Skip to content

Instantly share code, notes, and snippets.

@ruprict
Created December 9, 2012 14:40
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 ruprict/4245320 to your computer and use it in GitHub Desktop.
Save ruprict/4245320 to your computer and use it in GitHub Desktop.
require 'gosu'
require 'texplay'
class GameWindow < Gosu::Window
def initialize
super 200, 200, false
self.caption = "Scratch-off Sample"
# below we set up the image resources that we'll use for the app
# your base image that will be hidden under the grey layer
@background_image = Gosu::Image.new(self, "a.jpg", true)
# simply grey to cover our first image
@grey = Gosu::Image.new(self, "grey.jpg", true)
# small pointer or virtual coin to scratch-off the coating
@pointer = Gosu::Image.new(self, "pointer.png", true)
@pos_x = 0
@pos_y = 0
end
def update
end
def draw
@background_image.draw(0, 0, 0)
@pointer.draw(mouse_x, mouse_y, 0)
a = mouse_x
b = mouse_y
@grey.paint{
circle a+5, b+5, 10, 10, :mode => :clear, :fill => true
}
#@background_image.draw(0,0,0)
@grey.draw(0, 0, 0)
end
end
window = GameWindow.new
window.show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment