nsmenu working submenu navigation; new graphics bug discovered

This commit is contained in:
Minjae Song
2018-12-10 03:33:08 +09:00
parent b44699ae04
commit 06c6c68dba
4 changed files with 110 additions and 33 deletions

View File

@@ -66,9 +66,11 @@ abstract class UICanvas(
get() = mouseUp && Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary"))
/** Called by the screen */
fun update(delta: Float) {
handler.update(this, delta)
}
/** Called by the screen */
fun render(batch: SpriteBatch, camera: Camera) {
handler.render(this, batch, camera)
}
@@ -127,6 +129,8 @@ abstract class UICanvas(
}
/**
* Called by the screen's InputProcessor
*
* When implementing this, make sure to use ```mouseInScreen()``` function!
*/
open fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
@@ -137,6 +141,7 @@ abstract class UICanvas(
}
else return false
}
/** Called by the screen's InputProcessor */
open fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
if (this.isVisible && mouseInScreen(screenX, screenY)) {
uiItems.forEach { it.touchDown(screenX, screenY, pointer, button) }
@@ -145,6 +150,7 @@ abstract class UICanvas(
}
else return false
}
/** Called by the screen's InputProcessor */
open fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
if (this.isVisible) {
uiItems.forEach { it.touchUp(screenX, screenY, pointer, button) }
@@ -153,6 +159,7 @@ abstract class UICanvas(
}
else return false
}
/** Called by the screen's InputProcessor */
open fun scrolled(amount: Int): Boolean {
if (this.isVisible) {
uiItems.forEach { it.scrolled(amount) }
@@ -161,6 +168,7 @@ abstract class UICanvas(
}
else return false
}
/** Called by the screen's InputProcessor */
open fun keyDown(keycode: Int): Boolean {
if (this.isVisible) {
uiItems.forEach { it.keyDown(keycode) }
@@ -169,6 +177,7 @@ abstract class UICanvas(
}
else return false
}
/** Called by the screen's InputProcessor */
open fun keyUp(keycode: Int): Boolean {
if (this.isVisible) {
uiItems.forEach { it.keyUp(keycode) }
@@ -177,6 +186,7 @@ abstract class UICanvas(
}
else return false
}
/** Called by the screen's InputProcessor */
open fun keyTyped(character: Char): Boolean {
return false
//uiItems.forEach { it.keyT }