コード例 #1
0
ファイル: model_loading.cpp プロジェクト: 3dcgarts/assimp
int WINAPI WinMain( HINSTANCE hInstance, // Instance
				   HINSTANCE hPrevInstance,      // Previous Instance
				   LPSTR lpCmdLine,              // Command Line Parameters
				   int nShowCmd )                // Window Show State
{
	MSG msg;
	BOOL done=FALSE;

	createAILogger();
	logInfo("App fired!");

	// Check the command line for an override file path.
	int argc;
	LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
	if (argv != NULL && argc > 1)
	{
		std::wstring modelpathW(argv[1]);
		modelpath = std::string(modelpathW.begin(), modelpathW.end());
	}

	if (!Import3DFromFile(modelpath)) return 0;

	logInfo("=============== Post Import ====================");

	if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start Fullscreen?", MB_YESNO|MB_ICONEXCLAMATION)==IDNO)
	{
		fullscreen=FALSE;
	}

	if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen))
	{
		return 0;
	}

	while(!done)	// Game Loop
	{
		if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE))
		{
			if (msg.message==WM_QUIT)
			{
				done=TRUE;
			}
			else
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else
		{
			// Draw The Scene. Watch For ESC Key And Quit Messaged From DrawGLScene()
			if (active)
			{
				if (keys[VK_ESCAPE])
				{
					done=TRUE;
				}
				else
				{
					DrawGLScene();
					SwapBuffers(hDC);
				}
			}

			if (keys[VK_F1])
			{
				keys[VK_F1]=FALSE;
				KillGLWindow();
				fullscreen=!fullscreen;
				if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen))
				{
					return 0;
				}
			}
		}
	}

	// *** cleanup ***

	textureIdMap.clear(); //no need to delete pointers in it manually here. (Pointers point to textureIds deleted in next step)

	if (textureIds)
	{
		delete[] textureIds;
		textureIds = NULL;
	}

	// *** cleanup end ***

	destroyAILogger();
	KillGLWindow();
	return (msg.wParam);
}
コード例 #2
0
int WINAPI WinMain( HINSTANCE hInstance, // Instance
				   HINSTANCE hPrevInstance,      // Previous Instance
				   LPSTR lpCmdLine,              // Command Line Parameters
				   int nShowCmd )                // Window Show State
{
	MSG msg;			// Windows Message Structure
	BOOL done=FALSE;	// Bool Variable To Exit Loop

	createAILogger();
	logInfo("App fired!");

	// load scene

	if (!Import3DFromFile(basepath+modelname)) return 0;

	logInfo("=============== Post Import ====================");


	// Ask The User Which Screen Mode They Prefer
	if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start Fullscreen?", MB_YESNO|MB_ICONEXCLAMATION)==IDNO)
	{
		fullscreen=FALSE;		// Windowed Mode
	}

	// Create Our OpenGL Window (also calls GLinit und LoadGLTextures)
	if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen))
	{
		return 0;
	}




	while(!done)	// Game Loop
	{
		if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE))	// Is There A Message Waiting
		{
			if (msg.message==WM_QUIT)			// Have we received A Quit Message?
			{
				done=TRUE;						// If So done=TRUE
			}
			else
			{
				TranslateMessage(&msg);			// Translate The Message
				DispatchMessage(&msg);			// Dispatch The Message
			}
		}
		else
		{
			// Draw The Scene. Watch For ESC Key And Quit Messaged From DrawGLScene()
			if (active)
			{
				if (keys[VK_ESCAPE])	// Was ESC pressed?
				{
					done=TRUE;			// ESC signalled A quit
				}
				else
				{
					DrawGLScene();		// Draw The Scene
					SwapBuffers(hDC);	// Swap Buffers (Double Buffering)
				}
			}

			if (keys[VK_F1])		// Is F1 Being Pressed?
			{
				keys[VK_F1]=FALSE;	// If so make Key FALSE
				KillGLWindow();		// Kill Our Current Window
				fullscreen=!fullscreen;	// Toggle Fullscreen
				//recreate Our OpenGL Window
				if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen))
				{
					return 0;		// Quit if Window Was Not Created
				}
			}
		}
	}

	// *** cleanup ***

	// clear map
	textureIdMap.clear(); //no need to delete pointers in it manually here. (Pointers point to textureIds deleted in next step)

	// clear texture ids
	if (textureIds)
	{
		delete[] textureIds;
		textureIds = NULL;
	}

	// *** cleanup end ***

	// Shutdown
	destroyAILogger();
	KillGLWindow();
	return (msg.wParam);	// Exit The Program
}
コード例 #3
0
ファイル: Assimp.cpp プロジェクト: zaeraal/SDF
	// Shutdown
	CAssimp::~CAssimp()
	{
		logInfo("App ended!");
		destroyAILogger();
	}