-
Notifications
You must be signed in to change notification settings - Fork 39
UI Drawing Overview
RAGENativeUI introduces ResRectangle, ResText and Sprite classes. Using these the UI always looks good on any resolution.
RAGENativeUI uses 1080 pixels as a base height, and then calculates the width based on the user's current aspect ratio (Screen width/Screen height). This way the aspect ratio of your menus is always mantained.
ResText expands on Text by adding a TextAlignment property and WordWrap property. Using the TextAlignment you can align your text to the left, center or right. WordWrap property will wrap your text after X pixels.
Using the Sprite object is very easy. To create a gradient background, you can do this:
var background = new Sprite("commonmenu", "bgd_gradient", new Point(100, 20), new Size(200, 500)); You can then alter it's Heading, Color, Size, Position, TextureDict and TextureName.
The Sprite class has a static method that allows you to draw custom textures, DrawTexture(Texture texture, Point position, Size size, Graphics graphics). Since it requires a Graphics instance it can only be called on a frame render event.