Noobie OOP Question.
in
Programming Questions
•
2 years ago
I am trying to make a starting screen for a game with Object-Oriented Programming. It is pretty much my first shot at OOP so I am obviously having some problems. Processing highlights the yellow area and says "Syntax error, maybe a missing semicolon?" What's the problem? There is a semicolon there so...
PFont f;
class Button{
int X1; //Coordinates for rectangle.
int Y1;
int X2 = X1+200;
int Y2 = Y1+30;
int XB = X1+10; //Coordinates for text in rectangle
int YB = Y1+10;
String buttonText; //String for actual text of button
Button(){ //Constructor method
rect(X1,Y1,X2,Y2); //Outline of Button
textFont(f,24); //Establishing font and text
fill(0);
text(buttonText,XB,YB);
}
}
void setup(){
size(400,400); //Screen size
f = loadFont("Dialog-48.vlw"); //Loading font
Button startGame = new Button; //New "Start Game" Button.
X1=10;
Y1=10;
this.X2=X2;
this.Y2=Y2;
this.XB=Xb;
this.YB=YB;
buttonText = "Start Game";
//Button options = new Button;
//Button about = new Button;
}
void draw(){
}
1