2 Copyright (C) 2004-2011 Parallel Realities
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 void SDL_SetAlpha(SDL_Surface *surface, uint8_t value) {
24 SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
25 SDL_SetSurfaceAlphaMod(surface, value);
30 for (int i = 0 ; i < MAX_TILES ; i++)
40 medalMessageTimer = 0;
46 takeRandomScreenShots = false;
55 debug(("graphics.free: Background\n"));
56 if (background != NULL)
58 SDL_FreeSurface(background);
60 debug(("graphics.free: Background - Done\n"));
64 debug(("graphics.free: Tiles\n"));
65 for (int i = 0 ; i < MAX_TILES ; i++)
69 SDL_FreeSurface(tile[i]);
73 debug(("graphics.free: Tiles - Done\n"));
75 debug(("graphics.free: Sprites\n"));
76 Sprite *sprite = (Sprite*)spriteList.getHead();
77 while (sprite->next != NULL)
79 sprite = (Sprite*)sprite->next;
80 //debug(("graphics.free: Sprites Sprite::Free - %s\n", sprite->name));
83 debug(("graphics.free: Sprites Clear()\n"));
85 debug(("graphics.free: Sprites - Done\n"));
88 void Graphics::destroy()
92 for (int i = 0 ; i < 5 ; i++)
96 TTF_CloseFont(font[i]);
100 if (medalMessage != NULL)
102 SDL_FreeSurface(medalMessage);
107 SDL_FreeSurface(fadeBlack);
112 SDL_FreeSurface(infoBar);
115 for (int i = 0 ; i < 4 ; i++)
117 if (medal[i] != NULL)
119 SDL_FreeSurface(medal[i]);
125 void Graphics::registerEngine(Engine *engine)
127 this->engine = engine;
130 void Graphics::mapColors()
132 red = SDL_MapRGB(screen->format, 0xff, 0x00, 0x00);
133 yellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x00);
134 green = SDL_MapRGB(screen->format, 0x00, 0xff, 0x00);
135 darkGreen = SDL_MapRGB(screen->format, 0x00, 0x77, 0x00);
136 skyBlue = SDL_MapRGB(screen->format, 0x66, 0x66, 0xff);
137 blue = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
138 cyan = SDL_MapRGB(screen->format, 0x00, 0x99, 0xff);
139 white = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
140 lightGrey = SDL_MapRGB(screen->format, 0xcc, 0xcc, 0xcc);
141 grey = SDL_MapRGB(screen->format, 0x88, 0x88, 0x88);
142 darkGrey = SDL_MapRGB(screen->format, 0x33, 0x33, 0x33);
143 black = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
145 fontForeground.r = fontForeground.g = fontForeground.b = 0xff;
146 fontBackground.r = fontBackground.g = fontBackground.b = 0x00;
148 fadeBlack = alphaRect(640, 480, 0x00, 0x00, 0x00);
150 infoBar = alphaRect(640, 25, 0x00, 0x00, 0x00);
155 Sprite *Graphics::getSpriteHead()
157 return (Sprite*)spriteList.getHead();
160 void Graphics::setTransparent(SDL_Surface *sprite)
162 SDL_SetColorKey(sprite, SDL_TRUE, SDL_MapRGB(sprite->format, 0, 0, 0));
165 bool Graphics::canShowMedalMessage() const
167 return (medalMessageTimer <= 0);
170 void Graphics::updateScreen()
172 if (medalMessageTimer > 0)
183 drawRect(screen->w - (medalMessage->w + 5 + padding), 5, medalMessage->w + padding - 2, 20, grey, screen);
184 drawRect(screen->w - (medalMessage->w + 5 + padding - 1), 6, medalMessage->w + padding - 4, 18, black, screen);
185 blit(medalMessage, screen->w - (medalMessage->w + 5), 7, screen, false);
189 blit(medal[medalType], screen->w - (medalMessage->w + 5 + 16), 7, screen, false);
193 SDL_UpdateTexture(texture, NULL, screen->pixels, screen->w * 4);
194 SDL_RenderCopy(renderer, texture, NULL, NULL);
195 SDL_RenderPresent(renderer);
197 if (takeRandomScreenShots)
199 if ((Math::prand() % 500) == 0)
201 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
202 SDL_SaveBMP(screen, screenshot);
209 if (engine->keyState[SDL_SCANCODE_F12])
211 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
212 SDL_SaveBMP(screen, screenshot);
215 engine->keyState[SDL_SCANCODE_F12] = 0;
218 if ((engine->keyState[SDL_SCANCODE_F10]) || ((engine->keyState[SDL_SCANCODE_RETURN]) && (engine->keyState[SDL_SCANCODE_LALT])))
220 engine->fullScreen = !engine->fullScreen;
221 SDL_SetWindowFullscreen(window, engine->fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
223 engine->keyState[SDL_SCANCODE_F10] = engine->keyState[SDL_SCANCODE_LALT] = engine->keyState[SDL_SCANCODE_RETURN] = 0;
227 void Graphics::delay(int time)
229 unsigned long then = SDL_GetTicks();
231 engine->keyState[SDL_SCANCODE_ESCAPE] = 0;
237 if (SDL_GetTicks() >= then + time)
245 if (engine->keyState[SDL_SCANCODE_ESCAPE])
253 void Graphics::RGBtoHSV(float r, float g, float b, float *h, float *s, float *v)
256 mn = min(min(r, g), b);
257 mx = max(max(r, g), b);
274 *h = (g - b) / delta;
278 *h = 2 + (b - r) / delta;
282 *h = 4 + (r - g) / delta;
293 void Graphics::HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
308 t = v * (1 - s * (1 - f));
350 SDL_Surface *Graphics::loadImage(const char *filename, bool srcalpha)
352 SDL_Surface *image, *newImage;
355 if (!engine->unpack(filename, PAK_IMG))
356 showErrorAndExit(ERR_FILE, filename);
357 image = IMG_Load_RW(engine->sdlrw, 1);
359 image = IMG_Load(filename);
363 showErrorAndExit(ERR_FILE, filename);
365 newImage = SDL_ConvertSurface(image, screen->format, 0);
369 SDL_FreeSurface(image);
373 // This happens when we are loading the window icon image
378 SDL_SetAlpha(newImage, 255);
380 setTransparent(newImage);
385 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
387 SDL_Surface *image, *newImage;
390 if (!engine->unpack(filename, PAK_IMG))
391 showErrorAndExit(ERR_FILE, filename);
392 image = IMG_Load_RW(engine->sdlrw, 1);
394 image = IMG_Load(filename);
398 showErrorAndExit(ERR_FILE, filename);
400 if ((hue != 0) || (sat != 0) || (value != 0))
402 if (image->format->BitsPerPixel != 8)
404 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
409 float r, g, b, h, s, v;
411 if (image->format->palette->colors != NULL)
413 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
415 color = &image->format->palette->colors[i];
421 RGBtoHSV(r, g, b, &h, &s, &v);
427 HSVtoRGB(&r, &g, &b, h, s, v);
438 newImage = SDL_ConvertSurface(image, screen->format, 0);
442 SDL_FreeSurface(image);
446 // This happens when we are loading the window icon image
450 setTransparent(newImage);
455 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
457 Sprite *sprite = addSprite(name);
458 sprite->setFrame(0, image, 60);
460 return sprite->getCurrentFrame();
463 void Graphics::fade(int amount)
465 SDL_SetAlpha(fadeBlack, amount);
466 blit(fadeBlack, 0, 0, screen, false);
469 void Graphics::fadeToBlack()
475 SDL_SetAlpha(fadeBlack, start);
476 blit(fadeBlack, 0, 0, screen, false);
482 void Graphics::loadMapTiles(const char *baseDir)
484 bool found, autoAlpha;
490 if (strcmp(baseDir, "gfx/common") == 0)
499 for (int i = 1 ; i < MAX_TILES ; i++)
503 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
507 if (!engine->getPak()->fileExists(filename))
512 fp = fopen(filename, "rb");
521 tile[i] = loadImage(filename);
525 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
527 SDL_SetAlpha(tile[i], 130);
532 if (i < MAP_DECORATION)
534 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
542 Note : We need to search for the right >>> PIXEL SIZE <<< and NOT point size!!
543 If a user has a resolution other than approximately 72dpi then
544 they will get a small or larger font and this won't work. This might look
545 weird since we'll load and delete multiple fonts, but it works...
547 void Graphics::loadFont(int i, const char *filename, int pixelSize)
549 int minx, maxx, miny, maxy, advance;
551 debug(("Attempting to load a font with pixel size of %d...\n", pixelSize));
555 debug(("Freeing Font %d first...\n", i));
556 TTF_CloseFont(font[i]);
559 char tempPath[PATH_MAX];
561 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
570 TTF_CloseFont(font[i]);
574 font[i] = TTF_OpenFont(tempPath, ++size);
576 font[i] = TTF_OpenFont("data/vera.ttf", ++size);
581 engine->reportFontFailure();
584 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
586 // great! we have an exact match
587 if (maxx == pixelSize)
592 // we've overshot, so we'll use the previous size!
593 if (maxx > pixelSize)
595 TTF_CloseFont(font[i]);
598 font[i] = TTF_OpenFont(tempPath, size - 1);
600 font[i] = TTF_OpenFont("data/vera.ttf", size - 1);
603 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
610 debug(("Pixel size has exceeded 99 pixels! I'm giving up!\n"));
611 engine->reportFontFailure();
615 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
617 debug(("Got a match for font size %d - Nearest = %d\n", pixelSize, maxx));
620 Sprite *Graphics::addSprite(const char *name)
622 Sprite *sprite = new Sprite;
623 strlcpy(sprite->name, name, sizeof sprite->name);
625 spriteList.add(sprite);
630 Sprite *Graphics::getSprite(const char *name, bool required)
632 Sprite *sprite = (Sprite*)spriteList.getHead();
634 while (sprite->next != NULL)
636 sprite = (Sprite*)sprite->next;
638 if (strcmp(sprite->name, name) == 0)
645 showErrorAndExit("The requested sprite '%s' does not exist", name);
650 void Graphics::animateSprites()
652 Sprite *sprite = (Sprite*)spriteList.getHead();
654 while (sprite->next != NULL)
656 sprite = (Sprite*)sprite->next;
661 if ((engine->getFrameLoop() % 8) == 0)
663 Math::wrapInt(&(++waterAnim), 201, 204);
664 Math::wrapInt(&(++slimeAnim), 207, 212);
665 Math::wrapInt(&(++lavaAnim), 214, 220);
669 int Graphics::getWaterAnim() const
674 int Graphics::getSlimeAnim() const
679 int Graphics::getLavaAnim() const
684 int Graphics::getLavaAnim(int current)
686 if ((engine->getFrameLoop() % 8) == 0)
687 return Math::rrand(214, 220);
692 void Graphics::loadBackground(const char *filename)
694 if (background != NULL)
695 SDL_FreeSurface(background);
697 if (strcmp(filename, "@none@") == 0)
700 background = loadImage(filename);
702 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
705 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
707 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
710 int bpp = dest->format->BytesPerPixel;
711 /* Here p is the address to the pixel we want to set */
712 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
721 *(Uint16 *)p = pixel;
725 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
727 p[0] = (pixel >> 16) & 0xff;
728 p[1] = (pixel >> 8) & 0xff;
734 p[1] = (pixel >> 8) & 0xff;
735 p[2] = (pixel >> 16) & 0xff;
740 *(Uint32 *)p = pixel;
745 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
747 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
750 int bpp = surface->format->BytesPerPixel;
751 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
761 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
762 return p[0] << 16 | p[1] << 8 | p[2];
764 return p[0] | p[1] << 8 | p[2] << 16;
770 return 0; /* shouldn't happen, but avoids warnings */
774 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
780 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
784 putPixel((int)startX, (int)startY, color, dest);
786 if ((int)startX == (int)endX)
796 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
800 showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
803 if ((x < -image->w) || (x > 640 + image->w))
806 if ((y < -image->h) || (y > 480 + image->h))
809 // Set up a rectangle to draw to
814 gRect.x -= (image->w / 2);
815 gRect.y -= (image->h / 2);
821 /* Blit onto the screen surface */
822 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
823 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
826 void Graphics::drawBackground()
828 if (background != NULL)
829 blit(background, 0, 0, screen, false);
831 SDL_FillRect(screen, NULL, black);
834 void Graphics::drawBackground(SDL_Rect *r)
836 if (r->x < 0) r->x = 0;
837 if (r->y < 0) r->y = 0;
838 if (r->x + r->w > 639) r->w = 640 - r->x;
839 if (r->y + r->h > 639) r->h = 480 - r->y;
841 if (SDL_BlitSurface(background, r, screen, r) < 0)
842 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
845 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
852 SDL_FillRect(dest, &gRect, color);
855 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
857 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
858 drawRect(x, y, w, h, color, dest);
861 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
863 fontForeground.r = red;
864 fontForeground.g = green;
865 fontForeground.b = blue;
867 fontBackground.r = red2;
868 fontBackground.g = green2;
869 fontBackground.b = blue2;
872 void Graphics::setFontSize(int size)
875 Math::limitInt(&fontSize, 0, 4);
878 SDL_Surface *Graphics::getString(const char *in, bool transparent)
880 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
884 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
888 setTransparent(text);
893 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
897 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
900 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
905 setTransparent(text);
907 if (alignment == TXT_RIGHT) x -= text->w;
908 if (alignment == TXT_CENTERED) center = true;
910 blit(text, x, y, dest, center);
911 SDL_FreeSurface(text);
914 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
918 if(!cache.text || strcmp(in, cache.text)) {
920 SDL_FreeSurface(cache.surface);
925 cache.text = strdup(in);
927 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
930 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
935 setTransparent(cache.surface);
938 if (alignment == TXT_RIGHT) x -= cache.surface->w;
939 if (alignment == TXT_CENTERED) center = true;
941 blit(cache.surface, x, y, dest, center);
944 void Graphics::clearChatString()
949 void Graphics::createChatString(const char *in)
951 strlcat(chatString, " ", sizeof chatString);
952 strlcat(chatString, in, sizeof chatString);
955 void Graphics::drawChatString(SDL_Surface *surface, int y)
957 char *word = strtok(chatString, " ");
958 char wordWithSpace[100];
963 int surfaceWidth = surface->w - 10;
965 SDL_Surface *wordSurface;
969 if (strcmp(word, "<RGB>") == 0)
971 r = atoi(strtok(NULL, " "));
972 g = atoi(strtok(NULL, " "));
973 b = atoi(strtok(NULL, " "));
975 if ((!r) && (!g) && (!b))
977 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
981 setFontColor(r, g, b, 0, 0, 0);
983 word = strtok(NULL, " ");
988 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
990 wordSurface = getString(wordWithSpace, false);
992 if (x + wordSurface->w > surfaceWidth)
994 y += (int)(wordSurface->h * 1.5) ;
998 blit(wordSurface, x, y, surface, false);
1000 x += wordSurface->w;
1002 SDL_FreeSurface(wordSurface);
1004 word = strtok(NULL, " ");
1008 void Graphics::showMedalMessage(int type, const char *in)
1012 if (medalMessage != NULL)
1014 SDL_FreeSurface(medalMessage);
1023 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
1028 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
1033 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
1038 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1042 medalType = type - 1; // for indexing on the image
1045 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1046 medalMessage = getString(message, true);
1050 snprintf(message, sizeof message, " %s ", in);
1051 medalMessage = getString(message, true);
1053 medalMessageTimer = (5 * 60);
1056 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1058 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1059 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1060 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1063 SDL_Surface *Graphics::createSurface(int width, int height)
1065 SDL_Surface *surface, *newImage;
1067 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1069 if (surface == NULL)
1070 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1072 newImage = SDL_ConvertSurface(surface, screen->format, 0);
1074 SDL_FreeSurface(surface);
1079 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1081 SDL_Surface *surface = createSurface(width, height);
1083 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1085 SDL_SetAlpha(surface, 130);
1090 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1092 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1094 blit(alpha, 0, 0, image, false);
1096 SDL_SetColorKey(image, SDL_TRUE, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1099 void Graphics::lock(SDL_Surface *surface)
1101 /* Lock the screen for direct access to the pixels */
1102 if (SDL_MUSTLOCK(surface))
1104 if (SDL_LockSurface(surface) < 0 )
1106 showErrorAndExit("Could not lock surface", "");
1111 void Graphics::unlock(SDL_Surface *surface)
1113 if (SDL_MUSTLOCK(surface))
1115 SDL_UnlockSurface(surface);
1119 void Graphics::resetLoading()
1124 void Graphics::showLoading(int amount, int max)
1132 Math::limitInt(&(currentLoading += amount), 0, max);
1134 drawRect(120, 420, 400, 10, black, white, screen);
1135 drawRect(121, 421, currentLoading, 8, red, screen);
1137 SDL_UpdateRect(screen, 120, 420, 400, 10);
1141 void Graphics::showLicenseErrorAndExit()
1143 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1144 drawString("License Agreement Missing", 320, 50, true, screen);
1146 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1148 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1149 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1150 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1152 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1153 drawString("Press Escape to continue", 320, 450, true, screen);
1155 engine->flushInput();
1161 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1167 void Graphics::showErrorAndExit(const char *error, const char *param)
1169 SDL_FillRect(screen, NULL, black);
1171 if (strcmp(param, "LICENSE") == 0)
1173 showLicenseErrorAndExit();
1177 snprintf(message, sizeof message, error, param);
1179 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1180 drawString("An unforseen error has occurred", 320, 50, true, screen);
1181 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1182 drawString(message, 320, 90, true, screen);
1184 drawString("You may wish to try the following,", 50, 150, false, screen);
1187 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1188 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1189 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1190 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1191 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1192 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1196 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1197 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1199 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1200 drawString("Press Escape to continue", 320, 450, true, screen);
1202 engine->flushInput();
1208 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1216 void Graphics::showRootWarning()
1218 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1219 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1221 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1223 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1224 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1225 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1227 drawString("Press Space to Exit", 320, 420, true, screen);
1228 drawString("Press Escape to Continue", 320, 450, true, screen);
1230 engine->flushInput();
1237 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1241 else if (engine->keyState[SDL_SCANCODE_SPACE])