diff options
| author | arngo <[email protected]> | 2022-01-18 18:36:01 -0500 |
|---|---|---|
| committer | arngo <[email protected]> | 2022-01-18 18:36:01 -0500 |
| commit | 37101bf5f1ea8d65d13348aec171fadf8850a46e (patch) | |
| tree | be62f9e03811b17ca5feb6cdda5b76b7576e52dc /mrblib/raylib.rb | |
| parent | cfd787b4f8c8684b626f2cd612e4336a2d3b4978 (diff) | |
| download | mruby-raylib-37101bf5f1ea8d65d13348aec171fadf8850a46e.tar.gz mruby-raylib-37101bf5f1ea8d65d13348aec171fadf8850a46e.zip | |
web and desktop main loop
Diffstat (limited to 'mrblib/raylib.rb')
| -rw-r--r-- | mrblib/raylib.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/mrblib/raylib.rb b/mrblib/raylib.rb index 5fd1ad7..0f542c9 100644 --- a/mrblib/raylib.rb +++ b/mrblib/raylib.rb @@ -1,12 +1,20 @@ module Raylib - #attr_accessor :main_loop + class << self + attr_accessor :main_loop - #def call_main_loop - # self.main_loop.call - #end + def while_window_open(&block) + self.main_loop = block + if Raylib.platform == 'desktop' + while !Raylib.window_should_close? do + self.main_loop.call + end + elsif Raylib.platform == 'web' + Raylib.emscripten_set_main_loop + end + end - def self.window_open(&block) - self.main_loop = block - self.execute_main_loop + def test + puts 'hello' + end end end |
