4.6.4-patch2

Use the same framebuffer / spritebatch for all icon renders
This commit is contained in:
Yair Morgenstern
2023-04-19 22:31:29 +03:00
parent 4dc6d50cde
commit e9296842b6
4 changed files with 9 additions and 12 deletions

View File

@ -3,8 +3,8 @@ package com.unciv.build
object BuildConfig { object BuildConfig {
const val kotlinVersion = "1.8.0" const val kotlinVersion = "1.8.0"
const val appName = "Unciv" const val appName = "Unciv"
const val appCodeNumber = 853 const val appCodeNumber = 854
const val appVersion = "4.6.4-patch1" const val appVersion = "4.6.4-patch2"
const val gdxVersion = "1.11.0" const val gdxVersion = "1.11.0"
const val roboVMVersion = "2.3.1" const val roboVMVersion = "2.3.1"

View File

@ -531,7 +531,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci
companion object { companion object {
//region AUTOMATICALLY GENERATED VERSION DATA - DO NOT CHANGE THIS REGION, INCLUDING THIS COMMENT //region AUTOMATICALLY GENERATED VERSION DATA - DO NOT CHANGE THIS REGION, INCLUDING THIS COMMENT
val VERSION = Version("4.6.4-patch1", 853) val VERSION = Version("4.6.4-patch2", 854)
//endregion //endregion
lateinit var Current: UncivGame lateinit var Current: UncivGame

View File

@ -137,7 +137,7 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
val relevantTile by lazy { state.attackedTile val relevantTile by lazy { state.attackedTile
?: state.tile ?: state.tile
?: state.unit?.getTile() ?: relevantUnit?.getTile()
?: state.city?.getCenterTile() ?: state.city?.getCenterTile()
} }

View File

@ -283,15 +283,16 @@ object Fonts {
addChar(nation.name, ImageGetter.getNationPortrait(nation, ORIGINAL_FONT_SIZE)) addChar(nation.name, ImageGetter.getNationPortrait(nation, ORIGINAL_FONT_SIZE))
} }
fun getPixmapFromActor(actor: Actor): Pixmap { val frameBuffer by lazy { FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.width, Gdx.graphics.height, false) }
val spriteBatch = SpriteBatch() val spriteBatch by lazy { SpriteBatch() }
fun getPixmapFromActor(actor: Actor): Pixmap {
val frameBuffer =
FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.width, Gdx.graphics.height, false)
frameBuffer.begin() frameBuffer.begin()
Gdx.gl.glClearColor(0f,0f,0f,0f) Gdx.gl.glClearColor(0f,0f,0f,0f)
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT) Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
spriteBatch.begin() spriteBatch.begin()
actor.draw(spriteBatch, 1f) actor.draw(spriteBatch, 1f)
spriteBatch.end() spriteBatch.end()
@ -302,10 +303,6 @@ object Fonts {
Gdx.gl.glReadPixels(0, 0, w, h, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixmap.pixels) Gdx.gl.glReadPixels(0, 0, w, h, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixmap.pixels)
frameBuffer.end() frameBuffer.end()
// These need to be disposed so they don't clog up the RAM *but not right now*
spriteBatch.dispose()
frameBuffer.dispose()
// Pixmap is now *upside down* so we need to flip it around the y axis // Pixmap is now *upside down* so we need to flip it around the y axis
for (i in 0..w) for (i in 0..w)