test.cpp

来自「一款C++小游戏的源代码」· C++ 代码 · 共 48 行

CPP
48
字号
#include "gengine.h"
#include "../common.h"

static DWORD lasttime=0, ttime;
static ControlEvent input;

int testGraphicEngine( void )
{
	ttime = GetTickCount();
	if( ttime - lasttime < 49 )
		return 0;
	lasttime = ttime;

#ifdef _DEBUG
//	OutDebugString( "in testGraphicEngine" );
#endif
//	testBrighter();
//	testSprite();
//	testRleBitmap();
//	testAni();
	if( mouseB ){
		input.what = ctMouse;
		input.info[0] = mouseB;
		scene.PixelToPlot( mouseX, mouseY, (int*)&input.info[1], (int*)&input.info[2] );
		mouseB = 0;
		//OutDebugString( "mouse down" );
		//OutDebugInt( "mousex=", input.info[1] );
		//OutDebugInt( "mousey=", input.info[2] );
	}
	else
		input.what = ctNothing;
	warrior->UpdateStatus( &input );
	//OutDebugString( "before scene.update" );
	scene.Update();
	//OutDebugString( "before warrior.update" );
	//warrior->Update();
	//OutDebugString( "after update" );
	hz.Printf( backScreen, 0, 13, 0xffffff, "mousex:%d, mouseY:%d", input.info[1], input.info[2] );
	hz.Printf( backScreen, 0, 26, 0xffffff, "mousex:%d, mouseY:%d", mouseX, mouseY );
	hz.Printf( backScreen, 0, 39, 0xffffff, "herox:%d, heroY:%d", warrior->mx, warrior->my );

#ifndef _OFFDDRAW
	UpdateScreen();
#endif

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?