-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWelcomeScreen.java
More file actions
59 lines (46 loc) · 961 Bytes
/
WelcomeScreen.java
File metadata and controls
59 lines (46 loc) · 961 Bytes
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
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class WelcomeScreen extends Screen
{
public static Image img = ImageLoader.loadCompatibleImage("mario.png");
private int x, y;
public WelcomeScreen(GameState s, int w, int h) {
super(s, w, h);
}
public void render(Graphics g) {
g.setFont(new Font("Geneva", Font.BOLD, 42));
g.setColor(Color.BLUE);
g.drawImage(img, 0, 0, null);
g.drawString("Press Enter to Play", x, y);
}
public void update() {
x++;
y++;
if(x > width)
x = 0;
if(y > height)
y = 0;
}
public void keyPressed(KeyEvent e)
{
int code = e.getKeyCode();
if(code == KeyEvent.VK_ENTER)
state.switchToGameScreen();
}
public void keyReleased(KeyEvent e)
{
}
public void mousePressed(Point2D p)
{
}
public void mouseReleased(Point2D p)
{
}
public void mouseMoved(Point2D p)
{
}
public void mouseDragged(Point2D p)
{
}
}