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)
164 SDL_SetColorKey(sprite, SDL_TRUE, SDL_MapRGB(sprite->format, 0, 0, 0));
167 bool Graphics::canShowMedalMessage() const
169 return (medalMessageTimer <= 0);
172 void Graphics::updateScreen()
174 if (medalMessageTimer > 0)
185 drawRect(screen->w - (medalMessage->w + 5 + padding), 5, medalMessage->w + padding - 2, 20, grey, screen);
186 drawRect(screen->w - (medalMessage->w + 5 + padding - 1), 6, medalMessage->w + padding - 4, 18, black, screen);
187 blit(medalMessage, screen->w - (medalMessage->w + 5), 7, screen, false);
191 blit(medal[medalType], screen->w - (medalMessage->w + 5 + 16), 7, screen, false);
195 SDL_UpdateTexture(texture, NULL, screen->pixels, screen->w * 4);
196 SDL_RenderCopy(renderer, texture, NULL, NULL);
197 SDL_RenderPresent(renderer);
199 if (takeRandomScreenShots)
201 if ((Math::prand() % 500) == 0)
203 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
204 SDL_SaveBMP(screen, screenshot);
211 if (engine->keyState[SDL_SCANCODE_F12])
213 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
214 SDL_SaveBMP(screen, screenshot);
217 engine->keyState[SDL_SCANCODE_F12] = 0;
220 if ((engine->keyState[SDL_SCANCODE_F10]) || ((engine->keyState[SDL_SCANCODE_RETURN]) && (engine->keyState[SDL_SCANCODE_LALT])))
222 engine->fullScreen = !engine->fullScreen;
223 SDL_SetWindowFullscreen(window, engine->fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
225 engine->keyState[SDL_SCANCODE_F10] = engine->keyState[SDL_SCANCODE_LALT] = engine->keyState[SDL_SCANCODE_RETURN] = 0;
229 void Graphics::delay(int time)
231 unsigned long then = SDL_GetTicks();
233 engine->keyState[SDL_SCANCODE_ESCAPE] = 0;
239 if (SDL_GetTicks() >= then + time)
247 if (engine->keyState[SDL_SCANCODE_ESCAPE])
255 void Graphics::RGBtoHSV(float r, float g, float b, float *h, float *s, float *v)
258 mn = min(min(r, g), b);
259 mx = max(max(r, g), b);
276 *h = (g - b) / delta;
280 *h = 2 + (b - r) / delta;
284 *h = 4 + (r - g) / delta;
295 void Graphics::HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
310 t = v * (1 - s * (1 - f));
352 SDL_Surface *Graphics::loadImage(const char *filename, bool srcalpha)
354 SDL_Surface *image, *newImage;
357 if (!engine->unpack(filename, PAK_IMG))
358 showErrorAndExit(ERR_FILE, filename);
359 image = IMG_Load_RW(engine->sdlrw, 1);
361 image = IMG_Load(filename);
365 return showErrorAndExit(ERR_FILE, filename), image;
367 newImage = SDL_ConvertSurface(image, screen->format, 0);
371 SDL_FreeSurface(image);
375 // This happens when we are loading the window icon image
380 SDL_SetAlpha(newImage, 255);
382 setTransparent(newImage);
387 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
389 SDL_Surface *image, *newImage;
392 if (!engine->unpack(filename, PAK_IMG))
393 showErrorAndExit(ERR_FILE, filename);
394 image = IMG_Load_RW(engine->sdlrw, 1);
396 image = IMG_Load(filename);
400 return showErrorAndExit(ERR_FILE, filename), image;
402 if ((hue != 0) || (sat != 0) || (value != 0))
404 if (image->format->BitsPerPixel != 8)
406 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
411 float r, g, b, h, s, v;
413 if (image->format->palette->colors != NULL)
415 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
417 color = &image->format->palette->colors[i];
423 RGBtoHSV(r, g, b, &h, &s, &v);
429 HSVtoRGB(&r, &g, &b, h, s, v);
440 newImage = SDL_ConvertSurface(image, screen->format, 0);
444 SDL_FreeSurface(image);
448 // This happens when we are loading the window icon image
452 setTransparent(newImage);
457 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
459 Sprite *sprite = addSprite(name);
460 sprite->setFrame(0, image, 60);
462 return sprite->getCurrentFrame();
465 void Graphics::fade(int amount)
467 SDL_SetAlpha(fadeBlack, amount);
468 blit(fadeBlack, 0, 0, screen, false);
471 void Graphics::fadeToBlack()
477 SDL_SetAlpha(fadeBlack, start);
478 blit(fadeBlack, 0, 0, screen, false);
484 void Graphics::loadMapTiles(const char *baseDir)
486 bool found, autoAlpha;
492 if (strcmp(baseDir, "gfx/common") == 0)
501 for (int i = 1 ; i < MAX_TILES ; i++)
505 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
509 if (!engine->getPak()->fileExists(filename))
514 fp = fopen(filename, "rb");
523 tile[i] = loadImage(filename);
530 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
532 SDL_SetAlpha(tile[i], 130);
537 if (i < MAP_DECORATION)
539 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
546 void Graphics::loadFont(int i, const char *filename, int pointSize)
548 debug(("Attempting to load font %s with point size of %d...\n", filename, pointSize));
552 debug(("Freeing Font %d first...\n", i));
553 TTF_CloseFont(font[i]);
558 char tempPath[PATH_MAX];
559 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
560 font[i] = TTF_OpenFont(tempPath, pointSize);
562 font[i] = TTF_OpenFont(filename, pointSize);
567 engine->reportFontFailure();
570 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
573 Sprite *Graphics::addSprite(const char *name)
575 Sprite *sprite = new Sprite;
576 strlcpy(sprite->name, name, sizeof sprite->name);
578 spriteList.add(sprite);
583 Sprite *Graphics::getSprite(const char *name, bool required)
585 Sprite *sprite = (Sprite*)spriteList.getHead();
587 while (sprite->next != NULL)
589 sprite = (Sprite*)sprite->next;
591 if (strcmp(sprite->name, name) == 0)
598 showErrorAndExit("The requested sprite '%s' does not exist", name);
603 void Graphics::animateSprites()
605 Sprite *sprite = (Sprite*)spriteList.getHead();
607 while (sprite->next != NULL)
609 sprite = (Sprite*)sprite->next;
614 if ((engine->getFrameLoop() % 8) == 0)
616 Math::wrapInt(&(++waterAnim), 201, 204);
617 Math::wrapInt(&(++slimeAnim), 207, 212);
618 Math::wrapInt(&(++lavaAnim), 214, 220);
622 int Graphics::getWaterAnim() const
627 int Graphics::getSlimeAnim() const
632 int Graphics::getLavaAnim() const
637 int Graphics::getLavaAnim(int current)
639 if ((engine->getFrameLoop() % 8) == 0)
640 return Math::rrand(214, 220);
645 void Graphics::loadBackground(const char *filename)
647 if (background != NULL)
648 SDL_FreeSurface(background);
650 if (strcmp(filename, "@none@") == 0)
653 background = loadImage(filename);
655 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
658 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
660 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
663 int bpp = dest->format->BytesPerPixel;
664 /* Here p is the address to the pixel we want to set */
665 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
674 *(Uint16 *)p = pixel;
678 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
680 p[0] = (pixel >> 16) & 0xff;
681 p[1] = (pixel >> 8) & 0xff;
687 p[1] = (pixel >> 8) & 0xff;
688 p[2] = (pixel >> 16) & 0xff;
693 *(Uint32 *)p = pixel;
698 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
700 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
703 int bpp = surface->format->BytesPerPixel;
704 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
714 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
715 return p[0] << 16 | p[1] << 8 | p[2];
717 return p[0] | p[1] << 8 | p[2] << 16;
723 return 0; /* shouldn't happen, but avoids warnings */
727 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
733 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
737 putPixel((int)startX, (int)startY, color, dest);
739 if ((int)startX == (int)endX)
749 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
753 return showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
756 if ((x < -image->w) || (x > 640 + image->w))
759 if ((y < -image->h) || (y > 480 + image->h))
762 // Set up a rectangle to draw to
767 gRect.x -= (image->w / 2);
768 gRect.y -= (image->h / 2);
774 /* Blit onto the screen surface */
775 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
776 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
779 void Graphics::drawBackground()
781 if (background != NULL)
782 blit(background, 0, 0, screen, false);
784 SDL_FillRect(screen, NULL, black);
787 void Graphics::drawBackground(SDL_Rect *r)
789 if (r->x < 0) r->x = 0;
790 if (r->y < 0) r->y = 0;
791 if (r->x + r->w > 639) r->w = 640 - r->x;
792 if (r->y + r->h > 639) r->h = 480 - r->y;
794 if (SDL_BlitSurface(background, r, screen, r) < 0)
795 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
798 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
805 SDL_FillRect(dest, &gRect, color);
808 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
810 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
811 drawRect(x, y, w, h, color, dest);
814 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
816 fontForeground.r = red;
817 fontForeground.g = green;
818 fontForeground.b = blue;
820 fontBackground.r = red2;
821 fontBackground.g = green2;
822 fontBackground.b = blue2;
825 void Graphics::setFontSize(int size)
828 Math::limitInt(&fontSize, 0, 4);
831 SDL_Surface *Graphics::getString(const char *in, bool transparent)
833 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
837 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
842 fprintf(stderr, "Unable to render text: %s\n", SDL_GetError());
847 setTransparent(text);
852 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
856 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
859 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
864 setTransparent(text);
866 if (alignment == TXT_RIGHT) x -= text->w;
867 if (alignment == TXT_CENTERED) center = true;
869 blit(text, x, y, dest, center);
870 SDL_FreeSurface(text);
873 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
877 if(!cache.text || strcmp(in, cache.text)) {
879 SDL_FreeSurface(cache.surface);
884 cache.text = strdup(in);
886 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
889 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
894 setTransparent(cache.surface);
897 if (alignment == TXT_RIGHT) x -= cache.surface->w;
898 if (alignment == TXT_CENTERED) center = true;
900 blit(cache.surface, x, y, dest, center);
903 void Graphics::clearChatString()
908 void Graphics::createChatString(const char *in)
910 strlcat(chatString, " ", sizeof chatString);
911 strlcat(chatString, in, sizeof chatString);
914 void Graphics::drawChatString(SDL_Surface *surface, int y)
916 char *word = strtok(chatString, " ");
917 char wordWithSpace[100];
922 int surfaceWidth = surface->w - 10;
924 SDL_Surface *wordSurface;
928 if (strcmp(word, "<RGB>") == 0)
930 r = atoi(strtok(NULL, " "));
931 g = atoi(strtok(NULL, " "));
932 b = atoi(strtok(NULL, " "));
934 if ((!r) && (!g) && (!b))
936 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
940 setFontColor(r, g, b, 0, 0, 0);
942 word = strtok(NULL, " ");
947 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
949 wordSurface = getString(wordWithSpace, false);
951 if (x + wordSurface->w > surfaceWidth)
953 y += (int)(wordSurface->h * 1.5) ;
957 blit(wordSurface, x, y, surface, false);
961 SDL_FreeSurface(wordSurface);
963 word = strtok(NULL, " ");
967 void Graphics::showMedalMessage(int type, const char *in)
971 if (medalMessage != NULL)
973 SDL_FreeSurface(medalMessage);
982 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
987 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
992 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
997 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1001 medalType = type - 1; // for indexing on the image
1004 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1005 medalMessage = getString(message, true);
1009 snprintf(message, sizeof message, " %s ", in);
1010 medalMessage = getString(message, true);
1012 medalMessageTimer = (5 * 60);
1015 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1017 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1018 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1019 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1022 SDL_Surface *Graphics::createSurface(int width, int height)
1024 SDL_Surface *surface, *newImage;
1026 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1028 if (surface == NULL)
1029 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1031 newImage = SDL_ConvertSurface(surface, screen->format, 0);
1033 SDL_FreeSurface(surface);
1038 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1040 SDL_Surface *surface = createSurface(width, height);
1042 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1044 SDL_SetAlpha(surface, 130);
1049 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1051 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1053 blit(alpha, 0, 0, image, false);
1055 SDL_SetColorKey(image, SDL_TRUE, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1058 void Graphics::lock(SDL_Surface *surface)
1060 /* Lock the screen for direct access to the pixels */
1061 if (SDL_MUSTLOCK(surface))
1063 if (SDL_LockSurface(surface) < 0 )
1065 showErrorAndExit("Could not lock surface", "");
1070 void Graphics::unlock(SDL_Surface *surface)
1072 if (SDL_MUSTLOCK(surface))
1074 SDL_UnlockSurface(surface);
1078 void Graphics::resetLoading()
1083 void Graphics::showLoading(int amount, int max)
1091 Math::limitInt(&(currentLoading += amount), 0, max);
1093 drawRect(120, 420, 400, 10, black, white, screen);
1094 drawRect(121, 421, currentLoading, 8, red, screen);
1101 void Graphics::showLicenseErrorAndExit()
1103 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1104 drawString("License Agreement Missing", 320, 50, true, screen);
1106 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1108 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1109 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1110 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1112 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1113 drawString("Press Escape to continue", 320, 450, true, screen);
1115 engine->flushInput();
1121 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1127 void Graphics::showErrorAndExit(const char *error, const char *param)
1129 SDL_FillRect(screen, NULL, black);
1131 if (strcmp(param, "LICENSE") == 0)
1133 showLicenseErrorAndExit();
1137 snprintf(message, sizeof message, error, param);
1139 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1140 drawString("An unforseen error has occurred", 320, 50, true, screen);
1141 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1142 drawString(message, 320, 90, true, screen);
1144 drawString("You may wish to try the following,", 50, 150, false, screen);
1147 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1148 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1149 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1150 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1151 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1152 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1156 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1157 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1159 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1160 drawString("Press Escape to continue", 320, 450, true, screen);
1162 engine->flushInput();
1168 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1176 void Graphics::showRootWarning()
1178 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1179 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1181 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1183 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1184 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1185 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1187 drawString("Press Space to Exit", 320, 420, true, screen);
1188 drawString("Press Escape to Continue", 320, 450, true, screen);
1190 engine->flushInput();
1197 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1201 else if (engine->keyState[SDL_SCANCODE_SPACE])