Differences From Artifact [19a06a471eb23a83]:
- File
src/gui.d
- 2012-07-14 18:16:22 - part of checkin [d782a7db12] on branch trunk - More cute glyph. (user: kinaba) [annotate]
To Artifact [3be06eef4f2a58fa]:
- File
src/gui.d
- 2012-07-15 01:58:08 - part of checkin [9d983af88c] on branch trunk - Hige parsing and rendering. (user: kinaba) [annotate]
64 this.colors['.'] = Color(255,191,127); 64 this.colors['.'] = Color(255,191,127);
65 this.colors['*'] = Color(255,127,127); 65 this.colors['*'] = Color(255,127,127);
66 this.colors['R'] = Color(128,128,0); 66 this.colors['R'] = Color(128,128,0);
67 this.colors['d'] = Color(255,0,0); 67 this.colors['d'] = Color(255,0,0);
68 this.colors['\\'] = 68 this.colors['\\'] =
69 this.colors['L'] = 69 this.colors['L'] =
70 this.colors['O'] = Color(127,255,127); 70 this.colors['O'] = Color(127,255,127);
> 71 this.colors['w'] = Color(204,229,255);
71 this.colors['W'] = Color(204,229,255); | 72 this.colors['W'] =
> 73 this.colors['!'] = Color(159,159,159);
72 foreach(char c; 'A'..'J') this.colors[c] = Color(142,142,255); 74 foreach(char c; 'A'..'J') this.colors[c] = Color(142,142,255);
73 foreach(char c; '1'..':') this.colors[c] = Color(255,142,255); 75 foreach(char c; '1'..':') this.colors[c] = Color(255,142,255);
74 this.render['#'] = "■"; 76 this.render['#'] = "■";
75 this.render['*'] = "✹"; 77 this.render['*'] = "✹";
76 this.render['.'] = "♒"; 78 this.render['.'] = "♒";
77 this.render['\\'] = "λ"; 79 this.render['\\'] = "λ";
78 this.render['R'] = "☃"; 80 this.render['R'] = "☃";
79 this.render['d'] = "☠"; 81 this.render['d'] = "☠";
80 this.render['L'] = "☒"; 82 this.render['L'] = "☒";
81 this.render['O'] = "☐"; 83 this.render['O'] = "☐";
> 84 this.render['W'] = "ꔣ";
> 85 this.render['!'] = "✄";
82 foreach(c,tp; g.map.tr_target) { 86 foreach(c,tp; g.map.tr_target) {
83 char d = g.map[tp]; 87 char d = g.map[tp];
84 this.render[c] = [cast(dchar)('☢'+d-'1')].to!string();/* | 88 this.render[c] = [cast(dchar)('☢'+d-'1')].to!string();
85 } 89 }
86 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('☢'+c-'1 90 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('☢'+c-'1
87 this.paint ~= (Control c, PaintEventArgs ev) { 91 this.paint ~= (Control c, PaintEventArgs ev) {
88 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientS 92 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientS
89 }; 93 };
90 } 94 }
91 95
................................................................................................................................................................................
95 int scrH = this.clientSize.height; 99 int scrH = this.clientSize.height;
96 100
97 // Fill bg. 101 // Fill bg.
98 graphicContext.fillRectangle(this.backColor, Rect(0,0,scrW,scrH) 102 graphicContext.fillRectangle(this.backColor, Rect(0,0,scrW,scrH)
99 103
100 // Fill water. 104 // Fill water.
101 int w = g.water_level(); 105 int w = g.water_level();
102 graphicContext.fillRectangle(this.colors['W'], Rect(0, scrH-cell | 106 graphicContext.fillRectangle(this.colors['w'], Rect(0, scrH-cell
103 107
104 // Paint map. 108 // Paint map.
105 for(int y=1; y<=g.map.H; ++y) 109 for(int y=1; y<=g.map.H; ++y)
106 for(int x=1; x<=g.map.W; ++x) { 110 for(int x=1; x<=g.map.W; ++x) {
107 Rect r = Rect(cell*(x-1), scrH-cell*y, cell, cell); 111 Rect r = Rect(cell*(x-1), scrH-cell*y, cell, cell);
108 char c = g.map[y,x]; 112 char c = g.map[y,x];
109 if( c != ' ' ) { 113 if( c != ' ' ) {
................................................................................................................................................................................
110 if( c == 'R' && g.dead ) 114 if( c == 'R' && g.dead )
111 c = 'd'; 115 c = 'd';
112 graphicContext.drawText(this.render[c], font, th 116 graphicContext.drawText(this.render[c], font, th
113 } 117 }
114 } 118 }
115 119
116 // Update textual info. 120 // Update textual info.
> 121 this.text = .text(
> 122 "Score: ", g.score,
> 123 " Air: ", g.hp,
117 this.text = .text("Score: ", g.score, " Air: ", g.hp, " Tide: ", | 124 " Tide: ", g.water_until_rise,
> 125 " Wadler: ", g.hige_until_rise,
> 126 " Razor: ", g.map.razor);
118 invalidate(); 127 invalidate();
119 } 128 }
120 129
121 private: 130 private:
122 void setup_keyhandling() 131 void setup_keyhandling()
123 { 132 {
124 noMessageFilter(); 133 noMessageFilter();