mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
Player movement seems like back to working, res→assets
Former-commit-id: f91181caee4dabf4cb2e51d8077441c6b0f83757 Former-commit-id: 8b450303698c5c85dea9145a056b290b95a6a7b0
This commit is contained in:
@@ -43,7 +43,8 @@ object CommandDict {
|
||||
Pair("bulletintest", SetBulletin()),
|
||||
Pair("gsontest", GsonTest()),
|
||||
Pair("tips", PrintRandomTips()),
|
||||
Pair("langtest", LangTest())
|
||||
Pair("langtest", LangTest()),
|
||||
Pair("musictest", MusicTest())
|
||||
)
|
||||
|
||||
operator fun get(commandName: String): ConsoleCommand {
|
||||
|
||||
45
src/net/torvald/terrarum/console/MusicTest.kt
Normal file
45
src/net/torvald/terrarum/console/MusicTest.kt
Normal file
@@ -0,0 +1,45 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import org.newdawn.slick.Music
|
||||
import org.newdawn.slick.openal.AudioLoader
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-08-02.
|
||||
*/
|
||||
class MusicTest : ConsoleCommand {
|
||||
|
||||
var music: Music? = null
|
||||
|
||||
/**
|
||||
* Args 0: command given
|
||||
* Args 1: first argument
|
||||
*
|
||||
* e.g. in ```setav mass 74```, zeroth args will be ```setav```.
|
||||
*/
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size < 2) {
|
||||
printUsage()
|
||||
return
|
||||
}
|
||||
|
||||
if (args[1] == "stop") {
|
||||
music!!.stop()
|
||||
return
|
||||
}
|
||||
|
||||
val type = args[1].substringAfter('.').toUpperCase()
|
||||
/*AudioLoader.getStreamingAudio(
|
||||
type,
|
||||
File("./assets/sounds/test/${args[1]}").absoluteFile.toURI().toURL()
|
||||
).playAsMusic(1f, 1f, false)*/
|
||||
|
||||
music = Music("./assets/sounds/test/${args[1]}")
|
||||
music!!.play()
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo().execute("Usage: musictest filename/in/res/sounds/test")
|
||||
Echo().execute("musictest stop to stop playback")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user