Class: GGLib::FadeScreen
- Inherits:
-
StateObject
- Object
- StateObject
- GGLib::FadeScreen
- Defined in:
- lib/state.rb
Defined Under Namespace
Classes: FadeIn
Instance Attribute Summary collapse
-
#widgetID ⇒ Object
readonly
Returns the value of attribute widgetID.
Instance Method Summary collapse
- #draw ⇒ Object
- #endFade ⇒ Object
- #fading? ⇒ Boolean
-
#initialize(fadeTo = nil, speed = 1) ⇒ FadeScreen
constructor
A new instance of FadeScreen.
- #onStart ⇒ Object
Methods inherited from StateObject
#button_down, #button_up, #end, #onEnd, #onTerminate, #start, #update, #window
Constructor Details
#initialize(fadeTo = nil, speed = 1) ⇒ FadeScreen
Returns a new instance of FadeScreen.
69 70 71 72 73 74 75 76 |
# File 'lib/state.rb', line 69 def initialize(fadeTo=nil, speed=1) $faded=false @image=Gosu::Image.new($window, $gglroot+"/media/black.bmp", true) @fading=false @speed=speed @fadeTo=fadeTo @color=Gosu::Color.new(0xffffffff) end |
Instance Attribute Details
#widgetID ⇒ Object (readonly)
Returns the value of attribute widgetID.
68 69 70 |
# File 'lib/state.rb', line 68 def @widgetID end |
Instance Method Details
#draw ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/state.rb', line 84 def draw if @fading @alpha+=@speed if @alpha > 255 @alpha=255 end @color.alpha=@alpha @image.draw(0, 0, ZOrder::Top+1, 640, 480, @color) if @alpha == 255 endFade @widgetID = FadeIn.new(@speed) end end end |
#endFade ⇒ Object
98 99 100 101 102 103 |
# File 'lib/state.rb', line 98 def endFade @fading=false @image=nil self.end @fadeTo.start if @fadeTo!=nil end |
#fading? ⇒ Boolean
77 78 79 |
# File 'lib/state.rb', line 77 def fading? return @fading end |
#onStart ⇒ Object
80 81 82 83 |
# File 'lib/state.rb', line 80 def onStart @fading=true @alpha=0 end |