mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 12:54:06 -04:00
Discrete rendering (#1768)
* Re-introduced Discrete Rendering as an opt-in feature * Persistent settings change
This commit is contained in:
parent
ae8fdb3b7d
commit
925f3267ad
@ -67,6 +67,8 @@ class UncivGame(
|
|||||||
settings = GameSaver().getGeneralSettings() // needed for the screen
|
settings = GameSaver().getGeneralSettings() // needed for the screen
|
||||||
screen = LoadingScreen()
|
screen = LoadingScreen()
|
||||||
|
|
||||||
|
Gdx.graphics.isContinuousRendering = settings.continuousRendering
|
||||||
|
|
||||||
thread(name="LoadJSON") {
|
thread(name="LoadJSON") {
|
||||||
RulesetCache.loadRulesets()
|
RulesetCache.loadRulesets()
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class GameSettings {
|
|||||||
var showPixelImprovements: Boolean = true
|
var showPixelImprovements: Boolean = true
|
||||||
var showPixelResources: Boolean = true
|
var showPixelResources: Boolean = true
|
||||||
var nuclearWeaponEnabled = false
|
var nuclearWeaponEnabled = false
|
||||||
|
var continuousRendering = true
|
||||||
var userId = ""
|
var userId = ""
|
||||||
|
|
||||||
fun save(){
|
fun save(){
|
||||||
|
@ -50,7 +50,7 @@ class TileGroupIcons(val tileGroup: TileGroup){
|
|||||||
|
|
||||||
if (unit != null && isViewable) { // Tile is visible
|
if (unit != null && isViewable) { // Tile is visible
|
||||||
newImage = UnitGroup(unit, 25f)
|
newImage = UnitGroup(unit, 25f)
|
||||||
if (oldUnitGroup?.blackSpinningCircle != null) {
|
if (UncivGame.Current.settings.continuousRendering && oldUnitGroup?.blackSpinningCircle != null) {
|
||||||
newImage.blackSpinningCircle = ImageGetter.getCircle()
|
newImage.blackSpinningCircle = ImageGetter.getCircle()
|
||||||
.apply { rotation = oldUnitGroup.blackSpinningCircle!!.rotation }
|
.apply { rotation = oldUnitGroup.blackSpinningCircle!!.rotation }
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.Group
|
|||||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
||||||
import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction
|
import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||||
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.map.MapUnit
|
import com.unciv.logic.map.MapUnit
|
||||||
|
|
||||||
class UnitGroup(val unit: MapUnit, val size: Float): Group() {
|
class UnitGroup(val unit: MapUnit, val size: Float): Group() {
|
||||||
@ -49,16 +50,17 @@ class UnitGroup(val unit: MapUnit, val size: Float): Group() {
|
|||||||
addActor(whiteHalo)
|
addActor(whiteHalo)
|
||||||
whiteHalo.toBack()
|
whiteHalo.toBack()
|
||||||
|
|
||||||
|
if (UncivGame.Current.settings.continuousRendering) {
|
||||||
val spinningCircle = if (blackSpinningCircle != null) blackSpinningCircle!!
|
val spinningCircle = if (blackSpinningCircle != null) blackSpinningCircle!!
|
||||||
else ImageGetter.getCircle()
|
else ImageGetter.getCircle()
|
||||||
spinningCircle.setSize(5f, 5f)
|
spinningCircle.setSize(5f, 5f)
|
||||||
spinningCircle.color = Color.BLACK
|
spinningCircle.color = Color.BLACK
|
||||||
spinningCircle.center(this)
|
spinningCircle.center(this)
|
||||||
spinningCircle.x += whiteHaloSize / 2 // to edge of white halo
|
spinningCircle.x += whiteHaloSize / 2 // to edge of white halo
|
||||||
spinningCircle.setOrigin(spinningCircle.width / 2 - whiteHaloSize / 2, spinningCircle.height / 2)
|
spinningCircle.setOrigin(spinningCircle.width / 2 - whiteHaloSize / 2, spinningCircle.height / 2)
|
||||||
addActor(spinningCircle)
|
addActor(spinningCircle)
|
||||||
spinningCircle.addAction(Actions.repeat(RepeatAction.FOREVER, Actions.rotateBy(90f, 1f)))
|
spinningCircle.addAction(Actions.repeat(RepeatAction.FOREVER, Actions.rotateBy(90f, 1f)))
|
||||||
blackSpinningCircle = spinningCircle
|
blackSpinningCircle = spinningCircle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -83,6 +83,14 @@ class WorldScreenOptionsPopup(val worldScreen:WorldScreen) : Popup(worldScreen){
|
|||||||
|
|
||||||
addTileSetSelectBox(innerTable)
|
addTileSetSelectBox(innerTable)
|
||||||
|
|
||||||
|
// Do not add to template.properties yet please.
|
||||||
|
innerTable.add("Continuous rendering\n(HIGHLY EXPERIMENTAL)".toLabel())
|
||||||
|
innerTable.addButton(if (settings.continuousRendering) "Yes".tr() else "No".tr()) {
|
||||||
|
settings.continuousRendering = !settings.continuousRendering
|
||||||
|
Gdx.graphics.isContinuousRendering = settings.continuousRendering
|
||||||
|
update()
|
||||||
|
}
|
||||||
|
|
||||||
innerTable.add("Gameplay options".toLabel(fontSize = 24)).colspan(2).row()
|
innerTable.add("Gameplay options".toLabel(fontSize = 24)).colspan(2).row()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user