mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
new item type, "Dynamic Item"; working text terminal
Former-commit-id: 81e6d836f5f1e6490027d38146a32d404cf9ce3e Former-commit-id: af6557340f9cd0ea0b67eb7a8825aeffe75f9d82
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import net.torvald.terrarum.gamecontroller.Key
|
||||
import net.torvald.terrarum.virtualcomputers.terminal.SimpleTextTerminal
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Graphics
|
||||
import org.newdawn.slick.Image
|
||||
import org.newdawn.slick.state.BasicGameState
|
||||
import org.newdawn.slick.state.StateBasedGame
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* ComputerCraft/OpenComputers like-alike, just for fun!
|
||||
@@ -11,17 +16,40 @@ import org.newdawn.slick.state.StateBasedGame
|
||||
* Created by minjaesong on 16-09-07.
|
||||
*/
|
||||
class StateVTTest : BasicGameState() {
|
||||
override fun init(container: GameContainer?, game: StateBasedGame?) {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
|
||||
val vt = SimpleTextTerminal(SimpleTextTerminal.ELECTRIC_BLUE, 80, 25)
|
||||
|
||||
val vtUI = Image(vt.displayW, vt.displayH)
|
||||
|
||||
override fun init(container: GameContainer, game: StateBasedGame) {
|
||||
|
||||
}
|
||||
|
||||
override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
override fun update(container: GameContainer, game: StateBasedGame, delta: Int) {
|
||||
Terrarum.appgc.setTitle("VT — F: ${container.fps}")
|
||||
vt.update(container, delta)
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun getID() = Terrarum.STATE_ID_TEST_TTY
|
||||
|
||||
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
override fun render(container: GameContainer, game: StateBasedGame, g: Graphics) {
|
||||
vt.render(container, vtUI.graphics)
|
||||
|
||||
g.drawImage(vtUI,
|
||||
Terrarum.WIDTH.minus(vtUI.width).div(2f),
|
||||
Terrarum.HEIGHT.minus(vtUI.height).div(2f))
|
||||
|
||||
//vtUI.graphics.flush()
|
||||
}
|
||||
|
||||
override fun keyPressed(key: Int, c: Char) {
|
||||
super.keyPressed(key, c)
|
||||
|
||||
if (key == Key.RETURN)
|
||||
vt.printChar(10.toChar())
|
||||
else
|
||||
vt.printChar(c)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user