Module: GosuWindowAPI

Included in:
HookedGosuWindow, MockGosuWindow
Defined in:
lib/gamebox/core/hooked_gosu_window.rb

Constant Summary collapse

MAX_UPDATE_SIZE_IN_MILLIS =
500

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#needs_cursorObject Also known as: needs_cursor?

Returns the value of attribute needs_cursor.



35
36
37
# File 'lib/gamebox/core/hooked_gosu_window.rb', line 35

def needs_cursor
  @needs_cursor
end

Instance Method Details

#button_down(id) ⇒ Object

in gosu this captures mouse and keyboard events



27
28
29
# File 'lib/gamebox/core/hooked_gosu_window.rb', line 27

def button_down(id)
  fire :button_down, id
end

#button_up(id) ⇒ Object



31
32
33
# File 'lib/gamebox/core/hooked_gosu_window.rb', line 31

def button_up(id)
  fire :button_up, id
end

#drawObject



22
23
24
# File 'lib/gamebox/core/hooked_gosu_window.rb', line 22

def draw
  fire :draw
end

#initialize(width, height, fullscreen) ⇒ Object



3
4
5
# File 'lib/gamebox/core/hooked_gosu_window.rb', line 3

def initialize(width, height, fullscreen)
  super(width, height, fullscreen)
end

#updateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gamebox/core/hooked_gosu_window.rb', line 7

def update
  millis = Gosu::milliseconds

  # ignore the first update
  if @last_millis
    delta = millis
    delta -= @last_millis if millis > @last_millis
    delta = MAX_UPDATE_SIZE_IN_MILLIS if delta > MAX_UPDATE_SIZE_IN_MILLIS

    fire :update, delta
  end

  @last_millis = millis
end