2 Copyright (C) 2004-2011 Parallel Realities
3 Copyright (C) 2011-2015 Perpendicular Dimensions
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 void SDL_SetAlpha(SDL_Surface *surface, uint8_t value) {
25 SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
26 SDL_SetSurfaceAlphaMod(surface, value);
31 for (int i = 0 ; i < MAX_TILES ; i++)
41 medalMessageTimer = 0;
47 takeRandomScreenShots = false;
56 debug(("graphics.free: Background\n"));
57 if (background != NULL)
59 SDL_FreeSurface(background);
61 debug(("graphics.free: Background - Done\n"));
65 debug(("graphics.free: Tiles\n"));
66 for (int i = 0 ; i < MAX_TILES ; i++)
70 SDL_FreeSurface(tile[i]);
74 debug(("graphics.free: Tiles - Done\n"));
76 debug(("graphics.free: Sprites\n"));
77 Sprite *sprite = (Sprite*)spriteList.getHead();
78 while (sprite->next != NULL)
80 sprite = (Sprite*)sprite->next;
81 //debug(("graphics.free: Sprites Sprite::Free - %s\n", sprite->name));
84 debug(("graphics.free: Sprites Clear()\n"));
86 debug(("graphics.free: Sprites - Done\n"));
89 void Graphics::destroy()
93 for (int i = 0 ; i < 5 ; i++)
97 TTF_CloseFont(font[i]);
101 if (medalMessage != NULL)
103 SDL_FreeSurface(medalMessage);
108 SDL_FreeSurface(fadeBlack);
113 SDL_FreeSurface(infoBar);
116 for (int i = 0 ; i < 4 ; i++)
118 if (medal[i] != NULL)
120 SDL_FreeSurface(medal[i]);
126 void Graphics::registerEngine(Engine *engine)
128 this->engine = engine;
131 void Graphics::mapColors()
133 red = SDL_MapRGB(screen->format, 0xff, 0x00, 0x00);
134 yellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x00);
135 green = SDL_MapRGB(screen->format, 0x00, 0xff, 0x00);
136 darkGreen = SDL_MapRGB(screen->format, 0x00, 0x77, 0x00);
137 skyBlue = SDL_MapRGB(screen->format, 0x66, 0x66, 0xff);
138 blue = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
139 cyan = SDL_MapRGB(screen->format, 0x00, 0x99, 0xff);
140 white = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
141 lightGrey = SDL_MapRGB(screen->format, 0xcc, 0xcc, 0xcc);
142 grey = SDL_MapRGB(screen->format, 0x88, 0x88, 0x88);
143 darkGrey = SDL_MapRGB(screen->format, 0x33, 0x33, 0x33);
144 black = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
146 fontForeground.r = fontForeground.g = fontForeground.b = 0xff;
147 fontBackground.r = fontBackground.g = fontBackground.b = 0x00;
149 fadeBlack = alphaRect(640, 480, 0x00, 0x00, 0x00);
151 infoBar = alphaRect(640, 25, 0x00, 0x00, 0x00);
156 Sprite *Graphics::getSpriteHead()
158 return (Sprite*)spriteList.getHead();
161 void Graphics::setTransparent(SDL_Surface *sprite)
163 SDL_SetColorKey(sprite, SDL_TRUE, SDL_MapRGB(sprite->format, 0, 0, 0));
166 bool Graphics::canShowMedalMessage() const
168 return (medalMessageTimer <= 0);
171 void Graphics::updateScreen()
173 if (medalMessageTimer > 0)
184 drawRect(screen->w - (medalMessage->w + 5 + padding), 5, medalMessage->w + padding - 2, 20, grey, screen);
185 drawRect(screen->w - (medalMessage->w + 5 + padding - 1), 6, medalMessage->w + padding - 4, 18, black, screen);
186 blit(medalMessage, screen->w - (medalMessage->w + 5), 7, screen, false);
190 blit(medal[medalType], screen->w - (medalMessage->w + 5 + 16), 7, screen, false);
194 SDL_UpdateTexture(texture, NULL, screen->pixels, screen->w * 4);
195 SDL_RenderCopy(renderer, texture, NULL, NULL);
196 SDL_RenderPresent(renderer);
198 if (takeRandomScreenShots)
200 if ((Math::prand() % 500) == 0)
202 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
203 SDL_SaveBMP(screen, screenshot);
210 if (engine->keyState[SDL_SCANCODE_F12])
212 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
213 SDL_SaveBMP(screen, screenshot);
216 engine->keyState[SDL_SCANCODE_F12] = 0;
219 if ((engine->keyState[SDL_SCANCODE_F10]) || ((engine->keyState[SDL_SCANCODE_RETURN]) && (engine->keyState[SDL_SCANCODE_LALT])))
221 engine->fullScreen = !engine->fullScreen;
222 SDL_SetWindowFullscreen(window, engine->fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
224 engine->keyState[SDL_SCANCODE_F10] = engine->keyState[SDL_SCANCODE_LALT] = engine->keyState[SDL_SCANCODE_RETURN] = 0;
228 void Graphics::delay(int time)
230 unsigned long then = SDL_GetTicks();
232 engine->keyState[SDL_SCANCODE_ESCAPE] = 0;
238 if (SDL_GetTicks() >= then + time)
246 if (engine->keyState[SDL_SCANCODE_ESCAPE])
254 void Graphics::RGBtoHSV(float r, float g, float b, float *h, float *s, float *v)
257 mn = min(min(r, g), b);
258 mx = max(max(r, g), b);
275 *h = (g - b) / delta;
279 *h = 2 + (b - r) / delta;
283 *h = 4 + (r - g) / delta;
294 void Graphics::HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
309 t = v * (1 - s * (1 - f));
351 SDL_Surface *Graphics::loadImage(const char *filename, bool srcalpha)
353 SDL_Surface *image, *newImage;
356 if (!engine->unpack(filename, PAK_IMG))
357 showErrorAndExit(ERR_FILE, filename);
358 image = IMG_Load_RW(engine->sdlrw, 1);
360 image = IMG_Load(filename);
364 showErrorAndExit(ERR_FILE, filename);
366 newImage = SDL_ConvertSurface(image, screen->format, 0);
370 SDL_FreeSurface(image);
374 // This happens when we are loading the window icon image
379 SDL_SetAlpha(newImage, 255);
381 setTransparent(newImage);
386 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
388 SDL_Surface *image, *newImage;
391 if (!engine->unpack(filename, PAK_IMG))
392 showErrorAndExit(ERR_FILE, filename);
393 image = IMG_Load_RW(engine->sdlrw, 1);
395 image = IMG_Load(filename);
399 showErrorAndExit(ERR_FILE, filename);
401 if ((hue != 0) || (sat != 0) || (value != 0))
403 if (image->format->BitsPerPixel != 8)
405 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
410 float r, g, b, h, s, v;
412 if (image->format->palette->colors != NULL)
414 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
416 color = &image->format->palette->colors[i];
422 RGBtoHSV(r, g, b, &h, &s, &v);
428 HSVtoRGB(&r, &g, &b, h, s, v);
439 newImage = SDL_ConvertSurface(image, screen->format, 0);
443 SDL_FreeSurface(image);
447 // This happens when we are loading the window icon image
451 setTransparent(newImage);
456 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
458 Sprite *sprite = addSprite(name);
459 sprite->setFrame(0, image, 60);
461 return sprite->getCurrentFrame();
464 void Graphics::fade(int amount)
466 SDL_SetAlpha(fadeBlack, amount);
467 blit(fadeBlack, 0, 0, screen, false);
470 void Graphics::fadeToBlack()
476 SDL_SetAlpha(fadeBlack, start);
477 blit(fadeBlack, 0, 0, screen, false);
483 void Graphics::loadMapTiles(const char *baseDir)
485 bool found, autoAlpha;
491 if (strcmp(baseDir, "gfx/common") == 0)
500 for (int i = 1 ; i < MAX_TILES ; i++)
504 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
508 if (!engine->getPak()->fileExists(filename))
513 fp = fopen(filename, "rb");
522 tile[i] = loadImage(filename);
526 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
528 SDL_SetAlpha(tile[i], 130);
533 if (i < MAP_DECORATION)
535 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
543 Note : We need to search for the right >>> PIXEL SIZE <<< and NOT point size!!
544 If a user has a resolution other than approximately 72dpi then
545 they will get a small or larger font and this won't work. This might look
546 weird since we'll load and delete multiple fonts, but it works...
548 void Graphics::loadFont(int i, const char *filename, int pixelSize)
550 int minx, maxx, miny, maxy, advance;
552 debug(("Attempting to load a font with pixel size of %d...\n", pixelSize));
556 debug(("Freeing Font %d first...\n", i));
557 TTF_CloseFont(font[i]);
560 char tempPath[PATH_MAX];
562 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
571 TTF_CloseFont(font[i]);
575 font[i] = TTF_OpenFont(tempPath, ++size);
577 font[i] = TTF_OpenFont("data/vera.ttf", ++size);
582 engine->reportFontFailure();
585 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
587 // great! we have an exact match
588 if (maxx == pixelSize)
593 // we've overshot, so we'll use the previous size!
594 if (maxx > pixelSize)
596 TTF_CloseFont(font[i]);
599 font[i] = TTF_OpenFont(tempPath, size - 1);
601 font[i] = TTF_OpenFont("data/vera.ttf", size - 1);
604 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
611 debug(("Pixel size has exceeded 99 pixels! I'm giving up!\n"));
612 engine->reportFontFailure();
616 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
618 debug(("Got a match for font size %d - Nearest = %d\n", pixelSize, maxx));
621 Sprite *Graphics::addSprite(const char *name)
623 Sprite *sprite = new Sprite;
624 strlcpy(sprite->name, name, sizeof sprite->name);
626 spriteList.add(sprite);
631 Sprite *Graphics::getSprite(const char *name, bool required)
633 Sprite *sprite = (Sprite*)spriteList.getHead();
635 while (sprite->next != NULL)
637 sprite = (Sprite*)sprite->next;
639 if (strcmp(sprite->name, name) == 0)
646 showErrorAndExit("The requested sprite '%s' does not exist", name);
651 void Graphics::animateSprites()
653 Sprite *sprite = (Sprite*)spriteList.getHead();
655 while (sprite->next != NULL)
657 sprite = (Sprite*)sprite->next;
662 if ((engine->getFrameLoop() % 8) == 0)
664 Math::wrapInt(&(++waterAnim), 201, 204);
665 Math::wrapInt(&(++slimeAnim), 207, 212);
666 Math::wrapInt(&(++lavaAnim), 214, 220);
670 int Graphics::getWaterAnim() const
675 int Graphics::getSlimeAnim() const
680 int Graphics::getLavaAnim() const
685 int Graphics::getLavaAnim(int current)
687 if ((engine->getFrameLoop() % 8) == 0)
688 return Math::rrand(214, 220);
693 void Graphics::loadBackground(const char *filename)
695 if (background != NULL)
696 SDL_FreeSurface(background);
698 if (strcmp(filename, "@none@") == 0)
701 background = loadImage(filename);
703 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
706 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
708 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
711 int bpp = dest->format->BytesPerPixel;
712 /* Here p is the address to the pixel we want to set */
713 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
722 *(Uint16 *)p = pixel;
726 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
728 p[0] = (pixel >> 16) & 0xff;
729 p[1] = (pixel >> 8) & 0xff;
735 p[1] = (pixel >> 8) & 0xff;
736 p[2] = (pixel >> 16) & 0xff;
741 *(Uint32 *)p = pixel;
746 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
748 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
751 int bpp = surface->format->BytesPerPixel;
752 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
762 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
763 return p[0] << 16 | p[1] << 8 | p[2];
765 return p[0] | p[1] << 8 | p[2] << 16;
771 return 0; /* shouldn't happen, but avoids warnings */
775 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
781 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
785 putPixel((int)startX, (int)startY, color, dest);
787 if ((int)startX == (int)endX)
797 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
801 showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
804 if ((x < -image->w) || (x > 640 + image->w))
807 if ((y < -image->h) || (y > 480 + image->h))
810 // Set up a rectangle to draw to
815 gRect.x -= (image->w / 2);
816 gRect.y -= (image->h / 2);
822 /* Blit onto the screen surface */
823 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
824 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
827 void Graphics::drawBackground()
829 if (background != NULL)
830 blit(background, 0, 0, screen, false);
832 SDL_FillRect(screen, NULL, black);
835 void Graphics::drawBackground(SDL_Rect *r)
837 if (r->x < 0) r->x = 0;
838 if (r->y < 0) r->y = 0;
839 if (r->x + r->w > 639) r->w = 640 - r->x;
840 if (r->y + r->h > 639) r->h = 480 - r->y;
842 if (SDL_BlitSurface(background, r, screen, r) < 0)
843 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
846 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
853 SDL_FillRect(dest, &gRect, color);
856 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
858 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
859 drawRect(x, y, w, h, color, dest);
862 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
864 fontForeground.r = red;
865 fontForeground.g = green;
866 fontForeground.b = blue;
868 fontBackground.r = red2;
869 fontBackground.g = green2;
870 fontBackground.b = blue2;
873 void Graphics::setFontSize(int size)
876 Math::limitInt(&fontSize, 0, 4);
879 SDL_Surface *Graphics::getString(const char *in, bool transparent)
881 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
885 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
889 setTransparent(text);
894 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
898 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
901 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
906 setTransparent(text);
908 if (alignment == TXT_RIGHT) x -= text->w;
909 if (alignment == TXT_CENTERED) center = true;
911 blit(text, x, y, dest, center);
912 SDL_FreeSurface(text);
915 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
919 if(!cache.text || strcmp(in, cache.text)) {
921 SDL_FreeSurface(cache.surface);
926 cache.text = strdup(in);
928 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
931 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
936 setTransparent(cache.surface);
939 if (alignment == TXT_RIGHT) x -= cache.surface->w;
940 if (alignment == TXT_CENTERED) center = true;
942 blit(cache.surface, x, y, dest, center);
945 void Graphics::clearChatString()
950 void Graphics::createChatString(const char *in)
952 strlcat(chatString, " ", sizeof chatString);
953 strlcat(chatString, in, sizeof chatString);
956 void Graphics::drawChatString(SDL_Surface *surface, int y)
958 char *word = strtok(chatString, " ");
959 char wordWithSpace[100];
964 int surfaceWidth = surface->w - 10;
966 SDL_Surface *wordSurface;
970 if (strcmp(word, "<RGB>") == 0)
972 r = atoi(strtok(NULL, " "));
973 g = atoi(strtok(NULL, " "));
974 b = atoi(strtok(NULL, " "));
976 if ((!r) && (!g) && (!b))
978 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
982 setFontColor(r, g, b, 0, 0, 0);
984 word = strtok(NULL, " ");
989 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
991 wordSurface = getString(wordWithSpace, false);
993 if (x + wordSurface->w > surfaceWidth)
995 y += (int)(wordSurface->h * 1.5) ;
999 blit(wordSurface, x, y, surface, false);
1001 x += wordSurface->w;
1003 SDL_FreeSurface(wordSurface);
1005 word = strtok(NULL, " ");
1009 void Graphics::showMedalMessage(int type, const char *in)
1013 if (medalMessage != NULL)
1015 SDL_FreeSurface(medalMessage);
1024 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
1029 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
1034 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
1039 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1043 medalType = type - 1; // for indexing on the image
1046 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1047 medalMessage = getString(message, true);
1051 snprintf(message, sizeof message, " %s ", in);
1052 medalMessage = getString(message, true);
1054 medalMessageTimer = (5 * 60);
1057 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1059 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1060 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1061 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1064 SDL_Surface *Graphics::createSurface(int width, int height)
1066 SDL_Surface *surface, *newImage;
1068 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1070 if (surface == NULL)
1071 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1073 newImage = SDL_ConvertSurface(surface, screen->format, 0);
1075 SDL_FreeSurface(surface);
1080 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1082 SDL_Surface *surface = createSurface(width, height);
1084 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1086 SDL_SetAlpha(surface, 130);
1091 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1093 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1095 blit(alpha, 0, 0, image, false);
1097 SDL_SetColorKey(image, SDL_TRUE, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1100 void Graphics::lock(SDL_Surface *surface)
1102 /* Lock the screen for direct access to the pixels */
1103 if (SDL_MUSTLOCK(surface))
1105 if (SDL_LockSurface(surface) < 0 )
1107 showErrorAndExit("Could not lock surface", "");
1112 void Graphics::unlock(SDL_Surface *surface)
1114 if (SDL_MUSTLOCK(surface))
1116 SDL_UnlockSurface(surface);
1120 void Graphics::resetLoading()
1125 void Graphics::showLoading(int amount, int max)
1133 Math::limitInt(&(currentLoading += amount), 0, max);
1135 drawRect(120, 420, 400, 10, black, white, screen);
1136 drawRect(121, 421, currentLoading, 8, red, screen);
1140 void Graphics::showLicenseErrorAndExit()
1142 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1143 drawString("License Agreement Missing", 320, 50, true, screen);
1145 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1147 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1148 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1149 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1151 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1152 drawString("Press Escape to continue", 320, 450, true, screen);
1154 engine->flushInput();
1160 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1166 void Graphics::showErrorAndExit(const char *error, const char *param)
1168 SDL_FillRect(screen, NULL, black);
1170 if (strcmp(param, "LICENSE") == 0)
1172 showLicenseErrorAndExit();
1176 snprintf(message, sizeof message, error, param);
1178 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1179 drawString("An unforseen error has occurred", 320, 50, true, screen);
1180 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1181 drawString(message, 320, 90, true, screen);
1183 drawString("You may wish to try the following,", 50, 150, false, screen);
1186 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1187 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1188 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1189 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1190 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1191 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1195 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1196 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1198 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1199 drawString("Press Escape to continue", 320, 450, true, screen);
1201 engine->flushInput();
1207 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1215 void Graphics::showRootWarning()
1217 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1218 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1220 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1222 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1223 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1224 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1226 drawString("Press Space to Exit", 320, 420, true, screen);
1227 drawString("Press Escape to Continue", 320, 450, true, screen);
1229 engine->flushInput();
1236 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1240 else if (engine->keyState[SDL_SCANCODE_SPACE])