GTA V Menu
This is intended as a simple menu for SHV/C++ mods that mimics the looks of the game's menus.
Clone this repository recursively, such that simpleini is cloned with it:
git clone --recursive https://github.com/E66666666/GTAVMenuBase
You'll want to have this repo cloned to your git folder along with where you store your projects. All of my GTA V projects that use this menu, use it in the same way, by having something like
-I../../ScriptHookV_SDK/ in their VS Project files.
Just make sure this repo folder is in your additional include files.
Mods using this menu:
Full menu example:
Since native functions are used, ScriptHookV is needed. ScriptHookV should be extracted into a
ScriptHookV_SDK folder parallel to this repo's folder and your mod folder that uses this.
Directory structure example:
git └───ScriptHookV_SDK │ └───inc │ └───lib └───GTAVMenuBase │ └───thirdparty │ └───simpleini └───YourProject
Check GTAVMenuExample's implementation to see the source code.
update_menu() is the main update loop. This should be called every tick.
Required methods inside
- accepts a
MenuControlspointer and a void
std::function, so a function is called when the menu gets opened. The function can be
nullptrif no functionality is desired.
- accepts a
- Draws all sprites that should be drawn, like backgrounds and check boxes, and draws any other additional information.
Required menus and items:
- Main menu
- Check the description how to do this
- You'll need to specify a menu title
For a more complete example (working build), check GTAVMenuExample.
MenuControls does input checking, so it can distinguish between key press, key being pressed, key being released. This applies both to keyboard input (
GetAsyncKeyState) and native inputs (
IS_DISABLED_CONTROL_PRESSED). Conflicts/delays between these two shouldn't occur as that's handled in
CheckKeys: if a GetAsyncKeyState is detected, native controls are temporarily
blocked. This should prevent ghosting when a menu key is assigned to the same key the game
navigation controls are binded to.
There are two detail panes available:
- Info pane to the right
- Details pane below the menu
A menu option with the info pane on the right can be created with
OptionPlus. You can bind
functions to left/right press, and the original
return-true-when-option-pressed is also
still available. The pane can be filled with a string vector, where each item represents a new
line. As of now these aren't split automatically yet, so you'll need to manually manage the
line length. It's originally made to show short pieces of information.
Detail panes are available for all option types. It accepts a string vector. Each item in this vector is automatically split up so it fits nicely within the detail pane. A newline can be forced by adding more string items to the vector. For normal use a vector with a simple string should be enough.
- commit 173a499 moves the menu to the top left. This makes
(0.0f, 0.0f)sit flush with the safe zone
- commit 3b37182 restores the selected bool pointer requirement in OptionPlus
- commit ec9477b removes the automatic uppercase menu subtitle argument
- commit d7a1e72 updates to C++17 for
std::variantin commit a61461d)
Feel free to use the issues, or post in the thread on the GTA5-Mods forums.
This thing started out as something I needed for VStancer where Unknown Modder on GTA5-Mods linked me the SudoMod menu sources.
Good luck modding!
- DireDan for the original implementation for sudomod
- Sudomod authors
- NativeUI authors
- Unknown Modder