Created
January 4, 2015 19:06
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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