restructuring game startup
This commit is contained in:
+18
-13
@@ -1,27 +1,35 @@
|
||||
#include "FC-Chess.h"
|
||||
|
||||
FCC::Chess::Chess()
|
||||
{
|
||||
|
||||
//start game
|
||||
FCC::Chess::startup();
|
||||
FCC::Chess::mainLoop();
|
||||
}
|
||||
|
||||
void FCC::Chess::mainLoop()
|
||||
{
|
||||
// initialize user interface
|
||||
tui.startup();
|
||||
|
||||
//start game
|
||||
FCC::Chess::mainMenu();
|
||||
}
|
||||
|
||||
void FCC::Chess::mainMenu()
|
||||
{
|
||||
/* TO DO
|
||||
- Add options
|
||||
- call FCC::Chess::GameLoop when game begins */
|
||||
}
|
||||
|
||||
void FCC::Chess::gameLoop()
|
||||
{
|
||||
// initialize board
|
||||
FCC::Chess::startupGame();
|
||||
|
||||
// main loop
|
||||
while(!gameEnded)
|
||||
{
|
||||
/*MISSING: user input*/
|
||||
/* To Do: user input */
|
||||
tui.mainLoop();
|
||||
}
|
||||
}
|
||||
|
||||
void FCC::Chess::startup()
|
||||
void FCC::Chess::startupGame()
|
||||
{
|
||||
// preparing board: colors
|
||||
for (int8_t i = 0; i < 8; i++) {
|
||||
@@ -50,9 +58,6 @@ void FCC::Chess::startup()
|
||||
posPieces[i][3] = (uint8_t)(Pieces::KING);
|
||||
posPieces[i][4] = (uint8_t)(Pieces::QUEEN);
|
||||
}
|
||||
|
||||
// set language to English (default)
|
||||
// m_lang = FCC::Languages::ENGLISH;
|
||||
}
|
||||
|
||||
bool FCC::Chess::checkIsEnemyOnField()
|
||||
|
||||
+3
-2
@@ -50,8 +50,9 @@ namespace FCC
|
||||
uint8_t posPieces[8][8], posColor[8][8], posPossible[8][8], selX, selY, tarX, tarY; //tar = target, sel = selected, pos = possible
|
||||
|
||||
// funcs
|
||||
void startup();
|
||||
void mainLoop();
|
||||
void mainMenu();
|
||||
void startupGame();
|
||||
void gameLoop();
|
||||
void checkHorizontalMovementAllowed();
|
||||
void checkVerticalMovementAllowed();
|
||||
void checkDiagonalMovementAllowed();
|
||||
|
||||
+2
-11
@@ -1,17 +1,8 @@
|
||||
// FC-Chess.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "FC-Chess.h"
|
||||
|
||||
//using namespace std;
|
||||
#include "FC-Chess.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// starting the game
|
||||
FCC::Chess gm;
|
||||
|
||||
|
||||
// FCC::TUI test;
|
||||
// test.testLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user