Differences From Artifact [1dc5dff936083189]:
- File
gui.d
- 2012-07-14 08:31:35 - part of checkin [a5e6c99b3d] on branch trunk - Guarded. (user: kinaba) [annotate]
To Artifact [8bca70d55515c665]:
- File
gui.d
- 2012-07-14 08:55:55 - part of checkin [69105bf94a] on branch trunk - Stand alone solver. (user: kinaba) [annotate]
- File
src/gui.d
- 2012-07-14 09:16:47 - part of checkin [6293256fec] on branch trunk - Preparing for submission... (user: kinaba) [annotate]
1 1 import dfl.all;
2 2 import util;
3 3 import game;
4 4 import output;
5 +//import solver;
5 6
6 7 class GUI : Form
7 8 {
8 9 private {
9 10 Game g;
10 11 int cell;
11 12 int turn = 0;
................................................................................
20 21 noMessageFilter();
21 22 this.setStyle(ControlStyles.OPAQUE, true);
22 23 this.g = g;
23 24
24 25 this.paint ~= &my_paint;
25 26 this.keyDown ~= &my_keydown;
26 27
27 - const MAX_SIZE = 640;
28 28 this.formBorderStyle = FormBorderStyle.FIXED_DIALOG;
29 29 this.maximizeBox = false;
30 30 this.minimizeBox = false;
31 - this.cell = MAX_SIZE / max(g.map.W, g.map.H);
31 + this.cell = min(1024/g.map.W, 640/g.map.H);
32 32 this.clientSize = Size(g.map.W*cell, g.map.H*cell);
33 33 set_text();
34 34
35 35 // Resources
36 36 this.font = new Font("MS Gothic", cell-2, GraphicsUnit.PIXEL);
37 37 this.backColor = Color(255,255,255);
38 38 this.colors['#'] =
................................................................................
92 92 {
93 93 case Keys.DOWN: g.command('D'); break;
94 94 case Keys.UP: g.command('U'); break;
95 95 case Keys.LEFT: g.command('L'); break;
96 96 case Keys.RIGHT: g.command('R'); break;
97 97 case Keys.W: g.command('W'); break;
98 98 case Keys.A: g.command('A'); break;
99 +// case Keys.G: solver.act(g); break;
99 100 default: break;
100 101 }
101 102 if(g.cleared)
102 103 Application.exit();
103 104 invalidate();
104 105 set_text();
105 106 }