1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #ifndef I4_WIN32_HH
|
---|
10 | #define I4_WIN32_HH
|
---|
11 |
|
---|
12 |
|
---|
13 | #include <windows.h>
|
---|
14 |
|
---|
15 | #include "video/win32/dx_cursor.hh"
|
---|
16 | #include "device/device.hh"
|
---|
17 | #include "palette/pal.hh"
|
---|
18 | #include "time/time.hh"
|
---|
19 | #include "window/win_evt.hh"
|
---|
20 |
|
---|
21 | class i4_display_class;
|
---|
22 |
|
---|
23 |
|
---|
24 | // this classes process key &mouse input for a win32 winow
|
---|
25 |
|
---|
26 | class win32_input_class : public i4_device_class
|
---|
27 | {
|
---|
28 | HWND whandle;
|
---|
29 |
|
---|
30 | char *window_name() { return "Golgotha Milestone 5"; }
|
---|
31 |
|
---|
32 | char *class_name() { return "Crack dot Com"; }
|
---|
33 |
|
---|
34 | // BOOL CreateKeyboard(GUID &guid, LPDIRECTINPUTDEVICE& lpdiKey, DWORD dwAccess);
|
---|
35 | // BOOL InitDInput(void);
|
---|
36 | w16 translate_windows_key(w16 wkey, w32 &modifer);
|
---|
37 | i4_bool have_window;
|
---|
38 | w16 modifier_state;
|
---|
39 | i4_bool active;
|
---|
40 | i4_display_class *display;
|
---|
41 | static i4_bool class_registered;
|
---|
42 | i4_bool mouse_locked;
|
---|
43 |
|
---|
44 | char window_message[128];
|
---|
45 | i4_time_class last_down[3], last_up[3];
|
---|
46 |
|
---|
47 | protected:
|
---|
48 | virtual void redraw() { ; }
|
---|
49 | virtual void resize(sw32 w, sw32 h) { ; }
|
---|
50 | virtual void move(sw32 x, sw32 y) { ; }
|
---|
51 | virtual void set_active(i4_bool yes_no) { active=yes_no; }
|
---|
52 | virtual void close_event() { ; }
|
---|
53 | public:
|
---|
54 |
|
---|
55 | enum mouse_button_type {LEFT,RIGHT,MIDDLE};
|
---|
56 | enum mouse_button_state {UP,DOWN};
|
---|
57 |
|
---|
58 | void update_mouse_movement(sw32 new_mouse_x, sw32 new_mouse_y);
|
---|
59 |
|
---|
60 | void update_mouse_buttons(i4_mouse_button_event_class::btype type, mouse_button_state state);
|
---|
61 |
|
---|
62 | HWND get_window_handle() { return whandle; }
|
---|
63 |
|
---|
64 | //dx_threaded_mouse_class *async_mouse;
|
---|
65 | void *async_mouse;
|
---|
66 |
|
---|
67 | sw32 mouse_x, mouse_y;
|
---|
68 | struct confine_struct
|
---|
69 | {
|
---|
70 | i4_bool on;
|
---|
71 | sw32 x1,y1,x2,y2;
|
---|
72 | confine_struct() { on=i4_F; }
|
---|
73 | } confine;
|
---|
74 |
|
---|
75 | sw32 process(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, DWORD time);
|
---|
76 |
|
---|
77 | win32_input_class(char *extra_message);
|
---|
78 |
|
---|
79 | char *name() { return "Win32 device manager"; }
|
---|
80 |
|
---|
81 | void get_window_area(int &x, int &y, int &w, int &h);
|
---|
82 |
|
---|
83 | i4_bool create_window(sw32 x, sw32 y, w32 w, w32 h,
|
---|
84 | i4_display_class *display_responsible_for_close,
|
---|
85 | i4_bool takeup_fullscreen=i4_F);
|
---|
86 |
|
---|
87 | void destroy_window();
|
---|
88 |
|
---|
89 | i4_bool get_active() const { return active; }
|
---|
90 |
|
---|
91 | virtual i4_bool process_events();
|
---|
92 |
|
---|
93 | void set_async_mouse(dx_threaded_mouse_class *m);
|
---|
94 |
|
---|
95 | i4_bool lock_mouse_in_place(i4_bool yes_no);
|
---|
96 | };
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 |
|
---|
102 | #endif
|
---|
103 |
|
---|