mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Flippin' eck
This commit is contained in:
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@@ -41,4 +41,7 @@
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SuppressKotlinCodeStyleNotification">
|
||||
<option name="disableForAll" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -29,7 +29,7 @@ import net.torvald.tsvm.peripheral.VMProgramRom
|
||||
class FixtureHomeComputer : FixtureBase {
|
||||
|
||||
private val vm = VM(0x200000, TheRealWorld(), arrayOf(
|
||||
VMProgramRom(ModMgr.getPath("dwarventech", "bios/tsvmbios.rom"))
|
||||
VMProgramRom(ModMgr.getPath("dwarventech", "bios/tsvmbios.js"))
|
||||
))
|
||||
private val vmRunner: VMRunner
|
||||
private val coroutineJob: Job
|
||||
@@ -95,13 +95,13 @@ internal class UIHomeComputer : UICanvas(
|
||||
private val drawOffX = (width - 560).div(2).toFloat()
|
||||
private val drawOffY = (height - 448).div(2).toFloat()
|
||||
|
||||
private var batch: SpriteBatch
|
||||
private var batch: FlippingSpriteBatch
|
||||
private var camera: OrthographicCamera
|
||||
|
||||
internal lateinit var vm: VM
|
||||
|
||||
init {
|
||||
batch = SpriteBatch()
|
||||
batch = FlippingSpriteBatch()
|
||||
camera = OrthographicCamera(width.toFloat(), height.toFloat())
|
||||
//val m = Matrix4()
|
||||
//m.setToOrtho2D(0f, 0f, width.toFloat(), height.toFloat())
|
||||
|
||||
@@ -34,7 +34,7 @@ class ItemHomeComputer(originalID: ItemID) : GameItem(originalID) {
|
||||
CommonResourcePool.addToLoadingList("dwarventech-sprites-fixtures-desktop_computer.tga") {
|
||||
// val t = TextureRegion(Texture(ModMgr.getGdxFile("dwarventech", "nonexisting_file!!!")))
|
||||
val t = TextureRegion(Texture(ModMgr.getGdxFile("dwarventech", "sprites/fixtures/desktop_computer.tga")))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
Binary file not shown.
@@ -1,8 +1,11 @@
|
||||
while (1) {
|
||||
con.reset_graphics();con.curs_set(0);con.clear();
|
||||
graphics.resetPalette();graphics.setBackground(0,0,0);
|
||||
|
||||
let logo = gzip.decomp(base64.atob("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"));
|
||||
|
||||
|
||||
|
||||
// display logo in mundane, true-to-msx way
|
||||
graphics.setFramebufferScroll(0,-164);
|
||||
// hide entire framebuffer with black text to hide the slow image drawing
|
||||
@@ -71,7 +74,10 @@ if (portNumber < 4) {
|
||||
// eval(com.fetchResponse(portNumber).trimNull());
|
||||
// using Function() so that BIOS variables won't get leaked in
|
||||
{Function("\"use strict\";var _BIOS={};_BIOS.FIRST_BOOTABLE_PORT=[0,1];Object.freeze(_BIOS);"+com.fetchResponse(portNumber).trimNull())()};
|
||||
break;
|
||||
}
|
||||
else {
|
||||
printerrln("No bootable medium found.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -132,36 +132,39 @@ class SpriteAnimation(@Transient val parentActor: ActorWithBody) : Disposable {
|
||||
// batch.color = colorFilter
|
||||
|
||||
|
||||
// val realTY = (parentActor.hitboxTranslateY + (cellHeight - parentActor.baseHitboxH)) * scale
|
||||
val tx = (parentActor.hitboxTranslateX) * scale
|
||||
val txF = (parentActor.hitboxTranslateX + parentActor.baseHitboxW) * scale
|
||||
val ty = (parentActor.hitboxTranslateY + (cellHeight - parentActor.baseHitboxH)) * scale
|
||||
val tyF = (parentActor.hitboxTranslateY + parentActor.baseHitboxH) * scale
|
||||
|
||||
if (flipHorizontal && !flipVertical) {
|
||||
if (flipHorizontal && flipVertical) {
|
||||
batch.draw(region,
|
||||
FastMath.floor(posX).toFloat() + (parentActor.hitboxTranslateX + parentActor.baseHitboxW) * scale,
|
||||
FastMath.floor(posY).toFloat() + (parentActor.hitboxTranslateY + parentActor.baseHitboxH) * scale,
|
||||
FastMath.floor(posX).toFloat() + txF,
|
||||
FastMath.floor(posY).toFloat() + tyF,
|
||||
-FastMath.floor(cellWidth * scale).toFloat(),
|
||||
-FastMath.floor(cellHeight * scale).toFloat()
|
||||
)
|
||||
}
|
||||
else if (flipHorizontal && flipVertical) {
|
||||
else if (flipHorizontal && !flipVertical) {
|
||||
batch.draw(region,
|
||||
FastMath.floor(posX).toFloat() + (parentActor.hitboxTranslateX + parentActor.baseHitboxW) * scale,
|
||||
FastMath.floor(posY).toFloat() - (parentActor.hitboxTranslateY) * scale,
|
||||
FastMath.floor(posX).toFloat() + txF,
|
||||
FastMath.floor(posY).toFloat() - ty,
|
||||
-FastMath.floor(cellWidth * scale).toFloat(),
|
||||
FastMath.floor(cellHeight * scale).toFloat()
|
||||
)
|
||||
}
|
||||
else if (!flipHorizontal && !flipVertical) {
|
||||
else if (!flipHorizontal && flipVertical) {
|
||||
batch.draw(region,
|
||||
FastMath.floor(posX).toFloat() - (parentActor.hitboxTranslateX) * scale,
|
||||
FastMath.floor(posY).toFloat() + (parentActor.hitboxTranslateY + parentActor.baseHitboxH) * scale,
|
||||
FastMath.floor(posX).toFloat() - tx,
|
||||
FastMath.floor(posY).toFloat() + tyF,
|
||||
FastMath.floor(cellWidth * scale).toFloat(),
|
||||
-FastMath.floor(cellHeight * scale).toFloat()
|
||||
)
|
||||
}
|
||||
else {
|
||||
batch.draw(region,
|
||||
FastMath.floor(posX).toFloat() - (parentActor.hitboxTranslateX) * scale,
|
||||
FastMath.floor(posY).toFloat() - (parentActor.hitboxTranslateY) * scale,
|
||||
FastMath.floor(posX).toFloat() - tx,
|
||||
FastMath.floor(posY).toFloat() - ty,
|
||||
FastMath.floor(cellWidth * scale).toFloat(),
|
||||
FastMath.floor(cellHeight * scale).toFloat()
|
||||
)
|
||||
|
||||
@@ -184,8 +184,11 @@ public class App implements ApplicationListener {
|
||||
|
||||
public static CreateTileAtlas tileMaker;
|
||||
|
||||
/** Vanilla */
|
||||
public static TerrarumSansBitmap fontGame;
|
||||
/** Vertically flipped */
|
||||
public static TerrarumSansBitmap fontGameFBO;
|
||||
/** Big interchar */
|
||||
public static TerrarumSansBitmap fontUITitle;
|
||||
public static TinyAlphNum fontSmallNumbers;
|
||||
|
||||
@@ -232,11 +235,11 @@ public class App implements ApplicationListener {
|
||||
|
||||
public static Mesh fullscreenQuad;
|
||||
private static OrthographicCamera camera;
|
||||
private static SpriteBatch logoBatch;
|
||||
private static FlippingSpriteBatch logoBatch;
|
||||
public static TextureRegion logo;
|
||||
public static AudioDevice audioDevice;
|
||||
|
||||
public static SpriteBatch batch;
|
||||
public static FlippingSpriteBatch batch;
|
||||
public static ShapeRenderer shapeRender;
|
||||
|
||||
private static com.badlogic.gdx.graphics.Color gradWhiteTop = new com.badlogic.gdx.graphics.Color(0xf8f8f8ff);
|
||||
@@ -397,11 +400,11 @@ public class App implements ApplicationListener {
|
||||
|
||||
glInfo.create();
|
||||
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false, false, true));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false, false, false));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarking_actor", () -> new BlockMarkerActor());
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("loading_circle_64", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/loading_circle_64.tga"), 64, 64, 0, 0, 0, 0, false, false, true));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("inline_loading_spinner", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/inline_loading_spinner.tga"), 20, 20, 0, 0, 0, 0, false, false, true));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("inventory_category", () -> new TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20, 0, 0, 0, 0, false, false, true));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("loading_circle_64", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/loading_circle_64.tga"), 64, 64, 0, 0, 0, 0, false, false, false));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("inline_loading_spinner", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/inline_loading_spinner.tga"), 20, 20, 0, 0, 0, 0, false, false, false));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("inventory_category", () -> new TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20, 0, 0, 0, 0, false, false, false));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("title_health1", () -> new Texture(Gdx.files.internal("./assets/graphics/gui/health_take_a_break.tga")));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("title_health2", () -> new Texture(Gdx.files.internal("./assets/graphics/gui/health_distance.tga")));
|
||||
|
||||
@@ -409,17 +412,17 @@ public class App implements ApplicationListener {
|
||||
|
||||
|
||||
// set basis of draw
|
||||
logoBatch = new SpriteBatch();
|
||||
logoBatch = new FlippingSpriteBatch();
|
||||
camera = new OrthographicCamera((scr.getWf()), (scr.getHf()));
|
||||
|
||||
batch = new SpriteBatch();
|
||||
batch = new FlippingSpriteBatch();
|
||||
shapeRender = new ShapeRenderer();
|
||||
|
||||
initViewPort(scr.getWidth(), scr.getHeight());
|
||||
|
||||
// logo here :p
|
||||
logo = new TextureRegion(new Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")));
|
||||
logo.flip(false, true);
|
||||
logo.flip(false, false);
|
||||
|
||||
// set GL graphics constants
|
||||
for (int i = 0; i < ditherPatterns.length; i++) {
|
||||
@@ -515,11 +518,11 @@ public class App implements ApplicationListener {
|
||||
environment = RunningEnvironment.PC;
|
||||
}*/
|
||||
|
||||
fontGame = new TerrarumSansBitmap(FONT_DIR, false, true, false,
|
||||
fontGame = new TerrarumSansBitmap(FONT_DIR, false, false, false,
|
||||
false,
|
||||
256, false, 0.5f, false
|
||||
);
|
||||
fontUITitle = new TerrarumSansBitmap(FONT_DIR, false, true, false,
|
||||
fontUITitle = new TerrarumSansBitmap(FONT_DIR, false, false, false,
|
||||
false,
|
||||
64, false, 0.5f, false
|
||||
);
|
||||
@@ -694,8 +697,8 @@ public class App implements ApplicationListener {
|
||||
Texture tex2 = CommonResourcePool.INSTANCE.getAsTexture("title_health2");
|
||||
int virtualHeight = scr.getHeight() - logoPosY - logo.getRegionHeight() / 4;
|
||||
int virtualHeightOffset = scr.getHeight() - virtualHeight;
|
||||
logoBatch.draw(tex1, (drawWidth - tex1.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) - 16, tex1.getWidth(), -tex1.getHeight());
|
||||
logoBatch.draw(tex2, (drawWidth - tex2.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) + 16 + tex2.getHeight(), tex2.getWidth(), -tex2.getHeight());
|
||||
logoBatch.drawFlipped(tex1, (drawWidth - tex1.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) - 16, tex1.getWidth(), -tex1.getHeight());
|
||||
logoBatch.drawFlipped(tex2, (drawWidth - tex2.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) + 16 + tex2.getHeight(), tex2.getWidth(), -tex2.getHeight());
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -23,27 +23,27 @@ object CommonResourcePool {
|
||||
init {
|
||||
addToLoadingList("itemplaceholder_16") {
|
||||
val t = TextureRegion(Texture("assets/item_kari_16.tga"))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
addToLoadingList("itemplaceholder_24") {
|
||||
val t = TextureRegion(Texture("assets/item_kari_24.tga"))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
addToLoadingList("itemplaceholder_32") {
|
||||
val t = TextureRegion(Texture("assets/item_kari_32.tga"))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
addToLoadingList("itemplaceholder_48") {
|
||||
val t = TextureRegion(Texture("assets/item_kari_48.tga"))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
addToLoadingList("test_texture") {
|
||||
val t = TextureRegion(Texture("assets/test_texture.tga"))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
loadAll()
|
||||
|
||||
52
src/net/torvald/terrarum/FlippingSpriteBatch.kt
Normal file
52
src/net/torvald/terrarum/FlippingSpriteBatch.kt
Normal file
@@ -0,0 +1,52 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
|
||||
/**
|
||||
* Don't flip the assets! Flip the draw command instead!
|
||||
*
|
||||
* Created by minjaesong on 2021-12-13.
|
||||
*/
|
||||
class FlippingSpriteBatch : SpriteBatch() {
|
||||
|
||||
/**
|
||||
* This function draws the flipped version of the image by giving flipped uv-coord to the SpriteBatch
|
||||
*/
|
||||
override fun draw(texture: Texture, x: Float, y: Float, width: Float, height: Float) =
|
||||
draw(texture, x, y, width, height, 0f, 0f, 1f, 1f)
|
||||
|
||||
override fun draw(texture: Texture, x: Float, y: Float) =
|
||||
draw(texture, x, y, texture.width.toFloat(), texture.height.toFloat(), 0f, 0f, 1f, 1f)
|
||||
|
||||
fun drawFlipped(texture: Texture, x: Float, y: Float, width: Float, height: Float) =
|
||||
draw(texture, x, y, width, height, 0f, 1f, 1f, 0f)
|
||||
fun drawFlipped(texture: Texture, x: Float, y: Float) =
|
||||
draw(texture, x, y, texture.width.toFloat(), texture.height.toFloat(), 0f, 1f, 1f, 0f)
|
||||
|
||||
|
||||
/**
|
||||
* This function does obey the flipping set to the TextureRegion and try to draw flipped version of it,
|
||||
* without touching the flipping setting of the given region.
|
||||
*/
|
||||
override fun draw(region: TextureRegion, x: Float, y: Float, width: Float, height: Float) =
|
||||
draw(region.texture, x, y, width, height, region.u, region.v, region.u2, region.v2)
|
||||
|
||||
override fun draw(region: TextureRegion, x: Float, y: Float) =
|
||||
draw(region.texture, x, y, region.regionWidth.toFloat(), region.regionHeight.toFloat(), region.u, region.v, region.u2, region.v2)
|
||||
|
||||
fun drawFlipped(region: TextureRegion, x: Float, y: Float, width: Float, height: Float) =
|
||||
draw(region.texture, x, y, width, height, region.u, region.v2, region.u2, region.v)
|
||||
fun drawFlipped(region: TextureRegion, x: Float, y: Float) =
|
||||
draw(region.texture, x, y, region.regionWidth.toFloat(), region.regionHeight.toFloat(), region.u, region.v2, region.u2, region.v)
|
||||
|
||||
|
||||
/**
|
||||
* NOTE TO SELF:
|
||||
*
|
||||
* It seems that original SpriteBatch Y-flips when it's drawing a texture, but NOT when it's drawing a textureregion
|
||||
*
|
||||
* (textureregion's default uv-coord is (0,0,1,1)
|
||||
*/
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import com.badlogic.gdx.math.Matrix4
|
||||
@@ -21,7 +20,7 @@ import net.torvald.terrarum.ui.Toolkit
|
||||
*/
|
||||
object PostProcessor : Disposable {
|
||||
|
||||
private lateinit var batch: SpriteBatch // not nulling to save some lines of code
|
||||
private lateinit var batch: FlippingSpriteBatch // not nulling to save some lines of code
|
||||
private lateinit var shapeRenderer: ShapeRenderer
|
||||
private lateinit var camera: OrthographicCamera
|
||||
|
||||
@@ -65,7 +64,7 @@ object PostProcessor : Disposable {
|
||||
|
||||
debugUI.setPosition(0, 0)
|
||||
|
||||
batch = SpriteBatch()
|
||||
batch = FlippingSpriteBatch()
|
||||
camera = OrthographicCamera(App.scr.wf, App.scr.hf)
|
||||
camera.setToOrtho(true)
|
||||
|
||||
|
||||
@@ -326,6 +326,27 @@ inline fun FrameBuffer.inAction(camera: OrthographicCamera?, batch: SpriteBatch?
|
||||
batch?.projectionMatrix = camera?.combined
|
||||
}
|
||||
|
||||
/**
|
||||
* Vertically flipped version of [FrameBuffer.inAction]
|
||||
*/
|
||||
inline fun FrameBuffer.inActionF(camera: OrthographicCamera?, batch: SpriteBatch?, action: (FrameBuffer) -> Unit) {
|
||||
//this.begin()
|
||||
FrameBufferManager.begin(this)
|
||||
|
||||
camera?.setToOrtho(false, this.width.toFloat(), this.height.toFloat())
|
||||
camera?.position?.set((this.width / 2f).round(), (this.height / 2f).round(), 0f) // TODO floor? ceil? round?
|
||||
camera?.update()
|
||||
batch?.projectionMatrix = camera?.combined
|
||||
|
||||
action(this)
|
||||
|
||||
//this.end()
|
||||
FrameBufferManager.end()
|
||||
|
||||
camera?.setToOrtho(true, App.scr.wf, App.scr.hf)
|
||||
camera?.update()
|
||||
batch?.projectionMatrix = camera?.combined
|
||||
}
|
||||
|
||||
|
||||
infix fun Color.mul(other: Color): Color = this.cpy().mul(other)
|
||||
|
||||
@@ -106,7 +106,7 @@ object IME {
|
||||
}
|
||||
|
||||
|
||||
val iconSheet = TextureRegionPack("assets/graphics/gui/ime_icons_by_language.tga", 20, 20, flipY = true)
|
||||
val iconSheet = TextureRegionPack("assets/graphics/gui/ime_icons_by_language.tga", 20, 20, flipY = false)
|
||||
val iconPixmap = Pixmap(Gdx.files.internal("assets/graphics/gui/ime_icons_by_language.tga"))
|
||||
for (k in 0 until iconPixmap.height step 20) {
|
||||
val langCode = StringBuilder()
|
||||
|
||||
@@ -53,15 +53,12 @@ class ChunkLoadingLoadScreen(screenToBeLoaded: IngameInstance, private val world
|
||||
}
|
||||
|
||||
|
||||
App.batch.inUse {
|
||||
App.batch.inUse { val it = it as FlippingSpriteBatch
|
||||
it.color = Color.WHITE
|
||||
val previewX = (drawWidth - previewWidth).div(2f).round()
|
||||
val previewY = (App.scr.height - previewHeight.times(1.5f)).div(2f).round()
|
||||
Toolkit.drawBoxBorder(it, previewX.toInt() - 1, previewY.toInt() - 1, previewWidth + 2, previewHeight + 2)
|
||||
it.draw(previewTexture,
|
||||
previewX,
|
||||
previewY
|
||||
)
|
||||
it.drawFlipped(previewTexture, previewX, previewY)
|
||||
val text = messages.getHeadElem() ?: ""
|
||||
App.fontGame.draw(it,
|
||||
text,
|
||||
|
||||
@@ -30,13 +30,13 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
|
||||
// load common resources to the AssetsManager
|
||||
CommonResourcePool.addToLoadingList("$moduleName.items16") {
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items.tga"), 16, 16, flipY = true)
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items.tga"), 16, 16, flipY = false)
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("$moduleName.items24") {
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items24.tga"), 24, 24, flipY = true)
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items24.tga"), 24, 24, flipY = false)
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("$moduleName.items48") {
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items48.tga"), 48, 48, flipY = true)
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items48.tga"), 48, 48, flipY = false)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.torvald.terrarum.modulebasegame
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import com.badlogic.gdx.graphics.glutils.FloatFrameBuffer
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
@@ -43,7 +42,7 @@ import kotlin.system.exitProcess
|
||||
*/
|
||||
object IngameRenderer : Disposable {
|
||||
/** for non-private use, use with care! */
|
||||
lateinit var batch: SpriteBatch
|
||||
lateinit var batch: FlippingSpriteBatch
|
||||
private lateinit var camera: OrthographicCamera
|
||||
|
||||
private lateinit var blurWriteQuad: Mesh
|
||||
@@ -234,8 +233,8 @@ object IngameRenderer : Disposable {
|
||||
|
||||
prepLightmapRGBA()
|
||||
BlocksDrawer.renderData()
|
||||
drawToRGB(actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, particlesContainer)
|
||||
drawToA(actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, particlesContainer)
|
||||
drawToRGB(actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, actorsRenderOverlay, particlesContainer)
|
||||
drawToA(actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, actorsRenderOverlay, particlesContainer)
|
||||
drawOverlayActors(actorsRenderOverlay)
|
||||
}
|
||||
|
||||
@@ -360,7 +359,7 @@ object IngameRenderer : Disposable {
|
||||
|
||||
//batch.shader = if (App.getConfigBoolean("fx_dither")) IngameRenderer.shaderBayer else null
|
||||
batch.shader = null
|
||||
batch.draw(mixedOutTex, 0f, 0f)
|
||||
batch.drawFlipped(mixedOutTex, 0f, 0f)
|
||||
}
|
||||
|
||||
|
||||
@@ -423,6 +422,7 @@ object IngameRenderer : Disposable {
|
||||
actorsRenderMiddle: List<ActorWithBody>?,
|
||||
actorsRenderMidTop: List<ActorWithBody>?,
|
||||
actorsRenderFront : List<ActorWithBody>?,
|
||||
actorsOverlay : List<ActorWithBody>?,
|
||||
particlesContainer: CircularArray<ParticleBase>?
|
||||
) {
|
||||
fboRGB.inAction(null, null) { clearBuffer() }
|
||||
@@ -466,6 +466,7 @@ object IngameRenderer : Disposable {
|
||||
setCameraPosition(0f, 0f)
|
||||
BlocksDrawer.drawFront(batch.projectionMatrix) // blue coloured filter of water, etc.
|
||||
|
||||
batch.shader = null
|
||||
batch.inUse {
|
||||
FeaturesDrawer.drawEnvOverlay(batch)
|
||||
}
|
||||
@@ -520,6 +521,7 @@ object IngameRenderer : Disposable {
|
||||
actorsRenderMiddle: List<ActorWithBody>?,
|
||||
actorsRenderMidTop: List<ActorWithBody>?,
|
||||
actorsRenderFront : List<ActorWithBody>?,
|
||||
actorsOverlay : List<ActorWithBody>?,
|
||||
particlesContainer: CircularArray<ParticleBase>?
|
||||
) {
|
||||
fboA.inAction(null, null) {
|
||||
@@ -591,6 +593,8 @@ object IngameRenderer : Disposable {
|
||||
lightTex.regionWidth * lightmapDownsample,
|
||||
lightTex.regionHeight * lightmapDownsample
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -602,7 +606,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
private fun drawOverlayActors(actors: List<ActorWithBody>?) {
|
||||
fboRGB_lightMixed.inAction(camera, batch) {
|
||||
fboRGB_lightMixed.inActionF(camera, batch) {
|
||||
|
||||
batch.inUse {
|
||||
batch.shader = shaderAlphaDither
|
||||
@@ -625,12 +629,11 @@ object IngameRenderer : Disposable {
|
||||
|
||||
private fun invokeInit() {
|
||||
if (!initDone) {
|
||||
batch = SpriteBatch()
|
||||
batch = FlippingSpriteBatch()
|
||||
camera = OrthographicCamera(WIDTHF, HEIGHTF)
|
||||
|
||||
camera.setToOrtho(true, WIDTHF, HEIGHTF)
|
||||
camera.update()
|
||||
Gdx.gl20.glViewport(0, 0, WIDTH, HEIGHT)
|
||||
|
||||
resize(WIDTH, HEIGHT)
|
||||
|
||||
@@ -862,9 +865,9 @@ object IngameRenderer : Disposable {
|
||||
private fun worldCamToRenderPos(): Pair<Float, Float> {
|
||||
// for some reason it does not like integer. No, really; it breaks (jitter when you move) when you try to "fix" that.
|
||||
val xoff = (WorldCamera.x / TILE_SIZE) - LightmapRenderer.camX
|
||||
val yoff = (WorldCamera.y / TILE_SIZE) - LightmapRenderer.camY
|
||||
val yoff = (WorldCamera.y / TILE_SIZE) - LightmapRenderer.camY - 1
|
||||
val xrem = -(WorldCamera.x.toFloat() fmod TILE_SIZEF) - (xoff * TILE_SIZEF)
|
||||
val yrem = -(WorldCamera.y.toFloat() fmod TILE_SIZEF) - (yoff * TILE_SIZEF)
|
||||
val yrem = +(WorldCamera.y.toFloat() fmod TILE_SIZEF) + (yoff * TILE_SIZEF)
|
||||
|
||||
return (xrem - LightmapRenderer.LIGHTMAP_OVERRENDER * TILE_SIZEF) to (yrem - LightmapRenderer.LIGHTMAP_OVERRENDER * TILE_SIZEF)
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
private val warning32bitJavaIcon = TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/32_bit_warning.tga")))
|
||||
|
||||
init {
|
||||
warning32bitJavaIcon.flip(false, true)
|
||||
warning32bitJavaIcon.flip(false, false)
|
||||
}
|
||||
|
||||
private fun loadThingsWhileIntroIsVisible() {
|
||||
|
||||
@@ -68,15 +68,12 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
}
|
||||
|
||||
|
||||
App.batch.inUse {
|
||||
App.batch.inUse { val it = it as FlippingSpriteBatch
|
||||
it.color = Color.WHITE
|
||||
val previewX = (drawWidth - previewWidth).div(2f).round()
|
||||
val previewY = (App.scr.height - previewHeight.times(1.5f)).div(2f).round()
|
||||
Toolkit.drawBoxBorder(it, previewX.toInt()-1, previewY.toInt()-1, previewWidth+2, previewHeight+2)
|
||||
it.draw(previewTexture,
|
||||
previewX,
|
||||
previewY
|
||||
)
|
||||
it.drawFlipped(previewTexture, previewX, previewY)
|
||||
val text = messages.getHeadElem() ?: ""
|
||||
App.fontGame.draw(it,
|
||||
text,
|
||||
|
||||
@@ -25,7 +25,7 @@ class FixtureLogicSignalEmitter : FixtureBase, Electric {
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("basegame-sprites-fixtures-signal_source.tga") {
|
||||
val t = TextureRegion(Texture(ModMgr.getGdxFile("basegame", "sprites/fixtures/signal_source.tga")))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
/*return*/t
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
@@ -40,7 +40,7 @@ internal class FixtureTikiTorch : FixtureBase, Luminous {
|
||||
|
||||
// loading textures
|
||||
CommonResourcePool.addToLoadingList("sprites-fixtures-tiki_torch.tga") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/fixtures/tiki_torch.tga"), 16, 32, flipY = true)
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/fixtures/tiki_torch.tga"), 16, 32, flipY = false)
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("particles-tiki_smoke.tga") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "particles/bigger_smoke.tga"), 16, 16)
|
||||
|
||||
@@ -62,7 +62,7 @@ object MegaRainGovernor {
|
||||
|
||||
// return composed (mega)pixmap
|
||||
val region = TextureRegion(Texture(pixmap))
|
||||
region.flip(false, true)
|
||||
region.flip(false, false)
|
||||
|
||||
/*return*/region
|
||||
}
|
||||
|
||||
@@ -78,10 +78,11 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("terrarum-defaultsavegamethumb") {
|
||||
TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/savegame_thumb_placeholder.png")))
|
||||
val t = TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/savegame_thumb_placeholder.png")))
|
||||
t.flip(false, false); t
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("savegame_status_icon") {
|
||||
TextureRegionPack("assets/graphics/gui/savegame_status_icon.tga", 24, 24)
|
||||
TextureRegionPack("assets/graphics/gui/savegame_status_icon.tga", 24, 24, flipY = false)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
@@ -350,7 +351,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
|
||||
setCameraPosition(batch, camera, 0f, 0f)
|
||||
val saveTex = Texture(savePixmap)
|
||||
val saveTex = TextureRegion(Texture(savePixmap)); saveTex.flip(false, true)
|
||||
batch.inUse {
|
||||
batch.draw(saveTex, (width - uiWidth - 10) / 2f, 0f)
|
||||
|
||||
@@ -362,7 +363,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
||||
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
|
||||
}
|
||||
|
||||
saveTex.dispose()
|
||||
saveTex.texture.dispose()
|
||||
savePixmap.dispose()
|
||||
|
||||
batch.begin()
|
||||
@@ -538,6 +539,7 @@ class UIItemPlayerCells(
|
||||
p.reassembleSprite(skimmer, p.sprite)
|
||||
p.sprite!!.textureRegion.get(0,0).let {
|
||||
thumb = it
|
||||
thumb!!.flip(false, false)
|
||||
}
|
||||
this.sprite = p.sprite
|
||||
}
|
||||
@@ -710,7 +712,7 @@ class UIItemWorldCells(
|
||||
// draw thumbnail
|
||||
batch.color = Color.WHITE
|
||||
blendNormal(batch)
|
||||
batch.draw(thumb ?: CommonResourcePool.getAsTextureRegion("terrarum-defaultsavegamethumb"), x, y + height, width.toFloat(), -height.toFloat())
|
||||
batch.draw(thumb ?: CommonResourcePool.getAsTextureRegion("terrarum-defaultsavegamethumb"), x, y, width.toFloat(), height.toFloat())
|
||||
// draw gradient
|
||||
blendMul(batch)
|
||||
batch.draw(grad, x + width.toFloat(), y, -width.toFloat(), height.toFloat())
|
||||
|
||||
@@ -75,7 +75,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
|
||||
private val goButton = UIItemTextButton(this, "MENU_LABEL_CONFIRM_BUTTON", drawX + width/2 + (width/2 - goButtonWidth) / 2, drawY + height - 24, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true)
|
||||
|
||||
init {
|
||||
tex.forEach { it.flip(false, true) }
|
||||
tex.forEach { it.flip(false, false) }
|
||||
|
||||
goButton.touchDownListener = { _, _, _, _ ->
|
||||
// printdbg(this, "generate! Size=${sizeSelector.selection}, Name=${nameInput.getTextOrPlaceholder()}, Seed=${seedInput.getTextOrPlaceholder()}")
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import net.torvald.getKeycapConsole
|
||||
@@ -179,7 +180,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
|
||||
setCameraPosition(batch, camera, 0f, 0f)
|
||||
val saveTex = Texture(savePixmap)
|
||||
val saveTex = TextureRegion(Texture(savePixmap)); saveTex.flip(false, true)
|
||||
batch.inUse {
|
||||
batch.color = Color.WHITE
|
||||
batch.draw(saveTex, (width - uiWidth - 10) / 2f, 0f)
|
||||
@@ -191,7 +192,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
||||
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
|
||||
}
|
||||
|
||||
saveTex.dispose()
|
||||
saveTex.texture.dispose()
|
||||
savePixmap.dispose()
|
||||
|
||||
batch.begin()
|
||||
|
||||
@@ -7,10 +7,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import com.badlogic.gdx.graphics.glutils.FloatFrameBuffer
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.FrameBufferManager
|
||||
import net.torvald.terrarum.inAction
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
|
||||
@@ -43,7 +40,7 @@ object Toolkit : Disposable {
|
||||
private lateinit var blurWriteQuad2: Mesh
|
||||
private lateinit var blurWriteQuad4: Mesh
|
||||
|
||||
val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36, flipY = true)
|
||||
val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36, flipY = false)
|
||||
|
||||
val textureWhiteSquare = Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga"))
|
||||
val textureWhiteCircle = Texture(Gdx.files.internal("assets/graphics/circle_512.tga"))
|
||||
@@ -235,7 +232,7 @@ object Toolkit : Disposable {
|
||||
|
||||
batch.begin()
|
||||
batch.shader = null
|
||||
batch.draw(fboBlur.colorBufferTexture, x.toFloat(), y.toFloat())
|
||||
(batch as FlippingSpriteBatch).drawFlipped(fboBlur.colorBufferTexture, x.toFloat(), y.toFloat())
|
||||
}
|
||||
|
||||
fun drawBaloon(batch: SpriteBatch, x: Float, y: Float, w: Float, h: Float) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.FlippingSpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
|
||||
@@ -34,11 +34,11 @@ class UIItemModuleInfoCell(
|
||||
private val modAuthor = modProp.author
|
||||
|
||||
init {
|
||||
modIcon.flip(false, true)
|
||||
modIcon.flip(false, false)
|
||||
|
||||
CommonResourcePool.addToLoadingList("basegame_errored_icon32") {
|
||||
val t = TextureRegion(Texture(ModMgr.getGdxFile("basegame", "gui/modwitherror.tga")))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
t
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
@@ -24,12 +24,12 @@ class UIItemToggleButton(
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("ui_item_toggler_base") {
|
||||
val t = TextureRegion(Texture(Gdx.files.internal("./assets/graphics/gui/toggler_back.tga")))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
t
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("ui_item_toggler_handle") {
|
||||
val t = TextureRegion(Texture(Gdx.files.internal("./assets/graphics/gui/toggler_switch.tga")))
|
||||
t.flip(false, true)
|
||||
t.flip(false, false)
|
||||
t
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.torvald.terrarum.weather
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.random.HQRNG
|
||||
@@ -121,7 +120,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
/**
|
||||
* Sub-portion of IngameRenderer. You are not supposed to directly deal with this.
|
||||
*/
|
||||
internal fun render(camera: Camera, batch: SpriteBatch, world: GameWorld) {
|
||||
internal fun render(camera: Camera, batch: FlippingSpriteBatch, world: GameWorld) {
|
||||
val parallaxZeroPos = (world.height / 3f) * 0.8888f
|
||||
val parallaxDomainSize = world.height / 4f
|
||||
|
||||
@@ -179,8 +178,8 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
|
||||
batch.inUse {
|
||||
it.shader = null
|
||||
it.draw(skyboxTexture, 0f, -App.scr.halfhf, App.scr.wf, App.scr.hf * 2f) // because of how the linear filter works, we extend the image by two
|
||||
batch.shader = null
|
||||
batch.drawFlipped(skyboxTexture, 0f, -App.scr.halfhf, App.scr.wf, App.scr.hf * 2f) // because of how the linear filter works, we extend the image by two
|
||||
}
|
||||
|
||||
// don't use shader to just fill the whole screen... frag shader will be called a million times and it's best to not burden it
|
||||
|
||||
Reference in New Issue
Block a user