Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

88 righe
2.8 KiB

  1. /**********************************************************************************************
  2. *
  3. * raylib - Advance Game template
  4. *
  5. * Logo Screen Functions Definitions (Init, Update, Draw, Unload)
  6. *
  7. * Copyright (c) 2014-2018 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. // Logo screen global variables
  31. static int framesCounter;
  32. static int finishScreen;
  33. static Texture2D logo;
  34. //----------------------------------------------------------------------------------
  35. // Logo Screen Functions Definition
  36. //----------------------------------------------------------------------------------
  37. // Logo Screen Initialization logic
  38. void InitLogoScreen(void)
  39. {
  40. // TODO: Initialize LOGO screen variables here!
  41. framesCounter = 0;
  42. finishScreen = 0;
  43. logo = LoadTexture("resources/raylib_logo.png");
  44. }
  45. // Logo Screen Update logic
  46. void UpdateLogoScreen(void)
  47. {
  48. // TODO: Update LOGO screen variables here!
  49. framesCounter++; // Count frames
  50. // Wait for 2 seconds (120 frames) before jumping to TITLE screen
  51. if (framesCounter > 120)
  52. {
  53. finishScreen = true;
  54. }
  55. }
  56. // Logo Screen Draw logic
  57. void DrawLogoScreen(void)
  58. {
  59. // TODO: Draw LOGO screen here!
  60. DrawTextEx(font, "LOGO SCREEN", (Vector2){ 20, 10 }, font.baseSize*3, 4, GRAY);
  61. DrawText("WAIT for 2 SECONDS...", 290, 400, 20, GRAY);
  62. DrawTexture(logo, GetScreenWidth()/2 - logo.width/2, 100, WHITE);
  63. }
  64. // Logo Screen Unload logic
  65. void UnloadLogoScreen(void)
  66. {
  67. // TODO: Unload LOGO screen variables here!
  68. UnloadTexture(logo);
  69. }
  70. // Logo Screen should finish?
  71. int FinishLogoScreen(void)
  72. {
  73. return finishScreen;
  74. }