Module: Hate::Core::Callbacks

Defined in:
lib/hate/core.rb

Overview

Callbacks are overridden by the user in Core::Game

Class Method Summary collapse

Class Method Details

.drawObject

Called each tick to update interface logic.



86
87
88
# File 'lib/hate/core.rb', line 86

def self.draw
  Hate::Game.draw if Hate::Game.respond_to?('draw')
end

.keypressed(key) ⇒ Object

Called when a key is pressed down.



106
107
108
# File 'lib/hate/core.rb', line 106

def self.keypressed(key)
  Hate::Game.keypressed(key) if Hate::Game.respond_to?('keypressed')
end

.keyreleased(key) ⇒ Object

Called when a key is let up.



111
112
113
# File 'lib/hate/core.rb', line 111

def self.keyreleased(key)
  Hate::Game.keyreleased(key) if Hate::Game.respond_to?('keyreleased')
end

.loadObject

Initializes pre-game logic.



76
77
78
# File 'lib/hate/core.rb', line 76

def self.load
  Hate::Game.load if Hate::Game.respond_to?('load')
end

.mousemotion(x, y, xr, xy, state) ⇒ Object

Called when a mouse is moved.



101
102
103
# File 'lib/hate/core.rb', line 101

def self.mousemotion(x, y, xr, xy, state)
  Hate::Game.mousemotion(x, y, xr, xy, state) if Hate::Game.respond_to?('mousemotion')
end

.mousepressed(x, y, button) ⇒ Object

Called when a mouse button is pressed down.



91
92
93
# File 'lib/hate/core.rb', line 91

def self.mousepressed(x, y, button)
  Hate::Game.mousepressed(x, y, button) if Hate::Game.respond_to?('mousepressed')
end

.mousereleased(x, y, button) ⇒ Object

Called when a mouse button is let up.



96
97
98
# File 'lib/hate/core.rb', line 96

def self.mousereleased(x, y, button)
  Hate::Game.mousereleased(x, y, button) if Hate::Game.respond_to?('mousereleased')
end

.quitObject

Called when the game is quit.



116
117
118
# File 'lib/hate/core.rb', line 116

def self.quit
  Hate::Game.quit if Hate::Game.respond_to?('quit')
end

.updateObject

Called every other tick to update game logic.



81
82
83
# File 'lib/hate/core.rb', line 81

def self.update
  Hate::Game.update if Hate::Game.respond_to?('update')
end