Browse Source

Tweak window setup order so viewsd have access to screen in View.wasAdded

master
Shadowfacts 2 years ago
parent
commit
8a3be763f1
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
  1. 3
      src/main/kotlin/net/shadowfacts/cacao/CacaoScreen.kt
  2. 2
      src/main/kotlin/net/shadowfacts/cacao/Window.kt

3
src/main/kotlin/net/shadowfacts/cacao/CacaoScreen.kt

@ -37,8 +37,11 @@ open class CacaoScreen: Screen(LiteralText("CacaoScreen")) {
*/
fun <T: Window> addWindow(window: T, index: Int = _windows.size): T {
_windows.add(index, window)
window.screen = this
window.wasAdded()
window.resize(width, height)
return window
}

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

@ -79,7 +79,9 @@ class Window(
init {
createInternalConstraints()
}
fun wasAdded() {
viewController.window = this
viewController.loadView()

Loading…
Cancel
Save