mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +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) {
|
||||
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(
|
||||
|
||||
@@ -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<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")
|
||||
}
|
||||
private val pool: Array<Thread?> = 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
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user