comparison game/Engine.java @ 173:8995a0363e0a

Remove secret.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Mar 2017 11:02:46 +0200
parents 5070e57ebbfc
children 55ea5821c802
comparison
equal deleted inserted replaced
172:f664e851bc07 173:8995a0363e0a
21 21
22 22
23 class AboutBox extends IDMWidget 23 class AboutBox extends IDMWidget
24 { 24 {
25 BufferedImage aboutImg; 25 BufferedImage aboutImg;
26 boolean aboutSecret;
27 26
28 public AboutBox() 27 public AboutBox()
29 { 28 {
30 try {
31 ResourceLoader res = new ResourceLoader("graphics/girl.jpg");
32 aboutImg = ImageIO.read(res.getStream());
33 }
34 catch (IOException e)
35 {
36 }
37
38 aboutSecret = false;
39
40 setPos(150f, 150f); 29 setPos(150f, 150f);
41 setSize(720f, 420f); 30 setSize(720f, 420f);
42 } 31 }
43 32
44 public void paint(Graphics2D g) 33 public void paint(Graphics2D g)
46 g.setPaint(new Color(0.0f, 0.0f, 0.0f, 0.7f)); 35 g.setPaint(new Color(0.0f, 0.0f, 0.0f, 0.7f));
47 g.fill(new RoundRectangle2D.Float(getScaledX(), getScaledY(), getScaledWidth(), getScaledHeight(), 10, 10)); 36 g.fill(new RoundRectangle2D.Float(getScaledX(), getScaledY(), getScaledWidth(), getScaledHeight(), 10, 10));
48 37
49 setTextFont(G.fonts[3], G.metrics[3]); 38 setTextFont(G.fonts[3], G.metrics[3]);
50 setTextPaint(Color.white); 39 setTextPaint(Color.white);
51 40 setCurrPosScaledRel(20, 35);
52 setCurrPosScaledRel(20, 30);
53 drawString(g, "RistiPolku (CrossPaths) v"+ G.version +"\n"); 41 drawString(g, "RistiPolku (CrossPaths) v"+ G.version +"\n");
54 42
55 setTextFont(G.fonts[1], G.metrics[1]); 43 setTextFont(G.fonts[1], G.metrics[1]);
56 if (aboutSecret) 44 setTextPaint(Color.yellow);
57 { 45 drawString(g, "(c) Copyright 2011 Tecnic Software productions (TNSP)\n");
58 g.drawImage(aboutImg, (int) getScaledRelX(20), (int) getScaledRelY(55), 46
59 aboutImg.getWidth(), aboutImg.getHeight(), null); 47 setTextPaint(Color.white);
60 48 drawString(g, "Programming, graphics and design by " +
61 setCurrPosScaledRel(225, 75); 49 "Matti 'ccr' Hämäläinen.\n" +
62 drawString(g, 50 "Audio from archive.org, used non-commercially.\n \n");
63 "Dedicated to my\n" + 51
64 "favorite woman\n" + 52 setTextPaint(Color.red);
65 "in the world."); 53 drawString(g, "Controls:\n");
66 54
67 setCurrPosScaledRel(370, 175); 55 IDMPoint old = textCurrOffs.copy();
68 drawString(g, "- Matti"); 56
69 } 57 setTextPaint(Color.white);
70 else 58 drawString(g,
71 { 59 "Arrow keys / mouse wheel\n"+
72 setTextPaint(Color.yellow); 60 "Enter / mouse click\n"+
73 drawString(g, "(c) Copyright 2011 Tecnic Software productions (TNSP)\n"); 61 "Space bar\n");
74 62
75 setTextPaint(Color.white); 63 textCurrPos.x += getScaledX(330);
76 drawString(g, "Programming, graphics and design by " + 64 textCurrOffs.y = old.y;
77 "Matti 'ccr' Hämäläinen.\n" + 65 drawString(g,
78 "Audio from archive.org, used non-commercially.\n \n"); 66 "- Rotate piece\n" +
79 67 "- Place/lock piece\n" +
80 setTextPaint(Color.red); 68 "- Swap piece\n");
81 drawString(g, "Controls:\n"); 69
82 70 textCurrPos.x -= getScaledX(330);
83 IDMPoint old = textCurrOffs.copy(); 71 setTextPaint(Color.green);
84 72 drawString(g,
85 setTextPaint(Color.white); 73 "\nObjective: Create a path long as possible by rotating\n"+
86 drawString(g, 74 "and placing pieces. More points will be awarded for\n"+
87 "Arrow keys / mouse wheel\n"+ 75 "advancing the path by several segments per turn."
88 "Enter / mouse click\n"+ 76 );
89 "Space bar\n");
90
91 textCurrPos.x += getScaledX(330);
92 textCurrOffs.y = old.y;
93 drawString(g,
94 "- Rotate piece\n" +
95 "- Place/lock piece\n" +
96 "- Swap piece\n");
97
98 textCurrPos.x -= getScaledX(330);
99 setTextPaint(Color.green);
100 drawString(g,
101 "\nObjective: Create a path long as possible by rotating\n"+
102 "and placing pieces. More points will be awarded for\n"+
103 "advancing the path by several segments per turn."
104 );
105 }
106 } 77 }
107 78
108 public boolean keyPressed(KeyEvent e) 79 public boolean keyPressed(KeyEvent e)
109 { 80 {
110 if (e.getKeyCode() == KeyEvent.VK_L) 81 clicked();
111 {
112 aboutSecret = true;
113 }
114 else
115 {
116 clicked();
117 aboutSecret = false;
118 }
119 return true; 82 return true;
120 } 83 }
121 84
122 public void clicked() 85 public void clicked()
123 { 86 {