mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
vital metre mockup
Former-commit-id: c49f7ba80cff854db6d79af1c9d50d77b0bae76d Former-commit-id: bd62a24bfd4c9737e2f23b0bae1756df62a19acf
This commit is contained in:
@@ -222,6 +222,77 @@ object Terrarum : StateBasedGame(GAME_NAME) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Throws(SlickException::class)
|
||||||
|
override fun initStatesList(gc: GameContainer) {
|
||||||
|
gc.input.enableKeyRepeat()
|
||||||
|
|
||||||
|
|
||||||
|
// get locale from config
|
||||||
|
val gameLocaleFromConfig = gameConfig.getAsString("language") ?: sysLang
|
||||||
|
|
||||||
|
// if bad game locale were set, use system locale
|
||||||
|
if (gameLocaleFromConfig.length < 2)
|
||||||
|
gameLocale = sysLang
|
||||||
|
else
|
||||||
|
gameLocale = gameLocaleFromConfig
|
||||||
|
|
||||||
|
println("[Terrarum] Locale: " + gameLocale)
|
||||||
|
|
||||||
|
|
||||||
|
fontGame = GameFontImpl()
|
||||||
|
fontSmallNumbers = TinyAlphNum()
|
||||||
|
|
||||||
|
|
||||||
|
// search for real controller
|
||||||
|
// exclude controllers with name "Mouse", "keyboard"
|
||||||
|
val notControllerRegex = Regex("mouse|keyboard")
|
||||||
|
try {
|
||||||
|
// gc.input.controllerCount is unreliable
|
||||||
|
for (i in 0..255) {
|
||||||
|
val controllerInQuo = Controllers.getController(i)
|
||||||
|
|
||||||
|
println("Controller $i: ${controllerInQuo.name}")
|
||||||
|
|
||||||
|
// check the name
|
||||||
|
if (!controllerInQuo.name.toLowerCase().contains(notControllerRegex)) {
|
||||||
|
controller = controllerInQuo
|
||||||
|
println("Controller $i selected: ${controller!!.name}")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e: IndexOutOfBoundsException) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controller != null) {
|
||||||
|
for (c in 0..controller!!.axisCount - 1) {
|
||||||
|
controller!!.setDeadZone(c, CONTROLLER_DEADZONE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gc.graphics.clear() // clean up any 'dust' in the buffer
|
||||||
|
|
||||||
|
//addState(StateVTTest())
|
||||||
|
//addState(StateGraphicComputerTest())
|
||||||
|
//addState(StateTestingLightning())
|
||||||
|
//addState(StateSplash())
|
||||||
|
//addState(StateMonitorCheck())
|
||||||
|
//addState(StateFontTester())
|
||||||
|
//addState(StateNoiseTexGen())
|
||||||
|
//addState(StateBlurTest())
|
||||||
|
//addState(StateShaderTest())
|
||||||
|
//addState(StateNoiseTester())
|
||||||
|
|
||||||
|
ingame = StateInGame()
|
||||||
|
addState(ingame)
|
||||||
|
|
||||||
|
|
||||||
|
// foolproof
|
||||||
|
if (stateCount < 1) {
|
||||||
|
throw Error("Please add or un-comment addState statements")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getDefaultDirectory() {
|
private fun getDefaultDirectory() {
|
||||||
val OS = System.getProperty("os.name").toUpperCase()
|
val OS = System.getProperty("os.name").toUpperCase()
|
||||||
if (OS.contains("WIN")) {
|
if (OS.contains("WIN")) {
|
||||||
@@ -373,77 +444,6 @@ object Terrarum : StateBasedGame(GAME_NAME) {
|
|||||||
|
|
||||||
return file // TODO TEST CODE
|
return file // TODO TEST CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(SlickException::class)
|
|
||||||
override fun initStatesList(gc: GameContainer) {
|
|
||||||
gc.input.enableKeyRepeat()
|
|
||||||
|
|
||||||
|
|
||||||
// get locale from config
|
|
||||||
val gameLocaleFromConfig = gameConfig.getAsString("language") ?: sysLang
|
|
||||||
|
|
||||||
// if bad game locale were set, use system locale
|
|
||||||
if (gameLocaleFromConfig.length < 2)
|
|
||||||
gameLocale = sysLang
|
|
||||||
else
|
|
||||||
gameLocale = gameLocaleFromConfig
|
|
||||||
|
|
||||||
println("[Terrarum] Locale: " + gameLocale)
|
|
||||||
|
|
||||||
|
|
||||||
fontGame = GameFontImpl()
|
|
||||||
fontSmallNumbers = TinyAlphNum()
|
|
||||||
|
|
||||||
|
|
||||||
// search for real controller
|
|
||||||
// exclude controllers with name "Mouse", "keyboard"
|
|
||||||
val notControllerRegex = Regex("mouse|keyboard")
|
|
||||||
try {
|
|
||||||
// gc.input.controllerCount is unreliable
|
|
||||||
for (i in 0..255) {
|
|
||||||
val controllerInQuo = Controllers.getController(i)
|
|
||||||
|
|
||||||
println("Controller $i: ${controllerInQuo.name}")
|
|
||||||
|
|
||||||
// check the name
|
|
||||||
if (!controllerInQuo.name.toLowerCase().contains(notControllerRegex)) {
|
|
||||||
controller = controllerInQuo
|
|
||||||
println("Controller $i selected: ${controller!!.name}")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e: IndexOutOfBoundsException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controller != null) {
|
|
||||||
for (c in 0..controller!!.axisCount - 1) {
|
|
||||||
controller!!.setDeadZone(c, CONTROLLER_DEADZONE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gc.graphics.clear() // clean up any 'dust' in the buffer
|
|
||||||
|
|
||||||
//addState(StateVTTest())
|
|
||||||
addState(StateGraphicComputerTest())
|
|
||||||
//addState(StateTestingLightning())
|
|
||||||
//addState(StateSplash())
|
|
||||||
//addState(StateMonitorCheck())
|
|
||||||
//addState(StateFontTester())
|
|
||||||
//addState(StateNoiseTexGen())
|
|
||||||
//addState(StateBlurTest())
|
|
||||||
//addState(StateShaderTest())
|
|
||||||
//addState(StateNoiseTester())
|
|
||||||
|
|
||||||
ingame = StateInGame()
|
|
||||||
addState(ingame)
|
|
||||||
|
|
||||||
|
|
||||||
// foolproof
|
|
||||||
if (stateCount < 1) {
|
|
||||||
throw Error("Please add or un-comment addState statements")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ internal class Term(globals: Globals, term: Teletype) {
|
|||||||
class WriteString(val tty: Teletype) : LuaFunction() {
|
class WriteString(val tty: Teletype) : LuaFunction() {
|
||||||
override fun call(p0: LuaValue): LuaValue {
|
override fun call(p0: LuaValue): LuaValue {
|
||||||
if (tty is Terminal)
|
if (tty is Terminal)
|
||||||
tty.writeString(p0.checkIBM437())
|
tty.writeString(p0.checkIBM437(), tty.cursorX, tty.cursorY)
|
||||||
else
|
else
|
||||||
tty.writeChars(p0.checkIBM437())
|
tty.writeChars(p0.checkIBM437())
|
||||||
return LuaValue.NONE
|
return LuaValue.NONE
|
||||||
@@ -89,7 +89,7 @@ internal class Term(globals: Globals, term: Teletype) {
|
|||||||
class PrintString(val tty: Teletype) : LuaFunction() {
|
class PrintString(val tty: Teletype) : LuaFunction() {
|
||||||
override fun call(p0: LuaValue): LuaValue {
|
override fun call(p0: LuaValue): LuaValue {
|
||||||
if (tty is Terminal)
|
if (tty is Terminal)
|
||||||
tty.printString(p0.checkIBM437())
|
tty.printString(p0.checkIBM437(), tty.cursorX, tty.cursorY)
|
||||||
else
|
else
|
||||||
tty.printChars(p0.checkIBM437())
|
tty.printChars(p0.checkIBM437())
|
||||||
return LuaValue.NONE
|
return LuaValue.NONE
|
||||||
|
|||||||
@@ -106,34 +106,35 @@ class GraphicsTerminal(private val host: TerrarumComputer) : Terminal {
|
|||||||
|
|
||||||
override fun emitChar(c: Char, xx: Int, yy: Int) {
|
override fun emitChar(c: Char, xx: Int, yy: Int) {
|
||||||
wrap() // needed
|
wrap() // needed
|
||||||
var x = xx
|
var nx = xx
|
||||||
var y = yy
|
var ny = yy
|
||||||
// wrap argument cursor
|
// wrap argument cursor
|
||||||
if (xx < 0 && yy <= 0) {
|
if (xx < 0 && yy <= 0) {
|
||||||
x = 0
|
nx = 0
|
||||||
y = 0
|
ny = 0
|
||||||
}
|
}
|
||||||
else if (cursorX >= width) {
|
else if (cursorX >= width) {
|
||||||
println("arstenioarstoneirastneo")
|
println("arstenioarstoneirastneo")
|
||||||
x = 0
|
nx = 0
|
||||||
y += 1
|
ny += 1
|
||||||
}
|
}
|
||||||
else if (cursorX < 0) {
|
else if (cursorX < 0) {
|
||||||
x = width - 1
|
nx = width - 1
|
||||||
y -= 1
|
ny -= 1
|
||||||
}
|
}
|
||||||
// auto scroll up
|
// auto scroll up
|
||||||
if (cursorY >= height) {
|
if (cursorY >= height) {
|
||||||
scroll()
|
scroll()
|
||||||
y -= 1
|
ny -= 1
|
||||||
}
|
}
|
||||||
|
|
||||||
println("xx: $xx, yy: $yy")
|
println("xx: $xx, yy: $yy")
|
||||||
|
println("nx: $nx, ny: $ny")
|
||||||
|
|
||||||
videoCard.drawChar(
|
videoCard.drawChar(
|
||||||
c,
|
c,
|
||||||
x * PeripheralVideoCard.blockW,
|
nx * PeripheralVideoCard.blockW,
|
||||||
y * PeripheralVideoCard.blockH,
|
ny * PeripheralVideoCard.blockH,
|
||||||
CLUT16_TO_64[foreColour]
|
CLUT16_TO_64[foreColour]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ open class SimpleTextTerminal(
|
|||||||
override fun printChar(c: Char) {
|
override fun printChar(c: Char) {
|
||||||
wrap()
|
wrap()
|
||||||
if (c >= ' ' && c.toInt() != 127) {
|
if (c >= ' ' && c.toInt() != 127) {
|
||||||
emitChar(c)
|
emitChar(c, cursorX, cursorY)
|
||||||
cursorX += 1
|
cursorX += 1
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -206,7 +206,7 @@ open class SimpleTextTerminal(
|
|||||||
ASCII_LF -> newLine()
|
ASCII_LF -> newLine()
|
||||||
ASCII_FF -> clear()
|
ASCII_FF -> clear()
|
||||||
ASCII_CR -> { cursorX = 0 }
|
ASCII_CR -> { cursorX = 0 }
|
||||||
ASCII_DEL -> { cursorX -= 1; wrap(); emitChar(colourKey.shl(8)) }
|
ASCII_DEL -> { cursorX -= 1; wrap(); emitChar(colourKey.shl(8), cursorX, cursorY) }
|
||||||
ASCII_DC1, ASCII_DC2, ASCII_DC3, ASCII_DC4 -> { foreColour = c - ASCII_DC1 }
|
ASCII_DC1, ASCII_DC2, ASCII_DC3, ASCII_DC4 -> { foreColour = c - ASCII_DC1 }
|
||||||
ASCII_DLE -> { foreColour = errorColour }
|
ASCII_DLE -> { foreColour = errorColour }
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
work_files/UI/vital_metres_2_annotation.png
Normal file
BIN
work_files/UI/vital_metres_2_annotation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 228 KiB |
BIN
work_files/UI/vital_metres_2_mockup.png
Normal file
BIN
work_files/UI/vital_metres_2_mockup.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
Reference in New Issue
Block a user