Diff
Not logged in

Differences From Artifact [d4577900b4db97c1]:

To Artifact [e84cacd6262f93a7]:


4 4 import driver; 5 5 6 6 class GUI(Solver) : Form, GameObserver 7 7 { 8 8 this(in Game g) 9 9 { 10 10 this.solver = new Solver(g); 11 - setup_size(g.map.W, g.map.H); 11 + setup_size(g.W, g.H); 12 12 setup_resources(g); 13 13 draw(g); 14 14 } 15 15 16 16 private void delegate(char c) fn; 17 17 void set_fn(F)(F f) { this.fn = f; } 18 18 ................................................................................ 79 79 this.render['\\'] = "λ"; 80 80 this.render['R'] = "☃"; 81 81 this.render['d'] = "☠"; 82 82 this.render['L'] = "☒"; 83 83 this.render['O'] = "☐"; 84 84 this.render['W'] = "ꔣ"; 85 85 this.render['!'] = "✄"; 86 - foreach(c,tp; g.map.tr_target) { 87 - char d = g.map[tp]; 88 - this.render[c] = [cast(dchar)('☢'+d-'1')].to!string(); 89 - } 86 + foreach(char c; 'A'..'J') this.render[c] = [cast(dchar)('☢'+g.trampoline(c)-'1')].to!string(); 90 87 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('☢'+c-'1')].to!string(); 91 88 this.paint ~= (Control c, PaintEventArgs ev) { 92 89 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientSize.width,this.clientSize.height)); 93 90 }; 94 91 } 95 92 96 93 void draw(in Game g) ................................................................................ 102 99 graphicContext.fillRectangle(this.backColor, Rect(0,0,scrW,scrH)); 103 100 104 101 // Fill water. 105 102 int w = g.water_level(); 106 103 graphicContext.fillRectangle(this.colors['w'], Rect(0, scrH-cell*w-1, scrW, cell*w+1)); 107 104 108 105 // Paint map. 109 - for(int y=1; y<=g.map.H; ++y) 110 - for(int x=1; x<=g.map.W; ++x) { 106 + for(int y=1; y<=g.H; ++y) 107 + for(int x=1; x<=g.W; ++x) { 111 108 Rect r = Rect(cell*(x-1), scrH-cell*y, cell, cell); 112 - char c = g.map[y,x]; 109 + char c = g[y,x]; 113 110 if( c != ' ' ) { 114 111 if( c == 'R' && g.dead ) 115 112 c = 'd'; 116 113 graphicContext.drawText(this.render[c], font, this.colors[c], r); 117 114 } 118 115 } 119 116 120 117 // Update textual info. 121 118 this.text = .text( 122 119 "Score: ", g.score, 123 120 " Air: ", g.hp, 124 121 " Tide: ", g.water_until_rise, 125 122 " Wadler: ", g.hige_until_rise, 126 - " Razor: ", g.map.razor); 123 + " Razor: ", g.num_razor); 127 124 invalidate(); 128 125 } 129 126 130 127 private: 131 128 void setup_keyhandling() 132 129 { 133 130 noMessageFilter();