⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 game.cpp

📁 成熟的RPG引擎,Flysky发布. 斜视角引擎.
💻 CPP
字号:
#include "GameH.h"

void ForV()
{
	frameST=Fps();
#ifdef _DebugMode
	if (IsDebug==true)
{
	//----------------------------------------------
	//              FPS 查看
	HDC hdc;
	lpDDS[1]->GetDC(&hdc);
	SetBkMode(hdc, TRANSPARENT);
	SetTextColor(hdc, RGB(255,0,0)); 
	char temp1[32],temp2[32]="FPS=";
    itoa(frameS,temp1,10);
	strcat(temp2,temp1);
	TextOut(hdc, 0, 0, temp2, int(strlen(temp2)));
	TextOut(hdc, 0, 200, SMessage, int(strlen(SMessage)));
	lpDDS[1]->ReleaseDC(hdc);
	//---------------------------------------------
}
#endif
}

void XGameLoop(LPDIRECTDRAWSURFACE7 DDS)
{
	map.ShowMap(DDS);//地图
	role.CheckLoop(DDS);//人物
	spety.Show(DDS); //特效
	map.ShowTileCPic(DDS,curpos.x,curpos.y);
}
void GameLoop()
{
	Clrscr(lpDDS[DDS_Alpha],RGB16(255,255,255));
	if (video.IsPlayMovie()==false) engine.GameLoop();   //游戏状态机
	PrintMouse(lpDDS[1],lpDDS[DDS_Mouse]); //画鼠标 必须
	ForV();
	if (video.IsPlayMovie()==false) FlipSurface();
	frame++;
}
//FPS
int Fps()
{
	static DWORD time1;
	static DWORD time2;
	static double seconds;

	time2=time1;
	time1=timeGetTime();

	seconds=double(time1-time2)/(double)1000;
	return (int)( (double)1/seconds );
}
//延时控速
void Tick() //空延时
{
	/*//延时控速
	if (frameSM>TickFps) //fps最大值大于控速fps时产生下面语句
	{
		NowTick=timeGetTime();
		while (NowTick<OldTick+DelayTick) {NowTick=timeGetTime();}
		OldTick=NowTick;
	}
	//延时控速结束*/
}

⌨️ 快捷键说明

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