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-platform:$gdxVersion:natives-desktop")
"implementation"("com.badlogicgames.gdx:gdx-tools:$gdxVersion") // This is for the TexturePacker class "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"("com.github.MinnDevelopment:java-discord-rpc:v2.0.1")
"implementation"("io.ktor:ktor-server-netty:1.3.2") "implementation"("io.ktor:ktor-server-netty:1.3.2")

View File

@ -6,7 +6,7 @@ object BuildConfig {
const val appCodeNumber = 491 const val appCodeNumber = 491
const val appVersion = "3.11.8" 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 roboVMVersion = "2.3.1"
const val ashleyVersion = "1.7.0" const val ashleyVersion = "1.7.0"
const val aiVersion = "1.8.0" const val aiVersion = "1.8.0"

View File

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

View File

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