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 DX5_DISPLAY_HH
|
---|
10 | #define DX5_DISPLAY_HH
|
---|
11 |
|
---|
12 | #include "video/display.hh"
|
---|
13 | #include "video/win32/win32_input.hh"
|
---|
14 | #include "video/win32/dx5_mouse.hh"
|
---|
15 | #include "video/win32/dd_cursor.hh"
|
---|
16 |
|
---|
17 | #include "error/error.hh"
|
---|
18 | #include <ddraw.h>
|
---|
19 |
|
---|
20 | class i4_cursor_class;
|
---|
21 |
|
---|
22 |
|
---|
23 | class i4_dx5_display_class : public i4_display_class
|
---|
24 | {
|
---|
25 | i4_draw_context_class *context;
|
---|
26 |
|
---|
27 | sw32 mouse_x, mouse_y, last_mouse_x, last_mouse_y;
|
---|
28 |
|
---|
29 | i4_dx5_image_class *fake_screen;
|
---|
30 |
|
---|
31 | i4_rect_list_class next_frame_copy;
|
---|
32 | i4_rect_list_class next_frame_two;
|
---|
33 |
|
---|
34 |
|
---|
35 | class i4_dx5_mode : public i4_display_class::mode
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | dx5_mode *dx5;
|
---|
39 | int driver_id;
|
---|
40 | } amode, cur_mode, last_mode;
|
---|
41 |
|
---|
42 | dx5_mode *mode_list;
|
---|
43 |
|
---|
44 | dx5_mouse_class *mouse;
|
---|
45 | ddraw_thread_cursor_class *thread_mouse;
|
---|
46 |
|
---|
47 | i4_bool use_page_flip, use_exclusive_mode;
|
---|
48 |
|
---|
49 | char name_buffer[1000];
|
---|
50 | public:
|
---|
51 | int using_accelerated_driver() { return (i4_bool)((cur_mode.driver_id & 0x8000)!=0); }
|
---|
52 |
|
---|
53 | i4_dx5_display_class();
|
---|
54 |
|
---|
55 | struct error_handler_type
|
---|
56 | {
|
---|
57 |
|
---|
58 | i4_error_function_type old_error_handler;
|
---|
59 | i4_bool need_restore_old;
|
---|
60 | error_handler_type() { need_restore_old=i4_F; }
|
---|
61 |
|
---|
62 | } error_handler;
|
---|
63 |
|
---|
64 | win32_input_class input;
|
---|
65 |
|
---|
66 | i4_draw_context_class *get_context() { return context; }
|
---|
67 | w16 width() const { return cur_mode.xres; }
|
---|
68 | w16 height() const { return cur_mode.yres; }
|
---|
69 |
|
---|
70 | mode *current_mode() { return &cur_mode; }
|
---|
71 | mode *get_first_mode(int driver_id);
|
---|
72 | mode *get_next_mode();
|
---|
73 | i4_bool initialize_mode();
|
---|
74 |
|
---|
75 | void flush();
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 | i4_image_class *get_screen();
|
---|
80 |
|
---|
81 | void init();
|
---|
82 |
|
---|
83 | // should be called before a program quits
|
---|
84 | i4_bool close();
|
---|
85 |
|
---|
86 | virtual i4_image_class *lock_frame_buffer(i4_frame_buffer_type type,
|
---|
87 | i4_frame_access_type access);
|
---|
88 | virtual void unlock_frame_buffer(i4_frame_buffer_type type);
|
---|
89 |
|
---|
90 |
|
---|
91 | i4_bool set_mouse_shape(i4_cursor_class *cursor);
|
---|
92 |
|
---|
93 | i4_bool lock_mouse_in_place(i4_bool yes_no)
|
---|
94 | {
|
---|
95 | return input.lock_mouse_in_place(yes_no);
|
---|
96 | }
|
---|
97 |
|
---|
98 | void begin_render_mode();
|
---|
99 | void end_render_mode();
|
---|
100 |
|
---|
101 | virtual i4_bool display_busy() const
|
---|
102 | {
|
---|
103 | return (i4_bool)(!input.get_active());
|
---|
104 | }
|
---|
105 |
|
---|
106 | virtual i4_refresh_type update_model();
|
---|
107 |
|
---|
108 | ~i4_dx5_display_class();
|
---|
109 | };
|
---|
110 |
|
---|
111 |
|
---|
112 | extern i4_dx5_display_class *i4_dx5_display;
|
---|
113 |
|
---|
114 | #endif
|
---|