00001
00002
00003
00004 #ifndef UBER_VIDEO_X_H
00005 #define UBER_VIDEO_X_H 1
00006
00007 #include "video_base.h"
00008 #include <X11/Xlib.h>
00009 #include <GL/glx.h>
00010 #include <X11/extensions/xf86vmode.h>
00011
00013
00016 class video_X: public video_base {
00017 protected:
00018 Display *m_display;
00019 Window m_window;
00020 GLXContext m_window_context;
00021 XVisualInfo *m_selected_visual;
00022 XF86VidModeModeInfo m_desktop_mode;
00023 std::string m_window_title;
00024 int *m_GL_attributes;
00025 #ifdef GLX_SGIX_fbconfig
00026 GLXFBConfigSGIX *m_available_configs;
00027 int m_num_available_configs;
00028 #endif
00029
00030 public:
00032 video_X(void);
00033
00035 virtual ~video_X(void);
00036
00038
00046 virtual bool init(unsigned int w, unsigned int h, unsigned int bpp, bool fs);
00047
00049
00060 virtual bool init(unsigned int w, unsigned int h, unsigned int bpp, const int attributes[], bool fs);
00061
00063 virtual void set_title(const std::string& title);
00064
00066 virtual void resize(unsigned int width, unsigned int height);
00067
00069
00072 virtual void start_frame(void);
00073
00075
00078 virtual void end_frame(void);
00079
00081
00085 virtual void toggle_fullscreen(void);
00086
00088 virtual void activate(void);
00089
00091
00095 virtual void shutdown(void);
00096
00098 inline Display* get_display(void){
00099 return m_display;
00100 }
00101
00103 inline GLXContext get_context(void){
00104 return m_window_context;
00105 }
00106
00108
00113 virtual void set_eventmask(long eventmask);
00114
00116
00120 virtual void move_pointer(int x, int y);
00121
00123
00129 virtual bool get_pointer(int *x, int *y);
00130
00131 #ifdef GLX_SGIX_fbconfig
00132
00133 static const int VISUAL_ATTRIBUTES_8BPP[];
00134
00136 static const int VISUAL_ATTRIBUTES_16BPP[];
00137
00139 static const int VISUAL_ATTRIBUTES_24BPP[];
00140
00142 static const int VISUAL_ATTRIBUTES_32BPP[];
00143 #else
00144
00145 static const int VISUAL_ATTRIBUTES_8BPP[];
00146
00148 static const int VISUAL_ATTRIBUTES_16BPP[];
00149
00151 static const int VISUAL_ATTRIBUTES_24BPP[];
00152
00154 static const int VISUAL_ATTRIBUTES_32BPP[];
00155 #endif
00156 private:
00158 static const int LARGE;
00159
00160 };
00161
00162 #endif