From f0fffa71d4d99b0c6e50fc79440bd441320562d8 Mon Sep 17 00:00:00 2001 From: andreja6 Date: Sun, 22 Apr 2018 15:05:45 -0700 Subject: [PATCH] Tried something --- main.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/main.cpp b/main.cpp index 61af646..2e0eebf 100644 --- a/main.cpp +++ b/main.cpp @@ -19,6 +19,7 @@ #if G3D_VER < 61000 #error Requires G3D 6.10 #endif +HWND hwnd; static const float VNUM = 0.01F; static std::string title = ""; static const std::string VERSION = "PRE-ALPHA "; @@ -711,9 +712,65 @@ App::~App() { delete applet; } + +LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_CLOSE: + DestroyWindow(hwnd); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hwnd, msg, wParam, lParam); + } + return 0; +} + int main(int argc, char** argv) { //_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); //_CrtSetBreakAlloc(1279); + + + //Create container window + char className[] = "classContainerHWND"; + WNDCLASSEX wc; + HINSTANCE hInstance = GetModuleHandle(NULL); + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = 0; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wc.lpszMenuName = NULL; + wc.lpszClassName = className; + wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + + if (!RegisterClassEx (&wc)) + { + MessageBox(NULL, "Window registration failed! Please make sure your computer supports Win32 graphical components!", "Error! Cannot start Dynamica!", MB_ICONEXCLAMATION | MB_OK); + return -1; + } + + hwnd = CreateWindowEx( + WS_EX_CLIENTEDGE, + className, + "Container Window", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,NULL, NULL, hInstance, NULL); + if(hwnd == NULL) + { + MessageBox(NULL, "Window Creation Failed! Please make sure your computer supports Win32 graphical components!", "Error! Cannot start Dynamica!", MB_ICONEXCLAMATION | MB_OK); + return -2; + } + ShowWindow(hwnd, SW_SHOW); + UpdateWindow(hwnd); + GAppSettings settings; if(getOSVersion() > 5.0) settings.window.defaultIconFilename = GetFileInPath("/content/images/rico.png");