some ui tweaks and fixes

This commit is contained in:
Andrew "Akari" Alexeyew 2012-08-04 05:57:26 +03:00
parent 10df99c337
commit b3219a3030
5 changed files with 31 additions and 30 deletions

View file

@ -6,7 +6,7 @@
*/
#include "menu.h"
#include "mainmenu.h"
#include "options.h"
#include "global.h"
void set_player(void *p) {
@ -32,7 +32,7 @@ void create_shottype_menu(MenuData *m) {
}
void draw_char_menu(MenuData *menu, MenuData *mod) {
draw_main_menu_bg(menu);
draw_options_menu_bg(menu);
draw_text(AL_Right, 220*(1-menu->fade), 30, "Player Select", _fonts.mainmenu);
glPushMatrix();

View file

@ -6,7 +6,7 @@
*/
#include "difficulty.h"
#include "mainmenu.h"
#include "options.h"
#include "global.h"
void set_difficulty(void *d) {
@ -24,7 +24,7 @@ void create_difficulty_menu(MenuData *m) {
}
void draw_difficulty_menu(MenuData *menu) {
draw_main_menu_bg(menu);
draw_options_menu_bg(menu);
draw_text(AL_Right, 210*(1-menu->fade), 30, "Rank Select", _fonts.mainmenu);
int i;
@ -56,4 +56,4 @@ void draw_difficulty_menu(MenuData *menu) {
int difficulty_menu_loop(MenuData *menu) {
return menu_loop(menu, NULL, draw_difficulty_menu);
}
}

View file

@ -93,7 +93,7 @@ void menu_input(MenuData *menu) {
if(menu->keypressed > KEYREPEAT_TIME) {
key_action(menu, menu->lastkey);
menu->keypressed = KEYREPEAT_TIME-10;
menu->keypressed = KEYREPEAT_TIME-5;
}
}

View file

@ -451,11 +451,10 @@ void create_options_menu(MenuData *m) {
// --- Drawing the menu --- //
void draw_options_menu_bg(MenuData* menu) {
glColor4f(0.3, 0.3, 0.3,1);
draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenu/mainmenubgbg");
glColor4f(1,0.6,0.5,0.6 + 0.1*sin(menu->frames/100.0));
//draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenu/mainmenubgbg");
glColor4f(0.3, 0.3, 0.3, 0.9 + 0.1 * sin(menu->frames/100.0));
draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenu/mainmenubg");
glColor3f(1,1,1);
glColor4f(1, 1, 1, 1);
}
void draw_options_menu(MenuData *menu) {
@ -484,6 +483,7 @@ void draw_options_menu(MenuData *menu) {
continue;
menu->entries[i].drawdata += 0.2 * (10*(i == menu->cursor) - menu->entries[i].drawdata);
float a = menu->entries[i].drawdata * 0.1;
bind = &(binds[i]);
int hasbind = bind->enabled;
@ -491,10 +491,10 @@ void draw_options_menu(MenuData *menu) {
if(menu->entries[i].action == NULL) {
glColor4f(0.5, 0.5, 0.5, 0.7 * alpha);
} else if(i == menu->cursor) {
glColor4f(1,1,0,0.7 * alpha);
} else {
glColor4f(1, 1, 1, 0.7 * alpha);
//glColor4f(0.7 + 0.3 * (1-a), 1, 1, (0.7 + 0.3 * a) * alpha);
float ia = 1-a;
glColor4f(0.9 + ia * 0.1, 0.6 + ia * 0.4, 0.2 + ia * 0.8, (0.7 + 0.3 * a) * alpha);
}
draw_text(AL_Left,
@ -517,7 +517,7 @@ void draw_options_menu(MenuData *menu) {
origin -= strlen(bind->values[j+1])/2.0 * 20;
if(bind_getvalue(bind) == j) {
glColor4f(1,1,0,0.7 * alpha);
glColor4f(0.9, 0.6, 0.2, alpha);
} else {
glColor4f(0.5,0.5,0.5,0.7 * alpha);
}
@ -527,23 +527,22 @@ void draw_options_menu(MenuData *menu) {
break;
case BT_KeyBinding:
if(!caption_drawn)
{
if(bind->blockinput) {
glColor4f(0.5, 1, 0.5, 1);
draw_text(AL_Right, origin, 20*i, "Press a key to assign, ESC to cancel", _fonts.standard);
} else
draw_text(AL_Right, origin, 20*i, SDL_GetKeyName(tconfig.intval[bind->configentry]), _fonts.standard);
if(!caption_drawn) {
glColor4f(1,1,1,0.7);
draw_text(AL_Center, (SCREEN_W - 200)/2, 20*(i-1), "Controls", _fonts.standard);
caption_drawn = 1;
}
if(bind->blockinput) {
glColor4f(0,1,0,0.7);
draw_text(AL_Right, origin, 20*i, "Press a key to assign, ESC to cancel", _fonts.standard);
} else
draw_text(AL_Right, origin, 20*i, SDL_GetKeyName(tconfig.intval[bind->configentry]), _fonts.standard);
break;
case BT_StrValue:
if(bind->blockinput) {
glColor4f(0,1,0,0.7);
glColor4f(0.5, 1, 0.5, 1.0);
if(strlen(*bind->values))
draw_text(AL_Right, origin, 20*i, *bind->values, _fonts.standard);
} else
@ -720,7 +719,7 @@ void options_menu_input(MenuData *menu) {
if(menu->keypressed > KEYREPEAT_TIME) {
options_key_action(menu, menu->lastkey);
menu->keypressed = KEYREPEAT_TIME-10;
menu->keypressed = KEYREPEAT_TIME-5;
}
}

View file

@ -38,7 +38,7 @@ void draw_stage_menu(MenuData *m) {
draw_text(AL_Right, (stringwidth(m->title, _fonts.mainmenu) + 10) * (1-m->fade), 30, m->title, _fonts.mainmenu);
glPushMatrix();
glTranslatef(100, 100 + min(0, SCREEN_H * 0.7 - 100 - m->drawdata[2]), 0);
glTranslatef(100, 100 + ((m->ecount * 20 + 140 > SCREEN_W)? min(0, SCREEN_H * 0.7 - 100 - m->drawdata[2]) : 0), 0);
glPushMatrix();
glTranslatef(SCREEN_W/2 - 100, m->drawdata[2], 0);
@ -53,13 +53,15 @@ void draw_stage_menu(MenuData *m) {
MenuEntry *e = &(m->entries[i]);
e->drawdata += 0.2 * (10*(i == m->cursor) - e->drawdata);
float a = e->drawdata * 0.1;
if(e->action == NULL)
glColor4f(0.5, 0.5, 0.5, 0.7);
else if(i == m->cursor)
glColor4f(1,1,0,0.7);
else
glColor4f(1, 1, 1, 0.7);
glColor4f(0.5, 0.5, 0.5, 0.5);
else {
//glColor4f(0.7 + 0.3 * (1-a), 1, 1, 0.7 + 0.3 * a);
float ia = 1-a;
glColor4f(0.9 + ia * 0.1, 0.6 + ia * 0.4, 0.2 + ia * 0.8, 0.7 + 0.3 * a);
}
if(e->draw)
e->draw(e, i, m->ecount);