diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c5b4e40..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "thirdparty/simpleini"] - path = thirdparty/simpleini - url = https://github.com/brofield/simpleini diff --git a/README.md b/README.md index d333354..4fb6435 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -# GTA V Menu +# ScriptHookV Menu Base -This is intended as a simple menu for SHV/C++ mods that mimics the looks of the game's menus. +This is intended as a simple menu for ScriptHookV scripts, +which mimics the looks of the game's menus. ![Comparison](MenuCompare.png) ## Building -### Setting up +Requirements: + * [ScriptHookV SDK by Alexander Blade](http://www.dev-c.com/gtav/scripthookv/) -* [simpleini (included as submodule)](https://github.com/brofield/simpleini) + * Added such that `#include ` can be found + * Uses `natives.h` generated from [alloc8ors Native DB](https://alloc8or.re/gta5/nativedb/) +* [simpleini](https://github.com/brofield/simpleini) + * Added such that `#include -``` - -Feel free to take a look at how my scripts use this menu: +Example implementations +* [Ghost Replay](https://github.com/E66666666/GTAVGhostReplay) * [Manual Transmission](https://github.com/E66666666/GTAVManualTransmission) * [Addon Spawner](https://github.com/E66666666/GTAVAddonLoader) * [VStancer](https://github.com/E66666666/GTAVStancer) @@ -32,9 +32,6 @@ Full menu example: * [GTAVMenuExample](https://github.com/E66666666/GTAVMenuExample) -The `natives.h` used in the code is from [alloc8ors Native DB](https://alloc8or.re/gta5/nativedb/) - this -differs from the natives generated by [Alexander Blades' Native DB DB](http://www.dev-c.com/nativedb/), so take caution. - ## Usage Check [GTAVMenuExample's implementation](https://github.com/E66666666/GTAVMenuExample/blob/master/GTAVMenuExample/script.cpp) to see the source code. @@ -42,14 +39,16 @@ Check [GTAVMenuExample's implementation](https://github.com/E66666666/GTAVMenuEx `update_menu()` is the main update loop. This should be called every tick. Required methods inside `update_menu()`: + * `CheckKeys` - * accepts a `MenuControls` pointer and a void `std::function`, so a function is called + * accepts a `MenuControls` pointer and a void `std::function`, so a function is called when the menu gets opened. The function can be `nullptr` if no functionality is desired. * `EndMenu` * 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 * Title @@ -58,12 +57,15 @@ Required menus and items: For a more complete example (working build), check [GTAVMenuExample](https://github.com/E66666666/GTAVMenuExample). ## Input handling -`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 + +`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. ## Details + There are two detail panes available: + * Info pane to the right * Details pane below the menu @@ -90,15 +92,17 @@ should be enough. Feel free to use the issues, or post in the [thread on the GTA5-Mods forums](https://forums.gta5-mods.com/topic/12090/tool-wip-c-shv-lightweight-menu-library). ## Remarks + If you're also not using [ScriptHookVDotNet](https://github.com/crosire/scripthookvdotnet) with [NativeUI](https://github.com/Guad/NativeUI) and just want something less painful than the mess that happens in the ScriptHookV Simple Trainer example, I hope this is of some use for you. -This thing started out as something I needed for [VStancer](https://github.com/E66666666/GTAVStancer) -where Unknown Modder on GTA5-Mods linked me the SudoMod menu sources. +This thing started out as something I needed for [VStancer](https://github.com/E66666666/GTAVStancer) +where Unknown Modder on GTA5-Mods linked me the SudoMod menu sources. -Good luck modding! +Good luck modding! ## Credits - * DireDan for the [original implementation for sudomod](https://www.unknowncheats.me/forum/grand-theft-auto-v/200692-originbase-sudomod-1-37-a.html) - * Sudomod authors - * NativeUI authors - * alloc8or + +* DireDan for the [original implementation for sudomod](https://www.unknowncheats.me/forum/grand-theft-auto-v/200692-originbase-sudomod-1-37-a.html) +* Sudomod authors +* NativeUI authors +* alloc8or diff --git a/menusettings.cpp b/menusettings.cpp index 2563b38..add15e0 100644 --- a/menusettings.cpp +++ b/menusettings.cpp @@ -1,6 +1,6 @@ #include "menusettings.h" -#include +#include #include "menucontrols.h" #include "menukeyboard.h" diff --git a/thirdparty/simpleini b/thirdparty/simpleini deleted file mode 160000 index 2af65fc..0000000 --- a/thirdparty/simpleini +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2af65fcc504f8242752755e836709762ef7ce062