Sha256: 5bbcff71b2e503163a2607853deb4be3ed956d1c5c5c4c10820d45b17f1fbc4a

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

# Hello world!
## Subclassing Ray::Game or Ray::Scene
    require 'ray'

    class HelloScene < Ray::Scene
      scene_name :hello
  
      def setup
        @font = font(path_of("VeraMono.ttf"), 12)
      end
  
      def render(win)
        @font.draw("Hello world!", :on => win, :at => [0, 0])
      end
    end

    class HelloWorld < Ray::Game
      def initialize
        super("Hello world!")
    
        HelloScene.bind(self)
        push_scene :hello
      end
  
      def register
        add_hook :quit, method(:exit!)
      end
    end

    HelloWorld.new.run
## DSL
    require 'ray'

    Ray::Game.new("Hello world!") do
      register do
        add_hook :quit, method(:exit!)
      end
  
      scene :hello do
        @font = font(path_of("VeraMono.ttf"), 12)
    
        render do |win|
          @font.draw("Hello world", :on => win, :at => [0, 0])
        end
      end
  
      push_scene :hello
    end
# Installation
Run the following command:

    gem install ray

This requires the SDL to be installed. SDL_TTF, SDL_image, SDL_gfx, and
SDL_mixer are also needed for several features, though you can install ray
without them.
# Features
* Hides the event loop where registred blocks or methods are run when something
  happens.
* Provides a cache for resources like images, fonts, sounds, ...
* Documented, using YARD. You can check the documentation on
  [rubydoc.info](http://rubydoc.info/github/Mon-Ouie/ray/master/frames)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ray-0.0.1 README.md