2 Copyright (C) 2004 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 fontForeground.unused = fontBackground.unused = 0;
145 fadeBlack = alphaRect(640, 480, 0x00, 0x00, 0x00);
147 infoBar = alphaRect(640, 25, 0x00, 0x00, 0x00);
152 Sprite *Graphics::getSpriteHead()
154 return (Sprite*)spriteList.getHead();
157 void Graphics::setTransparent(SDL_Surface *sprite)
159 SDL_SetColorKey(sprite, (SDL_SRCCOLORKEY|SDL_RLEACCEL), SDL_MapRGB(sprite->format, 0, 0, 0));
162 bool Graphics::canShowMedalMessage() const
164 return (medalMessageTimer <= 0);
167 void Graphics::updateScreen()
169 if (medalMessageTimer > 0)
180 drawRect(screen->w - (medalMessage->w + 5 + padding), 5, medalMessage->w + padding - 2, 20, grey, screen);
181 drawRect(screen->w - (medalMessage->w + 5 + padding - 1), 6, medalMessage->w + padding - 4, 18, black, screen);
182 blit(medalMessage, screen->w - (medalMessage->w + 5), 7, screen, false);
186 blit(medal[medalType], screen->w - (medalMessage->w + 5 + 16), 7, screen, false);
193 if (takeRandomScreenShots)
195 if ((Math::prand() % 500) == 0)
197 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
198 SDL_SaveBMP(screen, screenshot);
205 if (engine->keyState[SDLK_F12])
207 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
208 SDL_SaveBMP(screen, screenshot);
211 engine->keyState[SDLK_F12] = 0;
214 if ((engine->keyState[SDLK_F10]) || ((engine->keyState[SDLK_RETURN]) && (engine->keyState[SDLK_LALT])))
216 SDL_WM_ToggleFullScreen(screen);
217 engine->fullScreen = !engine->fullScreen;
219 engine->keyState[SDLK_F10] = engine->keyState[SDLK_LALT] = engine->keyState[SDLK_RETURN] = 0;
223 void Graphics::delay(int time)
225 unsigned long then = SDL_GetTicks();
227 engine->keyState[SDLK_ESCAPE] = 0;
233 if (SDL_GetTicks() >= then + time)
241 if (engine->keyState[SDLK_ESCAPE])
249 void Graphics::RGBtoHSV(float r, float g, float b, float *h, float *s, float *v)
252 mn = min(min(r, g), b);
253 mx = max(max(r, g), b);
270 *h = (g - b) / delta;
274 *h = 2 + (b - r) / delta;
278 *h = 4 + (r - g) / delta;
289 void Graphics::HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
304 t = v * (1 - s * (1 - f));
346 SDL_Surface *Graphics::loadImage(const char *filename, bool srcalpha)
348 SDL_Surface *image, *newImage;
351 if (!engine->unpack(filename, PAK_IMG))
352 showErrorAndExit(ERR_FILE, filename);
353 image = IMG_Load_RW(engine->sdlrw, 1);
355 image = IMG_Load(filename);
359 showErrorAndExit(ERR_FILE, filename);
361 newImage = SDL_DisplayFormat(image);
365 SDL_FreeSurface(image);
369 // This happens when we are loading the window icon image
374 SDL_SetAlpha(newImage, SDL_SRCALPHA, 255);
376 setTransparent(newImage);
381 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
383 SDL_Surface *image, *newImage;
386 if (!engine->unpack(filename, PAK_IMG))
387 showErrorAndExit(ERR_FILE, filename);
388 image = IMG_Load_RW(engine->sdlrw, 1);
390 image = IMG_Load(filename);
394 showErrorAndExit(ERR_FILE, filename);
396 if ((hue != 0) || (sat != 0) || (value != 0))
398 if (image->format->BitsPerPixel != 8)
400 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
405 float r, g, b, h, s, v;
407 if (image->format->palette->colors != NULL)
409 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
411 color = &image->format->palette->colors[i];
417 RGBtoHSV(r, g, b, &h, &s, &v);
423 HSVtoRGB(&r, &g, &b, h, s, v);
434 newImage = SDL_DisplayFormat(image);
438 SDL_FreeSurface(image);
442 // This happens when we are loading the window icon image
446 setTransparent(newImage);
451 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
453 Sprite *sprite = addSprite(name);
454 sprite->setFrame(0, image, 60);
456 return sprite->getCurrentFrame();
459 void Graphics::fade(int amount)
461 SDL_SetAlpha(fadeBlack, SDL_SRCALPHA|SDL_RLEACCEL, amount);
462 blit(fadeBlack, 0, 0, screen, false);
465 void Graphics::fadeToBlack()
471 SDL_SetAlpha(fadeBlack, SDL_SRCALPHA|SDL_RLEACCEL, start);
472 blit(fadeBlack, 0, 0, screen, false);
478 void Graphics::loadMapTiles(const char *baseDir)
480 bool found, autoAlpha;
486 if (strcmp(baseDir, "gfx/common") == 0)
495 for (int i = 1 ; i < MAX_TILES ; i++)
499 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
503 if (!engine->getPak()->fileExists(filename))
508 fp = fopen(filename, "rb");
517 tile[i] = loadImage(filename);
521 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
523 SDL_SetAlpha(tile[i], SDL_SRCALPHA|SDL_RLEACCEL, 130);
528 if (i < MAP_DECORATION)
530 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
538 Note : We need to search for the right >>> PIXEL SIZE <<< and NOT point size!!
539 If a user has a resolution other than approximately 72dpi then
540 they will get a small or larger font and this won't work. This might look
541 weird since we'll load and delete multiple fonts, but it works...
543 void Graphics::loadFont(int i, const char *filename, int pixelSize)
545 int minx, maxx, miny, maxy, advance;
547 debug(("Attempting to load a font with pixel size of %d...\n", pixelSize));
551 debug(("Freeing Font %d first...\n", i));
552 TTF_CloseFont(font[i]);
555 char tempPath[PATH_MAX];
557 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
566 TTF_CloseFont(font[i]);
570 font[i] = TTF_OpenFont(tempPath, ++size);
572 font[i] = TTF_OpenFont("data/vera.ttf", ++size);
577 engine->reportFontFailure();
580 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
582 // great! we have an exact match
583 if (maxx == pixelSize)
588 // we've overshot, so we'll use the previous size!
589 if (maxx > pixelSize)
591 TTF_CloseFont(font[i]);
594 font[i] = TTF_OpenFont(tempPath, size - 1);
596 font[i] = TTF_OpenFont("data/vera.ttf", size - 1);
599 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
606 debug(("Pixel size has exceeded 99 pixels! I'm giving up!\n"));
607 engine->reportFontFailure();
611 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
613 debug(("Got a match for font size %d - Nearest = %d\n", pixelSize, maxx));
616 Sprite *Graphics::addSprite(const char *name)
618 Sprite *sprite = new Sprite;
619 strlcpy(sprite->name, name, sizeof sprite->name);
621 spriteList.add(sprite);
626 Sprite *Graphics::getSprite(const char *name, bool required)
628 Sprite *sprite = (Sprite*)spriteList.getHead();
630 while (sprite->next != NULL)
632 sprite = (Sprite*)sprite->next;
634 if (strcmp(sprite->name, name) == 0)
641 showErrorAndExit("The requested sprite '%s' does not exist", name);
646 void Graphics::animateSprites()
648 Sprite *sprite = (Sprite*)spriteList.getHead();
650 while (sprite->next != NULL)
652 sprite = (Sprite*)sprite->next;
657 if ((engine->getFrameLoop() % 8) == 0)
659 Math::wrapInt(&(++waterAnim), 201, 204);
660 Math::wrapInt(&(++slimeAnim), 207, 212);
661 Math::wrapInt(&(++lavaAnim), 214, 220);
665 int Graphics::getWaterAnim() const
670 int Graphics::getSlimeAnim() const
675 int Graphics::getLavaAnim() const
680 int Graphics::getLavaAnim(int current)
682 if ((engine->getFrameLoop() % 8) == 0)
683 return Math::rrand(214, 220);
688 void Graphics::loadBackground(const char *filename)
690 if (background != NULL)
691 SDL_FreeSurface(background);
693 if (strcmp(filename, "@none@") == 0)
696 background = loadImage(filename);
698 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
701 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
703 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
706 int bpp = dest->format->BytesPerPixel;
707 /* Here p is the address to the pixel we want to set */
708 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
717 *(Uint16 *)p = pixel;
721 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
723 p[0] = (pixel >> 16) & 0xff;
724 p[1] = (pixel >> 8) & 0xff;
730 p[1] = (pixel >> 8) & 0xff;
731 p[2] = (pixel >> 16) & 0xff;
736 *(Uint32 *)p = pixel;
741 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
743 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
746 int bpp = surface->format->BytesPerPixel;
747 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
757 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
758 return p[0] << 16 | p[1] << 8 | p[2];
760 return p[0] | p[1] << 8 | p[2] << 16;
766 return 0; /* shouldn't happen, but avoids warnings */
770 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
776 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
780 putPixel((int)startX, (int)startY, color, dest);
782 if ((int)startX == (int)endX)
792 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
796 showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
799 if ((x < -image->w) || (x > 640 + image->w))
802 if ((y < -image->h) || (y > 480 + image->h))
805 // Set up a rectangle to draw to
810 gRect.x -= (image->w / 2);
811 gRect.y -= (image->h / 2);
817 /* Blit onto the screen surface */
818 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
819 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
822 void Graphics::drawBackground()
824 if (background != NULL)
825 blit(background, 0, 0, screen, false);
827 SDL_FillRect(screen, NULL, black);
830 void Graphics::drawBackground(SDL_Rect *r)
832 if (r->x < 0) r->x = 0;
833 if (r->y < 0) r->y = 0;
834 if (r->x + r->w > 639) r->w = 640 - r->x;
835 if (r->y + r->h > 639) r->h = 480 - r->y;
837 if (SDL_BlitSurface(background, r, screen, r) < 0)
838 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
841 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
848 SDL_FillRect(dest, &gRect, color);
851 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
853 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
854 drawRect(x, y, w, h, color, dest);
857 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
859 fontForeground.r = red;
860 fontForeground.g = green;
861 fontForeground.b = blue;
863 fontBackground.r = red2;
864 fontBackground.g = green2;
865 fontBackground.b = blue2;
867 fontForeground.unused = fontBackground.unused = 0;
870 void Graphics::setFontSize(int size)
873 Math::limitInt(&fontSize, 0, 4);
876 SDL_Surface *Graphics::getString(const char *in, bool transparent)
878 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
882 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
886 setTransparent(text);
891 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
895 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
898 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
903 setTransparent(text);
905 if (alignment == TXT_RIGHT) x -= text->w;
906 if (alignment == TXT_CENTERED) center = true;
908 blit(text, x, y, dest, center);
909 SDL_FreeSurface(text);
912 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
916 if(!cache.text || strcmp(in, cache.text)) {
918 SDL_FreeSurface(cache.surface);
923 cache.text = strdup(in);
925 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
928 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
933 setTransparent(cache.surface);
936 if (alignment == TXT_RIGHT) x -= cache.surface->w;
937 if (alignment == TXT_CENTERED) center = true;
939 blit(cache.surface, x, y, dest, center);
942 void Graphics::clearChatString()
947 void Graphics::createChatString(const char *in)
949 strlcat(chatString, " ", sizeof chatString);
950 strlcat(chatString, in, sizeof chatString);
953 void Graphics::drawChatString(SDL_Surface *surface, int y)
955 char *word = strtok(chatString, " ");
956 char wordWithSpace[100];
961 int surfaceWidth = surface->w - 10;
963 SDL_Surface *wordSurface;
967 if (strcmp(word, "<RGB>") == 0)
969 r = atoi(strtok(NULL, " "));
970 g = atoi(strtok(NULL, " "));
971 b = atoi(strtok(NULL, " "));
973 if ((!r) && (!g) && (!b))
975 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
979 setFontColor(r, g, b, 0, 0, 0);
981 word = strtok(NULL, " ");
986 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
988 wordSurface = getString(wordWithSpace, false);
990 if (x + wordSurface->w > surfaceWidth)
992 y += (int)(wordSurface->h * 1.5) ;
996 blit(wordSurface, x, y, surface, false);
1000 SDL_FreeSurface(wordSurface);
1002 word = strtok(NULL, " ");
1006 void Graphics::showMedalMessage(int type, const char *in)
1010 if (medalMessage != NULL)
1012 SDL_FreeSurface(medalMessage);
1021 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
1026 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
1031 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
1036 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1040 medalType = type - 1; // for indexing on the image
1043 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1044 medalMessage = getString(message, true);
1048 snprintf(message, sizeof message, " %s ", in);
1049 medalMessage = getString(message, true);
1051 medalMessageTimer = (5 * 60);
1054 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1056 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1057 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1058 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1061 SDL_Surface *Graphics::createSurface(int width, int height)
1063 SDL_Surface *surface, *newImage;
1065 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1067 if (surface == NULL)
1068 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1070 newImage = SDL_DisplayFormat(surface);
1072 SDL_FreeSurface(surface);
1077 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1079 SDL_Surface *surface = createSurface(width, height);
1081 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1083 SDL_SetAlpha(surface, SDL_SRCALPHA|SDL_RLEACCEL, 130);
1088 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1090 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1092 blit(alpha, 0, 0, image, false);
1094 SDL_SetColorKey(image, (SDL_SRCCOLORKEY|SDL_RLEACCEL), SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1097 void Graphics::lock(SDL_Surface *surface)
1099 /* Lock the screen for direct access to the pixels */
1100 if (SDL_MUSTLOCK(surface))
1102 if (SDL_LockSurface(surface) < 0 )
1104 showErrorAndExit("Could not lock surface", "");
1109 void Graphics::unlock(SDL_Surface *surface)
1111 if (SDL_MUSTLOCK(surface))
1113 SDL_UnlockSurface(surface);
1117 void Graphics::resetLoading()
1122 void Graphics::showLoading(int amount, int max)
1130 Math::limitInt(&(currentLoading += amount), 0, max);
1132 drawRect(120, 420, 400, 10, black, white, screen);
1133 drawRect(121, 421, currentLoading, 8, red, screen);
1135 SDL_UpdateRect(screen, 120, 420, 400, 10);
1139 void Graphics::showLicenseErrorAndExit()
1141 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1142 drawString("License Agreement Missing", 320, 50, true, screen);
1144 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1146 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1147 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1148 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1150 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1151 drawString("Press Escape to continue", 320, 450, true, screen);
1153 engine->flushInput();
1159 if (engine->keyState[SDLK_ESCAPE])
1165 void Graphics::showErrorAndExit(const char *error, const char *param)
1167 SDL_FillRect(screen, NULL, black);
1169 if (strcmp(param, "LICENSE") == 0)
1171 showLicenseErrorAndExit();
1175 snprintf(message, sizeof message, error, param);
1177 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1178 drawString("An unforseen error has occurred", 320, 50, true, screen);
1179 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1180 drawString(message, 320, 90, true, screen);
1182 drawString("You may wish to try the following,", 50, 150, false, screen);
1185 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1186 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1187 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1188 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1189 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1190 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1194 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1195 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1197 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1198 drawString("Press Escape to continue", 320, 450, true, screen);
1200 engine->flushInput();
1206 if (engine->keyState[SDLK_ESCAPE])
1214 void Graphics::showRootWarning()
1216 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1217 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1219 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1221 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1222 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1223 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1225 drawString("Press Space to Exit", 320, 420, true, screen);
1226 drawString("Press Escape to Continue", 320, 450, true, screen);
1228 engine->flushInput();
1235 if (engine->keyState[SDLK_ESCAPE])
1239 else if (engine->keyState[SDLK_SPACE])