CFinaleStaticScene::CFinaleStaticScene(const std::string &game_path, const std::string &scene_file): m_mustclose(false), m_timer(0) { mpSceneSurface.reset(SDL_CreateRGBSurface( 0, 320, 200, 8, 0, 0, 0, 0), &SDL_FreeSurface); #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetPaletteColors(mpSceneSurface->format->palette, g_pGfxEngine->Palette.m_Palette, 0, 255); SDL_SetColorKey(mpSceneSurface.get(), SDL_TRUE, COLORKEY); #else SDL_SetColors(mpSceneSurface.get(), g_pGfxEngine->Palette.m_Palette, 0, 255); SDL_SetColorKey(mpSceneSurface.get(), SDL_SRCCOLORKEY, COLORKEY); #endif if( finale_draw( mpSceneSurface.get(), scene_file, game_path) ) { #if SDL_VERSION_ATLEAST(2, 0, 0) #else mpSceneSurface.reset(g_pVideoDriver->convertThroughBlitSfc(mpSceneSurface.get()), &SDL_FreeSurface); #endif SDL_Surface *blit = g_pVideoDriver->getBlitSurface(); std::shared_ptr<SDL_Surface> scaledScene( SDL_ConvertSurface(blit, blit->format, 0), &SDL_FreeSurface); SDL_Rect srcRect, dstRect; srcRect.x = 0; srcRect.y = 0; srcRect.w = mpSceneSurface->w; srcRect.h = mpSceneSurface->h; dstRect.x = 0; dstRect.y = 0; dstRect.w = scaledScene->w; dstRect.h = scaledScene->h; SDL_FillRect(scaledScene.get(), nullptr, SDL_MapRGB(scaledScene->format, 0, 0, 0) ); SDL_BlitScaledWrap(mpSceneSurface.get(), &srcRect, scaledScene.get(), &dstRect); mpSceneSurface = scaledScene; } else { m_mustclose = true; } }
CFinaleStaticScene::CFinaleStaticScene(const std::string &game_path, const std::string &scene_file): m_mustclose(false), m_count(0), m_timer(0) { const SDL_Rect resrect = g_pVideoDriver->getGameResolution().SDLRect(); const Uint32 flags = g_pVideoDriver->getBlitSurface()->flags; mpSceneSurface = SDL_CreateRGBSurface( flags, resrect.w, resrect.h, 8, 0, 0, 0, 0); SDL_SetColors( mpSceneSurface.get(), g_pGfxEngine->Palette.m_Palette, 0, 255); if( finale_draw( mpSceneSurface.get(), scene_file, game_path) ) { mpSceneSurface = SDL_DisplayFormatAlpha(mpSceneSurface.get()); } else { m_mustclose = true; } }