PixelCrushers.DialogueSystem.UnityGUI.ScaledRect Class Reference

Scaled rects allow you to specify resolution-independent rects with a variety of positioning options. More...

Collaboration diagram for PixelCrushers.DialogueSystem.UnityGUI.ScaledRect:

Public Member Functions

 ScaledRect (ScaledRectAlignment origin, ScaledRectAlignment alignment, ScaledValue x, ScaledValue y, ScaledValue width, ScaledValue height, float minPixelWidth=0, float minPixelHeight=0)
 Initializes a new instance of the PixelCrushers.DialogueSystem.UnityGUI.ScaledRect class. More...
 
 ScaledRect (ScaledRect source)
 Copy constructor. More...
 
 ScaledRect ()
 Default constructor. More...
 
Rect GetPixelRect ()
 Calculates the pixel rect represented by the values of this ScaledRect. More...
 
Rect GetPixelRect (Vector2 windowSize)
 Gets the pixel rect represented by the values of this ScaledRect, scaled into a specified window size. More...
 
Rect GetPixelRect (Vector2 windowSize, Vector2 defaultSize)
 Calculates the pixel rect specified by this ScaledRect, scaled into a specified window size. More...
 

Static Public Member Functions

static ScaledRect FromOrigin (ScaledRectAlignment origin, ScaledValue width, ScaledValue height, float minPixelWidth=0, float minPixelHeight=0)
 Static utility function to build a new ScaledRect at an origin point and with the specified size. More...
 

Public Attributes

ScaledRectAlignment origin
 The origin point of the rect. More...
 
ScaledRectAlignment alignment
 The alignment of the rect – that is, which corner of the rect will be placed at the origin point. More...
 
ScaledValue x
 The x offset of the alignment corner. More...
 
ScaledValue y
 The y offset of the alignment corner. More...
 
ScaledValue width
 The width of the rect. More...
 
ScaledValue height
 The height of the rect. More...
 
float minPixelWidth
 The minimum pixel width of the rect; 0 indicates no minimum. More...
 
float minPixelHeight
 The minimum pixel height of the rect; 0 indicates no minimum. More...
 

Static Public Attributes

static readonly ScaledRect empty = new ScaledRect(ScaledRectAlignment.TopLeft, ScaledRectAlignment.TopLeft, ScaledValue.zero, ScaledValue.zero, ScaledValue.zero, ScaledValue.zero)
 Represents an empty rect, functionally equivalent to new Rect(0,0,0,0). More...
 
static readonly ScaledRect wholeScreen = new ScaledRect(ScaledRectAlignment.TopLeft, ScaledRectAlignment.TopLeft, ScaledValue.zero, ScaledValue.zero, ScaledValue.max, ScaledValue.max)
 Represents a rect that occupies the whole screen or window, functionally equivalent to new Rect(0,0,Screen.width,Screen.height) if the window is the whole screen. More...
 

Detailed Description

Scaled rects allow you to specify resolution-independent rects with a variety of positioning options.

The dialogue system uses scaled rects extensively with the Unity GUI to specify the positions of dialogue display controls without having to know the screen resolution ahead of time.

Constructor & Destructor Documentation

◆ ScaledRect() [1/3]

PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.ScaledRect ( ScaledRectAlignment  origin,
ScaledRectAlignment  alignment,
ScaledValue  x,
ScaledValue  y,
ScaledValue  width,
ScaledValue  height,
float  minPixelWidth = 0,
float  minPixelHeight = 0 
)

Initializes a new instance of the PixelCrushers.DialogueSystem.UnityGUI.ScaledRect class.

Parameters
originOrigin point.
alignmentAlignment corner that's placed on the origin.
xThe x offset of the alignment corner.
yThe y offset of the alignment corner.
widthWidth of the rect.
heightHeight of the rect.
minPixelWidthMinimum pixel width.
minPixelHeightMinimum pixel height.

◆ ScaledRect() [2/3]

PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.ScaledRect ( ScaledRect  source)

Copy constructor.

Initializes a new ScaledRect.

Parameters
sourceSource to copy.

◆ ScaledRect() [3/3]

PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.ScaledRect ( )

Default constructor.

Member Function Documentation

◆ FromOrigin()

static ScaledRect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.FromOrigin ( ScaledRectAlignment  origin,
ScaledValue  width,
ScaledValue  height,
float  minPixelWidth = 0,
float  minPixelHeight = 0 
)
static

Static utility function to build a new ScaledRect at an origin point and with the specified size.

Returns
The ScaledRect.
Parameters
originThe origin point; used for origin and alignment.
widthWidth.
heightHeight.
minPixelWidthMinimum pixel width. If 0, no minimum.
minPixelHeightMinimum pixel height. If 0, no minimum.

◆ GetPixelRect() [1/3]

Rect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.GetPixelRect ( )

Calculates the pixel rect represented by the values of this ScaledRect.

Returns
The pixel rect.

◆ GetPixelRect() [2/3]

Rect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.GetPixelRect ( Vector2  windowSize)

Gets the pixel rect represented by the values of this ScaledRect, scaled into a specified window size.

Returns
The pixel rect.
Parameters
windowSizeWindow size.

◆ GetPixelRect() [3/3]

Rect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.GetPixelRect ( Vector2  windowSize,
Vector2  defaultSize 
)

Calculates the pixel rect specified by this ScaledRect, scaled into a specified window size.

If the ScaledRect's width or height are 0, uses the corresponding x or y value in defaultSize.

Returns
The pixel rect.
Parameters
windowSizeThe window size in pixels.
defaultSizeThe default x and y pixel values to use if width or height are 0.

Member Data Documentation

◆ alignment

ScaledRectAlignment PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.alignment

The alignment of the rect – that is, which corner of the rect will be placed at the origin point.

◆ empty

readonly ScaledRect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.empty = new ScaledRect(ScaledRectAlignment.TopLeft, ScaledRectAlignment.TopLeft, ScaledValue.zero, ScaledValue.zero, ScaledValue.zero, ScaledValue.zero)
static

Represents an empty rect, functionally equivalent to new Rect(0,0,0,0).

◆ height

ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.height

The height of the rect.

◆ minPixelHeight

float PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.minPixelHeight

The minimum pixel height of the rect; 0 indicates no minimum.

◆ minPixelWidth

float PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.minPixelWidth

The minimum pixel width of the rect; 0 indicates no minimum.

◆ origin

ScaledRectAlignment PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.origin

The origin point of the rect.

This is the location on the screen/window where the alignment point will align to.

◆ wholeScreen

readonly ScaledRect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.wholeScreen = new ScaledRect(ScaledRectAlignment.TopLeft, ScaledRectAlignment.TopLeft, ScaledValue.zero, ScaledValue.zero, ScaledValue.max, ScaledValue.max)
static

Represents a rect that occupies the whole screen or window, functionally equivalent to new Rect(0,0,Screen.width,Screen.height) if the window is the whole screen.

◆ width

ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.width

The width of the rect.

◆ x

ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.x

The x offset of the alignment corner.

A value of 0 means no offset.

◆ y

ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.y

The y offset of the alignment corner.

A value of 0 means no offset.


The documentation for this class was generated from the following file: