Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

glut_display.hxx

Go to the documentation of this file.
00001 //  $Id: glut_display.hxx,v 1.6 2003/01/09 22:10:24 grumbel Exp $
00002 // 
00003 //  Construo - A wire-frame construction gamee
00004 //  Copyright (C) 2002 Ingo Ruhnke <[email protected]>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 // 
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_CONSTRUO_GLUT_DISPLAY_HXX
00021 #define HEADER_CONSTRUO_GLUT_DISPLAY_HXX
00022 
00023 #include "graphic_context.hxx"
00024 #include "input_context.hxx"
00025 
00027 class GlutDisplay : public GraphicContext,
00028                     public InputContext
00029 {
00030 private:
00031   static GlutDisplay* instance_;
00032 
00033   int width;
00034   int height;
00035 
00036   int mouse_x;
00037   int mouse_y;
00038 
00039   bool block;
00040 
00041   int update_display;
00042 
00043   bool is_fullscreen;
00044 public:
00045   static GlutDisplay* instance () { return instance_; }
00046 
00047   GlutDisplay (int w, int h);
00048   virtual ~GlutDisplay();
00049 
00050   void draw_lines (std::vector<Line>& lines, Color color, int wide = 0);
00051   void draw_line(float x1, float y1, float x2, float y2, Color color, int wide = 0);
00052   void draw_rect(float x1, float y1, float x2, float y2, Color color);
00053   void draw_fill_rect(float x1, float y1, float x2, float y2, Color color);
00054   void draw_circle(float x, float y, float r, Color color);
00055   void draw_circles(std::vector<Circle>& circles, Color color);
00056   void draw_fill_circle(float x, float y, float r, Color color);
00057   void draw_string(float x, float y, const std::string& str, Color color);
00058   void draw_string_centered(float x, float y, const std::string& str, Color color);
00059 
00060   void clear ();
00061   void flip ();
00062   void flip (int x1, int y1, int x2, int y2);
00063 
00064   void set_fullscreen (bool fullscreen);
00065   bool get_fullscreen () { return is_fullscreen; }
00066 
00067   int get_width()  { return width; }
00068   int get_height() { return height; }
00069 
00070   bool get_key (int key);
00071   int  get_mouse_x ();
00072   int  get_mouse_y ();
00073 
00074   void run();
00075 
00076   void reshape_func(int w, int h);
00077   void display_func ();
00078   void mouse_func (int button, int button_state, int x, int y);
00079   void idle_func ();
00080   void keyboard_func (unsigned char key, int x, int y);
00081   void mouse_motion_func (int x, int y);
00082 
00083   void set_clip_rect (int x1, int y1, int x2, int y2);
00084 
00085 private:
00086   GlutDisplay (const GlutDisplay&);
00087   GlutDisplay& operator= (const GlutDisplay&);
00088 };
00089 
00090 #endif
00091 
00092 /* EOF */

Generated on Thu Jul 24 10:24:29 2003 for Construo by doxygen1.3-rc3