* See also:
* - http://www.opengl.org/archives/resources/faq/technical/mswindows.htm
*/
-static __PFNWGLCHOOSEPIXELFORMAT pfnChoosePixelFormat = &ChoosePixelFormat;
-static __PFNWGLSETPIXELFORMAT pfnSetPixelFormat = &SetPixelFormat;
-static __PFNWGLSWAPBUFFERS pfnSwapBuffers = &SwapBuffers;
+static PFN_WGLCHOOSEPIXELFORMAT pfnChoosePixelFormat = &ChoosePixelFormat;
+static PFN_WGLSETPIXELFORMAT pfnSetPixelFormat = &SetPixelFormat;
+static PFN_WGLSWAPBUFFERS pfnSwapBuffers = &SwapBuffers;
static LRESULT CALLBACK
{
MINMAXINFO *pMMI;
switch (uMsg) {
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_ESCAPE:
+ PostMessage(hWnd, WM_CLOSE, 0, 0);
+ break;
+ }
+ break;
case WM_GETMINMAXINFO:
// Allow to create a window bigger than the desktop
pMMI = (MINMAXINFO *)lParam;
pMMI->ptMaxTrackSize.x = 60000;
pMMI->ptMaxTrackSize.y = 60000;
break;
+ case WM_CLOSE:
+ exit(0);
+ break;
default:
break;
}
libgl_filename = "OPENGL32";
}
- __libGlHandle = LoadLibraryA(libgl_filename);
- if (!__libGlHandle) {
+ _libGlHandle = LoadLibraryA(libgl_filename);
+ if (!_libGlHandle) {
std::cerr << "error: unable to open " << libgl_filename << "\n";
exit(1);
}
}
Context *
-createContext(const Visual *visual, Context *shareContext, Profile profile)
+createContext(const Visual *visual, Context *shareContext, Profile profile, bool debug)
{
if (profile != PROFILE_COMPAT) {
return NULL;
bool
processEvents(void) {
- // TODO
+ MSG uMsg;
+ while (PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE)) {
+ if (uMsg.message == WM_QUIT) {
+ return false;
+ }
+
+ if (!TranslateAccelerator(uMsg.hwnd, NULL, &uMsg)) {
+ TranslateMessage(&uMsg);
+ DispatchMessage(&uMsg);
+ }
+ }
return true;
}