rngine 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/shared/GameLoop.cpp +1 -1
- package/shared/GameLoop.hpp +2 -2
package/package.json
CHANGED
package/shared/GameLoop.cpp
CHANGED
|
@@ -90,7 +90,6 @@ std::vector<Rect> GameLoop::getRectsSnapshot() {
|
|
|
90
90
|
|
|
91
91
|
void GameLoop::runGameLoop() {
|
|
92
92
|
using namespace std::chrono;
|
|
93
|
-
double targetDeltaTime = 1.0 / _tickRate;
|
|
94
93
|
|
|
95
94
|
__android_log_print(ANDROID_LOG_INFO, "GameLoop", "Game loop thread started");
|
|
96
95
|
|
|
@@ -98,6 +97,7 @@ void GameLoop::runGameLoop() {
|
|
|
98
97
|
double accumulator = 0.0;
|
|
99
98
|
|
|
100
99
|
while (_isRunning) {
|
|
100
|
+
double targetDeltaTime = 1.0 / _tickRate.load();
|
|
101
101
|
auto currentTime = steady_clock::now();
|
|
102
102
|
double frameTime = duration<double>(currentTime - previousTime).count();
|
|
103
103
|
previousTime = currentTime;
|
package/shared/GameLoop.hpp
CHANGED
|
@@ -31,7 +31,7 @@ public:
|
|
|
31
31
|
void registerLottieDuration(double, double);
|
|
32
32
|
std::vector<Rect> getRectsSnapshot();
|
|
33
33
|
|
|
34
|
-
void setTickRate(double tickRate) { _tickRate
|
|
34
|
+
void setTickRate(double tickRate) { _tickRate.store(tickRate); };
|
|
35
35
|
|
|
36
36
|
private:
|
|
37
37
|
explicit GameLoop();
|
|
@@ -41,7 +41,7 @@ private:
|
|
|
41
41
|
std::vector<System> _systems{};
|
|
42
42
|
std::atomic<bool> _isRunning{true};
|
|
43
43
|
std::atomic<bool> _isPaused{true};
|
|
44
|
-
double _tickRate{60.0};
|
|
44
|
+
std::atomic<double> _tickRate{60.0};
|
|
45
45
|
Screen _screen;
|
|
46
46
|
GameStats _gameStats;
|
|
47
47
|
std::unique_ptr<std::thread> _gameThread;
|