Sha256: 9b2d545d00c8e595469434461a252ba3fc6f2c3f271baedb3b6ab2f34e0e578d
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
class Game < Gosu::Window def initialize # TODO: require SCREEN_WIDTH and SCREEN_HEIGHT super(SCREEN_WIDTH, SCREEN_HEIGHT) Global.initialize Global.presentation_proc.call() end def button_down(button_id) case button_id when Gosu::KB_DOWN then Global.cursor_down_proc.call unless Global.cursor_down_proc.nil? when Gosu::KB_UP then Global.cursor_up_proc.call unless Global.cursor_up_proc.nil? when Gosu::KB_LEFT then Global.cursor_left_proc.call unless Global.cursor_left_proc.nil? when Gosu::KB_RIGHT then Global.cursor_right_proc.call unless Global.cursor_right_proc.nil? when Gosu::MS_LEFT then Global.mouse_button_left_proc.call unless Global.mouse_button_left_proc.nil? when Gosu::MS_RIGHT then Global.mouse_button_right_proc.call unless Global.mouse_button_right_proc.nil? when Gosu::KB_SPACE then Global.space_bar_proc.call unless Global.space_bar_proc.nil? end Global.button_proc.call(button_id) unless Global.button_proc.nil? super end def update Global.update Global.actors.each do |e| e.move end Global.hud_texts.each do |e| e.move end Global.hud_images.each do |e| e.move end Global.loop_proc.call() unless Global.loop_proc.nil? end def draw Gosu.draw_rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Global.background) ( Global.backgrounds + Global.actors + Global.hud_texts + Global.hud_images ).sort_by(&:layer).each do |e| e.draw end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fantasy-0.1.3 | lib/fantasy/loop.rb |