Class VRC
Ladybug Virtual Resolution Container
Inheritance
Inherited Members
Namespace: Ladybug
Assembly: ladybug.dll
Syntax
public class VRC
Constructors
| Improve this Doc View SourceVRC(Scene, Int32, Int32)
Creates a new Virtual Resolution Container
Declaration
public VRC(Scene parentScene, int virtualWidth, int virtualHeight)
Parameters
Type | Name | Description |
---|---|---|
Scene | parentScene | Parent Scene |
System.Int32 | virtualWidth | Virtual Resolution Width |
System.Int32 | virtualHeight | Virtual Resolution Height |
Properties
| Improve this Doc View SourceActualAspectRatio
Actual aspect ratio of the application window
Declaration
public float ActualAspectRatio { get; }
Property Value
Type | Description |
---|---|
System.Single |
BackgroundColor
Background color of the VRC. Affects the color of Letterbox bars
Declaration
public Color BackgroundColor { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Color |
Canvas
The Canvas contains the content the VRC is rendering, which automatically resizes to maintain aspect ratio as the game window size changes
Declaration
public Rectangle Canvas { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Rectangle |
GraphicsDevice
GraphicsDevice of the parent Game instance
Declaration
public GraphicsDevice GraphicsDevice { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Graphics.GraphicsDevice |
PreferredAspectRatio
Virtual aspect ratio the VRC will maintain as window size changes
Declaration
public float PreferredAspectRatio { get; }
Property Value
Type | Description |
---|---|
System.Single |
Scale
Calculated scale of the VRC's canvas
Declaration
public Vector2 Scale { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 |
TransformMatrix
Matrix representing this VRC's size, scale, and rotation
Declaration
public Matrix TransformMatrix { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Matrix |
VirtualHeight
Virtual height value of the VRC's canvas
Declaration
public int VirtualHeight { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
VirtualWidth
Virtual width value of the VRC's canvas
Declaration
public int VirtualWidth { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Window
Window of the parent Game instance
Declaration
public GameWindow Window { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.GameWindow |
Methods
| Improve this Doc View SourceDraw(GameTime, SpriteBatch)
Draws all content handled by the VRC to its canvas, then draws the canvas centered within the game window
Declaration
public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.GameTime | gameTime | |
Microsoft.Xna.Framework.Graphics.SpriteBatch | spriteBatch |
OnDraw(Action<GameTime, SpriteBatch>)
Sets the action performed when the VRC is drawn to the screen
Declaration
public void OnDraw(Action<GameTime, SpriteBatch> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.Xna.Framework.GameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch> | action |
Remarks
Use this to draw to the VRC's canvas
OnDrawBackground(Action<GameTime, SpriteBatch>)
Sets the action performed when the VRC is drawing the background behind its canvas
Declaration
public void OnDrawBackground(Action<GameTime, SpriteBatch> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.Xna.Framework.GameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch> | action |
Remarks
Use this to set a texture/image for letterboxes
ScreenToCanvasSpace(Vector2)
Converts a Vector2 coordinate from screen space to a location relative to the VRC's canvas
Declaration
public Vector2 ScreenToCanvasSpace(Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | position |
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 |