trying to write a new ingamecontroller so that its update can be manually controlled

This commit is contained in:
minjaesong
2021-08-21 21:03:39 +09:00
parent bb95444067
commit ca72a6fbe5
14 changed files with 214 additions and 111 deletions

View File

@@ -16,8 +16,7 @@ import net.torvald.terrarum.Terrarum
* - updateListener
* - keyDownListener
* - keyUpListener
* - mouseMovedListene
* - touchDraggedListe
* - touchDraggedLister
* - touchDownListener
* - touchUpListener
* - scrolledListener
@@ -104,7 +103,6 @@ abstract class UIItem(var parentUI: UICanvas, val initialX: Int, val initialY: I
open var keyDownListener: ((Int) -> Unit)? = null
/** Parametre: keycode */
open var keyUpListener: ((Int) -> Unit)? = null
open var mouseMovedListener: ((Int, Int) -> Unit)? = null
open var touchDraggedListener: ((Int, Int, Int) -> Unit)? = null
/** Parameters: screenX, screenY, pointer, button */
open var touchDownListener: ((Int, Int, Int, Int) -> Unit)? = null
@@ -177,14 +175,6 @@ abstract class UIItem(var parentUI: UICanvas, val initialX: Int, val initialY: I
}
// mouse controlled
open fun mouseMoved(screenX: Int, screenY: Int): Boolean {
if (parentUI.isVisible && mouseMovedListener != null) {
mouseMovedListener!!.invoke(relativeMouseX, relativeMouseY)
return true
}
return false
}
open fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
if (parentUI.isVisible && touchDraggedListener != null) {
touchDraggedListener!!.invoke(relativeMouseX, relativeMouseY, pointer)