Beispiel #1
0
void drawLevel(int levelNum) {

	/*---------BEGIN PARSING---------*/
	/*Parsing is done before ncurses is started as most of this data is needed
	  once ncurses has started running.*/


	/*Allocating memory*/
	levelList = malloc(sizeof(LevelList));
	path = malloc(sizeof(Point));
	towers = malloc(sizeof(Point));

	/*Initilizing to empty.*/
	levelList->line = NULL;
	levelList->length = 0;

	/*Reads in the levels file and sets the max FILE X and Y based on filesize.*/
	/*The level choices are hardcoded in, this is sub optimal but since we are limiting menus as well*/
	if (levelNum == 1) {
		readFileLineByLine(levelList, "assets/levels/level1.txt");
	}
	else if (levelNum == 2) {
		readFileLineByLine(levelList, "assets/levels/level2.txt");
	}
	else if (levelNum == 3) {
		readFileLineByLine(levelList, "assets/levels/level3.txt");
	}
	setGlobalMaxes(levelList);

	/*Get path and tower lists of points.*/
	GET_LEVEL_POINTS_PATH(levelList, path);
	GET_LEVEL_TOWERS(levelList, towers);
	/*---------END PARSING-----------*/

	/*Begin draw*/
	clear();
	refresh();
	drawLevelWalls(levelList);
	drawLevelPath(path);
	drawLevelTowers(towers);
	refresh();
	/*end draw*/
}
Beispiel #2
0
inline std::vector<std::string> getReadFileLineByLine(const std::string& mPath)
{
    std::vector<std::string> result;
    readFileLineByLine(result, mPath);
    return result;
}