diff --git a/assets/graphics/gui/.gitattributes b/assets/graphics/gui/.gitattributes new file mode 100644 index 000000000..ca82ef549 --- /dev/null +++ b/assets/graphics/gui/.gitattributes @@ -0,0 +1 @@ +*.{psd,tga,ogg} filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/assets/graphics/sprites/test_player.png b/assets/graphics/sprites/test_player.png index 805eed58b..58fff107f 100644 Binary files a/assets/graphics/sprites/test_player.png and b/assets/graphics/sprites/test_player.png differ diff --git a/assets/graphics/sprites/test_player_glow.png b/assets/graphics/sprites/test_player_glow.png index 2d9df20f0..bd76c80e7 100644 Binary files a/assets/graphics/sprites/test_player_glow.png and b/assets/graphics/sprites/test_player_glow.png differ diff --git a/src/net/torvald/terrarum/StateInGame.kt b/src/net/torvald/terrarum/StateInGame.kt index 841f4228a..7122a6396 100644 --- a/src/net/torvald/terrarum/StateInGame.kt +++ b/src/net/torvald/terrarum/StateInGame.kt @@ -536,7 +536,7 @@ constructor() : BasicGameState() { if (false) { // don't multithread this for now, it's SLOWER //if (Terrarum.MULTITHREAD) { val actors = actorContainer.size.toFloat() // set up indices - for (i in 0..ThreadParallel.POOL_SIZE - 1) { + for (i in 0..Terrarum.THREADS - 1) { ThreadParallel.map( i, ThreadActorUpdate( diff --git a/src/net/torvald/terrarum/concurrent/ThreadParallel.kt b/src/net/torvald/terrarum/concurrent/ThreadParallel.kt index 234558bd8..3166b0ce4 100644 --- a/src/net/torvald/terrarum/concurrent/ThreadParallel.kt +++ b/src/net/torvald/terrarum/concurrent/ThreadParallel.kt @@ -1,28 +1,12 @@ package net.torvald.terrarum.concurrent import net.torvald.terrarum.Terrarum -import java.util.* /** * Created by minjaesong on 16-05-25. */ object ThreadParallel { - val POOL_SIZE = Terrarum.THREADS + 1 - - private val pool: Array = Array(POOL_SIZE, { null }) - - /** - * Map array of Runnable objects to thread pool. - * @param prefix : will name each thread as "Foo-1" - * @param runnables : vararg - */ - fun mapAll(prefix: String, runnables: Array) { - if (runnables.size != POOL_SIZE) - throw RuntimeException("Thread pool argument size mismatch. If you have four cores, you must use four runnables.") - - for (i in 0..runnables.size) - pool[i] = Thread(runnables[i], "$prefix-$i") - } + private val pool: Array = Array(Terrarum.THREADS, { null }) /** * Map Runnable object to certain index of the thread pool. @@ -34,18 +18,18 @@ object ThreadParallel { pool[index] = Thread(runnable, "$prefix-$index") } - /** - * Fill the thread pool with NULL value. - */ - fun purge() { - for (i in 0..POOL_SIZE) - pool[i] = null - } - /** * Start all thread in the pool. If the thread in the pool is NULL, it will simply ignored. */ fun startAll() { pool.forEach { it?.start() } } + + /** + * Primitive locking + */ + fun allFinished(): Boolean { + pool.forEach { if (it?.state != Thread.State.TERMINATED) return false } + return true + } } \ No newline at end of file diff --git a/src/net/torvald/terrarum/ui/MessageWindow.kt b/src/net/torvald/terrarum/ui/MessageWindow.kt index b63dffea1..16cc09f94 100644 --- a/src/net/torvald/terrarum/ui/MessageWindow.kt +++ b/src/net/torvald/terrarum/ui/MessageWindow.kt @@ -31,14 +31,14 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas { init { if (!isBlackVariant) { - segmentLeft = Image("./assets/graphics/gui/message_twoline_white_left.png"); - segmentRight = Image("./assets/graphics/gui/message_twoline_white_right.png"); - segmentBody = Image("./assets/graphics/gui/message_twoline_white_body.png"); + segmentLeft = Image("./assets/graphics/gui/message_twoline_white_left.tga") + segmentRight = Image("./assets/graphics/gui/message_twoline_white_right.tga") + segmentBody = Image("./assets/graphics/gui/message_twoline_white_body.tga") } else { - segmentLeft = Image("./assets/graphics/gui/message_twoline_black_left.png") - segmentRight = Image("./assets/graphics/gui/message_twoline_black_right.png") - segmentBody = Image("./assets/graphics/gui/message_twoline_black_body.png") + segmentLeft = Image("./assets/graphics/gui/message_black_left.tga") + segmentRight = Image("./assets/graphics/gui/message_black_right.tga") + segmentBody = Image("./assets/graphics/gui/message_black_body.tga") } uiFont = GameFontWhite() height = segmentLeft!!.height @@ -55,34 +55,17 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas { } override fun render(gc: GameContainer, g: Graphics) { - // using the texture - /*blendDisable() - - drawSegments(g) - g.setDrawMode(Graphics.MODE_ALPHA_MAP) + blendNormal() drawSegments(g) g.font = uiFont - - g.setDrawMode(Graphics.MODE_NORMAL) + for (i in 0..Math.min(messagesList.size, MESSAGES_DISPLAY) - 1) { g.color = fontCol g.drawString(messagesList[i], (messageWindowRadius + 4).toFloat(), (messageWindowRadius + GLYPH_HEIGHT * i).toFloat()) } - blendNormal()*/ - - // scroll-like, kinda Microsoft-y blendNormal() - g.color = Color(0f, 0f, 0f, 0.7f) - g.fillRect(0f, 0f, width.toFloat(), height.toFloat()) - g.color = Color(1f, 1f, 1f, 0.5f) - g.fillRect(0f, 0f, 2f, height.toFloat()) - g.fillRect(width - 2f, 0f, 2f, height.toFloat()) - for (i in 0..Math.min(messagesList.size, MESSAGES_DISPLAY) - 1) { - g.color = fontCol - g.drawString(messagesList[i], (messageWindowRadius + 4).toFloat(), (messageWindowRadius + GLYPH_HEIGHT * i).toFloat()) - } } override fun processInput(gc: GameContainer, delta: Int, input: Input) {