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 __DIRECTX_HH
|
---|
10 | #define __DIRECTX_HH
|
---|
11 |
|
---|
12 | #include "image/depth.hh"
|
---|
13 | #include "image/image16.hh"
|
---|
14 | #include "video/display.hh"
|
---|
15 | #include "video/win32/win32_input.hh"
|
---|
16 | #include <ddraw.h>
|
---|
17 |
|
---|
18 | void dx_error(sw32 result);
|
---|
19 |
|
---|
20 | //class directx_mouse_cursor_class;
|
---|
21 |
|
---|
22 | class directx_display_class : public i4_display_class
|
---|
23 | {
|
---|
24 | protected:
|
---|
25 | i4_image_class *mouse_pict;
|
---|
26 |
|
---|
27 | I4_SCREEN_TYPE *mouse_save,
|
---|
28 | *screen;
|
---|
29 | i4_coord mouse_hot_x,mouse_hot_y;
|
---|
30 | i4_pal_handle_class mouse_pal;
|
---|
31 | i4_color mouse_trans;
|
---|
32 |
|
---|
33 |
|
---|
34 |
|
---|
35 | I4_SCREEN_TYPE *back_buffer;
|
---|
36 | i4_bool win_is_open, exclusive_mode, using_emulation;
|
---|
37 |
|
---|
38 | LPDIRECTDRAW direct_draw_driver; // DirectDraw object
|
---|
39 | LPDIRECTDRAWSURFACE back_surface, primary_surface;
|
---|
40 |
|
---|
41 |
|
---|
42 | // directx_mouse_cursor_class *cursor;
|
---|
43 | i4_draw_context_class *context;
|
---|
44 |
|
---|
45 | public:
|
---|
46 | win32_input_class input;
|
---|
47 |
|
---|
48 | i4_bool saw_last, full_screen;
|
---|
49 |
|
---|
50 | void get_window_pos(sw32 &x, sw32 &y);
|
---|
51 |
|
---|
52 | // this is over-riding in the d3d_display so to search for hardware accelerators
|
---|
53 | virtual i4_bool create_direct_draw();
|
---|
54 |
|
---|
55 |
|
---|
56 | void destroy_direct_draw();
|
---|
57 |
|
---|
58 | directx_display_class();
|
---|
59 |
|
---|
60 | class directx_mode : public i4_display_class::mode
|
---|
61 | {
|
---|
62 | public :
|
---|
63 | directx_display_class *assoc; // pointer to use, so we can confirm we created this mode
|
---|
64 |
|
---|
65 | } amode, cur_mode, *last_found;
|
---|
66 |
|
---|
67 |
|
---|
68 | i4_bool create_back_surface(directx_mode *mode);
|
---|
69 |
|
---|
70 | virtual w16 width() const
|
---|
71 | {
|
---|
72 | return back_buffer->width();
|
---|
73 | }
|
---|
74 |
|
---|
75 | virtual w16 height() const
|
---|
76 | {
|
---|
77 | return back_buffer->height();
|
---|
78 | }
|
---|
79 |
|
---|
80 | virtual i4_bool remove_cursor() { return i4_T; }
|
---|
81 |
|
---|
82 | virtual i4_draw_context_class *get_context() { return context; }
|
---|
83 |
|
---|
84 | // called when windows gives us a WM_MOVE message, this tells everyone else interested
|
---|
85 | virtual void move_screen(i4_coord x, i4_coord y);
|
---|
86 |
|
---|
87 |
|
---|
88 | mode *current_mode() { return &cur_mode; }
|
---|
89 | mode *get_first_mode();
|
---|
90 | mode *get_next_mode(mode *last_mode);
|
---|
91 |
|
---|
92 | virtual i4_bool initialize_mode(mode *which_one);
|
---|
93 | i4_bool open_window(directx_mode *mode);
|
---|
94 | virtual i4_bool close();
|
---|
95 |
|
---|
96 |
|
---|
97 | virtual void flush();
|
---|
98 | virtual i4_image_class *get_screen();
|
---|
99 |
|
---|
100 | i4_bool set_mouse_shape(i4_cursor_class *cursor);
|
---|
101 | virtual i4_bool realize_palette(i4_pal_handle_class pal_id)
|
---|
102 | {
|
---|
103 | return i4_T; // pretend like this works for now
|
---|
104 | }
|
---|
105 |
|
---|
106 | virtual i4_bool lock_mouse_in_place(i4_bool yes_no)
|
---|
107 | {
|
---|
108 | return input.lock_mouse_in_place(yes_no);
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | virtual i4_bool create_surfaces(directx_mode *mode);
|
---|
113 | virtual void active(i4_bool act);
|
---|
114 | virtual w32 priority();
|
---|
115 |
|
---|
116 | virtual char *name() const { return "DirectX"; }
|
---|
117 | virtual i4_bool available();
|
---|
118 | };
|
---|
119 |
|
---|
120 |
|
---|
121 | #endif
|
---|