Sha256: bd72fbd4b299d6065f71c87f9a1583e3bc1876e8b20d0bfc27ba575a8f3e6f4c

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib")
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../ext")

require 'ray'

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
    @sprite = sprite path_of("sprite.png")

    @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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ray-0.2.1 samples/view/view.rb
ray-0.2.0 samples/view/view.rb
ray-0.1.1 samples/view/view.rb
ray-0.1.0 samples/view/view.rb