Skip to content
Permalink
911cc8d56f
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
91 lines (77 sloc) 1.98 KB
class Menu{
ArrayList<Button> _buttonList;
Menu(){
_buttonList = new ArrayList<Button>();
makeButtons();
}
void draw(){
for(Button b: _buttonList) {
b.draw();
}
}
boolean mousePressed(){
boolean result = false;
for(Button b: _buttonList) {
boolean check = b.isMouseOver();
if(check) {
result = true;
for(Button b0: _buttonList) {
b0.unSelect();
}
b.Select();
break;
}
}
return result;
}
void mouseDragged() {
selector.stretchSelection();
}
void mouseReleased() {
selector.resetSelection();
}
void makeButtons() {
int y = 50;
Button cirS = new Button (0, y, "Circ Sel");
y += i_buttonHeight + 10;
_buttonList.add(cirS);
cirS.addHandler(new CirSHandler());
Button rectS = new Button (0, y, "Rect Sel");
y += i_buttonHeight + 10;
_buttonList.add(rectS);
rectS.addHandler(new RectSHandler());
Button pan = new Button (0, y, "Pan");
y += i_buttonHeight + 10;
_buttonList.add(pan);
pan.addHandler(new PanHandler());
//Button rot = new Button (0, y, "Rotate");
//y += i_buttonHeight + 10;
//_buttonList.add(rot);
//rot.addHandler(new RotHandler());
Button place = new Button (0, y, "Place");
y += i_buttonHeight + 10;
_buttonList.add(place);
place.addHandler(new PlaceHandler());
place.Select();
}
}
void drawHelpMenu() {
float hwidth = 400;
float hheight = 600;
pushStyle();
strokeWeight (i_helpStrokeWidth);
stroke(c_helpStroke);
fill(c_helpBackground);
rect(width/2 - hwidth/2, height/2 - hheight/2, hwidth, hheight, 50, 50, 50, 50);
textSize(40);
fill(c_helpText);
text("Help:", width/2 - 50, height/2 - hheight/2 + 50);
textSize (30);
float x = width/2 - 150;
float y = height/2 - hheight/2 + 100;
for (int i = 0; i < i_helpStrings; i++) {
text(s_helpStrings[i], x, y);
y += 35;
}
popStyle();
}