本文整理汇总了C++中Files::ReadInputASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ Files::ReadInputASCII方法的具体用法?C++ Files::ReadInputASCII怎么用?C++ Files::ReadInputASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::ReadInputASCII方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//The Game
int main(int argc, char* args[]) {
Food Food;
GraphicFiles_Vars GF_Var;
InternalRandom IRand;
LoopControl Loop;
OptionsRandom ORand;
Map Map;
MidVars MidVar;
Snake Snake;
Timer Timer;
GMI_Vars GMI_Var;
Files File;
FoodSys FoodSys;
GameOver GameOver;
GraphicFiles_Main GF_Main;
Initializers Init;
Input Input;
Menu Menu;
NPC NPC;
Tail Tail;
//External variables initializers.
Init.ExternalVariableInitializers(Food, GMI_Var, IRand, Loop, Map, ORand, Snake);
//Gets saved options from a txt file.
File.ReadOptionsFile(IRand, Map, MidVar, ORand, Snake);
//Gets high scores from a txt file.
File.ReadHighScoresFile(IRand, MidVar);
//Initializes SDL
GF_Main.init_SDL(GMI_Var, GF_Var);
//Gets snake movement controls from a txt file.
File.ReadInputASCII(GF_Var, MidVar);
//The program (re)start point.
while (Loop.getGameReset()) {
//Menu, where the user can customize and start the game.
Menu.MainMenu(GMI_Var, GF_Var, IRand, Loop, Map, MidVar, ORand);
//Saves Options to a txt file.
File.WriteOptionsFile(Map, ORand, Snake);
//Saves snake movement controls to a txt file.
File.WriteInputASCII(GF_Var);
if (Loop.getGameReset()) {
//Initializes SDL components for the game loop.
GF_Main.init_SDL_GameLoop(GMI_Var, GF_Var, Map, ORand);
//Reads saved game txt file if game is loaded.
File.ReadSavedGame(Food, IRand, Map, MidVar, ORand, Snake);
//Defaults variables for the game loop.
Init.InternalVariableInitializers(Food, GMI_Var, GF_Var, IRand, Loop, Map, ORand, Snake);
//Constructes the borders of the map.
Init.MapBorderBuild(IRand, Map);
//Initializers for the game loop.
Init.FunctionInitializers(Food, IRand, Map, ORand, Snake, Timer);
//The game loop.
while (!Loop.getExitState()) {
//SDL based input system.
Input.GetInput(GMI_Var, GF_Var, IRand, Loop, Map, ORand, Snake, Timer);
//Saves game on exit if user chooses to.
File.WriteSavedGame(Food, IRand, Loop, Map, ORand, Snake);
//NPC AI
NPC.NPC_Move(Food, Map, ORand, Snake);
//Checks user input.
Tail.ProcessUserInput(IRand, Loop, Map, ORand, Snake);
//Deletes the snake right after death.
Tail.DeleteSnakeTail(IRand, Map, ORand, Snake);
//Places the food onto the map and processes it.
FoodSys.FoodProcess(Food, GF_Var, IRand, Loop, Map, ORand, Snake);
//Keeps the tail of the Snake the same size (becomes larger as you eat).
Tail.TailLengthMaintainer(IRand, Map, ORand, Snake);
//Draws the SDL game loop screen.
GF_Main.UpdateGameScreen(GMI_Var, GF_Var, Food, Loop, Map, ORand, Snake);
//Exits the game loop if a right condition is met.
GameOver.GameLoopExit(IRand, Loop, Map, ORand, Snake);
}
GF_Main.quit_SDL_GameLoop(GF_Var);
}
//Saves high scores to a txt file.
File.WriteHighScoresFile(IRand, Loop, MidVar, ORand);
//Tells you how you exited the game loop and shows final score(s).
GameOver.GameOverMessage(GMI_Var, GF_Var, IRand, Loop, Map, ORand);
}
//Quits SDL
GF_Main.quit_SDL(GF_Var, ORand);
return 0;
}