-
Notifications
You must be signed in to change notification settings - Fork 138
/
Application.kt
42 lines (35 loc) · 1.33 KB
/
Application.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package org.hexworks.zircon.api.application
import org.hexworks.cobalt.events.api.Subscription
import org.hexworks.zircon.api.behavior.Closeable
import org.hexworks.zircon.api.grid.TileGrid
import org.hexworks.zircon.internal.application.InternalApplication
/**
* An [Application] enhances a [TileGrid] with continuous rendering,
* and some additional functionality such as rendering callbacks.
*/
interface Application : Closeable {
/**
* The tile grid that's being continuously rendered by this [Application].
*/
val tileGrid: TileGrid
/**
* Starts this application and returns the framework-specific application object.
*/
suspend fun start()
/**
* Adds a callback which will be called **before** every render.
* **Note that** this operation should be **very fast** otherwise it will
* block the rendering. Very fast is `<1ms`.
*/
fun beforeRender(listener: (RenderData) -> Unit): Subscription
/**
* Adds a callback which will be called **after** every render.
* **Note that** this operation should be **very fast** otherwise it will
* block the rendering. Very fast is `<1ms`.
*/
fun afterRender(listener: (RenderData) -> Unit): Subscription
/**
* Exposes the internal API of this [Application].
*/
fun asInternal(): InternalApplication
}