diff options
| author | arngo <[email protected]> | 2022-01-15 19:23:08 -0500 |
|---|---|---|
| committer | arngo <[email protected]> | 2022-01-15 19:23:08 -0500 |
| commit | cfd787b4f8c8684b626f2cd612e4336a2d3b4978 (patch) | |
| tree | 2fe449734bc5a38190b07aa06dec73050490356a | |
| parent | 34e315e6edb9fca2c86df44b1ce071726000245d (diff) | |
| download | mruby-raylib-cfd787b4f8c8684b626f2cd612e4336a2d3b4978.tar.gz mruby-raylib-cfd787b4f8c8684b626f2cd612e4336a2d3b4978.zip | |
.
| -rw-r--r-- | mrblib/raylib.rb | 18 | ||||
| -rw-r--r-- | src/raylib.c | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/mrblib/raylib.rb b/mrblib/raylib.rb index 53dc28f..5fd1ad7 100644 --- a/mrblib/raylib.rb +++ b/mrblib/raylib.rb @@ -1,14 +1,12 @@ -class Raylib - class << self - attr_accessor :main_loop +module Raylib + #attr_accessor :main_loop - #def call_main_loop - # self.main_loop.call - #end + #def call_main_loop + # self.main_loop.call + #end - def window_open(&block) - self.main_loop = block - self.execute_main_loop - end + def self.window_open(&block) + self.main_loop = block + self.execute_main_loop end end diff --git a/src/raylib.c b/src/raylib.c index f2fef48..23d75ac 100644 --- a/src/raylib.c +++ b/src/raylib.c @@ -73,13 +73,16 @@ mrb_clear_background(mrb_state *mrb, mrb_value self) return mrb_nil_value(); } -void + void call_main_loop() { mrb_state *mrb = mrb_open(); if (!mrb) {} + printf("test"); struct RClass *c = mrb_class_get(mrb, "Raylib"); - mrb_funcall(mrb, mrb_obj_value(c), "main_loop.call", 0); + printf("test2"); + mrb_value main_loop = mrb_funcall(mrb, mrb_obj_value(c), "main_loop", 0); + mrb_funcall(mrb, main_loop, "call", 0); } static mrb_value @@ -100,7 +103,6 @@ mrb_execute_main_loop(mrb_state *mrb, mrb_value self) return mrb_nil_value(); } - void mrb_mruby_raylib_gem_init(mrb_state* mrb) { struct RClass *raylib = mrb_define_module(mrb, "Raylib"); |
