mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
font upd
Former-commit-id: bf42a690c7cd199d4f2ec00855213b83aecb144b Former-commit-id: b992aac69b93c5d1632e96c4985cf61a6419b6a8
This commit is contained in:
@@ -76,6 +76,9 @@ Note: Right-to-left languages (arabic, hebrew, etc.) are not supported.
|
|||||||
4. Export the image as TGA
|
4. Export the image as TGA
|
||||||
5. Include the converted PNG to the project
|
5. Include the converted PNG to the project
|
||||||
|
|
||||||
|
### Game font ###
|
||||||
|
|
||||||
|
The font for the game is managed on [this GitHub repository](https://github.com/minjaesong/Terrarum-sans-bitmap). Make your contribution there and file a pull request on this project.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
src/com/sudoplay/joise/generator.tar
Normal file
BIN
src/com/sudoplay/joise/generator.tar
Normal file
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.imagefont
|
package net.torvald.imagefont
|
||||||
|
|
||||||
|
import net.torvald.terrarum.Terrarum
|
||||||
import org.newdawn.slick.*
|
import org.newdawn.slick.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +30,11 @@ class GameFontImpl : GameFontBase() {
|
|||||||
, W_UNIHAN, H_UNIHAN
|
, W_UNIHAN, H_UNIHAN
|
||||||
);*/
|
);*/
|
||||||
GameFontBase.cyrilic = SpriteSheet(
|
GameFontBase.cyrilic = SpriteSheet(
|
||||||
"./assets/graphics/fonts/cyrilic_variable.tga", 15, 19, 1)
|
when (Terrarum.gameLocale.substring(0..1)) {
|
||||||
|
"bg" -> "./assets/graphics/fonts/cyrilic_bulgarian_variable.tga"
|
||||||
|
"sr" -> "./assets/graphics/fonts/cyrilic_serbian_variable.tga"
|
||||||
|
else -> "./assets/graphics/fonts/cyrilic_variable.tga"
|
||||||
|
}, 15, 19, 1)
|
||||||
GameFontBase.fullwidthForms = SpriteSheet(
|
GameFontBase.fullwidthForms = SpriteSheet(
|
||||||
"./assets/graphics/fonts/fullwidth_forms.tga", GameFontBase.W_UNIHAN, GameFontBase.H_UNIHAN)
|
"./assets/graphics/fonts/fullwidth_forms.tga", GameFontBase.W_UNIHAN, GameFontBase.H_UNIHAN)
|
||||||
GameFontBase.uniPunct = SpriteSheet(
|
GameFontBase.uniPunct = SpriteSheet(
|
||||||
@@ -77,4 +82,13 @@ class GameFontImpl : GameFontBase() {
|
|||||||
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
||||||
buildWidthTable(greekSheet, 0x370, 0..0x5F)
|
buildWidthTable(greekSheet, 0x370, 0..0x5F)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun reload() {
|
||||||
|
GameFontBase.cyrilic = SpriteSheet(
|
||||||
|
when (Terrarum.gameLocale.substring(0..1)) {
|
||||||
|
"bg" -> "./assets/graphics/fonts/cyrilic_bulgarian_variable.tga"
|
||||||
|
"sr" -> "./assets/graphics/fonts/cyrilic_serbian_variable.tga"
|
||||||
|
else -> "./assets/graphics/fonts/cyrilic_variable.tga"
|
||||||
|
}, 15, 19, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ nopqrstuvwxyz
|
|||||||
override fun init(gc: GameContainer, game: StateBasedGame) {
|
override fun init(gc: GameContainer, game: StateBasedGame) {
|
||||||
canvas = Graphics(1024, 1024)
|
canvas = Graphics(1024, 1024)
|
||||||
|
|
||||||
Terrarum.gameLocale = "fiFI"
|
|
||||||
|
|
||||||
/*segfont = SpriteSheetFont(
|
/*segfont = SpriteSheetFont(
|
||||||
SpriteSheet("./assets/graphics/fonts/24-seg_red.tga", 22, 31),
|
SpriteSheet("./assets/graphics/fonts/24-seg_red.tga", 22, 31),
|
||||||
' '
|
' '
|
||||||
@@ -121,6 +119,15 @@ nopqrstuvwxyz
|
|||||||
g.drawString(s, 10f, 70f + 20 * i)
|
g.drawString(s, 10f, 70f + 20 * i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*val text = arrayOf(
|
||||||
|
"ru: Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства",
|
||||||
|
"bg: Под южно дърво, цъфтящо в синьо, бягаше малко пухкаво зайче",
|
||||||
|
"sr: Ајшо, лепото и чежњо, за љубав срца мога дођи у Хаџиће на кафу"
|
||||||
|
)
|
||||||
|
|
||||||
|
(0..2).forEach {
|
||||||
|
g.drawString(text[it], 10f, 70f + 20 * it)
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,17 +67,6 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
|||||||
val readFromDisk = readConfigJson()
|
val readFromDisk = readConfigJson()
|
||||||
if (!readFromDisk) readConfigJson()
|
if (!readFromDisk) readConfigJson()
|
||||||
|
|
||||||
// get locale from config
|
|
||||||
val gameLocaleFromConfig = gameConfig.getAsString("language") ?: sysLang
|
|
||||||
|
|
||||||
// if bad game locale were set, use system locale
|
|
||||||
if (gameLocaleFromConfig.length < 2)
|
|
||||||
gameLocale = sysLang
|
|
||||||
else
|
|
||||||
gameLocale = gameLocaleFromConfig
|
|
||||||
|
|
||||||
println("[Terrarum] Locale: " + gameLocale)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Controllers.getController(0)
|
Controllers.getController(0)
|
||||||
environment = if (getConfigString("pcgamepadenv") == "console")
|
environment = if (getConfigString("pcgamepadenv") == "console")
|
||||||
@@ -94,9 +83,24 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
|||||||
override fun initStatesList(gc: GameContainer) {
|
override fun initStatesList(gc: GameContainer) {
|
||||||
gc.input.enableKeyRepeat()
|
gc.input.enableKeyRepeat()
|
||||||
|
|
||||||
|
|
||||||
|
// get locale from config
|
||||||
|
val gameLocaleFromConfig = gameConfig.getAsString("language") ?: sysLang
|
||||||
|
|
||||||
|
// if bad game locale were set, use system locale
|
||||||
|
if (gameLocaleFromConfig.length < 2)
|
||||||
|
gameLocale = sysLang
|
||||||
|
else
|
||||||
|
gameLocale = gameLocaleFromConfig
|
||||||
|
|
||||||
|
println("[Terrarum] Locale: " + gameLocale)
|
||||||
|
|
||||||
|
|
||||||
fontGame = GameFontImpl()
|
fontGame = GameFontImpl()
|
||||||
fontSmallNumbers = TinyAlphNum()
|
fontSmallNumbers = TinyAlphNum()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// search for real controller
|
// search for real controller
|
||||||
// exclude controllers with name "Mouse", "keyboard"
|
// exclude controllers with name "Mouse", "keyboard"
|
||||||
val notControllerRegex = Regex("mouse|keyboard")
|
val notControllerRegex = Regex("mouse|keyboard")
|
||||||
@@ -212,9 +216,11 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
|||||||
field = value.substring(0..1)
|
field = value.substring(0..1)
|
||||||
else
|
else
|
||||||
field = value
|
field = value
|
||||||
|
|
||||||
|
if (fontGame != null) (fontGame as GameFontImpl).reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var fontGame: Font
|
var fontGame: Font? = null
|
||||||
private set
|
private set
|
||||||
lateinit var fontSmallNumbers: Font
|
lateinit var fontSmallNumbers: Font
|
||||||
private set
|
private set
|
||||||
@@ -282,6 +288,9 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
|||||||
const val NAME = "Terrarum"
|
const val NAME = "Terrarum"
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
System.setProperty("java.library.path", "lib")
|
||||||
|
System.setProperty("org.lwjgl.librarypath", File("lib").absolutePath)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
appgc = AppGameContainer(Terrarum(NAME))
|
appgc = AppGameContainer(Terrarum(NAME))
|
||||||
appgc.setDisplayMode(WIDTH, HEIGHT, false)
|
appgc.setDisplayMode(WIDTH, HEIGHT, false)
|
||||||
@@ -301,7 +310,7 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
|||||||
|
|
||||||
appgc.start()
|
appgc.start()
|
||||||
}
|
}
|
||||||
catch (ex: SlickException) {
|
catch (ex: Exception) {
|
||||||
val logger = Logger.getLogger(Terrarum::class.java.name)
|
val logger = Logger.getLogger(Terrarum::class.java.name)
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss")
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss")
|
||||||
val calendar = Calendar.getInstance()
|
val calendar = Calendar.getInstance()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.newdawn.slick.Input
|
|||||||
class UIQuickBar : UICanvas, MouseControlled {
|
class UIQuickBar : UICanvas, MouseControlled {
|
||||||
private val gutter = 8
|
private val gutter = 8
|
||||||
override var width: Int = (ItemSlotImageBuilder.slotImageSize + gutter) * SLOT_COUNT
|
override var width: Int = (ItemSlotImageBuilder.slotImageSize + gutter) * SLOT_COUNT
|
||||||
override var height: Int = ItemSlotImageBuilder.slotImageSize + 4 + Terrarum.fontGame.lineHeight
|
override var height: Int = ItemSlotImageBuilder.slotImageSize + 4 + Terrarum.fontGame!!.lineHeight
|
||||||
/**
|
/**
|
||||||
* In milliseconds
|
* In milliseconds
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user