Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef EGL_Window_INCLUDE_ONCE
00033 #define EGL_Window_INCLUDE_ONCE
00034
00035 #include <vlGraphics/OpenGLContext.hpp>
00036 #include <vlEGL/link_config.hpp>
00037 #include <EGL/egl.h>
00038 #include <map>
00039
00040 namespace vlEGL
00041 {
00042
00043 VLEGL_EXPORT int messageLoop();
00044 VLEGL_EXPORT void peekMessage(MSG& msg);
00045 VLEGL_EXPORT void dispatchUpdate();
00046
00047
00048
00052 class VLEGL_EXPORT EGLWindow: public vl::OpenGLContext
00053 {
00054 public:
00055 static const wchar_t* EGLWindowClassName;
00056 static LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
00057
00058 public:
00059 EGLWindow();
00060 ~EGLWindow();
00061
00062
00063
00064 void swapBuffers();
00065 void makeCurrent();
00066 void update();
00067 void quitApplication();
00068 void setMouseVisible(bool visible);
00069 void setPosition(int x, int y);
00070 void setSize(int w, int h);
00071 void setWindowSize(int w, int h);
00072 vl::ivec2 position() const;
00073 vl::ivec2 windowSize() const;
00074 vl::ivec2 size() const;
00075 void setWindowTitle(const vl::String& title);
00076 void show();
00077 void hide();
00078 void getFocus();
00079 void setMousePosition(int x, int y);
00080
00083 bool initEGLWindow(HWND parent, const vl::String& title, const vl::OpenGLContextFormat& fmt, int x=0, int y=0, int width=640, int height=480);
00084
00086 void destroyEGLGLWindow();
00087
00088 HWND hwnd() const { return mHWND; }
00089
00091 DWORD style() const { return mStyle; }
00092
00094 void setStyle(DWORD style) { mStyle = style; }
00095
00097 DWORD exStyle() const { return mStyle; }
00098
00100 void setExStyle(DWORD ex_style) { mStyle = ex_style; }
00101
00103 const wchar_t* windowClassName() const { return mWindowClassName; }
00104
00106 void setWindowClassName(const wchar_t* name) { mWindowClassName = name; }
00107
00108 const EGLDisplay& eglDisplay() const { return mEGL_Display; }
00109 const EGLContext& eglContext() const { return mEGL_Context; }
00110 const EGLSurface& eglSurface() const { return mEGL_Surface; }
00111
00112 protected:
00113 int mMouseDownCount;
00114 HWND mHWND;
00115 DWORD mStyle;
00116 DWORD mExStyle;
00117 const wchar_t* mWindowClassName;
00118
00119 EGLDisplay mEGL_Display;
00120 EGLContext mEGL_Context;
00121 EGLSurface mEGL_Surface;
00122
00123
00124
00125 public:
00127 static EGLWindow* getWindow(HWND hWnd);
00128 static const std::map< HWND, EGLWindow* >& winMap() { return mWinMap; }
00129
00130 protected:
00131 static std::map< HWND, EGLWindow* > mWinMap;
00132 };
00133
00134 VLEGL_EXPORT void translateKeyEvent(WPARAM wParam, LPARAM lParam, unsigned short& unicode_out, vl::EKey& key_out);
00135
00136 }
00137
00138 #endif