variables.d 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // quantumde1 developed software, licensed under MIT license.
  2. module variables;
  3. import std.typecons;
  4. import raylib;
  5. import bindbc.lua;
  6. import system.abstraction;
  7. nothrow void resetAllScriptValues() {
  8. debugWriteln("Resetting all values!");
  9. selectedChoice = 0;
  10. foreach (i; 0..characterTextures.length)
  11. {
  12. characterTextures[i].drawTexture = false;
  13. UnloadTexture(characterTextures[i].texture);
  14. }
  15. foreach (i; 0..backgroundTextures.length)
  16. {
  17. backgroundTextures[i].drawTexture = false;
  18. UnloadTexture(backgroundTextures[i].texture);
  19. }
  20. characterTextures = [];
  21. backgroundTextures = [];
  22. }
  23. /* system */
  24. struct SystemSettings {
  25. int sound_state;
  26. char right_button;
  27. char left_button;
  28. char back_button;
  29. char forward_button;
  30. char dialog_button;
  31. char opmenu_button;
  32. string script_path;
  33. }
  34. struct TextureEngine {
  35. bool drawTexture;
  36. bool justDrawn;
  37. float width;
  38. float height;
  39. float x;
  40. float y;
  41. Texture2D texture;
  42. float scale;
  43. float alpha = 0.0f;
  44. float targetAlpha = 0.0f;
  45. float fadeSpeed = 9.0f;
  46. bool isFading = false;
  47. }
  48. enum GameState {
  49. MainMenu = 1,
  50. InGame = 2,
  51. Exit = 3
  52. }
  53. enum EngineExitCodes {
  54. EXIT_FILE_NOT_FOUND = 2,
  55. EXIT_SCRIPT_ERROR = 3,
  56. EXIT_OK = 0,
  57. }
  58. Camera2D camera;
  59. Camera2D oldCamera;
  60. TextureEngine[] characterTextures;
  61. TextureEngine[] backgroundTextures;
  62. SystemSettings systemSettings;
  63. int currentGameState = 1;
  64. Font textFont;
  65. Music music;
  66. Color characterColor = Color(255, 255, 255);
  67. /* booleans */
  68. bool playAnimation = false;
  69. bool luaReload = true;
  70. bool videoFinished = false;
  71. bool isCameraMoving = false;
  72. bool showDialog = false;
  73. bool isTextFullyDisplayed = false;
  74. /* strings */
  75. string[] messageGlobal;
  76. string[] choices;
  77. string luaExec;
  78. /* floats */
  79. float cameraTargetX = 0;
  80. float cameraTargetY = 0;
  81. float cameraTargetZoom = 1.0f;
  82. float cameraMoveSpeed = 5.0f;
  83. float frameDuration = 0.016f;
  84. float typingSpeed = 0.6f;
  85. /* textures */
  86. Texture2D[] framesUI;
  87. Texture2D dialogBackgroundTex;
  88. Texture2D choiceWindowTex;
  89. Texture2D circle;
  90. /* integer values */
  91. int button;
  92. int selectedChoice = 0;
  93. int choicePage = -1;
  94. int currentFrame = 0;
  95. int currentChoiceCharIndex = 0;
  96. /* lua */
  97. lua_State* L;