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));
542 void Graphics::loadFont(int i, const char *filename, int pointSize)
544 debug(("Attempting to load font %s with point size of %d...\n", filename, pointSize));
548 debug(("Freeing Font %d first...\n", i));
549 TTF_CloseFont(font[i]);
553 char tempPath[PATH_MAX];
554 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
555 font[i] = TTF_OpenFont(tempPath, pointSize);
557 font[i] = TTF_OpenFont("data/vera.ttf", pointSize);
562 engine->reportFontFailure();
565 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
568 Sprite *Graphics::addSprite(const char *name)
570 Sprite *sprite = new Sprite;
571 strlcpy(sprite->name, name, sizeof sprite->name);
573 spriteList.add(sprite);
578 Sprite *Graphics::getSprite(const char *name, bool required)
580 Sprite *sprite = (Sprite*)spriteList.getHead();
582 while (sprite->next != NULL)
584 sprite = (Sprite*)sprite->next;
586 if (strcmp(sprite->name, name) == 0)
593 showErrorAndExit("The requested sprite '%s' does not exist", name);
598 void Graphics::animateSprites()
600 Sprite *sprite = (Sprite*)spriteList.getHead();
602 while (sprite->next != NULL)
604 sprite = (Sprite*)sprite->next;
609 if ((engine->getFrameLoop() % 8) == 0)
611 Math::wrapInt(&(++waterAnim), 201, 204);
612 Math::wrapInt(&(++slimeAnim), 207, 212);
613 Math::wrapInt(&(++lavaAnim), 214, 220);
617 int Graphics::getWaterAnim() const
622 int Graphics::getSlimeAnim() const
627 int Graphics::getLavaAnim() const
632 int Graphics::getLavaAnim(int current)
634 if ((engine->getFrameLoop() % 8) == 0)
635 return Math::rrand(214, 220);
640 void Graphics::loadBackground(const char *filename)
642 if (background != NULL)
643 SDL_FreeSurface(background);
645 if (strcmp(filename, "@none@") == 0)
648 background = loadImage(filename);
650 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
653 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
655 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
658 int bpp = dest->format->BytesPerPixel;
659 /* Here p is the address to the pixel we want to set */
660 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
669 *(Uint16 *)p = pixel;
673 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
675 p[0] = (pixel >> 16) & 0xff;
676 p[1] = (pixel >> 8) & 0xff;
682 p[1] = (pixel >> 8) & 0xff;
683 p[2] = (pixel >> 16) & 0xff;
688 *(Uint32 *)p = pixel;
693 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
695 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
698 int bpp = surface->format->BytesPerPixel;
699 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
709 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
710 return p[0] << 16 | p[1] << 8 | p[2];
712 return p[0] | p[1] << 8 | p[2] << 16;
718 return 0; /* shouldn't happen, but avoids warnings */
722 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
728 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
732 putPixel((int)startX, (int)startY, color, dest);
734 if ((int)startX == (int)endX)
744 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
748 showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
751 if ((x < -image->w) || (x > 640 + image->w))
754 if ((y < -image->h) || (y > 480 + image->h))
757 // Set up a rectangle to draw to
762 gRect.x -= (image->w / 2);
763 gRect.y -= (image->h / 2);
769 /* Blit onto the screen surface */
770 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
771 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
774 void Graphics::drawBackground()
776 if (background != NULL)
777 blit(background, 0, 0, screen, false);
779 SDL_FillRect(screen, NULL, black);
782 void Graphics::drawBackground(SDL_Rect *r)
784 if (r->x < 0) r->x = 0;
785 if (r->y < 0) r->y = 0;
786 if (r->x + r->w > 639) r->w = 640 - r->x;
787 if (r->y + r->h > 639) r->h = 480 - r->y;
789 if (SDL_BlitSurface(background, r, screen, r) < 0)
790 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
793 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
800 SDL_FillRect(dest, &gRect, color);
803 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
805 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
806 drawRect(x, y, w, h, color, dest);
809 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
811 fontForeground.r = red;
812 fontForeground.g = green;
813 fontForeground.b = blue;
815 fontBackground.r = red2;
816 fontBackground.g = green2;
817 fontBackground.b = blue2;
820 void Graphics::setFontSize(int size)
823 Math::limitInt(&fontSize, 0, 4);
826 SDL_Surface *Graphics::getString(const char *in, bool transparent)
828 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
832 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
837 fprintf(stderr, "Unable to render text: %s\n", SDL_GetError());
842 setTransparent(text);
847 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
851 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
854 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
859 setTransparent(text);
861 if (alignment == TXT_RIGHT) x -= text->w;
862 if (alignment == TXT_CENTERED) center = true;
864 blit(text, x, y, dest, center);
865 SDL_FreeSurface(text);
868 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
872 if(!cache.text || strcmp(in, cache.text)) {
874 SDL_FreeSurface(cache.surface);
879 cache.text = strdup(in);
881 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
884 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
889 setTransparent(cache.surface);
892 if (alignment == TXT_RIGHT) x -= cache.surface->w;
893 if (alignment == TXT_CENTERED) center = true;
895 blit(cache.surface, x, y, dest, center);
898 void Graphics::clearChatString()
903 void Graphics::createChatString(const char *in)
905 strlcat(chatString, " ", sizeof chatString);
906 strlcat(chatString, in, sizeof chatString);
909 void Graphics::drawChatString(SDL_Surface *surface, int y)
911 char *word = strtok(chatString, " ");
912 char wordWithSpace[100];
917 int surfaceWidth = surface->w - 10;
919 SDL_Surface *wordSurface;
923 if (strcmp(word, "<RGB>") == 0)
925 r = atoi(strtok(NULL, " "));
926 g = atoi(strtok(NULL, " "));
927 b = atoi(strtok(NULL, " "));
929 if ((!r) && (!g) && (!b))
931 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
935 setFontColor(r, g, b, 0, 0, 0);
937 word = strtok(NULL, " ");
942 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
944 wordSurface = getString(wordWithSpace, false);
946 if (x + wordSurface->w > surfaceWidth)
948 y += (int)(wordSurface->h * 1.5) ;
952 blit(wordSurface, x, y, surface, false);
956 SDL_FreeSurface(wordSurface);
958 word = strtok(NULL, " ");
962 void Graphics::showMedalMessage(int type, const char *in)
966 if (medalMessage != NULL)
968 SDL_FreeSurface(medalMessage);
977 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
982 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
987 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
992 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
996 medalType = type - 1; // for indexing on the image
999 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1000 medalMessage = getString(message, true);
1004 snprintf(message, sizeof message, " %s ", in);
1005 medalMessage = getString(message, true);
1007 medalMessageTimer = (5 * 60);
1010 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1012 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1013 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1014 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1017 SDL_Surface *Graphics::createSurface(int width, int height)
1019 SDL_Surface *surface, *newImage;
1021 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1023 if (surface == NULL)
1024 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1026 newImage = SDL_ConvertSurface(surface, screen->format, 0);
1028 SDL_FreeSurface(surface);
1033 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1035 SDL_Surface *surface = createSurface(width, height);
1037 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1039 SDL_SetAlpha(surface, 130);
1044 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1046 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1048 blit(alpha, 0, 0, image, false);
1050 SDL_SetColorKey(image, SDL_TRUE, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1053 void Graphics::lock(SDL_Surface *surface)
1055 /* Lock the screen for direct access to the pixels */
1056 if (SDL_MUSTLOCK(surface))
1058 if (SDL_LockSurface(surface) < 0 )
1060 showErrorAndExit("Could not lock surface", "");
1065 void Graphics::unlock(SDL_Surface *surface)
1067 if (SDL_MUSTLOCK(surface))
1069 SDL_UnlockSurface(surface);
1073 void Graphics::resetLoading()
1078 void Graphics::showLoading(int amount, int max)
1086 Math::limitInt(&(currentLoading += amount), 0, max);
1088 drawRect(120, 420, 400, 10, black, white, screen);
1089 drawRect(121, 421, currentLoading, 8, red, screen);
1093 void Graphics::showLicenseErrorAndExit()
1095 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1096 drawString("License Agreement Missing", 320, 50, true, screen);
1098 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1100 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1101 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1102 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1104 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1105 drawString("Press Escape to continue", 320, 450, true, screen);
1107 engine->flushInput();
1113 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1119 void Graphics::showErrorAndExit(const char *error, const char *param)
1121 SDL_FillRect(screen, NULL, black);
1123 if (strcmp(param, "LICENSE") == 0)
1125 showLicenseErrorAndExit();
1129 snprintf(message, sizeof message, error, param);
1131 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1132 drawString("An unforseen error has occurred", 320, 50, true, screen);
1133 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1134 drawString(message, 320, 90, true, screen);
1136 drawString("You may wish to try the following,", 50, 150, false, screen);
1139 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1140 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1141 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1142 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1143 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1144 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1148 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1149 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, 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])
1168 void Graphics::showRootWarning()
1170 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1171 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1173 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1175 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1176 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1177 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1179 drawString("Press Space to Exit", 320, 420, true, screen);
1180 drawString("Press Escape to Continue", 320, 450, true, screen);
1182 engine->flushInput();
1189 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1193 else if (engine->keyState[SDL_SCANCODE_SPACE])