working exit button

This commit is contained in:
devZoGok
2024-05-29 20:31:45 +03:00
parent 1a5fbccc5b
commit b9baa05f27
5 changed files with 7 additions and 7 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
#include "exitButton.h"
#include "defConfigs.h"
#include <root.h>
#include "gameManager.h"
using namespace std;
using namespace vb01;
@@ -10,6 +8,6 @@ namespace battleship{
ExitButton::ExitButton(Vector3 pos, Vector2 size) : Button(pos, size, "Exit", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void ExitButton::onClick() {
//Root::getSingleton()->set
GameManager::getSingleton()->setRunning(false);
}
}
-1
View File
@@ -1,4 +1,3 @@
#pragma once
#ifndef EXIT_BUTTON_H
#define EXIT_BUTTON_H
+1
View File
@@ -145,6 +145,7 @@ namespace battleship{
}
void GameManager::start(string gameDir) {
running = true;
registerMembers();
initLua(gameDir);
+3 -1
View File
@@ -25,6 +25,8 @@ namespace battleship{
inline std::string getPath(){return path;}
inline gameBase::InputManager* getInputManager(){return inputManager;}
inline bool isServerSide(){return serverSide;}
inline bool isRunning(){return running;}
inline void setRunning(bool r){this->running = r;}
inline gameBase::StateManager* getStateManager(){return stateManager;}
private:
GameManager(){}
@@ -36,7 +38,7 @@ namespace battleship{
gameBase::InputManager *inputManager = nullptr;
int width, height;
std::string path = "";
bool serverSide;
bool serverSide, running = false;
};
}
+1 -1
View File
@@ -25,7 +25,7 @@ int main(int argc, char **argv) {
ConcreteGuiManager::getSingleton()->readLuaScreenScript("mainMenu.lua");
while(true){
while(gm->isRunning()){
gm->update();
}