Diff
Not logged in

Differences From Artifact [e84cacd6262f93a7]:

To Artifact [d4577900b4db97c1]:


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.W, g.H); 11 + setup_size(g.map.W, g.map.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(char c; 'A'..'J') this.render[c] = [cast(dchar)('☢'+g.trampoline(c)-'1')].to!string(); 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 + } 87 90 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('☢'+c-'1')].to!string(); 88 91 this.paint ~= (Control c, PaintEventArgs ev) { 89 92 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientSize.width,this.clientSize.height)); 90 93 }; 91 94 } 92 95 93 96 void draw(in Game g) ................................................................................ 99 102 graphicContext.fillRectangle(this.backColor, Rect(0,0,scrW,scrH)); 100 103 101 104 // Fill water. 102 105 int w = g.water_level(); 103 106 graphicContext.fillRectangle(this.colors['w'], Rect(0, scrH-cell*w-1, scrW, cell*w+1)); 104 107 105 108 // Paint map. 106 - for(int y=1; y<=g.H; ++y) 107 - for(int x=1; x<=g.W; ++x) { 109 + for(int y=1; y<=g.map.H; ++y) 110 + for(int x=1; x<=g.map.W; ++x) { 108 111 Rect r = Rect(cell*(x-1), scrH-cell*y, cell, cell); 109 - char c = g[y,x]; 112 + char c = g.map[y,x]; 110 113 if( c != ' ' ) { 111 114 if( c == 'R' && g.dead ) 112 115 c = 'd'; 113 116 graphicContext.drawText(this.render[c], font, this.colors[c], r); 114 117 } 115 118 } 116 119 117 120 // Update textual info. 118 121 this.text = .text( 119 122 "Score: ", g.score, 120 123 " Air: ", g.hp, 121 124 " Tide: ", g.water_until_rise, 122 125 " Wadler: ", g.hige_until_rise, 123 - " Razor: ", g.num_razor); 126 + " Razor: ", g.map.razor); 124 127 invalidate(); 125 128 } 126 129 127 130 private: 128 131 void setup_keyhandling() 129 132 { 130 133 noMessageFilter();