Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
ROFLBALT
SCREEN_WIDTH = 120
SCREEN_HEIGHT = 40
class Game
def initialize
reset
end
def reset
@run = true
@world = World.new(SCREEN_WIDTH)
@screen = Screen.new(SCREEN_WIDTH, SCREEN_HEIGHT, @world)
end
def run
Signal.trap(:INT) do
@run = false
end
while @run
start_time = Time.new.to_f
unless @world.tick
reset
end
render start_time
end
on_exit
end
def render start_time
@world.buildings.each do |building|
@screen.draw(building)
end
@screen.draw(@world.player)
@world.misc.each do |object|
@screen.draw(object)
end
@screen.render start_time
end
def on_exit
@screen.on_exit
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.