diff options
| author | Simon <simon@hardwired.org.uk> | 2011-01-30 20:05:47 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-01-30 20:05:47 (GMT) |
| commit | 8510421b37b024498a82753fef47051a7fb1687d (patch) | |
| tree | 81bc0ba557dd415042003bcae02ee779a3236fd8 /src/interface.c | |
| parent | 7522e95a9d7103d73b93538b233f67416e6d0921 (diff) | |
| parent | fcf958da21621887a80249f2af863991544815fd (diff) | |
| download | powder-8510421b37b024498a82753fef47051a7fb1687d.zip powder-8510421b37b024498a82753fef47051a7fb1687d.tar.gz | |
Merge with crackers console
Diffstat (limited to 'src/interface.c')
| -rw-r--r-- | src/interface.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/interface.c b/src/interface.c index eef4b5b..e83adcb 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3809,3 +3809,54 @@ void open_link(char *uri) { printf("Cannot open browser\n"); #endif } +char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands + int mx,my,b,bq; + ui_edit ed; + ed.x = 15; + ed.y = 210; + ed.w = XRES; + ed.nx = 1; + ed.def = ""; + strcpy(ed.str, ""); + ed.focus = 1; + ed.hide = 0; + ed.multiline = 0; + ed.cursor = 0; + //fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190); + while (!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + ed.focus = 1; + + clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent? + draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE); + drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.1 (by cracker64)\n" + "Current commands are quit, set, reset, load\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" + "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n" + "To load a save use load saveID (ex. load 1337)" + ,255, 187, 187, 255); + if(error) + drawtext(vid_buf, 15, 190, error,255, 187, 187, 255); + ui_edit_draw(vid_buf, &ed); + ui_edit_process(mx, my, b, &ed); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + if (sdl_key==SDLK_RETURN) + { + return ed.str; + } + if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE) + { + console_mode = 0; + return NULL; + } + + } + + +} + |
