variables.d 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. extern (C) char* get_file_data_from_archive(const char *input_file, const char *file_name, uint *file_size_out);
  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. int sound_state;
  27. char right_button;
  28. char left_button;
  29. char back_button;
  30. char forward_button;
  31. char dialog_button;
  32. char opmenu_button;
  33. string script_path;
  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. float alpha = 0.0f;
  45. float targetAlpha = 0.0f;
  46. float fadeSpeed = 9.0f;
  47. bool isFading = false;
  48. }
  49. enum GameState {
  50. MainMenu = 1,
  51. InGame = 2,
  52. Exit = 3
  53. }
  54. enum EngineExitCodes {
  55. EXIT_FILE_NOT_FOUND = 2,
  56. EXIT_SCRIPT_ERROR = 3,
  57. EXIT_OK = 0,
  58. }
  59. Camera2D camera;
  60. Camera2D oldCamera;
  61. TextureEngine[] characterTextures;
  62. TextureEngine[] backgroundTextures;
  63. SystemSettings systemSettings;
  64. int currentGameState = 1;
  65. Font textFont;
  66. Music music;
  67. Color characterColor = Color(255, 255, 255);
  68. /* booleans */
  69. bool playAnimation = false;
  70. bool audioEnabled = false;
  71. bool sfxEnabled = false;
  72. bool fullscreenEnabled = true;
  73. bool luaReload = true;
  74. bool videoFinished = false;
  75. bool isCameraMoving = false;
  76. bool neededCharacterDrawing = false;
  77. bool showDialog = false;
  78. bool isTextFullyDisplayed = false;
  79. /* strings */
  80. string ver = "1.1.8";
  81. string[] messageGlobal;
  82. string[] choices;
  83. string[] backlogText;
  84. string luaExec;
  85. char* musicPath;
  86. /* floats */
  87. float cameraTargetX = 0;
  88. float cameraTargetY = 0;
  89. float cameraTargetZoom = 1.0f;
  90. float cameraMoveSpeed = 5.0f;
  91. float frameDuration = 0.016f;
  92. float typingSpeed = 0.6f;
  93. /* textures */
  94. Texture2D[] framesUI;
  95. Texture2D dialogBackgroundTex;
  96. Texture2D choiceWindowTex;
  97. Texture2D circle;
  98. /* integer values */
  99. int button;
  100. int selectedChoice = 0;
  101. int choicePage = -1;
  102. int currentFrame = 0;
  103. int currentChoiceCharIndex = 0;
  104. /* lua */
  105. lua_State* L;