mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
fixed recursion bug
This commit is contained in:
+8
-35
@@ -12,7 +12,7 @@ using namespace vb01;
|
||||
|
||||
namespace game{
|
||||
namespace core{
|
||||
GameManager *gameManager = nullptr;
|
||||
static GameManager *gameManager = nullptr;
|
||||
|
||||
GameManager* GameManager::getSingleton(){
|
||||
if(!gameManager)
|
||||
@@ -22,47 +22,20 @@ namespace game{
|
||||
}
|
||||
|
||||
GameManager::GameManager() {
|
||||
Root *root = Root::getSingleton();
|
||||
root->start(800, 600, "Battleship", "../vb01");
|
||||
}
|
||||
|
||||
GameManager::~GameManager() {}
|
||||
|
||||
/*
|
||||
void GameManager::start() {
|
||||
Root *root = Root::getSingleton();
|
||||
root->start(800, 600, "../../vb01", "Battleship");
|
||||
|
||||
stateManager = new StateManager();
|
||||
listener = new EventListener(this);
|
||||
void GameManager::detachBitmapText(AbstractBitmapText *bitmapText) {
|
||||
for (int i = 0; i < bitmapTexts.size(); i++)
|
||||
if (bitmapText == bitmapTexts[i]) {
|
||||
delete bitmapText;
|
||||
bitmapTexts.erase(bitmapTexts.begin() + i);
|
||||
}
|
||||
}
|
||||
|
||||
void GameManager::detachAllBitmapTexts() {
|
||||
while (bitmapTexts.size() > 0) {
|
||||
delete bitmapTexts[bitmapTexts.size() - 1];
|
||||
bitmapTexts.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
void GameManager::detachImage(AbstractImage *image) {
|
||||
for (int i = 0; i < images.size(); i++)
|
||||
if (image == images[i]) {
|
||||
delete image;
|
||||
images.erase(images.begin() + i);
|
||||
}
|
||||
}
|
||||
|
||||
void GameManager::detachAllImages() {
|
||||
while (images.size() > 0) {
|
||||
delete images[images.size() - 1];
|
||||
images.pop_back();
|
||||
}
|
||||
}
|
||||
*/
|
||||
listener = new InputManager(root->getWindow());
|
||||
}
|
||||
|
||||
void GameManager::update() {
|
||||
Root::getSingleton()->update();
|
||||
listener->update();
|
||||
stateManager->update();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace game{
|
||||
class GameManager {
|
||||
public:
|
||||
static GameManager* getSingleton();
|
||||
void start();
|
||||
void update();
|
||||
inline int getWidth(){return width;}
|
||||
inline int getHeight(){return height;}
|
||||
|
||||
@@ -7,10 +7,14 @@ using namespace game::core;
|
||||
|
||||
int main() {
|
||||
GameManager *gameManager = GameManager::getSingleton();
|
||||
gameManager->start();
|
||||
/*
|
||||
GuiAppState *state = new GuiAppState();
|
||||
gameManager->getStateManager()->attachState(state);
|
||||
makeTitlescreenButtons(state);
|
||||
*/
|
||||
while(true){
|
||||
//gameManager->update();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user