From: Tim Goya Date: Sun, 2 Nov 2008 19:32:27 +0000 (+0000) Subject: revert accidentally commited files X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=98dfd58973cda2eebb77cdc0241d9a8c7c745371;p=supertux.git revert accidentally commited files SVN-Revision: 5820 --- diff --git a/src/video/gl_renderer.cpp b/src/video/gl_renderer.cpp index 275d55916..1d062c44b 100644 --- a/src/video/gl_renderer.cpp +++ b/src/video/gl_renderer.cpp @@ -134,6 +134,8 @@ Renderer::Renderer() : desktop_width(-1), desktop_height(-1) { + ::Renderer::instance_ = this; + #if SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2 || (SDL_MINOR_VERSION == 2 && SDL_PATCHLEVEL >= 10) // unfortunately only newer SDLs have these infos. // This must be called before SDL_SetVideoMode() or it will return diff --git a/src/video/renderer.hpp b/src/video/renderer.hpp index b04d0dca4..2839492ea 100644 --- a/src/video/renderer.hpp +++ b/src/video/renderer.hpp @@ -55,6 +55,11 @@ public: virtual void flip() = 0; virtual void resize(int w, int h) = 0; virtual void apply_config() = 0; + + static Renderer* instance() { assert(instance_); return instance_; } + +protected: + static Renderer* instance_; }; #endif diff --git a/src/video/sdl_renderer.cpp b/src/video/sdl_renderer.cpp index 4be1dd0ec..b02d0a189 100644 --- a/src/video/sdl_renderer.cpp +++ b/src/video/sdl_renderer.cpp @@ -130,6 +130,8 @@ namespace SDL { Renderer::Renderer() { + ::Renderer::instance_ = this; + const SDL_VideoInfo *info = SDL_GetVideoInfo(); log_info << "Hardware surfaces are " << (info->hw_available ? "" : "not ") << "available." << std::endl; log_info << "Hardware to hardware blits are " << (info->blit_hw ? "" : "not ") << "accelerated." << std::endl; @@ -141,20 +143,11 @@ namespace SDL log_info << "Color fills are " << (info->blit_fill ? "" : "not ") << "accelerated." << std::endl; int flags = SDL_SWSURFACE | SDL_ANYFORMAT; - int width; - int height; if(config->use_fullscreen) - { flags |= SDL_FULLSCREEN; - width = config->fullscreen_width; - height = config->fullscreen_height; - } - else - { - flags |= SDL_RESIZABLE; - width = config->window_width; - height = config->window_height; - } + + int width = 800; //FIXME: config->screenwidth; + int height = 600; //FIXME: config->screenheight; screen = SDL_SetVideoMode(width, height, 0, flags); if(screen == 0) { @@ -166,18 +159,20 @@ namespace SDL numerator = 1; denominator = 1; - float xfactor = (float) width / SCREEN_WIDTH; - float yfactor = (float) height / SCREEN_HEIGHT; + /* FIXME: + float xfactor = (float) config->screenwidth / SCREEN_WIDTH; + float yfactor = (float) config->screenheight / SCREEN_HEIGHT; if(xfactor < yfactor) { - numerator = width; + numerator = config->screenwidth; denominator = SCREEN_WIDTH; } else { - numerator = height; + numerator = config->screenheight; denominator = SCREEN_HEIGHT; } + */ if(texture_manager == 0) texture_manager = new TextureManager(); }