[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
[494] | 4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
[56] | 5 | * |
---|
| 6 | * This software was released into the Public Domain. As with most public |
---|
[555] | 7 | * domain software, no warranty is made or implied by Crack dot Com, by |
---|
| 8 | * Jonathan Clark, or by Sam Hocevar. |
---|
[56] | 9 | */ |
---|
| 10 | |
---|
[2] | 11 | #ifndef __CONSOLE_HPP_ |
---|
| 12 | #define __CONSOLE_HPP_ |
---|
[481] | 13 | #include "jwindow.h" |
---|
[2] | 14 | |
---|
| 15 | class console |
---|
| 16 | { |
---|
| 17 | protected : |
---|
| 18 | int lastx,lasty,w,h,cx,cy; |
---|
| 19 | JCFont *fnt; |
---|
| 20 | char *screen; |
---|
[120] | 21 | Jwindow *con_win; |
---|
[2] | 22 | char *name; |
---|
| 23 | public : |
---|
| 24 | |
---|
[106] | 25 | console(JCFont *font, int width, int height, char const *Name); |
---|
[2] | 26 | int showing() { return con_win!=NULL; } |
---|
| 27 | void show(); |
---|
| 28 | void hide(); |
---|
| 29 | void redraw(); |
---|
| 30 | void put_char(char ch); |
---|
| 31 | void do_cr(); |
---|
| 32 | int screen_w() { return w*fnt->width(); } |
---|
| 33 | int screen_h() { return h*fnt->height(); } |
---|
| 34 | int wx() { return con_win->x1(); } |
---|
| 35 | int wy() { return con_win->y1(); } |
---|
| 36 | void draw_cursor(); |
---|
[39] | 37 | void put_string(char const *st); |
---|
[2] | 38 | void draw_char(int x, int y, char ch); |
---|
| 39 | void toggle() { if (con_win) hide(); else show(); } |
---|
[39] | 40 | void print_f(char const *format, ...); |
---|
[2] | 41 | ~console(); |
---|
| 42 | } ; |
---|
| 43 | |
---|
| 44 | class shell_term : public console |
---|
| 45 | { |
---|
| 46 | char shcmd[300]; |
---|
| 47 | public : |
---|
[106] | 48 | shell_term(JCFont *font, int width, int height, char const *Name); |
---|
[494] | 49 | virtual ~shell_term() { }; |
---|
[106] | 50 | int handle_event(event &ev); |
---|
[2] | 51 | virtual void prompt(); |
---|
[39] | 52 | virtual void execute(char const *st); |
---|
[2] | 53 | } ; |
---|
| 54 | |
---|
| 55 | #endif |
---|