M2HudDrawable

abstract class M2HudDrawable(tag: Any? = null) : M2Drawable, IM2HudDrawable<M2HudDrawable>

Abstract base class for HUD-style drawable elements that support explicit positioning (X/Y), sizing (width/height), color, alignment, and the standard IM2HudDrawable contract for adding to screens and groups.

M2HudDrawable sits between the raw M2Drawable foundation and concrete primitives such as M2Shape, text, and image drawables. It provides convenience methods for setting dimensions, colors, and placement.

Parameters

tag

An optional Any tag for identifying this drawable instance.

Inheritors

Constructors

Link copied to clipboard
constructor(tag: Any? = null)

Functions

Link copied to clipboard

Adds this drawable to a group without alignment.

open override fun addTo(group: M2Group, align: M2Align?): M2HudDrawable

Adds this drawable to a group with optional alignment.

open override fun addTo(screen: M2Screen, align: M2Align?): M2HudDrawable

Adds this drawable to a screen with optional alignment.

Link copied to clipboard
fun M2HudDrawable.animateBlue(durationMillis: Long, toColor: Int, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the blue color channel of this HUD drawable to the given value.

Link copied to clipboard
fun M2HudDrawable.animateGradAngle(durationMillis: Long, targetAngleDeg: Float, rotation: M2Rotation = M2Rotation.Cw, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the gradient angle of this shape's M2GradientFill fill to an absolute targetAngleDeg.

Link copied to clipboard
fun M2HudDrawable.animateGradAngleBy(durationMillis: Long, amountDeg: Float, rotation: M2Rotation = M2Rotation.Cw, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the gradient angle of this shape's M2GradientFill by a relative amountDeg.

Link copied to clipboard
fun M2HudDrawable.animateGradientAlpha(durationMillis: Long, toAlpha: <Error class: unknown class>, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = true, callback: IM2AnimatorCallback? = null): M2Animator

Animates the alpha of this shape's gradient secondary color to the given toAlpha.

Link copied to clipboard
fun M2HudDrawable.animateGradientBlue(durationMillis: Long, toColor: Int, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the blue channel of this shape's gradient secondary color to the given value.

Link copied to clipboard
fun M2HudDrawable.animateGradientGreen(durationMillis: Long, toColor: Int, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the green channel of this shape's gradient secondary color to the given value.

Link copied to clipboard
fun M2HudDrawable.animateGradientRed(durationMillis: Long, toColor: Int, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the red channel of this shape's gradient secondary color to the given value.

Link copied to clipboard
fun M2HudDrawable.animateGradientSize(durationMillis: Long, gradTargetSizePrecent: Float, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = true, callback: IM2AnimatorCallback? = null): M2Animator

Animates the gradient size of this shape's M2GradientFill to a target size expressed as a percentage of the drawable's extent along the gradient axis.

Link copied to clipboard
fun M2HudDrawable.animateGreen(durationMillis: Long, toColor: Int, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the green color channel of this HUD drawable to the given value.

Link copied to clipboard
fun M2HudDrawable.animateRed(durationMillis: Long, toColor: Int, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Animates the red color channel of this HUD drawable to the given value.

Link copied to clipboard
fun M2HudDrawable.animateTransformScaleX(durationMillis: Long, scale: Float, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, callback: IM2AnimatorCallback? = null, apply: Boolean = false): M2Animator

Animates a scale of this drawable's transform matrix along one axis only.

Link copied to clipboard
fun M2HudDrawable.animateTransformScaleY(durationMillis: Long, scale: Float, repeat: M2AnimatorRepeat = M2AnimatorRepeat.None, callback: IM2AnimatorCallback? = null, apply: Boolean = false): M2Animator
Link copied to clipboard
protected open override fun copyPropertiesTo(target: M2Drawable)

Copies all visual properties from this drawable to target.

Link copied to clipboard
fun M2HudDrawable.fadeInto(group: M2Panel, durationMillis: Long, targetAlpha: <Error class: unknown class>, apply: Boolean = false, callback: IM2AnimatorCallback? = null): M2Animator

Adds this M2HudDrawable to the given M2Panel and fades it in from fully transparent to the specified targetAlpha.

Link copied to clipboard
open override fun getBottomY(): Float

Returns the Y coordinate of the bottom edge of this drawable (y + height).

Link copied to clipboard
fun getColor(): <Error class: unknown class>

Returns the current fill color of this drawable.

Link copied to clipboard
open override fun getEndX(): Float

Returns the X coordinate of the right edge of this drawable (x + width).

Link copied to clipboard
open override fun getHeight(): Float

Returns the current height of this drawable.

Link copied to clipboard
open override fun getWidth(): Float

Returns the current width of this drawable.

Link copied to clipboard
open override fun getX(): Float

Returns the X coordinate of this drawable relative to its parent.

Link copied to clipboard
open override fun getY(): Float

Returns the Y coordinate of this drawable relative to its parent.

Link copied to clipboard
open override fun setAlpha(alpha: <Error class: unknown class>): M2Drawable

The alpha, pinned to 255 while a gradient is set.

Link copied to clipboard
open fun setColor(color: <Error class: unknown class>): M2HudDrawable

Sets the fill color of this drawable.

Sets the fill color of this drawable using a predefined M2Color.

Link copied to clipboard
fun setDimensions(x: Float, y: Float, width: Float, height: Float): M2HudDrawable
fun setDimensions(x: Int, y: Int, width: Int, height: Int): M2HudDrawable

Sets the position and size of this drawable in a single call.

Link copied to clipboard
open override fun setHeight(height: Float): M2HudDrawable

Sets the height of this drawable.

Link copied to clipboard

Sets both width and height to the same value, creating a square bounding box.

Link copied to clipboard
open override fun setWidth(width: Float): M2HudDrawable

Sets the width of this drawable.

Link copied to clipboard
fun setWidthHeight(width: Float, height: Float): M2HudDrawable
fun setWidthHeight(width: Int, height: Int): M2HudDrawable

Sets both width and height of this drawable.

Link copied to clipboard
fun setWidthHeightAs(group: M2Group, factor: Float = 1.0f): M2HudDrawable

Sets this drawable's width and height to match the given M2Group, optionally scaled by factor.

fun setWidthHeightAs(hudElement: M2HudDrawable, factor: Float = 1.0f): M2HudDrawable

Sets this drawable's width and height to match another M2HudDrawable, optionally scaled by factor.

fun setWidthHeightAs(screen: M2Screen, factor: Float = 1.0f): M2HudDrawable

Sets this drawable's width and height to match the given M2Screen, optionally scaled by factor.

Link copied to clipboard
open override fun setX(x: Float): M2HudDrawable

Sets the X coordinate of this drawable relative to its parent.

Link copied to clipboard
fun setXY(x: Int, y: Int): M2HudDrawable

Sets the position of this drawable relative to its parent.

Link copied to clipboard
open override fun setY(y: Float): M2HudDrawable

Sets the Y coordinate of this drawable relative to its parent.

Link copied to clipboard
open override fun toString(): String

Returns a human-readable string describing this drawable's identity and state, including tag, firmware ID, creation status, object type, alpha, and world position (when set).