mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
actually working load manual/auto button
This commit is contained in:
@@ -777,8 +777,8 @@ public class App implements ApplicationListener {
|
|||||||
public void resize(int w0, int h0) {
|
public void resize(int w0, int h0) {
|
||||||
|
|
||||||
float magn = (float) getConfigDouble("screenmagnifying");
|
float magn = (float) getConfigDouble("screenmagnifying");
|
||||||
int width = Math.round(w0 / magn);
|
int width = (int) Math.floor(w0 / magn);
|
||||||
int height = Math.round(h0 / magn);
|
int height = (int) Math.floor(h0 / magn);
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "Resize called: "+width+","+height);
|
printdbg(this, "Resize called: "+width+","+height);
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ class TerrarumScreenSize(scrw: Int = defaultW, scrh: Int = defaultH) {
|
|||||||
|
|
||||||
this.magn = magn
|
this.magn = magn
|
||||||
|
|
||||||
windowW = (scrw * magn).roundToInt() and 0x7FFFFFFE
|
windowW = (scrw * magn).ceilInt() and 0x7FFFFFFE
|
||||||
windowH = (scrh * magn).roundToInt() and 0x7FFFFFFE
|
windowH = (scrh * magn).ceilInt() and 0x7FFFFFFE
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "Window dim: $windowW x $windowH, called by:")
|
printdbg(this, "Window dim: $windowW x $windowH, called by:")
|
||||||
|
|||||||
@@ -191,7 +191,16 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
imageDrawHeight = imageButtonH,
|
imageDrawHeight = imageButtonH,
|
||||||
highlightable = false,
|
highlightable = false,
|
||||||
useBorder = true,
|
useBorder = true,
|
||||||
).also { it.extraDrawOp = getDrawTextualInfoFun(loadables.getManualSave()!!) }
|
).also {
|
||||||
|
it.extraDrawOp = getDrawTextualInfoFun(loadables.getManualSave()!!)
|
||||||
|
it.clickOnceListener = { _,_ ->
|
||||||
|
loadables.getManualSave()!!.let {
|
||||||
|
UILoadGovernor.playerDisk = it.player
|
||||||
|
UILoadGovernor.worldDisk = it.world
|
||||||
|
}
|
||||||
|
mode = MODE_LOAD_DA_SHIT_ALREADY
|
||||||
|
}
|
||||||
|
}
|
||||||
loadAutoThumbButton = UIItemImageButton(this, autoThumb,
|
loadAutoThumbButton = UIItemImageButton(this, autoThumb,
|
||||||
initialX = (Toolkit.drawWidth - altSelDrawW)/2 + altSelQQQdrawW - imageButtonW/2,
|
initialX = (Toolkit.drawWidth - altSelDrawW)/2 + altSelQQQdrawW - imageButtonW/2,
|
||||||
initialY = altSelDrawY + 120,
|
initialY = altSelDrawY + 120,
|
||||||
@@ -201,7 +210,16 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
imageDrawHeight = imageButtonH,
|
imageDrawHeight = imageButtonH,
|
||||||
highlightable = false,
|
highlightable = false,
|
||||||
useBorder = true,
|
useBorder = true,
|
||||||
).also { it.extraDrawOp = getDrawTextualInfoFun(loadables.getAutoSave()!!) }
|
).also {
|
||||||
|
it.extraDrawOp = getDrawTextualInfoFun(loadables.getAutoSave()!!)
|
||||||
|
it.clickOnceListener = { _,_ ->
|
||||||
|
loadables.getAutoSave()!!.let {
|
||||||
|
UILoadGovernor.playerDisk = it.player
|
||||||
|
UILoadGovernor.worldDisk = it.world
|
||||||
|
}
|
||||||
|
mode = MODE_LOAD_DA_SHIT_ALREADY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MODE_SAVE_MULTIPLE_CHOICES
|
MODE_SAVE_MULTIPLE_CHOICES
|
||||||
}
|
}
|
||||||
@@ -217,12 +235,12 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
UILoadGovernor.previousSaveWasLoaded = true
|
UILoadGovernor.previousSaveWasLoaded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODE_LOAD_DA_SHIT_ALREADY
|
MODE_LOAD_DA_SHIT_ALREADY
|
||||||
|
|
||||||
|
|
||||||
// test codes //
|
// test codes //
|
||||||
|
|
||||||
val autoThumb = loadables.getManualSave()!!.getThumbnail()
|
/*val autoThumb = loadables.getManualSave()!!.getThumbnail()
|
||||||
val manualThumb = loadables.getManualSave()!!.getThumbnail()
|
val manualThumb = loadables.getManualSave()!!.getThumbnail()
|
||||||
|
|
||||||
loadManualThumbButton = UIItemImageButton(this, manualThumb,
|
loadManualThumbButton = UIItemImageButton(this, manualThumb,
|
||||||
@@ -234,7 +252,16 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
imageDrawHeight = imageButtonH,
|
imageDrawHeight = imageButtonH,
|
||||||
highlightable = false,
|
highlightable = false,
|
||||||
useBorder = true,
|
useBorder = true,
|
||||||
).also { it.extraDrawOp = getDrawTextualInfoFun(loadables.getManualSave()!!) }
|
).also {
|
||||||
|
it.extraDrawOp = getDrawTextualInfoFun(loadables.getManualSave()!!)
|
||||||
|
it.clickOnceListener = { _,_ ->
|
||||||
|
loadables.getManualSave()!!.let {
|
||||||
|
UILoadGovernor.playerDisk = it.player
|
||||||
|
UILoadGovernor.worldDisk = it.world
|
||||||
|
}
|
||||||
|
mode = MODE_LOAD_DA_SHIT_ALREADY
|
||||||
|
}
|
||||||
|
}
|
||||||
loadAutoThumbButton = UIItemImageButton(this, autoThumb,
|
loadAutoThumbButton = UIItemImageButton(this, autoThumb,
|
||||||
initialX = (Toolkit.drawWidth - altSelDrawW)/2 + altSelQQQdrawW - imageButtonW/2,
|
initialX = (Toolkit.drawWidth - altSelDrawW)/2 + altSelQQQdrawW - imageButtonW/2,
|
||||||
initialY = altSelDrawY + 120,
|
initialY = altSelDrawY + 120,
|
||||||
@@ -244,9 +271,18 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
imageDrawHeight = imageButtonH,
|
imageDrawHeight = imageButtonH,
|
||||||
highlightable = false,
|
highlightable = false,
|
||||||
useBorder = true,
|
useBorder = true,
|
||||||
).also { it.extraDrawOp = getDrawTextualInfoFun(loadables.getManualSave()!!) }
|
).also {
|
||||||
|
it.extraDrawOp = getDrawTextualInfoFun(loadables.getManualSave()!!)
|
||||||
|
it.clickOnceListener = { _,_ ->
|
||||||
|
loadables.getManualSave()!!.let {
|
||||||
|
UILoadGovernor.playerDisk = it.player
|
||||||
|
UILoadGovernor.worldDisk = it.world
|
||||||
|
}
|
||||||
|
mode = MODE_LOAD_DA_SHIT_ALREADY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MODE_SAVE_MULTIPLE_CHOICES
|
MODE_SAVE_MULTIPLE_CHOICES*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,11 +528,15 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
|
|
||||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
if (mode == MODE_SELECT) getCells().forEach { it.touchDown(screenX, screenY, pointer, button) }
|
if (mode == MODE_SELECT) getCells().forEach { it.touchDown(screenX, screenY, pointer, button) }
|
||||||
|
if (::loadAutoThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadAutoThumbButton.touchDown(screenX, screenY, pointer, button) }
|
||||||
|
if (::loadManualThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadManualThumbButton.touchDown(screenX, screenY, pointer, button) }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
if (mode == MODE_SELECT) getCells().forEach { it.touchUp(screenX, screenY, pointer, button) }
|
if (mode == MODE_SELECT) getCells().forEach { it.touchUp(screenX, screenY, pointer, button) }
|
||||||
|
if (::loadAutoThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadAutoThumbButton.touchUp(screenX, screenY, pointer, button) }
|
||||||
|
if (::loadManualThumbButton.isInitialized && mode == MODE_SAVE_MULTIPLE_CHOICES) { loadManualThumbButton.touchUp(screenX, screenY, pointer, button) }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ open class UIItemImageButton(
|
|||||||
// draw image
|
// draw image
|
||||||
batch.color = if (highlighted) highlightCol
|
batch.color = if (highlighted) highlightCol
|
||||||
else if (mouseUp) activeCol
|
else if (mouseUp) activeCol
|
||||||
else Toolkit.Theme.COL_INACTIVE
|
else if (useBorder) Toolkit.Theme.COL_INACTIVE else inactiveCol
|
||||||
if (useBorder) {
|
if (useBorder) {
|
||||||
Toolkit.drawBoxBorder(batch, posX - 1f, posY - 1f, width + 2f, height + 2f)
|
Toolkit.drawBoxBorder(batch, posX - 1f, posY - 1f, width + 2f, height + 2f)
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|||||||
Reference in New Issue
Block a user