-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPauseMenu.pde
More file actions
executable file
·71 lines (61 loc) · 1.94 KB
/
Copy pathPauseMenu.pde
File metadata and controls
executable file
·71 lines (61 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class PauseMenu{
boolean position = false;
int rectX = width/2 - 50;
int rectY = 300;
//Um... an exit button and a resume button, I guess.
//And, of course, code copied from the menu for the actual handling of the selection.
void draw(){
if(z_key == 1){
z_key++;
if(position == false){
manager.resume();
gameState = 2;
}else if(position == true){
gameState = 0;
manager.reset();
}
}
if(esc_key == 1){
println("into the esc branch of pause");
esc_key++;
gameState = 2;
manager.resume();
position = false;
}
drawMenu();
}
void drawMenu(){
//Take key input
if(up_key == 1){position = false; up_key++;}
if(down_key == 1){position = true; down_key++;}
noStroke();
fill(0, 0, 0, 127);
rectMode(CORNERS);
rect(0, 0, width, height);
//Move that blasted rectangle
int targetloc = position ? 350 : 300;
rectY = (int)((rectY + targetloc) / 2 + 3 >= 350 && (rectY + targetloc) / 2 - 3 <= targetloc ? targetloc : (rectY + targetloc) / 2);
rectX = width/2;
//Draw stuff
strokeWeight(0);
textAlign(CENTER, CENTER);
textSize(30);
fill(255);
text("Paused",width/2, 200);
fill(60, 140, 200);
rectMode(CENTER);
rect(rectX, rectY, 100, 50);
fill(255);
textSize(20);
text("Resume", width/2, 300);
textSize(15);
text("Exit", width/2, 350);
textAlign(LEFT, CENTER);
text("Z to select", rectX + 80, rectY);
}
void reset(){
position = false;
rectX = width/2 - 50;
rectY = 300;
}
}