game.cpp.svn-base

来自「自己做的小游戏」· SVN-BASE 代码 · 共 74 行

SVN-BASE
74
字号
#include "Game.h"
#include "player.h"
#include "custom_time.h"
#include "game_object.h"
#include "fsm.h"
#include "msg.h"
#include "msgroute.h"
#include "../gamedata/gamedata.h"
#include "../gamedata/fireball.h"
#include <time.h>
#include <windows.h>

GameObject	gameGO;
char		scriptStr[256];
char		missionStr[256];
Vertex		endLeftBottom, endRightUp;





//游戏初始化的顺序是:定时器,GO,game的状态机


bool InitGame()
{
	InitTime();

	GOInitialize(&gameGO, UINT_MAX);
	FSMInitialize(gameGO.unique_id, FSM_Game);
	return true;
}


//基本的游戏循环,所有的游戏应该都是这样的
void Process()
{
	MarkTimeThisTick();

	SendDelayedMessages();

	GOUpdate(&gameGO);

	Renderer::render();

	MarkTimeThisTick2();
}


//进入游戏状态
void GameStart()
{
	SendMsg(MSG_GameStart, gameGO.unique_id, gameGO.unique_id);
}



//简化测试用的,debug时用的。
void peng()
{
	player.checked = true;
	player.collide = false;

	list<GameObject>::iterator i;
	for (i = units.begin(); i != units.end(); ++i) {
		i->checked = true;
		i->collide = false;
	}
	list<FireBall>::iterator ii;
	for (ii = fireBalls.begin(); ii != fireBalls.end(); ++ii) {
		ii->checked = true;
		ii->collide = false;
	}
}

⌨️ 快捷键说明

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