Log in to reply

[.NET] Positioning rectangle on bottom is broken but on top is working

  • Hi,
    I wanted to make black full screen width rectangle with 100px height and sizing is ok but when i try to set position on botton its broken for 1920x1080 i need to do this like that:

    var y = Game.ScreenResolution.Height - 360;
    var bar = new UIRectangle(new Point(0, y), new Size(Game.ScreenResolution.Width, 100), Color.Black);

    But why. Thinking logically this 'y' variable should look like this:

    var y = Game.ScreenResolution.Height - 100; // where 100 is height of the bar

    Thanks 4 any help ;p

  • SHVDN hardcodes the max x,y,width,height values to 1280x720. Just assume the max width is 1280 and max height is 720 in your values. So something like this:

    var bar = new UIRectangle(new Point(0, 620), new Size(1280, 100), Color.Black);

    Keep in mind 100 pixels is different on 1080p vs 720p. 100 pixels of 1080p is 9% of the screen while 100 pixels of 720p is 13% of the screen. If 100 pixels looks good on your 1080p monitor, set the value to 65 pixels, because 9% of 720p is ~65.

    If you want to see what SHVDN is doing in the background, check out the source code: https://github.com/crosire/scripthookvdotnet/blob/main/source/scripting_v2/GTA/UIRectangle.cs#L60

  • @Jitnaught Thanks a lot !

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.