mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
working exit button
This commit is contained in:
+2
-4
@@ -1,7 +1,5 @@
|
|||||||
#include "exitButton.h"
|
#include "exitButton.h"
|
||||||
#include "defConfigs.h"
|
#include "gameManager.h"
|
||||||
|
|
||||||
#include <root.h>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace vb01;
|
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) {}
|
ExitButton::ExitButton(Vector3 pos, Vector2 size) : Button(pos, size, "Exit", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
|
||||||
|
|
||||||
void ExitButton::onClick() {
|
void ExitButton::onClick() {
|
||||||
//Root::getSingleton()->set
|
GameManager::getSingleton()->setRunning(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef EXIT_BUTTON_H
|
#ifndef EXIT_BUTTON_H
|
||||||
#define EXIT_BUTTON_H
|
#define EXIT_BUTTON_H
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ namespace battleship{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameManager::start(string gameDir) {
|
void GameManager::start(string gameDir) {
|
||||||
|
running = true;
|
||||||
registerMembers();
|
registerMembers();
|
||||||
initLua(gameDir);
|
initLua(gameDir);
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -25,6 +25,8 @@ namespace battleship{
|
|||||||
inline std::string getPath(){return path;}
|
inline std::string getPath(){return path;}
|
||||||
inline gameBase::InputManager* getInputManager(){return inputManager;}
|
inline gameBase::InputManager* getInputManager(){return inputManager;}
|
||||||
inline bool isServerSide(){return serverSide;}
|
inline bool isServerSide(){return serverSide;}
|
||||||
|
inline bool isRunning(){return running;}
|
||||||
|
inline void setRunning(bool r){this->running = r;}
|
||||||
inline gameBase::StateManager* getStateManager(){return stateManager;}
|
inline gameBase::StateManager* getStateManager(){return stateManager;}
|
||||||
private:
|
private:
|
||||||
GameManager(){}
|
GameManager(){}
|
||||||
@@ -36,7 +38,7 @@ namespace battleship{
|
|||||||
gameBase::InputManager *inputManager = nullptr;
|
gameBase::InputManager *inputManager = nullptr;
|
||||||
int width, height;
|
int width, height;
|
||||||
std::string path = "";
|
std::string path = "";
|
||||||
bool serverSide;
|
bool serverSide, running = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user