Module: Nimo

Defined in:
lib/nimo/screen.rb,
lib/nimo/utils/game.rb,
lib/nimo/game_object.rb,
lib/nimo/game_window.rb,
lib/nimo/utils/resources.rb,
lib/nimo/utils/intersection.rb,
lib/nimo/listeners/event_listener.rb,
lib/nimo/listeners/input_listener.rb,
lib/nimo/representations/quad_representation.rb,
lib/nimo/representations/text_representation.rb,
lib/nimo/representations/image_representation.rb,
lib/nimo/representations/object_representation.rb,
lib/nimo/representations/sprite_representation.rb

Defined Under Namespace

Modules: Behavior, EventListener, InputListener Classes: Animation, GameBuilder, GameObject, GameWindow, ImageRepresentation, Intersection, ObjectRepresentation, QuadRepresentation, Resources, Screen, SpriteRepresentation, TextRepresentation, Timer

Class Method Summary collapse

Class Method Details

.Game(title, width, height, &blk) ⇒ Object

Helper method to create and show a new GameWindow with a construction block.

Example, from simplest.rb:

Nimo::Game("Simplest", 640, 480) do
  screen :game do
    quad :with => { :width => 20, :height => 20, :color => Gosu::white } do
      # Code ommited.
    end
    when_key(Gosu::Button::KbEscape) { exit }
  end
end


16
17
18
19
20
21
# File 'lib/nimo/utils/game.rb', line 16

def self.Game(title, width, height, &blk)
  window = Nimo::GameWindow.new(title, width, height)
  GameBuilder.new(window).instance_eval(&blk) if block_given?
  window.show
  return window
end