mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
somehow fixed a consolewin bug
- It would read a key even if it's closed
This commit is contained in:
@@ -56,9 +56,9 @@
|
||||
"177"; "177";"BLOCK_TORCH_FROST" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"fxtr"; "0"; "0"; "1"; "0";"0.3048";"0.4848";"1.0000";"0.0000"; "0"; "1"; "N/A"; "0";"16"
|
||||
"192"; "176";"BLOCK_TORCH" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"fxtr"; "0"; "0"; "1"; "0";"0.0000";"0.0000";"0.0000";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"193"; "177";"BLOCK_TORCH_FROST" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"fxtr"; "0"; "0"; "1"; "0";"0.0000";"0.0000";"0.0000";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"208"; "208";"BLOCK_ILLUMINATOR_WHITE" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"0.8916";"0.9304";"0.9148";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"208"; "208";"BLOCK_ILLUMINATOR_WHITE" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"0.9270";"0.9414";"0.8519";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"209"; "209";"BLOCK_ILLUMINATOR_YELLOW" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"1.0000";"0.8408";"0.0000";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"210"; "210";"BLOCK_ILLUMINATOR_ORANGE" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"1.0000";"0.6100";"0.0000";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"210"; "210";"BLOCK_ILLUMINATOR_ORANGE" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"1.0000";"0.5294";"0.0000";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"211"; "211";"BLOCK_ILLUMINATOR_RED" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"0.9188";"0.0000";"0.0000";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"212"; "212";"BLOCK_ILLUMINATOR_FUCHSIA" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"0.9188";"0.0000";"0.7156";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
"213"; "213";"BLOCK_ILLUMINATOR_PURPLE" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"glas"; "0"; "1"; "0"; "1";"0.7156";"0.0000";"0.9188";"0.0000"; "0"; "0"; "N/A"; "0";"16"
|
||||
@@ -159,7 +159,8 @@
|
||||
|
||||
## Illuminators ##
|
||||
|
||||
# Illuminator white: RGB(228,238,234), simulation of a halophosphate FL lamp (If you want high CRI lamp, collect a daylight!)
|
||||
# Illuminator white: Mercury Lamp; CIELAB of (94, -5.131, 10.613), which is made out of CIEXYZ of (0.947638, 1.146481, 0.482263), measured with ColorMunki Spectrometer (If you want high CRI lamp, collect a daylight!)
|
||||
# Illuminator orange: Sodium Lamp; CIE xy of (0.5375, 0.4153), CIEXYZ of (352.531139, 272.379377, 30.980339), measured with ColorMunki Spectrometer
|
||||
# Defalut torch : Y 64 x 0.55183 y 0.40966 (Planckian ~1 770 K); real candlelight colour taken from Spyder5 colorimeter (for I couldn't afford i1DisplayPro/Colormunki)
|
||||
# Sunstone: Artificial sunlight, change colour over time in sync with sunlight. The light is set by game's code.
|
||||
# Sunlight capacitor: daylight at noon. Set by game's code.
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 20.
|
@@ -100,7 +100,7 @@ class IngameController(val ingame: Ingame) : InputAdapter() {
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
ingame.uiContainer.forEach { it.keyTyped(character) }
|
||||
ingame.uiContainer.forEach { if (it.isVisible) it.keyTyped(character) }
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@ class ConsoleWindow : UICanvas() {
|
||||
val acceptedChars = "1234567890-=qwfpgjluy;[]\\arstdhneio'zxcvbkm,./!@#$%^&*()_+QWFPGJLUY:{}|ARSTDHNEIO\"ZXCVBKM<>? ".toSet()
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
println("[ConsoleWindow] Key typed event; isVisible = $isVisible")
|
||||
|
||||
if (character in acceptedChars) {
|
||||
commandInputPool!!.append(character)
|
||||
inputCursorPos += 1
|
||||
|
||||
@@ -12,6 +12,8 @@ import net.torvald.terrarum.gameactors.roundInt
|
||||
/**
|
||||
* UIItems must be added manually at the init!
|
||||
*
|
||||
* FIXME: Bad design!!
|
||||
*
|
||||
* Created by minjaesong on 2015-12-31.
|
||||
*/
|
||||
abstract class UICanvas(
|
||||
|
||||
@@ -104,7 +104,7 @@ class UIHandler(//var UI: UICanvas,
|
||||
if (closeFired && openCloseCounter > 9) closeFired = false
|
||||
|
||||
|
||||
if (isVisible || alwaysVisible) {
|
||||
if (isVisible) {
|
||||
ui.updateUI(delta)
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ class UIHandler(//var UI: UICanvas,
|
||||
|
||||
fun render(ui: UICanvas, batch: SpriteBatch, camera: Camera) {
|
||||
|
||||
if (isVisible || alwaysVisible) {
|
||||
if (isVisible) {
|
||||
// camera SHOULD BE CENTERED to HALFX and HALFY (see StateInGame) //
|
||||
|
||||
|
||||
@@ -255,4 +255,85 @@ class UIHandler(//var UI: UICanvas,
|
||||
fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
||||
Ingame.setCameraPosition(batch, camera, newX, newY)
|
||||
}
|
||||
|
||||
fun mouseMoved(uiItems: List<UIItem>, screenX: Int, screenY: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.mouseMoved(screenX, screenY) }
|
||||
subUIs.forEach { it.mouseMoved(screenX, screenY) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun touchDragged(uiItems: List<UIItem>, screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.touchDragged(screenX, screenY, pointer) }
|
||||
subUIs.forEach { it.touchDragged(screenX, screenY, pointer) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun touchDown(uiItems: List<UIItem>, screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.touchDown(screenX, screenY, pointer, button) }
|
||||
subUIs.forEach { it.touchDown(screenX, screenY, pointer, button) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun touchUp(uiItems: List<UIItem>, screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.touchUp(screenX, screenY, pointer, button) }
|
||||
subUIs.forEach { it.touchUp(screenX, screenY, pointer, button) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun scrolled(uiItems: List<UIItem>, amount: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.scrolled(amount) }
|
||||
subUIs.forEach { it.scrolled(amount) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun keyDown(uiItems: List<UIItem>, keycode: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.keyDown(keycode) }
|
||||
subUIs.forEach { it.keyDown(keycode) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun keyUp(uiItems: List<UIItem>, keycode: Int): Boolean {
|
||||
if (isVisible) {
|
||||
uiItems.forEach { it.keyUp(keycode) }
|
||||
subUIs.forEach { it.keyUp(keycode) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
fun keyTyped(uiItems: List<UIItem>, character: Char): Boolean {
|
||||
if (isVisible) {
|
||||
//uiItems.forEach { it.keyTyped(character) }
|
||||
subUIs.forEach { it.keyTyped(character) }
|
||||
return true
|
||||
}
|
||||
else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,10 +561,14 @@ object LightmapRenderer {
|
||||
}
|
||||
|
||||
|
||||
fun resize(width: Int, height: Int) {
|
||||
fun resize(screenW: Int, screenH: Int) {
|
||||
// make sure the BlocksDrawer is resized first!
|
||||
|
||||
lightBuffer = Pixmap(BlocksDrawer.tilesInHorizontal, BlocksDrawer.tilesInVertical, Pixmap.Format.RGBA8888)
|
||||
// copied from BlocksDrawer, duh!
|
||||
val tilesInHorizontal = (screenW.toFloat() / TILE_SIZE).ceilInt() + 1
|
||||
val tilesInVertical = (screenH.toFloat() / TILE_SIZE).ceilInt() + 1
|
||||
|
||||
lightBuffer = Pixmap(tilesInHorizontal, tilesInVertical, Pixmap.Format.RGBA8888)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user