Class: Okami::Window

Inherits:
Gosu::Window
  • Object
show all
Defined in:
lib/okami/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_visibleObject

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 button_down id
  Okami::Keyboard .button_down  id
  Okami::Mouse    .button_down  id
end

#button_up(id) ⇒ Object



18
19
20
21
# File 'lib/okami/window.rb', line 18

def button_up   id
  Okami::Keyboard .button_up    id
  Okami::Mouse    .button_up    id
end

#calculate_dtObject



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_cursorObject



10
# File 'lib/okami/window.rb', line 10

def hide_cursor;   @cursor_visible = false end

#needs_cursor?Boolean

Returns:

  • (Boolean)


11
# File 'lib/okami/window.rb', line 11

def needs_cursor?; @cursor_visible         end

#show_cursorObject



9
# File 'lib/okami/window.rb', line 9

def show_cursor;   @cursor_visible = true  end