Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
// The application main loop
//-----------------------------------------------------------------------------
int CIHVTestApp::Main()
{
	SpewOutputFunc( IHVTestSpewFunc );
		    
	if ( !SetupStudioRender() )
	{
		return 0;
	}

	if ( !InitMaterialSystem( m_hWnd ) )
	{
		return 0;
	}

#if !defined( _X360 ) // X360TBD:
extern void Sys_InitFloatTime( void ); //garymcthack
	Sys_InitFloatTime();
#endif

	LoadModels();

#if USE_VTUNE
	VTResume();
#endif
#ifdef USE_VPROF
	g_VProfCurrentProfile.Start();
#endif

	bool m_bExitMainLoop = false;
	while (!m_bExitMainLoop && !g_BenchFinished)
	{
		AppPumpMessages();
		RenderFrame();
	}

#ifdef USE_VPROF
	g_VProfCurrentProfile.Stop();
#endif
	g_IHVTestFP = fopen( "ihvtest_vprof.txt", "w" );
#ifdef USE_VPROF
	SpewOutputFunc( IHVTestVProfSpewFunc );
	g_VProfCurrentProfile.OutputReport( VPRT_SUMMARY );
	g_VProfCurrentProfile.OutputReport( VPRT_HIERARCHY_TIME_PER_FRAME_AND_COUNT_ONLY );
	fclose( g_IHVTestFP );
	SpewOutputFunc( IHVTestSpewFunc );
#endif
#if USE_VTUNE
	VTPause();
#endif

    return 0;
}
Ejemplo n.º 2
0
void Sys_Init(void)
{

	MaskExceptions ();

	Sys_SetFPCW ();

    dos_outportb(0x43, 0x34); // set system timer to mode 2
    dos_outportb(0x40, 0);    // for the Sys_FloatTime() function
    dos_outportb(0x40, 0);

	Sys_InitFloatTime ();

	_go32_interrupt_stack_size = 4 * 1024;;
	_go32_rmcb_stack_size = 4 * 1024;
}
Ejemplo n.º 3
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	WNDCLASS wc = { 0 };
	wc.lpfnWndProc = MainWndProc;
	wc.hInstance = hInstance;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.lpszClassName = "Module 2";

	if (!RegisterClass(&wc))
	{
		return EXIT_FAILURE;
	}

	HWND mainWindow;
	DWORD windowStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;

	int width = 800;
	int height = 600;

	RECT rectangle = { 0 };
	rectangle.bottom = height;
	rectangle.right = width;

	AdjustWindowRect(&rectangle, windowStyle, 0);

	width = rectangle.right - rectangle.left;
	height = rectangle.bottom - rectangle.top;

	mainWindow = CreateWindowEx(0, "Module 2", "Lesson 2.6", windowStyle, CW_USEDEFAULT, CW_USEDEFAULT, width, height, NULL, NULL, hInstance, NULL);

	HDC deviceContext = GetDC(mainWindow);
	PatBlt(deviceContext, 0, 0, width, height, BLACKNESS);
	ReleaseDC(mainWindow, deviceContext);

	Host_Init();

	float oldTime = Sys_InitFloatTime();
	float targetTime = 1.0f / 60.0f;
	float timeAccumulated = 0.0f;

	MSG message;

	while (IsRunning)
	{
		while (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&message);
			DispatchMessage(&message);
		}

		float newTime = Sys_FloatTime();
		float delta = newTime - oldTime;
		oldTime = newTime;
		timeAccumulated += delta;

		if (timeAccumulated >= targetTime)
		{
			Host_Frame(targetTime);
			timeAccumulated -= targetTime;
		}

		Sleep(1);
	}

	Host_Shutdown();

	return 0;
}
Ejemplo n.º 4
0
void Sys_Init(void)
{
#ifndef SWDS
	Sys_InitFloatTime();
#endif
}
Ejemplo n.º 5
0
int32 WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	COM_ParseCmdLine(lpCmdLine);

	WNDCLASS wc = { 0 };
	wc.lpfnWndProc = MainWndProc;
	wc.hInstance = hInstance;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.lpszClassName = "Module 2";

	if (!RegisterClass(&wc))
		exit(EXIT_FAILURE);

	HWND mainwindow;
	DWORD WindowStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;

	RECT r;
	r.top = r.left = 0;
	r.right = 800;
	r.bottom = 600;

	AdjustWindowRect(&r, WindowStyle, FALSE);

	mainwindow = CreateWindowEx(
		0,
		"Module 2",
		"Lesson 2.6",
		WindowStyle,
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		r.right - r.left,
		r.bottom - r.top,
		NULL,
		NULL,
		hInstance,
		0
		);

	ShowWindow(mainwindow, SW_SHOWDEFAULT);

	HDC DeviceContext = GetDC(mainwindow);
	PatBlt(DeviceContext, 0, 0, 800, 600, BLACKNESS);
	ReleaseDC(mainwindow, DeviceContext);

	Host_Init();


	float oldtime = Sys_InitFloatTime();


	MSG msg;
	while (IsRunning)
	{
		// check os

		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		float newtime = Sys_FloatTime();
		Host_Frame(newtime - oldtime);
		oldtime = newtime;
	}

	Host_Shutdown();

	return 0;
}