mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
trying to make fixtures with UIs working, was not successful
This commit is contained in:
@@ -116,7 +116,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
lateinit var logo: TextureRegion
|
||||
|
||||
val uiContainer = ArrayList<UICanvas>()
|
||||
val uiContainer = ArrayList<UICanvas?>()
|
||||
private lateinit var uiMenu: UICanvas
|
||||
|
||||
private lateinit var worldFBO: FrameBuffer
|
||||
@@ -226,7 +226,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
// update UIs //
|
||||
uiContainer.forEach { it.update(delta) }
|
||||
uiContainer.forEach { it?.update(delta) }
|
||||
}
|
||||
|
||||
fun renderScreen() {
|
||||
@@ -325,42 +325,42 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
class TitleScreenController(val screen: TitleScreen) : InputAdapter() {
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.touchUp(screenX, screenY, pointer, button) }
|
||||
screen.uiContainer.forEach { it?.touchUp(screenX, screenY, pointer, button) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.mouseMoved(screenX, screenY) }
|
||||
screen.uiContainer.forEach { it?.mouseMoved(screenX, screenY) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
screen.uiContainer.forEach { it.keyTyped(character) }
|
||||
screen.uiContainer.forEach { it?.keyTyped(character) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.scrolled(amount) }
|
||||
screen.uiContainer.forEach { it?.scrolled(amount) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.keyUp(keycode) }
|
||||
screen.uiContainer.forEach { it?.keyUp(keycode) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.touchDragged(screenX, screenY, pointer) }
|
||||
screen.uiContainer.forEach { it?.touchDragged(screenX, screenY, pointer) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.keyDown(keycode) }
|
||||
screen.uiContainer.forEach { it?.keyDown(keycode) }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
screen.uiContainer.forEach { it.touchDown(screenX, screenY, pointer, button) }
|
||||
screen.uiContainer.forEach { it?.touchDown(screenX, screenY, pointer, button) }
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user