mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
titlescreen: camera follows terraini undulation
This commit is contained in:
@@ -1,110 +0,0 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
class UIStartMenu : UICanvas() {
|
||||
|
||||
companion object {
|
||||
/** Contains STRING_IDs */
|
||||
val menuLabels = arrayOf(
|
||||
"MENU_MODE_SINGLEPLAYER",
|
||||
"MENU_OPTIONS",
|
||||
"MENU_MODULES",
|
||||
"MENU_LABEL_LANGUAGE",
|
||||
"MENU_LABEL_CREDITS",
|
||||
"MENU_LABEL_QUIT"
|
||||
)
|
||||
|
||||
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (Terrarum.fontGame.lineHeight * 1.5).toInt()
|
||||
}
|
||||
|
||||
|
||||
|
||||
override var width: Int = 240
|
||||
override var height: Int = 36 * menuLabels.size.plus(1)
|
||||
override var openCloseTime = 0f
|
||||
|
||||
|
||||
private val menubar = UIItemTextButtonList(
|
||||
this,
|
||||
menuLabels,
|
||||
240, this.height,
|
||||
textAreaWidth = 240,
|
||||
readFromLang = true,
|
||||
activeBackCol = Color(0),
|
||||
highlightBackCol = Color(0),
|
||||
backgroundCol = Color(0),
|
||||
inactiveCol = Color.WHITE,
|
||||
defaultSelection = null
|
||||
)
|
||||
|
||||
init {
|
||||
uiItems.add(menubar)
|
||||
|
||||
|
||||
// attach listeners
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_QUIT")].clickOnceListener = { _, _, _ -> System.exit(0) }
|
||||
}
|
||||
|
||||
override fun update(delta: Float) {
|
||||
menubar.update(delta)
|
||||
}
|
||||
|
||||
override fun render(batch: SpriteBatch) {
|
||||
menubar.render(batch)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
}
|
||||
68
src/net/torvald/terrarum/ui/UITitleRemoConCredits.kt
Normal file
68
src/net/torvald/terrarum/ui/UITitleRemoConCredits.kt
Normal file
@@ -0,0 +1,68 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.gameactors.Second
|
||||
|
||||
class UITitleRemoConCredits(val superMenu: UICanvas) : UICanvas() {
|
||||
|
||||
|
||||
val menuLabels = arrayOf(
|
||||
"MENU_LABEL_CREDITS",
|
||||
"MENU_CREDIT_GPL_DNT",
|
||||
"MENU_LABEL_RETURN"
|
||||
)
|
||||
|
||||
|
||||
override var width: Int = UITitleRemoConRoot.remoConWidth
|
||||
override var height: Int = UITitleRemoConRoot.getRemoConHeight(menuLabels)
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
|
||||
private val menubar = UIItemTextButtonList(
|
||||
this,
|
||||
menuLabels,
|
||||
this.width, this.height,
|
||||
textAreaWidth = this.width,
|
||||
readFromLang = true,
|
||||
activeBackCol = Color(0),
|
||||
highlightBackCol = Color(0),
|
||||
backgroundCol = Color(0),
|
||||
inactiveCol = Color.WHITE,
|
||||
defaultSelection = null
|
||||
)
|
||||
|
||||
init {
|
||||
uiItems.add(menubar)
|
||||
|
||||
|
||||
// attach listeners
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_RETURN")].clickOnceListener = { _, _, _ ->
|
||||
superMenu.handler.setAsOpen()
|
||||
this.handler.setAsClose()
|
||||
}
|
||||
}
|
||||
|
||||
override fun update(delta: Float) {
|
||||
menubar.update(delta)
|
||||
}
|
||||
|
||||
override fun render(batch: SpriteBatch) {
|
||||
menubar.render(batch)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
}
|
||||
}
|
||||
86
src/net/torvald/terrarum/ui/UITitleRemoConRoot.kt
Normal file
86
src/net/torvald/terrarum/ui/UITitleRemoConRoot.kt
Normal file
@@ -0,0 +1,86 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
class UITitleRemoConRoot : UICanvas() {
|
||||
|
||||
companion object {
|
||||
val remoConWidth = 240
|
||||
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
|
||||
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (Terrarum.fontGame.lineHeight * 1.5).toInt()
|
||||
}
|
||||
|
||||
|
||||
/** Contains STRING_IDs */
|
||||
val menuLabels = arrayOf(
|
||||
"MENU_MODE_SINGLEPLAYER",
|
||||
"MENU_OPTIONS",
|
||||
"MENU_MODULES",
|
||||
"MENU_LABEL_LANGUAGE",
|
||||
"MENU_LABEL_CREDITS",
|
||||
"MENU_LABEL_QUIT"
|
||||
)
|
||||
|
||||
|
||||
override var width: Int = remoConWidth
|
||||
override var height: Int = getRemoConHeight(menuLabels)
|
||||
override var openCloseTime = 0f
|
||||
|
||||
|
||||
private val menubar = UIItemTextButtonList(
|
||||
this,
|
||||
menuLabels,
|
||||
this.width, this.height,
|
||||
textAreaWidth = this.width,
|
||||
readFromLang = true,
|
||||
activeBackCol = Color(0),
|
||||
highlightBackCol = Color(0),
|
||||
backgroundCol = Color(0),
|
||||
inactiveCol = Color.WHITE,
|
||||
defaultSelection = null
|
||||
)
|
||||
|
||||
|
||||
//private val paneCredits = UIHandler()
|
||||
private val remoConCredits = UIHandler(UITitleRemoConCredits(this))
|
||||
|
||||
|
||||
init {
|
||||
uiItems.add(menubar)
|
||||
|
||||
|
||||
// attach listeners
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_QUIT")].clickOnceListener = { _, _, _ -> System.exit(0) }
|
||||
}
|
||||
|
||||
override fun update(delta: Float) {
|
||||
menubar.update(delta)
|
||||
}
|
||||
|
||||
override fun render(batch: SpriteBatch) {
|
||||
menubar.render(batch)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user