From: Christoph Sommer Date: Wed, 19 Apr 2006 23:02:00 +0000 (+0000) Subject: Updated -nogl patch X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=01dec550e8691affe04145766e67141adb5a9ec5;p=supertux.git Updated -nogl patch SVN-Revision: 3372 --- diff --git a/contrib/supertux-nogl.diff b/contrib/supertux-nogl.diff index 93e477391..0a0cc39ec 100644 --- a/contrib/supertux-nogl.diff +++ b/contrib/supertux-nogl.diff @@ -591,149 +591,6 @@ diff -Naur supertux/src/video/glutil.hpp supertux-nogl/src/video/glutil.hpp #endif -diff -Naur supertux/src/video/screen.cpp supertux-nogl/src/video/screen.cpp ---- supertux/src/video/screen.cpp 2006-04-07 03:32:13.000000000 +0200 -+++ supertux-nogl/src/video/screen.cpp 2006-04-07 04:11:49.000000000 +0200 -@@ -38,61 +38,70 @@ - - static const float LOOP_DELAY = 20.0; - --void fillrect(float x, float y, float w, float h, const Color& col) --{ -- if(w < 0) { -- x += w; -- w = -w; -- } -- if(h < 0) { -- y += h; -- h = -h; -- } -- -- glColor4f(col.red, col.green, col.blue, col.alpha); - -- glDisable(GL_TEXTURE_2D); -- glBegin(GL_POLYGON); -- glVertex2f(x, y); -- glVertex2f(x+w, y); -- glVertex2f(x+w, y+h); -- glVertex2f(x, y+h); -- glEnd(); -- glEnable(GL_TEXTURE_2D); -- -- glColor4f(0, 0, 0, 1); -+void fillrect(float x, float y, float w, float h, int r, int g, int b, int a) -+ { -+ SDL_Surface* screen = SDL_GetVideoSurface(); -+ -+ if(w < 0) { -+ x += w; -+ w = -w; -+ } -+ if(h < 0) { -+ y += h; -+ h = -h; -+ } -+ -+ SDL_Rect src, rect; -+ SDL_Surface *temp = NULL; -+ -+ rect.x = (int)x; -+ rect.y = (int)y; -+ rect.w = (int)w; -+ rect.h = (int)h; -+ -+ if(a != 255) { -+ temp = SDL_CreateRGBSurface(screen->flags, rect.w, rect.h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); -+ -+ src.x = 0; -+ src.y = 0; -+ src.w = rect.w; -+ src.h = rect.h; -+ -+ SDL_FillRect(temp, &src, SDL_MapRGB(screen->format, r, g, b)); -+ SDL_SetAlpha(temp, SDL_SRCALPHA, a); -+ SDL_BlitSurface(temp,0,screen,&rect); -+ SDL_FreeSurface(temp); -+ } -+ else -+ SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, r, g, b)); - } - - void fadeout(float fade_time) - { -- float alpha_inc = LOOP_DELAY / fade_time; -- Color c(0, 0, 0, alpha_inc); -- float alpha = 1.0; -+ float alpha_inc = 256 / (fade_time / LOOP_DELAY); -+ float alpha = 256; - -- while(alpha >= 0) { -+ while(alpha > 0) { - alpha -= alpha_inc; -- fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, c); -- // left side -+ fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0,0,0, (int)alpha_inc); // left side - -- SDL_GL_SwapBuffers(); -+ SDL_Flip(SDL_GetVideoSurface()); - sound_manager->update(); - - SDL_Delay(int(LOOP_DELAY)); -- alpha -= alpha_inc; - } -- -- fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Color()); -+ fillrect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 255); - } - - void shrink_fade(const Vector& point, float fade_time) - { -- float left_inc = point.x / (fade_time / LOOP_DELAY); -- float right_inc = (SCREEN_WIDTH - point.x) / (fade_time / LOOP_DELAY); -- float up_inc = point.y / (fade_time / LOOP_DELAY); -- float down_inc = (SCREEN_HEIGHT - point.y) / (fade_time / LOOP_DELAY); -+ float left_inc = point.x / ((float)fade_time / LOOP_DELAY); -+ float right_inc = (SCREEN_WIDTH - point.x) / ((float)fade_time / LOOP_DELAY); -+ float up_inc = point.y / ((float)fade_time / LOOP_DELAY); -+ float down_inc = (SCREEN_HEIGHT - point.y) / ((float)fade_time / LOOP_DELAY); - - float left_cor = 0, right_cor = 0, up_cor = 0, down_cor = 0; -- Color c; - - while(left_cor < point.x && right_cor < SCREEN_WIDTH - point.x && - up_cor < point.y && down_cor < SCREEN_HEIGHT - point.y) { -@@ -101,15 +110,14 @@ - up_cor += up_inc; - down_cor += down_inc; - -- fillrect(0, 0, left_cor, SCREEN_HEIGHT, c); // left side -- fillrect(SCREEN_WIDTH - right_cor, 0, right_cor, SCREEN_HEIGHT, c); // right side -- fillrect(0, 0, SCREEN_WIDTH, up_cor, c); // up side -- fillrect(0, SCREEN_HEIGHT - down_cor, SCREEN_WIDTH, down_cor+1, c); // down side -+ fillrect(0, 0, left_cor, SCREEN_HEIGHT, 0,0,0, 255); // left side -+ fillrect(SCREEN_WIDTH - right_cor, 0, right_cor, SCREEN_HEIGHT, 0,0,0, 255); // right side -+ fillrect(0, 0, SCREEN_WIDTH, up_cor, 0,0,0, 255); // up side -+ fillrect(0, SCREEN_HEIGHT - down_cor, SCREEN_WIDTH, down_cor+1, 0,0,0, 255); // down side - -- SDL_GL_SwapBuffers(); -+ SDL_Flip(SDL_GetVideoSurface()); - - sound_manager->update(); - SDL_Delay(int(LOOP_DELAY)); - } - } -- -diff -Naur supertux/src/video/screen.hpp supertux-nogl/src/video/screen.hpp ---- supertux/src/video/screen.hpp 2006-04-07 03:32:13.000000000 +0200 -+++ supertux-nogl/src/video/screen.hpp 2006-04-07 04:11:49.000000000 +0200 -@@ -20,7 +20,6 @@ - #define SUPERTUX_SCREEN_H - - #include --#include - #include - - #include diff -Naur supertux/src/video/surface.cpp supertux-nogl/src/video/surface.cpp --- supertux/src/video/surface.cpp 2006-03-25 01:16:31.000000000 +0100 +++ supertux-nogl/src/video/surface.cpp 2006-04-07 04:11:49.000000000 +0200