- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp.java
More file actions
Latest commit
75 lines (59 loc) · 1.73 KB
/
Copy pathHelp.java
File metadata and controls
75 lines (59 loc) · 1.73 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
72
73
74
75
packageSaueSpillet;
importjava.awt.Color;
importjava.awt.Font;
importjava.awt.Graphics;
importjava.awt.Graphics2D;
importjava.awt.Image;
importjava.awt.event.MouseAdapter;
importjava.awt.event.MouseEvent;
importjavax.swing.ImageIcon;
publicclassHelpextendsMouseAdapter {
privateGamegame;
privateHandlerhandler;
privateImagebackgroundPic;
privateImagehelpPic;
publicHelp(Gamegame, Handlerhandler) {
this.game = game;
this.handler = handler;
loadpic();
}
publicvoidmousePressed(MouseEvente) {
intmx = e.getX();
intmy = e.getY();
if (Game.gameState == Game.State.Help) {
if (Menu.mouseOver(mx, my, 100, 400, 200, 64)) {
Game.gameState = Game.State.Menu;
}
}
}
publicvoidmouseReleased(MouseEvente) {
}
publicvoidloadpic() {
backgroundPic = newImageIcon(
"C:\\Users\\Sjur\\tdt4100-2018-master\\git\\tdt4100-2018\\minegenkode\\GamepackRes\\sheeps.png")
.getImage();
helpPic = newImageIcon(
"C:\\Users\\Sjur\\tdt4100-2018-master\\git\\tdt4100-2018\\minegenkode\\GamepackRes\\Help.png")
.getImage();
}
publicvoidtick() {
}
publicvoidrender(Graphicsg) {
Fontfnt = newFont("arial", 1, 50);
Fontfn2 = newFont("arial", 1, 30);
g.drawImage(backgroundPic, 0,0,null);
g.drawImage(helpPic, 800, 0, null);
g.setColor(Color.white);
g.setFont(fn2);
g.drawString("Du er en taper,", 100, 280);
g.drawString("kun tapere leser hjelp siden", 100, 330);
Graphics2Dg2d = (Graphics2D) g;
g.setFont(fnt);
g2d.setComposite(Menu.makeTransparent(0.5f));
g.setColor(newColor(210,105,30));
g.fillRect(100, 400, 200, 64);
g2d.setComposite(Menu.makeTransparent(1));
g.setColor(newColor(124,252,0));
g.drawString("Back", 140, 450);
}
}