variables.d 2.1 KB

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