#include <fadeout.hpp>
Inherits ScreenFade.
Public Member Functions | |
FadeOut (float fade_time, Color dest_color=Color(0, 0, 0)) | |
virtual | ~FadeOut () |
virtual void | update (float elapsed_time) |
gets called for once (per logical) frame. | |
virtual void | draw (DrawingContext &context) |
gets called once per frame. | |
virtual bool | done () |
returns true if the effect is completed | |
Private Attributes | |
Color | color |
float | fade_time |
float | accum_time |
Definition at line 26 of file fadeout.hpp.
Definition at line 21 of file fadeout.cpp.
00022 : color(color), fade_time(fade_time), accum_time(0) 00023 { 00024 }
FadeOut::~FadeOut | ( | ) | [virtual] |
void FadeOut::update | ( | float | elapsed_time | ) | [virtual] |
gets called for once (per logical) frame.
ScreenFades should do their state updates and logic here
Implements ScreenFade.
Definition at line 31 of file fadeout.cpp.
References accum_time, and fade_time.
00032 { 00033 accum_time += elapsed_time; 00034 if(accum_time > fade_time) 00035 accum_time = fade_time; 00036 }
void FadeOut::draw | ( | DrawingContext & | context | ) | [virtual] |
gets called once per frame.
The ScreenFade should draw itself in this function. State changes should not be done in this function, but rather in update
Implements ScreenFade.
Definition at line 39 of file fadeout.cpp.
References accum_time, Color::alpha, color, DrawingContext::draw_filled_rect(), fade_time, LAYER_GUI, SCREEN_HEIGHT, and SCREEN_WIDTH.
00040 { 00041 Color col = color; 00042 col.alpha = accum_time / fade_time; 00043 context.draw_filled_rect(Vector(0, 0), 00044 Vector(SCREEN_WIDTH, SCREEN_HEIGHT), 00045 col, LAYER_GUI+1); 00046 }
bool FadeOut::done | ( | ) | [virtual] |
returns true if the effect is completed
Implements ScreenFade.
Definition at line 49 of file fadeout.cpp.
References accum_time, and fade_time.
00050 { 00051 return accum_time >= fade_time; 00052 }
Color FadeOut::color [private] |
float FadeOut::fade_time [private] |
float FadeOut::accum_time [private] |