variables.d 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. import graphics.collision;
  8. nothrow void resetAllScriptValues() {
  9. debugWriteln("Resetting all values!");
  10. selectedChoice = 0;
  11. foreach (i; 0..characterTextures.length)
  12. {
  13. characterTextures[i].drawTexture = false;
  14. UnloadTexture(characterTextures[i].texture);
  15. }
  16. foreach (i; 0..backgroundTextures.length)
  17. {
  18. backgroundTextures[i].drawTexture = false;
  19. UnloadTexture(backgroundTextures[i].texture);
  20. }
  21. characterTextures = [];
  22. backgroundTextures = [];
  23. }
  24. /* system */
  25. struct SystemSettings {
  26. string scriptPath;
  27. string menuScriptPath;
  28. string windowTitle;
  29. string iconPath;
  30. string dialogBoxEndIndicator;
  31. string dialogBoxBackground;
  32. string fallbackFont;
  33. int defaultScreenWidth;
  34. int defaultScreenHeight;
  35. int screenWidth;
  36. int screenHeight;
  37. bool defaultFullscreen;
  38. }
  39. struct TextureEngine {
  40. bool drawTexture;
  41. bool justDrawn;
  42. float width;
  43. float height;
  44. float x;
  45. float y;
  46. Texture2D texture;
  47. float scale;
  48. Color color = Colors.WHITE;
  49. float alpha = 0.0f;
  50. float targetAlpha = 0.0f;
  51. float fadeSpeed = 9.0f;
  52. bool isFading = false;
  53. }
  54. enum GameState {
  55. MainMenu = 1,
  56. InGame = 2,
  57. Exit = 3
  58. }
  59. enum EngineExitCodes {
  60. EXIT_FILE_NOT_FOUND = 2,
  61. EXIT_SCRIPT_ERROR = 3,
  62. EXIT_OK = 0,
  63. }
  64. Camera3D camera;
  65. OBB[] collisions;
  66. TextureEngine[] characterTextures;
  67. TextureEngine[] backgroundTextures;
  68. SystemSettings systemSettings;
  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 frameDuration = 0.016f;
  86. float typingSpeed = 0.6f;
  87. float scale = 1.0f;
  88. float acceleration = 0.2f;
  89. float maxVelocity = 10.0f;
  90. float currentVelocity = 0.0f;
  91. /* textures */
  92. Texture2D[] framesUI;
  93. Texture2D dialogBackgroundTex;
  94. Texture2D circle;
  95. /* integer values */
  96. int button;
  97. int selectedChoice = 0;
  98. int choicePage = -1;
  99. int currentGameState = 1;
  100. int currentFrame = 0;
  101. int currentChoiceCharIndex = 0;
  102. int playerCollisionIndex = 0; //default, can be changed via setter function in graphics.collision
  103. /* ubyte values */
  104. ubyte animationAlpha = 127;
  105. /* lua */
  106. lua_State* L;