M2ScreenService

class M2ScreenService : M2Service

Service for managing the screen stack, z-ordering, and the frame rendering loop.

Properties

Link copied to clipboard

The current head orientation quaternion.

Link copied to clipboard
var tick: Long

The current frame tick count since the SDK started.

Link copied to clipboard

The screen currently at the top of the stack and visible to the user.

Functions

Link copied to clipboard
fun addScreen(screen: M2Screen)

Pushes a regular (non-system) screen onto the stack, making it the topmost visible screen.

Link copied to clipboard
fun enablePreview(enable: Boolean)

Turns the phone-side HUD preview on or off.

Link copied to clipboard

Returns the current rendering center X offset, used for personal display alignment.

Link copied to clipboard

Returns the current rendering center Y offset, used for personal display alignment.

Link copied to clipboard

Number of draw-object ids currently allocated to the glasses out of the fixed 255-id pool (id 0 is reserved as a sentinel). Every on-screen drawable (card, text, image, animator target…) holds one id for as long as it's on screen; exhausting the pool fails further allocations (silently, on the wire). Poll this to warn the user before that happens.

Link copied to clipboard
fun logTree(label: String? = null, tag: String = "M2LogTree")

Logs the hierarchical drawable tree of all screens to the SDK logger for debugging.

Link copied to clipboard

Registers a listener for frame-based draw events.

Link copied to clipboard

Registers a listener for screen stack and rendering configuration events.

Link copied to clipboard
fun removeScreen(screen: M2Screen)

Removes a regular (non-system) screen from the stack and pops the next screen to the top.

Link copied to clipboard

Removes the current topmost screen (if present).

Link copied to clipboard

Sets the rendering center X offset for personal display alignment.

Link copied to clipboard

Sets the rendering center Y offset for personal display alignment.

Link copied to clipboard
fun stackSize(): Int

Returns the number of screens currently in the screen stack.

Link copied to clipboard

Unregisters a previously registered draw event listener.

Link copied to clipboard

Unregisters a previously registered screen event listener.