-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.java
43 lines (31 loc) · 933 Bytes
/
Menu.java
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
import java.util.ArrayList;
import java.awt.Color;
import java.awt.Graphics;
public class Menu extends GameObject {
private Button[] buttons;
public Menu(int w, int h, int amount) {
super(500-w/2, 400-h/2, w, h);
buttons = new Button[amount];
for(int k=0;k<buttons.length;k++) {
buttons[k]=new Button(x,y,w,h,buttons.length,k);
}
}
public Menu() {
super(500-200, 400-200, 400, 400);
buttons = new Button[3];
for(int k=0;k<buttons.length;k++) {
buttons[k]=new Button(x,y,w,h,buttons.length,k);
}
}
public void update() {
}
public void draw(Graphics pen) {
pen.setColor(Color.gray);
pen.fillRect(x, y, w, h);
pen.setColor(Color.BLACK);
pen.drawRect(x, y, w, h);
for(Button b: buttons) {
b.draw(pen);
}
}
}