fixed bad offset but still bad render

This commit is contained in:
Minjae Song
2018-09-17 17:02:09 +09:00
parent 920b11e3e9
commit 8da321bdc2
4 changed files with 28 additions and 6 deletions

BIN
demo.PNG

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -507,9 +507,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
sheetsPack.add(texRegPack)
//pixmap.dispose() // you are terminated
pixmap.dispose() // you are terminated
}
sheets = sheetsPack.toTypedArray()
@@ -550,7 +548,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private var pixmapTextureHolder: Texture? = null
private var pixmapHolder: Pixmap? = null
private val pixmapOffsetY = -10
private val pixmapOffsetY = 10
override fun draw(batch: Batch, charSeq: CharSequence, x: Float, y: Float): GlyphLayout? {
val oldProjectionMatrix = batch.projectionMatrix
@@ -622,7 +620,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
pixmapHolder?.dispose() /* you can do this one */
//pixmapTextureHolder?.dispose() /* you CAN'T do this however */
pixmapHolder = Pixmap(getWidth(textBuffer), H + -(pixmapOffsetY * 2), Pixmap.Format.RGBA8888)
pixmapHolder = Pixmap(getWidth(textBuffer), H + (pixmapOffsetY * 2), Pixmap.Format.RGBA8888)
var index = 0
while (index <= textBuffer.lastIndex) {
@@ -712,7 +710,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
batch.color = mainCol
makeShadow(pixmapHolder)
pixmapTextureHolder = Texture(pixmapHolder)
batch.draw(pixmapTextureHolder, x.toFloat(), y.toFloat())
batch.draw(pixmapTextureHolder, x.toFloat(), (y - pixmapOffsetY).toFloat())
/*textTexture.end()

View File

@@ -1,3 +1,27 @@
/*
* Terrarum Sans Bitmap
*
* Copyright (c) 2018 Minjae Song (Torvald)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.torvald.terrarumsansbitmap.gdx
import com.badlogic.gdx.files.FileHandle