Example #1
0
void DirectX12Render::Initialize(UINT width, UINT height)
{
	Width = width;
	Height = height;
	InitializeDX();
	InitializeAssets();
}
Example #2
0
int WINAPI WinMain( HINSTANCE hinstance,
	HINSTANCE hprevinstance,
	LPSTR lpcmdline,
	int ncmdshow)
{
	WNDCLASS	winclass;	// this will hold the class we create
	HWND		hwnd;		// generic window handle
	MSG			msg;		// generic message

	// first fill in the window class stucture
	winclass.style			= CS_HREDRAW | CS_VREDRAW;                  
	winclass.lpfnWndProc	= WindowProc;
	winclass.cbClsExtra		= 0;
	winclass.cbWndExtra		= 0;
	winclass.hInstance		= hinstance;
	winclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
	winclass.hCursor		= LoadCursor(NULL, IDC_ARROW);
	winclass.hbrBackground  = (HBRUSH)GetStockObject(BLACK_BRUSH);
	winclass.lpszMenuName	= NULL;
	winclass.lpszClassName	= "WindowCreation";

	// register the window class
	if (!RegisterClass(&winclass))
		return(0);

	// create the window
	if (!(hwnd = CreateWindow( "WindowCreation", // class
		TITLE,	     // title
		WS_OVERLAPPEDWINDOW | WS_VISIBLE,
		0,
		0,
		//Set the size of the window to the size of the screen 
		600,
		400,
		//GetSystemMetrics(SM_CXSCREEN),
		//GetSystemMetrics(SM_CYSCREEN),
		NULL,	   // handle to parent 
		NULL,	   // handle to menu
		hinstance,	// instance
		NULL)))	// creation parms
		return(0);
#ifdef USEOPENGL
	InitializeOpenGL(hwnd, 600, 400);
#else
	InitializeDX(hwnd, 600, 400);
#endif
	
	//
// 	SayHello hello222;
// 	hello222.DisplayHelloMessage();

	// enter main event loop
	bool quit = false;
	while(!quit)
	{
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{ 
			// test if this is a quit
			if (msg.message == WM_QUIT) quit = true;

			// translate any accelerator keys
			TranslateMessage(&msg);
			// send the message to the window proc
			DispatchMessage(&msg);
		} // end if
		else {
			/************************************************************************/
			/* do some main logic control                                                                     */
			/************************************************************************/
/**
try
{
	//throw ErrorException(1,"this is my error",__FILE__, __LINE__);
}
catch (ErrorException& e)
{
	ErrorManager* log = ErrorManager::GetInstance();
	log->Create("testlog.txt");
	log->Output("**Error**");
	log->LogException(e);
	log->Output("*********");
	log->Close();
}
*/
#ifdef USEOPENGL
			RenderOpenGL();
#else
			RenderDX();
#endif

			
		}

	} // end while

	// return to Windows like this
	return(msg.wParam);

} // end WinMain