rev |
line source |
paulo@0
|
1 /*
|
paulo@0
|
2
|
paulo@0
|
3 BGCTRL layout
|
paulo@0
|
4 Layer 0: Current menu
|
paulo@0
|
5 Layer 1: Menu that is fading away
|
paulo@0
|
6 Layer 2: Gradient background
|
paulo@0
|
7
|
paulo@0
|
8 VRAM layout
|
paulo@0
|
9 (1 map == 64 tiles)
|
paulo@0
|
10 Tiles 0.000-2FF: layer 0 bitmap
|
paulo@0
|
11 Tiles 0.300-3FF: unused
|
paulo@0
|
12 Tiles 2.000-2FF: layer 1 bitmap
|
paulo@0
|
13 Tiles 2.300-33F: unused
|
paulo@0
|
14 Tiles 2.340-36F: map 29 (layer 2)
|
paulo@0
|
15 Tiles 2.370-37F: layer 2 gradient tiles
|
paulo@0
|
16 Tiles 2.380-3FF: layer 0 map
|
paulo@0
|
17 Tiles 2.3C0-3FF: layer 1 map
|
paulo@0
|
18
|
paulo@0
|
19
|
paulo@0
|
20 */
|
paulo@0
|
21
|
paulo@0
|
22 #include <stdint.h>
|
paulo@0
|
23 #include <string.h>
|
paulo@0
|
24 #include "fontdraw.h"
|
paulo@0
|
25 typedef u32 TileSliver;
|
paulo@0
|
26
|
paulo@0
|
27 #ifdef ARM9
|
paulo@0
|
28 #include <nds.h>
|
paulo@0
|
29 #define MENU_GFX_CORE 1
|
paulo@0
|
30 #define MENU_GFX_VRAM(bank, tile) (TileSliver *)(BG_TILE_RAM_SUB(bank) + 32 * tile)
|
paulo@0
|
31 #define MENU_GFX_MAP ((NAMETABLE *)0x06200000)
|
paulo@0
|
32 #define MENU_GFX_BGCTRL BGCTRL_SUB
|
paulo@0
|
33 #define MENU_GFX_OFFSET ((bg_scroll *)(0x04001010))
|
paulo@0
|
34 #define HIDDEN_ROWS 0
|
paulo@0
|
35 #define HIDDEN_COLS 0
|
paulo@0
|
36 #define BG0_ON DISPLAY_BG0_ACTIVE
|
paulo@0
|
37 #define BG1_ON DISPLAY_BG1_ACTIVE
|
paulo@0
|
38 #define BG2_ON DISPLAY_BG2_ACTIVE
|
paulo@0
|
39 #define videoSetModeMenu(x) videoSetModeSub(x)
|
paulo@0
|
40 #define MENU_GFX_PALETTE BG_PALETTE_SUB
|
paulo@0
|
41 #define USING_TOUCH 1
|
paulo@0
|
42 #else
|
paulo@0
|
43 #include <gba.h>
|
paulo@0
|
44 #define MENU_GFX_CORE 0
|
paulo@0
|
45 #define MENU_GFX_VRAM(bank, tile) (TileSliver *)PATRAM4(bank, tile)
|
paulo@0
|
46 #define MENU_GFX_MAP MAP
|
paulo@0
|
47 #define MENU_GFX_BGCTRL BGCTRL
|
paulo@0
|
48 #define MENU_GFX_OFFSET BG_OFFSET
|
paulo@0
|
49 #define HIDDEN_ROWS 2
|
paulo@0
|
50 #define HIDDEN_COLS 1
|
paulo@0
|
51 #define videoSetModeMenu(x) (REG_DISPCNT = x)
|
paulo@0
|
52 #define MODE_0_2D 0
|
paulo@0
|
53 #define MENU_GFX_PALETTE BG_PALETTE
|
paulo@0
|
54 #define USING_TOUCH 0
|
paulo@0
|
55 #endif
|
paulo@0
|
56
|
paulo@0
|
57 static const VWFWindow vwfLayer0 = {
|
paulo@0
|
58 .left = 0, .top = 0, .width = 32, .height = 24,
|
paulo@0
|
59 .chrBase = MENU_GFX_VRAM(0, 0),
|
paulo@0
|
60 .map = 30,
|
paulo@0
|
61 .core = MENU_GFX_CORE,
|
paulo@0
|
62 .mapTileBase = 0
|
paulo@0
|
63 };
|
paulo@0
|
64
|
paulo@0
|
65 static const VWFWindow vwfLayer1 = {
|
paulo@0
|
66 .left = 0, .top = 0, .width = 32, .height = 24,
|
paulo@0
|
67 .chrBase = MENU_GFX_VRAM(2, 0),
|
paulo@0
|
68 .map = 31,
|
paulo@0
|
69 .core = MENU_GFX_CORE,
|
paulo@0
|
70 .mapTileBase = 0
|
paulo@0
|
71 };
|
paulo@0
|
72
|
paulo@0
|
73
|
paulo@0
|
74 void vsync(void);
|
paulo@0
|
75
|
paulo@0
|
76 static const TileSliver gradientBackgroundDelta[8] = {
|
paulo@0
|
77 0x00000000,
|
paulo@0
|
78 0x10101010,
|
paulo@0
|
79 0x00000000,
|
paulo@0
|
80 0x01010101,
|
paulo@0
|
81 0x10101010,
|
paulo@0
|
82 0x01010101,
|
paulo@0
|
83 0x11111111,
|
paulo@0
|
84 0x10101010
|
paulo@0
|
85 };
|
paulo@0
|
86
|
paulo@0
|
87 /* Makes 12 gradient background tiles starting at dst.
|
paulo@0
|
88 */
|
paulo@0
|
89
|
paulo@0
|
90 static void makeGradientBackgroundTiles(TileSliver *dst) {
|
paulo@0
|
91 for (TileSliver tile = 0x11111111;
|
paulo@0
|
92 tile < 0xDDDDDDDD;
|
paulo@0
|
93 tile += 0x11111111) {
|
paulo@0
|
94 for (unsigned int y = 0; y < 8; ++y) {
|
paulo@0
|
95 *dst++ = tile + gradientBackgroundDelta[y];
|
paulo@0
|
96 }
|
paulo@0
|
97 }
|
paulo@0
|
98 }
|
paulo@0
|
99
|
paulo@0
|
100 static void makeLayer2(void) {
|
paulo@0
|
101 makeGradientBackgroundTiles(MENU_GFX_VRAM(2, 0x300));
|
paulo@0
|
102 for (int y = 0; y < 12; ++y) {
|
paulo@0
|
103 for (int x = 0; x < 32; ++x) {
|
paulo@0
|
104 MENU_GFX_MAP[29][y][x] = 0xE300 + y;
|
paulo@0
|
105 }
|
paulo@0
|
106 }
|
paulo@0
|
107 for (int y = 0; y < 12; ++y) {
|
paulo@0
|
108 for (int x = 0; x < 32; ++x) {
|
paulo@0
|
109 MENU_GFX_MAP[29][y + 12][x] = 0xF300 + y;
|
paulo@0
|
110 }
|
paulo@0
|
111 }
|
paulo@0
|
112 MENU_GFX_BGCTRL[2] = BG_TILE_BASE(2) | BG_MAP_BASE(29);
|
paulo@0
|
113 MENU_GFX_OFFSET[2].x = HIDDEN_COLS * 8;
|
paulo@0
|
114 MENU_GFX_OFFSET[2].y = HIDDEN_ROWS * 8;
|
paulo@0
|
115 }
|
paulo@0
|
116
|
paulo@0
|
117
|
paulo@0
|
118
|
paulo@0
|
119 /*
|
paulo@0
|
120 Button palette:
|
paulo@0
|
121 0 transparent
|
paulo@0
|
122 1 White (button top)
|
paulo@0
|
123 2 Medium gray (button side)
|
paulo@0
|
124 3 Darkest gray (button bottom)
|
paulo@0
|
125 4 Light gray (button background)
|
paulo@0
|
126 5 Dark gray (button text aa, lower corner)
|
paulo@0
|
127 6 Black (button text)
|
paulo@0
|
128 7 Black
|
paulo@0
|
129
|
paulo@0
|
130 This comes in both ordinary and highlighted versions. There are two copies of the highlighted text.
|
paulo@0
|
131
|
paulo@0
|
132 */
|
paulo@0
|
133
|
paulo@0
|
134 static const TileSliver buttonSideTiles[16] = {
|
paulo@0
|
135 0x11111114,
|
paulo@0
|
136 0x11111142,
|
paulo@0
|
137 0x11111422,
|
paulo@0
|
138 0x44444222,
|
paulo@0
|
139 0x44444222,
|
paulo@0
|
140 0x44444222,
|
paulo@0
|
141 0x44444222,
|
paulo@0
|
142 0x44444222,
|
paulo@0
|
143 0x44444222,
|
paulo@0
|
144 0x44444222,
|
paulo@0
|
145 0x44444222,
|
paulo@0
|
146 0x44444222,
|
paulo@0
|
147 0x44444222,
|
paulo@0
|
148 0x33333522,
|
paulo@0
|
149 0x33333352,
|
paulo@0
|
150 0x33333335
|
paulo@0
|
151 };
|
paulo@0
|
152
|
paulo@0
|
153 static void loadButtonSideTiles(void) {
|
paulo@0
|
154 for (int bank = 0; bank <= 2; bank += 2) {
|
paulo@0
|
155 TileSliver *dst = MENU_GFX_VRAM(bank, 0x30C);
|
paulo@0
|
156 memcpy(dst, buttonSideTiles, 32);
|
paulo@0
|
157 memcpy(dst + 8, buttonSideTiles + 4, 32);
|
paulo@0
|
158 memcpy(dst + 16, buttonSideTiles + 8, 32);
|
paulo@0
|
159 }
|
paulo@0
|
160 }
|
paulo@0
|
161
|
paulo@0
|
162 static const u8 buttonIntensity[8] =
|
paulo@0
|
163 {28, 31, 23, 15, 28, 19, 0, 0};
|
paulo@0
|
164
|
paulo@0
|
165 /**
|
paulo@0
|
166 * Loads the unhighlighted (gray) button palette.
|
paulo@0
|
167 */
|
paulo@0
|
168 static void loadButtonPalette(void) {
|
paulo@0
|
169 for (int i = 0; i < 8; ++i) {
|
paulo@0
|
170 unsigned int intensity = buttonIntensity[i];
|
paulo@0
|
171
|
paulo@0
|
172 MENU_GFX_PALETTE[192 + i] = intensity * RGB5(1, 1, 1);
|
paulo@0
|
173 }
|
paulo@0
|
174 }
|
paulo@0
|
175
|
paulo@0
|
176 void ljmenu_setHilitePalette(int phase) {
|
paulo@0
|
177
|
paulo@0
|
178 // generate triangle wave
|
paulo@0
|
179 phase = (phase & 0x3F) ^ 0x20;
|
paulo@0
|
180 if (phase & 0x20) {
|
paulo@0
|
181 phase ^= 0x3F;
|
paulo@0
|
182 }
|
paulo@0
|
183
|
paulo@0
|
184 for (int i = 0; i < 8; ++i) {
|
paulo@0
|
185 int intensity = buttonIntensity[i];
|
paulo@0
|
186 int intensity34 = (3 * intensity) >> 2;
|
paulo@0
|
187 int rg = intensity34 + (phase >> 2) + 4;
|
paulo@0
|
188 int b = rg >> 1;
|
paulo@0
|
189 if (rg > 31) {
|
paulo@0
|
190 rg = 31;
|
paulo@0
|
191 }
|
paulo@0
|
192 unsigned int c = RGB5(1, 1, 0) * rg + RGB5(0, 0, 1) * b;
|
paulo@0
|
193
|
paulo@0
|
194 MENU_GFX_PALETTE[200 + i] = c;
|
paulo@0
|
195 MENU_GFX_PALETTE[208 + i] = c;
|
paulo@0
|
196 }
|
paulo@0
|
197 }
|
paulo@0
|
198
|
paulo@0
|
199 #define TILE_HFLIP 0x0400
|
paulo@0
|
200
|
paulo@0
|
201 void ljmenu_hiliteButton(int l, int t, int r, int b, int hilite) {
|
paulo@0
|
202 hilite = hilite ? 0xD000 : 0xC000;
|
paulo@0
|
203
|
paulo@0
|
204 /* Draw sides of button */
|
paulo@0
|
205 MENU_GFX_MAP[30][t][l] = 0x30C | hilite;
|
paulo@0
|
206 MENU_GFX_MAP[30][t][r - 1] = 0x30C | TILE_HFLIP | hilite;
|
paulo@0
|
207 for (int y = t + 1; y < b - 1; ++y) {
|
paulo@0
|
208 MENU_GFX_MAP[30][y][l] = 0x30D | hilite;
|
paulo@0
|
209 MENU_GFX_MAP[30][y][r - 1] = 0x30D | TILE_HFLIP | hilite;
|
paulo@0
|
210 }
|
paulo@0
|
211 MENU_GFX_MAP[30][b - 1][l] = 0x30E | hilite;
|
paulo@0
|
212 MENU_GFX_MAP[30][b - 1][r - 1] = 0x30E | TILE_HFLIP | hilite;
|
paulo@0
|
213 vwfPutMap(&vwfLayer0, l + 1, t, r - 1, b, hilite);
|
paulo@0
|
214 }
|
paulo@0
|
215
|
paulo@0
|
216 void ljmenu_drawButton(int l, int t, int r, int b, const char *text) {
|
paulo@0
|
217 vwfRectfill(&vwfLayer0,
|
paulo@0
|
218 l * 8 + 8, t * 8, r * 8 - 8, t * 8 + 3, 1);
|
paulo@0
|
219 vwfRectfill(&vwfLayer0,
|
paulo@0
|
220 l * 8 + 8, t * 8 + 3, r * 8 - 8, b * 8 - 3, 4);
|
paulo@0
|
221 vwfRectfill(&vwfLayer0,
|
paulo@0
|
222 l * 8 + 8, b * 8 - 3, r * 8 - 8, b * 8, 3);
|
paulo@0
|
223
|
paulo@0
|
224 int w = fontdraw_strWidth(text);
|
paulo@0
|
225 int x = l * 8 + (r - l) * 4 - w / 2;
|
paulo@0
|
226 int y = t * 8 + (b - t) * 4 - 12 / 2;
|
paulo@0
|
227
|
paulo@0
|
228 vwfPuts(&vwfLayer0, text, x, y);
|
paulo@0
|
229 ljmenu_hiliteButton(l, t, r, b, 0);
|
paulo@0
|
230 }
|
paulo@0
|
231
|
paulo@0
|
232 static void makePalettes(void) {
|
paulo@0
|
233 // make background layer palettes
|
paulo@0
|
234 for (unsigned int i = 0; i <= 12; ++i) {
|
paulo@0
|
235 int blue = 2 * i;
|
paulo@0
|
236 MENU_GFX_PALETTE[225 + i]= RGB5(0, 0, blue);
|
paulo@0
|
237 }
|
paulo@0
|
238 for (unsigned int i = 0; i <= 12; ++i) {
|
paulo@0
|
239 int red = ((i + 9) * 3) >> 1;
|
paulo@0
|
240 MENU_GFX_PALETTE[241 + i]= RGB5(red, red / 2, 0);
|
paulo@0
|
241 }
|
paulo@0
|
242
|
paulo@0
|
243 MENU_GFX_PALETTE[1] = RGB5(21,21,23);
|
paulo@0
|
244 MENU_GFX_PALETTE[2] = RGB5(31,31,31);
|
paulo@0
|
245 MENU_GFX_PALETTE[3] = RGB5(31,31,31);
|
paulo@0
|
246 loadButtonPalette();
|
paulo@0
|
247 }
|
paulo@0
|
248
|
paulo@0
|
249 void ljmenu_cls(void) {
|
paulo@0
|
250 vwfWinInit(&vwfLayer0);
|
paulo@0
|
251 vwfPutMap(&vwfLayer0, 2, 4, 30, 22, 0xC000);
|
paulo@0
|
252 }
|
paulo@0
|
253
|
paulo@0
|
254 void ljmenu_init(void) {
|
paulo@0
|
255 makeLayer2();
|
paulo@0
|
256 loadButtonSideTiles();
|
paulo@0
|
257 makePalettes();
|
paulo@0
|
258 ljmenu_cls();
|
paulo@0
|
259 MENU_GFX_BGCTRL[0] = BG_TILE_BASE(0) | BG_MAP_BASE(30);
|
paulo@0
|
260 MENU_GFX_OFFSET[0].x = HIDDEN_COLS * 8;
|
paulo@0
|
261 MENU_GFX_OFFSET[0].y = HIDDEN_ROWS * 8;
|
paulo@0
|
262 MENU_GFX_BGCTRL[1] = BG_TILE_BASE(2) | BG_MAP_BASE(31);
|
paulo@0
|
263 MENU_GFX_OFFSET[1].x = HIDDEN_COLS * 8;
|
paulo@0
|
264 MENU_GFX_OFFSET[1].y = HIDDEN_ROWS * 8;
|
paulo@0
|
265 videoSetModeMenu(MODE_0_2D | BG0_ON | BG1_ON | BG2_ON);
|
paulo@0
|
266 }
|
paulo@0
|
267
|
paulo@0
|
268 void ljmenu_freeze(void) {
|
paulo@0
|
269
|
paulo@0
|
270 // Copy background
|
paulo@0
|
271 memcpy(vwfLayer0.chrBase, vwfLayer1.chrBase, 240*160/2);
|
paulo@0
|
272
|
paulo@0
|
273 // Copy map
|
paulo@0
|
274 memcpy(MENU_GFX_MAP[30], MENU_GFX_MAP[31], sizeof(NAMETABLE));
|
paulo@0
|
275 }
|
paulo@0
|
276
|
paulo@0
|
277 void ljmenu_setTitle(const char *topLeft, const char *topRight) {
|
paulo@0
|
278 vwfRectfill(&vwfLayer0, 16, 16, 240, 16 + 12, 0);
|
paulo@0
|
279 vwfPuts(&vwfLayer0, topLeft, 16, 16);
|
paulo@0
|
280 if (topRight) {
|
paulo@0
|
281 int x = 240 - fontdraw_strWidth(topRight);
|
paulo@0
|
282 vwfPuts(&vwfLayer0, topRight, x, 16);
|
paulo@0
|
283 }
|
paulo@0
|
284 }
|
paulo@0
|
285
|
paulo@0
|
286 static unsigned short tabsX;
|
paulo@0
|
287 static unsigned short tabsPadding;
|
paulo@0
|
288 #define TAB_TOP 32
|
paulo@0
|
289 #define TAB_BOTTOM 44
|
paulo@0
|
290 #define TAB_LEFT 16
|
paulo@0
|
291 #define TAB_RIGHT 240
|
paulo@0
|
292
|
paulo@0
|
293 void ljmenu_beginTabs(unsigned int padding) {
|
paulo@0
|
294 tabsX = TAB_LEFT;
|
paulo@0
|
295 tabsPadding = padding;
|
paulo@0
|
296 }
|
paulo@0
|
297
|
paulo@0
|
298 void ljmenu_addTab(const char *text, int hilite) {
|
paulo@0
|
299 unsigned int bgColor = hilite ? 12 : 4;
|
paulo@0
|
300 unsigned int w = text ? fontdraw_strWidth(text) : 0;
|
paulo@0
|
301 unsigned int left = tabsX;
|
paulo@0
|
302 unsigned int right = left + 2 * tabsPadding + w;
|
paulo@0
|
303
|
paulo@0
|
304 if (right > TAB_RIGHT) {
|
paulo@0
|
305 return;
|
paulo@0
|
306 }
|
paulo@0
|
307 vwfRectfill(&vwfLayer0,
|
paulo@0
|
308 left, TAB_TOP, right, TAB_BOTTOM,
|
paulo@0
|
309 bgColor);
|
paulo@0
|
310 if (hilite) {
|
paulo@0
|
311 vwfHline(&vwfLayer0,
|
paulo@0
|
312 left, TAB_TOP, right,
|
paulo@0
|
313 bgColor + 1);
|
paulo@0
|
314 vwfVline(&vwfLayer0,
|
paulo@0
|
315 left, TAB_TOP, TAB_BOTTOM,
|
paulo@0
|
316 bgColor + 1);
|
paulo@0
|
317 vwfVline(&vwfLayer0,
|
paulo@0
|
318 right - 1, TAB_TOP, TAB_BOTTOM,
|
paulo@0
|
319 bgColor + 1);
|
paulo@0
|
320 } else {
|
paulo@0
|
321 vwfHline(&vwfLayer0,
|
paulo@0
|
322 left, TAB_BOTTOM - 1, right,
|
paulo@0
|
323 bgColor + 1);
|
paulo@0
|
324 }
|
paulo@0
|
325 if (text) {
|
paulo@0
|
326 vwfPuts(&vwfLayer0, text, left + tabsPadding, TAB_TOP);
|
paulo@0
|
327 }
|
paulo@0
|
328 tabsX = right;
|
paulo@0
|
329 }
|
paulo@0
|
330
|
paulo@0
|
331 void ljmenu_endTabs(void) {
|
paulo@0
|
332 vwfRectfill(&vwfLayer0,
|
paulo@0
|
333 tabsX, TAB_TOP, TAB_RIGHT, TAB_BOTTOM - 1,
|
paulo@0
|
334 4);
|
paulo@0
|
335 vwfHline(&vwfLayer0,
|
paulo@0
|
336 tabsX, TAB_BOTTOM - 1, TAB_RIGHT,
|
paulo@0
|
337 5);
|
paulo@0
|
338 }
|
paulo@0
|
339
|
paulo@0
|
340 #define PROPPANEL_TOP TAB_BOTTOM
|
paulo@0
|
341 #define PROPPANEL_HT 12
|
paulo@0
|
342 #define PROPPANEL_ROWS 7
|
paulo@0
|
343 #define PROPPANEL_BOTTOM (PROPPANEL_TOP + PROPPANEL_HT * PROPPANEL_ROWS)
|
paulo@0
|
344
|
paulo@0
|
345 void ljmenu_propPanelClear(unsigned int nRows) {
|
paulo@0
|
346 if (nRows > PROPPANEL_ROWS) {
|
paulo@0
|
347 nRows = PROPPANEL_ROWS;
|
paulo@0
|
348 }
|
paulo@0
|
349 int y = PROPPANEL_TOP + PROPPANEL_HT * nRows;
|
paulo@0
|
350 vwfRectfill(&vwfLayer0,
|
paulo@0
|
351 TAB_LEFT, PROPPANEL_TOP, TAB_RIGHT, y,
|
paulo@0
|
352 4);
|
paulo@0
|
353 vwfRectfill(&vwfLayer0,
|
paulo@0
|
354 TAB_LEFT, y, TAB_RIGHT, PROPPANEL_BOTTOM,
|
paulo@0
|
355 0);
|
paulo@0
|
356 }
|
paulo@0
|
357
|
paulo@0
|
358 void ljmenu_propPanelDrawRow(const char *name, const char *value,
|
paulo@0
|
359 unsigned int y, unsigned int hilite) {
|
paulo@0
|
360 if (y > PROPPANEL_ROWS) {
|
paulo@0
|
361 return;
|
paulo@0
|
362 }
|
paulo@0
|
363 y = PROPPANEL_TOP + PROPPANEL_HT * y;
|
paulo@0
|
364 unsigned int bgColor = hilite ? 12 : 4;
|
paulo@0
|
365
|
paulo@0
|
366 vwfRectfill(&vwfLayer0,
|
paulo@0
|
367 TAB_LEFT, y, TAB_RIGHT, y + PROPPANEL_HT,
|
paulo@0
|
368 bgColor);
|
paulo@0
|
369 if (hilite) {
|
paulo@0
|
370 vwfRect(&vwfLayer0,
|
paulo@0
|
371 TAB_LEFT, y, TAB_RIGHT, y + PROPPANEL_HT,
|
paulo@0
|
372 bgColor + 1);
|
paulo@0
|
373 }
|
paulo@0
|
374 if (name) {
|
paulo@0
|
375 vwfPuts(&vwfLayer0, name, TAB_LEFT + 8, y);
|
paulo@0
|
376 }
|
paulo@0
|
377 if (value) {
|
paulo@0
|
378 int x = TAB_RIGHT - 8 - fontdraw_strWidth(value);
|
paulo@0
|
379 vwfPuts(&vwfLayer0, value, x, y);
|
paulo@0
|
380 }
|
paulo@0
|
381 }
|
paulo@0
|
382
|
paulo@0
|
383 static void roundrect(const VWFWindow *w,
|
paulo@0
|
384 int l, int t, int r, int b, int c) {
|
paulo@0
|
385 vwfRectfill(w, l, t + 2, r, b - 2, c);
|
paulo@0
|
386 vwfHline(w, l + 2, t, r - 2, c);
|
paulo@0
|
387 vwfHline(w, l + 1, t + 1, r - 1, c);
|
paulo@0
|
388 vwfHline(w, l + 1, b - 2, r - 1, c);
|
paulo@0
|
389 vwfHline(w, l + 2, b - 1, r - 2, c);
|
paulo@0
|
390 }
|
paulo@0
|
391
|
paulo@0
|
392 static void ljmenu_balloon(const char *text1, const char *text2,
|
paulo@0
|
393 int l, int t, int r) {
|
paulo@0
|
394 int b = t + (text2 ? 24 : 12);
|
paulo@0
|
395 roundrect(&vwfLayer0, l, t, r, b, 4);
|
paulo@0
|
396 vwfPuts(&vwfLayer0, text1, l + 4, t);
|
paulo@0
|
397 if (text2) {
|
paulo@0
|
398 vwfPuts(&vwfLayer0, text2, l + 4, t + 12);
|
paulo@0
|
399 }
|
paulo@0
|
400 }
|
paulo@0
|
401
|
paulo@0
|
402 void ljmenu_propPanelDrawDesc(const char *text1, const char *text2) {
|
paulo@0
|
403 ljmenu_balloon(text1, text2, TAB_LEFT, PROPPANEL_BOTTOM + 4, TAB_RIGHT);
|
paulo@0
|
404 }
|
paulo@0
|
405
|
paulo@0
|
406 void ljmenu_propPanelDrawHelp(const char *text1, const char *text2) {
|
paulo@0
|
407 int y = text2 ? 176 - 24 : 176 - 12;
|
paulo@0
|
408 ljmenu_balloon(text1, text2, TAB_LEFT, y, TAB_RIGHT);
|
paulo@0
|
409 }
|
paulo@0
|
410
|
paulo@0
|
411 #if 0
|
paulo@0
|
412 static void ljmenu_pressA(void) {
|
paulo@0
|
413 int phase = 0;
|
paulo@0
|
414 while (!(REG_KEYINPUT & KEY_A)) {
|
paulo@0
|
415 ++phase;
|
paulo@0
|
416 vsync();
|
paulo@0
|
417 ljmenu_setHilitePalette(phase);
|
paulo@0
|
418 }
|
paulo@0
|
419 while (REG_KEYINPUT & KEY_A) {
|
paulo@0
|
420 ++phase;
|
paulo@0
|
421 vsync();
|
paulo@0
|
422 ljmenu_setHilitePalette(phase);
|
paulo@0
|
423 }
|
paulo@0
|
424 }
|
paulo@0
|
425
|
paulo@0
|
426 void ljmenuTest(void) {
|
paulo@0
|
427 ljmenu_init();
|
paulo@0
|
428 ljmenu_cls();
|
paulo@0
|
429 ljmenu_setTitle("LOCKJAW 0.43", "© 2008 Damian Yerrick");
|
paulo@0
|
430 ljmenu_drawButton(22, 18, 22 + 8, 18 + 3, "OK");
|
paulo@0
|
431 ljmenu_hiliteButton(22, 18, 22 + 8, 18 + 3, 1);
|
paulo@0
|
432 ljmenu_drawButton(13, 18, 13 + 8, 18 + 3, "Cancel");
|
paulo@0
|
433 ljmenu_drawButton(2, 8, 30, 11,
|
paulo@0
|
434 "coming soon: the new look of LOCKJAW");
|
paulo@0
|
435 ljmenu_pressA();
|
paulo@0
|
436
|
paulo@0
|
437 ljmenu_cls();
|
paulo@0
|
438 ljmenu_setTitle("LOCKJAW 0.43", "© 2008 Damian Yerrick");
|
paulo@0
|
439 ljmenu_beginTabs(4);
|
paulo@0
|
440 ljmenu_addTab("Game", 1);
|
paulo@0
|
441 ljmenu_addTab("Well", 0);
|
paulo@0
|
442 ljmenu_addTab("Move", 0);
|
paulo@0
|
443 ljmenu_addTab("Line", 0);
|
paulo@0
|
444 ljmenu_addTab("Ctrl", 0);
|
paulo@0
|
445 ljmenu_addTab("Drop", 0);
|
paulo@0
|
446 ljmenu_addTab("Disp", 0);
|
paulo@0
|
447 ljmenu_endTabs();
|
paulo@0
|
448 ljmenu_propPanelClear(7);
|
paulo@0
|
449 ljmenu_propPanelDrawRow("Gimmick", "Marathon", 0, 1);
|
paulo@0
|
450 ljmenu_propPanelDrawRow("Mr. Gimmick", "Halo", 1, 0);
|
paulo@0
|
451 ljmenu_propPanelDrawDesc("Goal or other game mode",
|
paulo@0
|
452 "Play until you <Ganon>DIE.</Ganon>");
|
paulo@0
|
453 ljmenu_propPanelDrawHelp("u d: move; l r: change; L R: page; Start: OK",
|
paulo@0
|
454 NULL);
|
paulo@0
|
455 ljmenu_pressA();
|
paulo@0
|
456 }
|
paulo@0
|
457
|
paulo@0
|
458 #endif
|