ComponentsManager.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #include "EmulatorComponent.h"
  3. #include "../Utilities/Stopwatch.h"
  4. #include <vector>
  5. #include <string>
  6. namespace TLAC::Components
  7. {
  8. const std::string COMPONENTS_CONFIG_FILE_NAME = "components.ini";
  9. // Incomplete type
  10. struct DwGuiDisplay
  11. {
  12. void* vftable;
  13. void* active;
  14. void* cap;
  15. void* on;
  16. void* move;
  17. void* widget;
  18. };
  19. class ComponentsManager
  20. {
  21. public:
  22. ComponentsManager();
  23. ~ComponentsManager();
  24. void Initialize();
  25. void Update();
  26. void UpdateInput();
  27. void UpdatePostInput();
  28. void UpdateDraw2D();
  29. void OnFocusGain();
  30. void OnFocusLost();
  31. void Dispose();
  32. inline bool GetIsInputEmulatorUsed() { return isInputEmulatorUsed; };
  33. inline void SetIsInputEmulatorUsed(bool value) { isInputEmulatorUsed = value; };
  34. inline bool GetUpdateGameInput() { return updateGameInput; };
  35. inline void SetUpdateGameInput(bool value) { updateGameInput = value; }
  36. inline bool IsDwGuiActive() { return dwGuiDisplay->active != nullptr; };
  37. inline bool IsDwGuiHovered() { return dwGuiDisplay->on != nullptr; };
  38. private:
  39. DwGuiDisplay* dwGuiDisplay;
  40. bool isInputEmulatorUsed = false;
  41. bool updateGameInput = true;
  42. float elpasedTime;
  43. Utilities::Stopwatch updateStopwatch;
  44. std::vector<EmulatorComponent*> components;
  45. void ParseAddComponents();
  46. };
  47. }