www
www
This commit is contained in:
1 parent
3933cd1901
commit
0aa65c433d
98 files changed
+56670
No files matched your search
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
enum class ModuleCategory : uint8_t {
|
||||
Player,
|
||||
ESP,
|
||||
World,
|
||||
Visual,
|
||||
Internal,
|
||||
};
|
||||
|
||||
class BaseModule {
|
||||
public:
|
||||
BaseModule(std::string module_name, std::string tab_label, ModuleCategory category)
|
||||
: name_(std::move(module_name)),
|
||||
tab_label_(std::move(tab_label)),
|
||||
category_(category) {}
|
||||
|
||||
virtual ~BaseModule() = default;
|
||||
|
||||
virtual void RegisterTab() = 0;
|
||||
virtual void Render() = 0;
|
||||
virtual void Update() = 0;
|
||||
virtual void OnHotkey() {}
|
||||
|
||||
const std::string& Name() const { return name_; }
|
||||
const std::string& TabLabel() const { return tab_label_; }
|
||||
ModuleCategory Category() const { return category_; }
|
||||
|
||||
bool Enabled() const { return enabled_; }
|
||||
void SetEnabled(bool value) { enabled_ = value; }
|
||||
|
||||
protected:
|
||||
std::string name_;
|
||||
std::string tab_label_;
|
||||
ModuleCategory category_;
|
||||
bool enabled_ = false;
|
||||
};
|
||||
|
||||
using ModuleFactory = std::function<std::unique_ptr<BaseModule>()>;
|
||||
|
||||
class ModuleManager final {
|
||||
public:
|
||||
void AddRegistrar(const std::string& name, ModuleFactory factory);
|
||||
void Init();
|
||||
|
||||
void DispatchRenderByTab(MainTab tab);
|
||||
void DispatchUpdate();
|
||||
void DispatchHotkeys();
|
||||
|
||||
BaseModule* FindModule(const std::string& name);
|
||||
std::vector<BaseModule*> GetModulesByCategory(ModuleCategory category);
|
||||
bool Initialized() const { return initialized_; }
|
||||
|
||||
private:
|
||||
std::vector<std::pair<std::string, ModuleFactory>> registrars_;
|
||||
std::vector<std::unique_ptr<BaseModule>> modules_;
|
||||
bool initialized_ = false;
|
||||
};
|
||||
|
||||
ModuleManager& GetModuleManager();
|
||||
void RegisterDefaultModules();
|
||||
Reference in new issue
Block a user