source: golgotha/src/i4/video/win32/win32.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: 3.6 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 __WIN32_HPP_
10#define __WIN32_HPP_
11
12#include <windows.h>
13#include "threads/threads.hh"
14
15#include "image/image.hh"
16#include "video/display.hh"
17#include "isllist.hh"
18#include "video/win32/win32_input.hh"
19
20class win32_display_class : public i4_display_class
21
22private:
23  i4_bool create_direct_draw();
24  void destroy_direct_draw();
25
26  void copy_part_to_vram(i4_coord x, i4_coord y,
27                         i4_coord x1, i4_coord y1,
28                         i4_coord x2, i4_coord y2);
29
30
31
32  mode amode, cur_mode;
33
34  I4_SCREEN_TYPE          *back_buffer;
35  BITMAPINFOHEADER         back_buffer_bmp;
36  BITMAPINFO               dc_bmpinfo;
37  i4_bool                  win_is_open;
38  HBITMAP                  bitmap;
39  i4_draw_context_class   *context; 
40  w32                      open_window_flags;  // passed to CreateWindowEx
41
42public:
43  win32_input_class input;
44
45  void make_window_stay_top(i4_bool yes);
46
47
48  i4_bool minimized;
49
50  char *class_name() { return "game"; }
51  char *window_name() { return "window"; }
52
53  virtual mode *current_mode() { return &cur_mode; }
54                         
55  i4_coord            current_window_x,current_window_y;
56  friend class win32_device_manager;
57
58  virtual w16 width() const { return back_buffer->width(); }
59  virtual w16 height() const { return back_buffer->height(); }
60
61
62  // called when windows gives us a WM_MOVE message, this tells everyone else interested
63  void move_screen(i4_coord x, i4_coord y);         
64  // called when windows gives us a WM_RESIZE message, this tells everyone else interested
65  void resize_screen(i4_coord w, i4_coord h);         
66
67 
68  virtual i4_bool set_mouse_shape(i4_cursor_class *cursor)
69  {
70    return i4_F;
71  }
72
73  // devices local to this display (Keys & mice)
74  virtual i4_device_class *local_devices() { return &input; }
75
76  // makes the physical display consistant with previous gfx calls
77  // either through page flipping or copying dirty rects from an
78  // off-screen buffer
79  virtual void flush();
80  virtual i4_image_class *get_screen() { return back_buffer; }
81
82  // returns some descriptive name for this display
83  virtual char *name() { return "Windowed"; }
84
85  virtual i4_draw_context_class *get_context() { return context; }
86  win32_display_class();
87
88  virtual mode *get_first_mode();
89  virtual mode *get_next_mode(mode *last_mode) { return 0; }
90
91
92  // initialize_mode need not call close() to switch to another mode
93  virtual i4_bool initialize_mode(mode *which_one);
94
95  // should be called before a program quits
96  virtual i4_bool close();
97  virtual i4_bool available() { return i4_T; }
98
99  virtual i4_image_class *grab_framebuffer() { return back_buffer->copy(); }
100
101  // loads palette into hardware registers, return i4_F if pal_id is wrong color depth for display
102  virtual i4_bool realize_palette(i4_pal_handle_class pal_id)
103  {
104    return i4_F;
105  }
106
107  virtual i4_bool display_busy() const
108  {
109    if (!input.get_active())
110      return i4_T;
111    else return i4_F;
112  }
113
114  virtual void set_mouse_raw_mode(i4_bool yes_no)
115  {
116    input.set_mouse_raw_mode(yes_no);
117  }
118};
119
120extern win32_display_class win32_display_instance;
121
122#endif
123
124
125
Note: See TracBrowser for help on using the repository browser.