[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 __GUI_HPP_ |
---|
| 12 | #define __GUI_HPP_ |
---|
[481] | 13 | #include "jwindow.h" |
---|
[2] | 14 | |
---|
| 15 | |
---|
| 16 | class ico_button : public ifield |
---|
| 17 | { |
---|
| 18 | int up,act,u,d,ua,da; // up, down, up active, down active |
---|
| 19 | int activate_id; // sent when if not -1 when object receives a draw actove |
---|
| 20 | char key[16]; |
---|
[124] | 21 | public : |
---|
[39] | 22 | ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id=-1, char const *help_key=NULL); |
---|
[2] | 23 | |
---|
[106] | 24 | virtual void area(int &x1, int &y1, int &x2, int &y2); |
---|
| 25 | virtual void draw_first(image *screen) { draw(0,screen); } |
---|
[124] | 26 | virtual void draw(int active, image *screen); |
---|
[120] | 27 | virtual void handle_event(event &ev, image *screen, InputManager *im); |
---|
[2] | 28 | |
---|
| 29 | virtual char *read() { return (char *)&up; } |
---|
| 30 | void set_xy(int X, int Y) { x=X; y=Y; } |
---|
| 31 | int X() { return x; } |
---|
| 32 | int Y() { return y; } |
---|
| 33 | int status() { return up; } |
---|
| 34 | void set_act_id(int id); |
---|
| 35 | } ; |
---|
| 36 | |
---|
| 37 | class ico_switch_button : public ifield |
---|
| 38 | { |
---|
| 39 | ifield *blist,*cur_but; |
---|
| 40 | int act; |
---|
| 41 | public : |
---|
| 42 | ico_switch_button(int X, int Y, int ID, int start_on, ifield *butts, ifield *Next); |
---|
[106] | 43 | virtual void area(int &x1, int &y1, int &x2, int &y2); |
---|
| 44 | virtual void draw_first(image *screen) { cur_but->draw_first(screen); } |
---|
| 45 | virtual void draw(int active, image *screen) { cur_but->draw(active,screen); act=active; } |
---|
[120] | 46 | virtual void handle_event(event &ev, image *screen, InputManager *im); |
---|
[2] | 47 | virtual ifield *unlink(int id); |
---|
| 48 | virtual char *read() { return cur_but->read(); } |
---|
| 49 | ~ico_switch_button(); |
---|
[124] | 50 | } ; |
---|
[2] | 51 | |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | |
---|