mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 11:51:50 +09:00
working demo; fixed chinese shading bug
operation not guaranteed on Slick2d
This commit is contained in:
Binary file not shown.
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Screen
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
|
||||
|
||||
/**
|
||||
@@ -13,8 +14,19 @@ class FontTestGDX : Game() {
|
||||
|
||||
lateinit var font: GameFontBase
|
||||
|
||||
lateinit var inputText: List<String>
|
||||
|
||||
lateinit var batch: SpriteBatch
|
||||
|
||||
override fun create() {
|
||||
font = GameFontBase("./assets")
|
||||
font = GameFontBase("./assets", flipY = false) // must test for two cases
|
||||
|
||||
val inTextFile = Gdx.files.internal("./FontTestGDX/demotext.txt")
|
||||
val reader = inTextFile.reader()
|
||||
inputText = reader.readLines()
|
||||
reader.close()
|
||||
|
||||
batch = SpriteBatch()
|
||||
}
|
||||
|
||||
override fun getScreen(): Screen? {
|
||||
@@ -26,12 +38,20 @@ class FontTestGDX : Game() {
|
||||
|
||||
override fun render() {
|
||||
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 1f)
|
||||
Gdx.gl.glClearColor(1f - 0xBA/255f, 1f - 0xDA/255f, 1f - 0x55/255f, 1f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
|
||||
Gdx.gl.glEnable(GL20.GL_BLEND)
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
|
||||
batch.begin()
|
||||
|
||||
inputText.reversed().forEachIndexed { index, s ->
|
||||
font.draw(batch, s, 10f, 10f + index * font.lineHeight)
|
||||
}
|
||||
|
||||
batch.end()
|
||||
}
|
||||
|
||||
override fun pause() {
|
||||
@@ -52,8 +72,8 @@ fun main(args: Array<String>) {
|
||||
val appConfig = LwjglApplicationConfiguration()
|
||||
appConfig.vSyncEnabled = false
|
||||
appConfig.resizable = false//true;
|
||||
appConfig.width = 740 // photographic ratio (1.5:1)
|
||||
appConfig.height = 1110 // photographic ratio (1.5:1)
|
||||
appConfig.width = 1024 // photographic ratio (1.5:1)
|
||||
appConfig.height = 1024 // photographic ratio (1.5:1)
|
||||
appConfig.title = "Terrarum Sans Bitmap Test (GDX)"
|
||||
|
||||
LwjglApplication(FontTestGDX(), appConfig)
|
||||
|
||||
Reference in New Issue
Block a user