added 3dengfx into the repo, probably not the correct version for this
[summerhack] / src / 3dengfx / src / fxwt / fxwt.hpp
1 /*
2 This file is part of fxwt, the window system toolkit of 3dengfx.
3
4 Copyright (c) 2004, 2005 John Tsiombikas <nuclear@siggraph.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 /* main fxwt event handling and system abstraction.
22  *
23  * Author: John Tsiombikas 2004
24  */
25
26 #ifndef _FXWT_HPP_
27 #define _FXWT_HPP_
28
29 #include <list>
30
31 #include "text.hpp"
32 #include "init.hpp"
33 #include "keysyms.hpp"
34
35 namespace fxwt {
36
37         enum {
38                 BN_LEFT                 = 1,
39                 BN_MIDDLE               = 2,
40                 BN_RIGHT                = 3,
41                 BN_WHEELUP              = 4,
42                 BN_WHEELDOWN    = 5
43         };
44
45         extern std::list<void (*)()> disp_handlers;
46         extern std::list<void (*)()> idle_handlers;
47         extern std::list<void (*)(int)> keyb_handlers;
48         extern std::list<void (*)(int, int)> motion_handlers;
49         extern std::list<void (*)(int, int, int, int)> button_handlers;
50         
51         extern bool button_state[6];
52         extern int screenx, screeny;
53
54         void init();
55
56         void set_display_handler(void (*handler)());
57         void set_idle_handler(void (*handler)());
58         void set_keyboard_handler(void (*handler)(int));
59         void set_motion_handler(void (*handler)(int, int));
60         void set_button_handler(void (*handler)(int, int, int, int));
61
62         void remove_display_handler(void (*handler)());
63         void remove_idle_handler(void (*handler)());
64         void remove_keyboard_handler(void (*handler)(int));
65         void remove_motion_handler(void (*handler)(int, int));
66         void remove_button_handler(void (*handler)(int, int, int, int));
67
68         bool mouse_button_pressed(int bn);
69
70         Vector2 get_mouse_pos_normalized();
71
72         void set_window_title(const char *title);
73         void swap_buffers();
74         
75         int main_loop();
76 }
77
78 #endif  /* _FXWT_HPP_ */