Rebuild autotool system
[construo.git] / glut_display.hxx
blob9039c11437979de8d4c9d1eb7a9d2a9b95e40695
1 // $Id: glut_display.hxx,v 1.13 2003/07/28 21:03:22 grumbel Exp $
2 //
3 // Construo - A wire-frame construction gamee
4 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef HEADER_CONSTRUO_GLUT_DISPLAY_HXX
21 #define HEADER_CONSTRUO_GLUT_DISPLAY_HXX
23 #include "root_graphic_context.hxx"
24 #include "input_context.hxx"
26 /** */
27 class GlutDisplay : public RootGraphicContext,
28 public InputContext
30 private:
31 static GlutDisplay* instance_;
33 /** X-Position of the glut window, used in fullscreen to allow a
34 restore */
35 int window_x_pos;
37 /** Y-Position of the glut window, used in fullscreen to allow a
38 restore */
39 int window_y_pos;
41 /** Width of the window, used to restore after fullscreen */
42 int window_width;
44 /** height of the window, used to restore after fullscreen */
45 int window_height;
47 /** The actual size of the current screen/window */
48 int width;
50 /** The actual size of the current screen/window */
51 int height;
53 int mouse_x;
54 int mouse_y;
56 bool block;
58 int update_display;
60 bool is_fullscreen;
61 public:
62 static GlutDisplay* instance () { return instance_; }
64 GlutDisplay (int w, int h, int fullscreen);
65 virtual ~GlutDisplay();
67 void draw_lines (std::vector<Line>& lines, Color color, int wide = 0);
68 void draw_line(float x1, float y1, float x2, float y2, Color color, int wide = 0);
69 void draw_rect(float x1, float y1, float x2, float y2, Color color);
70 void draw_fill_rect(float x1, float y1, float x2, float y2, Color color);
71 void draw_circle(float x, float y, float r, Color color);
72 void draw_circles(std::vector<Circle>& circles, Color color);
73 void draw_fill_circle(float x, float y, float r, Color color);
74 void draw_string(float x, float y, const std::string& str, Color color);
75 void draw_string_centered(float x, float y, const std::string& str, Color color);
77 void clear ();
78 void flip ();
79 void flip (int x1, int y1, int x2, int y2);
81 bool get_fullscreen () { return is_fullscreen; }
83 int get_width() { return width; }
84 int get_height() { return height; }
86 bool get_key (int key);
87 int get_mouse_x ();
88 int get_mouse_y ();
90 void run();
91 void set_cursor_real(CursorType);
92 void reshape_func(int w, int h);
93 void display_func ();
94 void mouse_func (int button, int button_state, int x, int y);
95 void idle_func ();
96 void keyboard_func (unsigned char key, int x, int y);
97 void special_func (int key, int x, int y);
98 void mouse_motion_func (int x, int y);
100 void set_clip_rect (int x1, int y1, int x2, int y2);
102 void push_quick_draw();
103 void pop_quick_draw();
105 void enter_fullscreen();
106 void leave_fullscreen();
107 private:
108 GlutDisplay (const GlutDisplay&);
109 GlutDisplay& operator= (const GlutDisplay&);
112 #endif
114 /* EOF */