variables.d 2.4 KB

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