Quick options menu
This commit is contained in:
parent
08009ebbaa
commit
9cf65de1c3
@ -163,6 +163,7 @@ extern int aheat_enable;
|
||||
extern int decorations_enable;
|
||||
extern int hud_enable;
|
||||
extern int pretty_powder;
|
||||
extern int drawgrav_enable;
|
||||
int limitFPS;
|
||||
int water_equal_test;
|
||||
|
||||
|
@ -15,6 +15,17 @@ struct menu_section
|
||||
};
|
||||
typedef struct menu_section menu_section;
|
||||
|
||||
#define QM_TOGGLE 1
|
||||
|
||||
struct quick_option
|
||||
{
|
||||
char *icon;
|
||||
const char *name;
|
||||
int type;
|
||||
int *variable;
|
||||
};
|
||||
typedef struct quick_option quick_option;
|
||||
|
||||
struct menu_wall
|
||||
{
|
||||
pixel colour;
|
||||
@ -58,6 +69,13 @@ static menu_section msections[] = //doshow does not do anything currently.
|
||||
{"\xC8", "Cracker!", 0, 0},
|
||||
};
|
||||
|
||||
static quick_option quickmenu[] = //doshow does not do anything currently.
|
||||
{
|
||||
{"P", "Sand effect", QM_TOGGLE, &pretty_powder},
|
||||
{"G", "Draw gravity grid", QM_TOGGLE, &drawgrav_enable},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static menu_section colorsections[] = //doshow does not do anything currently.
|
||||
{
|
||||
{"\xC4", "Colors", 7, 1},
|
||||
@ -201,10 +219,10 @@ extern int zoom_en;
|
||||
extern int zoom_x, zoom_y;
|
||||
extern int zoom_wx, zoom_wy;
|
||||
|
||||
extern int drawgrav_enable;
|
||||
|
||||
void menu_count(void);
|
||||
|
||||
void quickoptions_menu(pixel *vid_buf, int b, int bq, int x, int y);
|
||||
|
||||
void prop_edit_ui(pixel *vid_buf, int x, int y);
|
||||
|
||||
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);
|
||||
|
@ -2416,6 +2416,51 @@ int color_menu_ui(pixel *vid_buf, int i, int *cr, int *cg, int *cb, int b, int b
|
||||
return 0;
|
||||
}
|
||||
|
||||
int quickoptions_tooltip_fade = 0;
|
||||
char * quickoptions_tooltip;
|
||||
int quickoptions_tooltip_y = 0;
|
||||
void quickoptions_menu(pixel *vid_buf, int b, int bq, int x, int y)
|
||||
{
|
||||
int i = 0;
|
||||
if(quickoptions_tooltip_fade && quickoptions_tooltip)
|
||||
{
|
||||
drawtext_outline(vid_buf, (XRES - 5) - textwidth(quickoptions_tooltip), quickoptions_tooltip_y, quickoptions_tooltip, 255, 255, 255, quickoptions_tooltip_fade*20, 0, 0, 0, quickoptions_tooltip_fade*15);
|
||||
quickoptions_tooltip_fade--;
|
||||
}
|
||||
while(quickmenu[i].icon!=NULL)
|
||||
{
|
||||
if(quickmenu[i].type == QM_TOGGLE)
|
||||
{
|
||||
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+1, 14, 14, 255, 255, 255, 255);
|
||||
if(*(quickmenu[i].variable))
|
||||
{
|
||||
fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+1, 14, 14, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, (XRES+BARSIZE)-11, (i*16)+5, quickmenu[i].icon, 0, 0, 0, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+1, 14, 14, 0, 0, 0, 255);
|
||||
drawtext(vid_buf, (XRES+BARSIZE)-11, (i*16)+5, quickmenu[i].icon, 255, 255, 255, 255);
|
||||
}
|
||||
if(x >= (XRES+BARSIZE)-16 && x <= (XRES+BARSIZE)-2 && y >= (i*16)+1 && y <= (i*16)+15)
|
||||
{
|
||||
quickoptions_tooltip_fade+=2;
|
||||
quickoptions_tooltip = quickmenu[i].name;
|
||||
quickoptions_tooltip_y = (i*16)+5;
|
||||
if(b && !bq)
|
||||
{
|
||||
*(quickmenu[i].variable) = !(*(quickmenu[i].variable));
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(quickoptions_tooltip_fade > 12)
|
||||
quickoptions_tooltip_fade = 12;
|
||||
if(quickoptions_tooltip_fade < 0)
|
||||
quickoptions_tooltip_fade = 0;
|
||||
}
|
||||
|
||||
int sdl_poll(void)
|
||||
{
|
||||
SDL_Event event;
|
||||
|
@ -2613,6 +2613,8 @@ int main(int argc, char *argv[])
|
||||
luacon_step(x/sdl_scale, y/sdl_scale,sl,sr);
|
||||
#endif
|
||||
|
||||
quickoptions_menu(vid_buf, b, bq, x, y);
|
||||
|
||||
for (i=0; i<SC_TOTAL; i++)//draw all the menu sections
|
||||
{
|
||||
draw_menu(vid_buf, i, active_menu);
|
||||
|
Reference in New Issue
Block a user