summaryrefslogtreecommitdiff
path: root/src/interface.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-02-24 02:55:33 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-02-24 02:55:33 (GMT)
commita53d956d8dea008f6719b3d537c0e1d204c476c0 (patch)
tree117b557fff2bee809411fd9f397eb1865a92a944 /src/interface.c
parentcf80586ddc0e49e8bde1326af69d22016e9aede3 (diff)
downloadpowder-a53d956d8dea008f6719b3d537c0e1d204c476c0.zip
powder-a53d956d8dea008f6719b3d537c0e1d204c476c0.tar.gz
transparent console....
Diffstat (limited to 'src/interface.c')
-rw-r--r--src/interface.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/interface.c b/src/interface.c
index a762b39..5e8eed4 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -3841,6 +3841,7 @@ typedef struct command_history command_history;
command_history *last_command = NULL;
char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
int mx,my,b,cc,ci = -1;
+ pixel *old_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
command_history *currentcommand;
ui_edit ed;
ed.x = 15;
@@ -3853,7 +3854,9 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
ed.hide = 0;
ed.multiline = 0;
ed.cursor = 0;
- //fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
+ memcpy(old_buf,vid_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
+ fillrect(old_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
+
while (!sdl_poll())
{
b = SDL_GetMouseState(&mx, &my);
@@ -3861,19 +3864,11 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
my /= sdl_scale;
ed.focus = 1;
- clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
+ //clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
+ memcpy(vid_buf,old_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE);
- drawtext(vid_buf, 100, 15, "Welcome to The Powder Toy console v.2 (by cracker64)\n"
- "Current commands are quit, set, reset, load, create, file, kill, sound\n"
- "You can set type, temp, ctype, life, x, y, vx, vy using this format ('set life particle# 9001')\n"
- "You can also use 'all' instead of a particle number to do it to everything.\n"
- "You can now use particle names (ex. set type all deut)\n"
- "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n"
- "To load a save use load saveID (ex. load 1337)\n"
- "Create particles with 'create deut x,y' where x and y are the coords\n"
- "Run scripts from file 'file filename'\n"
- "You can delete/kill a particle with 'kill x,y'"
- "Play a sound with (sound blah.wav)"
+ drawtext(vid_buf, 100, 15, "Welcome to The Powder Toy console v.3 (by cracker64)\n"
+ "Current commands are quit, set, reset, load, create, file, kill, sound\n" //TODO: help command
,255, 187, 187, 255);
cc = 0;
@@ -3911,11 +3906,13 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
currentcommand->prev_command = last_command;
currentcommand->command = mystrdup(ed.str);
last_command = currentcommand;
+ free(old_buf);
return currentcommand->command;
}
if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE)
{
console_mode = 0;
+ free(old_buf);
return NULL;
}
if(sdl_key==SDLK_UP || sdl_key==SDLK_DOWN)
@@ -3951,6 +3948,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
}
}
console_mode = 0;
+ free(old_buf);
return NULL;
}