Basic Window

require 'gosu'

class GameWindow < Gosu::Window
	def initialize
		super 640, 480
		self.caption = "My First Game"

If you are familiar with Ruby, the syntax should be pretty straightforward, but there are a few Window methods worth looking at:

initialize is your window’s constructor, and all of its configuration should be contained in this method. Note that we use super to pass the width and height of the window up to Window#initialize which uses them to size the window on the screen. is sneaky- it creates a new GameWindow as you might expect, and then immediately calls show which tells Gosu to start the rendering loop inside your window. Note that if we put a line of code after this, it would not be run until the window closes.