Runtime fullscreen toggle TODO: Fix bug that prevents from closing the window after a fullscreen toggle
This commit is contained in:
parent
d8e7c82f1c
commit
1ddff1ad3b
@ -206,4 +206,5 @@ void sdl_seticon(void);
|
|||||||
void play_sound(char *file);
|
void play_sound(char *file);
|
||||||
void start_grav_async(void);
|
void start_grav_async(void);
|
||||||
void stop_grav_async(void);
|
void stop_grav_async(void);
|
||||||
|
void set_scale(int scale, int kiosk);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4559,12 +4559,13 @@ void decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy)
|
|||||||
void simulation_ui(pixel * vid_buf)
|
void simulation_ui(pixel * vid_buf)
|
||||||
{
|
{
|
||||||
int xsize = 300;
|
int xsize = 300;
|
||||||
int ysize = 114;
|
int ysize = 140;
|
||||||
int x0=(XRES-xsize)/2,y0=(YRES-MENUSIZE-ysize)/2,b=1,bq,mx,my;
|
int x0=(XRES-xsize)/2,y0=(YRES-MENUSIZE-ysize)/2,b=1,bq,mx,my;
|
||||||
int new_scale;
|
int new_scale, new_kiosk;
|
||||||
ui_checkbox cb;
|
ui_checkbox cb;
|
||||||
ui_checkbox cb2;
|
ui_checkbox cb2;
|
||||||
ui_checkbox cb3;
|
ui_checkbox cb3;
|
||||||
|
ui_checkbox cb4;
|
||||||
|
|
||||||
cb.x = x0+xsize-16;
|
cb.x = x0+xsize-16;
|
||||||
cb.y = y0+23;
|
cb.y = y0+23;
|
||||||
@ -4580,6 +4581,11 @@ void simulation_ui(pixel * vid_buf)
|
|||||||
cb3.y = y0+77;
|
cb3.y = y0+77;
|
||||||
cb3.focus = 0;
|
cb3.focus = 0;
|
||||||
cb3.checked = (sdl_scale==2)?1:0;
|
cb3.checked = (sdl_scale==2)?1:0;
|
||||||
|
|
||||||
|
cb4.x = x0+xsize-16;
|
||||||
|
cb4.y = y0+103;
|
||||||
|
cb4.focus = 0;
|
||||||
|
cb4.checked = (kiosk_enable==1)?1:0;
|
||||||
|
|
||||||
while (!sdl_poll())
|
while (!sdl_poll())
|
||||||
{
|
{
|
||||||
@ -4610,6 +4616,9 @@ void simulation_ui(pixel * vid_buf)
|
|||||||
drawtext(vid_buf, x0+8, y0+80, "Large window", 255, 255, 255, 255);
|
drawtext(vid_buf, x0+8, y0+80, "Large window", 255, 255, 255, 255);
|
||||||
drawtext(vid_buf, x0+12+textwidth("Large window"), y0+80, "Double window size for small screens", 255, 255, 255, 180);
|
drawtext(vid_buf, x0+12+textwidth("Large window"), y0+80, "Double window size for small screens", 255, 255, 255, 180);
|
||||||
//drawtext(vid_buf, x0+12, y0+68, "May also cause slow performance on older computers", 255, 255, 255, 180);
|
//drawtext(vid_buf, x0+12, y0+68, "May also cause slow performance on older computers", 255, 255, 255, 180);
|
||||||
|
|
||||||
|
drawtext(vid_buf, x0+8, y0+106, "Fullscreen", 255, 255, 255, 255);
|
||||||
|
drawtext(vid_buf, x0+12+textwidth("Fullscreen"), y0+106, "Fill the entire screen", 255, 255, 255, 180);
|
||||||
|
|
||||||
//TODO: Options for Air and Normal gravity
|
//TODO: Options for Air and Normal gravity
|
||||||
//Maybe save/load defaults too.
|
//Maybe save/load defaults too.
|
||||||
@ -4620,10 +4629,12 @@ void simulation_ui(pixel * vid_buf)
|
|||||||
ui_checkbox_draw(vid_buf, &cb);
|
ui_checkbox_draw(vid_buf, &cb);
|
||||||
ui_checkbox_draw(vid_buf, &cb2);
|
ui_checkbox_draw(vid_buf, &cb2);
|
||||||
ui_checkbox_draw(vid_buf, &cb3);
|
ui_checkbox_draw(vid_buf, &cb3);
|
||||||
|
ui_checkbox_draw(vid_buf, &cb4);
|
||||||
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||||
ui_checkbox_process(mx, my, b, bq, &cb);
|
ui_checkbox_process(mx, my, b, bq, &cb);
|
||||||
ui_checkbox_process(mx, my, b, bq, &cb2);
|
ui_checkbox_process(mx, my, b, bq, &cb2);
|
||||||
ui_checkbox_process(mx, my, b, bq, &cb3);
|
ui_checkbox_process(mx, my, b, bq, &cb3);
|
||||||
|
ui_checkbox_process(mx, my, b, bq, &cb4);
|
||||||
|
|
||||||
if (b && !bq && mx>=x0 && mx<x0+xsize && my>=y0+ysize-16 && my<=y0+ysize)
|
if (b && !bq && mx>=x0 && mx<x0+xsize && my>=y0+ysize-16 && my<=y0+ysize)
|
||||||
break;
|
break;
|
||||||
@ -4636,8 +4647,9 @@ void simulation_ui(pixel * vid_buf)
|
|||||||
|
|
||||||
legacy_enable = !cb.checked;
|
legacy_enable = !cb.checked;
|
||||||
new_scale = (cb3.checked)?2:1;
|
new_scale = (cb3.checked)?2:1;
|
||||||
if(new_scale!=sdl_scale)
|
new_kiosk = (cb4.checked)?1:0;
|
||||||
set_scale(new_scale);
|
if(new_scale!=sdl_scale || new_kiosk!=kiosk_enable)
|
||||||
|
set_scale(new_scale, new_kiosk);
|
||||||
if(ngrav_enable != cb2.checked)
|
if(ngrav_enable != cb2.checked)
|
||||||
{
|
{
|
||||||
if(cb2.checked)
|
if(cb2.checked)
|
||||||
|
@ -1230,8 +1230,9 @@ char my_uri[] = "http://" SERVER "/Update.api?Action=Download&Architecture="
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
void set_scale(int scale){
|
void set_scale(int scale, int kiosk){
|
||||||
sdl_scale = scale;
|
sdl_scale = scale;
|
||||||
|
kiosk_enable = kiosk;
|
||||||
sdl_open();
|
sdl_open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user