コード例 #1
0
////////////////////////////////////////////////////////////////////////////
// AppCycle().  Do one iteration of the WT cycle.
//
void AppDoCycle(void)
{
	wt_input();
	wt_render();

	HDC hdc = GetDC(hwndApp);
	//don't bother to realize the palette, because we've got AppActivate().
	AppPaint(hwndApp, hdc);
	ReleaseDC(hwndApp, hdc);
}
コード例 #2
0
int main(int argc, char *argv[])
{
     int quit = False;
     
     if (argc != 2) {
   	  fprintf(stderr, "Usage:  wt <world file>\n");
   	  exit(EXIT_FAILURE);
     }

     if (wt_init(argv[1],320,200) == EXIT_FAILURE) {
   	  perror(argv[1]);
   	  exit(EXIT_FAILURE);   
     }

     while (!quit) {
       wt_render();
       quit = wt_input();
     }

     wt_term();
     return EXIT_SUCCESS;
}
コード例 #3
0
/////////////////////////////////////////////////////////////////////////////
// GetFrameRate.  Times the frame rate in one of four ways: WT only without
// any WinG blitting, WinG only without any WT rendering, WT rendering with
// WinG blitting with static rendering, WT rendering with WinG blitting with
// dynamic rendering (player is rotating).
//
DWORD GetFrameRate(int reps, WPARAM what)
{
	HDC hdc = GetDC(hwndApp);
	if (hpalApp)
	{
		SelectPalette(hdc, hpalApp, FALSE);
		RealizePalette(hdc);
	}

	if (what == ID_STUFF_FRAMERATE_DYNAMIC) {
		kbPressed[kbUpArrow] = 1;
		wt_input();
		wt_input();
		wt_input();
		wt_input();
		wt_input();
		kbPressed[kbUpArrow] = 0;

		kbPressed[kbLeftArrow] = 1;
	}

	DWORD Time = timeGetTime();

	for (int i=0; i<reps; i++) {
		if (what != ID_STUFF_FRAMERATE_RAW_WING) {
			if (what == ID_STUFF_FRAMERATE_DYNAMIC)
				wt_input();
		  	wt_render();
		}
		if (what != ID_STUFF_FRAMERATE_RAW_WT)
			AppPaint(hwndApp, hdc);
	}

	Time = timeGetTime() - Time;
	ReleaseDC(hwndApp, hdc);

	if (what == ID_STUFF_FRAMERATE_DYNAMIC)
		kbPressed[kbLeftArrow] = 0;

	return(Time);
}