mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
com.torvald → net.torvald
Former-commit-id: 375604da8a20a6ba7cd0a8d05a44add02b2d04f4 Former-commit-id: 287287c5920b07618174d7a7573f049d350ded66
This commit is contained in:
42
src/net/torvald/terrarum/console/Zoom.kt
Normal file
42
src/net/torvald/terrarum/console/Zoom.kt
Normal file
@@ -0,0 +1,42 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-25.
|
||||
*/
|
||||
class Zoom : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
|
||||
var zoom: Float
|
||||
try {
|
||||
zoom = args[1].toFloat()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
Echo().execute("Wrong number input.")
|
||||
return
|
||||
}
|
||||
|
||||
if (zoom < Terrarum.game.ZOOM_MIN) {
|
||||
zoom = Terrarum.game.ZOOM_MIN
|
||||
}
|
||||
else if (zoom > Terrarum.game.ZOOM_MAX) {
|
||||
zoom = Terrarum.game.ZOOM_MAX
|
||||
}
|
||||
|
||||
Terrarum.game.screenZoom = zoom
|
||||
|
||||
System.gc()
|
||||
|
||||
Echo().execute("Set screen zoom to " + zoom.toString())
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
}
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo().execute("Usage: zoom [zoom]")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user