-
-
Notifications
You must be signed in to change notification settings - Fork 28
Custom Menu Banner
Alexander Schmid edited this page Dec 7, 2019
·
2 revisions
With alt:V NativeUI you can easily customize your menu. You can set a custom banner with the SetBannerType methods.
Use this whenever you want a plain colored banner background. First you create a rectangle with your desired colors and then you call the SetBannerType method.
const menu = new NativeUI.Menu("NativeUI Test", "Test plain menu", new NativeUI.Point(50, 50));
//We only care about color for rectangle banner type, position & size is set automatically
var banner = new NativeUI.ResRectangle(new NativeUI.Point(0, 0), new NativeUI.Size(0,0), new NativeUI.Color(200, 200, 200, 255));
menu.SetRectangleBannerType(banner);
See Sprites List for a complete list of available sprites in GTA V.
Setting a sprite as the banner is as easy as the rectangle.
const menu = new NativeUI.Menu("", "You want that durty look?", new NativeUI.Point(50, 50));
var banner = new NativeUI.Sprite("shopui_title_barber", "shopui_title_barber", new NativeUI.Point(0, 0), new NativeUI.Size(0, 0));
menu.SetSpriteBannerType(banner);
This can be used whenever a sprite should be drawn on top of a colored rectangle.
const menu = new NativeUI.Menu("Shop", "Shit you need, almost free", new NativeUI.Point(50, 50));
var rectangle = new NativeUI.ResRectangle(new NativeUI.Point(0, 0), new NativeUI.Size(0,0), new NativeUI.Color(0, 0, 0, 255));
menu.SetRectangleBannerType(rectangle);
var banner = new NativeUI.Sprite("mpshops", "shopui_title_graphics_sale", new NativeUI.Point(0, 0), new NativeUI.Size(0, 0));
menu.AddSpriteBannerType(banner);
You can deliver your texture in a zip file with your mod or you can embed it in your dll.
myMenu.SetBannerType("scripts\\banner.png"); // Extracted from zip
myMenu.SetBannerType(Sprite.WriteFromResource(Assembly.GetExecutingAssembly(), "SolutionName.file.png");
// From resource
You can also remove the banner completely and only leave the subtitle. You will have to create a blank ResRectangle and offset the menu by -107 pixels high.
const menu = new NativeUI.Menu("", "Banner less menu", new NativeUI.Point(50, -57)); //Optional offset the menu -107 (banner height is 107) to have no offset at all
menu.SetNoBannerType();