Sha256: 1360016787674efcf6eb943c98e0655f9b07930a441625ae4537311aad185a2b

Contents?: true

Size: 779 Bytes

Versions: 3

Compression:

Stored size: 779 Bytes

Contents

require "gosu"
require "gosu/swig_patches"
require "gosu/patches"
require "rhythmmml/scene"

module Rhythmmml
  class Game < Gosu::Window
    attr_reader :mml, :options, :scenes
    def initialize(mml, options={})
      super(640, 480, false)
      self.caption = "Rhythmmml"
      @mml = mml
      @options = options
      @options[:font_dir] ||= File.expand_path("../../../data/fonts", __FILE__)
      @scenes = []
      @scenes << Scene::Title.new(self)
    end

    def update
      current_scene.update
    end

    def draw
      current_scene.draw
    end

    def button_down(id)
      case id
      when Gosu::KbEscape
        close
      else
        current_scene.button_down(id)
      end
    end

    private
    def current_scene
      @scenes[0]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rhythmmml-0.0.3 lib/rhythmmml/game.rb
rhythmmml-0.0.2 lib/rhythmmml/game.rb
rhythmmml-0.0.1 lib/rhythmmml/game.rb