Sha256: 1bfe51accf0c98982b32f619ab968910127309c643d9d6150ec11d5b78bd290f

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

require "gosu"
require "onsengame/z_order"
require "onsengame/scene/base"
require "onsengame/scene/main"

module Onsengame
  module Scene
    class Title
      include Base

      def initialize(window)
        super
        @title = Gosu::Image.from_text(@window,
                                       @window.caption,
                                       @font_path,
                                       64,
                                       4,
                                       @window.width,
                                       :center)
        @guide = Gosu::Image.from_text(@window,
                                       "press enter",
                                       @font_path,
                                       36,
                                       4,
                                       @window.width,
                                       :center)
        @guide_color = Gosu::Color::WHITE
      end

      def update
        super
        if Time.now.sec % 2 == 0
          @guide_color = Gosu::Color::WHITE
        else
          @guide_color = Gosu::Color::GRAY
        end
      end

      def draw
        super
        @title.draw(0, @window.height * 0.2, ZOrder::TEXT)
        @guide.draw(0, @window.height * 0.6, ZOrder::TEXT,
                    1, 1, @guide_color)
      end

      def button_down(id)
        case id
        when Gosu::KbReturn
          @window.scenes.unshift(Main.new(@window))
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
onsengame-0.0.4 lib/onsengame/scene/title.rb
onsengame-0.0.3 lib/onsengame/scene/title.rb
onsengame-0.0.2 lib/onsengame/scene/title.rb
onsengame-0.0.1 lib/onsengame/scene/title.rb