1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
5 | * |
---|
6 | * This software was released into the Public Domain. As with most public |
---|
7 | * domain software, no warranty is made or implied by Crack dot Com, by |
---|
8 | * Jonathan Clark, or by Sam Hocevar. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef __GUI_HPP_ |
---|
12 | #define __GUI_HPP_ |
---|
13 | #include "jwindow.h" |
---|
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]; |
---|
21 | public : |
---|
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); |
---|
23 | |
---|
24 | virtual void area(int &x1, int &y1, int &x2, int &y2); |
---|
25 | virtual void draw_first(image *screen) { draw(0,screen); } |
---|
26 | virtual void draw(int active, image *screen); |
---|
27 | virtual void handle_event(event &ev, image *screen, InputManager *im); |
---|
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); |
---|
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; } |
---|
46 | virtual void handle_event(event &ev, image *screen, InputManager *im); |
---|
47 | virtual ifield *unlink(int id); |
---|
48 | virtual char *read() { return cur_but->read(); } |
---|
49 | ~ico_switch_button(); |
---|
50 | } ; |
---|
51 | |
---|
52 | #endif |
---|
53 | |
---|
54 | |
---|