-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScreen.java
175 lines (136 loc) · 4.04 KB
/
Screen.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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
class Screen implements Runnable, KeyListener, WindowListener, MouseListener {
public final String TITLE = "Musical Guac";
public final Dimension SIZE = new Dimension(1920, 1080); //SETS WINDOW DIMENSION
public JFrame window;
private int fontSize=300;
private Rectangle choice1;
private Rectangle choice2;
private Rectangle choice3;
private Rectangle tong;
private Image imgbuffer;
private boolean change;
private boolean isrunner, isdoner;
public void setChange(boolean change) {
this.change = change;
}
public Screen(){
choice1= new Rectangle(400,600,1000,100);
choice2=new Rectangle(400,700,1000,100);
choice3=new Rectangle(400,800,1000,100);
window=new JFrame();
window.setSize(SIZE);
window.setTitle(TITLE);
window.setVisible(true);
window.setLayout(null);
isrunner=true;
isdoner=false;
setChange(true);
imgbuffer = window.createImage(SIZE.width, SIZE.height);
}
public void run() {
while(isrunner){
vicks();
if(change){
setChange(false);
}
try{Thread.sleep(10000);}
catch(InterruptedException ie){
ie.printStackTrace();
}
}
isdoner = true;
}
private void vicks(){
Graphics2D g2d = (Graphics2D) imgbuffer.getGraphics();
g2d.setColor(Color.black);
g2d.fillRect(0, 0, SIZE.width, SIZE.height); //actually fills screen
g2d.setFont(new Font("chiller",Font.BOLD, fontSize));
g2d.setColor(Color.green);
g2d.draw(choice1);
g2d.draw(choice2);
g2d.draw(choice3);
g2d.drawString("MUSICAL", 300, 300);
g2d.drawString("GUACAMOLE", 300,500);
g2d.setFont(new Font("chiller",Font.BOLD, 100));
g2d.drawString("PLAY", 800, 890);
g2d.drawString("CREDITS",740, 690);
g2d.drawString("OPTIONS",740,790);
g2d = (Graphics2D) window.getGraphics();
if(isrunner)
g2d = (Graphics2D) window.getGraphics();
g2d.drawImage(imgbuffer, 0, 0, SIZE.width, SIZE.height, 0, 0, SIZE.width, SIZE.height, null);
if(hitbox whatever){
g2d.setFont(new Font("chiller", Font.BOLD, fontSize));
g2d.drawString("ALEX YU DAB", 300, 300);
}
g2d.dispose();
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
}