Class: Rhythmmml::Scene::Title

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/rhythmmml/scene.rb

Instance Method Summary collapse

Constructor Details

#initialize(window) ⇒ Title

Returns a new instance of Title.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rhythmmml/scene.rb', line 37

def initialize(window)
  super
  @title = Gosu::Image.from_text(@window,
                                 "Rhythmmml",
                                 @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

Instance Method Details

#button_down(id) ⇒ Object



72
73
74
75
76
77
# File 'lib/rhythmmml/scene.rb', line 72

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

#drawObject



65
66
67
68
69
70
# File 'lib/rhythmmml/scene.rb', line 65

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

#updateObject



56
57
58
59
60
61
62
63
# File 'lib/rhythmmml/scene.rb', line 56

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