Differences From Artifact [bcbc7e6a97423060]:
- File
src/gui.d
- 2012-07-14 16:04:29 - part of checkin [0c10424b3c] on branch trunk - Minor fix for danger avoidance. (user: kinaba) [annotate]
To Artifact [6f9d0f82c55a2152]:
- File
src/gui.d
- 2012-07-14 16:07:05 - part of checkin [db3405fee7] on branch trunk - Not to responde keyboard when auto-gui mode. (user: kinaba) [annotate]
6 class GUI(Solver) : Form, GameObserver 6 class GUI(Solver) : Form, GameObserver
7 { 7 {
8 this(in Game g) 8 this(in Game g)
9 { 9 {
10 this.solver = new Solver(g); 10 this.solver = new Solver(g);
11 setup_size(g.map.W, g.map.H); 11 setup_size(g.map.W, g.map.H);
12 setup_resources(); 12 setup_resources();
13 setup_keyhandling(); <
14 draw(g); 13 draw(g);
15 } 14 }
16 15
17 private void delegate(char c) fn; 16 private void delegate(char c) fn;
18 void set_fn(F)(F f) { this.fn = f; } 17 void set_fn(F)(F f) { this.fn = f; }
19 18
20 void run(bool automate = false) 19 void run(bool automate = false)
................................................................................................................................................................................
23 Timer t = new Timer; 22 Timer t = new Timer;
24 t.interval = 50; 23 t.interval = 50;
25 t.tick ~= (Timer sender, EventArgs ea){ 24 t.tick ~= (Timer sender, EventArgs ea){
26 fn(solver.single_step()); 25 fn(solver.single_step());
27 }; 26 };
28 t.start(); 27 t.start();
29 this.closing ~= (Form f,CancelEventArgs c){t.stop();}; 28 this.closing ~= (Form f,CancelEventArgs c){t.stop();};
> 29 } else {
> 30 setup_keyhandling();
30 } 31 }
31 Application.run(this); 32 Application.run(this);
32 } 33 }
33 34
34 override void on_game_changed(char c, in Game g, bool finished) 35 override void on_game_changed(char c, in Game g, bool finished)
35 { 36 {
36 draw(g); 37 draw(g);