summaryrefslogtreecommitdiff
path: root/src/interface.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-04-25 15:39:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-04-25 15:39:28 (GMT)
commit28d9328959df6f0542d872b73870d31fa9300f7b (patch)
tree6960c58dfdf5c150f5a439cbf2337031eb905d09 /src/interface.c
parent7b82eae82e770410feeed841b7e2c05c7e20d9da (diff)
downloadpowder-28d9328959df6f0542d872b73870d31fa9300f7b.zip
powder-28d9328959df6f0542d872b73870d31fa9300f7b.tar.gz
Dialog box for changing simulation options, gravity toggle needs implementing
Diffstat (limited to 'src/interface.c')
-rw-r--r--src/interface.c90
1 files changed, 83 insertions, 7 deletions
diff --git a/src/interface.c b/src/interface.c
index b31a107..2cc3031 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -591,16 +591,16 @@ void draw_svf_ui(pixel *vid_buf)// all the buttons at the bottom
drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
}
- //the heat sim button
- if (!legacy_enable)
+ //The simulation options button, used to be the heat sim button
+ /*if (!legacy_enable)
{
- fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255);
- drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255);
- drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255);
+ fillrect(vid_buf, XRES-160+BARSIZE, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255);
+ drawtext(vid_buf, XRES-154+BARSIZE, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255);
+ drawtext(vid_buf, XRES-154+BARSIZE, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255);
}
- else
+ else*/
{
- drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255);
+ drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); //TODO: More suitable icon
drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
}
@@ -4501,3 +4501,79 @@ void decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy)
}
free(old_buf);
}
+
+void simulation_ui(pixel * vid_buf)
+{
+ int xsize = 300;
+ int ysize = 100;
+ int x0=(XRES-xsize)/2,y0=(YRES-MENUSIZE-ysize)/2,b=1,bq,mx,my;
+ ui_checkbox cb;
+ ui_checkbox cb2;
+
+ cb.x = x0+xsize-16;
+ cb.y = y0+23;
+ cb.focus = 0;
+ cb.checked = !legacy_enable;
+
+ cb2.x = x0+xsize-16;
+ cb2.y = y0+51;
+ cb2.focus = 0;
+ cb2.checked = ngrav_enable;
+
+ while (!sdl_poll())
+ {
+ b = SDL_GetMouseState(&mx, &my);
+ if (!b)
+ break;
+ }
+
+ while (!sdl_poll())
+ {
+ bq = b;
+ b = SDL_GetMouseState(&mx, &my);
+ mx /= sdl_scale;
+ my /= sdl_scale;
+
+ clearrect(vid_buf, x0-2, y0-2, xsize+4, ysize+4);
+ drawrect(vid_buf, x0, y0, xsize, ysize, 192, 192, 192, 255);
+ drawtext(vid_buf, x0+8, y0+8, "Simulation options", 255, 216, 32, 255);
+
+ drawtext(vid_buf, x0+8, y0+26, "Heat simulation", 255, 255, 255, 255);
+ drawtext(vid_buf, x0+12+textwidth("Heat simulation"), y0+26, "Introduced in version 34.", 255, 255, 255, 180);
+ drawtext(vid_buf, x0+12, y0+40, "Older saves may behave oddly with this enabled.", 255, 255, 255, 180);
+
+ drawtext(vid_buf, x0+8, y0+54, "Newtonian gravity", 255, 255, 255, 255);
+ drawtext(vid_buf, x0+12+textwidth("Newtonian gravity"), y0+54, "Introduced in version 48.", 255, 255, 255, 180);
+ drawtext(vid_buf, x0+12, y0+68, "May also cause slow performance on older computers", 255, 255, 255, 180);
+
+ //TODO: Options for Air and Normal gravity
+ //Maybe save/load defaults too.
+
+ drawtext(vid_buf, x0+5, y0+ysize-11, "OK", 255, 255, 255, 255);
+ drawrect(vid_buf, x0, y0+ysize-16, xsize, 16, 192, 192, 192, 255);
+
+ ui_checkbox_draw(vid_buf, &cb);
+ ui_checkbox_draw(vid_buf, &cb2);
+ 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, &cb2);
+
+ if (b && !bq && mx>=x0 && mx<x0+xsize && my>=y0+ysize-16 && my<=y0+ysize)
+ break;
+
+ if (sdl_key==SDLK_RETURN)
+ break;
+ if (sdl_key==SDLK_ESCAPE)
+ break;
+ }
+
+ legacy_enable = !cb.checked;
+ ngrav_enable = cb2.checked;
+
+ while (!sdl_poll())
+ {
+ b = SDL_GetMouseState(&mx, &my);
+ if (!b)
+ break;
+ }
+} \ No newline at end of file