mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 14:57:58 +07:00
4.6.4-patch2
Use the same framebuffer / spritebatch for all icon renders
This commit is contained in:
@ -531,7 +531,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci
|
||||
|
||||
companion object {
|
||||
//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
|
||||
|
||||
lateinit var Current: UncivGame
|
||||
|
@ -137,7 +137,7 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
|
||||
|
||||
val relevantTile by lazy { state.attackedTile
|
||||
?: state.tile
|
||||
?: state.unit?.getTile()
|
||||
?: relevantUnit?.getTile()
|
||||
?: state.city?.getCenterTile()
|
||||
}
|
||||
|
||||
|
@ -283,15 +283,16 @@ object Fonts {
|
||||
addChar(nation.name, ImageGetter.getNationPortrait(nation, ORIGINAL_FONT_SIZE))
|
||||
}
|
||||
|
||||
fun getPixmapFromActor(actor: Actor): Pixmap {
|
||||
val spriteBatch = SpriteBatch()
|
||||
val frameBuffer by lazy { FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.width, Gdx.graphics.height, false) }
|
||||
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()
|
||||
|
||||
Gdx.gl.glClearColor(0f,0f,0f,0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
spriteBatch.begin()
|
||||
actor.draw(spriteBatch, 1f)
|
||||
spriteBatch.end()
|
||||
@ -302,10 +303,6 @@ object Fonts {
|
||||
Gdx.gl.glReadPixels(0, 0, w, h, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixmap.pixels)
|
||||
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
|
||||
for (i in 0..w)
|
||||
|
Reference in New Issue
Block a user