2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
24 /*---------------------------------------------------------------------------*/
31 static int set_action(int i
)
33 audio_play(AUD_MENU
, 1.0f
);
36 return goto_state(&st_title
);
41 return goto_state(&st_start
);
46 static void gui_set(int id
, int i
)
49 gui_state(id
, set_name(i
), GUI_SML
, i
, 0);
51 gui_label(id
, "", GUI_SML
, GUI_ALL
, 0, 0);
54 static int set_enter(void)
56 int w
= config_get_d(CONFIG_WIDTH
);
57 int h
= config_get_d(CONFIG_HEIGHT
);
63 audio_music_fade_to(0.5f
, "bgm/inter.ogg");
64 audio_play(AUD_START
, 1.f
);
66 if ((id
= gui_vstack(0)))
68 if ((jd
= gui_harray(id
)))
70 gui_label(jd
, "Level Set", GUI_SML
, GUI_ALL
, gui_yel
, gui_red
);
73 gui_start(jd
, "Back", GUI_SML
, SET_BACK
, 0);
76 if ((jd
= gui_harray(id
)))
78 shot_id
= gui_image(jd
, "shot-rlk/easy.jpg", 7 * w
/ 16, 7 * h
/ 16);
80 if ((kd
= gui_varray(jd
)))
91 desc_id
= gui_multi(id
, " \\ \\ \\ \\ \\", GUI_SML
, GUI_ALL
, gui_yel
, gui_wht
);
98 static void set_leave(int id
)
103 static void set_paint(int id
, float st
)
110 static void set_timer(int id
, float dt
)
116 static void set_point(int id
, int x
, int y
, int dx
, int dy
)
120 if ((jd
= gui_point(id
, x
, y
)))
122 int i
= gui_token(jd
);
124 gui_set_image(shot_id
, set_shot(i
));
125 gui_set_multi(desc_id
, set_desc(i
));
130 static void set_stick(int id
, int a
, int v
)
134 int x
= (config_tst_d(CONFIG_JOYSTICK_AXIS_X
, a
)) ? v
: 0;
135 int y
= (config_tst_d(CONFIG_JOYSTICK_AXIS_Y
, a
)) ? v
: 0;
137 if ((jd
= gui_stick(id
, x
, y
)))
139 int i
= gui_token(jd
);
141 gui_set_image(shot_id
, set_shot(i
));
142 gui_set_multi(desc_id
, set_desc(i
));
147 static int set_click(int b
, int d
)
149 return (b
< 0 && d
== 1) ? set_action(gui_token(gui_click())) : 1;
152 static int set_keybd(int c
, int d
)
154 return (d
&& c
== SDLK_ESCAPE
) ? goto_state(&st_title
) : 1;
157 static int set_buttn(int b
, int d
)
161 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A
, b
))
162 return set_action(gui_token(gui_click()));
163 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B
, b
))
164 return goto_state(&st_title
);
165 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT
, b
))
166 return goto_state(&st_title
);
171 /*---------------------------------------------------------------------------*/
173 struct state st_set
= {