Created
July 16, 2011 21:07
-
-
Save bil-bas/1086793 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
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../ray/lib") | |
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../ray/ext") | |
require 'ray' | |
require 'pry' | |
def path_of(res) | |
File.expand_path File.join(File.dirname(__FILE__), '../../test/res', res) | |
end | |
Ray.game "View" do | |
register { add_hook :quit, method(:exit!) } | |
scene :view do | |
img = Ray::Image.new [100, 100] | |
image_target img do |target| | |
target.clear Ray::Color.red | |
target.update | |
end | |
@sprite = sprite img | |
@normal_view = window.default_view | |
@normal_view.center = @sprite.rect.size / 2 | |
@zoomed_view = @normal_view.dup | |
@zoomed_view.viewport = [0.05, 0.05, 0.2, 0.2] | |
@zoomed_view.zoom_by [10, 10] | |
render do |win| | |
win.with_view @normal_view do | |
win.draw @sprite | |
end | |
win.with_view @zoomed_view do | |
#win.draw @sprite | |
end | |
end | |
end | |
scenes << :view | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment