ENGINES: Add ScummVM splash

This commit is contained in:
Eugene Sandulenko 2015-11-07 22:35:10 +01:00
parent 54e136d27e
commit 3ced58e189
3 changed files with 978 additions and 0 deletions

View file

@ -41,6 +41,7 @@
#include "common/error.h"
#include "common/list.h"
#include "common/list_intern.h"
#include "common/memstream.h"
#include "common/scummsys.h"
#include "common/taskbar.h"
#include "common/textconsole.h"
@ -57,6 +58,7 @@
#include "graphics/cursorman.h"
#include "graphics/pixelformat.h"
#include "image/bmp.h"
#ifdef _WIN32_WCE
extern bool isSmartphone();
@ -240,6 +242,49 @@ void initCommonGFX(bool defaultTo1XScaler) {
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
}
// Please leave the splashscreen in wokring order for your releases, even if they're commercial.
// This is a proper and good way to show your appreciation for our hard work over these years.
bool splash = false;
#include "logo_data.h"
void splashScreen() {
Common::MemoryReadStream stream(logo_data, ARRAYSIZE(logo_data));
Image::BitmapDecoder bitmap;
if (!bitmap.loadStream(stream)) {
warning("Error loading logo file");
return;
}
g_system->showOverlay();
// Fill with white
Graphics::Surface screen;
screen.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
screen.fillRect(Common::Rect(screen.w, screen.h), screen.format.ARGBToColor(0xff, 0xff, 0xff, 0xff));
g_system->copyRectToOverlay(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h);
// Draw logo
Graphics::Surface *logo = bitmap.getSurface()->convertTo(g_system->getOverlayFormat(), bitmap.getPalette());
int x = (g_system->getOverlayWidth() - logo->w) / 2;
int y = (g_system->getOverlayHeight() - logo->h) / 2;
g_system->copyRectToOverlay(logo->getPixels(), logo->pitch, x, y, logo->w, logo->h);
// Delay 0.6 secs
uint time0 = g_system->getMillis();
Common::Event event;
while (time0 + 600 > g_system->getMillis()) {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
}
g_system->hideOverlay();
splash = true;
}
void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) {
g_system->beginGFXTransaction();
@ -258,6 +303,9 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics:
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
if (!splash)
splashScreen();
if (gfxError == OSystem::kTransactionSuccess)
return;