Module: Hate::Core::Callbacks
- Defined in:
- lib/hate/core.rb
Overview
Callbacks are overridden by the user in Core::Game
Class Method Summary collapse
-
.draw ⇒ Object
Called each tick to update interface logic.
-
.keypressed(key) ⇒ Object
Called when a key is pressed down.
-
.keyreleased(key) ⇒ Object
Called when a key is let up.
-
.load ⇒ Object
Initializes pre-game logic.
-
.mousemotion(x, y, xr, xy, state) ⇒ Object
Called when a mouse is moved.
-
.mousepressed(x, y, button) ⇒ Object
Called when a mouse button is pressed down.
-
.mousereleased(x, y, button) ⇒ Object
Called when a mouse button is let up.
-
.quit ⇒ Object
Called when the game is quit.
-
.update ⇒ Object
Called every other tick to update game logic.
Class Method Details
.draw ⇒ Object
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 |
.load ⇒ Object
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, ) Hate::Game.mousepressed(x, y, ) 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, ) Hate::Game.mousereleased(x, y, ) if Hate::Game.respond_to?('mousereleased') end |