Scaled rects allow you to specify resolution-independent rects with a variety of positioning options. More...
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... | |
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.
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.
origin | Origin point. |
alignment | Alignment corner that's placed on the origin. |
x | The x offset of the alignment corner. |
y | The y offset of the alignment corner. |
width | Width of the rect. |
height | Height of the rect. |
minPixelWidth | Minimum pixel width. |
minPixelHeight | Minimum pixel height. |
PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.ScaledRect | ( | ScaledRect | source | ) |
PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.ScaledRect | ( | ) |
Default constructor.
|
static |
Static utility function to build a new ScaledRect at an origin point and with the specified size.
origin | The origin point; used for origin and alignment. |
width | Width. |
height | Height. |
minPixelWidth | Minimum pixel width. If 0 , no minimum. |
minPixelHeight | Minimum pixel height. If 0 , no minimum. |
Rect PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.GetPixelRect | ( | ) |
Calculates the pixel rect represented by the values of this ScaledRect.
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.
windowSize | Window size. |
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.
windowSize | The window size in pixels. |
defaultSize | The default x and y pixel values to use if width or height are 0 . |
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.
|
static |
Represents an empty rect, functionally equivalent to new Rect(0,0,0,0)
.
ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.height |
The height of the rect.
float PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.minPixelHeight |
The minimum pixel height of the rect; 0
indicates no minimum.
float PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.minPixelWidth |
The minimum pixel width of the rect; 0
indicates no minimum.
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.
|
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.
ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.width |
The width of the rect.
ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.x |
The x offset of the alignment corner.
A value of 0
means no offset.
ScaledValue PixelCrushers.DialogueSystem.UnityGUI.ScaledRect.y |
The y offset of the alignment corner.
A value of 0
means no offset.