Appearance
Menu
INFO
Callbacks passed to the menu elements are called when their value changes
As an extra - they are also called when they are being created for initialization purpose
Creating a New Menu
First things first, a category needs to be created, so we're gonna usemenu_category* g_sdk->menu_manager->add_category( std::string const& name, std::string const& display_name )
name must be unique so config won't be accidentally shared with other modules display_name will be the name of the category that will be displayed in the menu
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
return true;
}Adding a Label
INFO
This function adds a label in a category/sub-category
void menu_category::add_label( std::string const& text )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_label( "Test label" );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_label( "Test label" );
return true;
}Adding a Checkbox
INFO
This function adds a checkbox in a category/sub-category
void menu_category::add_checkbox( std::string const& element_name, std::string const& element_display_name, bool default_value, std::function< void( bool ) > const& callback )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_checkbox( "example_checkbox", "Example Checkbox", false, []( bool value )
{
if ( value )
g_sdk->log_console( "[+] Checkbox toggled on" );
else
g_sdk->log_console( "[+] Checkbox toggled off" );
} );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_checkbox( "example_checkbox", "Example Checkbox", false, []( bool value )
{
if ( value )
g_sdk->log_console( "[+] Checkbox toggled on" );
else
g_sdk->log_console( "[+] Checkbox toggled off" );
} );
return true;
}Adding a Hotkey
INFO
This function adds a hotkey in a category/sub-category
void menu_category::add_hotkey( std::string const& element_name, std::string const& element_display_name, unsigned char default_key, bool default_value = false, bool toggle = false, std::function< void( std::string*, bool ) > const& callback = nullptr )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_hotkey( "example_hotkey", "Example Hotkey", VK_F5, false, false, []( std::string*, bool value )
{
if ( value )
g_sdk->log_console( "[+] F5 pressed!" );
} );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_hotkey( "example_hotkey", "Example Hotkey", VK_F5, false, false, []( std::string*, bool value )
{
if ( value )
g_sdk->log_console( "[+] F5 pressed!" );
} );
return true;
}Adding a Separator
INFO
This function adds a separator in a category/sub-category
void menu_category::add_separator()
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_separator();
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_separator();
return true;
}Adding a Slider Int
INFO
This function adds a slider int in a category/sub-category
void menu_category::add_slider_int( std::string const& element_name, std::string const& element_display_name, int min, int max, int step, int default_value, std::function< void( int ) > const& callback = nullptr )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_slider_int( "example_slider_int", "Example Slider Int", 0, 100, 1, 70, []( int value )
{
if ( value > 70 )
g_sdk->log_console( "[!] Value is %d", value );
else if ( value > 40 )
g_sdk->log_console( "[?] Value is %d", value );
else
g_sdk->log_console( "[+] Value is %d", value );
} );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_slider_int( "example_slider_int", "Example Slider Int", 0, 100, 1, 70, []( int value )
{
if ( value > 70 )
g_sdk->log_console( "[!] Value is %d", value );
else if ( value > 40 )
g_sdk->log_console( "[?] Value is %d", value );
else
g_sdk->log_console( "[+] Value is %d", value );
} );
return true;
}Adding a Slider Float
INFO
This function adds a slider float in a category/sub-category
void menu_category::add_slider_float( std::string const& element_name, std::string const& element_display_name, float min, float max, float step, float default_value, std::function< void( float ) > const& callback = nullptr )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_slider_float( "example_slider_float", "Example Slider Float", 0.f, 1.f, 0.01f, 0.7f, []( float value )
{
if ( value > 0.7f )
g_sdk->log_console( "[!] Value is %.02f", value );
else if ( value > 0.4f )
g_sdk->log_console( "[?] Value is %.02f", value );
else
g_sdk->log_console( "[+] Value is %.02f", value );
} );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_slider_float( "example_slider_float", "Example Slider Float", 0.f, 1.f, 0.01f, 0.7f, []( float value )
{
if ( value > 0.7f )
g_sdk->log_console( "[!] Value is %.02f", value );
else if ( value > 0.4f )
g_sdk->log_console( "[?] Value is %.02f", value );
else
g_sdk->log_console( "[+] Value is %.02f", value );
} );
return true;
}Adding a Combo
INFO
This function adds a combo in a category/sub-category
void menu_category::add_combo( std::string const& element_name, std::string const& element_display_name, std::vector< std::string > const& items, int default_value, const std::function< void( int ) >& callback = nullptr )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_combo( "example_combo", "Example Combo", { "Info" , "Warning" , "Error" }, 1, []( int value )
{
if ( value == 0 )
g_sdk->log_console( "[+] Logged as info" );
else if ( value == 1 )
g_sdk->log_console( "[?] Logged as warning" );
else if ( value == 2 )
g_sdk->log_console( "[!] Logged as error" );
} );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_combo( "example_combo", "Example Combo", { "Info" , "Warning" , "Error" }, 1, []( int value )
{
if ( value == 0 )
g_sdk->log_console( "[+] Logged as info" );
else if ( value == 1 )
g_sdk->log_console( "[?] Logged as warning" );
else if ( value == 2 )
g_sdk->log_console( "[!] Logged as error" );
} );
return true;
}Adding a Colorpicker
INFO
This function adds a colorpicker in a category/sub-category
void menu_category::add_colorpicker( std::string const& element_name, std::string const& element_display_name, uint32_t default_color, std::function< void( uint32_t ) > const& callback = nullptr )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_colorpicker( "example_colorpicker", "Example Colorpicker", 0xFFFFFFFF, []( uint32_t color )
{
g_sdk->log_console( "[+] Color changed to %x", color );
} );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_colorpicker( "example_colorpicker", "Example Colorpicker", 0xFFFFFFFF, []( uint32_t color )
{
g_sdk->log_console( "[+] Color changed to %x", color );
} );
return true;
}Adding a Sub-category
INFO
This function adds a sub-category in a category/sub-category
menu_category* menu_category::add_sub_category( std::string const& element_name, std::string const& element_display_name )
Example
cpp
extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_sub_category( "example_sub_category", "Example Sub-category" );
return true;
}extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
g_sdk = sdk;
g_sdk->log_console( "[+] ExampleModule loaded!" );
const auto category = g_sdk->menu_manager->add_category( "example_module", "ExampleModule" );
category->add_sub_category( "example_sub_category", "Example Sub-category" );
return true;
}