WIP: Emscripten support
This commit is contained in:
parent
c65d9ad287
commit
11d3755116
12 changed files with 170 additions and 99 deletions
|
@ -164,7 +164,9 @@ static void mriBindingInit()
|
|||
static void
|
||||
showMsg(const std::string &msg)
|
||||
{
|
||||
shState->eThread().showMessageBox(msg.c_str());
|
||||
printf("Show msg %s\n", msg.c_str());
|
||||
return;
|
||||
// shState->eThread().showMessageBox(msg.c_str());
|
||||
}
|
||||
|
||||
static void printP(int argc, VALUE *argv,
|
||||
|
@ -350,6 +352,9 @@ static VALUE evalHelper(evalArg *arg)
|
|||
return rb_funcall2(Qnil, rb_intern("eval"), ARRAY_SIZE(argv), argv);
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
static VALUE evalString(VALUE string, VALUE filename, int *state)
|
||||
{
|
||||
evalArg arg = { string, filename };
|
||||
|
@ -482,6 +487,10 @@ static void runRMXPScripts(BacktraceData &btData)
|
|||
|
||||
while (true)
|
||||
{
|
||||
#ifdef __EMSCRIPTEN
|
||||
emscripten_sleep(10);
|
||||
#endif
|
||||
|
||||
for (long i = 0; i < scriptCount; ++i)
|
||||
{
|
||||
VALUE script = rb_ary_entry(scriptArray, i);
|
||||
|
@ -508,6 +517,9 @@ static void runRMXPScripts(BacktraceData &btData)
|
|||
break;
|
||||
}
|
||||
|
||||
printf("tick\n");
|
||||
shState->eThread().process(shState->rtData());
|
||||
|
||||
VALUE exc = rb_gv_get("$!");
|
||||
if (rb_obj_class(exc) != getRbData()->exc[Reset])
|
||||
break;
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
#include "exception.h"
|
||||
#include "binding-util.h"
|
||||
#include "util.h"
|
||||
#include "eventthread.h"
|
||||
|
||||
RB_METHOD(inputUpdate)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
shState->input().update();
|
||||
shState->eThread().process(shState->rtData());
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue