C# Class Nez.Analysis.Layout

Layout class that supports title safe area.
You have to support various resolutions when you develop multi-platform games. Also, you have to support title safe area for Xbox 360 games. This structure places given rectangle with specified alignment and margin based on layout area (client area) with safe area. Margin is percentage of client area size. Example: Place( region, 0.1f, 0.2f, Aligment.TopLeft ); Place region at 10% from left side of the client area, 20% from top of the client area. Place( region, 0.3f, 0.4f, Aligment.BottomRight ); Place region at 30% from right side of client, 40% from the bottom of the client area. You can individually specify client area and safe area. So, it is useful when you have split screen game which layout happens based on client and it takes care of the safe at same time.
Show file Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
clientArea Microsoft.Xna.Framework.Rectangle
safeArea Microsoft.Xna.Framework.Rectangle

Public Methods

Method Description
Layout ( Rectangle clientArea ) : System

Construct layout object by specify client area. Safe area becomes same size as client area.

Layout ( Rectangle clientArea, Rectangle safeArea ) : System

Construct layout object by specify both client area and safe area.

Layout ( Viewport viewport ) : System

Construct layout object by specify viewport. Safe area becomes same as Viewpoert.TItleSafeArea.

place ( Rectangle region, float horizontalMargin, float verticalMargine, Alignment alignment ) : Rectangle

Layouting specified region

place ( Vector2 size, float horizontalMargin, float verticalMargine, Alignment alignment ) : Vector2

Layouting specified region

Method Details

Layout() public method

Construct layout object by specify client area. Safe area becomes same size as client area.
public Layout ( Rectangle clientArea ) : System
clientArea Microsoft.Xna.Framework.Rectangle
return System

Layout() public method

Construct layout object by specify both client area and safe area.
public Layout ( Rectangle clientArea, Rectangle safeArea ) : System
clientArea Microsoft.Xna.Framework.Rectangle
safeArea Microsoft.Xna.Framework.Rectangle safe area
return System

Layout() public method

Construct layout object by specify viewport. Safe area becomes same as Viewpoert.TItleSafeArea.
public Layout ( Viewport viewport ) : System
viewport Microsoft.Xna.Framework.Graphics.Viewport
return System

place() public method

Layouting specified region
public place ( Rectangle region, float horizontalMargin, float verticalMargine, Alignment alignment ) : Rectangle
region Microsoft.Xna.Framework.Rectangle placing rectangle
horizontalMargin float
verticalMargine float
alignment Alignment
return Microsoft.Xna.Framework.Rectangle

place() public method

Layouting specified region
public place ( Vector2 size, float horizontalMargin, float verticalMargine, Alignment alignment ) : Vector2
size Vector2
horizontalMargin float
verticalMargine float
alignment Alignment
return Vector2

Property Details

clientArea public property

Gets/Sets client area.
public Rectangle,Microsoft.Xna.Framework clientArea
return Microsoft.Xna.Framework.Rectangle

safeArea public property

Gets/Sets safe area.
public Rectangle,Microsoft.Xna.Framework safeArea
return Microsoft.Xna.Framework.Rectangle