}
-void fadeout()
+#define LOOP_DELAY 20.0
+
+void fadeout(int fade_time)
{
+ float alpha_inc = 256 / (fade_time / LOOP_DELAY);
+ float alpha = 256;
+
+ while(alpha > 0)
+ {
+ alpha -= alpha_inc;
+ fillrect(0, 0, screen->w, screen->h, 0,0,0, (int)alpha_inc); // left side
+
+ DrawingContext context; // ugly...
+ context.do_drawing();
+
+ SDL_Delay(int(LOOP_DELAY));
+ }
+
fillrect(0, 0, screen->w, screen->h, 0, 0, 0, 255);
DrawingContext context;
context.do_drawing();
}
-#define LOOP_DELAY 20.0
-void shrink_fade(const Vector& point, float fade_time)
+void shrink_fade(const Vector& point, int fade_time)
{
- float left_inc = point.x / (fade_time / LOOP_DELAY);
- float right_inc = (screen->w - point.x) / (fade_time / LOOP_DELAY);
- float up_inc = point.y / (fade_time / LOOP_DELAY);
- float down_inc = (screen->h - point.y) / (fade_time / LOOP_DELAY);
+ float left_inc = point.x / ((float)fade_time / LOOP_DELAY);
+ float right_inc = (screen->w - point.x) / ((float)fade_time / LOOP_DELAY);
+ float up_inc = point.y / ((float)fade_time / LOOP_DELAY);
+ float down_inc = (screen->h - point.y) / ((float)fade_time / LOOP_DELAY);
float left_cor = 0, right_cor = 0, up_cor = 0, down_cor = 0;
void drawline(int x1, int y1, int x2, int y2, int r, int g, int b, int a);
void fillrect(float x, float y, float w, float h, int r, int g, int b,
int a = 255);
-void shrink_fade(const Vector& point, float fade_time);
-//void black_fade(Surface* surface, int seconds, bool fade_out);
-void fade(const std::string& surface, int seconds, bool fade_out);
-void update_rect(SDL_Surface *scr, Sint32 x, Sint32 y, Sint32 w, Sint32 h);
-void fadeout();
+
+void fadeout(int fade_time);
+void shrink_fade(const Vector& point, int fade_time);
#endif /*SUPERTUX_SCREEN_H*/