mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
sprite updates
Former-commit-id: a52e024a231e54e7e837b7c717606f4f0d187758 Former-commit-id: fcdb5a9e12802c9671bea24481c94a8876dfd418
This commit is contained in:
1
assets/graphics/gui/.gitattributes
vendored
Normal file
1
assets/graphics/gui/.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.{psd,tga,ogg} filter=lfs diff=lfs merge=lfs -text
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
@@ -536,7 +536,7 @@ constructor() : BasicGameState() {
|
|||||||
if (false) { // don't multithread this for now, it's SLOWER //if (Terrarum.MULTITHREAD) {
|
if (false) { // don't multithread this for now, it's SLOWER //if (Terrarum.MULTITHREAD) {
|
||||||
val actors = actorContainer.size.toFloat()
|
val actors = actorContainer.size.toFloat()
|
||||||
// set up indices
|
// set up indices
|
||||||
for (i in 0..ThreadParallel.POOL_SIZE - 1) {
|
for (i in 0..Terrarum.THREADS - 1) {
|
||||||
ThreadParallel.map(
|
ThreadParallel.map(
|
||||||
i,
|
i,
|
||||||
ThreadActorUpdate(
|
ThreadActorUpdate(
|
||||||
|
|||||||
@@ -1,28 +1,12 @@
|
|||||||
package net.torvald.terrarum.concurrent
|
package net.torvald.terrarum.concurrent
|
||||||
|
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 16-05-25.
|
* Created by minjaesong on 16-05-25.
|
||||||
*/
|
*/
|
||||||
object ThreadParallel {
|
object ThreadParallel {
|
||||||
val POOL_SIZE = Terrarum.THREADS + 1
|
private val pool: Array<Thread?> = Array(Terrarum.THREADS, { null })
|
||||||
|
|
||||||
private val pool: Array<Thread?> = 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<Runnable>) {
|
|
||||||
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")
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map Runnable object to certain index of the thread pool.
|
* Map Runnable object to certain index of the thread pool.
|
||||||
@@ -34,18 +18,18 @@ object ThreadParallel {
|
|||||||
pool[index] = Thread(runnable, "$prefix-$index")
|
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.
|
* Start all thread in the pool. If the thread in the pool is NULL, it will simply ignored.
|
||||||
*/
|
*/
|
||||||
fun startAll() {
|
fun startAll() {
|
||||||
pool.forEach { it?.start() }
|
pool.forEach { it?.start() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primitive locking
|
||||||
|
*/
|
||||||
|
fun allFinished(): Boolean {
|
||||||
|
pool.forEach { if (it?.state != Thread.State.TERMINATED) return false }
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -31,14 +31,14 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
if (!isBlackVariant) {
|
if (!isBlackVariant) {
|
||||||
segmentLeft = Image("./assets/graphics/gui/message_twoline_white_left.png");
|
segmentLeft = Image("./assets/graphics/gui/message_twoline_white_left.tga")
|
||||||
segmentRight = Image("./assets/graphics/gui/message_twoline_white_right.png");
|
segmentRight = Image("./assets/graphics/gui/message_twoline_white_right.tga")
|
||||||
segmentBody = Image("./assets/graphics/gui/message_twoline_white_body.png");
|
segmentBody = Image("./assets/graphics/gui/message_twoline_white_body.tga")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
segmentLeft = Image("./assets/graphics/gui/message_twoline_black_left.png")
|
segmentLeft = Image("./assets/graphics/gui/message_black_left.tga")
|
||||||
segmentRight = Image("./assets/graphics/gui/message_twoline_black_right.png")
|
segmentRight = Image("./assets/graphics/gui/message_black_right.tga")
|
||||||
segmentBody = Image("./assets/graphics/gui/message_twoline_black_body.png")
|
segmentBody = Image("./assets/graphics/gui/message_black_body.tga")
|
||||||
}
|
}
|
||||||
uiFont = GameFontWhite()
|
uiFont = GameFontWhite()
|
||||||
height = segmentLeft!!.height
|
height = segmentLeft!!.height
|
||||||
@@ -55,34 +55,17 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(gc: GameContainer, g: Graphics) {
|
override fun render(gc: GameContainer, g: Graphics) {
|
||||||
// using the texture
|
blendNormal()
|
||||||
/*blendDisable()
|
|
||||||
|
|
||||||
drawSegments(g)
|
|
||||||
g.setDrawMode(Graphics.MODE_ALPHA_MAP)
|
|
||||||
drawSegments(g)
|
drawSegments(g)
|
||||||
|
|
||||||
g.font = uiFont
|
g.font = uiFont
|
||||||
|
|
||||||
g.setDrawMode(Graphics.MODE_NORMAL)
|
|
||||||
for (i in 0..Math.min(messagesList.size, MESSAGES_DISPLAY) - 1) {
|
for (i in 0..Math.min(messagesList.size, MESSAGES_DISPLAY) - 1) {
|
||||||
g.color = fontCol
|
g.color = fontCol
|
||||||
g.drawString(messagesList[i], (messageWindowRadius + 4).toFloat(), (messageWindowRadius + GLYPH_HEIGHT * i).toFloat())
|
g.drawString(messagesList[i], (messageWindowRadius + 4).toFloat(), (messageWindowRadius + GLYPH_HEIGHT * i).toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
blendNormal()*/
|
|
||||||
|
|
||||||
// scroll-like, kinda Microsoft-y
|
|
||||||
blendNormal()
|
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) {
|
override fun processInput(gc: GameContainer, delta: Int, input: Input) {
|
||||||
|
|||||||
Reference in New Issue
Block a user