Barotrauma Client Doc
Barotrauma.GUICanvas Class Reference
Inheritance diagram for Barotrauma.GUICanvas:
Barotrauma.RectTransform

Protected Member Functions

 GUICanvas ()
 
- Protected Member Functions inherited from Barotrauma.RectTransform
void RecalculateScale ()
 
void RecalculatePivotOffset ()
 
void RecalculateAnchorPoint ()
 
void RecalculateRelativeSize ()
 
void RecalculateAbsoluteSize ()
 
void RecalculateAll (bool resize, bool scale=true, bool withChildren=true)
 

Properties

static GUICanvas Instance [get]
 
override Rectangle NonScaledUIRect [get]
 
- Properties inherited from Barotrauma.RectTransform
GUIComponent GUIComponent [get, set]
 Should be assigned only by GUIComponent. Note that RectTransform is created first and the GUIComponent after that. This means the GUIComponent is not set before the GUIComponent is initialized. More...
 
RectTransform?? Parent [get, set]
 
IEnumerable< RectTransformChildren [get]
 
int CountChildren [get]
 
Vector2 RelativeSize [get, set]
 Relative to the parent rect. More...
 
Point?? MinSize [get, set]
 Min size in pixels. Does not affect scaling. More...
 
Point?? MaxSize [get, set]
 Max size in pixels. Does not affect scaling. More...
 
Point NonScaledSize [get, set]
 Size before scale multiplications. More...
 
Point ScaledSize [get]
 Size after scale multiplications. More...
 
Vector2? LocalScale [get, set]
 
Vector2 Scale [get]
 
Vector2 RelativeOffset [get, set]
 Defined as portions of the parent size. Also the direction of the offset is relative, calculated away from the anchor point. More...
 
Point AbsoluteOffset [get, set]
 Absolute in pixels but relative to the anchor point. Calculated away from the anchor point, like a padding. Use RelativeOffset to set an amount relative to the parent size. More...
 
Point ScreenSpaceOffset [get, set]
 Screen space offset. From top left corner. In pixels. More...
 
Point PivotOffset [get]
 Calculated from the selected pivot. In pixels. More...
 
Point AnchorPoint [get]
 Screen space point in pixels. More...
 
Point TopLeft [get]
 
Point NonScaledTopLeft [get]
 
Rectangle Rect [get]
 
Rectangle ParentRect [get]
 
Rectangle NonScaledRect [get]
 
virtual Rectangle NonScaledUIRect [get]
 
Point NonScaledParentSize [get]
 
Rectangle NonScaledParentRect [get]
 
Rectangle NonScaledParentUIRect [get]
 
Rectangle UIRect [get]
 
Pivot Pivot [get, set]
 Does not automatically calculate children. Note also that if you change the pivot point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatcally or MatchPivotToAnchor to match the pivot to anchor. More...
 
Anchor Anchor [get, set]
 Does not automatically calculate children. Note also that if you change the anchor point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatically or MatchPivotToAnchor to match the pivot to anchor. More...
 
ScaleBasis ScaleBasis [get, set]
 
bool IsLastChild [get]
 
bool IsFirstChild [get]
 
bool IsFixedSize [get, set]
 If false, the element will resize if the parent is resized (with the children). If true, the element will resize only when explicitly resized. Note that scaling always affects the elements. More...
 
Point?? AnimTargetPos [get]
 

Additional Inherited Members

- Public Member Functions inherited from Barotrauma.RectTransform
void ResetSizeChanged ()
 
 RectTransform (Vector2 relativeSize, RectTransform parent, Anchor anchor=Anchor.TopLeft, Pivot? pivot=null, Point? minSize=null, Point? maxSize=null, ScaleBasis scaleBasis=ScaleBasis.Normal)
 
 RectTransform (Point absoluteSize, RectTransform parent=null, Anchor anchor=Anchor.TopLeft, Pivot? pivot=null, ScaleBasis scaleBasis=ScaleBasis.Normal, bool isFixedSize=false)
 By default, elements defined with an absolute size (in pixels) will scale with the parent. This can be changed by setting IsFixedSize to true. More...
 
void SetPosition (Anchor anchor, Pivot? pivot=null)
 
void Resize (Point absoluteSize, bool resizeChildren=true)
 
