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.
25 for (int i = 0 ; i < MAX_TILES ; i++)
35 medalMessageTimer = 0;
41 takeRandomScreenShots = false;
50 debug(("graphics.free: Background\n"));
51 if (background != NULL)
53 SDL_FreeSurface(background);
55 debug(("graphics.free: Background - Done\n"));
59 debug(("graphics.free: Tiles\n"));
60 for (int i = 0 ; i < MAX_TILES ; i++)
64 SDL_FreeSurface(tile[i]);
68 debug(("graphics.free: Tiles - Done\n"));
70 debug(("graphics.free: Sprites\n"));
71 Sprite *sprite = (Sprite*)spriteList.getHead();
72 while (sprite->next != NULL)
74 sprite = (Sprite*)sprite->next;
75 //debug(("graphics.free: Sprites Sprite::Free - %s\n", sprite->name));
78 debug(("graphics.free: Sprites Clear()\n"));
80 debug(("graphics.free: Sprites - Done\n"));
83 void Graphics::destroy()
87 for (int i = 0 ; i < 5 ; i++)
91 TTF_CloseFont(font[i]);
95 if (medalMessage != NULL)
97 SDL_FreeSurface(medalMessage);
102 SDL_FreeSurface(fadeBlack);
107 SDL_FreeSurface(infoBar);
110 for (int i = 0 ; i < 4 ; i++)
112 if (medal[i] != NULL)
114 SDL_FreeSurface(medal[i]);
120 void Graphics::registerEngine(Engine *engine)
122 this->engine = engine;
125 void Graphics::mapColors()
127 red = SDL_MapRGB(screen->format, 0xff, 0x00, 0x00);
128 yellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x00);
129 green = SDL_MapRGB(screen->format, 0x00, 0xff, 0x00);
130 darkGreen = SDL_MapRGB(screen->format, 0x00, 0x77, 0x00);
131 skyBlue = SDL_MapRGB(screen->format, 0x66, 0x66, 0xff);
132 blue = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
133 cyan = SDL_MapRGB(screen->format, 0x00, 0x99, 0xff);
134 white = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
135 lightGrey = SDL_MapRGB(screen->format, 0xcc, 0xcc, 0xcc);
136 grey = SDL_MapRGB(screen->format, 0x88, 0x88, 0x88);
137 darkGrey = SDL_MapRGB(screen->format, 0x33, 0x33, 0x33);
138 black = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
140 fontForeground.r = fontForeground.g = fontForeground.b = 0xff;
141 fontBackground.r = fontBackground.g = fontBackground.b = 0x00;
143 fadeBlack = alphaRect(640, 480, 0x00, 0x00, 0x00);
145 infoBar = alphaRect(640, 25, 0x00, 0x00, 0x00);
150 Sprite *Graphics::getSpriteHead()
152 return (Sprite*)spriteList.getHead();
155 void Graphics::setTransparent(SDL_Surface *sprite)
157 SDL_SetColorKey(sprite, SDL_RLEACCEL, SDL_MapRGB(sprite->format, 0, 0, 0));
160 bool Graphics::canShowMedalMessage() const
162 return (medalMessageTimer <= 0);
165 void Graphics::updateScreen()
167 if (medalMessageTimer > 0)
178 drawRect(screen->w - (medalMessage->w + 5 + padding), 5, medalMessage->w + padding - 2, 20, grey, screen);
179 drawRect(screen->w - (medalMessage->w + 5 + padding - 1), 6, medalMessage->w + padding - 4, 18, black, screen);
180 blit(medalMessage, screen->w - (medalMessage->w + 5), 7, screen, false);
184 blit(medal[medalType], screen->w - (medalMessage->w + 5 + 16), 7, screen, false);
188 SDL_UpdateTexture(texture, NULL, screen->pixels, screen->w * 4);
189 SDL_RenderCopy(renderer, texture, NULL, NULL);
190 SDL_RenderPresent(renderer);
192 if (takeRandomScreenShots)
194 if ((Math::prand() % 500) == 0)
196 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
197 SDL_SaveBMP(screen, screenshot);
204 if (engine->keyState[SDL_SCANCODE_F12])
206 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
207 SDL_SaveBMP(screen, screenshot);
210 engine->keyState[SDL_SCANCODE_F12] = 0;
213 if ((engine->keyState[SDL_SCANCODE_F10]) || ((engine->keyState[SDL_SCANCODE_RETURN]) && (engine->keyState[SDL_SCANCODE_LALT])))
215 engine->fullScreen = !engine->fullScreen;
216 SDL_SetWindowFullscreen(window, engine->fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
218 engine->keyState[SDL_SCANCODE_F10] = engine->keyState[SDL_SCANCODE_LALT] = engine->keyState[SDL_SCANCODE_RETURN] = 0;
222 void Graphics::delay(int time)
224 unsigned long then = SDL_GetTicks();
226 engine->keyState[SDL_SCANCODE_ESCAPE] = 0;
232 if (SDL_GetTicks() >= then + time)
240 if (engine->keyState[SDL_SCANCODE_ESCAPE])
248 void Graphics::RGBtoHSV(float r, float g, float b, float *h, float *s, float *v)
251 mn = min(min(r, g), b);
252 mx = max(max(r, g), b);
269 *h = (g - b) / delta;
273 *h = 2 + (b - r) / delta;
277 *h = 4 + (r - g) / delta;
288 void Graphics::HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
303 t = v * (1 - s * (1 - f));
345 SDL_Surface *Graphics::loadImage(const char *filename, bool srcalpha)
347 SDL_Surface *image, *newImage;
350 if (!engine->unpack(filename, PAK_IMG))
351 showErrorAndExit(ERR_FILE, filename);
352 image = IMG_Load_RW(engine->sdlrw, 1);
354 image = IMG_Load(filename);
358 showErrorAndExit(ERR_FILE, filename);
360 newImage = SDL_ConvertSurface(image, screen->format, 0);
364 SDL_FreeSurface(image);
368 // This happens when we are loading the window icon image
373 SDL_SetSurfaceAlphaMod(newImage, 255);
375 setTransparent(newImage);
380 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
382 SDL_Surface *image, *newImage;
385 if (!engine->unpack(filename, PAK_IMG))
386 showErrorAndExit(ERR_FILE, filename);
387 image = IMG_Load_RW(engine->sdlrw, 1);
389 image = IMG_Load(filename);
393 showErrorAndExit(ERR_FILE, filename);
395 if ((hue != 0) || (sat != 0) || (value != 0))
397 if (image->format->BitsPerPixel != 8)
399 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
404 float r, g, b, h, s, v;
406 if (image->format->palette->colors != NULL)
408 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
410 color = &image->format->palette->colors[i];
416 RGBtoHSV(r, g, b, &h, &s, &v);
422 HSVtoRGB(&r, &g, &b, h, s, v);
433 newImage = SDL_ConvertSurface(image, screen->format, 0);
437 SDL_FreeSurface(image);
441 // This happens when we are loading the window icon image
445 setTransparent(newImage);
450 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
452 Sprite *sprite = addSprite(name);
453 sprite->setFrame(0, image, 60);
455 return sprite->getCurrentFrame();
458 void Graphics::fade(int amount)
460 SDL_SetSurfaceAlphaMod(fadeBlack, amount);
461 blit(fadeBlack, 0, 0, screen, false);
464 void Graphics::fadeToBlack()
470 SDL_SetSurfaceAlphaMod(fadeBlack, start);
471 blit(fadeBlack, 0, 0, screen, false);
477 void Graphics::loadMapTiles(const char *baseDir)
479 bool found, autoAlpha;
485 if (strcmp(baseDir, "gfx/common") == 0)
494 for (int i = 1 ; i < MAX_TILES ; i++)
498 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
502 if (!engine->getPak()->fileExists(filename))
507 fp = fopen(filename, "rb");
516 tile[i] = loadImage(filename);
520 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
522 SDL_SetSurfaceAlphaMod(tile[i], 130);
527 if (i < MAP_DECORATION)
529 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
537 Note : We need to search for the right >>> PIXEL SIZE <<< and NOT point size!!
538 If a user has a resolution other than approximately 72dpi then
539 they will get a small or larger font and this won't work. This might look
540 weird since we'll load and delete multiple fonts, but it works...
542 void Graphics::loadFont(int i, const char *filename, int pixelSize)
544 int minx, maxx, miny, maxy, advance;
546 debug(("Attempting to load a font with pixel size of %d...\n", pixelSize));
550 debug(("Freeing Font %d first...\n", i));
551 TTF_CloseFont(font[i]);
554 char tempPath[PATH_MAX];
556 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
565 TTF_CloseFont(font[i]);
569 font[i] = TTF_OpenFont(tempPath, ++size);
571 font[i] = TTF_OpenFont("data/vera.ttf", ++size);
576 engine->reportFontFailure();
579 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
581 // great! we have an exact match
582 if (maxx == pixelSize)
587 // we've overshot, so we'll use the previous size!
588 if (maxx > pixelSize)
590 TTF_CloseFont(font[i]);
593 font[i] = TTF_OpenFont(tempPath, size - 1);
595 font[i] = TTF_OpenFont("data/vera.ttf", size - 1);
598 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
605 debug(("Pixel size has exceeded 99 pixels! I'm giving up!\n"));
606 engine->reportFontFailure();
610 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
612 debug(("Got a match for font size %d - Nearest = %d\n", pixelSize, maxx));
615 Sprite *Graphics::addSprite(const char *name)
617 Sprite *sprite = new Sprite;
618 strlcpy(sprite->name, name, sizeof sprite->name);
620 spriteList.add(sprite);
625 Sprite *Graphics::getSprite(const char *name, bool required)
627 Sprite *sprite = (Sprite*)spriteList.getHead();
629 while (sprite->next != NULL)
631 sprite = (Sprite*)sprite->next;
633 if (strcmp(sprite->name, name) == 0)
640 showErrorAndExit("The requested sprite '%s' does not exist", name);
645 void Graphics::animateSprites()
647 Sprite *sprite = (Sprite*)spriteList.getHead();
649 while (sprite->next != NULL)
651 sprite = (Sprite*)sprite->next;
656 if ((engine->getFrameLoop() % 8) == 0)
658 Math::wrapInt(&(++waterAnim), 201, 204);
659 Math::wrapInt(&(++slimeAnim), 207, 212);
660 Math::wrapInt(&(++lavaAnim), 214, 220);
664 int Graphics::getWaterAnim() const
669 int Graphics::getSlimeAnim() const
674 int Graphics::getLavaAnim() const
679 int Graphics::getLavaAnim(int current)
681 if ((engine->getFrameLoop() % 8) == 0)
682 return Math::rrand(214, 220);
687 void Graphics::loadBackground(const char *filename)
689 if (background != NULL)
690 SDL_FreeSurface(background);
692 if (strcmp(filename, "@none@") == 0)
695 background = loadImage(filename);
697 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
700 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
702 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
705 int bpp = dest->format->BytesPerPixel;
706 /* Here p is the address to the pixel we want to set */
707 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
716 *(Uint16 *)p = pixel;
720 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
722 p[0] = (pixel >> 16) & 0xff;
723 p[1] = (pixel >> 8) & 0xff;
729 p[1] = (pixel >> 8) & 0xff;
730 p[2] = (pixel >> 16) & 0xff;
735 *(Uint32 *)p = pixel;
740 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
742 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
745 int bpp = surface->format->BytesPerPixel;
746 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
756 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
757 return p[0] << 16 | p[1] << 8 | p[2];
759 return p[0] | p[1] << 8 | p[2] << 16;
765 return 0; /* shouldn't happen, but avoids warnings */
769 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
775 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
779 putPixel((int)startX, (int)startY, color, dest);
781 if ((int)startX == (int)endX)
791 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
795 showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
798 if ((x < -image->w) || (x > 640 + image->w))
801 if ((y < -image->h) || (y > 480 + image->h))
804 // Set up a rectangle to draw to
809 gRect.x -= (image->w / 2);
810 gRect.y -= (image->h / 2);
816 /* Blit onto the screen surface */
817 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
818 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
821 void Graphics::drawBackground()
823 if (background != NULL)
824 blit(background, 0, 0, screen, false);
826 SDL_FillRect(screen, NULL, black);
829 void Graphics::drawBackground(SDL_Rect *r)
831 if (r->x < 0) r->x = 0;
832 if (r->y < 0) r->y = 0;
833 if (r->x + r->w > 639) r->w = 640 - r->x;
834 if (r->y + r->h > 639) r->h = 480 - r->y;
836 if (SDL_BlitSurface(background, r, screen, r) < 0)
837 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
840 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
847 SDL_FillRect(dest, &gRect, color);
850 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
852 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
853 drawRect(x, y, w, h, color, dest);
856 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
858 fontForeground.r = red;
859 fontForeground.g = green;
860 fontForeground.b = blue;
862 fontBackground.r = red2;
863 fontBackground.g = green2;
864 fontBackground.b = blue2;
867 void Graphics::setFontSize(int size)
870 Math::limitInt(&fontSize, 0, 4);
873 SDL_Surface *Graphics::getString(const char *in, bool transparent)
875 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
879 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
883 setTransparent(text);
888 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
892 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
895 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
900 setTransparent(text);
902 if (alignment == TXT_RIGHT) x -= text->w;
903 if (alignment == TXT_CENTERED) center = true;
905 blit(text, x, y, dest, center);
906 SDL_FreeSurface(text);
909 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
913 if(!cache.text || strcmp(in, cache.text)) {
915 SDL_FreeSurface(cache.surface);
920 cache.text = strdup(in);
922 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
925 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
930 setTransparent(cache.surface);
933 if (alignment == TXT_RIGHT) x -= cache.surface->w;
934 if (alignment == TXT_CENTERED) center = true;
936 blit(cache.surface, x, y, dest, center);
939 void Graphics::clearChatString()
944 void Graphics::createChatString(const char *in)
946 strlcat(chatString, " ", sizeof chatString);
947 strlcat(chatString, in, sizeof chatString);
950 void Graphics::drawChatString(SDL_Surface *surface, int y)
952 char *word = strtok(chatString, " ");
953 char wordWithSpace[100];
958 int surfaceWidth = surface->w - 10;
960 SDL_Surface *wordSurface;
964 if (strcmp(word, "<RGB>") == 0)
966 r = atoi(strtok(NULL, " "));
967 g = atoi(strtok(NULL, " "));
968 b = atoi(strtok(NULL, " "));
970 if ((!r) && (!g) && (!b))
972 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
976 setFontColor(r, g, b, 0, 0, 0);
978 word = strtok(NULL, " ");
983 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
985 wordSurface = getString(wordWithSpace, false);
987 if (x + wordSurface->w > surfaceWidth)
989 y += (int)(wordSurface->h * 1.5) ;
993 blit(wordSurface, x, y, surface, false);
997 SDL_FreeSurface(wordSurface);
999 word = strtok(NULL, " ");
1003 void Graphics::showMedalMessage(int type, const char *in)
1007 if (medalMessage != NULL)
1009 SDL_FreeSurface(medalMessage);
1018 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
1023 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
1028 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
1033 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1037 medalType = type - 1; // for indexing on the image
1040 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1041 medalMessage = getString(message, true);
1045 snprintf(message, sizeof message, " %s ", in);
1046 medalMessage = getString(message, true);
1048 medalMessageTimer = (5 * 60);
1051 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1053 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1054 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1055 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1058 SDL_Surface *Graphics::createSurface(int width, int height)
1060 SDL_Surface *surface, *newImage;
1062 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1064 if (surface == NULL)
1065 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1067 newImage = SDL_ConvertSurface(surface, screen->format, 0);
1069 SDL_FreeSurface(surface);
1074 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1076 SDL_Surface *surface = createSurface(width, height);
1078 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1080 SDL_SetSurfaceAlphaMod(surface, 130);
1085 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1087 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1089 blit(alpha, 0, 0, image, false);
1091 SDL_SetColorKey(image, SDL_RLEACCEL, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1094 void Graphics::lock(SDL_Surface *surface)
1096 /* Lock the screen for direct access to the pixels */
1097 if (SDL_MUSTLOCK(surface))
1099 if (SDL_LockSurface(surface) < 0 )
1101 showErrorAndExit("Could not lock surface", "");
1106 void Graphics::unlock(SDL_Surface *surface)
1108 if (SDL_MUSTLOCK(surface))
1110 SDL_UnlockSurface(surface);
1114 void Graphics::resetLoading()
1119 void Graphics::showLoading(int amount, int max)
1127 Math::limitInt(&(currentLoading += amount), 0, max);
1129 drawRect(120, 420, 400, 10, black, white, screen);
1130 drawRect(121, 421, currentLoading, 8, red, screen);
1132 SDL_UpdateRect(screen, 120, 420, 400, 10);
1136 void Graphics::showLicenseErrorAndExit()
1138 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1139 drawString("License Agreement Missing", 320, 50, true, screen);
1141 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1143 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1144 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1145 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1147 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1148 drawString("Press Escape to continue", 320, 450, true, screen);
1150 engine->flushInput();
1156 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1162 void Graphics::showErrorAndExit(const char *error, const char *param)
1164 SDL_FillRect(screen, NULL, black);
1166 if (strcmp(param, "LICENSE") == 0)
1168 showLicenseErrorAndExit();
1172 snprintf(message, sizeof message, error, param);
1174 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1175 drawString("An unforseen error has occurred", 320, 50, true, screen);
1176 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1177 drawString(message, 320, 90, true, screen);
1179 drawString("You may wish to try the following,", 50, 150, false, screen);
1182 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1183 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1184 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1185 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1186 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1187 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1191 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1192 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1194 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1195 drawString("Press Escape to continue", 320, 450, true, screen);
1197 engine->flushInput();
1203 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1211 void Graphics::showRootWarning()
1213 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1214 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1216 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1218 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1219 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1220 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1222 drawString("Press Space to Exit", 320, 420, true, screen);
1223 drawString("Press Escape to Continue", 320, 450, true, screen);
1225 engine->flushInput();
1232 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1236 else if (engine->keyState[SDL_SCANCODE_SPACE])