Class: Okami::Window
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- Okami::Window
- Defined in:
- lib/okami/window.rb
Instance Attribute Summary collapse
-
#cursor_visible ⇒ Object
Returns the value of attribute cursor_visible.
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #button_up(id) ⇒ Object
- #calculate_dt ⇒ Object
- #fill(color, z = 0, mode = :default) ⇒ Object
- #hide_cursor ⇒ Object
-
#initialize(*args) ⇒ Window
constructor
A new instance of Window.
- #needs_cursor? ⇒ Boolean
- #show_cursor ⇒ Object
Constructor Details
#initialize(*args) ⇒ Window
Returns a new instance of Window.
4 5 6 |
# File 'lib/okami/window.rb', line 4 def initialize *args $window = super *args end |
Instance Attribute Details
#cursor_visible ⇒ Object
Returns the value of attribute cursor_visible.
8 9 10 |
# File 'lib/okami/window.rb', line 8 def cursor_visible @cursor_visible end |
Instance Method Details
#button_down(id) ⇒ Object
13 14 15 16 |
# File 'lib/okami/window.rb', line 13 def id Okami::Keyboard . id Okami::Mouse . id end |
#button_up(id) ⇒ Object
18 19 20 21 |
# File 'lib/okami/window.rb', line 18 def id Okami::Keyboard . id Okami::Mouse . id end |
#calculate_dt ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/okami/window.rb', line 31 def calculate_dt update_interval = self.update_interval / 1000.0 seconds = Time.now.to_f @_current_time = seconds @_previous_time ||= @_current_time - update_interval dt = @_current_time - @_previous_time @_previous_time = @_current_time dt = update_interval if dt < update_interval return dt, seconds end |
#fill(color, z = 0, mode = :default) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/okami/window.rb', line 23 def fill color, z=0, mode=:default draw_quad 0, 0, color, width, 0, color, 0, height, color, width, height, color, z, mode end |
#hide_cursor ⇒ Object
10 |
# File 'lib/okami/window.rb', line 10 def hide_cursor; @cursor_visible = false end |
#needs_cursor? ⇒ Boolean
11 |
# File 'lib/okami/window.rb', line 11 def needs_cursor?; @cursor_visible end |
#show_cursor ⇒ Object
9 |
# File 'lib/okami/window.rb', line 9 def show_cursor; @cursor_visible = true end |