Exemplo n.º 1
0
int32 CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int32 nCmdShow)
{
	COM_ParseCmdLine(lpCmdLine);

	int32 test = COM_CheckParm("-setalpha");
	int32 value = Q_atoi(com_argv[test+1]);
	return 0;
}
Exemplo n.º 2
0
i32 main(i32 argc, char **argv)
{
	// This is the equivalent of all the parsing from WinMain.
	COM_ParseCmdLine(argc, argv);

	i32 test = Com_CheckParm("-hello");
	i32 test2 = Com_CheckParm("-alpha");
	i32 num = Q_atoi(com_argv[3]);

	return 0;
}
Exemplo n.º 3
0
/*
lpCmdLine: command line args as a single string with program name and leading whitespace excluded
*/
int32 WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {

    globalInstance = hInstance;

    // This is pass by value. lpCmdLine is unchanged in this context
    COM_ParseCmdLine(lpCmdLine);

    // Call init code
    host_init();

    // Initialize the timer
    float oldtime = sys_initFloatTime();


    while (isRunning) {


        // Get a new value from the initialized timer
        float newtime = sys_floatTime();

        // Separate out update and rendering logic
        host_frame(newtime - oldtime);

        // Better to use subtractive tracking of time
        // No lost frames on each iteration due to floating point precision
        oldtime = newtime;


        /*
        // DEBUG
        char buf[64];
        sprintf_s(buf, 64, "Total time: %3.7f \n", newtime);
        OutputDebugString(buf);
        */


    }

    // Shutdown code
    host_shutdown();

#if _DEBUG
    _CrtDumpMemoryLeaks();
#endif

    return 0;
}
Exemplo n.º 4
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;
}