Skip to content

Instantly share code, notes, and snippets.

Created January 4, 2015 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d668678dad865f9d2067 to your computer and use it in GitHub Desktop.
Save anonymous/d668678dad865f9d2067 to your computer and use it in GitHub Desktop.
Goal: Print "HelloGame!" to the center of a window. Syntax errors are on lines 23 and 28 when code is ran.
require 'gosu'
class Hello < Gosu::Window
def initialize (width = 800, height = 600, fullscreen = false)
super
self.caption = "HelloGame!"
@image = Gosu::Image.from_text self, "HelloGame!",
Gosu.default_font_name,
100
end
def button_down id
close if id == Gosu::KbEscape
end
def update
@x = self.width/2 - @image.width/2
@y = self.height/2 - @image.height/2
end
def draw
@image.draw (@x, @y, 0)
end
end
Hello.new.show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment