Views

class Views(val coroutineContext: CoroutineContext, val ag: AG, val injector: Injector = Injector(), val input: Input = Input(), val timeProvider: TimeProvider = TimeProvider, val stats: Stats = Stats(), val gameWindow: GameWindow, val gameId: String = "korgegame", val settingsFolder: String? = null, val batchMaxQuads: Int = BatchBuilder2D.DEFAULT_BATCH_QUADS, val bp: BoundsProvider = BoundsProvider.Base(), val stageBuilder: (Views) -> Stage = { Stage(it) }) : BaseEventListener, Extra, CoroutineScope, ViewsContainer, BoundsProvider, DialogInterfaceProvider, Closeable, ResourcesContainer, InvalidateNotifier, DeviceDimensionsProvider

Heavyweight singleton object within the application that contains information about the Views. It contains information about the coroutineContext, the gameWindow, the injector, the input and contains a reference to the root view.

Constructors

Link copied to clipboard
constructor(gameWindow: GameWindow)
constructor(coroutineContext: CoroutineContext, ag: AG, injector: Injector = Injector(), input: Input = Input(), timeProvider: TimeProvider = TimeProvider, stats: Stats = Stats(), gameWindow: GameWindow, gameId: String = "korgegame", settingsFolder: String? = null, batchMaxQuads: Int = BatchBuilder2D.DEFAULT_BATCH_QUADS, bp: BoundsProvider = BoundsProvider.Base(), stageBuilder: (Views) -> Stage = { Stage(it) })

Types

Link copied to clipboard
data class SaveEvent(val action: String, val view: View?)

Properties

Link copied to clipboard
Link copied to clipboard
open override val actualVirtualBottom: Double
Link copied to clipboard
open override var actualVirtualBounds: Rectangle
Link copied to clipboard
open override val actualVirtualHeight: Int
Link copied to clipboard
open override val actualVirtualLeft: Int
Link copied to clipboard
open override val actualVirtualRight: Double
Link copied to clipboard
open override val actualVirtualTop: Int
Link copied to clipboard
open override val actualVirtualWidth: Int
Link copied to clipboard
Link copied to clipboard
val ag: AG
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val computedPixelRatio: Double
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
lateinit var debugBmpFont: BitmapFont
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val devicePixelRatio: Double
Link copied to clipboard
open override val dialogInterface: DialogInterface
Link copied to clipboard
Link copied to clipboard
open override var extra: ExtraType
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Mouse coordinates relative to the Stage singleton

Link copied to clipboard
Link copied to clipboard
open override var globalToWindowMatrix: Matrix
Link copied to clipboard
open override val globalToWindowScale: Scale
Link copied to clipboard
open override val globalToWindowScaleAvg: Double
Link copied to clipboard
open override val globalToWindowScaleX: Double
Link copied to clipboard
open override val globalToWindowScaleY: Double
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var name: String?
Link copied to clipboard

Native height in pixels (in retina displays this will be twice the window height). Use virtualHeight instead

Link copied to clipboard

Native width in pixels (in retina displays this will be twice the window width). Use virtualWidth instead

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val pixelsPerCm: Double

Approximate on iOS

Link copied to clipboard
open override val pixelsPerInch: Double

Approximate on iOS

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val resources: Resources
Link copied to clipboard
Link copied to clipboard
val root: Stage

Reference to the root node Stage (alias)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val settingsFolder: String? = null
Link copied to clipboard

Reference to the root node Stage

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val views: Views
Link copied to clipboard
open override val virtualBottom: Double
Link copied to clipboard

The defined virtual height

Link copied to clipboard
Link copied to clipboard
open override val virtualLeft: Double
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val virtualRight: Double
Link copied to clipboard
Link copied to clipboard
open override val virtualTop: Double
Link copied to clipboard

The defined virtual width

Link copied to clipboard
Link copied to clipboard

Mouse coordinates relative to the native window. Can't be used directly. Use globalMousePos instead

Link copied to clipboard
open override var windowToGlobalMatrix: Matrix
Link copied to clipboard
open override val windowToGlobalScale: Scale
Link copied to clipboard
open override val windowToGlobalScaleAvg: Double
Link copied to clipboard
open override val windowToGlobalScaleX: Double
Link copied to clipboard
open override val windowToGlobalScaleY: Double
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
suspend fun DialogInterfaceProvider.alert(message: String)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : BEvent> clearEvents(type: EventType<T>)
Link copied to clipboard
open override fun close()
Link copied to clipboard
suspend fun closeSuspend()
Link copied to clipboard
Link copied to clipboard
fun debugHightlightView(viewToHightlight: View?, onlyIfDebuggerOpened: Boolean = false)
Link copied to clipboard
Link copied to clipboard
override fun <T : BEvent> dispatch(event: T): Boolean
override fun <T : BEvent> dispatch(type: EventType<T>, event: T, result: EventResult?): Boolean

open override fun <T : BEvent> dispatch(type: EventType<T>, event: T, result: EventResult?, up: Boolean, down: Boolean): Boolean

Dispatched a event of type that will execute all the handlers registered with onEvents in this object and its children.

Link copied to clipboard
open fun <T : BEvent> dispatchChildren(type: EventType<T>, event: T, result: EventResult?)
Link copied to clipboard
open fun <T : BEvent> dispatchDown(type: EventType<T>, event: T, result: EventResult? = null): Boolean
Link copied to clipboard
Link copied to clipboard
open fun <T : BEvent> dispatchParent(type: EventType<T>, event: T, result: EventResult?)
Link copied to clipboard
open fun <T : BEvent> dispatchUp(type: EventType<T>, event: T, result: EventResult? = null): Boolean
Link copied to clipboard
Link copied to clipboard
override fun <T : BEvent> dispatchWithResult(event: T, out: EventResult): EventResult
Link copied to clipboard
fun dispose()
Link copied to clipboard
fun dumpStats()
Link copied to clipboard
fun frameUpdateAndRender(fixedSizeStep: TimeSpan = TimeSpan.NIL, forceRender: Boolean = false, doUpdate: Boolean = true, doRender: Boolean = true)
Link copied to clipboard
Link copied to clipboard
open override fun globalToWindowBounds(bounds: Rectangle): Rectangle
Link copied to clipboard
open override fun globalToWindowCoords(pos: Point): Point
Link copied to clipboard
suspend fun init()
Link copied to clipboard
open override fun invalidatedView(view: BaseView?)
Link copied to clipboard
Link copied to clipboard
fun onClose(callback: suspend () -> Unit)

Adds a callback to be executed when the game is closed in normal circumstances.

Link copied to clipboard
override fun <T : BEvent> onEvent(type: EventType<T>, handler: (T) -> Unit): CloseableCancellable

Registers a handler block to be executed when an event of type is dispatched

Link copied to clipboard
override fun onEventCount(type: EventType<*>): Int
Link copied to clipboard
open fun <T : BEvent> onEvents(vararg etypes: EventType<out T>, handler: (T) -> Unit): Closeable
Link copied to clipboard
Link copied to clipboard
suspend fun DialogInterfaceProvider.openFileDialog(filter: String? = null, write: Boolean = false, multi: Boolean = false): List<VfsFile>
suspend fun DialogInterfaceProvider.openFileDialog(filter: FileFilter? = null, write: Boolean = false, multi: Boolean = false, currentDir: VfsFile? = null): List<VfsFile>
Link copied to clipboard
suspend fun DialogInterfaceProvider.prompt(message: String, default: String = ""): String
Link copied to clipboard
fun registerPropertyTrigger(propName: String, gen: (View, String, String) -> Unit)
Link copied to clipboard
fun registerPropertyTriggerSuspend(propName: String, gen: suspend (View, String, String) -> Unit)
Link copied to clipboard

Enables the use of StageComponent components.

Link copied to clipboard
fun render()
Link copied to clipboard
fun renderNew(frameBuffer: AGFrameBuffer = ag.mainFrameBuffer)
Link copied to clipboard
fun resized()
fun resized(width: Int, height: Int)
Link copied to clipboard
fun BoundsProvider.setBoundsInfo(reqVirtualSize: Size, actualSize: Size, scaleMode: ScaleMode = ScaleMode.FILL, anchor: Anchor = Anchor.CENTER, virtualSize: Ref<SizeInt> = Ref(), targetSize: Ref<SizeInt> = Ref())
Link copied to clipboard
fun setVirtualSize(width: Int, height: Int)
Link copied to clipboard
fun Views.simulateRenderFrame(view: View, posterize: Int = 0, includeBackground: Boolean = true, useTexture: Boolean = true): Bitmap32
Link copied to clipboard
Link copied to clipboard
fun <T : View?> undoable(action: String, view: T, block: (T) -> Unit)
Link copied to clipboard
fun update(elapsed: TimeSpan)
Link copied to clipboard
open override fun windowToGlobalCoords(pos: Point): Point