mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
45 lines
1.0 KiB
Kotlin
45 lines
1.0 KiB
Kotlin
package net.torvald.terrarum.modulebasegame.console
|
|
|
|
import net.torvald.terrarum.INGAME
|
|
import net.torvald.terrarum.console.ConsoleCommand
|
|
import net.torvald.terrarum.console.Echo
|
|
|
|
/**
|
|
* Created by minjaesong on 2016-01-25.
|
|
*/
|
|
internal object Zoom : ConsoleCommand {
|
|
override fun execute(args: Array<String>) {
|
|
if (args.size == 2) {
|
|
|
|
var zoom: Float
|
|
try {
|
|
zoom = args[1].toFloat()
|
|
}
|
|
catch (e: NumberFormatException) {
|
|
Echo("Wrong number input.")
|
|
return
|
|
}
|
|
|
|
if (zoom < INGAME.ZOOM_MINIMUM) {
|
|
zoom = INGAME.ZOOM_MINIMUM
|
|
}
|
|
else if (zoom > INGAME.ZOOM_MAXIMUM) {
|
|
zoom = INGAME.ZOOM_MAXIMUM
|
|
}
|
|
|
|
INGAME.screenZoom = zoom
|
|
|
|
System.gc()
|
|
|
|
Echo("Set screen zoom to " + zoom.toString())
|
|
}
|
|
else {
|
|
printUsage()
|
|
}
|
|
}
|
|
|
|
override fun printUsage() {
|
|
Echo("Usage: zoom [zoom]")
|
|
}
|
|
}
|