mirror of
https://github.com/encounter/cpp3ds.git
synced 2026-03-30 11:04:22 -07:00
Make Simulator's state publicly read-only
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user