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