mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
buildingmaker: can hide/show selection overlay
This commit is contained in:
@@ -47,6 +47,9 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
- Remove Sel. : net.torvald.terrarum.modulebasegame.YamlCommandToolMarqueeErase
|
- Remove Sel. : net.torvald.terrarum.modulebasegame.YamlCommandToolMarqueeErase
|
||||||
- Clear Sel. : net.torvald.terrarum.modulebasegame.YamlCommandToolMarqueeClear
|
- Clear Sel. : net.torvald.terrarum.modulebasegame.YamlCommandToolMarqueeClear
|
||||||
- Move Selected
|
- Move Selected
|
||||||
|
-
|
||||||
|
- Hide/Show Sel. : net.torvald.terrarum.modulebasegame.YamlCommandToolToggleMarqueeOverlay
|
||||||
|
-
|
||||||
- Undo
|
- Undo
|
||||||
- Redo
|
- Redo
|
||||||
- Time
|
- Time
|
||||||
@@ -97,13 +100,23 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
val uiContainer = ArrayList<UICanvas>()
|
val uiContainer = ArrayList<UICanvas>()
|
||||||
|
|
||||||
|
private val pensMustShowSelection = arrayOf(
|
||||||
|
PENMODE_MARQUEE, PENMODE_MARQUEE_ERASE
|
||||||
|
)
|
||||||
|
|
||||||
var currentPenMode = PENMODE_PENCIL
|
var currentPenMode = PENMODE_PENCIL
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
if (value in pensMustShowSelection) {
|
||||||
|
showSelection = true
|
||||||
|
}
|
||||||
|
}
|
||||||
var currentPenTarget = PENTARGET_TERRAIN
|
var currentPenTarget = PENTARGET_TERRAIN
|
||||||
|
|
||||||
val selection = ArrayList<Point2i>()
|
val selection = ArrayList<Point2i>()
|
||||||
|
|
||||||
val blockMarkings = TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16)
|
val blockMarkings = TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16)
|
||||||
|
internal var showSelection = true
|
||||||
val blockPointingCursor = object : ActorWithBody(Actor.RenderOrder.OVERLAY) {
|
val blockPointingCursor = object : ActorWithBody(Actor.RenderOrder.OVERLAY) {
|
||||||
|
|
||||||
override var referenceID: ActorID? = 1048575 // custom refID
|
override var referenceID: ActorID? = 1048575 // custom refID
|
||||||
@@ -326,7 +339,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun renderGame() {
|
private fun renderGame() {
|
||||||
IngameRenderer.invoke(world as GameWorldExtension, actorsRenderOverlay = actorsRenderOverlay + essentialOverlays, uisToDraw = uiContainer)
|
IngameRenderer.invoke(world as GameWorldExtension, actorsRenderOverlay = if (showSelection) actorsRenderOverlay + essentialOverlays else essentialOverlays, uisToDraw = uiContainer)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
@@ -532,3 +545,9 @@ class YamlCommandToolMarqueeClear : YamlInvokable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class YamlCommandToolToggleMarqueeOverlay : YamlInvokable {
|
||||||
|
override fun invoke(args: Array<Any>) {
|
||||||
|
(args[0] as BuildingMaker).showSelection = !(args[0] as BuildingMaker).showSelection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame
|
package net.torvald.terrarum.modulebasegame
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.dataclass.CircularArray
|
import net.torvald.dataclass.CircularArray
|
||||||
@@ -13,6 +14,7 @@ import net.torvald.terrarum.console.Authenticator
|
|||||||
import net.torvald.terrarum.gameactors.Actor
|
import net.torvald.terrarum.gameactors.Actor
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
import net.torvald.terrarum.gamecontroller.IngameController
|
import net.torvald.terrarum.gamecontroller.IngameController
|
||||||
|
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
import net.torvald.terrarum.itemproperties.GameItem
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
import net.torvald.terrarum.modulebasegame.console.AVTracker
|
import net.torvald.terrarum.modulebasegame.console.AVTracker
|
||||||
@@ -251,6 +253,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
historicalFigureIDBucket = ArrayList<Int>()
|
historicalFigureIDBucket = ArrayList<Int>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeyToggler.forceSet(Input.Keys.Q, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
val ingameController = IngameController(this)
|
val ingameController = IngameController(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user