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.

142 lines
4.8 KiB

  1. /**********************************************************************************************
  2. *
  3. * raylib - transmission mission
  4. *
  5. * Screens Functions Declarations (Init, Update, Draw, Unload)
  6. *
  7. * Copyright (c) 2014-2019 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. #ifndef SCREENS_H
  26. #define SCREENS_H
  27. #define MAX_CODING_WORDS 12
  28. #define MAX_MISSION_WORDS 8
  29. //----------------------------------------------------------------------------------
  30. // Types and Structures Definition
  31. //----------------------------------------------------------------------------------
  32. typedef enum GameScreen { LOGO = 0, TITLE, MISSION, GAMEPLAY, ENDING } GameScreen;
  33. // Words to be coded or coding words
  34. typedef struct Word {
  35. int id;
  36. Rectangle rec;
  37. Rectangle iniRec;
  38. bool hover;
  39. bool picked;
  40. char text[32]; // text
  41. } Word;
  42. // Mission information
  43. typedef struct Mission {
  44. int id;
  45. char brief[512]; // Mission briefing
  46. char key[32]; // Mission keyword
  47. char msg[256]; // Message to be coded
  48. int wordsCount; // Number of words to coded
  49. int sols[10]; // Solution code, depends on wordsCount
  50. } Mission;
  51. //----------------------------------------------------------------------------------
  52. // Global Variables Definition
  53. //----------------------------------------------------------------------------------
  54. GameScreen currentScreen;
  55. Music music;
  56. Sound fxButton;
  57. //Mission *missions;
  58. // UI BUTTON
  59. Rectangle recButton;
  60. float fadeButton;
  61. Color colorButton;
  62. Texture2D texButton;
  63. Vector2 textPositionButton;
  64. int fontSizeButton;
  65. Color textColorButton;
  66. int currentMission;
  67. int totalMissions;
  68. Font fontMission;
  69. Word messageWords[MAX_MISSION_WORDS];
  70. #ifdef __cplusplus
  71. extern "C" { // Prevents name mangling of functions
  72. #endif
  73. //----------------------------------------------------------------------------------
  74. // Transmission Functions Declaration
  75. //----------------------------------------------------------------------------------
  76. bool IsButtonPressed();
  77. void DrawButton(const char *text);
  78. Mission *LoadMissions(const char *fileName);
  79. //----------------------------------------------------------------------------------
  80. // Logo Screen Functions Declaration
  81. //----------------------------------------------------------------------------------
  82. void InitLogoScreen(void);
  83. void UpdateLogoScreen(void);
  84. void DrawLogoScreen(void);
  85. void UnloadLogoScreen(void);
  86. int FinishLogoScreen(void);
  87. //----------------------------------------------------------------------------------
  88. // Title Screen Functions Declaration
  89. //----------------------------------------------------------------------------------
  90. void InitTitleScreen(void);
  91. void UpdateTitleScreen(void);
  92. void DrawTitleScreen(void);
  93. void UnloadTitleScreen(void);
  94. int FinishTitleScreen(void);
  95. //----------------------------------------------------------------------------------
  96. // Mission Screen Functions Declaration
  97. //----------------------------------------------------------------------------------
  98. void InitMissionScreen(void);
  99. void UpdateMissionScreen(void);
  100. void DrawMissionScreen(void);
  101. void UnloadMissionScreen(void);
  102. int FinishMissionScreen(void);
  103. //----------------------------------------------------------------------------------
  104. // Gameplay Screen Functions Declaration
  105. //----------------------------------------------------------------------------------
  106. void InitGameplayScreen(void);
  107. void UpdateGameplayScreen(void);
  108. void DrawGameplayScreen(void);
  109. void UnloadGameplayScreen(void);
  110. int FinishGameplayScreen(void);
  111. //----------------------------------------------------------------------------------
  112. // Ending Screen Functions Declaration
  113. //----------------------------------------------------------------------------------
  114. void InitEndingScreen(void);
  115. void UpdateEndingScreen(void);
  116. void DrawEndingScreen(void);
  117. void UnloadEndingScreen(void);
  118. int FinishEndingScreen(void);
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122. #endif // SCREENS_H