LRESULT Win32Window::wndProc(UINT msg, WPARAM wParam, LPARAM lParam) { if(msg == WM_CLOSE) { PostQuitMessage(0); } switch(msg) { case WM_SIZE: onResize(ResizeEvent(LOWORD(lParam), HIWORD(lParam))); break; case WM_KEYDOWN: onKeyDown(KeyEvent(wParam)); break; case WM_KEYUP: onKeyUp(KeyEvent(wParam)); break; case WM_MOUSEMOVE: POINTS pt = MAKEPOINTS(lParam); break; } return DefWindowProc(hwnd, msg, wParam, lParam); }
void AppImplMswScreenSaver::run() { mDC = ::GetDC( mWnd ); mApp->getRenderer()->setup( mApp, mWnd, mDC ); mApp->privateSetup__(); RECT windowRect; ::GetClientRect( mWnd, &windowRect ); mWindowWidth = windowRect.right; mWindowHeight = windowRect.bottom; mApp->privateResize__( ResizeEvent( Vec2i( windowRect.right, windowRect.bottom ) ) ); ::SetTimer( mWnd, TIMER_ID, (UINT)(1000 / mApp->getSettings().getFrameRate()), NULL ); }
void acCustomGraphicsView::resizeEvent(QResizeEvent *event) { emit ResizeEvent(event); }
void Platform::Initialize(Game* game) { FileSystem::GetInstance()->SetResourcePath("./"); //Struct to describe the main window. WNDCLASSEX windowClass; //Empty the windowClass struct memset(&windowClass, 0, sizeof(WNDCLASSEX)); windowClass.cbSize = sizeof(WNDCLASSEX); //Store the size of the struct windowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; //Redraw the window on horizontal or vertical size changes windowClass.lpfnWndProc = WndProc; //The message handling function to be used by the window windowClass.hInstance = hInstance; //Handle to the window's instance windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); //Use the custom icon that we added to the project windowClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);//Use the custom icon that we added to the project windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);//Use the standard "Windows arrow" cursor in this window windowClass.hbrBackground = (HBRUSH)COLOR_ACTIVEBORDER;//Use the "active border" colour for the window background windowClass.lpszClassName = WINDOW_CLASS; //Assign a name to this window class //Attempt to register this window class with Windows if (!RegisterClassEx(&windowClass)) { MessageBox(NULL, "Failed To Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION); //Exit the program // Log the error } //Create an, initially invisible, window hwnd = CreateWindowEx(NULL, WINDOW_CLASS, WINDOW_TITLE, WS_OVERLAPPEDWINDOW, 50, 50, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0, hInstance, NULL); //If now window was created if (!hwnd) { LogManager::GetInstance()->WriteLog("Window Creation Error!"); MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return; } //Get the window's device context if (!(hdc = GetDC(hwnd))) { MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return; } //Create an appropriate pixel format from the device context SetupPixelFormat(hdc); //Create a windows opengl context from the device context hglrc = wglCreateContext(hdc); //Make the newly created GL context the current one to use wglMakeCurrent(hdc, hglrc); if (glewInit() != GLEW_OK) { wglDeleteContext(hglrc); DestroyWindow(hwnd); return; } // Show the window ShowWindow(hwnd, SW_SHOW); SetForegroundWindow(hwnd); SetFocus(hwnd); ResizeEvent(WINDOW_WIDTH, WINDOW_HEIGHT); }
void QNamedWindow::resizeEvent(QResizeEvent *event) { emit ResizeEvent(event); //if(!bResizable) resize(pixmap.width(), pixmap.height()); }