00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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