mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[emscripten] Use emterpreter
This allows us to control the runloop
This commit is contained in:
committed by
EmilieNumworks
parent
fd7516f8ac
commit
67f082f4e8
@@ -18,12 +18,12 @@ Timer * RunLoop::timerAtIndex(int i) {
|
||||
}
|
||||
|
||||
void RunLoop::run() {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_main_loop_arg([](void * ctx){ ((RunLoop *)ctx)->step(); }, this, 0, 1);
|
||||
#else
|
||||
while(step()) {
|
||||
runWhile(nullptr, nullptr);
|
||||
}
|
||||
|
||||
void RunLoop::runWhile(bool (*callback)(void * ctx), void * ctx) {
|
||||
while ((callback == nullptr || callback(ctx)) && step()) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RunLoop::step() {
|
||||
|
||||
Reference in New Issue
Block a user