void Resize (Vector2 relativeSize, bool resizeChildren=true)
 
void ChangeScale (Vector2 newScale)
 
void ResetScale ()
 
void RecalculateScale (bool withChildren)
 Currently this needs to be manually called only when the global scale changes. If the local scale changes, the scale is automatically recalculated. More...
 
void Translate (Point translation)
 Manipulates ScreenSpaceOffset. If you want to manipulate some other offset, access the property setters directly. More...
 
IEnumerable< RectTransformGetParents ()
 Returns all parent elements in the hierarchy. More...
 
IEnumerable< RectTransformGetAllChildren ()
 Returns all child elements in the hierarchy. More...
 
int GetChildIndex (RectTransform rectT)
 
RectTransform GetChild (int index)
 
bool IsParentOf (RectTransform rectT, bool recursive=true)
 
bool IsChildOf (RectTransform rectT, bool recursive=true)
 
void ClearChildren ()
 
void SortChildren (Comparison< RectTransform > comparison)
 
void ReverseChildren ()
 
void SetAsLastChild ()
 
void SetAsFirstChild ()
 
bool RepositionChildInHierarchy (int index)
 
void RecalculateChildren (bool resize, bool scale=true)
 
void AddChildrenToGUIUpdateList (bool ignoreChildren=false, int order=0)
 
void MatchPivotToAnchor ()
 
void MoveOverTime (Point targetPos, float duration, Action onDoneMoving=null)
 
void ScaleOverTime (Point targetSize, float duration)
 
- Static Public Member Functions inherited from Barotrauma.RectTransform
static RectTransform Load (XElement element, RectTransform parent, Anchor defaultAnchor=Anchor.TopLeft)
 
static Pivot MatchPivotToAnchor (Anchor anchor)
 
static Anchor MatchAnchorToPivot (Pivot pivot)
 
static Anchor MoveAnchorLeft (Anchor anchor)
 Moves the anchor to the left, keeping the vertical position unchanged (e.g. CenterRight -> CenterLeft) More...
 
static Anchor MoveAnchorRight (Anchor anchor)
 Moves the anchor to the right, keeping the vertical position unchanged (e.g. CenterLeft -> CenterRight) More...
 
static Anchor MoveAnchorTop (Anchor anchor)
 Moves the anchor to the top, keeping the horizontal position unchanged (e.g. BottomCenter -> TopCenter) More...
 
static Anchor MoveAnchorBottom (Anchor anchor)
 Moves the anchor to the bottom, keeping the horizontal position unchanged (e.g. TopCenter -> BottomCenter) More...
 
static Point ConvertOffsetRelativeToAnchor (Point offset, Anchor anchor)
 Converts the offset so that the direction is always away from the anchor point. More...
 
static Point CalculatePivotOffset (Pivot anchor, Point size)
 
static Point CalculateAnchorPoint (Anchor anchor, Rectangle parent)
 
static void ResetGlobalScale ()
 The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not. More...
 
- Static Public Attributes inherited from Barotrauma.RectTransform
static readonly Point MaxPoint = new Point(int.MaxValue, int.MaxValue)
 
static Vector2 globalScale = Vector2.One
 Applied to all RectTransforms. The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not. More...
 
- Protected Attributes inherited from Barotrauma.RectTransform
readonly List< RectTransformchildren = new List<RectTransform>()
 
- Events inherited from Barotrauma.RectTransform
Action< RectTransformParentChanged
 
Action< RectTransformChildrenChanged
 The element provided as the argument is the changed child. It may be new in the hierarchy or just repositioned. More...
 
Action ScaleChanged
 
Action SizeChanged
 

Detailed Description

Definition at line 9 of file GUICanvas.cs.

Constructor & Destructor Documentation

◆ GUICanvas()

Barotrauma.GUICanvas.GUICanvas ( )
protected

Definition at line 11 of file GUICanvas.cs.

Property Documentation

◆ Instance

GUICanvas Barotrauma.GUICanvas.Instance
staticget

Definition at line 14 of file GUICanvas.cs.

◆ NonScaledUIRect

override Rectangle Barotrauma.GUICanvas.NonScaledUIRect
getprotected

Definition at line 36 of file GUICanvas.cs.