Make Simulator's state publicly read-only

This commit is contained in:
Thomas Edvalson
2014-03-17 16:25:13 -04:00
parent 06972dce38
commit 64183e2aee
3 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -33,6 +33,8 @@ namespace cpp3ds {
sf::Texture pausedFrameTexture;
sf::Sprite pausedFrame;
SimulatorState state = SIM_STOPPED;
void runGame();
void checkThreadState();
void saveScreenshot();
@@ -48,8 +50,7 @@ namespace cpp3ds {
public:
SFMLWidget *screen;
SimulatorState state = SIM_STOPPED;
bool isThreadRunning = false;
Simulator(Glib::RefPtr<Gtk::Application> app, Glib::RefPtr<Gtk::Builder> builder);
@@ -60,6 +61,7 @@ namespace cpp3ds {
void stop();
float get_slider3d();
SimulatorState getState(){ return state; }
};
// Simulator global to be accessed in-game
+1 -1
View File
@@ -6,7 +6,7 @@ namespace cpp3ds {
void display(){
_simulator->screen->display();
_simulator->screen->renderWindow.clear();
while (_simulator->state == SIM_PAUSED)
while (_simulator->getState() == SIM_PAUSED)
sf:sleep(sf::milliseconds(100));
}
+1 -1
View File
@@ -13,7 +13,7 @@ namespace cpp3ds {
sf::Clock clock;
sf::Time deltaTime;
while (ret == 0) {
if (_simulator->state == SIM_STOPPED)
if (_simulator->getState() == SIM_STOPPED)
return -1;
render();
if (useDisplay)