M2ScreenService

class M2ScreenService : M2Service

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

Properties

Link copied to clipboard

Whether preview mode is currently active.

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)

Enables or disables phone preview mode, which mirrors the glasses HUD on the phone display.

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
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.

Link copied to clipboard

Sends updated session parameters (screen offset, dimensions, rendering rate) to the glasses if any have changed since the last call.