Skip to content

MAIN MENU

Hypnootize edited this page Oct 27, 2023 · 4 revisions

HOW TO EDIT THE MAIN MENU BUTTONS

Menu buttons consists in two HUD elements hosted in two separate files m0rehud/Resource/UI/MainMenuOverride.res and m0rehud/Resource/GameMenu.res

MAINMENUOVERRIDE.RES

MainMenuOverride.res features the the main button code, here are stored most button properties like positioning, sizing, font and colors.

For semplicity I'll split the button in two different sections.

The first section can be used to resize and reposition the button, here is what it looks like for the ITEMS button:

"Items"
{
	"ControlName"			"EditablePanel"
	"fieldname"			"Items"
	"xpos"				"0"
	"ypos"				"0"
	"zpos"				"15"
	"wide"				"150"
	"tall"				"17"

	"pin_to_sibling"		"Servers"
	"pin_corner_to_sibling"		"PIN_TOPLEFT"
	"pin_to_sibling_corner"		"PIN_BOTTOMLEFT"

As usual the "wide" and "tall" values can be used to resize the button

As for the positioning, m0rehud main menu uses a pinning system to position the buttons, this means each button will feature three settings:

"pin_to_sibling": This is used to pin the button to another existing button, in this case the ITEMS button is pinned to the "Servers" button

"pin_corner_to_sibling": This let us pick which corner of our button we want to pin, in this case select the ITEMS button top left corner by using "PIN_TOPLEFT"

"pin_to_sibling_corner": This instead will pick a corner of the button we are pinning to, in this example with "PIN_BOTTOMLEFT" we selected the bottom left corner of the SERVERS button

For example to add a button in-between the "Servers" and "Items" buttons I will first pin the TOPLEFT of my button to the "Servers" BOTTOMLEFT and then make sure to also update the "Items" button pins so, instead of the "Servers" button, it will be pinned to my new button

The "xpos" and "ypos" values can then be used to offset the button in relation to it's pin.

This, in my opinion, makes the button positioning process a lot easier and also comes with the extra perk of being able to move all the buttons at the same time once they are all tied together, which can currently be done by editing the "MainMenuAnchor" element.

In the second section is possible to tweak most of the button aspects:

"SubButton"
{
	"ControlName"			"CExImageButton"
	"fieldName"			"SubButton"
	"xpos"				"0"
	"ypos"				"0"
	"wide"				"f0"
	"tall"				"f0"
	"visible"			"1"
	"enabled"			"1"
	"proportionaltoparent"		"1"
	"font"				"Coolvetica16"
	"AllCaps"			"1"
	"textAlignment"			"west"
	"sound_depressed"		"UI/buttonclick.wav"

	"paintbackground"		"0"

	"defaultFgColor_override"	"White"
	"armedFgColor_override"		"Menu_Accent"

	"defaultBgColor_override"	""
	"armedBgColor_override"		""
}

"font": Is used to set the font used by the button, a full list of available fonts can be found inside m0rehud/resource/scheme/fonts_scheme.res

"AllCaps": If "1" the button text will show all in capital letters, when "0" it will show in the same way as it was typed in the file

"textAlignment": Is used to control the text direction, it can be: west east north south

"paintbackground" If "1" it will add a background to the button

"defaultFgColor_override": Controls the color of the button text in it's normal state

"armedFgColor_override": Controls the color of the button text when hovered

"defaultBgColor_override": Controls the color of the button background in it's normal state

"armedBgColor_override": Controls the color of the button background when hovered

GAMEMENU.RES

"Items"
{
	"label"		"Items"
	"command"	"engine open_charinfo"
	"OnlyAtMenu"	"0"
	"OnlyInGame"	"0"
	"tooltip"	"Open Items Loadout"
}

Inside GameMenu.res it's where things like the button "command", "label" and "tooltip" are applied. The button can also feature either "OnlyAtMenu" or "OnlyInGame" to limit the areas where the button is visible.

"label": This is the text that will be displayed by the button

"command": This is the action the button will exec once clicked

"tooltip": Can be used to add a button explanation, it will show a panel with inside the explanation whenever the button is hovered by the user

"OnlyAtMenu": If "1" the button will only be shown in the main menu and will be invisible in the pause menu

"OnlyInGame": If "1" the button will only shown in the pause menu and will be invisible in the main menu

ADDING AND REMOVING BUTTONS

If you wish to add a new button to the menu the best approach is to probably clone both MainMenuOverride.res and GameMenu.res elements of an already existing button, you can then edit it's name and "fieldname" to feature your new button's name as well as the editing the other properties like explained above. Once again be extra careful while positioning the button to make sure both the pins of the new button and the pins of the already existing buttons are correct.

If you are looking to remove some of the buttons instead, you can simply remove both MainMenuOverride.res and GameMenu.res elements of the button you wish to remove. Once the elements are gone make sure to update any pin points of other buttons that were previously pinned to the removed button, most of the time it's ok to pin them to the closest button above them.