repl.it
@SPQR/

Dungeon Crawler

C++11

A console game with procedural generation and such cool things

fork
loading
Files
  • main.cpp
  • display
  • entity
  • game
  • item
  • level
  • saves
  • tilemap
  • display.h
  • entity.h
  • game.h
  • input.h
  • item.h
  • level.h
  • tilemap.h
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "game.h"
#include "display.h"
#include "input.h"
#include "level.h"
#include "tilemap.h"
#include "item.h"

//these must be defined here to ensure proper order
Player player;
HUD hud;
std::vector<UseableWin*> UseWins;
TextWin hudWindow("HUD info panel", 0, TextWin::hudWin, Pixel('-', 245, 243), Pixel('+', 238, 240), 0, (Display::height() / 3) * 2, Display::width(), Display::height() / 3);

int main() {
	Display::setLevel(level);
	populateTileMap(); //fill up the tileMap vector

	std::thread inputThread(getInput); //thread for input
	std::thread displayThread(doDisplay); //thread for the display

	std::cout << "\033[2J"; //clear compiler messages from console before program start
	std::cout << "\033[?25l"; //hide cursor so it doesn't spasm all over the place all the time

	Item * testItem = new Item("Test Item");
	player.inventory().addItem(testItem, 1);

	while (game.isRunning()) //main game loop for general processing
	{

		processInput(); //process input from inputThread
		//player.update();
	}

	game.stop(); //have to stop the game or the other threads will not join

	inputThread.join();
	displayThread.join();
  return 0;
}
?