Akebi-GC
Akebi-GC copied to clipboard
Documentation for making new module
Here's a copypaste of what Callow said in #akebi-contributors
making a feature
you can just copy some feature and just change name to your by Ctrl+H if you want do it by yourself you need make class as singleton for example:
static Hotkeys& GetInstance();
private:
Hotkeys();
and of course derive from Feature class now to describe functions,
FeatureGUIInfo
You must to define this function, and return the FeatureGUInfo reference
Arguments:
struct FeatureGUIInfo
{
std::string name;
std::string moduleName;
bool isGroup;
};
ex:
const FeatureGUIInfo& Hotkeys::GetGUIInfo() const
{
static const FeatureGUIInfo info{ "", "Hotkeys", false };
return info;
}
In this example the feature is not group so group name is empty string it means, that cheatmanager will not add GroupPanel around all UI. Hotkeys it just a section, you can see sections in left side in UI.
DrawMain
virtual void DrawMain() = 0;
it's main function to draw UI
you must to define it
ex:
void Settings::DrawMain()
{
ImGui::BeginGroupPanel("General");
{
ConfigWidget(f_MenuKey, false,
"Key to toggle main menu visibility. Cannot be empty.\n"\
"If you forget this key, you can see or set it in your config file.");
ConfigWidget(f_HotkeysEnabled, "Enable hotkeys.");
if (ConfigWidget(f_FontSize, 1, 8, 64, "Font size for cheat interface."))
{
f_FontSize = std::clamp(f_FontSize.value(), 8, 64);
renderer::SetGlobalFontSize(static_cast<float>(f_FontSize));
}
}
ImGui::EndGroupPanel();
ImGui::BeginGroupPanel("Logging");
{
bool consoleChanged = ConfigWidget(f_ConsoleLogging,
"Enable console for logging information (changes will take effect after relaunch)");
if (consoleChanged && !f_ConsoleLogging)
{
Logger::SetLevel(Logger::Level::None, Logger::LoggerType::ConsoleLogger);
}
bool fileLogging = ConfigWidget(f_FileLogging,
"Enable file logging (changes will take effect after relaunch).\n" \
"A folder in the app directory will be created for logs.");
if (fileLogging && !f_FileLogging)
{
Logger::SetLevel(Logger::Level::None, Logger::LoggerType::FileLogger);
}
}
ImGui::EndGroupPanel();
ImGui::BeginGroupPanel("Status Window");
{
ConfigWidget(f_StatusShow);
ConfigWidget(f_StatusMove, "Allow moving of 'Status' window.");
}
ImGui::EndGroupPanel();
}
NeedStatusDraw
virtual bool NeedStatusDraw() const { return false; };
NeedStatusDraw
need for give CheatManager information is it need to call DrawStatus()
for this feature
It calls every frame
DrawStatus()
need for drawing stuff to status window
the same with NeedInfoDraw()
and DrawInfo()
DrawExternal
need for draw the UI externally from menu. Used in ESP drawing for example.
Fields
config::Field
class just store the value to config file when it changed. (Note. If field value is a structure and you just change a field, the class can't detect this behavior, so you should FireChanged
by yourself, the same if you change value by pointer)
NF
, NFB
and etc. Its just macros for easier initialize fields.
Most common used is NF
and NFS
(New Field, New Field Shared)
Arguments:
#define NFS(field, name, section, defaultValue) ...
#define NF(field, name, section, defaultValue) ...
NF
is used for storing value in config (relative to the section, and config)
And Shared
is when you want value to persist between configs.
ConfigWidget
it's helper that automatically create UI field, depends of field value type, and automatically trigger FireChanged
when value was changed.
Btw, in NF
, field its previously declared field, name it's name for drawing by ConfigWidget, section it's section in json file, ::
is delimiter for tree hierarchy, defaultValue
is default value, when the field is not defined in config.
said before, Arguments different by Value Type.
ConfigWidget Implementation is here.
Arguments Overview