mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
replaced a hack that starts random game on title screen
This commit is contained in:
@@ -36,6 +36,11 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
||||
*/
|
||||
open var actorNowPlaying: ActorHumanoid? = null
|
||||
|
||||
open var gameInitialised = false
|
||||
internal set
|
||||
open var gameFullyLoaded = false
|
||||
internal set
|
||||
|
||||
val ACTORCONTAINER_INITIAL_SIZE = 64
|
||||
val actorContainer = ArrayList<Actor>(ACTORCONTAINER_INITIAL_SIZE)
|
||||
val actorContainerInactive = ArrayList<Actor>(ACTORCONTAINER_INITIAL_SIZE)
|
||||
@@ -44,6 +49,8 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
||||
}
|
||||
|
||||
override fun show() {
|
||||
// the very basic show() implementation
|
||||
gameInitialised = true
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.torvald.terrarum.modulebasegame.Ingame
|
||||
*/
|
||||
object LoadScreen : ScreenAdapter() {
|
||||
|
||||
var screenToLoad: Ingame? = null
|
||||
var screenToLoad: IngameInstance? = null
|
||||
private lateinit var screenLoadingThread: Thread
|
||||
|
||||
|
||||
|
||||
@@ -132,10 +132,10 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
//private val ingameDrawThread: ThreadIngameDraw // draw must be on the main thread
|
||||
|
||||
|
||||
var gameInitialised = false
|
||||
private set
|
||||
var gameFullyLoaded = false
|
||||
private set
|
||||
override var gameInitialised = false
|
||||
internal set
|
||||
override var gameFullyLoaded = false
|
||||
internal set
|
||||
|
||||
|
||||
private val TILE_SIZEF = FeaturesDrawer.TILE_SIZE.toFloat()
|
||||
@@ -168,7 +168,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
//BlocksDrawer.world = this.world
|
||||
FeaturesDrawer.world = this.world
|
||||
|
||||
gameInitialised = true
|
||||
|
||||
super.show() // gameInitialised = true
|
||||
}
|
||||
|
||||
data class GameSaveData(
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.LoadScreen
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2018-12-08.
|
||||
*/
|
||||
class UIProxyNewBuildingMaker : UICanvas() {
|
||||
|
||||
override var width: Int = 0
|
||||
override var height: Int = 0
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
val ingame = BuildingMaker(Terrarum.batch)
|
||||
|
||||
Terrarum.ingame = ingame
|
||||
LoadScreen.screenToLoad = ingame
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.LoadScreen
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2018-12-08.
|
||||
*/
|
||||
class UIProxyNewRandomGame : UICanvas() {
|
||||
|
||||
override var width: Int = 0
|
||||
override var height: Int = 0
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
val ingame = Ingame(Terrarum.batch)
|
||||
ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
|
||||
//ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, 0x51621DL)
|
||||
ingame.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||
|
||||
Terrarum.ingame = ingame
|
||||
LoadScreen.screenToLoad = ingame
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -108,27 +108,6 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
||||
throw NullPointerException("No parent node to return")
|
||||
}
|
||||
}
|
||||
else if (it.labelText.contains("Start New Random Game")) {
|
||||
if (!startNewGameCalled) {
|
||||
startNewGameCalled = true
|
||||
|
||||
|
||||
printdbg(this, 1)
|
||||
|
||||
val ingame = Ingame(Terrarum.batch)
|
||||
ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
|
||||
//ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, 0x51621DL)
|
||||
ingame.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||
|
||||
printdbg(this, 2)
|
||||
|
||||
Terrarum.ingame = ingame
|
||||
LoadScreen.screenToLoad = ingame
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
|
||||
printdbg(this, 3)
|
||||
}
|
||||
}
|
||||
else {
|
||||
// check if target exists
|
||||
//println("current node: ${currentRemoConContents.data}")
|
||||
|
||||
@@ -7,8 +7,11 @@ import java.util.*
|
||||
|
||||
object UITitleRemoConYaml {
|
||||
|
||||
// YAML indent with a space, separate label and class with " : " (\x20\x3A\x20)
|
||||
|
||||
/**
|
||||
* YAML indent with a space, separate label and class with " : " (\x20\x3A\x20)
|
||||
*
|
||||
* The class must be the UICanvas
|
||||
*/
|
||||
val menus = """
|
||||
- MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UITitleCharactersList
|
||||
- CONTEXT_CHARACTER_NEW
|
||||
@@ -34,8 +37,8 @@ object UITitleRemoConYaml {
|
||||
|
||||
val debugTools = """
|
||||
- Development Tools $
|
||||
- Building Maker
|
||||
- Start New Random Game
|
||||
- Building Maker : net.torvald.terrarum.modulebasegame.ui.UIProxyNewBuildingMaker
|
||||
- Start New Random Game : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
|
||||
- MENU_LABEL_RETURN
|
||||
""".trimIndent()
|
||||
|
||||
|
||||
@@ -730,6 +730,7 @@ internal object BlocksDrawer {
|
||||
|
||||
|
||||
// write to colour buffer
|
||||
// As the texture size is very small, multithreading it would be less effective
|
||||
for (y in 0 until tilesBuffer.height) {
|
||||
for (x in 0 until tilesBuffer.width) {
|
||||
val color = sourceBuffer[y][x]
|
||||
|
||||
Reference in New Issue
Block a user