source: golgotha/src/i4/video/opengl/opengl_display.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 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#include "video/x11/x11_input.hh"
10#include "video/display.hh"
11
12class opengl_display_class : public i4_display_class
13{
14  int GLX_error_base;
15  int GLX_event_base;
16  i4_bool know_if_available, known_availability;
17
18
19  i4_draw_context_class *context;
20  mode amode, cur_mode;
21  i4_cursor_class *mcursor;
22
23  i4_image_class *mouse_save1,          // save of screen under mouse
24    *mouse_save2,
25    *prev_mouse_save;      // pointer to mouse_save1 or 2, depending on which saved last
26 
27  void remove_cursor(sw32 x, sw32 y, i4_image_class *mouse_save);
28  void save_and_draw_cursor(sw32 x, sw32 y, i4_image_class *&mouse_save);
29
30  i4_image_class *fake_screen;
31  i4_rect_list_class next_frame_copy;
32  sw32 last_mouse_x, last_mouse_y;
33 
34public:
35  x11_input_class input;
36
37  void get_pl_pos(int pixel_x, int pixel_y, float &glx, float &gly)
38  {
39    glx = pixel_x *2.0 / (float)(width()) -1;
40    gly = ((height()-pixel_y) *2.0/  (float)height() -1 );
41  }
42
43  virtual char *name() { return "OpenGl X display"; }
44  virtual i4_draw_context_class *get_context() { return context; }
45  virtual i4_image_class *get_screen() { return fake_screen; }
46  i4_bool set_mouse_shape(i4_cursor_class *cursor);
47  virtual void flush();
48  virtual w16 width() const { return fake_screen->width(); }
49  virtual w16 height() const { return fake_screen->height(); }
50
51  virtual mode *current_mode() { return &cur_mode; } 
52  virtual mode *get_first_mode();
53  virtual mode *get_next_mode(mode *last_mode) { return 0; }
54  virtual i4_bool initialize_mode(mode *which_one);
55
56  virtual i4_bool close();
57  virtual i4_bool realize_palette(i4_pal_handle_class pal_id) { return i4_F; }
58
59  virtual i4_bool lock_mouse_in_place(i4_bool yes_no) { return input.lock_mouse_in_place(yes_no); }
60
61
62
63
64  opengl_display_class();
65
66  i4_bool available();
67  XVisualInfo *get_visual(Display *display);
68
69
70};
71
72extern opengl_display_class opengl_display_instance;
Note: See TracBrowser for help on using the repository browser.