LRESULT COptionsPageStyle::OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { if(lParam == PN_UPDATEDISPLAY) { // re-initialise display... OnInitialise(); } return 0; }
virtual bool Initialise(Uint32 uiWidth, Uint32 uiHeight, const char* c_pszWindowTitle) { DebugLog("----- Initialising Application -----"); m_bReadyToLoadRes = false; m_pGraphicsSys = new GraphicsSystemImpl(); m_pResMan = new ResourceManagerImpl(); m_pAudioEng = new AudioEngineImpl(); Float32 fVWidth = 1024.0f; Float32 fVHeight = 768.0f; OnInitialise(fVWidth, fVHeight); // Callback to initialise. DebugLog("Creating window"); bool bResult = m_pGraphicsSys->Initialise(uiWidth, uiHeight, fVWidth, fVHeight, false, c_pszWindowTitle); if(!bResult) { delete m_pGraphicsSys; m_pGraphicsSys = NULL; return false; } DebugLog("Launching background loading thread."); // Create a thread to load background resources THREADID id; Thread::Create(&id, ThreadFunc, this); // Wait until the secondary context has been created while(m_rcSecContext == 0) Thread::Sleep(1); // Share this context and make it current ((GraphicsSystemImpl*)m_pGraphicsSys)->ShareOGLContext(m_rcSecContext); ((GraphicsSystemImpl*)m_pGraphicsSys)->MakeCurrent(); DebugLog("Loading GL extenstions"); // Load GL extensions extern GLExtensions ext; ext.Load(); // We can now load resources. m_bReadyToLoadRes = true; m_eState = enumSTATE_ResourceLoading; // Notify that OpenGL has initialised. OnViewInitialised(); // OpenGL initialised. DebugLog("View Initialised."); // Get the current tick count QueryPerformanceCounter((LARGE_INTEGER*)&m_n64TimeStart); return bResult; }
//------------------------------------------------------------------ // // CreateAppWindow(..) // // Params: // windowTitle - Title of the window // windowWidth - Width of window // windowHeight - Height of window // // Creates the window with the specified string as title // //------------------------------------------------------------------ bool CApp::CreateAppWindow(const std::string &windowTitle, UINT windowWidth, UINT windowHeight) { m_windowName = windowTitle; // Create and determine window size RECT windowSize; windowSize.left = 0; windowSize.right = windowWidth; windowSize.top = 0; windowSize.bottom = windowHeight; AdjustWindowRectEx(&windowSize, WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, false, WS_EX_OVERLAPPEDWINDOW); m_hWnd = CreateWindowEx(0, m_sAppName.c_str(), windowTitle.c_str(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, (windowSize.right - windowSize.left), (windowSize.bottom - windowSize.top), NULL, NULL, m_hInstance, NULL); // Recalculate window to get client area to correct size RECT rClient, rWindow; POINT ptDiff; GetClientRect(m_hWnd, &rClient); GetWindowRect(m_hWnd, &rWindow); ptDiff.x = (rWindow.right - rWindow.left) - rClient.right; ptDiff.y = (rWindow.bottom - rWindow.top) - rClient.bottom; MoveWindow(m_hWnd,rWindow.left, rWindow.top, windowWidth + ptDiff.x, windowHeight + ptDiff.y, TRUE); if(m_hWnd == 0) { CDEBUGLOG->WriteError("Failed to create window"); throw std::runtime_error("Failed to create window"); return FALSE; } // Store a pointer to this object in the window, otherwise we can't grab it using // GetWindowLongPtr(..) in the callback for messages SetWindowLongPtr( m_hWnd, GWLP_USERDATA, (INT_PTR)this ); ShowWindow(m_hWnd, SW_SHOW); UpdateWindow(m_hWnd); // Run initialisation, if fail quit the application if (!OnInitialise(windowWidth, windowHeight)) { CDEBUGLOG->WriteError("Failed to initialise" + windowTitle); m_bRun = false; } return true; }
virtual bool Initialise(Uint32 uiWidth, Uint32 uiHeight, const char* c_pszWindowTitle) { DebugLog("----- Initialising Application -----"); m_bReadyToLoadRes = false; m_pGraphicsSys = new GraphicsSystemImpl(); m_pResMan = new ResourceManagerImpl(m_pApp->activity->assetManager); m_pAudioEng = new AudioEngineImpl(); Float32 fVWidth = 1024.0f; Float32 fVHeight = 768.0f; OnInitialise(fVWidth, fVHeight); // Callback to initialise. DebugLog("Creating window"); bool bResult = m_pGraphicsSys->Initialise(uiWidth, uiHeight, fVWidth, fVHeight, false, c_pszWindowTitle); if(!bResult) { delete m_pGraphicsSys; m_pGraphicsSys = NULL; return false; } DebugLog("Loading resources."); // Android TEMP this->ResourceLoader(); // We can now load resources. m_bReadyToLoadRes = true; m_eState = enumSTATE_ResourceLoading; // Notify that OpenGL has initialised. OnViewInitialised(); // OpenGL initialised. DebugLog("View Initialised."); // Get the current tick count gettimeofday(&m_timeStart, NULL); return bResult; }
void Control::Initialise(Control* _parent, MyGUI::Widget* _place, const std::string& _layoutName) { OnInitialise(_parent, _place, _layoutName); ActivateControllers(); }
void Control::Initialise(const std::string& _layoutName) { OnInitialise(nullptr, nullptr, _layoutName); ActivateControllers(); }