mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
at least message shows on loadscreen
does the transition works?
This commit is contained in:
@@ -232,6 +232,7 @@ public class AppLoader implements ApplicationListener {
|
|||||||
private static com.badlogic.gdx.graphics.Color gradWhiteBottom = new com.badlogic.gdx.graphics.Color(0xd8d8d8ff);
|
private static com.badlogic.gdx.graphics.Color gradWhiteBottom = new com.badlogic.gdx.graphics.Color(0xd8d8d8ff);
|
||||||
|
|
||||||
private static Screen currenScreen;
|
private static Screen currenScreen;
|
||||||
|
private static LoadScreenBase currentSetLoadScreen;
|
||||||
public static int screenW = 0;
|
public static int screenW = 0;
|
||||||
public static int screenH = 0;
|
public static int screenH = 0;
|
||||||
public static int halfScreenW = 0;
|
public static int halfScreenW = 0;
|
||||||
@@ -728,19 +729,38 @@ public class AppLoader implements ApplicationListener {
|
|||||||
if (currenScreen != null) currenScreen.resume();
|
if (currenScreen != null) currenScreen.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LoadScreenBase getLoadScreen() {
|
||||||
|
return currentSetLoadScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLoadScreen(LoadScreenBase screen) {
|
||||||
|
currentSetLoadScreen = screen;
|
||||||
|
_setScr(screen);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setScreen(Screen screen) {
|
public static void setScreen(Screen screen) {
|
||||||
printdbg("[AppLoader-Static]", "Changing screen to " + screen.getClass().getCanonicalName());
|
if (screen instanceof LoadScreenBase) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Loadscreen '" + screen.getClass().getSimpleName() + "' must be set with 'setLoadScreen()' method");
|
||||||
|
}
|
||||||
|
|
||||||
|
_setScr(screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void _setScr(Screen screen) {
|
||||||
|
|
||||||
|
printdbg("AppLoader-Static", "Changing screen to " + screen.getClass().getCanonicalName());
|
||||||
|
|
||||||
// this whole thing is directtly copied from com.badlogic.gdx.Game
|
// this whole thing is directtly copied from com.badlogic.gdx.Game
|
||||||
|
|
||||||
if (currenScreen != null) {
|
if (currenScreen != null) {
|
||||||
printdbg("[AppLoader-Static]", "Screen before change: " + currenScreen.getClass().getCanonicalName());
|
printdbg("AppLoader-Static", "Screen before change: " + currenScreen.getClass().getCanonicalName());
|
||||||
|
|
||||||
currenScreen.hide();
|
currenScreen.hide();
|
||||||
currenScreen.dispose();
|
currenScreen.dispose();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printdbg("[AppLoader-Static]", "Screen before change: null");
|
printdbg("AppLoader-Static", "Screen before change: null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -752,7 +772,7 @@ public class AppLoader implements ApplicationListener {
|
|||||||
|
|
||||||
System.gc();
|
System.gc();
|
||||||
|
|
||||||
printdbg("[AppLoader-Static]", "Screen transition complete: " + currenScreen.getClass().getCanonicalName());
|
printdbg("AppLoader-Static", "Screen transition complete: " + currenScreen.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package net.torvald.terrarum
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.ScreenAdapter
|
import com.badlogic.gdx.ScreenAdapter
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
|
import com.badlogic.gdx.utils.Disposable
|
||||||
import net.torvald.util.CircularArray
|
import net.torvald.util.CircularArray
|
||||||
|
|
||||||
open class LoadScreenBase : ScreenAdapter() {
|
open class LoadScreenBase : ScreenAdapter(), Disposable {
|
||||||
|
|
||||||
open var screenToLoad: IngameInstance? = null
|
open var screenToLoad: IngameInstance? = null
|
||||||
open lateinit var screenLoadingThread: Thread
|
open lateinit var screenLoadingThread: Thread
|
||||||
@@ -64,7 +65,7 @@ open class LoadScreenBase : ScreenAdapter() {
|
|||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
if (doContextChange) {
|
if (doContextChange) {
|
||||||
Thread.sleep(80)
|
Thread.sleep(80)
|
||||||
AppLoader.setScreen(LoadScreen.screenToLoad!!)
|
AppLoader.setScreen(screenToLoad!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import net.torvald.util.CircularArray
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2017-07-13.
|
* Created by minjaesong on 2017-07-13.
|
||||||
*/
|
*/
|
||||||
object LoadScreen : LoadScreenBase() {
|
object SanicLoadScreen : LoadScreenBase() {
|
||||||
|
|
||||||
|
init {
|
||||||
|
AppLoader.disposableSingletonsPool.add(this)
|
||||||
|
}
|
||||||
|
|
||||||
private var arrowObjPos = 0f // 0 means at starting position, regardless of screen position
|
private var arrowObjPos = 0f // 0 means at starting position, regardless of screen position
|
||||||
private var arrowObjGlideOffsetX = 0f
|
private var arrowObjGlideOffsetX = 0f
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import net.torvald.terrarum.modulebasegame.gameworld.WorldSimulator
|
|||||||
import net.torvald.terrarum.modulebasegame.ui.*
|
import net.torvald.terrarum.modulebasegame.ui.*
|
||||||
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
||||||
import net.torvald.terrarum.modulebasegame.worldgenerator.RoguelikeRandomiser
|
import net.torvald.terrarum.modulebasegame.worldgenerator.RoguelikeRandomiser
|
||||||
import net.torvald.terrarum.modulebasegame.worldgenerator.WorldGenerator
|
|
||||||
import net.torvald.terrarum.modulebasegame.worldgenerator.Worldgen
|
import net.torvald.terrarum.modulebasegame.worldgenerator.Worldgen
|
||||||
import net.torvald.terrarum.modulebasegame.worldgenerator.WorldgenParams
|
import net.torvald.terrarum.modulebasegame.worldgenerator.WorldgenParams
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -226,7 +225,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
printdbg(this, "loaded successfully.")
|
printdbg(this, "loaded successfully.")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LoadScreen.addMessage("Loading world from save")
|
AppLoader.getLoadScreen().addMessage("Loading world from save")
|
||||||
|
|
||||||
|
|
||||||
gameworld = gameSaveData.world
|
gameworld = gameSaveData.world
|
||||||
@@ -252,8 +251,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
printdbg(this, "loaded successfully.")
|
printdbg(this, "loaded successfully.")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LoadScreen.addMessage("${AppLoader.GAME_NAME} version ${AppLoader.getVERSION_STRING()}")
|
AppLoader.getLoadScreen().addMessage("${AppLoader.GAME_NAME} version ${AppLoader.getVERSION_STRING()}")
|
||||||
LoadScreen.addMessage("Creating new world")
|
AppLoader.getLoadScreen().addMessage("Creating new world")
|
||||||
|
|
||||||
|
|
||||||
// init map as chosen size
|
// init map as chosen size
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, worldwidth: Int, worl
|
|||||||
// a Class impl is chosen to make resize-handling easier, there's not much benefit making this a singleton anyway
|
// a Class impl is chosen to make resize-handling easier, there's not much benefit making this a singleton anyway
|
||||||
|
|
||||||
init {
|
init {
|
||||||
screenToBeLoaded.world
|
AppLoader.disposableSingletonsPool.add(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val world = screenToBeLoaded.world
|
private val world = screenToBeLoaded.world
|
||||||
@@ -28,10 +28,10 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, worldwidth: Int, worl
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val WIDTH_RATIO = 0.7
|
private const val WIDTH_RATIO = 0.7
|
||||||
private const val PREVIEW_UPDATE_RATE = 1/8f
|
private const val PREVIEW_UPDATE_RATE = 1 / 8f
|
||||||
|
|
||||||
private val COL_WALL = Color.WHITE
|
private val COL_WALL = Color.WHITE
|
||||||
private val COL_TERR = Color(.5f,.5f,.5f,1f)
|
private val COL_TERR = Color(.5f, .5f, .5f, 1f)
|
||||||
private val COL_AIR = Color.BLACK
|
private val COL_AIR = Color.BLACK
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,24 +54,34 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, worldwidth: Int, worl
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
previewTexture.dispose()
|
//println("WorldgenLoadScreenRender")
|
||||||
previewTexture = Texture(previewPixmap)
|
|
||||||
|
|
||||||
//
|
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
|
||||||
|
|
||||||
previewRenderCounter += delta
|
previewRenderCounter += delta
|
||||||
if (previewRenderCounter >= PREVIEW_UPDATE_RATE) {
|
if (previewRenderCounter >= PREVIEW_UPDATE_RATE) {
|
||||||
previewRenderCounter -= PREVIEW_UPDATE_RATE
|
previewRenderCounter -= PREVIEW_UPDATE_RATE
|
||||||
renderToPreview()
|
renderToPreview()
|
||||||
|
previewTexture.dispose()
|
||||||
|
previewTexture = Texture(previewPixmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AppLoader.batch.inUse {
|
AppLoader.batch.inUse {
|
||||||
|
it.color = Color.WHITE
|
||||||
it.draw(previewTexture,
|
it.draw(previewTexture,
|
||||||
(AppLoader.screenW - previewWidth).div(2f).round(),
|
(AppLoader.screenW - previewWidth).div(2f).round(),
|
||||||
(AppLoader.screenH - previewHeight.times(1.5f)).div(2f).round()
|
(AppLoader.screenH - previewHeight.times(1.5f)).div(2f).round()
|
||||||
)
|
)
|
||||||
|
val text = messages.getHeadElem() ?: ""
|
||||||
|
AppLoader.fontGame.draw(it,
|
||||||
|
text,
|
||||||
|
(AppLoader.screenW - AppLoader.fontGame.getWidth(text)).div(2f).round(),
|
||||||
|
(AppLoader.screenH + previewHeight.times(1.5f)).div(2f).round() - AppLoader.fontGame.lineHeight
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
super.render(delta)
|
super.render(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +102,6 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, worldwidth: Int, worl
|
|||||||
|
|
||||||
override fun addMessage(msg: String) {
|
override fun addMessage(msg: String) {
|
||||||
super.addMessage(msg)
|
super.addMessage(msg)
|
||||||
println("[WorldgenLoadScreen] $msg")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.AppLoader
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.LoadScreen
|
import net.torvald.terrarum.SanicLoadScreen
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||||
@@ -35,8 +35,8 @@ class UIProxyNewBuildingMaker : UICanvas() {
|
|||||||
val ingame = BuildingMaker(AppLoader.batch)
|
val ingame = BuildingMaker(AppLoader.batch)
|
||||||
|
|
||||||
Terrarum.setCurrentIngameInstance(ingame)
|
Terrarum.setCurrentIngameInstance(ingame)
|
||||||
LoadScreen.screenToLoad = ingame
|
SanicLoadScreen.screenToLoad = ingame
|
||||||
AppLoader.setScreen(LoadScreen)
|
AppLoader.setScreen(SanicLoadScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endClosing(delta: Float) {
|
override fun endClosing(delta: Float) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
|||||||
import net.torvald.random.HQRNG
|
import net.torvald.random.HQRNG
|
||||||
import net.torvald.terrarum.AppLoader
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.AppLoader.printdbg
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.LoadScreen
|
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
@@ -48,7 +47,7 @@ class UIProxyNewRandomGame : UICanvas() {
|
|||||||
//LoadScreen.screenToLoad = ingame
|
//LoadScreen.screenToLoad = ingame
|
||||||
//AppLoader.setScreen(LoadScreen)
|
//AppLoader.setScreen(LoadScreen)
|
||||||
val loadScreen = WorldgenLoadScreen(ingame, worldParam.width, worldParam.height)
|
val loadScreen = WorldgenLoadScreen(ingame, worldParam.width, worldParam.height)
|
||||||
AppLoader.setScreen(loadScreen)
|
AppLoader.setLoadScreen(loadScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endClosing(delta: Float) {
|
override fun endClosing(delta: Float) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.sudoplay.joise.Joise
|
|||||||
import com.sudoplay.joise.module.*
|
import com.sudoplay.joise.module.*
|
||||||
import net.torvald.terrarum.AppLoader
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.AppLoader.printdbg
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.LoadScreen
|
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.concurrent.ThreadExecutor
|
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
@@ -31,8 +30,10 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
|
|||||||
genFuture = ThreadExecutor.submit {
|
genFuture = ThreadExecutor.submit {
|
||||||
for (x in 0 until world.width) {
|
for (x in 0 until world.width) {
|
||||||
|
|
||||||
if (AppLoader.IS_DEVELOPMENT_BUILD)
|
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
||||||
LoadScreen.addMessage("Tile draw for x=$x")
|
AppLoader.getLoadScreen().addMessage("Tile draw for x=$x")
|
||||||
|
//println("Tile draw for x=$x")
|
||||||
|
}
|
||||||
|
|
||||||
for (y in 0 until world.height) {
|
for (y in 0 until world.height) {
|
||||||
val sampleTheta = (x.toDouble() / world.width) * TWO_PI
|
val sampleTheta = (x.toDouble() / world.width) * TWO_PI
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.worldgenerator
|
package net.torvald.terrarum.modulebasegame.worldgenerator
|
||||||
|
|
||||||
import net.torvald.terrarum.LoadScreen
|
import net.torvald.terrarum.AppLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2016-06-13.
|
* Created by minjaesong on 2016-06-13.
|
||||||
@@ -12,7 +12,7 @@ class ThreadProcessNoiseLayers(val startIndex: Int, val endIndex: Int,
|
|||||||
override fun run() {
|
override fun run() {
|
||||||
for (record in noiseRecords) {
|
for (record in noiseRecords) {
|
||||||
println("[mapgenerator] ${record.message}...")
|
println("[mapgenerator] ${record.message}...")
|
||||||
LoadScreen.addMessage("${record.message}...")
|
AppLoader.getLoadScreen().addMessage("${record.message}...")
|
||||||
|
|
||||||
for (y in startIndex..endIndex) {
|
for (y in startIndex..endIndex) {
|
||||||
for (x in 0..WorldGenerator.WIDTH - 1) {
|
for (x in 0..WorldGenerator.WIDTH - 1) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.sudoplay.joise.module.*
|
|||||||
import net.torvald.random.HQRNG
|
import net.torvald.random.HQRNG
|
||||||
import net.torvald.terrarum.AppLoader
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.AppLoader.printdbg
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.LoadScreen
|
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||||
import net.torvald.terrarum.concurrent.ThreadParallel
|
import net.torvald.terrarum.concurrent.ThreadParallel
|
||||||
@@ -492,7 +491,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
// fill the area as Joise map
|
// fill the area as Joise map
|
||||||
printdbg(this, "Raising and eroding terrain...")
|
printdbg(this, "Raising and eroding terrain...")
|
||||||
LoadScreen.addMessage("Raising and eroding terrain...")
|
AppLoader.getLoadScreen().addMessage("Raising and eroding terrain...")
|
||||||
for (y in 0..(TERRAIN_UNDULATION - 1)) {
|
for (y in 0..(TERRAIN_UNDULATION - 1)) {
|
||||||
for (x in 0..WIDTH) {
|
for (x in 0..WIDTH) {
|
||||||
// straight-line sampling
|
// straight-line sampling
|
||||||
@@ -603,7 +602,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
private fun fillMapByNoiseMap() {
|
private fun fillMapByNoiseMap() {
|
||||||
printdbg(this, "Shaping world...")
|
printdbg(this, "Shaping world...")
|
||||||
LoadScreen.addMessage("Reticulating splines...") // RETICULATING SPLINES
|
AppLoader.getLoadScreen().addMessage("Reticulating splines...") // RETICULATING SPLINES
|
||||||
// generate dirt-stone transition line
|
// generate dirt-stone transition line
|
||||||
// use catmull spline
|
// use catmull spline
|
||||||
val dirtStoneLine = IntArray(WIDTH)
|
val dirtStoneLine = IntArray(WIDTH)
|
||||||
@@ -798,7 +797,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
private fun generateFloatingIslands() {
|
private fun generateFloatingIslands() {
|
||||||
printdbg(this, "Placing floating islands...")
|
printdbg(this, "Placing floating islands...")
|
||||||
LoadScreen.addMessage("Placing floating islands...")
|
AppLoader.getLoadScreen().addMessage("Placing floating islands...")
|
||||||
|
|
||||||
val nIslandsMax = Math.round(world.width * 6f / 8192f)
|
val nIslandsMax = Math.round(world.width * 6f / 8192f)
|
||||||
val nIslandsMin = Math.max(2, Math.round(world.width * 4f / 8192f))
|
val nIslandsMin = Math.max(2, Math.round(world.width * 4f / 8192f))
|
||||||
@@ -845,7 +844,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
private fun plantGrass() {
|
private fun plantGrass() {
|
||||||
printdbg(this, "Planting grass...")
|
printdbg(this, "Planting grass...")
|
||||||
LoadScreen.addMessage("Planting grass...")
|
AppLoader.getLoadScreen().addMessage("Planting grass...")
|
||||||
|
|
||||||
/* TODO composing dirt and stone
|
/* TODO composing dirt and stone
|
||||||
* over certain level, use background dirt with stone 'peckles'
|
* over certain level, use background dirt with stone 'peckles'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.worldgenerator
|
package net.torvald.terrarum.modulebasegame.worldgenerator
|
||||||
|
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.AppLoader.printdbg
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.LoadScreen
|
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +33,7 @@ object Worldgen {
|
|||||||
|
|
||||||
val it = jobs[i]
|
val it = jobs[i]
|
||||||
|
|
||||||
LoadScreen.addMessage(it.loadingScreenName)
|
AppLoader.getLoadScreen().addMessage(it.loadingScreenName)
|
||||||
it.theWork.run()
|
it.theWork.run()
|
||||||
|
|
||||||
// wait
|
// wait
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ class CircularArray<T>(val size: Int, val overwriteOnOverflow: Boolean): Iterabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the youngest (last of the array) element */
|
/** Returns the youngest (last of the array) element */
|
||||||
fun getHeadElem(): T = if (isEmpty) throw EmptyStackException() else buffer[(head - 1).wrap()]
|
fun getHeadElem(): T? = if (isEmpty) null else buffer[(head - 1).wrap()]
|
||||||
/** Returns the oldest (first of the array) element */
|
/** Returns the oldest (first of the array) element */
|
||||||
fun getTailElem(): T = buffer[tail]
|
fun getTailElem(): T? = if (isEmpty) null else buffer[tail]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relative-indexed get. Index of zero will return the head element.
|
* Relative-indexed get. Index of zero will return the head element.
|
||||||
|
|||||||
Reference in New Issue
Block a user