Class: GGLib::FadeScreen::FadeIn

Inherits:
Widget show all
Defined in:
lib/state.rb

Instance Attribute Summary

Attributes inherited from Widget

#buttonId, #defimage, #id, #name, #sleeping, #theme, #window, #zfocus

Attributes inherited from Containable

#align, #container, #maxSize, #minSize, #offset, #padding, #valign

Attributes inherited from Tile

#id, #inclusive, #x1, #x2, #y1, #y2

Instance Method Summary collapse

Methods inherited from Widget

#acceptStickyFocus?, #acceptText?, #blur, #button, #clicked?, #del, #downevent, #event, #feedText, #focus, #hasFocus?, #hasStickyFocus?, #intDraw, #onClick, #onDelete, #onDrag, #onInitialize, #onKeyDown, #onKeyUp, #onMouseDown, #onMouseOut, #onMouseOver, #onRightClick, #onRightDrag, #onRightMouseDown, #onStickyBlur, #onStickyFocus, #over?, #sleep, #sleeping?, #stickFocus, #unstickFocus, #wakeUp

Methods inherited from Tile

#centerOn, #del, deleteAllInstances, deleteById, #each, #eachBorder, getAllInstances, getById, #height, #iTile, intersect?, #intersect?, #isInTile?, #move, #resize, setAllInstances, #setCoordinates, #setTile, #width, #xTile

Constructor Details

#initialize(speed = 5) ⇒ FadeIn

Returns a new instance of FadeIn.



106
107
108
109
110
111
112
113
114
115
# File 'lib/state.rb', line 106

def initialize(speed=5)
  @image=Gosu::Image.new($window, $gglroot+"/media/black.bmp", true)
  @speed=speed
  @color=Gosu::Color.new(0x00ffffff)
  @alpha=255
  super(:FadeIn, 0, 0, 0, 0)
  wakeUp
  stickFocus
  $window.setFocus(nil)
end

Instance Method Details

#drawObject



116
117
118
119
120
121
122
123
124
125
126
# File 'lib/state.rb', line 116

def draw
  @alpha-=@speed
  if @alpha < 0
    @alpha=0
  end
  @color.alpha=@alpha
  @image.draw(0, 0, ZOrder::Top+1, 640, 480, @color)
  if @alpha == 0
    endFade
  end
end

#endFadeObject



127
128
129
130
131
132
# File 'lib/state.rb', line 127

def endFade
  unstickFocus
  $window.setFocus(nil)
  del
  $faded=true
end