summaryrefslogtreecommitdiffhomepage
path: root/build/template
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2022-01-12 17:55:11 -0500
committerrealtradam <[email protected]>2022-01-12 17:55:11 -0500
commit49485963fc39238a9053566761c457c0fe796867 (patch)
treec987a9e4ce87346991ba0fa1621c91433cc4b3b8 /build/template
parenta53f8c8f28bdeebbcd5224d606f14ce224ab20ea (diff)
downloadFelFlameEngine-49485963fc39238a9053566761c457c0fe796867.tar.gz
FelFlameEngine-49485963fc39238a9053566761c457c0fe796867.zip
working web compilation
Diffstat (limited to 'build/template')
-rw-r--r--build/template/game.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/build/template/game.c b/build/template/game.c
new file mode 100644
index 0000000..619b961
--- /dev/null
+++ b/build/template/game.c
@@ -0,0 +1,17 @@
+// emcc -s WASM=1 -Os -I ../include/ hello_ruby.c web/lib/libmruby.a -o hello_ruby.js --closure 1
+
+#include <mruby.h>
+#include <mruby/compile.h>
+
+ int
+main(void)
+{
+ mrb_state *mrb = mrb_open();
+ if (!mrb) { /* handle error */ }
+ // mrb_load_string(mrb, str) to load from NULL terminated strings
+ // mrb_load_nstring(mrb, str, len) for strings without null terminator or with known length
+ mrb_load_string(mrb, "puts 'hello world'");
+ mrb_load_string(mrb, "Ye.c_method");
+ mrb_close(mrb);
+ return 0;
+}