int main(int argc, char** argv) {

	// Initialize the window and the GL components
	if (!OnInitInstance() || !GL_Initialize()) {
		return 1;
	}

	// Initialize the application
	OnInitialize();

	while(mAppRunning == true) {
		MSG message = {0};
		bool result = PeekMessage(&message, 0, 0, 0, PM_REMOVE);
	
		if (result == true) {
			TranslateMessage(&message);
			DispatchMessage(&message);
		}
	
		OnFrame();
	}

	system("pause");
	OnDestroyInstance();
	return 0;
}
Example #2
0
int CXtApp::InitInstance(void)
{
	int nRet = FUN_RET_OK;

	if ( m_bDaemon ) /*  == TRUE */
	{
		nRet = Daemon();
		if ( nRet < 0 ) /* Failed to transform the process into daemon mode. */
		{
			m_bDaemon = FALSE;
			return -3;
		}
	}

	nRet = OnInitInstance();
	if ( nRet < 0 )
	{
		return -5;
	}

	return FUN_RET_OK;
}