Struct ITextDraw
This type represents a pointer to an unmanaged open.mp ITextDraw interface.
[OpenMpApi(new Type[] { typeof(ITextDrawBase) })]
public readonly struct ITextDraw : IEquatable<ITextDraw>, ITextDraw.IManagedInterface, ITextDrawBase.IManagedInterface, IExtensible.IManagedInterface, IIDProvider.IManagedInterface, IUnmanagedInterface
- Implements
- Inherited Members
Constructors
ITextDraw(nint)
Initializes a new instance of the ITextDraw struct.
public ITextDraw(nint handle)
Parameters
handlenintA pointer to the unmanaged interface.
Properties
Handle
Gets the handle to the unmanaged interface instance.
public nint Handle { get; }
Property Value
HasValue
Gets a value indicating whether the pointer has a value.
public bool HasValue { get; }
Property Value
Methods
AddExtension<T>(T)
Adds the specified managed extension to this extensible.
public void AddExtension<T>(T extension) where T : Extension
Parameters
extensionTAn instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.
Type Parameters
TThe type of the managed extension.
Remarks
A managed extension can only be added to one extensible.
Exceptions
- ArgumentException
Throw when an instance of the extension type was already added to this extensible.
Equals(ITextDraw)
public bool Equals(ITextDraw other)
Parameters
otherITextDraw
Returns
Equals(object?)
public override bool Equals(object? other)
Parameters
otherobject
Returns
GetAlignment()
Gets the alignment of the textdraw's text.
public TextDrawAlignmentTypes GetAlignment()
Returns
- TextDrawAlignmentTypes
The current text alignment.
GetBackgroundColour()
Gets the background colour of the textdraw.
public Colour GetBackgroundColour()
Returns
- Colour
The background colour.
GetBoxColour()
Gets the colour of the textdraw's box.
public Colour GetBoxColour()
Returns
- Colour
The colour of the textdraw's box.
GetBoxColour(out Colour)
Gets the colour of the textdraw's box.
public void GetBoxColour(out Colour colour)
Parameters
colourColourThe box colour.
GetExtension(UID)
Gets the extension with the specified id.
public IExtension GetExtension(UID id)
Parameters
idUIDThe identifier of the extension type.
Returns
- IExtension
The extension or null if the extension could not be found.
GetExtension<T>()
Gets the specified managed extension from this extensible.
public T GetExtension<T>() where T : Extension
Returns
- T
An instance of the extension with type
T.
Type Parameters
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
GetHashCode()
public override int GetHashCode()
Returns
GetID()
Gets the identifier of this unit.
public int GetID()
Returns
- int
The identifier of the unit.
GetLetterColour()
Gets the colour of the textdraw's letters.
public Colour GetLetterColour()
Returns
- Colour
The colour of the textdraw's letters.
GetLetterSize()
Gets the size of the textdraw's letters.
public Vector2 GetLetterSize()
Returns
- Vector2
The size of the textdraw's letters.
GetOutline()
Gets the outline thickness of the textdraw.
public int GetOutline()
Returns
- int
The outline thickness.
GetPosition()
Gets the position of the textdraw.
public Vector2 GetPosition()
Returns
- Vector2
The position of the textdraw.
GetPreviewModel()
Gets the preview model for the textdraw.
public int GetPreviewModel()
Returns
- int
The model ID being previewed.
GetPreviewRotation()
Gets the preview rotation for the textdraw.
public Vector3 GetPreviewRotation()
Returns
- Vector3
The rotation vector.
GetPreviewVehicleColour()
Gets the preview vehicle colours for the textdraw.
public (int, int) GetPreviewVehicleColour()
Returns
GetPreviewZoom()
Gets the preview zoom factor for the textdraw.
public float GetPreviewZoom()
Returns
- float
The preview zoom factor.
GetShadow()
Gets the shadow strength of the textdraw.
public int GetShadow()
Returns
- int
The shadow strength.
GetStyle()
Gets the drawing style of the textdraw.
public TextDrawStyle GetStyle()
Returns
- TextDrawStyle
The drawing style.
GetText()
Gets the text of the textdraw.
public string GetText()
Returns
- string
The text currently displayed by the textdraw.
GetTextSize()
Gets the size of the textdraw area.
public Vector2 GetTextSize()
Returns
- Vector2
The size of the textdraw area.
HasBox()
Gets whether the textdraw uses a box.
public bool HasBox()
Returns
HideForPlayer(IPlayer)
Hides the text draw for the specified player.
public void HideForPlayer(IPlayer player)
Parameters
playerIPlayerThe player for whom the text draw will be hidden.
IsProportional()
Gets whether the textdraw is proportional.
public bool IsProportional()
Returns
IsSelectable()
Gets whether the textdraw is selectable.
public bool IsSelectable()
Returns
IsShownForPlayer(IPlayer)
Determines whether the text draw is shown for the specified player.
public bool IsShownForPlayer(IPlayer player)
Parameters
playerIPlayerThe player to check.
Returns
QueryExtension<T>()
Gets the specified unmanaged extension from this extensible.
public T QueryExtension<T>() where T : unmanaged, IExtension.IManagedInterface
Returns
- T
The unmanaged extension or null if the extension could not be found.
Type Parameters
TThe type of the unmanaged extension.
RemoveExtension(IExtension)
Removes the specified extension from this extensible.
public void RemoveExtension(IExtension extension)
Parameters
extensionIExtensionThe extension to remove.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
RemoveExtension(UID)
Removes the extension with the specified id from this extensible.
public void RemoveExtension(UID id)
Parameters
idUIDThe identifier of the extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
RemoveExtension<T>(T)
Removes the specified managed extension from this extensible.
public void RemoveExtension<T>(T extension) where T : Extension
Parameters
extensionTThe managed extension to remove.
Type Parameters
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
Restream()
Re-streams the textdraw to all players to which it is currently streamed in.
public void Restream()
SetAlignment(TextDrawAlignmentTypes)
Sets the alignment of the textdraw's text.
public ref ITextDrawBase SetAlignment(TextDrawAlignmentTypes alignment)
Parameters
alignmentTextDrawAlignmentTypesThe alignment to set.
Returns
- ITextDrawBase
This instance for chaining.
SetBackgroundColour(Colour)
Sets the background colour of the textdraw.
public ref ITextDrawBase SetBackgroundColour(Colour colour)
Parameters
colourColourThe new background colour.
Returns
- ITextDrawBase
This instance for chaining.
SetBoxColour(Colour)
Sets the colour of the textdraw's box.
public ref ITextDrawBase SetBoxColour(Colour colour)
Parameters
colourColourThe new box colour.
Returns
- ITextDrawBase
This instance for chaining.
SetColour(Colour)
Sets the colour of the textdraw's letters.
public ref ITextDrawBase SetColour(Colour colour)
Parameters
colourColourThe new letter colour.
Returns
- ITextDrawBase
This instance for chaining.
SetLetterSize(Vector2)
Sets the size of the textdraw's letters.
public ref ITextDrawBase SetLetterSize(Vector2 size)
Parameters
sizeVector2The new letter size.
Returns
- ITextDrawBase
This instance for chaining.
SetOutline(int)
Sets the outline of the textdraw.
public ref ITextDrawBase SetOutline(int outline)
Parameters
outlineintThe outline thickness.
Returns
- ITextDrawBase
This instance for chaining.
SetPosition(Vector2)
Sets the position of the textdraw.
public ref ITextDrawBase SetPosition(Vector2 position)
Parameters
positionVector2The new position of the textdraw.
Returns
- ITextDrawBase
This instance for chaining.
SetPreviewModel(int)
Sets the preview model for the textdraw.
public ref ITextDrawBase SetPreviewModel(int model)
Parameters
modelintThe model ID to preview.
Returns
- ITextDrawBase
This instance for chaining.
SetPreviewRotation(Vector3)
Sets the preview rotation for the textdraw.
public ref ITextDrawBase SetPreviewRotation(Vector3 rotation)
Parameters
rotationVector3The rotation vector.
Returns
- ITextDrawBase
This instance for chaining.
SetPreviewVehicleColour(int, int)
Sets the preview vehicle colours for the textdraw.
public ref ITextDrawBase SetPreviewVehicleColour(int colour1, int colour2)
Parameters
Returns
- ITextDrawBase
This instance for chaining.
SetPreviewZoom(float)
Sets the preview zoom factor for the textdraw.
public ref ITextDrawBase SetPreviewZoom(float zoom)
Parameters
zoomfloatThe zoom factor.
Returns
- ITextDrawBase
This instance for chaining.
SetProportional(bool)
Sets whether the textdraw is proportional.
public ref ITextDrawBase SetProportional(bool proportional)
Parameters
Returns
- ITextDrawBase
This instance for chaining.
SetSelectable(bool)
Sets whether the textdraw is selectable.
public ref ITextDrawBase SetSelectable(bool selectable)
Parameters
Returns
- ITextDrawBase
This instance for chaining.
SetShadow(int)
Sets the shadow strength of the textdraw.
public ref ITextDrawBase SetShadow(int shadow)
Parameters
shadowintThe shadow strength.
Returns
- ITextDrawBase
This instance for chaining.
SetStyle(TextDrawStyle)
Sets the drawing style of the textdraw.
public ref ITextDrawBase SetStyle(TextDrawStyle style)
Parameters
styleTextDrawStyleThe drawing style.
Returns
- ITextDrawBase
This instance for chaining.
SetText(string)
Sets the text of the textdraw.
public void SetText(string text)
Parameters
textstringThe new text to display.
SetTextForPlayer(IPlayer, string)
Sets the text of the text draw for the specified player.
public void SetTextForPlayer(IPlayer player, string text)
Parameters
SetTextSize(Vector2)
Sets the size of the textdraw area.
public ref ITextDrawBase SetTextSize(Vector2 size)
Parameters
sizeVector2The new textdraw area size.
Returns
- ITextDrawBase
This instance for chaining.
ShowForPlayer(IPlayer)
Shows the text draw for the specified player.
public void ShowForPlayer(IPlayer player)
Parameters
playerIPlayerThe player for whom the text draw will be shown.
TryGetExtension<T>()
Tries to get the specified managed extension from this extensible.
public T? TryGetExtension<T>() where T : Extension
Returns
- T
An instance of the extension with type
Tor null if no extension with the specified type could be found.
Type Parameters
TThe type of the managed extension.
TryQueryExtension<T>(out T)
Tries to get the specified unmanaged extension from this extensible.
public bool TryQueryExtension<T>(out T extension) where T : unmanaged, IExtension.IManagedInterface
Parameters
extensionTThe extension if found, otherwise null.
Returns
Type Parameters
TThe type of the unmanaged extension.
UseBox(bool)
Sets whether the textdraw uses a box.
public ref ITextDrawBase UseBox(bool use)
Parameters
Returns
- ITextDrawBase
This instance for chaining.
Operators
operator ==(ITextDraw, object?)
Determines whether the specified values are equal.
public static bool operator ==(ITextDraw lhs, object? rhs)
Parameters
lhsITextDrawThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are equal; otherwise,false.
explicit operator ITextDraw(IExtensible)
Casts the IExtensible to a ITextDraw.
public static explicit operator ITextDraw(IExtensible value)
Parameters
valueIExtensibleThe IExtensible to cast.
Returns
explicit operator ITextDraw(IIDProvider)
Casts the IIDProvider to a ITextDraw.
public static explicit operator ITextDraw(IIDProvider value)
Parameters
valueIIDProviderThe IIDProvider to cast.
Returns
explicit operator IExtensible(ITextDraw)
Casts the ITextDraw to a IExtensible.
public static explicit operator IExtensible(ITextDraw value)
Parameters
Returns
- IExtensible
The converted IExtensible.
explicit operator IIDProvider(ITextDraw)
Casts the ITextDraw to a IIDProvider.
public static explicit operator IIDProvider(ITextDraw value)
Parameters
Returns
- IIDProvider
The converted IIDProvider.
explicit operator ITextDrawBase(ITextDraw)
Casts the ITextDraw to a ITextDrawBase.
public static explicit operator ITextDrawBase(ITextDraw value)
Parameters
Returns
- ITextDrawBase
The converted ITextDrawBase.
explicit operator ITextDraw(ITextDrawBase)
Casts the ITextDrawBase to a ITextDraw.
public static explicit operator ITextDraw(ITextDrawBase value)
Parameters
valueITextDrawBaseThe ITextDrawBase to cast.
Returns
operator !=(ITextDraw, object?)
Determines whether the specified values are not equal.
public static bool operator !=(ITextDraw lhs, object? rhs)
Parameters
lhsITextDrawThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are not equal; otherwise,false.