Diff
Not logged in

Differences From Artifact [1dc5dff936083189]:

To Artifact [8bca70d55515c665]:


1 import dfl.all; 1 import dfl.all; 2 import util; 2 import util; 3 import game; 3 import game; 4 import output; 4 import output; > 5 //import solver; 5 6 6 class GUI : Form 7 class GUI : Form 7 { 8 { 8 private { 9 private { 9 Game g; 10 Game g; 10 int cell; 11 int cell; 11 int turn = 0; 12 int turn = 0; ................................................................................................................................................................................ 20 noMessageFilter(); 21 noMessageFilter(); 21 this.setStyle(ControlStyles.OPAQUE, true); 22 this.setStyle(ControlStyles.OPAQUE, true); 22 this.g = g; 23 this.g = g; 23 24 24 this.paint ~= &my_paint; 25 this.paint ~= &my_paint; 25 this.keyDown ~= &my_keydown; 26 this.keyDown ~= &my_keydown; 26 27 27 const MAX_SIZE = 640; < 28 this.formBorderStyle = FormBorderStyle.FIXED_DIALOG; 28 this.formBorderStyle = FormBorderStyle.FIXED_DIALOG; 29 this.maximizeBox = false; 29 this.maximizeBox = false; 30 this.minimizeBox = false; 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 this.clientSize = Size(g.map.W*cell, g.map.H*cell); 32 this.clientSize = Size(g.map.W*cell, g.map.H*cell); 33 set_text(); 33 set_text(); 34 34 35 // Resources 35 // Resources 36 this.font = new Font("MS Gothic", cell-2, GraphicsUnit.PIXEL); 36 this.font = new Font("MS Gothic", cell-2, GraphicsUnit.PIXEL); 37 this.backColor = Color(255,255,255); 37 this.backColor = Color(255,255,255); 38 this.colors['#'] = 38 this.colors['#'] = ................................................................................................................................................................................ 92 { 92 { 93 case Keys.DOWN: g.command('D'); break; 93 case Keys.DOWN: g.command('D'); break; 94 case Keys.UP: g.command('U'); break; 94 case Keys.UP: g.command('U'); break; 95 case Keys.LEFT: g.command('L'); break; 95 case Keys.LEFT: g.command('L'); break; 96 case Keys.RIGHT: g.command('R'); break; 96 case Keys.RIGHT: g.command('R'); break; 97 case Keys.W: g.command('W'); break; 97 case Keys.W: g.command('W'); break; 98 case Keys.A: g.command('A'); break; 98 case Keys.A: g.command('A'); break; > 99 // case Keys.G: solver.act(g); break; 99 default: break; 100 default: break; 100 } 101 } 101 if(g.cleared) 102 if(g.cleared) 102 Application.exit(); 103 Application.exit(); 103 invalidate(); 104 invalidate(); 104 set_text(); 105 set_text(); 105 } 106 }