source: golgotha/src/i4/video/win32/dx_cursor.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 15 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.4 KB
Line 
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 DX_CURSOR_HH
10#define DX_CURSOR_HH
11
12#include "threads/threads.hh"
13#include "palette/pal.hh"
14#include "image/image.hh"
15
16
17#include "window/cursor.hh"
18#include <dinput.h>
19
20class win32_input_class;
21
22class dx_threaded_mouse_class
23{
24protected:
25
26  LPDIRECTINPUT          direct_input_driver;
27  LPDIRECTINPUTDEVICE    direct_input_mouse_device;
28  HANDLE                 direct_input_mouse_event;
29  HWND                   window_handle;
30   
31  i4_cursor_class     cursor;
32 
33  i4_bool             position_locked;
34 
35  i4_bool             active;
36
37  i4_bool             visible;        // this is false until cursor is first displayed
38 
39  volatile i4_bool    stop;           // set by delete(), who waits for thread to stop 
40
41  enum { thread_stack_size = 4000*1024 };
42 
43  void uninit_mouse();
44  void init_mouse(HWND hwnd);
45   
46public:
47  i4_critical_section_class draw_lock;
48  i4_critical_section_class acquire_lock;
49
50  sw32 clip_x1, clip_y1, clip_x2, clip_y2;
51
52
53  win32_input_class *input;
54
55  sw32 current_mouse_x,
56       current_mouse_y; 
57
58  sw32 save_mouse_x,
59       save_mouse_y;
60 
61  void lock_position(i4_bool yes_no)
62  {
63    if (yes_no)
64      position_locked = i4_T;
65    else
66      position_locked = i4_F;
67  }
68
69  // private, don't call
70  void thread();
71
72  virtual void remove()  {}
73  virtual void save()    {}
74  virtual void display() {}
75  virtual void set_cursor(i4_cursor_class *cursor) {};
76  virtual void use_backbuffer(i4_bool use_bbuf) = 0;
77 
78  virtual void set_visible(i4_bool set)
79  {   
80    visible = set;   
81  }
82
83
84  dx_threaded_mouse_class(const i4_pal *screen_pal,
85                          HWND window_handle,
86                          sw32 clip_x1, sw32 clip_y1,
87                          sw32 clip_x2, sw32 clip_y2);
88
89  virtual ~dx_threaded_mouse_class();
90
91  // call when app loses focus
92  void set_active(i4_bool act);
93};
94
95
96
97#endif
Note: See TracBrowser for help on using the repository browser.