variables.d 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. string scriptPath;
  26. string windowTitle;
  27. string iconPath;
  28. string dialogBoxEndIndicator;
  29. string dialogBoxImage;
  30. string choiceBoxImage;
  31. string fallbackFont;
  32. }
  33. struct TextureEngine {
  34. bool drawTexture;
  35. bool justDrawn;
  36. float width;
  37. float height;
  38. float x;
  39. float y;
  40. Texture2D texture;
  41. float scale;
  42. float alpha = 0.0f;
  43. float targetAlpha = 0.0f;
  44. float fadeSpeed = 9.0f;
  45. bool isFading = false;
  46. }
  47. enum GameState {
  48. MainMenu = 1,
  49. InGame = 2,
  50. Exit = 3
  51. }
  52. enum EngineExitCodes {
  53. EXIT_FILE_NOT_FOUND = 2,
  54. EXIT_SCRIPT_ERROR = 3,
  55. EXIT_OK = 0,
  56. }
  57. Camera2D camera;
  58. Camera2D oldCamera;
  59. TextureEngine[] characterTextures;
  60. TextureEngine[] backgroundTextures;
  61. SystemSettings systemSettings;
  62. int currentGameState = 1;
  63. Font textFont;
  64. Music music;
  65. Color characterColor = Color(255, 255, 255);
  66. /* booleans */
  67. bool playAnimation = false;
  68. bool luaReload = true;
  69. bool videoFinished = false;
  70. bool isCameraMoving = false;
  71. bool showDialog = false;
  72. bool isTextFullyDisplayed = false;
  73. /* strings */
  74. string[] messageGlobal;
  75. string[] choices;
  76. string luaExec;
  77. /* floats */
  78. float cameraTargetX = 0;
  79. float cameraTargetY = 0;
  80. float cameraTargetZoom = 1.0f;
  81. float cameraMoveSpeed = 5.0f;
  82. float frameDuration = 0.016f;
  83. float typingSpeed = 0.6f;
  84. /* textures */
  85. Texture2D[] framesUI;
  86. Texture2D dialogBackgroundTex;
  87. Texture2D choiceWindowTex;
  88. Texture2D circle;
  89. /* integer values */
  90. int button;
  91. int selectedChoice = 0;
  92. int choicePage = -1;
  93. int currentFrame = 0;
  94. int currentChoiceCharIndex = 0;
  95. /* lua */
  96. lua_State* L;