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()
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)
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
373 setTransparent(newImage);
378 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
380 SDL_Surface *image, *newImage;
383 if (!engine->unpack(filename, PAK_IMG))
384 showErrorAndExit(ERR_FILE, filename);
385 image = IMG_Load_RW(engine->sdlrw, 1);
387 image = IMG_Load(filename);
391 showErrorAndExit(ERR_FILE, filename);
393 if ((hue != 0) || (sat != 0) || (value != 0))
395 if (image->format->BitsPerPixel != 8)
397 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
402 float r, g, b, h, s, v;
404 if (image->format->palette->colors != NULL)
406 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
408 color = &image->format->palette->colors[i];
414 RGBtoHSV(r, g, b, &h, &s, &v);
420 HSVtoRGB(&r, &g, &b, h, s, v);
431 newImage = SDL_DisplayFormat(image);
435 SDL_FreeSurface(image);
439 // This happens when we are loading the window icon image
443 setTransparent(newImage);
448 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
450 Sprite *sprite = addSprite(name);
451 sprite->setFrame(0, image, 60);
453 return sprite->getCurrentFrame();
456 void Graphics::fade(int amount)
458 SDL_SetAlpha(fadeBlack, SDL_SRCALPHA|SDL_RLEACCEL, amount);
459 blit(fadeBlack, 0, 0, screen, false);
462 void Graphics::fadeToBlack()
468 SDL_SetAlpha(fadeBlack, SDL_SRCALPHA|SDL_RLEACCEL, start);
469 blit(fadeBlack, 0, 0, screen, false);
475 void Graphics::loadMapTiles(const char *baseDir)
477 bool found, autoAlpha;
483 if (strcmp(baseDir, "gfx/common") == 0)
492 for (int i = 1 ; i < MAX_TILES ; i++)
496 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
500 if (!engine->getPak()->fileExists(filename))
505 fp = fopen(filename, "rb");
514 tile[i] = loadImage(filename);
518 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
520 SDL_SetAlpha(tile[i], SDL_SRCALPHA|SDL_RLEACCEL, 130);
525 if (i < MAP_DECORATION)
527 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
535 Note : We need to search for the right >>> PIXEL SIZE <<< and NOT point size!!
536 If a user has a resolution other than approximately 72dpi then
537 they will get a small or larger font and this won't work. This might look
538 weird since we'll load and delete multiple fonts, but it works...
540 void Graphics::loadFont(int i, const char *filename, int pixelSize)
542 int minx, maxx, miny, maxy, advance;
544 debug(("Attempting to load a font with pixel size of %d...\n", pixelSize));
548 debug(("Freeing Font %d first...\n", i));
549 TTF_CloseFont(font[i]);
552 char tempPath[PATH_MAX];
554 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
563 TTF_CloseFont(font[i]);
567 font[i] = TTF_OpenFont(tempPath, ++size);
569 font[i] = TTF_OpenFont("data/vera.ttf", ++size);
574 engine->reportFontFailure();
577 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
579 // great! we have an exact match
580 if (maxx == pixelSize)
585 // we've overshot, so we'll use the previous size!
586 if (maxx > pixelSize)
588 TTF_CloseFont(font[i]);
591 font[i] = TTF_OpenFont(tempPath, size - 1);
593 font[i] = TTF_OpenFont("data/vera.ttf", size - 1);
596 TTF_GlyphMetrics(font[i], '8', &minx, &maxx, &miny, &maxy, &advance);
603 debug(("Pixel size has exceeded 99 pixels! I'm giving up!\n"));
604 engine->reportFontFailure();
608 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
610 debug(("Got a match for font size %d - Nearest = %d\n", pixelSize, maxx));
613 Sprite *Graphics::addSprite(const char *name)
615 Sprite *sprite = new Sprite;
616 strncpy(sprite->name, name, sizeof sprite->name);
618 spriteList.add(sprite);
623 Sprite *Graphics::getSprite(const char *name, bool required)
625 Sprite *sprite = (Sprite*)spriteList.getHead();
627 while (sprite->next != NULL)
629 sprite = (Sprite*)sprite->next;
631 if (strcmp(sprite->name, name) == 0)
638 showErrorAndExit("The requested sprite '%s' does not exist", name);
643 void Graphics::animateSprites()
645 Sprite *sprite = (Sprite*)spriteList.getHead();
647 while (sprite->next != NULL)
649 sprite = (Sprite*)sprite->next;
654 if ((engine->getFrameLoop() % 8) == 0)
656 Math::wrapInt(&(++waterAnim), 201, 204);
657 Math::wrapInt(&(++slimeAnim), 207, 212);
658 Math::wrapInt(&(++lavaAnim), 214, 220);
662 int Graphics::getWaterAnim()
667 int Graphics::getSlimeAnim()
672 int Graphics::getLavaAnim()
677 int Graphics::getLavaAnim(int current)
679 if ((engine->getFrameLoop() % 8) == 0)
680 return Math::rrand(214, 220);
685 void Graphics::loadBackground(const char *filename)
687 if (background != NULL)
688 SDL_FreeSurface(background);
690 if (strcmp(filename, "@none@") == 0)
693 background = loadImage(filename);
695 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
698 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
700 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
703 int bpp = dest->format->BytesPerPixel;
704 /* Here p is the address to the pixel we want to set */
705 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
714 *(Uint16 *)p = pixel;
718 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
720 p[0] = (pixel >> 16) & 0xff;
721 p[1] = (pixel >> 8) & 0xff;
727 p[1] = (pixel >> 8) & 0xff;
728 p[2] = (pixel >> 16) & 0xff;
733 *(Uint32 *)p = pixel;
738 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
740 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
743 int bpp = surface->format->BytesPerPixel;
744 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
754 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
755 return p[0] << 16 | p[1] << 8 | p[2];
757 return p[0] | p[1] << 8 | p[2] << 16;
763 return 0; /* shouldn't happen, but avoids warnings */
767 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
773 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
777 putPixel((int)startX, (int)startY, color, dest);
779 if ((int)startX == (int)endX)
789 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
793 showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
796 if ((x < -image->w) || (x > 640 + image->w))
799 if ((y < -image->h) || (y > 480 + image->h))
802 // Set up a rectangle to draw to
807 gRect.x -= (image->w / 2);
808 gRect.y -= (image->h / 2);
814 /* Blit onto the screen surface */
815 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
816 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
819 void Graphics::drawBackground()
821 if (background != NULL)
822 blit(background, 0, 0, screen, false);
824 SDL_FillRect(screen, NULL, black);
827 void Graphics::drawBackground(SDL_Rect *r)
829 if (r->x < 0) r->x = 0;
830 if (r->y < 0) r->y = 0;
831 if (r->x + r->w > 639) r->w = 640 - r->x;
832 if (r->y + r->h > 639) r->h = 480 - r->y;
834 if (SDL_BlitSurface(background, r, screen, r) < 0)
835 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
838 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
845 SDL_FillRect(dest, &gRect, color);
848 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
850 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
851 drawRect(x, y, w, h, color, dest);
854 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
856 fontForeground.r = red;
857 fontForeground.g = green;
858 fontForeground.b = blue;
860 fontBackground.r = red2;
861 fontBackground.g = green2;
862 fontBackground.b = blue2;
864 fontForeground.unused = fontBackground.unused = 0;
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);
896 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
899 if (alignment == TXT_RIGHT) x -= text->w;
900 if (alignment == TXT_CENTERED) center = true;
902 setTransparent(text);
903 blit(text, x, y, dest, center);
904 SDL_FreeSurface(text);
907 void Graphics::clearChatString()
912 void Graphics::createChatString(const char *in)
914 snprintf(chatString, sizeof chatString, "%s %s", chatString, in);
917 void Graphics::drawChatString(SDL_Surface *surface, int y)
919 char *word = strtok(chatString, " ");
920 char wordWithSpace[100];
925 int surfaceWidth = surface->w - 10;
927 SDL_Surface *wordSurface;
931 if (strcmp(word, "<RGB>") == 0)
933 r = atoi(strtok(NULL, " "));
934 g = atoi(strtok(NULL, " "));
935 b = atoi(strtok(NULL, " "));
937 if ((!r) && (!g) && (!b))
939 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
943 setFontColor(r, g, b, 0, 0, 0);
945 word = strtok(NULL, " ");
950 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
952 wordSurface = getString(wordWithSpace, false);
954 if (x + wordSurface->w > surfaceWidth)
956 y += (int)(wordSurface->h * 1.5) ;
960 blit(wordSurface, x, y, surface, false);
962 SDL_FreeSurface(wordSurface);
966 word = strtok(NULL, " ");
970 void Graphics::showMedalMessage(int type, const char *in)
974 if (medalMessage != NULL)
976 SDL_FreeSurface(medalMessage);
985 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
990 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
995 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
1000 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1004 medalType = type - 1; // for indexing on the image
1007 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1008 medalMessage = getString(message, true);
1012 snprintf(message, sizeof message, " %s ", in);
1013 medalMessage = getString(message, true);
1015 medalMessageTimer = (5 * 60);
1018 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1020 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1021 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1022 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1025 SDL_Surface *Graphics::createSurface(int width, int height)
1027 SDL_Surface *surface, *newImage;
1029 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1031 if (surface == NULL)
1032 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1034 newImage = SDL_DisplayFormat(surface);
1036 SDL_FreeSurface(surface);
1041 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1043 SDL_Surface *surface = createSurface(width, height);
1045 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1047 SDL_SetAlpha(surface, SDL_SRCALPHA|SDL_RLEACCEL, 130);
1052 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1054 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1056 blit(alpha, 0, 0, image, false);
1058 SDL_SetColorKey(image, (SDL_SRCCOLORKEY|SDL_RLEACCEL), SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1061 void Graphics::lock(SDL_Surface *surface)
1063 /* Lock the screen for direct access to the pixels */
1064 if (SDL_MUSTLOCK(surface))
1066 if (SDL_LockSurface(surface) < 0 )
1068 showErrorAndExit("Could not lock surface", "");
1073 void Graphics::unlock(SDL_Surface *surface)
1075 if (SDL_MUSTLOCK(surface))
1077 SDL_UnlockSurface(surface);
1081 void Graphics::resetLoading()
1086 void Graphics::showLoading(int amount, int max)
1094 Math::limitInt(&(currentLoading += amount), 0, max);
1096 drawRect(120, 420, 400, 10, black, white, screen);
1097 drawRect(121, 421, currentLoading, 8, red, screen);
1099 SDL_UpdateRect(screen, 120, 420, 400, 10);
1103 void Graphics::showLicenseErrorAndExit()
1105 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1106 drawString("License Agreement Missing", 320, 50, true, screen);
1108 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1110 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1111 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1112 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1114 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1115 drawString("Press Escape to continue", 320, 450, true, screen);
1117 engine->flushInput();
1123 if (engine->keyState[SDLK_ESCAPE])
1129 void Graphics::showErrorAndExit(const char *error, const char *param)
1131 SDL_FillRect(screen, NULL, black);
1133 if (strcmp(param, "LICENSE") == 0)
1135 showLicenseErrorAndExit();
1139 snprintf(message, sizeof message, error, param);
1141 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1142 drawString("An unforseen error has occurred", 320, 50, true, screen);
1143 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1144 drawString(message, 320, 90, true, screen);
1146 drawString("You may wish to try the following,", 50, 150, false, screen);
1149 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1150 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1151 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1152 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1153 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1154 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1158 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1159 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1161 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1162 drawString("Press Escape to continue", 320, 450, true, screen);
1164 engine->flushInput();
1170 if (engine->keyState[SDLK_ESCAPE])
1178 void Graphics::showRootWarning()
1180 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1181 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1183 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1185 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1186 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1187 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1189 drawString("Press Space to Exit", 320, 420, true, screen);
1190 drawString("Press Escape to Continue", 320, 450, true, screen);
1192 engine->flushInput();
1199 if (engine->keyState[SDLK_ESCAPE])
1203 else if (engine->keyState[SDLK_SPACE])