Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Exploring the n'th dimension.

Adam Arold adam-arold

💭
Exploring the n'th dimension.
View GitHub Profile
View java.sh
java -jar build/libs/caves-of-zircon.jar
View git.sh
git reset --hard PROJECT_SETUP
View git.sh
cd caves-of-zircon-tutorial
View git.sh
git clone https://github.com/Hexworks/caves-of-zircon-tutorial.git
View Observable.kt
fun <T: Event> Observable<T>.onEvent(fn: (Event) -> Unit){
onEvent(object : Listener<T> {
override fun accept(event: T) {
fn(event)
}
})
}
View Observable.kt
observable.onEvent(object : Listener<Event>{
override fun accept(event: Event) {
// ...
}
})
View Observable.kt
interface Observable <T: Event> {
fun onEvent(listener: Listener<T>)
}
View oops.java
// Oops! Function1 wanted!
observable.onEvent(/* */);
View Observable.kt
interface Observable<T : Event> {
fun onEvent(fn: (T) -> Unit)
}
View Positions.kt
object Positions {
@JvmStatic
@JvmOverloads
fun create(x: Int,
y: Int = x) = Position.create(x, y)
}