made it like...work .

master
mgosselinUTC 2015-03-16 15:05:16 -04:00
parent efe8f6eb52
commit b75e2b3839
2 changed files with 15 additions and 17 deletions

View File

@ -9,9 +9,16 @@ import java.util.Random;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
/**
* simple little play toy to generate star like backgrounds. planned background
* for spacewars.
*
* @author mgosselin
*
*/
public class Main { public class Main {
private static Variable nameVar = new Variable("", "name", "0", false); private static Variable nameVar = new Variable("", "name", "0", false);
private static int stars = 10; private static int stars = 100;
private static BufferedImage buffer; private static BufferedImage buffer;
private static Graphics2D graphics; private static Graphics2D graphics;
@ -19,7 +26,7 @@ public class Main {
try { try {
//while (true) { //while (true) {
String name = "" + Integer.parseInt(nameVar.getValue()); String name = "" + Integer.parseInt(nameVar.getValue());
//nameVar.setValue("" + (Integer.parseInt(nameVar.getValue()) + 1)); nameVar.setValue("" + (Integer.parseInt(nameVar.getValue()) + 1));
Random rand = new Random(); Random rand = new Random();
buffer = new BufferedImage(1024, 600, 3); buffer = new BufferedImage(1024, 600, 3);
@ -33,7 +40,7 @@ public class Main {
for (int y = 0; y < HEIGHT; y++) { for (int y = 0; y < HEIGHT; y++) {
for (int x = 0; x < WIDTH; x++) { for (int x = 0; x < WIDTH; x++) {
int k = rand.nextInt(10); int k = rand.nextInt(20);
int r = 0 + k; int r = 0 + k;
int g = 0 + k; int g = 0 + k;
int b = 0 + k; int b = 0 + k;
@ -47,7 +54,7 @@ public class Main {
int size = MIN_STAR_SIZE + (int)(Math.random() * (MAX_STAR_SIZE - MIN_STAR_SIZE)); int size = MIN_STAR_SIZE + (int)(Math.random() * (MAX_STAR_SIZE - MIN_STAR_SIZE));
int r = (int)(Math.random() * 50); int r = (int)(Math.random() * 100);
int g = (int)(Math.random() * 50); int g = (int)(Math.random() * 50);
int b = (int)(Math.random() * 50); int b = (int)(Math.random() * 50);

View File

@ -6,10 +6,8 @@ import java.util.Formatter;
import java.util.Scanner; import java.util.Scanner;
/** /**
* to note, will not work on Mac yet. * helpful little class that creates a string variable that gets saved in application
* edit: WILL WORK ON MAC MOTHER FUCKERS * data. when you write to it, it gets saved as that file.
*
*
* @author Marcus * @author Marcus
* *
*/ */
@ -64,9 +62,8 @@ public class Variable {
String str = getValueFromFile(); String str = getValueFromFile();
// if we could not load a value from the file // if we could not load a value from the file
// AKA didnt fucking exist. // AKA didnt exist.
// ORRRRRRR if you were an ass, and forced // ORRRRRRR if you forced the value.
// the value.
if (str == null) { if (str == null) {
this.value = value; this.value = value;
saveValue(); saveValue();
@ -96,9 +93,6 @@ public class Variable {
f.format("" + value); f.format("" + value);
f.close(); f.close();
} catch (Exception e) { } catch (Exception e) {
// if(weArriveHere){
// we.are("fucked");
// }
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -115,9 +109,6 @@ public class Variable {
try { try {
f.createNewFile(); f.createNewFile();
} catch (IOException e) { } catch (IOException e) {
// if(weArriveHere){
// we.are("fucked");
// }
e.printStackTrace(); e.printStackTrace();
} }
} }