more stuff

This commit is contained in:
laochailan 2012-08-12 17:28:43 +02:00
parent 5bff076073
commit a1ed4a5d8a
6 changed files with 30 additions and 12 deletions

View file

@ -61,7 +61,7 @@ float menu_fade(MenuData *menu) {
return 0.0;
}
static void key_action(MenuData *menu, int sym) {
void menu_key_action(MenuData *menu, int sym) {
Uint8 *keys = SDL_GetKeyState(NULL);
if(sym == tconfig.intval[KEY_DOWN] || sym == SDLK_DOWN) {
@ -92,7 +92,7 @@ void menu_input(MenuData *menu) {
global_processevent(&event);
if(event.type == SDL_KEYDOWN)
key_action(menu,sym);
menu_key_action(menu,sym);
}
}

View file

@ -68,6 +68,7 @@ void menu_input(MenuData *menu);
void close_menu(MenuData *menu); // softly close menu (should be used in most cases)
void kill_menu(MenuData *menu); // quit action for persistent menus
void menu_key_action(MenuData *menu, int sym);
int menu_loop(MenuData *menu, void (*input)(MenuData*), void (*draw)(MenuData*), void (*end)(MenuData*));

View file

@ -441,7 +441,7 @@ void create_options_menu(MenuData *m) {
add_menu_separator(m);
allocate_binding(m);
add_menu_entry(m, "Return to the main menu", (MenuAction)close_menu, m);
add_menu_entry(m, "Return to the main menu", (MenuAction)kill_menu, m);
allocate_binding(m);
}

View file

@ -62,6 +62,8 @@ MenuData* replayview_stageselect(Replay *rpy) {
create_menu(m);
m->context = rpy;
m->flags = MF_Transient | MF_Abortable;
m->quitdelay = 0;
for(i = 0; i < rpy->stgcount; ++i) {
add_menu_entry(m, stage_get(rpy->stages[i].stage)->title, start_replay, rpy);
@ -100,7 +102,7 @@ static void shorten(char *s, int width) {
}
static void replayview_draw_stagemenu(MenuData *m) {
float alpha = min(1, m->frames/40.0);
float alpha = 1-menu_fade(m);
int i;
float height = (1+m->ecount) * 20;
@ -275,6 +277,7 @@ void create_replayview_menu(MenuData *m) {
replayview = m;
m->flags = MF_Abortable;
m->quitdelay = 0;
int r = fill_replayview_menu(m);
@ -294,8 +297,7 @@ void replayview_menu_input(MenuData *m) {
if(m->context)
menu_input((MenuData*)m->context);
else
menu_input(m);
menu_input(m);
}
void free_replayview(MenuData *m) {

View file

@ -80,6 +80,24 @@ void draw_saverpy_menu(MenuData *m) {
glPopMatrix();
}
int saverpy_menu_loop(MenuData *m) {
return menu_loop(m, NULL, draw_saverpy_menu, NULL);
void saverpy_menu_input(MenuData *menu) {
SDL_Event event;
while(SDL_PollEvent(&event)) {
int sym = event.key.keysym.sym;
global_processevent(&event);
if(event.type == SDL_KEYDOWN) {
if(sym == SDLK_LEFT)
menu_key_action(menu, SDLK_UP);
else if(sym == SDLK_RIGHT)
menu_key_action(menu, SDLK_DOWN);
else
menu_key_action(menu,sym);
}
}
}
int saverpy_menu_loop(MenuData *m) {
return menu_loop(m, saverpy_menu_input, draw_saverpy_menu, NULL);
}

View file

@ -374,10 +374,7 @@ void apply_bg_shaders(ShaderRule *shaderrules) {
glUniform1f(uniloc(shader, "rad"), 0.24);
glUniform1f(uniloc(shader, "ratio"), (float)resources.fbg[fbonum].nh/resources.fbg[fbonum].nw);
if(global.boss->zoomcolor)
glUniform4f(uniloc(shader, "color"), global.boss->zoomcolor->r,
global.boss->zoomcolor->g,
global.boss->zoomcolor->b,
global.boss->zoomcolor->a);
glUniform4fv(uniloc(shader, "color"), 1, (float *)global.boss->zoomcolor);
else
glUniform4f(uniloc(shader, "color"), 0.1, 0.2, 0.3, 1);
}