Created
December 9, 2012 14:40
-
-
Save ruprict/4245320 to your computer and use it in GitHub Desktop.
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' | |
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