mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 20:01:52 +09:00
demo app
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
demo/out/*
|
||||
demo/lib/*
|
||||
@@ -1,9 +1,9 @@
|
||||
package net.torvald.imagefont
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.getPixel
|
||||
import org.lwjgl.opengl.GL11
|
||||
import org.newdawn.slick.*
|
||||
import org.newdawn.slick.opengl.Texture
|
||||
import java.nio.ByteOrder
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -418,17 +418,38 @@ open class GameFontBase : Font {
|
||||
drawString(x + xoff, y, printedBody, color)
|
||||
}
|
||||
|
||||
private fun setBlendModeMul() {
|
||||
GL11.glEnable(GL11.GL_BLEND)
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA)
|
||||
}
|
||||
|
||||
private fun setBlendModeNormal() {
|
||||
GL11.glDisable(GL11.GL_BLEND)
|
||||
Terrarum.appgc.graphics.setDrawMode(Graphics.MODE_NORMAL)
|
||||
}
|
||||
|
||||
fun buildWidthTable(sheet: SpriteSheet, codeOffset: Int, codeRange: IntRange, rows: Int = 16) {
|
||||
fun Byte.toUint() = java.lang.Byte.toUnsignedInt(this)
|
||||
|
||||
/** @return Intarray(R, G, B, A) */
|
||||
fun Texture.getPixel(x: Int, y: Int): IntArray {
|
||||
val textureWidth = this.textureWidth
|
||||
val hasAlpha = this.hasAlpha()
|
||||
|
||||
val offset = (if (hasAlpha) 4 else 3) * (textureWidth * y + x) // 4: # of channels (RGBA)
|
||||
|
||||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||
return intArrayOf(
|
||||
this.textureData[offset].toUint(),
|
||||
this.textureData[offset + 1].toUint(),
|
||||
this.textureData[offset + 2].toUint(),
|
||||
if (hasAlpha)
|
||||
this.textureData[offset + 3].toUint()
|
||||
else 255
|
||||
)
|
||||
}
|
||||
else {
|
||||
return intArrayOf(
|
||||
this.textureData[offset + 2].toUint(),
|
||||
this.textureData[offset + 1].toUint(),
|
||||
this.textureData[offset].toUint(),
|
||||
if (hasAlpha)
|
||||
this.textureData[offset + 3].toUint()
|
||||
else 255
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val binaryCodeOffset = 15
|
||||
|
||||
val cellW = sheet.getSubImage(0, 0).width + 1 // should be 16
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.imagefont
|
||||
|
||||
import net.torvald.terrarum.imagefont.GameFontDemo
|
||||
import org.newdawn.slick.*
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,11 @@ class GameFontImpl : GameFontBase() {
|
||||
, W_UNIHAN, H_UNIHAN
|
||||
);*/
|
||||
GameFontBase.cyrilic = SpriteSheet(
|
||||
"./assets/graphics/fonts/cyrilic_variable.tga", 15, 19, 1)
|
||||
when (GameFontDemo.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(
|
||||
"./assets/graphics/fonts/fullwidth_forms.tga", GameFontBase.W_UNIHAN, GameFontBase.H_UNIHAN)
|
||||
GameFontBase.uniPunct = SpriteSheet(
|
||||
@@ -57,7 +62,7 @@ class GameFontImpl : GameFontBase() {
|
||||
GameFontBase.wenQuanYi_2,
|
||||
GameFontBase.greekSheet,
|
||||
GameFontBase.romanianSheet,
|
||||
GameFontBase.romanianSheetNarrow,
|
||||
GameFontBase.romanianSheetNarrow
|
||||
)
|
||||
GameFontBase.sheetKey = shk
|
||||
|
||||
|
||||
1
demo/.idea/.name
generated
Normal file
1
demo/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
TerrarumSansDemo
|
||||
15
demo/.idea/artifacts/unnamed.xml
generated
Normal file
15
demo/.idea/artifacts/unnamed.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="unnamed">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/unnamed</output-path>
|
||||
<root id="archive" name="TerrarumSansDemo.jar">
|
||||
<element id="directory" name="META-INF">
|
||||
<element id="file-copy" path="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
|
||||
</element>
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../LICENSE.md" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/config.properties" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/text.txt" />
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/lib" />
|
||||
<element id="module-output" name="TerrarumSansDemo" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
17
demo/.idea/libraries/KotlinJavaRuntime.xml
generated
Normal file
17
demo/.idea/libraries/KotlinJavaRuntime.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime">
|
||||
<CLASSES>
|
||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime.jar!/" />
|
||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<NATIVE>
|
||||
<root url="file://$PROJECT_DIR$/lib" />
|
||||
</NATIVE>
|
||||
<SOURCES>
|
||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
6
demo/.idea/misc.xml
generated
Normal file
6
demo/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
demo/.idea/modules.xml
generated
Normal file
8
demo/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/TerrarumSansDemo.iml" filepath="$PROJECT_DIR$/TerrarumSansDemo.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
610
demo/.idea/workspace.xml
generated
Normal file
610
demo/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,610 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ArtifactsWorkspaceSettings">
|
||||
<artifacts-to-build>
|
||||
<artifact name="unnamed" />
|
||||
</artifacts-to-build>
|
||||
</component>
|
||||
<component name="BookmarkManager">
|
||||
<bookmark url="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt" line="46" mnemonic="9" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fcc8c48a-4440-438f-9e38-d42425b5efd4" name="Default" comment="" />
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="CreatePatchCommitExecutor">
|
||||
<option name="PATCH_PATH" value="" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="GameFontDemo.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="610">
|
||||
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="400">
|
||||
<caret line="516" column="36" lean-forward="false" selection-start-line="516" selection-start-column="36" selection-end-line="516" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="config.properties" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/config.properties">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="text.txt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/text.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="95" lean-forward="false" selection-start-line="0" selection-start-column="95" selection-end-line="0" selection-end-column="95" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GameFontImpl.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="190">
|
||||
<caret line="29" column="0" lean-forward="false" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Kotlin File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>"|</find>
|
||||
<find>,\n</find>
|
||||
<find>main</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>\n</replace>
|
||||
</replaceStrings>
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="modificationStamps">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$/../../terrarum_renewed" value="2962360935090" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="externalProjectsViewState">
|
||||
<projects_view />
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt" />
|
||||
<option value="$PROJECT_DIR$/text.properties" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/text.txt" />
|
||||
<option value="$PROJECT_DIR$/config.properties" />
|
||||
<option value="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="-8" />
|
||||
<option name="y" value="-8" />
|
||||
<option name="width" value="1936" />
|
||||
<option name="height" value="1176" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
<manualOrder />
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="TerrarumSansDemo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="demo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="TerrarumSansDemo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="demo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="imagefont" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="TerrarumSansDemo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="demo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="META-INF" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="settings.editor.selected.configurable" value="project.kotlinCompiler" />
|
||||
<property name="settings.editor.splitter.proportion" value="0.2" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/lib" />
|
||||
<property name="project.structure.last.edited" value="Artifacts" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.32068965" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Kotlin.net.torvald.terrarum.imagefont.GameFontDemoKt">
|
||||
<configuration default="false" name="net.torvald.terrarum.imagefont.GameFontDemoKt" type="JetRunConfigurationType" factoryName="Kotlin" temporary="true" nameIsGenerated="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.torvald.terrarum.imagefont.GameFontDemoKt" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="TerrarumSansDemo" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
|
||||
<module name="" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<predefined_log_file id="idea.log" enabled="true" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Applet" factoryName="Applet">
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||
<module />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list />
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JarApplication" factoryName="JAR Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Java Scratch" factoryName="Java Scratch">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="SCRATCH_FILE_ID" value="0" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="TerrarumSansDemo" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="filePath" />
|
||||
<option name="vmParameters" />
|
||||
<option name="alternativeJrePath" />
|
||||
<option name="programParameters" />
|
||||
<option name="passParentEnvs" value="true" />
|
||||
<option name="workingDirectory" />
|
||||
<option name="isAlternativeJrePathEnabled" value="false" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="SUITE_NAME" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="GROUP_NAME" />
|
||||
<option name="TEST_OBJECT" value="CLASS" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="ANNOTATION_TYPE" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||
<option name="PROPERTIES_FILE" />
|
||||
<envs />
|
||||
<properties />
|
||||
<listeners />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="executeSpecs" factoryName="Gauge Execution">
|
||||
<setting name="environment" value="" />
|
||||
<setting name="specsToExecute" value="" />
|
||||
<setting name="tags" value="" />
|
||||
<setting name="parallelNodes" value="" />
|
||||
<setting name="execInParallel" value="false" />
|
||||
<setting name="programParameters" value="" />
|
||||
<setting name="workingDirectory" value="" />
|
||||
<setting name="moduleName" value="" />
|
||||
<envMap />
|
||||
<setting name="rowsRange" value="" />
|
||||
<method />
|
||||
</configuration>
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="Kotlin.net.torvald.terrarum.imagefont.GameFontDemoKt" />
|
||||
</list>
|
||||
<recent_temporary>
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="Kotlin.net.torvald.terrarum.imagefont.GameFontDemoKt" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="fcc8c48a-4440-438f-9e38-d42425b5efd4" name="Default" comment="" />
|
||||
<created>1487243351068</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1487243351068</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917467" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette	" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960597" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17948718" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960597" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3054371" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26007676" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="9" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Code Iris" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.32960597" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.1544196" sideWeight="0.4651163" order="10" side_tool="false" content_ui="tabs" x="1380" y="-157" width="1720" height="857" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager />
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="antWorkspaceConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/text.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="95" lean-forward="false" selection-start-line="0" selection-start-column="95" selection-end-line="0" selection-end-column="95" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="190">
|
||||
<caret line="29" column="0" lean-forward="false" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/META-INF/MANIFEST.MF">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="28">
|
||||
<caret line="2" column="57" lean-forward="true" selection-start-line="2" selection-start-column="57" selection-end-line="2" selection-end-column="57" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="400">
|
||||
<caret line="516" column="36" lean-forward="false" selection-start-line="516" selection-start-column="36" selection-end-line="516" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/../../Ba-AA/src/net/torvald/aa/demoplayer/BaAA.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="273">
|
||||
<caret line="428" column="8" lean-forward="false" selection-start-line="428" selection-start-column="8" selection-end-line="429" selection-end-column="87" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/config.properties">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="610">
|
||||
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ArtifactsStructureConfigurable.UI">
|
||||
<settings>
|
||||
<artifact-editor>
|
||||
<show-content>
|
||||
<type id="artifact" />
|
||||
<type id="library" />
|
||||
</show-content>
|
||||
</artifact-editor>
|
||||
<last-edited>unnamed</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.32068965" />
|
||||
<option value="0.5" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="FacetStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>Kotlin</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.32068965" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="GlobalLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="JdkListConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ModuleStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>TerrarumSansDemo</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.32068965" />
|
||||
<option value="0.6" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>KotlinJavaRuntime</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.32068965" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
4
demo/META-INF/MANIFEST.MF
Normal file
4
demo/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: lib/lwjgl.jar lib/lwjgl_util.jar lib/slick.jar lib/kotlin-reflect.jar lib/kotlin-runtime.jar
|
||||
Main-Class: net.torvald.terrarum.imagefont.GameFontDemoKt
|
||||
|
||||
89
demo/TerrarumSansDemo.iml
Normal file
89
demo/TerrarumSansDemo.iml
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="1">
|
||||
<option name="compilerInfo">
|
||||
<KotlinCompilerInfo>
|
||||
<option name="compilerSettings">
|
||||
<CompilerSettings>
|
||||
<option name="additionalArguments" value="-version" />
|
||||
<option name="copyJsLibraryFiles" value="true" />
|
||||
<option name="outputDirectoryForJsLibraryFiles" value="lib" />
|
||||
</CompilerSettings>
|
||||
</option>
|
||||
<option name="k2jsCompilerArguments">
|
||||
<K2JSCompilerArguments>
|
||||
<option name="outputFile" />
|
||||
<option name="noStdlib" value="false" />
|
||||
<option name="libraryFiles" />
|
||||
<option name="sourceMap" value="false" />
|
||||
<option name="metaInfo" value="false" />
|
||||
<option name="kjsm" value="false" />
|
||||
<option name="target" />
|
||||
<option name="moduleKind" />
|
||||
<option name="main" />
|
||||
<option name="outputPrefix" />
|
||||
<option name="outputPostfix" />
|
||||
<option name="languageVersion" />
|
||||
<option name="apiVersion" />
|
||||
<option name="suppressWarnings" value="false" />
|
||||
<option name="verbose" value="false" />
|
||||
<option name="version" value="false" />
|
||||
<option name="help" value="false" />
|
||||
<option name="extraHelp" value="false" />
|
||||
<option name="noInline" value="false" />
|
||||
<option name="repeat" />
|
||||
<option name="pluginClasspaths" />
|
||||
<option name="pluginOptions" />
|
||||
<option name="freeArgs">
|
||||
<list />
|
||||
</option>
|
||||
<option name="unknownExtraFlags">
|
||||
<list />
|
||||
</option>
|
||||
</K2JSCompilerArguments>
|
||||
</option>
|
||||
<option name="_commonCompilerArguments">
|
||||
<DummyImpl>
|
||||
<option name="languageVersion" />
|
||||
<option name="apiVersion" />
|
||||
<option name="suppressWarnings" value="false" />
|
||||
<option name="verbose" value="false" />
|
||||
<option name="version" value="false" />
|
||||
<option name="help" value="false" />
|
||||
<option name="extraHelp" value="false" />
|
||||
<option name="noInline" value="false" />
|
||||
<option name="repeat" />
|
||||
<option name="pluginClasspaths" />
|
||||
<option name="pluginOptions" />
|
||||
<option name="freeArgs">
|
||||
<list />
|
||||
</option>
|
||||
<option name="unknownExtraFlags">
|
||||
<list />
|
||||
</option>
|
||||
</DummyImpl>
|
||||
</option>
|
||||
</KotlinCompilerInfo>
|
||||
</option>
|
||||
<option name="versionInfo">
|
||||
<KotlinVersionInfo>
|
||||
<option name="apiLevel" value="1.0" />
|
||||
<option name="languageLevel" value="1.0" />
|
||||
<option name="targetPlatformName" value="JVM 1.6" />
|
||||
</KotlinVersionInfo>
|
||||
</option>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
1
demo/config.properties
Normal file
1
demo/config.properties
Normal file
@@ -0,0 +1 @@
|
||||
locale=enUS
|
||||
552
demo/src/net/torvald/terrarum/imagefont/GameFontBase.kt
Normal file
552
demo/src/net/torvald/terrarum/imagefont/GameFontBase.kt
Normal file
@@ -0,0 +1,552 @@
|
||||
package net.torvald.imagefont
|
||||
|
||||
import org.lwjgl.opengl.GL11
|
||||
import org.newdawn.slick.*
|
||||
import org.newdawn.slick.opengl.Texture
|
||||
import java.nio.ByteOrder
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-27.
|
||||
*/
|
||||
open class GameFontBase : Font {
|
||||
|
||||
private fun getHan(hanIndex: Int): IntArray {
|
||||
val han_x = hanIndex % JONG_COUNT
|
||||
val han_y = hanIndex / JONG_COUNT
|
||||
val ret = intArrayOf(han_x, han_y)
|
||||
return ret
|
||||
}
|
||||
|
||||
private fun getHanChosung(hanIndex: Int) = hanIndex / (JUNG_COUNT * JONG_COUNT)
|
||||
|
||||
private fun getHanJungseong(hanIndex: Int) = hanIndex / JONG_COUNT % JUNG_COUNT
|
||||
|
||||
private fun getHanJongseong(hanIndex: Int) = hanIndex % JONG_COUNT
|
||||
|
||||
private val jungseongWide = arrayOf(8, 12, 13, 17, 18, 21)
|
||||
private val jungseongComplex = arrayOf(9, 10, 11, 14, 15, 16, 22)
|
||||
|
||||
private fun isJungseongWide(hanIndex: Int) = jungseongWide.contains(getHanJungseong(hanIndex))
|
||||
private fun isJungseongComplex(hanIndex: Int) = jungseongComplex.contains(getHanJungseong(hanIndex))
|
||||
|
||||
private fun getHanInitialRow(hanIndex: Int): Int {
|
||||
val ret: Int
|
||||
|
||||
if (isJungseongWide(hanIndex))
|
||||
ret = 2
|
||||
else if (isJungseongComplex(hanIndex))
|
||||
ret = 4
|
||||
else
|
||||
ret = 0
|
||||
|
||||
return if (getHanJongseong(hanIndex) == 0) ret else ret + 1
|
||||
}
|
||||
|
||||
private fun getHanMedialRow(hanIndex: Int) = if (getHanJongseong(hanIndex) == 0) 6 else 7
|
||||
|
||||
private fun getHanFinalRow(hanIndex: Int): Int {
|
||||
val jungseongIndex = getHanJungseong(hanIndex)
|
||||
|
||||
return if (jungseongWide.contains(jungseongIndex))
|
||||
8
|
||||
else
|
||||
9
|
||||
}
|
||||
|
||||
private fun isHangul(c: Char) = c.toInt() >= 0xAC00 && c.toInt() < 0xD7A4
|
||||
private fun isAscii(c: Char) = c.toInt() >= 0x20 && c.toInt() <= 0xFF
|
||||
private fun isExtA(c: Char) = c.toInt() >= 0x100 && c.toInt() < 0x180
|
||||
private fun isKana(c: Char) = c.toInt() >= 0x3040 && c.toInt() < 0x3100
|
||||
private fun isCJKPunct(c: Char) = c.toInt() >= 0x3000 && c.toInt() < 0x3040
|
||||
private fun isUniHan(c: Char) = c.toInt() >= 0x3400 && c.toInt() < 0xA000
|
||||
private fun isCyrilic(c: Char) = c.toInt() >= 0x400 && c.toInt() < 0x460
|
||||
private fun isFullwidthUni(c: Char) = c.toInt() >= 0xFF00 && c.toInt() < 0xFF20
|
||||
private fun isUniPunct(c: Char) = c.toInt() >= 0x2000 && c.toInt() < 0x2070
|
||||
private fun isWenQuanYi1(c: Char) = c.toInt() >= 0x33F3 && c.toInt() <= 0x69FC
|
||||
private fun isWenQuanYi2(c: Char) = c.toInt() >= 0x69FD && c.toInt() <= 0x9FDC
|
||||
private fun isGreek(c: Char) = c.toInt() >= 0x370 && c.toInt() <= 0x3CE
|
||||
private fun isRomanian(c: Char) = c.toInt() >= 0x218 && c.toInt() <= 0x21A
|
||||
private fun isRomanianNarrow(c: Char) = c.toInt() == 0x21B
|
||||
|
||||
|
||||
|
||||
private fun extAindexX(c: Char) = (c.toInt() - 0x100) % 16
|
||||
private fun extAindexY(c: Char) = (c.toInt() - 0x100) / 16
|
||||
|
||||
private fun kanaIndexX(c: Char) = (c.toInt() - 0x3040) % 16
|
||||
private fun kanaIndexY(c: Char) = (c.toInt() - 0x3040) / 16
|
||||
|
||||
private fun cjkPunctIndexX(c: Char) = (c.toInt() - 0x3000) % 16
|
||||
private fun cjkPunctIndexY(c: Char) = (c.toInt() - 0x3000) / 16
|
||||
|
||||
private fun uniHanIndexX(c: Char) = (c.toInt() - 0x3400) % 256
|
||||
private fun uniHanIndexY(c: Char) = (c.toInt() - 0x3400) / 256
|
||||
|
||||
private fun cyrilicIndexX(c: Char) = (c.toInt() - 0x400) % 16
|
||||
private fun cyrilicIndexY(c: Char) = (c.toInt() - 0x400) / 16
|
||||
|
||||
private fun fullwidthUniIndexX(c: Char) = (c.toInt() - 0xFF00) % 16
|
||||
private fun fullwidthUniIndexY(c: Char) = (c.toInt() - 0xFF00) / 16
|
||||
|
||||
private fun uniPunctIndexX(c: Char) = (c.toInt() - 0x2000) % 16
|
||||
private fun uniPunctIndexY(c: Char) = (c.toInt() - 0x2000) / 16
|
||||
|
||||
private fun wenQuanYiIndexX(c: Char) =
|
||||
(c.toInt() - if (c.toInt() <= 0x4DB5) 0x33F3 else 0x33F3 + 0x4A) % 32
|
||||
private fun wenQuanYi1IndexY(c: Char) = (c.toInt() - (0x33F3 + 0x4A)) / 32
|
||||
private fun wenQuanYi2IndexY(c: Char) = (c.toInt() - 0x69FD) / 32
|
||||
|
||||
private fun greekIndexX(c: Char) = (c.toInt() - 0x370) % 16
|
||||
private fun greekIndexY(c: Char) = (c.toInt() - 0x370) / 16
|
||||
|
||||
private fun romanianIndexX(c: Char) = c.toInt() - 0x218
|
||||
private fun romanianIndexY(c: Char) = 0
|
||||
|
||||
private fun thaiIndexX(c: Char) = (c.toInt() - 0xE00) % 16
|
||||
private fun thaiIndexY(c: Char) = (c.toInt() - 0xE00) / 16
|
||||
|
||||
private fun thaiNarrowIndexX(c: Char) = 3
|
||||
private fun thaiNarrowIndexY(c: Char) = 0
|
||||
|
||||
|
||||
private val narrowWidthSheets = arrayOf(
|
||||
SHEET_EXTB_ROMANIAN_NARROW
|
||||
)
|
||||
private val unihanWidthSheets = arrayOf(
|
||||
SHEET_UNIHAN,
|
||||
SHEET_FW_UNI,
|
||||
SHEET_WENQUANYI_1,
|
||||
SHEET_WENQUANYI_2
|
||||
)
|
||||
private val zeroWidthSheets = arrayOf(
|
||||
SHEET_COLOURCODE
|
||||
)
|
||||
private val variableWidthSheets = arrayOf(
|
||||
SHEET_ASCII_VARW,
|
||||
SHEET_CYRILIC_VARW,
|
||||
SHEET_EXTA_VARW,
|
||||
SHEET_GREEK_VARW
|
||||
)
|
||||
|
||||
|
||||
override fun getWidth(s: String) = getWidthSubstr(s, s.length)
|
||||
|
||||
private fun getWidthSubstr(s: String, endIndex: Int): Int {
|
||||
var len = 0
|
||||
for (i in 0..endIndex - 1) {
|
||||
val chr = s[i]
|
||||
val ctype = getSheetType(s[i])
|
||||
|
||||
if (chr.toInt() == 0x21B) // Romanian t; HAX!
|
||||
len += 6
|
||||
else if (variableWidthSheets.contains(ctype)) {
|
||||
try {
|
||||
len += asciiWidths[chr.toInt()]!!
|
||||
}
|
||||
catch (e: kotlin.KotlinNullPointerException) {
|
||||
println("KotlinNullPointerException on glyph number ${Integer.toHexString(chr.toInt()).toUpperCase()}")
|
||||
System.exit(1)
|
||||
}
|
||||
}
|
||||
else if (zeroWidthSheets.contains(ctype))
|
||||
len += 0
|
||||
else if (narrowWidthSheets.contains(ctype))
|
||||
len += W_LATIN_NARROW
|
||||
else if (ctype == SHEET_CJK_PUNCT)
|
||||
len += W_ASIAN_PUNCT
|
||||
else if (ctype == SHEET_HANGUL)
|
||||
len += W_HANGUL
|
||||
else if (ctype == SHEET_KANA)
|
||||
len += W_KANA
|
||||
else if (unihanWidthSheets.contains(ctype))
|
||||
len += W_UNIHAN
|
||||
else
|
||||
len += W_LATIN_WIDE
|
||||
|
||||
if (i < endIndex - 1) len += interchar
|
||||
}
|
||||
return len * scale
|
||||
}
|
||||
|
||||
override fun getHeight(s: String) = H * scale
|
||||
|
||||
override fun getLineHeight() = H * scale
|
||||
|
||||
override fun drawString(x: Float, y: Float, s: String) = drawString(x, y, s, Color.white)
|
||||
|
||||
override fun drawString(x: Float, y: Float, s: String, color: Color) {
|
||||
GL11.glEnable(GL11.GL_BLEND)
|
||||
GL11.glColorMask(true, true, true, true)
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
var thisCol = color
|
||||
|
||||
// hangul fonts first
|
||||
//hangulSheet.startUse() // disabling texture binding to make the font coloured
|
||||
// JOHAB
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (isHangul(ch)) {
|
||||
val hIndex = ch.toInt() - 0xAC00
|
||||
|
||||
val indexCho = getHanChosung(hIndex)
|
||||
val indexJung = getHanJungseong(hIndex)
|
||||
val indexJong = getHanJongseong(hIndex)
|
||||
|
||||
val choRow = getHanInitialRow(hIndex)
|
||||
val jungRow = getHanMedialRow(hIndex)
|
||||
val jongRow = getHanFinalRow(hIndex)
|
||||
|
||||
val glyphW = getWidth(ch.toString())
|
||||
|
||||
hangulSheet.getSubImage(indexCho, choRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
}
|
||||
//hangulSheet.endUse()
|
||||
|
||||
// unihan fonts
|
||||
/*uniHan.startUse();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
|
||||
if (isUniHan(ch)) {
|
||||
int glyphW = getWidth("" + ch);
|
||||
uniHan.renderInUse(
|
||||
Math.round(x
|
||||
+ getWidthSubstr(s, i + 1) - glyphW
|
||||
)
|
||||
, Math.round((H - H_UNIHAN) / 2 + y)
|
||||
, uniHanIndexX(ch)
|
||||
, uniHanIndexY(ch)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
uniHan.endUse();*/
|
||||
|
||||
// WenQuanYi 1
|
||||
//wenQuanYi_1.startUse()
|
||||
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (isWenQuanYi1(ch)) {
|
||||
val glyphW = getWidth("" + ch)
|
||||
wenQuanYi_1.getSubImage(wenQuanYiIndexX(ch), wenQuanYi1IndexY(ch)).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round((H - H_UNIHAN) / 2 + y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//wenQuanYi_1.endUse()
|
||||
// WenQuanYi 2
|
||||
//wenQuanYi_2.startUse()
|
||||
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (isWenQuanYi2(ch)) {
|
||||
val glyphW = getWidth("" + ch)
|
||||
wenQuanYi_2.getSubImage(wenQuanYiIndexX(ch), wenQuanYi2IndexY(ch)).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round((H - H_UNIHAN) / 2 + y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//wenQuanYi_2.endUse()
|
||||
|
||||
// regular fonts
|
||||
var prevInstance = -1
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (!isHangul(ch) && !isUniHan(ch)) {
|
||||
|
||||
// if not init, endUse first
|
||||
if (prevInstance != -1) {
|
||||
//sheetKey[prevInstance].endUse()
|
||||
}
|
||||
//sheetKey[getSheetType(ch)].startUse()
|
||||
prevInstance = getSheetType(ch)
|
||||
|
||||
val sheetX: Int
|
||||
val sheetY: Int
|
||||
when (prevInstance) {
|
||||
SHEET_EXTA_VARW -> {
|
||||
sheetX = extAindexX(ch)
|
||||
sheetY = extAindexY(ch)
|
||||
}
|
||||
SHEET_KANA -> {
|
||||
sheetX = kanaIndexX(ch)
|
||||
sheetY = kanaIndexY(ch)
|
||||
}
|
||||
SHEET_CJK_PUNCT -> {
|
||||
sheetX = cjkPunctIndexX(ch)
|
||||
sheetY = cjkPunctIndexY(ch)
|
||||
}
|
||||
SHEET_CYRILIC_VARW -> {
|
||||
sheetX = cyrilicIndexX(ch)
|
||||
sheetY = cyrilicIndexY(ch)
|
||||
}
|
||||
SHEET_FW_UNI -> {
|
||||
sheetX = fullwidthUniIndexX(ch)
|
||||
sheetY = fullwidthUniIndexY(ch)
|
||||
}
|
||||
SHEET_UNI_PUNCT -> {
|
||||
sheetX = uniPunctIndexX(ch)
|
||||
sheetY = uniPunctIndexY(ch)
|
||||
}
|
||||
SHEET_GREEK_VARW -> {
|
||||
sheetX = greekIndexX(ch)
|
||||
sheetY = greekIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_WIDE -> {
|
||||
sheetX = romanianIndexX(ch)
|
||||
sheetY = romanianIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_NARROW -> {
|
||||
sheetX = 0
|
||||
sheetY = 0
|
||||
}
|
||||
else -> {
|
||||
sheetX = ch.toInt() % 16
|
||||
sheetY = ch.toInt() / 16
|
||||
}
|
||||
}
|
||||
|
||||
val glyphW = getWidth("" + ch)
|
||||
try {
|
||||
sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
|
||||
// to deal with the height difference of the sheets
|
||||
Math.round(y).toFloat() + (if (prevInstance == SHEET_CJK_PUNCT) -1 // height hack
|
||||
else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2 // completely legit height adjustment
|
||||
else 0).toFloat(),
|
||||
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
catch (e: ArrayIndexOutOfBoundsException) {
|
||||
// character that does not exist in the sheet. No render, pass.
|
||||
}
|
||||
catch (e1: RuntimeException) {
|
||||
// System.err.println("[GameFontBase] RuntimeException raised while processing character '$ch' (U+${Integer.toHexString(ch.toInt()).toUpperCase()})")
|
||||
// e1.printStackTrack()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (prevInstance != -1) {
|
||||
//sheetKey[prevInstance].endUse()
|
||||
}
|
||||
|
||||
GL11.glEnd()
|
||||
}
|
||||
|
||||
private fun getSheetType(c: Char): Int {
|
||||
// EFs
|
||||
if (isRomanianNarrow(c))
|
||||
return SHEET_EXTB_ROMANIAN_NARROW
|
||||
else if (isHangul(c))
|
||||
return SHEET_HANGUL
|
||||
else if (isKana(c))
|
||||
return SHEET_KANA
|
||||
else if (isUniHan(c))
|
||||
return SHEET_UNIHAN
|
||||
else if (isAscii(c))
|
||||
return SHEET_ASCII_VARW
|
||||
else if (isExtA(c))
|
||||
return SHEET_EXTA_VARW
|
||||
else if (isCyrilic(c))
|
||||
return SHEET_CYRILIC_VARW
|
||||
else if (isUniPunct(c))
|
||||
return SHEET_UNI_PUNCT
|
||||
else if (isCJKPunct(c))
|
||||
return SHEET_CJK_PUNCT
|
||||
else if (isFullwidthUni(c))
|
||||
return SHEET_FW_UNI
|
||||
else if (isGreek(c))
|
||||
return SHEET_GREEK_VARW
|
||||
else if (isRomanian(c))
|
||||
return SHEET_EXTB_ROMANIAN_WIDE
|
||||
else
|
||||
return SHEET_UNKNOWN// fixed width punctuations
|
||||
// fixed width
|
||||
// fallback
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw part of a string to the screen. Note that this will still position the text as though
|
||||
* it's part of the bigger string.
|
||||
* @param x
|
||||
* *
|
||||
* @param y
|
||||
* *
|
||||
* @param s
|
||||
* *
|
||||
* @param color
|
||||
* *
|
||||
* @param startIndex
|
||||
* *
|
||||
* @param endIndex
|
||||
*/
|
||||
override fun drawString(x: Float, y: Float, s: String, color: Color, startIndex: Int, endIndex: Int) {
|
||||
val unprintedHead = s.substring(0, startIndex)
|
||||
val printedBody = s.substring(startIndex, endIndex)
|
||||
val xoff = getWidth(unprintedHead)
|
||||
drawString(x + xoff, y, printedBody, color)
|
||||
}
|
||||
|
||||
fun buildWidthTable(sheet: SpriteSheet, codeOffset: Int, codeRange: IntRange, rows: Int = 16) {
|
||||
fun Byte.toUint() = java.lang.Byte.toUnsignedInt(this)
|
||||
|
||||
/** @return Intarray(R, G, B, A) */
|
||||
fun Texture.getPixel(x: Int, y: Int): IntArray {
|
||||
val textureWidth = this.textureWidth
|
||||
val hasAlpha = this.hasAlpha()
|
||||
|
||||
val offset = (if (hasAlpha) 4 else 3) * (textureWidth * y + x) // 4: # of channels (RGBA)
|
||||
|
||||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||
return intArrayOf(
|
||||
this.textureData[offset].toUint(),
|
||||
this.textureData[offset + 1].toUint(),
|
||||
this.textureData[offset + 2].toUint(),
|
||||
if (hasAlpha)
|
||||
this.textureData[offset + 3].toUint()
|
||||
else 255
|
||||
)
|
||||
}
|
||||
else {
|
||||
return intArrayOf(
|
||||
this.textureData[offset + 2].toUint(),
|
||||
this.textureData[offset + 1].toUint(),
|
||||
this.textureData[offset].toUint(),
|
||||
if (hasAlpha)
|
||||
this.textureData[offset + 3].toUint()
|
||||
else 255
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val binaryCodeOffset = 15
|
||||
|
||||
val cellW = sheet.getSubImage(0, 0).width + 1 // should be 16
|
||||
val cellH = sheet.getSubImage(0, 0).height + 1 // should be 20
|
||||
|
||||
// control chars
|
||||
for (ccode in codeRange) {
|
||||
val glyphX = ccode % rows
|
||||
val glyphY = ccode / rows
|
||||
|
||||
val codeStartX = (glyphX * cellW) + binaryCodeOffset
|
||||
val codeStartY = (glyphY * cellH)
|
||||
|
||||
var glyphWidth = 0
|
||||
for (downCtr in 0..3) {
|
||||
// if alpha is not zero, assume it's 1
|
||||
if (sheet.texture.getPixel(codeStartX, codeStartY + downCtr)[3] == 255) {
|
||||
glyphWidth = glyphWidth or (1 shl downCtr)
|
||||
}
|
||||
}
|
||||
|
||||
asciiWidths[codeOffset + ccode] = glyphWidth
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
lateinit internal var hangulSheet: SpriteSheet
|
||||
lateinit internal var asciiSheet: SpriteSheet
|
||||
|
||||
internal val asciiWidths: HashMap<Int, Int> = HashMap()
|
||||
|
||||
lateinit internal var extASheet: SpriteSheet
|
||||
lateinit internal var kanaSheet: SpriteSheet
|
||||
lateinit internal var cjkPunct: SpriteSheet
|
||||
// static SpriteSheet uniHan;
|
||||
lateinit internal var cyrilic: SpriteSheet
|
||||
lateinit internal var fullwidthForms: SpriteSheet
|
||||
lateinit internal var uniPunct: SpriteSheet
|
||||
lateinit internal var wenQuanYi_1: SpriteSheet
|
||||
lateinit internal var wenQuanYi_2: SpriteSheet
|
||||
lateinit internal var greekSheet: SpriteSheet
|
||||
lateinit internal var romanianSheet: SpriteSheet
|
||||
lateinit internal var romanianSheetNarrow: SpriteSheet
|
||||
|
||||
internal val JUNG_COUNT = 21
|
||||
internal val JONG_COUNT = 28
|
||||
|
||||
internal val W_ASIAN_PUNCT = 10
|
||||
internal val W_HANGUL = 11
|
||||
internal val W_KANA = 12
|
||||
internal val W_UNIHAN = 16
|
||||
internal val W_LATIN_WIDE = 9 // width of regular letters, including m
|
||||
internal val W_LATIN_NARROW = 5 // width of letter f, t, i, l
|
||||
|
||||
internal val H = 20
|
||||
internal val H_HANGUL = 16
|
||||
internal val H_UNIHAN = 16
|
||||
internal val H_KANA = 20
|
||||
|
||||
internal val SHEET_ASCII_VARW = 0
|
||||
internal val SHEET_HANGUL = 1
|
||||
internal val SHEET_EXTA_VARW = 2
|
||||
internal val SHEET_KANA = 3
|
||||
internal val SHEET_CJK_PUNCT = 4
|
||||
internal val SHEET_UNIHAN = 5
|
||||
internal val SHEET_CYRILIC_VARW = 6
|
||||
internal val SHEET_FW_UNI = 7
|
||||
internal val SHEET_UNI_PUNCT = 8
|
||||
internal val SHEET_WENQUANYI_1 = 9
|
||||
internal val SHEET_WENQUANYI_2 = 10
|
||||
internal val SHEET_GREEK_VARW = 11
|
||||
internal val SHEET_EXTB_ROMANIAN_WIDE = 12
|
||||
internal val SHEET_EXTB_ROMANIAN_NARROW = 13
|
||||
|
||||
internal val SHEET_UNKNOWN = 254
|
||||
internal val SHEET_COLOURCODE = 255
|
||||
|
||||
lateinit internal var sheetKey: Array<SpriteSheet?>
|
||||
|
||||
internal var interchar = 0
|
||||
internal var scale = 1
|
||||
set(value) {
|
||||
if (value > 0) field = value
|
||||
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
|
||||
}
|
||||
|
||||
}// end of companion object
|
||||
}
|
||||
|
||||
fun Image.drawWithShadow(x: Float, y: Float, color: Color) =
|
||||
this.drawWithShadow(x, y, 1f, color)
|
||||
|
||||
fun Image.drawWithShadow(x: Float, y: Float, scale: Float, color: Color) {
|
||||
this.draw(x + 1, y + 1, scale, color.darker(0.5f))
|
||||
this.draw(x , y + 1, scale, color.darker(0.5f))
|
||||
this.draw(x + 1, y , scale, color.darker(0.5f))
|
||||
|
||||
this.draw(x, y, scale, color)
|
||||
}
|
||||
94
demo/src/net/torvald/terrarum/imagefont/GameFontDemo.kt
Normal file
94
demo/src/net/torvald/terrarum/imagefont/GameFontDemo.kt
Normal file
@@ -0,0 +1,94 @@
|
||||
package net.torvald.terrarum.imagefont
|
||||
|
||||
import net.torvald.imagefont.GameFontImpl
|
||||
import org.newdawn.slick.*
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.nio.file.FileSystems
|
||||
import java.nio.file.Files
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by SKYHi14 on 2017-02-16.
|
||||
*/
|
||||
|
||||
class GameFontDemo : BasicGame("Terrarum Sans Bitmap Demo") {
|
||||
|
||||
lateinit var gameFont: Font
|
||||
|
||||
override fun init(p0: GameContainer?) {
|
||||
gameFont = GameFontImpl()
|
||||
}
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun render(gc: GameContainer, g: Graphics) {
|
||||
g.font = gameFont
|
||||
g.background = Color(0x282828)
|
||||
text.forEachIndexed { i, s ->
|
||||
g.drawString(s, 10f, 10f + i * gameFont.lineHeight)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
lateinit var gameLocale: String
|
||||
var hasError: Boolean
|
||||
val text = ArrayList<String>()
|
||||
|
||||
init {
|
||||
try {
|
||||
val prop = Properties()
|
||||
prop.load(FileInputStream("./config.properties"))
|
||||
|
||||
gameLocale = prop.getProperty("locale")
|
||||
|
||||
if (gameLocale.length < 2)
|
||||
throw IllegalArgumentException("Bad locale setting: “$gameLocale”")
|
||||
|
||||
|
||||
Files.lines(FileSystems.getDefault().getPath("./text.txt")).forEach(
|
||||
{ text.add(it) }
|
||||
)
|
||||
|
||||
hasError = false
|
||||
}
|
||||
catch (e: Exception) {
|
||||
gameLocale = "enUS"
|
||||
hasError = true
|
||||
text.add("There was some problem loading the demo :(")
|
||||
text.add("This is what JVM says:")
|
||||
text.add("")
|
||||
e.message!!.split('\n').forEach {
|
||||
text.add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
System.setProperty("java.library.path", "lib")
|
||||
System.setProperty("org.lwjgl.librarypath", File("lib").absolutePath)
|
||||
|
||||
val WIDTH = 1000
|
||||
val HEIGHT = 800
|
||||
|
||||
try {
|
||||
val appgc = AppGameContainer(GameFontDemo())
|
||||
appgc.setDisplayMode(WIDTH, HEIGHT, false)
|
||||
|
||||
appgc.setMultiSample(0)
|
||||
appgc.setShowFPS(false)
|
||||
|
||||
// game will run normally even if it is not focused
|
||||
appgc.setUpdateOnlyWhenVisible(false)
|
||||
appgc.alwaysRender = true
|
||||
|
||||
appgc.start()
|
||||
}
|
||||
catch (ex: Exception) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
75
demo/src/net/torvald/terrarum/imagefont/GameFontImpl.kt
Normal file
75
demo/src/net/torvald/terrarum/imagefont/GameFontImpl.kt
Normal file
@@ -0,0 +1,75 @@
|
||||
package net.torvald.imagefont
|
||||
|
||||
import net.torvald.terrarum.imagefont.GameFontDemo
|
||||
import org.newdawn.slick.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-20.
|
||||
*/
|
||||
class GameFontImpl : GameFontBase() {
|
||||
|
||||
init {
|
||||
|
||||
GameFontBase.hangulSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H_HANGUL)
|
||||
GameFontBase.asciiSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1)
|
||||
GameFontBase.extASheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/LatinExtA_variable.tga", 15, 19, 1)
|
||||
GameFontBase.kanaSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H_KANA)
|
||||
GameFontBase.cjkPunct = SpriteSheet(
|
||||
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H_KANA)
|
||||
/*uniHan = new SpriteSheet(
|
||||
"./assets/graphics/fonts/unifont_unihan"
|
||||
+ ((!terrarum.gameLocale.contains("zh"))
|
||||
? "_ja" : "")
|
||||
+".tga"
|
||||
, W_UNIHAN, H_UNIHAN
|
||||
);*/
|
||||
GameFontBase.cyrilic = SpriteSheet(
|
||||
when (GameFontDemo.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(
|
||||
"./assets/graphics/fonts/fullwidth_forms.tga", GameFontBase.W_UNIHAN, GameFontBase.H_UNIHAN)
|
||||
GameFontBase.uniPunct = SpriteSheet(
|
||||
"./assets/graphics/fonts/unipunct.tga", GameFontBase.W_LATIN_WIDE, GameFontBase.H)
|
||||
GameFontBase.wenQuanYi_1 = SpriteSheet(
|
||||
"./assets/graphics/fonts/wenquanyi_11pt_part1.tga", 16, 18, 2)
|
||||
GameFontBase.wenQuanYi_2 = SpriteSheet(
|
||||
"./assets/graphics/fonts/wenquanyi_11pt_part2.tga", 16, 18, 2)
|
||||
GameFontBase.greekSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/greek_variable.tga", 15, 19, 1)
|
||||
GameFontBase.romanianSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/romana_wide.tga", GameFontBase.W_LATIN_WIDE, GameFontBase.H)
|
||||
GameFontBase.romanianSheetNarrow = SpriteSheet(
|
||||
"./assets/graphics/fonts/romana_narrow.tga", GameFontBase.W_LATIN_NARROW, GameFontBase.H)
|
||||
|
||||
val shk = arrayOf(
|
||||
GameFontBase.asciiSheet,
|
||||
GameFontBase.hangulSheet,
|
||||
GameFontBase.extASheet,
|
||||
GameFontBase.kanaSheet,
|
||||
GameFontBase.cjkPunct,
|
||||
null, // Full unihan, filler because we're using WenQuanYi
|
||||
GameFontBase.cyrilic,
|
||||
GameFontBase.fullwidthForms,
|
||||
GameFontBase.uniPunct,
|
||||
GameFontBase.wenQuanYi_1,
|
||||
GameFontBase.wenQuanYi_2,
|
||||
GameFontBase.greekSheet,
|
||||
GameFontBase.romanianSheet,
|
||||
GameFontBase.romanianSheetNarrow
|
||||
)
|
||||
GameFontBase.sheetKey = shk
|
||||
|
||||
|
||||
buildWidthTable(asciiSheet, 0, 0..0xFF)
|
||||
buildWidthTable(extASheet, 0x100, 0..0x7F)
|
||||
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
||||
buildWidthTable(greekSheet, 0x370, 0..0x5F)
|
||||
}
|
||||
}
|
||||
37
demo/text.txt
Normal file
37
demo/text.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
Set locale in config.properties to “bgBG” for alternative Bulgarian letters, “srSR” for Serbian.
|
||||
|
||||
ABCDEFGHIJKLM NOPQRSTUVWXYZ
|
||||
abcdefghijklm nopqrstuvwxyz
|
||||
|
||||
Syö salmiakkia, koska se on hyvää sinulle
|
||||
|
||||
The Olympic marmot (Marmota olympus) is a rodent in the squirrel family, Sciuridae.
|
||||
It lives only in the U.S. state of Washington, at middle elevations on the Olympic Peninsula.
|
||||
About the size of a domestic cat, an adult weighs around 8 kg (18 lb) in summer.
|
||||
|
||||
Brná je část statutárního a krajského města Ústí nad Labem v České republice, spadající
|
||||
pod městský obvod Ústí nad Labem-Střekov. Nachází se asi pět kilometrů jižně od centra
|
||||
města v Českém středohoří na pravém břehu řeky Labe.
|
||||
|
||||
Malaysia er en forholdsvis ung stat. Sin endelige udstrækning fik den først i 1965 efter
|
||||
at Singapore trak sig ud. Staten blev grundlagt ved en sammenslutning af flere tidligere
|
||||
britiske besiddelser, foreløbigt i 1957 og endeligt i 1963.
|
||||
|
||||
Το θάλλιο συνοδεύει κυρίως θειούχα ορυκτά βασικών μετάλλων, όπως ο σφαλερίτης, ο σιδηροπυρίτης
|
||||
και ο γαληνίτης ενώ αναφέρονται και εμφανίσεις του σε κονδύλους μαγγανίου στους βυθούς των ωκεανών.
|
||||
διαφυλάξτε γενικά τη ζωή σας από βαθειά ψυχικά τραύματα
|
||||
ΔΙΑΦΥΛΆΞΤΕ ΓΕΝΙΚΆ ΤΗ ΖΩΉ ΣΑΣ ΑΠΌ ΒΑΘΕΙΆ ΨΥΧΙΚΆ ΤΡΑΎΜΑΤΑ
|
||||
Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства.
|
||||
Příliš žluťoučký kůň úpěl ďábelské ódy. Árvíztűrő tükörfúrógép.
|
||||
Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.
|
||||
Pijamalı hasta yağız şoföre çabucak güvendi. Kŕdeľ ďatľov učí koňa žrať kôru.
|
||||
Voix ambiguë d'un cœur qui au zéphyr préfère les jattes de kiwi.
|
||||
Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila.
|
||||
|
||||
sjaldgæft ekki stjórnarskrárvarin
|
||||
|
||||
Also supports:
|
||||
‛Unicode’ „quotation marks“—dashes…‼
|
||||
으웽~. 얘! 위에 이 애 우유의 양 외워와! 아오~ 왜요? 어여! 예... 웬 초콜릿? 제가 원했던 건 뻥튀기 쬐끔과 의류예요. 얘야, 왜 또 불평? 퀡퇣풿횂
|
||||
とりなくこゑす ゆめさませ みよあけわたる ひんかしを そらいろはえて おきつへに ほふねむれゐぬ もやのうち
|
||||
鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中,
|
||||
Reference in New Issue
Block a user