summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSavely Skresanov <savask@yandex.ru>2012-05-31 10:47:52 (GMT)
committer Savely Skresanov <savask@yandex.ru>2012-05-31 10:49:40 (GMT)
commit19ae18c0595be7ae08813717245290de34d761d0 (patch)
tree90eaf662a3d5cbca367a431ab06ebb1bdd948dcf /src
parent65e79b4b8f56422d3057e1d5e308292bc08b3583 (diff)
downloadpowder-19ae18c0595be7ae08813717245290de34d761d0.zip
powder-19ae18c0595be7ae08813717245290de34d761d0.tar.gz
Added a settings option to draw a wall frame around screen.
Diffstat (limited to 'src')
-rw-r--r--src/interface.c18
-rw-r--r--src/main.c6
-rw-r--r--src/misc.c32
3 files changed, 54 insertions, 2 deletions
diff --git a/src/interface.c b/src/interface.c
index c1b8df2..6ee5974 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -6971,7 +6971,7 @@ void render_ui(pixel * vid_buf, int xcoord, int ycoord, int orientation)
void simulation_ui(pixel * vid_buf)
{
int xsize = 300;
- int ysize = 246;
+ int ysize = 260;
int x0=(XRES-xsize)/2,y0=(YRES-MENUSIZE-ysize)/2,b=1,bq,mx,my;
int new_scale, new_kiosk;
ui_checkbox cb;
@@ -6980,6 +6980,7 @@ void simulation_ui(pixel * vid_buf)
ui_checkbox cb4;
ui_checkbox cb5;
ui_checkbox cb6;
+ ui_checkbox cb7;
char * airModeList[] = {"On", "Pressure Off", "Velocity Off", "Off", "No Update"};
int airModeListCount = 5;
char * gravityModeList[] = {"Vertical", "Off", "Radial"};
@@ -7016,6 +7017,11 @@ void simulation_ui(pixel * vid_buf)
cb6.y = y0+107;
cb6.focus = 0;
cb6.checked = water_equal_test;
+
+ cb7.x = x0+xsize-16; //Block frame
+ cb7.y = y0+227;
+ cb7.focus = 0;
+ cb7.checked = bframe;
list.x = x0+xsize-76; //Air Mode
list.y = y0+135;
@@ -7081,6 +7087,9 @@ void simulation_ui(pixel * vid_buf)
drawtext(vid_buf, x0+8, y0+214, "Fullscreen", 255, 255, 255, 255);
drawtext(vid_buf, x0+12+textwidth("Fullscreen"), y0+214, "Fill the entire screen", 255, 255, 255, 180);
+ drawtext(vid_buf, x0+8, y0+228, "Block frame", 255, 255, 255, 255);
+ drawtext(vid_buf, x0+12+textwidth("Block frame"), y0+228, "Draws a wall frame around screen", 255, 255, 255, 180);
+
//TODO: Options for Air and Normal gravity
//Maybe save/load defaults too.
@@ -7093,6 +7102,7 @@ void simulation_ui(pixel * vid_buf)
ui_checkbox_draw(vid_buf, &cb4);
ui_checkbox_draw(vid_buf, &cb5);
ui_checkbox_draw(vid_buf, &cb6);
+ ui_checkbox_draw(vid_buf, &cb7);
ui_list_draw(vid_buf, &list);
ui_list_draw(vid_buf, &list2);
#ifdef OGLR
@@ -7105,6 +7115,7 @@ void simulation_ui(pixel * vid_buf)
ui_checkbox_process(mx, my, b, bq, &cb4);
ui_checkbox_process(mx, my, b, bq, &cb5);
ui_checkbox_process(mx, my, b, bq, &cb6);
+ ui_checkbox_process(mx, my, b, bq, &cb7);
ui_list_process(vid_buf, mx, my, b, &list);
ui_list_process(vid_buf, mx, my, b, &list2);
@@ -7138,6 +7149,11 @@ void simulation_ui(pixel * vid_buf)
else
stop_grav_async();
}
+ if(cb7.checked && !bframe)
+ draw_bframe();
+ if(!cb7.checked && bframe)
+ erase_bframe();
+ bframe = cb7.checked;
while (!sdl_poll())
{
diff --git a/src/main.c b/src/main.c
index 2423ab7..bd15e8c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -307,6 +307,8 @@ void dump_frame(pixel *src, int w, int h, int pitch)
* STATE MANAGEMENT *
***********************************************************/
+char bframe = 0;
+
void clear_sim(void)
{
int i, x, y;
@@ -352,6 +354,8 @@ void clear_sim(void)
hv[y][x] = 273.15f+22.0f; //Set to room temperature
}
}
+ if(bframe)
+ draw_bframe();
}
// stamps library
@@ -801,7 +805,6 @@ int main(int argc, char *argv[])
parts = calloc(sizeof(particle), NPART);
cb_parts = calloc(sizeof(particle), NPART);
init_can_move();
- clear_sim();
#ifdef LUACONSOLE
luacon_open();
@@ -854,6 +857,7 @@ int main(int argc, char *argv[])
}
load_presets();
+ clear_sim();
for (i=1; i<argc; i++)
{
diff --git a/src/misc.c b/src/misc.c
index 210e4d2..11cdc88 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -135,6 +135,36 @@ void clean_text(char *text, int vwidth)
}
}
+void draw_bframe()
+{
+ int i;
+ for(i=0; i<(XRES/CELL); i++)
+ {
+ bmap[0][i]=WL_WALL;
+ bmap[YRES/CELL-1][i]=WL_WALL;
+ }
+ for(i=1; i<((YRES/CELL)-1); i++)
+ {
+ bmap[i][0]=WL_WALL;
+ bmap[i][XRES/CELL-1]=WL_WALL;
+ }
+}
+
+void erase_bframe()
+{
+ int i;
+ for(i=0; i<(XRES/CELL); i++)
+ {
+ bmap[0][i]=0;
+ bmap[YRES/CELL-1][i]=0;
+ }
+ for(i=1; i<((YRES/CELL)-1); i++)
+ {
+ bmap[i][0]=0;
+ bmap[i][XRES/CELL-1]=0;
+ }
+}
+
void save_presets(int do_update)
{
char * outputdata;
@@ -186,6 +216,7 @@ void save_presets(int do_update)
//General settings
cJSON_AddStringToObject(root, "proxy", http_proxy_string);
cJSON_AddNumberToObject(root, "scale", sdl_scale);
+ cJSON_AddNumberToObject(root, "bframe", bframe);
outputdata = cJSON_Print(root);
cJSON_Delete(root);
@@ -324,6 +355,7 @@ void load_presets(void)
if((tmpobj = cJSON_GetObjectItem(root, "proxy")) && tmpobj->type == cJSON_String) strncpy(http_proxy_string, tmpobj->valuestring, 255); else http_proxy_string[0] = 0;
//TODO: Translate old cmode value into new *_mode values
if(tmpobj = cJSON_GetObjectItem(root, "scale")) sdl_scale = tmpobj->valueint;
+ if(tmpobj = cJSON_GetObjectItem(root, "bframe")) bframe = tmpobj->valueint;
cJSON_Delete(root);
free(prefdata);