Skip to content

Instantly share code, notes, and snippets.

@RavensKrag
Last active August 29, 2015 14:17
Show Gist options
  • Save RavensKrag/9e5dc04596537de7a471 to your computer and use it in GitHub Desktop.
Save RavensKrag/9e5dc04596537de7a471 to your computer and use it in GitHub Desktop.
gosu input test
require 'rubygems'
require 'gosu'
require 'chipmunk'
class Window < Gosu::Window
def initialize
height = 900
width = (height.to_f*16/9).to_i
fullscreen = false
update_interval = 1/60.0 * 1000
super(width, height, fullscreen, update_interval)
self.caption = "Input Test"
end
def update
end
def draw
p = CP::Vec2.new(self.mouse_x, self.mouse_y)
z = 10000
color = Gosu::Color.argb(0x88ffff00)
offset = 10
self.draw_quad(
p.x-offset, p.y-offset, color,
p.x+offset, p.y-offset, color,
p.x+offset, p.y+offset, color,
p.x-offset, p.y+offset, color,
z
)
end
def button_down(id)
close if id == Gosu::KbEscape
end
def button_up(id)
end
def needs_cursor?
# @input.needs_cursor?
true
end
end
Window.new.show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment