summaryrefslogtreecommitdiffhomepage
path: root/mrblib/raylib.rb
blob: 7c8f6c24e9730357b45571c88e26e22045484aed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Rl = Raylib

module Raylib
  class << self
    attr_accessor :main_loop

    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 draw_text(text:, x:, y:, font_size:, color:)
      self._draw_text(text, x, y, font_size, color)
    end

    def draw_texture(texture:, x:, y:, tint: Rl::Color.new(255,255,255,255))
      self._draw_texture(texture, x, y, tint)
    end
  end
end