ASMR/src/main/kotlin/net/shadowfacts/cacao/Window.kt

34 lines
521 B
Kotlin
Raw Normal View History

2019-06-22 19:02:17 +00:00
package net.shadowfacts.cacao
2019-06-22 19:02:17 +00:00
import net.shadowfacts.cacao.geometry.Point
import net.shadowfacts.cacao.view.View
import no.birkett.kiwi.Solver
2019-06-22 14:59:18 +00:00
/**
* @author shadowfacts
*/
class Window {
var solver = Solver()
val views = mutableListOf<View>()
fun <T: View> addView(view: T): T {
views.add(view)
view.solver = solver
view.wasAdded()
return view
}
fun layout() {
solver.updateVariables()
views.forEach(View::didLayout)
}
fun draw(mouse: Point, delta: Float) {
views.forEach(View::draw)
}
}