summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-21 12:27:19 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-24 13:49:08 (GMT)
commitee39c061525e027adcf61379d9d28151ac96599a (patch)
tree49ffcd1fc7126f2f4e0fc253a9d07040005b609d /src
parentfc4de9640cedaaf73e3f43610492be8d92313929 (diff)
downloadpowder-ee39c061525e027adcf61379d9d28151ac96599a.zip
powder-ee39c061525e027adcf61379d9d28151ac96599a.tar.gz
Decorations toggle and brush size keys
Diffstat (limited to 'src')
-rw-r--r--src/interface.c58
-rw-r--r--src/main.c20
2 files changed, 72 insertions, 6 deletions
diff --git a/src/interface.c b/src/interface.c
index 6893d4c..ca61b4f 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -4360,7 +4360,7 @@ void decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy)
drawrect(vid_buf, window_offset_x + onleft_button_offset_x +1, window_offset_y +255+6, 12, 12, 255, 255, 255, 255);
drawrect(vid_buf, window_offset_x + 230, window_offset_y +255+6, 26, 12, 255, 255, 255, 255);
drawtext(vid_buf, window_offset_x + 232, window_offset_y +255+9, "Clear", 255, 255, 255, 255);
- drawtext(vid_buf, 2, 388, "Welcome to the decoration editor v.1 (by cracker64) \n\nPro tip: click the current color to move the selector to the other side. Left click is eraser. ", 255, 255, 255, 255);
+ drawtext(vid_buf, 2, 388, "Welcome to the decoration editor v.1 (by cracker64) \n\nPro tip: click the current color to move the selector to the other side. Right click is eraser. ", 255, 255, 255, 255);
ui_edit_draw(vid_buf, &box_R);
ui_edit_draw(vid_buf, &box_G);
ui_edit_draw(vid_buf, &box_B);
@@ -4557,6 +4557,62 @@ void decorations_ui(pixel *vid_buf,pixel *decorations,int *bsx,int *bsy)
}*/
}
}
+ if (sdl_key==SDLK_LEFTBRACKET) {
+ if (sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
+ {
+ *bsx -= 1;
+ *bsy -= 1;
+ }
+ else if (sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
+ {
+ *bsx -= 1;
+ }
+ else if (sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
+ {
+ *bsy -= 1;
+ }
+ else
+ {
+ *bsx -= ceil((*bsx/5)+0.5f);
+ *bsy -= ceil((*bsy/5)+0.5f);
+ }
+ if (*bsx>1180)
+ *bsx = 1180;
+ if (*bsy>1180)
+ *bsy = 1180;
+ if (*bsx<0)
+ *bsx = 0;
+ if (*bsy<0)
+ *bsy = 0;
+ }
+ if (sdl_key==SDLK_RIGHTBRACKET) {
+ if (sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
+ {
+ *bsx += 1;
+ *bsy += 1;
+ }
+ else if (sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
+ {
+ *bsx += 1;
+ }
+ else if (sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
+ {
+ *bsy += 1;
+ }
+ else
+ {
+ *bsx += ceil((*bsx/5)+0.5f);
+ *bsy += ceil((*bsy/5)+0.5f);
+ }
+ if (*bsx>1180)
+ *bsx = 1180;
+ if (*bsy>1180)
+ *bsy = 1180;
+ if (*bsx<0)
+ *bsx = 0;
+ if (*bsy<0)
+ *bsy = 0;
+ }
if(sdl_key=='b' || sdl_key==SDLK_ESCAPE)
{
free(old_buf);
diff --git a/src/main.c b/src/main.c
index fbb7aba..a4d73e0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -173,6 +173,7 @@ int sys_pause = 0;
int sys_shortcuts = 1;
int legacy_enable = 0; //Used to disable new features such as heat, will be set by save.
int ngrav_enable = 0; //Newtonian gravity, will be set by save
+int decorations_enable = 1;
int death = 0, framerender = 0;
int amd = 1;
int FPSB = 0;
@@ -2003,8 +2004,6 @@ int main(int argc, char *argv[])
vy[ny][nx] = -vy[ny][nx];
}
}
- if ((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
- active_menu = 11;
if (sdl_key==SDLK_INSERT)// || sdl_key==SDLK_BACKQUOTE)
REPLACE_MODE = !REPLACE_MODE;
if (sdl_key==SDLK_BACKQUOTE)
@@ -2014,8 +2013,19 @@ int main(int argc, char *argv[])
}
if (sdl_key=='b')
{
- decorations_ui(vid_buf,decorations,&bsx,&bsy);//decoration_mode = !decoration_mode;
- sys_pause=1;
+ if (sdl_mod & KMOD_CTRL)
+ {
+ decorations_enable = !decorations_enable;
+ itc = 51;
+ if (decorations_enable) strcpy(itc_msg, "Decorations layer: On");
+ else strcpy(itc_msg, "Decorations layer: Off");
+ }
+ else
+ {
+ decorations_ui(vid_buf,decorations,&bsx,&bsy);//decoration_mode = !decoration_mode;
+ decorations_enable = 1;
+ sys_pause=1;
+ }
}
if (sdl_key=='g')
{
@@ -2309,7 +2319,7 @@ int main(int argc, char *argv[])
}
}
menu_ui_v3(vid_buf, active_menu, &sl, &sr, &dae, b, bq, x, y); //draw the elements in the current menu
- draw_decorations(vid_buf,decorations);
+ if (decorations_enable) draw_decorations(vid_buf,decorations);
if (zoom_en && x>=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy //change mouse position while it is in a zoom window
&& x<sdl_scale*(zoom_wx+ZFACTOR*ZSIZE)
&& y<sdl_scale*(zoom_wy+ZFACTOR*ZSIZE))