mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 06:11:50 +09:00
quicker camera on buildingmaker
This commit is contained in:
@@ -422,17 +422,29 @@ object Terrarum : Screen {
|
||||
}
|
||||
|
||||
/** Position of the cursor in the world */
|
||||
inline val mouseX: Double
|
||||
val mouseX: Double
|
||||
get() = WorldCamera.x + Gdx.input.x / (ingame?.screenZoom ?: 1f).toDouble()
|
||||
/** Position of the cursor in the world */
|
||||
inline val mouseY: Double
|
||||
val mouseY: Double
|
||||
get() = WorldCamera.y + Gdx.input.y / (ingame?.screenZoom ?: 1f).toDouble()
|
||||
/** Position of the cursor in the world */
|
||||
@JvmStatic inline val mouseTileX: Int
|
||||
val oldMouseX: Double
|
||||
get() = WorldCamera.x + (Gdx.input.x - Gdx.input.deltaX) / (ingame?.screenZoom ?: 1f).toDouble()
|
||||
/** Position of the cursor in the world */
|
||||
val oldMouseY: Double
|
||||
get() = WorldCamera.y + (Gdx.input.y - Gdx.input.deltaY) / (ingame?.screenZoom ?: 1f).toDouble()
|
||||
/** Position of the cursor in the world */
|
||||
@JvmStatic val mouseTileX: Int
|
||||
get() = (mouseX / FeaturesDrawer.TILE_SIZE).floorInt()
|
||||
/** Position of the cursor in the world */
|
||||
@JvmStatic inline val mouseTileY: Int
|
||||
@JvmStatic val mouseTileY: Int
|
||||
get() = (mouseY / FeaturesDrawer.TILE_SIZE).floorInt()
|
||||
/** Position of the cursor in the world */
|
||||
@JvmStatic val oldMouseTileX: Int
|
||||
get() = (oldMouseX / FeaturesDrawer.TILE_SIZE).floorInt()
|
||||
/** Position of the cursor in the world */
|
||||
@JvmStatic val oldMouseTileY: Int
|
||||
get() = (oldMouseY / FeaturesDrawer.TILE_SIZE).floorInt()
|
||||
inline val mouseScreenX: Int
|
||||
get() = Gdx.input.x
|
||||
inline val mouseScreenY: Int
|
||||
|
||||
@@ -29,6 +29,9 @@ object AVKey {
|
||||
const val JUMPPOWER = "jumppower"
|
||||
const val JUMPPOWERBUFF = "$JUMPPOWER$BUFF"
|
||||
|
||||
/** NOT meant for living creatures. Also, only effective when noclip=true. E.g. camera actor */
|
||||
const val FRICTIONMULT = "frictionmult"
|
||||
|
||||
/** Int
|
||||
* "Default" value of 1 000
|
||||
*/
|
||||
|
||||
@@ -1070,7 +1070,7 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
|
||||
* for about get moving, see updateMovementControl */
|
||||
private fun setHorizontalFriction(delta: Float) {
|
||||
val friction = if (isNoClip)
|
||||
BASE_FRICTION * BlockCodex[Block.STONE].friction.frictionToMult()
|
||||
BASE_FRICTION * (actorValue.getAsDouble(AVKey.FRICTIONMULT) ?: 1.0) * BlockCodex[Block.STONE].friction.frictionToMult()
|
||||
else {
|
||||
// TODO status quo if !submerged else linearBlend(feetFriction, bodyFriction, submergedRatio)
|
||||
BASE_FRICTION * if (grounded) feetFriction else bodyFriction
|
||||
@@ -1099,9 +1099,11 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
|
||||
|
||||
private fun setVerticalFriction(delta: Float) {
|
||||
val friction = if (isNoClip)
|
||||
BASE_FRICTION * BlockCodex[Block.STONE].friction.frictionToMult()
|
||||
BASE_FRICTION * (actorValue.getAsDouble(AVKey.FRICTIONMULT) ?: 1.0) * BlockCodex[Block.STONE].friction.frictionToMult()
|
||||
else
|
||||
BASE_FRICTION * bodyFriction
|
||||
// TODO wall friction (wall skid) similar to setHorizintalFriction ?
|
||||
|
||||
|
||||
if (externalV.y < 0) {
|
||||
externalV.y += friction
|
||||
|
||||
@@ -223,6 +223,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
makePenWork(Terrarum.mouseTileX, Terrarum.mouseTileY)
|
||||
// TODO drag support using bresenham's algo
|
||||
// for some reason it just doesn't work...
|
||||
|
||||
}
|
||||
}
|
||||
@@ -312,10 +313,12 @@ class MovableWorldCamera : ActorHumanoid(0, usePhysics = false) {
|
||||
actorValue[AVKey.SPEED] = 8.0
|
||||
actorValue[AVKey.SPEEDBUFF] = 1.0
|
||||
actorValue[AVKey.ACCEL] = ActorHumanoid.WALK_ACCEL_BASE
|
||||
actorValue[AVKey.ACCELBUFF] = 1.0
|
||||
actorValue[AVKey.ACCELBUFF] = 4.0
|
||||
actorValue[AVKey.JUMPPOWER] = 0.0
|
||||
actorValue[AVKey.FRICTIONMULT] = 4.0
|
||||
}
|
||||
|
||||
|
||||
override fun drawBody(batch: SpriteBatch) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user