Skip to content

Commit 471b820

Browse files
committed
added central game loop etc
1 parent 4045cd8 commit 471b820

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

game/game.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#pragma once
2+
3+
class Game
4+
{
5+
bool isrunning;
6+
7+
public:
8+
Game();
9+
~Game();
10+
bool running();
11+
};
12+
13+
Game::Game()
14+
{
15+
isrunning = true;
16+
}
17+
18+
Game::~Game()
19+
{
20+
21+
}
22+
23+
bool Game::running()
24+
{
25+
return isrunning;
26+
}

interface/interface.h

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#pragma once
2+
3+
#include "../game/game.h"
4+
5+
#include <SDL2/SDL.h>
6+
7+
class Interface
8+
{
9+
Game game;
10+
11+
public:
12+
Interface(Game &);
13+
~Interface();
14+
void display();
15+
void getInput();
16+
};
17+
18+
Interface::Interface(Game &g)
19+
{
20+
game = g;
21+
}
22+
23+
Interface::~Interface()
24+
{
25+
26+
}
27+
28+
void Interface::display()
29+
{
30+
31+
}
32+
33+
void Interface::getInput()
34+
{
35+
36+
}

main.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "game\game.h"
2+
#include "interface\interface.h"
3+
4+
int main()
5+
{
6+
Game game;
7+
Interface interface(game);
8+
9+
while (game.running())
10+
{
11+
game.play();
12+
interface.display();
13+
interface.getInput();
14+
}
15+
}

TechType.h tech/TechType.h

File renamed without changes.

0 commit comments

Comments
 (0)