You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.0 KiB

  1. /**********************************************************************************************
  2. *
  3. * raylib - Advance Game template
  4. *
  5. * Ending Screen Functions Definitions (Init, Update, Draw, Unload)
  6. *
  7. * Copyright (c) 2014 Ramon Santamaria (@raysan5)
  8. *
  9. * This software is provided "as-is", without any express or implied warranty. In no event
  10. * will the authors be held liable for any damages arising from the use of this software.
  11. *
  12. * Permission is granted to anyone to use this software for any purpose, including commercial
  13. * applications, and to alter it and redistribute it freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not claim that you
  16. * wrote the original software. If you use this software in a product, an acknowledgment
  17. * in the product documentation would be appreciated but is not required.
  18. *
  19. * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  20. * as being the original software.
  21. *
  22. * 3. This notice may not be removed or altered from any source distribution.
  23. *
  24. **********************************************************************************************/
  25. #include "raylib.h"
  26. #include "screens.h"
  27. //----------------------------------------------------------------------------------
  28. // Global Variables Definition (local to this module)
  29. //----------------------------------------------------------------------------------
  30. // Ending screen global variables
  31. static int framesCounter;
  32. static int finishScreen;
  33. static float alpha = 0.0f;
  34. //----------------------------------------------------------------------------------
  35. // Ending Screen Functions Definition
  36. //----------------------------------------------------------------------------------
  37. // Ending Screen Initialization logic
  38. void InitEndingScreen(void)
  39. {
  40. // TODO: Initialize ENDING screen variables here!
  41. framesCounter = 0;
  42. finishScreen = 0;
  43. alpha = 0.0f;
  44. }
  45. // Ending Screen Update logic
  46. void UpdateEndingScreen(void)
  47. {
  48. // TODO: Update ENDING screen variables here!
  49. framesCounter++;
  50. alpha += 0.005f;
  51. if (alpha >= 1.0f) alpha = 1.0f;
  52. // Press enter to change to ATTIC screen
  53. if ((IsKeyPressed(KEY_ENTER)) || (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
  54. {
  55. finishScreen = 1;
  56. }
  57. }
  58. // Ending Screen Draw logic
  59. void DrawEndingScreen(void)
  60. {
  61. DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), DARKGRAY);
  62. DrawTextEx(font, "CONGRATULATIONS!", (Vector2){ 50, 160 }, font.baseSize*3, 2, Fade(WHITE, alpha));
  63. DrawTextEx(font, "SKULLY ESCAPED!", (Vector2){ 100, 300 }, font.baseSize*3, 2, Fade(WHITE, alpha));
  64. if ((framesCounter > 180) && ((framesCounter/40)%2)) DrawText("PRESS ENTER or CLICK", 380, 545, 40, BLACK);
  65. }
  66. // Ending Screen Unload logic
  67. void UnloadEndingScreen(void)
  68. {
  69. // TODO: Unload ENDING screen variables here!
  70. }
  71. // Ending Screen should finish?
  72. int FinishEndingScreen(void)
  73. {
  74. return finishScreen;
  75. }