Updated to latest LibGDX

This commit is contained in:
Yair Morgenstern
2020-11-02 21:48:43 +02:00
parent 2cddfc2b56
commit 1568ce90da
4 changed files with 20 additions and 19 deletions

View File

@ -61,7 +61,7 @@ project(":desktop") {
"implementation"("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
"implementation"("com.badlogicgames.gdx:gdx-tools:$gdxVersion") // This is for the TexturePacker class
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") // This iss so the JAR works with Kotlin
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") // This is so the JAR works with Kotlin
"implementation"("com.github.MinnDevelopment:java-discord-rpc:v2.0.1")
"implementation"("io.ktor:ktor-server-netty:1.3.2")

View File

@ -6,7 +6,7 @@ object BuildConfig {
const val appCodeNumber = 491
const val appVersion = "3.11.8"
const val gdxVersion = "1.9.10"
const val gdxVersion = "1.9.12"
const val roboVMVersion = "2.3.1"
const val ashleyVersion = "1.7.0"
const val aiVersion = "1.8.0"

View File

@ -89,27 +89,28 @@ object GameSaver {
fun getGeneralSettings(): GameSettings {
val settingsFile = getGeneralSettingsFile()
val settings: GameSettings =
if(!settingsFile.exists())
GameSettings().apply { isFreshlyCreated = true }
else try {
json().fromJson(GameSettings::class.java, settingsFile)
} catch (ex:Exception){
// I'm not sure of the circumstances,
// but some people were getting null settings, even though the file existed??? Very odd.
// ...Json broken or otherwise unreadable is the only possible reason.
println("Error reading settings file: ${ex.localizedMessage}")
println(" cause: ${ex.cause}")
GameSettings().apply { isFreshlyCreated = true }
}
if (!settingsFile.exists())
GameSettings().apply { isFreshlyCreated = true }
else try {
json().fromJson(GameSettings::class.java, settingsFile)
} catch (ex: Exception) {
// I'm not sure of the circumstances,
// but some people were getting null settings, even though the file existed??? Very odd.
// ...Json broken or otherwise unreadable is the only possible reason.
println("Error reading settings file: ${ex.localizedMessage}")
println(" cause: ${ex.cause}")
GameSettings().apply { isFreshlyCreated = true }
}
val currentTileSets = ImageGetter.atlas.regions.asSequence()
val atlas = ImageGetter.atlas
val currentTileSets = atlas.regions.asSequence()
.filter { it.name.startsWith("TileSets") }
.map { it.name.split("/")[1] }.distinct()
if(settings.tileSet !in currentTileSets) settings.tileSet = "Default"
if (settings.tileSet !in currentTileSets) settings.tileSet = "Default"
return settings
}
fun setGeneralSettings(gameSettings: GameSettings){
fun setGeneralSettings(gameSettings: GameSettings) {
getGeneralSettingsFile().writeString(json().toJson(gameSettings), false)
}

View File

@ -24,8 +24,8 @@ open class ZoomableScrollPane: ScrollPane(null) {
private fun addZoomListeners() {
addListener(object : InputListener() {
override fun scrolled(event: InputEvent?, x: Float, y: Float, amount: Int): Boolean {
if(amount > 0) zoom(scaleX * 0.8f)
override fun scrolled(event: InputEvent?, x: Float, y: Float, amountX: Float, amountY: Float): Boolean {
if (amountX > 0 || amountY > 0) zoom(scaleX * 0.8f)
else zoom(scaleX / 0.8f)
return false
}