void GlDisplayService::destroyWindow(int windowHandle) { GLFWwindow* window = getWindowPointer(windowHandle); m_freeHandles.push_back(windowHandle); m_context.destroyWindow(window); m_windows[windowHandle] = nullptr; }
LRESULT CALLBACK RunLoop::RunLoopWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (RunLoop* runLoop = static_cast<RunLoop*>(getWindowPointer(hWnd, 0))) return runLoop->wndProc(hWnd, message, wParam, lParam); if (message == WM_CREATE) { LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); // Associate the RunLoop with the window. setWindowPointer(hWnd, 0, createStruct->lpCreateParams); return 0; } return ::DefWindowProc(hWnd, message, wParam, lParam); }
void Drawing::eventHandler() { //Event handler SDL_Event e; //While application is running while( Quit == false) { //Handle events on queue //update surface if(refresh) { SDL_UpdateWindowSurface( getWindowPointer());//Window ); // similarly event driven refresh = false; } while( SDL_PollEvent( &e ) != 0 ) { //User requests quit if( e.type == SDL_QUIT ) { Quit = true; //break; } else if( e.type == SDL_KEYDOWN) { // for test if(e.key.keysym.sym == SDLK_a) { cout << "A" << endl; for(int i = 0; i < ScreenHeight/10; i++) { for(int j = 0; j < ScreenWidth/10; j++) { //cout << getPixel(i*10, j*10) << ' '; setPixel(i*10, j*10, (0xff << 16)); } } setRefresh(true); restart = true; } } } } }
void GlDisplayService::swapBuffers(int windowHandle) { GLFWwindow* window = getWindowPointer(windowHandle); m_context.swapBuffers(window); }
void GlDisplayService::setWindowTitle(int windowHandle, const char* title) { GLFWwindow* window = getWindowPointer(windowHandle); m_context.setWindowTitle(window, title); }
bool GlDisplayService::windowShouldClose(int windowHandle) const { GLFWwindow* window = getWindowPointer(windowHandle); return m_context.windowShouldClose(window); }