1 // $Id: glut_display.hxx,v 1.13 2003/07/28 21:03:22 grumbel Exp $
3 // Construo - A wire-frame construction gamee
4 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
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.
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"
27 class GlutDisplay
: public RootGraphicContext
,
31 static GlutDisplay
* instance_
;
33 /** X-Position of the glut window, used in fullscreen to allow a
37 /** Y-Position of the glut window, used in fullscreen to allow a
41 /** Width of the window, used to restore after fullscreen */
44 /** height of the window, used to restore after fullscreen */
47 /** The actual size of the current screen/window */
50 /** The actual size of the current screen/window */
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
);
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
);
91 void set_cursor_real(CursorType
);
92 void reshape_func(int w
, int h
);
94 void mouse_func (int button
, int button_state
, int x
, int y
);
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();
108 GlutDisplay (const GlutDisplay
&);
109 GlutDisplay
& operator= (const GlutDisplay
&);