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