Rev 5243 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5235 | alpine | 1 | #include "rsgamemenu.h" |
2 | |||
3 | #include "rsgame.h" |
||
4 | |||
5 | #include "rskos.h" |
||
6 | |||
7 | #include "strings.h" |
||
8 | |||
9 | //PRSFUNC0 menu_actions[] = { |
||
10 | // /* a */ &menu_action_start, |
||
11 | // /* b */ &menu_action_exit, |
||
12 | // /* c */ &menu_action_change_window_scale |
||
13 | //}; |
||
14 | |||
15 | char window_scale_str[] = "c< 2X >"; |
||
16 | |||
17 | /* |
||
18 | First char: |
||
19 | - letter a...z means action (a = 0th, b = 1st, c = 2nd, see menu_actions[] above) |
||
20 | - number 0...9 means goto menu #0, #1, #2... see menu_titles[] below |
||
21 | - space ' ' means no action, menu item is unselectable |
||
22 | - empty string "" is now allowed and can cause segfault |
||
23 | String from second char is label of menu item |
||
24 | |||
25 | */ |
||
26 | |||
27 | |||
28 | char* menu_main_titles[] = { |
||
29 | "a"L_START, |
||
5243 | alpine | 30 | // "1"L_SETTINGS, |
31 | // "2"L_ABOUT, |
||
32 | // "b"L_QUIT, |
||
5235 | alpine | 33 | |
34 | }; |
||
35 | |||
36 | char* menu_settings_titles[] = { |
||
5243 | alpine | 37 | // " "L_WINDOW_SCALE, |
38 | // window_scale_str, |
||
39 | // " ", |
||
40 | // "0"L_DONE, |
||
5235 | alpine | 41 | |
42 | }; |
||
43 | |||
44 | char* menu_about_titles[] = { |
||
5243 | alpine | 45 | // " "L_DEVELOPED_BY, |
46 | // " "L_ROMAN_SHUVALOV, |
||
47 | // " ", |
||
48 | // "0"L_DONE, |
||
5235 | alpine | 49 | |
50 | }; |
||
51 | |||
52 | char **menu_titles[] = { |
||
53 | /* 0 */ menu_main_titles, |
||
54 | /* 1 */ menu_settings_titles, |
||
55 | /* 2 */ menu_about_titles, |
||
56 | |||
57 | }; |
||
58 | |||
59 | |||
5251 | alpine | 60 | //void menu_cursor_down() { |
61 | // int new_index = game.menu_item_index+1; |
||
62 | // while ( (menu_titles[game.menu_index][new_index]) ) { |
||
63 | // if ((menu_titles[game.menu_index][new_index][0] != ' ')) { |
||
64 | // game.menu_item_index = new_index; |
||
65 | // game_ding(1); |
||
66 | // return; |
||
67 | // }; |
||
68 | // new_index++; |
||
69 | // }; |
||
70 | //}; |
||
71 | // |
||
72 | //void menu_cursor_up() { |
||
73 | // int new_index = game.menu_item_index-1; |
||
74 | // while ( new_index+1 ) { |
||
75 | // if ((menu_titles[game.menu_index][new_index][0] != ' ')) { |
||
76 | // game.menu_item_index = new_index; |
||
77 | // game_ding(1); |
||
78 | // return; |
||
79 | // }; |
||
80 | // new_index--; |
||
81 | // }; |
||
82 | //}; |
||
5235 | alpine | 83 | |
5251 | alpine | 84 | //void menu_open(int i) { |
85 | // |
||
86 | // game.menu_index = i; |
||
87 | // |
||
88 | // game.menu_item_index = -1; |
||
89 | // // (menu_cursor_down without sound) |
||
90 | // int new_index = game.menu_item_index+1; |
||
91 | // while ( (menu_titles[game.menu_index][new_index]) ) { |
||
92 | // if ((menu_titles[game.menu_index][new_index][0] != ' ')) { |
||
93 | // game.menu_item_index = new_index; |
||
94 | // return; |
||
95 | // }; |
||
96 | // new_index++; |
||
97 | // }; |
||
98 | // |
||
99 | //}; |
||
5235 | alpine | 100 | |
101 | void menu_cursor_click() { |
||
102 | |||
103 | // |
||
104 | |||
105 | }; |
||
106 | |||
107 | void menu_action_start() { |
||
108 | game.status = STATUS_PLAYING; |
||
109 | |||
5251 | alpine | 110 | // game.tx = GAME_WIDTH/2 - 50; |
111 | // game.ty = GAME_HEIGHT/2 - 10; |
||
5235 | alpine | 112 | |
113 | }; |
||
114 | |||
115 | void menu_action_exit() { |
||
116 | #ifdef RS_KOS |
||
117 | GameTerm(); |
||
118 | #endif |
||
119 | rskos_exit(); |
||
120 | };> |
||
121 |