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);
198 SDL_RenderClear(renderer);
200 if (takeRandomScreenShots)
202 if ((Math::prand() % 500) == 0)
204 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
205 SDL_SaveBMP(screen, screenshot);
212 if (engine->keyState[SDL_SCANCODE_F12])
214 snprintf(screenshot, sizeof screenshot, "screenshots/screenshot%.3d.bmp", screenShotNumber);
215 SDL_SaveBMP(screen, screenshot);
218 engine->keyState[SDL_SCANCODE_F12] = 0;
221 if ((engine->keyState[SDL_SCANCODE_F10]) || ((engine->keyState[SDL_SCANCODE_RETURN]) && (engine->keyState[SDL_SCANCODE_LALT])))
223 engine->fullScreen = !engine->fullScreen;
224 SDL_SetWindowFullscreen(window, engine->fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
226 engine->keyState[SDL_SCANCODE_F10] = engine->keyState[SDL_SCANCODE_LALT] = engine->keyState[SDL_SCANCODE_RETURN] = 0;
230 void Graphics::delay(int time)
232 unsigned long then = SDL_GetTicks();
234 engine->keyState[SDL_SCANCODE_ESCAPE] = 0;
240 if (SDL_GetTicks() >= then + time)
248 if (engine->keyState[SDL_SCANCODE_ESCAPE])
256 void Graphics::RGBtoHSV(float r, float g, float b, float *h, float *s, float *v)
259 mn = min(min(r, g), b);
260 mx = max(max(r, g), b);
277 *h = (g - b) / delta;
281 *h = 2 + (b - r) / delta;
285 *h = 4 + (r - g) / delta;
296 void Graphics::HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
311 t = v * (1 - s * (1 - f));
353 SDL_Surface *Graphics::loadImage(const char *filename, bool srcalpha)
355 SDL_Surface *image, *newImage;
358 if (!engine->unpack(filename, PAK_IMG))
359 showErrorAndExit(ERR_FILE, filename);
360 image = IMG_Load_RW(engine->sdlrw, 1);
362 image = IMG_Load(filename);
366 return showErrorAndExit(ERR_FILE, filename), image;
368 newImage = SDL_ConvertSurface(image, screen->format, 0);
372 SDL_FreeSurface(image);
376 // This happens when we are loading the window icon image
381 SDL_SetAlpha(newImage, 255);
383 setTransparent(newImage);
388 SDL_Surface *Graphics::loadImage(const char *filename, int hue, int sat, int value)
390 SDL_Surface *image, *newImage;
393 if (!engine->unpack(filename, PAK_IMG))
394 showErrorAndExit(ERR_FILE, filename);
395 image = IMG_Load_RW(engine->sdlrw, 1);
397 image = IMG_Load(filename);
401 return showErrorAndExit(ERR_FILE, filename), image;
403 if ((hue != 0) || (sat != 0) || (value != 0))
405 if (image->format->BitsPerPixel != 8)
407 debug(("WARNING: Could not set Hue for '%s'! Not an 8 bit image!\n", filename));
412 float r, g, b, h, s, v;
414 if (image->format->palette->colors != NULL)
416 for (int i = 1 ; i < image->format->palette->ncolors ; i++)
418 color = &image->format->palette->colors[i];
424 RGBtoHSV(r, g, b, &h, &s, &v);
430 HSVtoRGB(&r, &g, &b, h, s, v);
441 newImage = SDL_ConvertSurface(image, screen->format, 0);
445 SDL_FreeSurface(image);
449 // This happens when we are loading the window icon image
453 setTransparent(newImage);
458 SDL_Surface *Graphics::quickSprite(const char *name, SDL_Surface *image)
460 Sprite *sprite = addSprite(name);
461 sprite->setFrame(0, image, 60);
463 return sprite->getCurrentFrame();
466 void Graphics::fade(int amount)
468 SDL_SetAlpha(fadeBlack, amount);
469 blit(fadeBlack, 0, 0, screen, false);
472 void Graphics::fadeToBlack()
478 SDL_SetAlpha(fadeBlack, start);
479 blit(fadeBlack, 0, 0, screen, false);
485 void Graphics::loadMapTiles(const char *baseDir)
487 bool found, autoAlpha;
493 if (strcmp(baseDir, "gfx/common") == 0)
502 for (int i = 1 ; i < MAX_TILES ; i++)
506 snprintf(filename, sizeof filename, "%s/%d.png", baseDir, i);
510 if (!engine->getPak()->fileExists(filename))
515 fp = fopen(filename, "rb");
524 tile[i] = loadImage(filename);
531 if ((i < MAP_EXITSIGN) || (i >= MAP_WATERANIM))
533 SDL_SetAlpha(tile[i], 130);
538 if (i < MAP_DECORATION)
540 SDL_SetColorKey(tile[i], 0, SDL_MapRGB(tile[i]->format, 0, 0, 0));
547 void Graphics::loadFont(int i, const char *filename, int pointSize)
549 debug(("Attempting to load font %s with point size of %d...\n", filename, pointSize));
553 debug(("Freeing Font %d first...\n", i));
554 TTF_CloseFont(font[i]);
559 char tempPath[PATH_MAX];
560 snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine->userHomeDirectory);
561 font[i] = TTF_OpenFont(tempPath, pointSize);
563 font[i] = TTF_OpenFont(filename, pointSize);
568 engine->reportFontFailure();
571 TTF_SetFontStyle(font[i], TTF_STYLE_NORMAL);
574 Sprite *Graphics::addSprite(const char *name)
576 Sprite *sprite = new Sprite;
577 strlcpy(sprite->name, name, sizeof sprite->name);
579 spriteList.add(sprite);
584 Sprite *Graphics::getSprite(const char *name, bool required)
586 Sprite *sprite = (Sprite*)spriteList.getHead();
588 while (sprite->next != NULL)
590 sprite = (Sprite*)sprite->next;
592 if (strcmp(sprite->name, name) == 0)
599 showErrorAndExit("The requested sprite '%s' does not exist", name);
604 void Graphics::animateSprites()
606 Sprite *sprite = (Sprite*)spriteList.getHead();
608 while (sprite->next != NULL)
610 sprite = (Sprite*)sprite->next;
615 if ((engine->getFrameLoop() % 8) == 0)
617 Math::wrapInt(&(++waterAnim), 201, 204);
618 Math::wrapInt(&(++slimeAnim), 207, 212);
619 Math::wrapInt(&(++lavaAnim), 214, 220);
623 int Graphics::getWaterAnim() const
628 int Graphics::getSlimeAnim() const
633 int Graphics::getLavaAnim() const
638 int Graphics::getLavaAnim(int current)
640 if ((engine->getFrameLoop() % 8) == 0)
641 return Math::rrand(214, 220);
646 void Graphics::loadBackground(const char *filename)
648 if (background != NULL)
649 SDL_FreeSurface(background);
651 if (strcmp(filename, "@none@") == 0)
654 background = loadImage(filename);
656 SDL_SetColorKey(background, 0, SDL_MapRGB(background->format, 0, 0, 0));
659 void Graphics::putPixel(int x, int y, Uint32 pixel, SDL_Surface *dest)
661 if ((x < 0) || (x > 639) || (y < 0) || (y > 479))
664 int bpp = dest->format->BytesPerPixel;
665 /* Here p is the address to the pixel we want to set */
666 Uint8 *p = (Uint8 *)dest->pixels + y * dest->pitch + x * bpp;
675 *(Uint16 *)p = pixel;
679 if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
681 p[0] = (pixel >> 16) & 0xff;
682 p[1] = (pixel >> 8) & 0xff;
688 p[1] = (pixel >> 8) & 0xff;
689 p[2] = (pixel >> 16) & 0xff;
694 *(Uint32 *)p = pixel;
699 Uint32 Graphics::getPixel(SDL_Surface *surface, int x, int y)
701 if ((x < 0) || (x > (surface->w - 1)) || (y < 0) || (y > (surface->h - 1)))
704 int bpp = surface->format->BytesPerPixel;
705 Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
715 if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
716 return p[0] << 16 | p[1] << 8 | p[2];
718 return p[0] | p[1] << 8 | p[2] << 16;
724 return 0; /* shouldn't happen, but avoids warnings */
728 void Graphics::drawLine(float startX, float startY, float endX, float endY, int color, SDL_Surface *dest)
734 Math::calculateSlope(startX, startY, endX, endY, &dx, &dy);
738 putPixel((int)startX, (int)startY, color, dest);
740 if ((int)startX == (int)endX)
750 void Graphics::blit(SDL_Surface *image, int x, int y, SDL_Surface *dest, bool centered)
754 return showErrorAndExit("graphics::blit() - NULL pointer", SDL_GetError());
757 if ((x < -image->w) || (x > 640 + image->w))
760 if ((y < -image->h) || (y > 480 + image->h))
763 // Set up a rectangle to draw to
768 gRect.x -= (image->w / 2);
769 gRect.y -= (image->h / 2);
775 /* Blit onto the screen surface */
776 if (SDL_BlitSurface(image, NULL, dest, &gRect) < 0)
777 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
780 void Graphics::drawBackground()
782 if (background != NULL)
783 blit(background, 0, 0, screen, false);
785 SDL_FillRect(screen, NULL, black);
788 void Graphics::drawBackground(SDL_Rect *r)
790 if (r->x < 0) r->x = 0;
791 if (r->y < 0) r->y = 0;
792 if (r->x + r->w > 639) r->w = 640 - r->x;
793 if (r->y + r->h > 639) r->h = 480 - r->y;
795 if (SDL_BlitSurface(background, r, screen, r) < 0)
796 showErrorAndExit("graphics::blit() - %s", SDL_GetError());
799 void Graphics::drawRect(int x, int y, int w, int h, int color, SDL_Surface *dest)
806 SDL_FillRect(dest, &gRect, color);
809 void Graphics::drawRect(int x, int y, int w, int h, int color, int borderColor, SDL_Surface *dest)
811 drawRect(x - 1, y - 1, w + 2, h + 2, borderColor, dest);
812 drawRect(x, y, w, h, color, dest);
815 void Graphics::setFontColor(int red, int green, int blue, int red2, int green2, int blue2)
817 fontForeground.r = red;
818 fontForeground.g = green;
819 fontForeground.b = blue;
821 fontBackground.r = red2;
822 fontBackground.g = green2;
823 fontBackground.b = blue2;
826 void Graphics::setFontSize(int size)
829 Math::limitInt(&fontSize, 0, 4);
832 SDL_Surface *Graphics::getString(const char *in, bool transparent)
834 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
838 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
843 fprintf(stderr, "Unable to render text: %s\n", SDL_GetError());
848 setTransparent(text);
853 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest)
857 SDL_Surface *text = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
860 text = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
865 setTransparent(text);
867 if (alignment == TXT_RIGHT) x -= text->w;
868 if (alignment == TXT_CENTERED) center = true;
870 blit(text, x, y, dest, center);
871 SDL_FreeSurface(text);
874 void Graphics::drawString(const char *in, int x, int y, int alignment, SDL_Surface *dest, SurfaceCache &cache)
878 if(!cache.text || strcmp(in, cache.text)) {
880 SDL_FreeSurface(cache.surface);
885 cache.text = strdup(in);
887 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], in, fontForeground, fontBackground);
890 cache.surface = TTF_RenderUTF8_Shaded(font[fontSize], "FONT_ERROR", fontForeground, fontBackground);
895 setTransparent(cache.surface);
898 if (alignment == TXT_RIGHT) x -= cache.surface->w;
899 if (alignment == TXT_CENTERED) center = true;
901 blit(cache.surface, x, y, dest, center);
904 void Graphics::clearChatString()
909 void Graphics::createChatString(const char *in)
911 strlcat(chatString, " ", sizeof chatString);
912 strlcat(chatString, in, sizeof chatString);
915 void Graphics::drawChatString(SDL_Surface *surface, int y)
917 char *word = strtok(chatString, " ");
918 char wordWithSpace[100];
923 int surfaceWidth = surface->w - 10;
925 SDL_Surface *wordSurface;
929 if (strcmp(word, "<RGB>") == 0)
931 r = atoi(strtok(NULL, " "));
932 g = atoi(strtok(NULL, " "));
933 b = atoi(strtok(NULL, " "));
935 if ((!r) && (!g) && (!b))
937 debug(("Parse Error in Text Color (%d:%d:%d)!!\n", r, g, b));
941 setFontColor(r, g, b, 0, 0, 0);
943 word = strtok(NULL, " ");
948 snprintf(wordWithSpace, sizeof wordWithSpace, "%s ", word);
950 wordSurface = getString(wordWithSpace, false);
952 if (x + wordSurface->w > surfaceWidth)
954 y += (int)(wordSurface->h * 1.5) ;
958 blit(wordSurface, x, y, surface, false);
962 SDL_FreeSurface(wordSurface);
964 word = strtok(NULL, " ");
968 void Graphics::showMedalMessage(int type, const char *in)
972 if (medalMessage != NULL)
974 SDL_FreeSurface(medalMessage);
983 setFontColor(0xA6, 0x7D, 0x3D, 0x00, 0x00, 0x00);
988 setFontColor(0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00);
993 setFontColor(0xFF, 0xCC, 0x33, 0x00, 0x00, 0x00);
998 setFontColor(0xFF, 0x11, 0x55, 0x00, 0x00, 0x00);
1002 medalType = type - 1; // for indexing on the image
1005 snprintf(message, sizeof message, " Medal Earned - %s ", in);
1006 medalMessage = getString(message, true);
1010 snprintf(message, sizeof message, " %s ", in);
1011 medalMessage = getString(message, true);
1013 medalMessageTimer = (5 * 60);
1016 void Graphics::drawWidgetRect(int x, int y, int w, int h)
1018 drawRect(x - 5, y - 4, w + 10, h + 8, white, screen);
1019 drawRect(x - 4, y - 3, w + 8, h + 6, black, screen);
1020 drawRect(x - 3, y - 2, w + 6, h + 4, green, screen);
1023 SDL_Surface *Graphics::createSurface(int width, int height)
1025 SDL_Surface *surface, *newImage;
1027 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
1029 if (surface == NULL)
1030 showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError());
1032 newImage = SDL_ConvertSurface(surface, screen->format, 0);
1034 SDL_FreeSurface(surface);
1039 SDL_Surface *Graphics::alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
1041 SDL_Surface *surface = createSurface(width, height);
1043 SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, red, green, blue));
1045 SDL_SetAlpha(surface, 130);
1050 void Graphics::colorize(SDL_Surface *image, int red, int green, int blue)
1052 SDL_Surface *alpha = alphaRect(image->w, image->h, red, green, blue);
1054 blit(alpha, 0, 0, image, false);
1056 SDL_SetColorKey(image, SDL_TRUE, SDL_MapRGB(image->format, red / 2, green / 2, blue / 2));
1059 void Graphics::lock(SDL_Surface *surface)
1061 /* Lock the screen for direct access to the pixels */
1062 if (SDL_MUSTLOCK(surface))
1064 if (SDL_LockSurface(surface) < 0 )
1066 showErrorAndExit("Could not lock surface", "");
1071 void Graphics::unlock(SDL_Surface *surface)
1073 if (SDL_MUSTLOCK(surface))
1075 SDL_UnlockSurface(surface);
1079 void Graphics::resetLoading()
1084 void Graphics::showLoading(int amount, int max)
1092 Math::limitInt(&(currentLoading += amount), 0, max);
1094 drawRect(120, 420, 400, 10, black, white, screen);
1095 drawRect(121, 421, currentLoading, 8, red, screen);
1102 void Graphics::showLicenseErrorAndExit()
1104 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1105 drawString("License Agreement Missing", 320, 50, true, screen);
1107 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1109 drawString("The GNU General Public License was not found.", 320, 180, true, screen);
1110 drawString("It could either not be properly loaded or has been removed.", 320, 220, true, screen);
1111 drawString("Blob Wars : Metal Blob Solid will not run with the license missing.", 320, 260, true, screen);
1113 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1114 drawString("Press Escape to continue", 320, 450, true, screen);
1116 engine->flushInput();
1122 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1128 void Graphics::showErrorAndExit(const char *error, const char *param)
1130 SDL_FillRect(screen, NULL, black);
1132 if (strcmp(param, "LICENSE") == 0)
1134 showLicenseErrorAndExit();
1138 snprintf(message, sizeof message, error, param);
1140 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1141 drawString("An unforseen error has occurred", 320, 50, true, screen);
1142 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1143 drawString(message, 320, 90, true, screen);
1145 drawString("You may wish to try the following,", 50, 150, false, screen);
1148 drawString("1) Try reinstalling the game.", 75, 190, false, screen);
1149 drawString("2) Ensure you have SDL 1.2.5 or greater installed.", 75, 210, false, screen);
1150 drawString("3) Ensure you have the latest versions of additional required SDL libraries.", 75, 230, false, screen);
1151 drawString("4) Install using an RPM if you originally built the game from source", 75, 250, false, screen);
1152 drawString("or try building from source if you installed using an RPM.", 75, 270, false, screen);
1153 drawString("5) Visit http://www.parallelrealities.co.uk/blobWars.php and check for updates.", 75, 290, false, screen);
1157 drawString("If problems persist contact Parallel Realities. Please be aware however that we will not", 320, 360, true, screen);
1158 drawString("be able to assist in cases where the code or data has been modified.", 320, 380, true, screen);
1160 drawString("Blob Wars : Metal Blob Solid will now exit", 320, 420, true, screen);
1161 drawString("Press Escape to continue", 320, 450, true, screen);
1163 engine->flushInput();
1169 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1177 void Graphics::showRootWarning()
1179 setFontSize(3); setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
1180 drawString("CAUTION - RUNNING AS ROOT USER!", 320, 50, true, screen);
1182 setFontSize(1); setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
1184 drawString("WARNING - You appear to be running the game as the root user!", 320, 180, true, screen);
1185 drawString("This is not recommended and is it strongly advised that you do not run", 320, 220, true, screen);
1186 drawString("the game as root. You may still continue but consider running as regular user in future!", 320, 260, true, screen);
1188 drawString("Press Space to Exit", 320, 420, true, screen);
1189 drawString("Press Escape to Continue", 320, 450, true, screen);
1191 engine->flushInput();
1198 if (engine->keyState[SDL_SCANCODE_ESCAPE])
1202 else if (engine->keyState[SDL_SCANCODE_SPACE])