mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 20:01:52 +09:00
bringing the shadow back
This commit is contained in:
63
.idea/workspace.xml
generated
63
.idea/workspace.xml
generated
@@ -7,11 +7,8 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="22c5bc80-996c-4846-b173-7dc8c2096fe3" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/demotext.txt" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/demotext.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/insular_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/insular_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/kana.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/kana.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
@@ -32,8 +29,8 @@
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="521">
|
||||
<caret line="897" lean-forward="true" selection-start-line="897" selection-end-line="897" />
|
||||
<state relative-caret-position="287">
|
||||
<caret line="852" lean-forward="true" selection-start-line="852" selection-end-line="852" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -78,11 +75,11 @@
|
||||
</split-first>
|
||||
<split-second>
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="FontTestGDX.kt" pinned="false" current-in-tab="false">
|
||||
<file leaf-file-name="FontTestGDX.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret line="8" column="54" lean-forward="true" selection-start-line="8" selection-start-column="54" selection-end-line="8" selection-end-column="54" />
|
||||
<state relative-caret-position="469">
|
||||
<caret line="173" column="26" lean-forward="true" selection-start-line="173" selection-start-column="26" selection-end-line="173" selection-end-column="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -90,8 +87,8 @@
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="jar://$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar!/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="273">
|
||||
<caret line="437" column="21" lean-forward="true" selection-start-line="437" selection-start-column="21" selection-end-line="437" selection-end-column="21" />
|
||||
<state relative-caret-position="390">
|
||||
<caret line="446" column="21" lean-forward="true" selection-start-line="446" selection-start-column="21" selection-end-line="446" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -105,11 +102,11 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="534">
|
||||
<caret line="1027" column="49" selection-start-line="1027" selection-start-column="49" selection-end-line="1027" selection-end-column="49" />
|
||||
<state relative-caret-position="576">
|
||||
<caret line="583" column="21" lean-forward="true" selection-start-line="583" selection-start-column="21" selection-end-line="583" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -193,9 +190,9 @@
|
||||
<option value="$PROJECT_DIR$/CONTRIBUTING.md" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt" />
|
||||
<option value="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" />
|
||||
<option value="$PROJECT_DIR$/FontTestGDX/demotext.txt" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -844,13 +841,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="260">
|
||||
<caret line="20" column="18" lean-forward="true" selection-start-line="20" selection-start-column="18" selection-end-line="20" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://C:/Program Files/Java/jdk1.8.0_131/src.zip!/java/lang/Character.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="515">
|
||||
@@ -893,15 +883,8 @@
|
||||
</entry>
|
||||
<entry file="jar://$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar!/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="273">
|
||||
<caret line="437" column="21" lean-forward="true" selection-start-line="437" selection-start-column="21" selection-end-line="437" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret line="8" column="54" lean-forward="true" selection-start-line="8" selection-start-column="54" selection-end-line="8" selection-end-column="54" />
|
||||
<state relative-caret-position="390">
|
||||
<caret line="446" column="21" lean-forward="true" selection-start-line="446" selection-start-column="21" selection-end-line="446" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -912,10 +895,24 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="260">
|
||||
<caret line="20" column="18" lean-forward="true" selection-start-line="20" selection-start-column="18" selection-end-line="20" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="521">
|
||||
<caret line="897" lean-forward="true" selection-start-line="897" selection-end-line="897" />
|
||||
<state relative-caret-position="576">
|
||||
<caret line="583" column="21" lean-forward="true" selection-start-line="583" selection-start-column="21" selection-end-line="583" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="469">
|
||||
<caret line="173" column="26" lean-forward="true" selection-start-line="173" selection-start-column="26" selection-end-line="173" selection-end-column="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
||||
Binary file not shown.
@@ -5,7 +5,10 @@ import com.badlogic.gdx.backends.lwjgl.LwjglApplication
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
|
||||
|
||||
/**
|
||||
@@ -19,6 +22,8 @@ class FontTestGDX : Game() {
|
||||
|
||||
lateinit var batch: SpriteBatch
|
||||
|
||||
lateinit var frameBuffer: FrameBuffer
|
||||
|
||||
override fun create() {
|
||||
font = GameFontBase("./assets", flipY = false, errorOnUnknownChar = true) // must test for two flipY cases
|
||||
|
||||
@@ -135,6 +140,7 @@ class FontTestGDX : Game() {
|
||||
println(font.toColorCode(0xF_F55))
|
||||
println(font.toColorCode(0xE_CCC))
|
||||
|
||||
frameBuffer = FrameBuffer(Pixmap.Format.RGBA8888, appConfig.width, appConfig.height, true)
|
||||
}
|
||||
|
||||
override fun getScreen(): Screen? {
|
||||
@@ -144,22 +150,39 @@ class FontTestGDX : Game() {
|
||||
override fun setScreen(screen: Screen?) {
|
||||
}
|
||||
|
||||
var tex: Texture? = null
|
||||
|
||||
override fun render() {
|
||||
|
||||
Gdx.gl.glClearColor(.141f, .141f, .141f, 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)
|
||||
if (tex == null) {
|
||||
frameBuffer.begin()
|
||||
|
||||
Gdx.gl.glClearColor(.141f, .141f, .141f, 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()
|
||||
|
||||
batch.color = Color(0xeeeeeeff.toInt())
|
||||
inputText.forEachIndexed { index, s ->
|
||||
font.draw(batch, s, 10f, appConfig.height - 30f - index * font.lineHeight)
|
||||
}
|
||||
|
||||
batch.end()
|
||||
|
||||
frameBuffer.end()
|
||||
|
||||
///////////////
|
||||
|
||||
tex = frameBuffer.colorBufferTexture
|
||||
}
|
||||
|
||||
|
||||
batch.begin()
|
||||
|
||||
batch.color = Color(0xeeeeeeff.toInt())
|
||||
inputText.forEachIndexed { index, s ->
|
||||
font.draw(batch, s, 10f, appConfig.height - 30f - index * font.lineHeight)
|
||||
}
|
||||
|
||||
batch.color = Color.WHITE
|
||||
batch.draw(tex, 0f, appConfig.height.toFloat(), appConfig.width.toFloat(), -appConfig.height.toFloat())
|
||||
batch.end()
|
||||
}
|
||||
|
||||
@@ -183,7 +206,7 @@ fun main(args: Array<String>) {
|
||||
appConfig = LwjglApplicationConfiguration()
|
||||
appConfig.vSyncEnabled = false
|
||||
appConfig.resizable = false//true;
|
||||
appConfig.width = 960
|
||||
appConfig.width = 874
|
||||
appConfig.height = 2048
|
||||
appConfig.title = "Terrarum Sans Bitmap Test (GDX)"
|
||||
|
||||
|
||||
@@ -544,16 +544,16 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
batch.color = shadowCol
|
||||
|
||||
batch.draw(hangulSheet.get(indexCho, choRow ), x + posXbuffer[index] + 1, y)
|
||||
batch.draw(hangulSheet.get(indexCho, choRow ), x + posXbuffer[index] , y + if (flipY) 1 else -1)
|
||||
batch.draw(hangulSheet.get(indexCho, choRow ), x + posXbuffer[index] + 1, y + if (flipY) 1 else -1)
|
||||
batch.draw(hangulSheet.get(indexCho, choRow ), x + posXbuffer[index] , y + 1.flipY())
|
||||
batch.draw(hangulSheet.get(indexCho, choRow ), x + posXbuffer[index] + 1, y + 1.flipY())
|
||||
|
||||
batch.draw(hangulSheet.get(indexJung, jungRow), x + posXbuffer[index] + 1, y)
|
||||
batch.draw(hangulSheet.get(indexJung, jungRow), x + posXbuffer[index] , y + if (flipY) 1 else -1)
|
||||
batch.draw(hangulSheet.get(indexJung, jungRow), x + posXbuffer[index] + 1, y + if (flipY) 1 else -1)
|
||||
batch.draw(hangulSheet.get(indexJung, jungRow), x + posXbuffer[index] , y + 1.flipY())
|
||||
batch.draw(hangulSheet.get(indexJung, jungRow), x + posXbuffer[index] + 1, y + 1.flipY())
|
||||
|
||||
batch.draw(hangulSheet.get(indexJong, jongRow), x + posXbuffer[index] + 1, y)
|
||||
batch.draw(hangulSheet.get(indexJong, jongRow), x + posXbuffer[index] , y + if (flipY) 1 else -1)
|
||||
batch.draw(hangulSheet.get(indexJong, jongRow), x + posXbuffer[index] + 1, y + if (flipY) 1 else -1)
|
||||
batch.draw(hangulSheet.get(indexJong, jongRow), x + posXbuffer[index] , y + 1.flipY())
|
||||
batch.draw(hangulSheet.get(indexJong, jongRow), x + posXbuffer[index] + 1, y + 1.flipY())
|
||||
}
|
||||
|
||||
|
||||
@@ -564,61 +564,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
}
|
||||
else {
|
||||
try {
|
||||
/*val offset = if (!isDiacritics(c)) 0 else {
|
||||
if (index > 0) // LIMITATION: does not support double (or more) diacritics properly
|
||||
(glyphWidthBuffer[index] - glyphWidthBuffer[index - 1]) / 2
|
||||
else
|
||||
glyphWidthBuffer[index]
|
||||
}
|
||||
|
||||
if (!noShadow) {
|
||||
batch.color = shadowCol
|
||||
batch.draw(
|
||||
sheets[sheetID].get(sheetX, sheetY),
|
||||
x + posXbuffer[index] + 1 + offset,
|
||||
y + (if (sheetID == SHEET_UNIHAN) // evil exceptions
|
||||
offsetUnihan.flipY()
|
||||
else if (sheetID == SHEET_CUSTOM_SYM)
|
||||
offsetCustomSym
|
||||
else
|
||||
0) * if (flipY) 1 else -1
|
||||
)
|
||||
batch.draw(
|
||||
sheets[sheetID].get(sheetX, sheetY),
|
||||
x + posXbuffer[index] + offset,
|
||||
y + (if (sheetID == SHEET_UNIHAN) // evil exceptions
|
||||
offsetUnihan.flipY() + 1
|
||||
else if (sheetID == SHEET_CUSTOM_SYM)
|
||||
offsetCustomSym + 1
|
||||
else
|
||||
1) * if (flipY) 1 else -1
|
||||
)
|
||||
batch.draw(
|
||||
sheets[sheetID].get(sheetX, sheetY),
|
||||
x + posXbuffer[index] + 1 + offset,
|
||||
y + (if (sheetID == SHEET_UNIHAN) // evil exceptions
|
||||
offsetUnihan.flipY() + 1
|
||||
else if (sheetID == SHEET_CUSTOM_SYM)
|
||||
offsetCustomSym + 1
|
||||
else
|
||||
1).flipY()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
batch.color = mainCol
|
||||
batch.draw(
|
||||
sheets[sheetID].get(sheetX, sheetY),
|
||||
x + posXbuffer[index] + offset,
|
||||
y +
|
||||
if (sheetID == SHEET_UNIHAN) // evil exceptions
|
||||
offsetUnihan
|
||||
else if (sheetID == SHEET_CUSTOM_SYM)
|
||||
offsetCustomSym
|
||||
else 0
|
||||
)*/
|
||||
|
||||
batch.color = mainCol
|
||||
val posY = y + posYbuffer[index].flipY() +
|
||||
if (sheetID == SHEET_UNIHAN) // evil exceptions
|
||||
offsetUnihan
|
||||
@@ -629,6 +575,15 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
val posX = x + posXbuffer[index]
|
||||
val texture = sheets[sheetID].get(sheetX, sheetY)
|
||||
|
||||
|
||||
if (!noShadow) {
|
||||
batch.color = shadowCol
|
||||
batch.draw(texture, posX + 1, posY + 1.flipY())
|
||||
batch.draw(texture, posX , posY + 1.flipY())
|
||||
batch.draw(texture, posX + 1, posY)
|
||||
}
|
||||
|
||||
batch.color = mainCol
|
||||
batch.draw(texture, posX, posY)
|
||||
}
|
||||
catch (noSuchGlyph: ArrayIndexOutOfBoundsException) {
|
||||
|
||||
Reference in New Issue
Block a user