Beispiel #1
0
GHOST_TSuccess GHOST_System::exit()
{
	if (getFullScreen()) {
		endFullScreen();
	}
	if (m_displayManager) {
		delete m_displayManager;
		m_displayManager = 0;
	}
	if (m_windowManager) {
		delete m_windowManager;
		m_windowManager = 0;
	}
	if (m_timerManager) {
		delete m_timerManager;
		m_timerManager = 0;
	}
	if (m_eventManager) {
		delete m_eventManager;
		m_eventManager = 0;
	}
    if (m_ndofManager) {
        delete m_ndofManager;
        m_ndofManager = 0;
    }
	return GHOST_kSuccess;
}
Beispiel #2
0
GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow* window)
{
	GHOST_TSuccess success;

	/*
	 * Remove all pending events for the window.
	 */ 
	if (m_windowManager->getWindowFound(window)) {
		m_eventManager->removeWindowEvents(window);
	}
	if (window == m_windowManager->getFullScreenWindow()) {
		success = endFullScreen();
	}
	else {
		if (m_windowManager->getWindowFound(window)) {
			success = m_windowManager->removeWindow(window);
			if (success) {
				delete window;
			}
		}
		else {
			success = GHOST_kFailure;
		}
	}
	return success;
}
Beispiel #3
0
GHOST_TSuccess GHOST_System::exit()
{
	if (getFullScreen()) {
		endFullScreen();
	}

	delete m_displayManager;
	m_displayManager = NULL;

	delete m_windowManager;
	m_windowManager = NULL;

	delete m_timerManager;
	m_timerManager = NULL;

	delete m_eventManager;
	m_eventManager = NULL;

#ifdef WITH_INPUT_NDOF
	delete m_ndofManager;
	m_ndofManager = NULL;
#endif

	return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow *window)
{
	GHOST_TSuccess success = GHOST_kFailure;
	if (window) {
		if (window == m_fullScreenWindow) {
			endFullScreen();
		}
		else {
			std::vector<GHOST_IWindow *>::iterator result = find(m_windows.begin(), m_windows.end(), window);
			if (result != m_windows.end()) {
				setWindowInactive(window);
				m_windows.erase(result);
				success = GHOST_kSuccess;
			}
		}
	}
	return success;
}
	void OGLWindow::destruct()
	{
		if (hRC_)
		{	
			wglMakeCurrent(hDC (), NULL);
			wglDeleteContext(hRC_);
		}
		if (hPalette_)
		{	
			DeleteObject(hPalette_);
		}

		SetWindowLong(hWND_, GWL_USERDATA, (LONG)NULL);

		DestroyWindow(hWND_);

		// if we're in fullscreen, get out of it
		endFullScreen();
	}
	void Window::destruct()
	{
		if (hRC_)
		{	
			wglMakeCurrent(hDC (), NULL);
			wglDeleteContext(hRC_);
			hRC_ = NULL; 
		}
		if (hPalette_)
		{	
			DeleteObject(hPalette_);
		}

		// Should I add this? 
		// release the DC if we have one
		// if (hDC_ && !ReleaseDC(g_hwnd, hDC_))
		// {
		//MessageBox(NULL, "Unable to release device context", "Error", MB_OK | MB_ICONINFORMATION);
		//hDC_ = NULL;
		// }
	  
		SetWindowLong(hWND_, GWL_USERDATA, (LONG)NULL);

		if (hWND_) DestroyWindow(hWND_); 

		//Should I add this? Consider later
		// // unregister our class so we can create a new one if we need to
		// if (!UnregisterClass(WND_CLASS_NAME, g_hInstance))
		// {
		//MessageBox(NULL, "Unable to unregister window class", "Error", MB_OK | MB_ICONINFORMATION);
		//g_hInstance = NULL;
		// }

		// if we're in fullscreen, get out of it
		endFullScreen();
	}
	OGLWindow::~OGLWindow()
	{
		if (hRC_)				destruct();
		if (isFullScreen ())	endFullScreen();
		ShowCursor(TRUE);
	}