mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Renamed AppLoader into App
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: net.torvald.terrarum.AppLoader
|
||||
Main-Class: net.torvald.terrarum.App
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.random;
|
||||
|
||||
import net.torvald.UnsafeHelper;
|
||||
import net.torvald.terrarum.AppLoader;
|
||||
|
||||
/**
|
||||
* Code from https://richardstartin.github.io/posts/xxhash
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.torvald.spriteassembler
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.linearSearch
|
||||
import java.io.File
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import static net.torvald.terrarum.TerrarumKt.printStackTrace;
|
||||
*
|
||||
* Created by minjaesong on 2017-08-01.
|
||||
*/
|
||||
public class AppLoader implements ApplicationListener {
|
||||
public class App implements ApplicationListener {
|
||||
|
||||
public static final String GAME_NAME = TerrarumAppConfiguration.GAME_NAME;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class AppLoader implements ApplicationListener {
|
||||
/**
|
||||
* Singleton instance
|
||||
*/
|
||||
private static AppLoader INSTANCE = null;
|
||||
private static App INSTANCE = null;
|
||||
|
||||
/**
|
||||
* Screen injected at init, so that you run THAT screen instead of the main game.
|
||||
@@ -91,9 +91,9 @@ public class AppLoader implements ApplicationListener {
|
||||
* @param appConfig LWJGL3 Application Configuration
|
||||
* @param injectScreen GDX Screen you want to run
|
||||
*/
|
||||
public AppLoader(Lwjgl3ApplicationConfiguration appConfig, Screen injectScreen) {
|
||||
AppLoader.injectScreen = injectScreen;
|
||||
AppLoader.appConfig = appConfig;
|
||||
public App(Lwjgl3ApplicationConfiguration appConfig, Screen injectScreen) {
|
||||
App.injectScreen = injectScreen;
|
||||
App.appConfig = appConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,14 +101,14 @@ public class AppLoader implements ApplicationListener {
|
||||
*
|
||||
* @param appConfig LWJGL3 Application Configuration
|
||||
*/
|
||||
public AppLoader(Lwjgl3ApplicationConfiguration appConfig) {
|
||||
AppLoader.appConfig = appConfig;
|
||||
public App(Lwjgl3ApplicationConfiguration appConfig) {
|
||||
App.appConfig = appConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default null constructor. Don't use it.
|
||||
*/
|
||||
private AppLoader() {
|
||||
private App() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,9 +119,9 @@ public class AppLoader implements ApplicationListener {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static AppLoader getINSTANCE() {
|
||||
public static App getINSTANCE() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new AppLoader();
|
||||
INSTANCE = new App();
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class AppLoader implements ApplicationListener {
|
||||
private static Point2i resizeReqSize;
|
||||
|
||||
public static Lwjgl3ApplicationConfiguration appConfig;
|
||||
public static TerrarumScreenSize screenSize;
|
||||
public static TerrarumScreenSize scr;
|
||||
public static TerrarumGLinfo glInfo = new TerrarumGLinfo();
|
||||
|
||||
public static CreateTileAtlas tileMaker;
|
||||
@@ -298,9 +298,9 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
ShaderProgram.pedantic = false;
|
||||
|
||||
screenSize = new TerrarumScreenSize(getConfigInt("screenwidth"), getConfigInt("screenheight"));
|
||||
int width = screenSize.getScreenW();
|
||||
int height = screenSize.getScreenH();
|
||||
scr = new TerrarumScreenSize(getConfigInt("screenwidth"), getConfigInt("screenheight"));
|
||||
int width = scr.getWidth();
|
||||
int height = scr.getHeight();
|
||||
|
||||
Lwjgl3ApplicationConfiguration appConfig = new Lwjgl3ApplicationConfiguration();
|
||||
//appConfig.useGL30 = false; // https://stackoverflow.com/questions/46753218/libgdx-should-i-use-gl30
|
||||
@@ -341,7 +341,7 @@ public class AppLoader implements ApplicationListener {
|
||||
// set some more configuration vars
|
||||
MULTITHREAD = THREAD_COUNT >= 3 && getConfigBoolean("multithread");
|
||||
|
||||
new Lwjgl3Application(new AppLoader(appConfig), appConfig);
|
||||
new Lwjgl3Application(new App(appConfig), appConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -362,12 +362,12 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
// set basis of draw
|
||||
logoBatch = new SpriteBatch();
|
||||
camera = new OrthographicCamera((screenSize.getScreenWf()), (screenSize.getScreenHf()));
|
||||
camera = new OrthographicCamera((scr.getWf()), (scr.getHf()));
|
||||
|
||||
batch = new SpriteBatch();
|
||||
shapeRender = new ShapeRenderer();
|
||||
|
||||
initViewPort(screenSize.getScreenW(), screenSize.getScreenH());
|
||||
initViewPort(scr.getWidth(), scr.getHeight());
|
||||
|
||||
// logo here :p
|
||||
logo = new TextureRegion(new Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")));
|
||||
@@ -389,7 +389,7 @@ public class AppLoader implements ApplicationListener {
|
||||
VertexAttribute.ColorUnpacked(),
|
||||
VertexAttribute.TexCoords(0)
|
||||
);
|
||||
updateFullscreenQuad(screenSize.getScreenW(), screenSize.getScreenH());
|
||||
updateFullscreenQuad(scr.getWidth(), scr.getHeight());
|
||||
|
||||
|
||||
// set up renderer info variables
|
||||
@@ -398,7 +398,7 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
|
||||
// make gamepad(s)
|
||||
if (AppLoader.getConfigBoolean("usexinput")) {
|
||||
if (App.getConfigBoolean("usexinput")) {
|
||||
try {
|
||||
gamepad = new XinputControllerAdapter(XInputDevice.getDeviceFor(0));
|
||||
}
|
||||
@@ -484,7 +484,7 @@ public class AppLoader implements ApplicationListener {
|
||||
postInit();
|
||||
}
|
||||
|
||||
AppLoader.setDebugTime("GDX.rawDelta", (long) (Gdx.graphics.getDeltaTime() * 1000_000_000f));
|
||||
App.setDebugTime("GDX.rawDelta", (long) (Gdx.graphics.getDeltaTime() * 1000_000_000f));
|
||||
|
||||
|
||||
FrameBufferManager.begin(renderFBO);
|
||||
@@ -535,7 +535,7 @@ public class AppLoader implements ApplicationListener {
|
||||
screenshotRequested = false;
|
||||
|
||||
try {
|
||||
Pixmap p = ScreenUtils.getFrameBufferPixmap(0, 0, screenSize.getScreenW(), screenSize.getScreenH());
|
||||
Pixmap p = ScreenUtils.getFrameBufferPixmap(0, 0, scr.getWidth(), scr.getHeight());
|
||||
PixmapIO2.writeTGA(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".tga"), p, true);
|
||||
p.dispose();
|
||||
|
||||
@@ -564,8 +564,8 @@ public class AppLoader implements ApplicationListener {
|
||||
setCameraPosition(0f, 0f);
|
||||
|
||||
int safetyTextLen = fontGame.getWidth(Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY"));
|
||||
int logoPosX = (screenSize.getScreenW() - logo.getRegionWidth() - safetyTextLen) >>> 1;
|
||||
int logoPosY = Math.round(screenSize.getScreenH() / 15f);
|
||||
int logoPosX = (scr.getWidth() - logo.getRegionWidth() - safetyTextLen) >>> 1;
|
||||
int logoPosY = Math.round(scr.getHeight() / 15f);
|
||||
int textY = logoPosY + logo.getRegionHeight() - 16;
|
||||
|
||||
// draw logo reflection
|
||||
@@ -577,8 +577,8 @@ public class AppLoader implements ApplicationListener {
|
||||
logoBatch.draw(logo, logoPosX, logoPosY + logo.getRegionHeight());
|
||||
}
|
||||
else {
|
||||
logoBatch.draw(logo, (screenSize.getScreenW() - logo.getRegionWidth()) / 2f,
|
||||
(screenSize.getScreenH() - logo.getRegionHeight() * 2) / 2f + logo.getRegionHeight()
|
||||
logoBatch.draw(logo, (scr.getWidth() - logo.getRegionWidth()) / 2f,
|
||||
(scr.getHeight() - logo.getRegionHeight() * 2) / 2f + logo.getRegionHeight()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -603,8 +603,8 @@ public class AppLoader implements ApplicationListener {
|
||||
String s = Lang.INSTANCE.get("APP_CHINESE_HEALTHY_GAME_MSG_" + i);
|
||||
|
||||
fontGame.draw(logoBatch, s,
|
||||
(screenSize.getScreenW() - fontGame.getWidth(s)) >>> 1,
|
||||
Math.round(screenSize.getScreenH() * 12f / 15f + fontGame.getLineHeight() * (i - 1))
|
||||
(scr.getWidth() - fontGame.getWidth(s)) >>> 1,
|
||||
Math.round(scr.getHeight() * 12f / 15f + fontGame.getLineHeight() * (i - 1))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -612,15 +612,15 @@ public class AppLoader implements ApplicationListener {
|
||||
logoBatch.setColor(new Color(0x282828ff));
|
||||
Texture tex1 = CommonResourcePool.INSTANCE.getAsTexture("title_health1");
|
||||
Texture tex2 = CommonResourcePool.INSTANCE.getAsTexture("title_health2");
|
||||
int virtualHeight = screenSize.getScreenH() - logoPosY - logo.getRegionHeight() / 4;
|
||||
int virtualHeightOffset = screenSize.getScreenH() - virtualHeight;
|
||||
logoBatch.draw(tex1, (screenSize.getScreenW() - tex1.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) - 16, tex1.getWidth(), -tex1.getHeight());
|
||||
logoBatch.draw(tex2, (screenSize.getScreenW() - tex2.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) + 16 + tex2.getHeight(), tex2.getWidth(), -tex2.getHeight());
|
||||
int virtualHeight = scr.getHeight() - logoPosY - logo.getRegionHeight() / 4;
|
||||
int virtualHeightOffset = scr.getHeight() - virtualHeight;
|
||||
logoBatch.draw(tex1, (scr.getWidth() - tex1.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) - 16, tex1.getWidth(), -tex1.getHeight());
|
||||
logoBatch.draw(tex2, (scr.getWidth() - tex2.getWidth()) >>> 1, virtualHeightOffset + (virtualHeight >>> 1) + 16 + tex2.getHeight(), tex2.getWidth(), -tex2.getHeight());
|
||||
|
||||
}
|
||||
else {
|
||||
logoBatch.draw(logo, (screenSize.getScreenW() - logo.getRegionWidth()) / 2f,
|
||||
(screenSize.getScreenH() - logo.getRegionHeight() * 2) / 2f
|
||||
logoBatch.draw(logo, (scr.getWidth() - logo.getRegionWidth()) / 2f,
|
||||
(scr.getHeight() - logo.getRegionHeight() * 2) / 2f
|
||||
);
|
||||
}
|
||||
|
||||
@@ -634,20 +634,20 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
//initViewPort(width, height);
|
||||
|
||||
screenSize.setDimension(width, height);
|
||||
scr.setDimension(width, height);
|
||||
|
||||
if (currenScreen != null) currenScreen.resize(screenSize.getScreenW(), screenSize.getScreenH());
|
||||
updateFullscreenQuad(screenSize.getScreenW(), screenSize.getScreenH());
|
||||
if (currenScreen != null) currenScreen.resize(scr.getWidth(), scr.getHeight());
|
||||
updateFullscreenQuad(scr.getWidth(), scr.getHeight());
|
||||
|
||||
|
||||
if (renderFBO == null ||
|
||||
(renderFBO.getWidth() != screenSize.getScreenW() ||
|
||||
renderFBO.getHeight() != screenSize.getScreenH())
|
||||
(renderFBO.getWidth() != scr.getWidth() ||
|
||||
renderFBO.getHeight() != scr.getHeight())
|
||||
) {
|
||||
renderFBO = new FrameBuffer(
|
||||
Pixmap.Format.RGBA8888,
|
||||
screenSize.getScreenW(),
|
||||
screenSize.getScreenH(),
|
||||
scr.getWidth(),
|
||||
scr.getHeight(),
|
||||
false
|
||||
);
|
||||
}
|
||||
@@ -755,7 +755,7 @@ public class AppLoader implements ApplicationListener {
|
||||
currenScreen = screen;
|
||||
|
||||
currenScreen.show();
|
||||
currenScreen.resize(screenSize.getScreenW(), screenSize.getScreenH());
|
||||
currenScreen.resize(scr.getWidth(), scr.getHeight());
|
||||
|
||||
|
||||
System.gc();
|
||||
@@ -804,7 +804,7 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
|
||||
private void setCameraPosition(float newX, float newY) {
|
||||
camera.position.set((-newX + screenSize.getScreenW() / 2), (-newY + screenSize.getScreenH() / 2), 0f); // deliberate integer division
|
||||
camera.position.set((-newX + scr.getWidth() / 2), (-newY + scr.getHeight() / 2), 0f); // deliberate integer division
|
||||
camera.update();
|
||||
logoBatch.setProjectionMatrix(camera.combined);
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.utils.Json
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
|
||||
/**
|
||||
* Keys must be all lowercase
|
||||
@@ -18,7 +16,7 @@ object DefaultConfig {
|
||||
"screenheight" to TerrarumScreenSize.defaultH,
|
||||
"atlastexsize" to 2048,
|
||||
|
||||
"language" to AppLoader.getSysLang(),
|
||||
"language" to App.getSysLang(),
|
||||
"notificationshowuptime" to 4000,
|
||||
"multithread" to true,
|
||||
"multithreadedlight" to false,
|
||||
|
||||
@@ -9,8 +9,8 @@ import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
object ErrorDisp : Screen {
|
||||
|
||||
private val logoTex = AppLoader.logo
|
||||
private val font = AppLoader.fontGame
|
||||
private val logoTex = App.logo
|
||||
private val font = App.fontGame
|
||||
|
||||
|
||||
var title = Lang["ERROR_GENERIC_TEXT"]
|
||||
@@ -25,7 +25,7 @@ object ErrorDisp : Screen {
|
||||
|
||||
|
||||
private val titleTextLeftMargin = 8
|
||||
private val titleText = "${AppLoader.GAME_NAME} ${AppLoader.getVERSION_STRING()}"
|
||||
private val titleText = "${App.GAME_NAME} ${App.getVERSION_STRING()}"
|
||||
|
||||
|
||||
override fun show() {
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.torvald.gdx.graphics.Cvec
|
||||
class GdxColorMap {
|
||||
|
||||
constructor(imageFile: FileHandle) {
|
||||
AppLoader.printdbg(this, "Loading colormap from ${imageFile.name()}")
|
||||
App.printdbg(this, "Loading colormap from ${imageFile.name()}")
|
||||
printStackTrace(this)
|
||||
|
||||
val pixmap = Pixmap(imageFile)
|
||||
|
||||
@@ -2,26 +2,19 @@ package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Screen
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.gameactors.ActorID
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameactors.BlockMarkerActor
|
||||
import net.torvald.terrarum.gameactors.faction.FactionCodex
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.WorldSimulator
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.MaterialCodex
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.modulebasegame.ui.Notification
|
||||
import net.torvald.terrarum.modulebasegame.ui.UITooltip
|
||||
import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.VirtualDisk
|
||||
import net.torvald.terrarum.ui.ConsoleWindow
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.util.SortedArrayList
|
||||
import org.khelekore.prtree.DistanceCalculator
|
||||
import org.khelekore.prtree.DistanceResult
|
||||
@@ -76,8 +69,8 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
||||
init {
|
||||
consoleHandler.setPosition(0, 0)
|
||||
notifier.setPosition(
|
||||
(AppLoader.screenSize.screenW - notifier.width) / 2,
|
||||
AppLoader.screenSize.screenH - notifier.height - AppLoader.screenSize.tvSafeGraphicsHeight
|
||||
(App.scr.width - notifier.width) / 2,
|
||||
App.scr.height - notifier.height - App.scr.tvSafeGraphicsHeight
|
||||
)
|
||||
|
||||
printdbg(this, "New ingame instance ${this.hashCode()}, called from")
|
||||
@@ -128,7 +121,7 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
||||
val wallChangeQueue = ArrayList<BlockChangeQueueItem>()
|
||||
val wireChangeQueue = ArrayList<BlockChangeQueueItem>() // if 'old' is set and 'new' is blank, it's a wire cutter
|
||||
|
||||
var loadedTime_t = AppLoader.getTIME_T()
|
||||
var loadedTime_t = App.getTIME_T()
|
||||
protected set
|
||||
|
||||
override fun hide() {
|
||||
|
||||
@@ -22,7 +22,7 @@ open class LoadScreenBase : ScreenAdapter(), Disposable {
|
||||
internal var errorTrapped = false
|
||||
internal var doContextChange = false
|
||||
|
||||
var camera = OrthographicCamera(AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
var camera = OrthographicCamera(App.scr.wf, App.scr.hf)
|
||||
|
||||
override fun show() {
|
||||
messages.clear()
|
||||
@@ -51,7 +51,7 @@ open class LoadScreenBase : ScreenAdapter(), Disposable {
|
||||
}
|
||||
|
||||
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
initViewPort(App.scr.width, App.scr.height)
|
||||
}
|
||||
|
||||
fun initViewPort(width: Int, height: Int) {
|
||||
@@ -74,11 +74,11 @@ open class LoadScreenBase : ScreenAdapter(), Disposable {
|
||||
|
||||
if (doContextChange) {
|
||||
Thread.sleep(80)
|
||||
AppLoader.setScreen(screenToLoad!!)
|
||||
App.setScreen(screenToLoad!!)
|
||||
}
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
initViewPort(App.scr.width, App.scr.height)
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.files.FileHandle
|
||||
import net.torvald.terrarum.AppLoader.*
|
||||
import net.torvald.terrarum.App.*
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
@@ -141,7 +141,7 @@ object ModMgr {
|
||||
catch (e: Throwable) {
|
||||
printdbgerr(this, "There was an error while loading module $moduleName")
|
||||
printdbgerr(this, "\t$e")
|
||||
print(AppLoader.csiR); e.printStackTrace(System.out); print(AppLoader.csi0)
|
||||
print(App.csiR); e.printStackTrace(System.out); print(App.csi0)
|
||||
moduleInfo.remove(moduleName)
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ object ModMgr {
|
||||
catch (e: Throwable) {
|
||||
printdbgerr(this, "There was an error while loading module $moduleName")
|
||||
printdbgerr(this, "\t$e")
|
||||
print(AppLoader.csiR); e.printStackTrace(System.out); print(AppLoader.csi0)
|
||||
print(App.csiR); e.printStackTrace(System.out); print(App.csi0)
|
||||
moduleInfo.remove(moduleName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ class ModOptionsHost : UICanvas() {
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaBorder = 8
|
||||
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - moduleAreaHMargin * 2
|
||||
override var width = App.scr.width - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = App.scr.height - moduleAreaHMargin * 2
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ object PostProcessor : Disposable {
|
||||
private val functionRowHelper = Texture(Gdx.files.internal("assets/graphics/function_row_help.png"))
|
||||
|
||||
init {
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
@@ -64,27 +64,27 @@ object PostProcessor : Disposable {
|
||||
debugUI.setPosition(0, 0)
|
||||
|
||||
batch = SpriteBatch()
|
||||
camera = OrthographicCamera(AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
camera = OrthographicCamera(App.scr.wf, App.scr.hf)
|
||||
camera.setToOrtho(true)
|
||||
|
||||
batch.projectionMatrix = camera.combined
|
||||
|
||||
shapeRenderer = ShapeRenderer()
|
||||
Gdx.gl20.glViewport(0, 0, AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
Gdx.gl20.glViewport(0, 0, App.scr.width, App.scr.height)
|
||||
}
|
||||
|
||||
|
||||
debugUI.update(Gdx.graphics.deltaTime)
|
||||
|
||||
|
||||
AppLoader.measureDebugTime("Renderer.PostProcessor") {
|
||||
App.measureDebugTime("Renderer.PostProcessor") {
|
||||
|
||||
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
|
||||
|
||||
postShader(projMat, fbo)
|
||||
|
||||
// draw things when F keys are on
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD && KeyToggler.isOn(Input.Keys.F11)) {
|
||||
if (App.IS_DEVELOPMENT_BUILD && KeyToggler.isOn(Input.Keys.F11)) {
|
||||
drawSafeArea()
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ object PostProcessor : Disposable {
|
||||
batch.color = Color.WHITE
|
||||
batch.inUse {
|
||||
it.draw(functionRowHelper,
|
||||
(AppLoader.screenSize.screenW - functionRowHelper.width) / 2f,
|
||||
(App.scr.width - functionRowHelper.width) / 2f,
|
||||
functionRowHelper.height.toFloat(),
|
||||
functionRowHelper.width.toFloat(),
|
||||
functionRowHelper.height * -1f
|
||||
@@ -103,7 +103,7 @@ object PostProcessor : Disposable {
|
||||
if (KeyToggler.isOn(Input.Keys.F10)) {
|
||||
batch.color = Color.WHITE
|
||||
batch.inUse {
|
||||
AppLoader.fontSmallNumbers.draw(it, "Wire draw class: ${(Terrarum.ingame as? net.torvald.terrarum.modulebasegame.TerrarumIngame)?.selectedWireRenderClass}", 2f, 2f)
|
||||
App.fontSmallNumbers.draw(it, "Wire draw class: ${(Terrarum.ingame as? net.torvald.terrarum.modulebasegame.TerrarumIngame)?.selectedWireRenderClass}", 2f, 2f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +116,10 @@ object PostProcessor : Disposable {
|
||||
}
|
||||
|
||||
// draw dev build notifiers
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD && Terrarum.ingame != null) {
|
||||
if (App.IS_DEVELOPMENT_BUILD && Terrarum.ingame != null) {
|
||||
batch.inUse {
|
||||
batch.color = safeAreaCol
|
||||
AppLoader.fontGame.draw(it, thisIsDebugStr, 5f, AppLoader.screenSize.screenH - 24f)
|
||||
App.fontGame.draw(it, thisIsDebugStr, 5f, App.scr.height - 24f)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,17 +127,17 @@ object PostProcessor : Disposable {
|
||||
|
||||
private fun postShader(projMat: Matrix4, fbo: FrameBuffer) {
|
||||
val shader: ShaderProgram? =
|
||||
if (AppLoader.getConfigBoolean("fxretro"))
|
||||
AppLoader.shaderHicolour
|
||||
if (App.getConfigBoolean("fxretro"))
|
||||
App.shaderHicolour
|
||||
else
|
||||
AppLoader.shaderPassthruRGB
|
||||
App.shaderPassthruRGB
|
||||
|
||||
fbo.colorBufferTexture.bind(0)
|
||||
|
||||
shader?.bind()
|
||||
shader?.setUniformMatrix("u_projTrans", projMat)
|
||||
shader?.setUniformi("u_texture", 0)
|
||||
AppLoader.fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
|
||||
App.fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
|
||||
|
||||
|
||||
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
||||
@@ -145,35 +145,35 @@ object PostProcessor : Disposable {
|
||||
}
|
||||
|
||||
private fun drawSafeArea() {
|
||||
val tvSafeAreaW = AppLoader.screenSize.tvSafeGraphicsWidth.toFloat()
|
||||
val tvSafeAreaH = AppLoader.screenSize.tvSafeGraphicsHeight.toFloat()
|
||||
val tvSafeArea2W = AppLoader.screenSize.tvSafeActionWidth.toFloat()
|
||||
val tvSafeArea2H = AppLoader.screenSize.tvSafeActionHeight.toFloat()
|
||||
val tvSafeAreaW = App.scr.tvSafeGraphicsWidth.toFloat()
|
||||
val tvSafeAreaH = App.scr.tvSafeGraphicsHeight.toFloat()
|
||||
val tvSafeArea2W = App.scr.tvSafeActionWidth.toFloat()
|
||||
val tvSafeArea2H = App.scr.tvSafeActionHeight.toFloat()
|
||||
|
||||
shapeRenderer.inUse(ShapeRenderer.ShapeType.Line) {
|
||||
|
||||
// centre ind
|
||||
shapeRenderer.color = safeAreaCol2
|
||||
shapeRenderer.line(0f, 0f, AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
shapeRenderer.line(0f, AppLoader.screenSize.screenHf, AppLoader.screenSize.screenWf, 0f)
|
||||
shapeRenderer.line(0f, 0f, App.scr.wf, App.scr.hf)
|
||||
shapeRenderer.line(0f, App.scr.hf, App.scr.wf, 0f)
|
||||
|
||||
// safe action area
|
||||
shapeRenderer.color = safeAreaCol2
|
||||
shapeRenderer.rect(
|
||||
tvSafeArea2W, tvSafeArea2H, AppLoader.screenSize.screenW - 2 * tvSafeArea2W, AppLoader.screenSize.screenH - 2 * tvSafeArea2H
|
||||
tvSafeArea2W, tvSafeArea2H, App.scr.width - 2 * tvSafeArea2W, App.scr.height - 2 * tvSafeArea2H
|
||||
)
|
||||
|
||||
// safe graphics area
|
||||
shapeRenderer.color = safeAreaCol
|
||||
shapeRenderer.rect(
|
||||
tvSafeAreaW, tvSafeAreaH, AppLoader.screenSize.screenW - 2 * tvSafeAreaW, AppLoader.screenSize.screenH - 2 * tvSafeAreaH
|
||||
tvSafeAreaW, tvSafeAreaH, App.scr.width - 2 * tvSafeAreaW, App.scr.height - 2 * tvSafeAreaH
|
||||
)
|
||||
|
||||
// default res ind
|
||||
shapeRenderer.color = defaultResCol
|
||||
shapeRenderer.rect(
|
||||
(AppLoader.screenSize.screenW - TerrarumScreenSize.minimumW).div(2).toFloat(),
|
||||
(AppLoader.screenSize.screenH - TerrarumScreenSize.minimumH).div(2).toFloat(),
|
||||
(App.scr.width - TerrarumScreenSize.minimumW).div(2).toFloat(),
|
||||
(App.scr.height - TerrarumScreenSize.minimumH).div(2).toFloat(),
|
||||
TerrarumScreenSize.minimumW.toFloat(),
|
||||
TerrarumScreenSize.minimumH.toFloat()
|
||||
)
|
||||
@@ -182,22 +182,22 @@ object PostProcessor : Disposable {
|
||||
try {
|
||||
batch.inUse {
|
||||
batch.color = safeAreaCol
|
||||
AppLoader.fontSmallNumbers.draw(
|
||||
App.fontSmallNumbers.draw(
|
||||
batch, safeAreaStr,
|
||||
tvSafeAreaW, tvSafeAreaH - 10
|
||||
)
|
||||
|
||||
batch.color = defaultResCol
|
||||
AppLoader.fontSmallNumbers.draw(
|
||||
App.fontSmallNumbers.draw(
|
||||
batch, defaultResStr,
|
||||
(AppLoader.screenSize.screenW - TerrarumScreenSize.minimumW).div(2).toFloat(),
|
||||
(AppLoader.screenSize.screenH - TerrarumScreenSize.minimumH).div(2).toFloat()
|
||||
(App.scr.width - TerrarumScreenSize.minimumW).div(2).toFloat(),
|
||||
(App.scr.height - TerrarumScreenSize.minimumH).div(2).toFloat()
|
||||
)
|
||||
|
||||
batch.color = currentResCol
|
||||
AppLoader.fontSmallNumbers.draw(
|
||||
App.fontSmallNumbers.draw(
|
||||
batch, currentResStr,
|
||||
AppLoader.screenSize.screenW - 80f,
|
||||
App.scr.width - 80f,
|
||||
0f
|
||||
)
|
||||
}
|
||||
@@ -212,10 +212,10 @@ object PostProcessor : Disposable {
|
||||
}
|
||||
|
||||
private val defaultResStr = "${TerrarumScreenSize.minimumW}x${TerrarumScreenSize.minimumH}"
|
||||
private val currentResStr = "${AppLoader.screenSize.screenW}x${AppLoader.screenSize.screenH}"
|
||||
private val currentResStr = "${App.scr.width}x${App.scr.height}"
|
||||
private val safeAreaStr = "TV Safe Area"
|
||||
private val versionStr = "Version ${AppLoader.getVERSION_STRING()}"
|
||||
internal val thisIsDebugStr = "${AppLoader.GAME_NAME} Develoment Build $versionStr"
|
||||
private val versionStr = "Version ${App.getVERSION_STRING()}"
|
||||
internal val thisIsDebugStr = "${App.GAME_NAME} Develoment Build $versionStr"
|
||||
|
||||
/**
|
||||
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
||||
|
||||
@@ -15,13 +15,13 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
object SanicLoadScreen : LoadScreenBase() {
|
||||
|
||||
init {
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
}
|
||||
|
||||
private var arrowObjPos = 0f // 0 means at starting position, regardless of screen position
|
||||
private var arrowObjGlideOffsetX = 0f
|
||||
private var arrowObjGlideSize = 0f
|
||||
private val arrowGlideSpeed: Float; get() = AppLoader.screenSize.screenW * 2f // pixels per sec
|
||||
private val arrowGlideSpeed: Float; get() = App.scr.width * 2f // pixels per sec
|
||||
private lateinit var arrowObjTex: Texture
|
||||
private var glideTimer = 0f
|
||||
private var glideDispY = 0f
|
||||
@@ -46,10 +46,10 @@ object SanicLoadScreen : LoadScreenBase() {
|
||||
textFbo = FrameBuffer(
|
||||
Pixmap.Format.RGBA4444,
|
||||
maxOf(
|
||||
AppLoader.fontGame.getWidth(Lang["MENU_IO_LOADING"]),
|
||||
AppLoader.fontGame.getWidth(Lang["ERROR_GENERIC_TEXT"])
|
||||
App.fontGame.getWidth(Lang["MENU_IO_LOADING"]),
|
||||
App.fontGame.getWidth(Lang["ERROR_GENERIC_TEXT"])
|
||||
),
|
||||
AppLoader.fontGame.lineHeight.toInt(),
|
||||
App.fontGame.lineHeight.toInt(),
|
||||
true
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ object SanicLoadScreen : LoadScreenBase() {
|
||||
}
|
||||
|
||||
|
||||
val textX: Float; get() = (AppLoader.screenSize.screenW * 0.72f).floor()
|
||||
val textX: Float; get() = (App.scr.width * 0.72f).floor()
|
||||
|
||||
private var genuineSonic = false // the "NOW LOADING..." won't appear unless the arrow first run passes it (it's totally not a GenuineIntel tho)
|
||||
|
||||
@@ -72,8 +72,8 @@ object SanicLoadScreen : LoadScreenBase() {
|
||||
|
||||
val delta = Gdx.graphics.deltaTime
|
||||
|
||||
glideDispY = AppLoader.screenSize.screenH - 100f - AppLoader.fontGame.lineHeight
|
||||
arrowObjGlideSize = arrowObjTex.width + 2f * AppLoader.screenSize.screenW
|
||||
glideDispY = App.scr.height - 100f - App.fontGame.lineHeight
|
||||
arrowObjGlideSize = arrowObjTex.width + 2f * App.scr.width
|
||||
|
||||
|
||||
|
||||
@@ -105,43 +105,43 @@ object SanicLoadScreen : LoadScreenBase() {
|
||||
|
||||
|
||||
val textToPrint = if (errorTrapped) Lang["ERROR_GENERIC_TEXT"] else Lang["MENU_IO_LOADING"]
|
||||
val textWidth = AppLoader.fontGame.getWidth(textToPrint).toFloat()
|
||||
val textWidth = App.fontGame.getWidth(textToPrint).toFloat()
|
||||
|
||||
if (!doContextChange) {
|
||||
// draw text to FBO
|
||||
textFbo.inAction(camera, AppLoader.batch) {
|
||||
AppLoader.batch.inUse {
|
||||
textFbo.inAction(camera, App.batch) {
|
||||
App.batch.inUse {
|
||||
|
||||
|
||||
blendNormal(AppLoader.batch)
|
||||
AppLoader.fontGame
|
||||
blendNormal(App.batch)
|
||||
App.fontGame
|
||||
it.color = Color.WHITE
|
||||
|
||||
|
||||
AppLoader.fontGame.draw(it, textToPrint, ((textFbo.width - textWidth) / 2).toInt().toFloat(), 0f)
|
||||
App.fontGame.draw(it, textToPrint, ((textFbo.width - textWidth) / 2).toInt().toFloat(), 0f)
|
||||
|
||||
|
||||
blendMul(AppLoader.batch)
|
||||
blendMul(App.batch)
|
||||
// draw colour overlay, flipped
|
||||
it.draw(textOverlayTex,
|
||||
(textFbo.width - textWidth) / 2f,
|
||||
AppLoader.fontGame.lineHeight,
|
||||
App.fontGame.lineHeight,
|
||||
textWidth,
|
||||
-AppLoader.fontGame.lineHeight
|
||||
-App.fontGame.lineHeight
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AppLoader.batch.inUse {
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH) // dunno, no render without this
|
||||
App.batch.inUse {
|
||||
initViewPort(App.scr.width, App.scr.height) // dunno, no render without this
|
||||
it.projectionMatrix = camera.combined
|
||||
blendNormal(AppLoader.batch)
|
||||
blendNormal(App.batch)
|
||||
|
||||
|
||||
// almost black background
|
||||
it.color = Color(0x181818ff)
|
||||
it.fillRect(0f, 0f, AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
it.fillRect(0f, 0f, App.scr.wf, App.scr.hf)
|
||||
|
||||
|
||||
it.color = Color.WHITE
|
||||
@@ -184,52 +184,52 @@ object SanicLoadScreen : LoadScreenBase() {
|
||||
|
||||
// message backgrounds
|
||||
it.color = messageBackgroundColour
|
||||
it.fillRect(0f, 60f, AppLoader.screenSize.screenWf, 40f + (messages.size) * AppLoader.fontGame.lineHeight)
|
||||
it.fillRect(0f, 60f, App.scr.wf, 40f + (messages.size) * App.fontGame.lineHeight)
|
||||
|
||||
// log messages
|
||||
it.color = messageForegroundColour
|
||||
messages.reversed().forEachIndexed { i, s ->
|
||||
AppLoader.fontGame.draw(it,
|
||||
App.fontGame.draw(it,
|
||||
s,
|
||||
AppLoader.screenSize.tvSafeGraphicsWidth + 16f,
|
||||
80f + (messages.size - i - 1) * AppLoader.fontGame.lineHeight
|
||||
App.scr.tvSafeGraphicsWidth + 16f,
|
||||
80f + (messages.size - i - 1) * App.fontGame.lineHeight
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
AppLoader.batch.inUse {
|
||||
App.batch.inUse {
|
||||
// recycling part of the draw code //
|
||||
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH) // dunno, no render without this
|
||||
initViewPort(App.scr.width, App.scr.height) // dunno, no render without this
|
||||
it.projectionMatrix = camera.combined
|
||||
blendNormal(AppLoader.batch)
|
||||
blendNormal(App.batch)
|
||||
|
||||
|
||||
|
||||
// message backgrounds
|
||||
it.color = messageBackgroundColour
|
||||
it.fillRect(0f, 60f, AppLoader.screenSize.screenWf, 40f + (messages.size) * AppLoader.fontGame.lineHeight)
|
||||
it.fillRect(0f, 60f, App.scr.wf, 40f + (messages.size) * App.fontGame.lineHeight)
|
||||
|
||||
// log messages
|
||||
it.color = messageForegroundColour
|
||||
messages.reversed().forEachIndexed { i, s ->
|
||||
AppLoader.fontGame.draw(it,
|
||||
App.fontGame.draw(it,
|
||||
s,
|
||||
AppLoader.screenSize.tvSafeGraphicsWidth + 16f,
|
||||
80f + (messages.size - i - 1) * AppLoader.fontGame.lineHeight
|
||||
App.scr.tvSafeGraphicsWidth + 16f,
|
||||
80f + (messages.size - i - 1) * App.fontGame.lineHeight
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
AppLoader.batch.flush()
|
||||
App.batch.flush()
|
||||
}
|
||||
|
||||
|
||||
// replaces super.render()
|
||||
if (doContextChange) {
|
||||
Thread.sleep(80)
|
||||
AppLoader.setScreen(screenToLoad!!)
|
||||
App.setScreen(screenToLoad!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.jme3.math.FastMath
|
||||
import net.torvald.UnsafeHelper
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.AppLoader.*
|
||||
import net.torvald.terrarum.App.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
@@ -129,7 +129,7 @@ object Terrarum : Disposable {
|
||||
println("[Terrarum] init called by:")
|
||||
printStackTrace(this)
|
||||
|
||||
println("[Terrarum] ${AppLoader.GAME_NAME} version ${AppLoader.getVERSION_STRING()}")
|
||||
println("[Terrarum] ${App.GAME_NAME} version ${App.getVERSION_STRING()}")
|
||||
println("[Terrarum] LibGDX version ${com.badlogic.gdx.Version.VERSION}")
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ object Terrarum : Disposable {
|
||||
println("[Terrarum] vendor = $processorVendor")
|
||||
|
||||
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
|
||||
|
||||
|
||||
@@ -199,8 +199,8 @@ object Terrarum : Disposable {
|
||||
//shapeRender = ShapeRenderer()
|
||||
|
||||
|
||||
AppLoader.GAME_LOCALE = getConfigString("language")
|
||||
printdbg(this, "locale = ${AppLoader.GAME_LOCALE}")
|
||||
App.GAME_LOCALE = getConfigString("language")
|
||||
printdbg(this, "locale = ${App.GAME_LOCALE}")
|
||||
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ object Terrarum : Disposable {
|
||||
|
||||
|
||||
// title screen
|
||||
AppLoader.setScreen(TitleScreen(batch))
|
||||
App.setScreen(TitleScreen(batch))
|
||||
}
|
||||
|
||||
/** Don't call this! Call AppLoader.dispose() */
|
||||
@@ -339,7 +339,7 @@ inline fun FrameBuffer.inAction(camera: OrthographicCamera?, batch: SpriteBatch?
|
||||
//this.end()
|
||||
FrameBufferManager.end()
|
||||
|
||||
camera?.setToOrtho(true, AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
camera?.setToOrtho(true, App.scr.wf, App.scr.hf)
|
||||
camera?.update()
|
||||
batch?.projectionMatrix = camera?.combined
|
||||
}
|
||||
@@ -347,10 +347,10 @@ inline fun FrameBuffer.inAction(camera: OrthographicCamera?, batch: SpriteBatch?
|
||||
|
||||
// ShapeRenderer alternative for rects
|
||||
fun SpriteBatch.fillRect(x: Float, y: Float, w: Float, h: Float) {
|
||||
this.draw(AppLoader.textureWhiteSquare, x, y, w, h)
|
||||
this.draw(App.textureWhiteSquare, x, y, w, h)
|
||||
}
|
||||
fun SpriteBatch.fillCircle(x: Float, y: Float, w: Float, h: Float) {
|
||||
this.draw(AppLoader.textureWhiteCircle, x, y, w, h)
|
||||
this.draw(App.textureWhiteCircle, x, y, w, h)
|
||||
}
|
||||
fun SpriteBatch.drawStraightLine(x: Float, y: Float, otherEnd: Float, thickness: Float, isVertical: Boolean) {
|
||||
if (!isVertical)
|
||||
@@ -589,7 +589,7 @@ fun <T> List<T>.linearSearchBy(selector: (T) -> Boolean): T? {
|
||||
inline fun printStackTrace(obj: Any) = printStackTrace(obj, System.out) // because of Java
|
||||
|
||||
fun printStackTrace(obj: Any, out: PrintStream = System.out) {
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
||||
if (App.IS_DEVELOPMENT_BUILD) {
|
||||
Thread.currentThread().stackTrace.forEachIndexed { index, it ->
|
||||
if (index >= 3)
|
||||
out.println("[${obj.javaClass.simpleName}] ... $it")
|
||||
|
||||
@@ -12,37 +12,37 @@ class TerrarumScreenSize(scrw: Int = defaultW, scrh: Int = defaultH) {
|
||||
const val TV_SAFE_ACTION = 0.035f // as per EBU recommendation (https://tech.ebu.ch/docs/r/r095.pdf)
|
||||
}
|
||||
|
||||
var screenW: Int = 0; private set
|
||||
var screenH: Int = 0; private set
|
||||
var screenWf: Float = 0f; private set
|
||||
var screenHf: Float = 0f; private set
|
||||
var halfScreenW: Int = 0; private set
|
||||
var halfScreenH: Int = 0; private set
|
||||
var halfScreenWf: Float = 0f; private set
|
||||
var halfScreenHf: Float = 0f; private set
|
||||
var width: Int = 0; private set
|
||||
var height: Int = 0; private set
|
||||
var wf: Float = 0f; private set
|
||||
var hf: Float = 0f; private set
|
||||
var halfw: Int = 0; private set
|
||||
var halfh: Int = 0; private set
|
||||
var halfwf: Float = 0f; private set
|
||||
var halfhf: Float = 0f; private set
|
||||
var aspectRatio: Float = 0f; private set
|
||||
|
||||
|
||||
|
||||
val tvSafeGraphicsWidth: Int; get() = Math.round(screenW * TV_SAFE_GRAPHICS)
|
||||
val tvSafeGraphicsHeight: Int; get() = Math.round(screenH * TV_SAFE_GRAPHICS)
|
||||
val tvSafeActionWidth: Int; get() = Math.round(screenW * TV_SAFE_ACTION)
|
||||
val tvSafeActionHeight: Int; get() = Math.round(screenH * TV_SAFE_ACTION)
|
||||
val tvSafeGraphicsWidth: Int; get() = Math.round(width * TV_SAFE_GRAPHICS)
|
||||
val tvSafeGraphicsHeight: Int; get() = Math.round(height * TV_SAFE_GRAPHICS)
|
||||
val tvSafeActionWidth: Int; get() = Math.round(width * TV_SAFE_ACTION)
|
||||
val tvSafeActionHeight: Int; get() = Math.round(height * TV_SAFE_ACTION)
|
||||
|
||||
init {
|
||||
setDimension(maxOf(minimumW, scrw), maxOf(minimumH, scrh))
|
||||
}
|
||||
|
||||
fun setDimension(scrw: Int, scrh: Int) {
|
||||
screenW = scrw and 0x7FFFFFFE
|
||||
screenH = scrh and 0x7FFFFFFE
|
||||
screenWf = scrw.toFloat()
|
||||
screenHf = scrh.toFloat()
|
||||
halfScreenW = screenW / 2
|
||||
halfScreenH = screenH / 2
|
||||
halfScreenWf = screenWf / 2f
|
||||
halfScreenHf = screenHf / 2f
|
||||
aspectRatio = screenWf / screenHf
|
||||
width = scrw and 0x7FFFFFFE
|
||||
height = scrh and 0x7FFFFFFE
|
||||
wf = scrw.toFloat()
|
||||
hf = scrh.toFloat()
|
||||
halfw = width / 2
|
||||
halfh = height / 2
|
||||
halfwf = wf / 2f
|
||||
halfhf = hf / 2f
|
||||
aspectRatio = wf / hf
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
||||
|
||||
fun enter() {
|
||||
// init view port
|
||||
camera = OrthographicCamera(AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
camera = OrthographicCamera(App.scr.wf, App.scr.hf)
|
||||
|
||||
|
||||
img = Texture("assets/test_texture.tga")
|
||||
@@ -57,14 +57,14 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
||||
blurFboA = FrameBuffer(Pixmap.Format.RGBA8888, img.width, img.height, false)
|
||||
blurFboB = FrameBuffer(Pixmap.Format.RGBA8888, img.width, img.height, false)
|
||||
|
||||
worldFbo = FrameBuffer(Pixmap.Format.RGBA8888, AppLoader.screenSize.screenW, AppLoader.screenSize.screenH, false)
|
||||
worldFbo = FrameBuffer(Pixmap.Format.RGBA8888, App.scr.width, App.scr.height, false)
|
||||
|
||||
//blurShader.begin()
|
||||
//blurShader.setUniformf("iResolution", img.width.toFloat(), img.height.toFloat(), 0f)
|
||||
//blurShader.end()
|
||||
|
||||
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
initViewPort(App.scr.width, App.scr.height)
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
@@ -135,7 +135,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
||||
batch.inUse {
|
||||
batch.shader = null
|
||||
|
||||
camera.position.set(AppLoader.screenSize.screenW / 2f - 50f, AppLoader.screenSize.screenH / 2f - 50f, 0f)
|
||||
camera.position.set(App.scr.width / 2f - 50f, App.scr.height / 2f - 50f, 0f)
|
||||
camera.update()
|
||||
batch.projectionMatrix = camera.combined
|
||||
|
||||
@@ -147,11 +147,11 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
||||
}
|
||||
|
||||
|
||||
camera.setToOrtho(true, AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
camera.setToOrtho(true, App.scr.wf, App.scr.hf)
|
||||
batch.projectionMatrix = camera.combined
|
||||
batch.inUse {
|
||||
|
||||
camera.position.set(AppLoader.screenSize.screenW / 2f, AppLoader.screenSize.screenH / 2f, 0f)
|
||||
camera.position.set(App.scr.width / 2f, App.scr.height / 2f, 0f)
|
||||
camera.update()
|
||||
batch.projectionMatrix = camera.combined
|
||||
|
||||
@@ -168,7 +168,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
||||
}
|
||||
|
||||
override fun show() {
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
initViewPort(App.scr.width, App.scr.height)
|
||||
}
|
||||
|
||||
override fun pause() {
|
||||
|
||||
@@ -5,12 +5,13 @@ import com.badlogic.gdx.InputAdapter
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||
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 com.jme3.math.FastMath
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.App.printdbgerr
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.console.CommandDict
|
||||
@@ -39,7 +40,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
// todo register titlescreen as the ingame, similar in a way that the buildingmaker did
|
||||
|
||||
var camera = OrthographicCamera(AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
var camera = OrthographicCamera(App.scr.wf, App.scr.hf)
|
||||
|
||||
|
||||
// invert Y
|
||||
@@ -160,6 +161,15 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
IngameRenderer.setRenderedWorld(demoWorld)
|
||||
|
||||
|
||||
// load a half-gradient texture that would be used throughout the titlescreen and its sub UIs
|
||||
CommonResourcePool.addToLoadingList("title_halfgrad") { Texture(Gdx.files.internal("./assets/graphics/halfgrad.png")) }
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
|
||||
// fake UI for gradient overlay
|
||||
val uiFakeGradOverlay = UIFakeGradOverlay()
|
||||
|
||||
|
||||
uiMenu = UIRemoCon(UITitleRemoConYaml())//UITitleRemoConRoot()
|
||||
uiMenu.setPosition(0, 0)
|
||||
uiMenu.setAsOpen()
|
||||
@@ -181,13 +191,13 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
override fun show() {
|
||||
printdbg(this, "show() called")
|
||||
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
initViewPort(App.scr.width, App.scr.height)
|
||||
|
||||
|
||||
Gdx.input.inputProcessor = TitleScreenController(this)
|
||||
|
||||
|
||||
worldFBO = FrameBuffer(Pixmap.Format.RGBA8888, AppLoader.screenSize.screenW, AppLoader.screenSize.screenH, false)
|
||||
worldFBO = FrameBuffer(Pixmap.Format.RGBA8888, App.scr.width, App.scr.height, false)
|
||||
|
||||
loadThingsWhileIntroIsVisible()
|
||||
|
||||
@@ -214,15 +224,15 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
var i = 0L
|
||||
while (updateAkku >= updateRate) {
|
||||
AppLoader.measureDebugTime("Ingame.Update") { updateScreen(updateRate) }
|
||||
App.measureDebugTime("Ingame.Update") { updateScreen(updateRate) }
|
||||
updateAkku -= updateRate
|
||||
i += 1
|
||||
}
|
||||
AppLoader.setDebugTime("Ingame.UpdateCounter", i)
|
||||
App.setDebugTime("Ingame.UpdateCounter", i)
|
||||
|
||||
|
||||
// render? just do it anyway
|
||||
AppLoader.measureDebugTime("Ingame.Render") { renderScreen() }
|
||||
App.measureDebugTime("Ingame.Render") { renderScreen() }
|
||||
}
|
||||
|
||||
fun updateScreen(delta: Float) {
|
||||
@@ -278,14 +288,14 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
)
|
||||
|
||||
COPYTING.forEachIndexed { index, s ->
|
||||
val textWidth = AppLoader.fontGame.getWidth(s)
|
||||
AppLoader.fontGame.draw(batch, s,
|
||||
(AppLoader.screenSize.screenW - textWidth - 1f).toInt().toFloat(),
|
||||
(AppLoader.screenSize.screenH - AppLoader.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat()
|
||||
val textWidth = App.fontGame.getWidth(s)
|
||||
App.fontGame.draw(batch, s,
|
||||
(App.scr.width - textWidth - 1f).toInt().toFloat(),
|
||||
(App.scr.height - App.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat()
|
||||
)
|
||||
}
|
||||
|
||||
AppLoader.fontGame.draw(batch, PostProcessor.thisIsDebugStr, 5f, AppLoader.screenSize.screenH - 24f)
|
||||
App.fontGame.draw(batch, PostProcessor.thisIsDebugStr, 5f, App.scr.height - 24f)
|
||||
|
||||
}
|
||||
|
||||
@@ -301,11 +311,11 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
printStackTrace(this)
|
||||
|
||||
// Set up viewport when window is resized
|
||||
initViewPort(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
initViewPort(App.scr.width, App.scr.height)
|
||||
|
||||
|
||||
// resize UI by re-creating it (!!)
|
||||
uiMenu.resize(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
uiMenu.resize(App.scr.width, App.scr.height)
|
||||
// TODO I forgot what the fuck kind of hack I was talking about
|
||||
//uiMenu.setPosition(0, UITitleRemoConRoot.menubarOffY)
|
||||
uiMenu.setPosition(0, 0) // shitty hack. Could be:
|
||||
@@ -313,7 +323,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// 2: The UI is coded shit
|
||||
|
||||
|
||||
IngameRenderer.resize(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
IngameRenderer.resize(App.scr.width, App.scr.height)
|
||||
|
||||
printdbg(this, "resize() exit")
|
||||
}
|
||||
|
||||
42
src/net/torvald/terrarum/UIFakeGradOverlay.kt
Normal file
42
src/net/torvald/terrarum/UIFakeGradOverlay.kt
Normal file
@@ -0,0 +1,42 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-09-09.
|
||||
*/
|
||||
class UIFakeGradOverlay : UICanvas() {
|
||||
|
||||
override var width: Int
|
||||
get() = App.scr.width
|
||||
set(value) {}
|
||||
|
||||
override var height: Int
|
||||
get() = App.scr.height
|
||||
set(value) {}
|
||||
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
private val tex = CommonResourcePool.getAsTexture("title_halfgrad")
|
||||
|
||||
init {
|
||||
setAsAlwaysVisible()
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {}
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
gdxSetBlendMul()
|
||||
|
||||
batch.draw(tex, 0f, 0f, App.scr.wf, App.scr.hf)
|
||||
|
||||
gdxSetBlendNormal()
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {}
|
||||
override fun doClosing(delta: Float) {}
|
||||
override fun endOpening(delta: Float) {}
|
||||
override fun endClosing(delta: Float) {}
|
||||
override fun dispose() {}
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
|
||||
@@ -108,7 +103,7 @@ class UIItemInventoryElem(
|
||||
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
|
||||
// draw name of the item
|
||||
if (INVEN_DEBUG_MODE) {
|
||||
AppLoader.fontGame.draw(batch,
|
||||
App.fontGame.draw(batch,
|
||||
// print static id, dynamic id, and count
|
||||
"${item!!.originalID}/${item!!.dynamicID}" + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else ""),
|
||||
posX + textOffsetX,
|
||||
@@ -116,7 +111,7 @@ class UIItemInventoryElem(
|
||||
)
|
||||
}
|
||||
else {
|
||||
AppLoader.fontGame.draw(batch,
|
||||
App.fontGame.draw(batch,
|
||||
// print name and amount in parens
|
||||
item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else "") +
|
||||
// TEMPORARY print eqipped slot info as well
|
||||
@@ -147,8 +142,8 @@ class UIItemInventoryElem(
|
||||
|
||||
if (quickslot != null) {
|
||||
val label = quickslot!!.plus(0xE010).toChar()
|
||||
val labelW = AppLoader.fontGame.getWidth("$label")
|
||||
AppLoader.fontGame.draw(batch, "$label", barOffset + barFullLen - labelW, posY + textOffsetY)
|
||||
val labelW = App.fontGame.getWidth("$label")
|
||||
App.fontGame.draw(batch, "$label", barOffset + barFullLen - labelW, posY + textOffsetY)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.toItemCountText
|
||||
@@ -117,10 +112,10 @@ class UIItemInventoryElemSimple(
|
||||
}
|
||||
|
||||
|
||||
AppLoader.fontSmallNumbers.draw(batch,
|
||||
App.fontSmallNumbers.draw(batch,
|
||||
amountString,
|
||||
posX + (width - AppLoader.fontSmallNumbers.getWidth(amountString)).toFloat(),
|
||||
posY + (height - AppLoader.fontSmallNumbers.H).toFloat()
|
||||
posX + (width - App.fontSmallNumbers.getWidth(amountString)).toFloat(),
|
||||
posY + (height - App.fontSmallNumbers.H).toFloat()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package net.torvald.terrarum.blockproperties
|
||||
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.printmsg
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.App.printmsg
|
||||
import net.torvald.terrarum.ReferencingRanges.PREFIX_VIRTUALTILE
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.gameworld.FluidType
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.utils.CSVFetcher
|
||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||
import net.torvald.util.SortedArrayList
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
import java.io.IOException
|
||||
@@ -61,7 +59,7 @@ class BlockCodex {
|
||||
* Later entry (possible from other modules) will replace older ones
|
||||
*/
|
||||
internal constructor(module: String, path: String) : this() {
|
||||
AppLoader.printmsg(this, "Building block properties table")
|
||||
App.printmsg(this, "Building block properties table")
|
||||
try {
|
||||
register(module, CSVFetcher.readFromModule(module, path))
|
||||
}
|
||||
@@ -69,7 +67,7 @@ class BlockCodex {
|
||||
}
|
||||
|
||||
fun fromCSV(module: String, csvString: String) {
|
||||
AppLoader.printmsg(this, "Building wire properties table for module $module")
|
||||
App.printmsg(this, "Building wire properties table for module $module")
|
||||
|
||||
val csvParser = org.apache.commons.csv.CSVParser.parse(
|
||||
csvString,
|
||||
|
||||
@@ -39,7 +39,7 @@ class WireCodex {
|
||||
* @param path to the "wires" directory, not path to the CSV; must end with a slash!
|
||||
*/
|
||||
internal constructor(module: String, path: String) : this() {
|
||||
AppLoader.printmsg(this, "Building wire properties table for module $module")
|
||||
App.printmsg(this, "Building wire properties table for module $module")
|
||||
try {
|
||||
register(module, path, CSVFetcher.readFromModule(module, path + "wires.csv"))
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class WireCodex {
|
||||
}
|
||||
|
||||
fun fromCSV(module: String, path: String, csvString: String) {
|
||||
AppLoader.printmsg(this, "Building wire properties table for module $module")
|
||||
App.printmsg(this, "Building wire properties table for module $module")
|
||||
|
||||
val csvParser = org.apache.commons.csv.CSVParser.parse(
|
||||
csvString,
|
||||
@@ -64,7 +64,7 @@ class WireCodex {
|
||||
setProp(module, it.intVal("id"), it)
|
||||
}
|
||||
|
||||
AppLoader.printmsg(this, "Registering wire textures into the resource pool")
|
||||
App.printmsg(this, "Registering wire textures into the resource pool")
|
||||
wireProps.keys.forEach { id ->
|
||||
val wireid = id.split(':').last().toInt()
|
||||
|
||||
@@ -148,6 +148,6 @@ class WireCodex {
|
||||
val loadedClassInstance = loadedClassConstructor.newInstance(prop.id, invImgSheet, invImgX, invImgY)
|
||||
ItemCodex[prop.id] = loadedClassInstance as GameItem
|
||||
|
||||
AppLoader.printmsg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}")
|
||||
App.printmsg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}")
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
package net.torvald.terrarum.blockstats
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -31,8 +29,8 @@ object BlockStats {
|
||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||
if (player == null) return
|
||||
|
||||
val renderWidth = FastMath.ceil(AppLoader.screenSize.screenWf)
|
||||
val renderHeight = FastMath.ceil(AppLoader.screenSize.screenHf)
|
||||
val renderWidth = FastMath.ceil(App.scr.wf)
|
||||
val renderHeight = FastMath.ceil(App.scr.hf)
|
||||
|
||||
val noZoomCameraX = Math.round(FastMath.clamp(
|
||||
player.hitbox.centeredX.toFloat() - renderWidth / 2, TILE_SIZEF, map.width * TILE_SIZE - renderWidth - TILE_SIZEF))
|
||||
|
||||
@@ -5,12 +5,9 @@ import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import com.badlogic.gdx.utils.Queue
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
|
||||
object MinimapComposer : Disposable {
|
||||
|
||||
@@ -22,7 +19,7 @@ object MinimapComposer : Disposable {
|
||||
fun setWorld(world: GameWorld) {
|
||||
try {
|
||||
if (this.world != world) {
|
||||
AppLoader.printdbg(this, "World change detected -- old world: ${this.world.hashCode()}, new world: ${world.hashCode()}")
|
||||
App.printdbg(this, "World change detected -- old world: ${this.world.hashCode()}, new world: ${world.hashCode()}")
|
||||
|
||||
// TODO, also set totalWidth/Height
|
||||
}
|
||||
@@ -59,7 +56,7 @@ object MinimapComposer : Disposable {
|
||||
private val liveTilesMeta = Array(TILES_IN_X * TILES_IN_Y) { LiveTileMeta(revalidate = true) }
|
||||
|
||||
private val updaterQueue = Queue<Runnable>(TILES_IN_X * TILES_IN_Y * 2)
|
||||
private var currentThreads = Array(maxOf(1, AppLoader.THREAD_COUNT.times(2).div(3))) {
|
||||
private var currentThreads = Array(maxOf(1, App.THREAD_COUNT.times(2).div(3))) {
|
||||
Thread()
|
||||
}
|
||||
|
||||
@@ -67,7 +64,7 @@ object MinimapComposer : Disposable {
|
||||
totalWidth = minimap.width
|
||||
totalHeight = minimap.height
|
||||
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
}
|
||||
|
||||
fun update() {
|
||||
@@ -136,8 +133,8 @@ object MinimapComposer : Disposable {
|
||||
for (x in if (tileSlotIndexY >= TILES_IN_X / 2) (topLeftX + LIVETILE_SIZE - 1) downTo topLeftX else topLeftX until topLeftX + LIVETILE_SIZE) {
|
||||
val tileTerr = world.getTileFromTerrain(x, y)
|
||||
val wallTerr = world.getTileFromWall(x, y)
|
||||
val colTerr = AppLoader.tileMaker.terrainTileColourMap.get(tileTerr)!!.toGdxColor()
|
||||
val colWall = AppLoader.tileMaker.terrainTileColourMap.get(wallTerr)!!.toGdxColor().mul(AppLoader.tileMaker.wallOverlayColour)
|
||||
val colTerr = App.tileMaker.terrainTileColourMap.get(tileTerr)!!.toGdxColor()
|
||||
val colWall = App.tileMaker.terrainTileColourMap.get(wallTerr)!!.toGdxColor().mul(App.tileMaker.wallOverlayColour)
|
||||
|
||||
val outCol = if (colTerr.a > 0.1f) colTerr else colWall
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.App.printdbgerr
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.ModMgr.loadOrder
|
||||
import net.torvald.terrarum.modulebasegame.console.*
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
import java.util.*
|
||||
import kotlin.streams.toList
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-15.
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.TerrarumScreenSize
|
||||
|
||||
@ConsoleAlias("resize")
|
||||
object ResizeScreen: ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 3) {
|
||||
AppLoader.resizeScreen(args[1].toInt(), args[2].toInt())
|
||||
App.resizeScreen(args[1].toInt(), args[2].toInt())
|
||||
}
|
||||
else if (args.size == 2) {
|
||||
when (args[1]) {
|
||||
"720p" -> AppLoader.resizeScreen(1280,720)
|
||||
"1080p" -> AppLoader.resizeScreen(1920,1080)
|
||||
"default" -> AppLoader.resizeScreen(TerrarumScreenSize.defaultW, TerrarumScreenSize.defaultH)
|
||||
"720p" -> App.resizeScreen(1280,720)
|
||||
"1080p" -> App.resizeScreen(1920,1080)
|
||||
"default" -> App.resizeScreen(TerrarumScreenSize.defaultW, TerrarumScreenSize.defaultH)
|
||||
else -> { printUsage(); return }
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ object ResizeScreen: ConsoleCommand {
|
||||
printUsage(); return
|
||||
}
|
||||
|
||||
Echo("Screen resized to ${AppLoader.screenSize.screenW}x${AppLoader.screenSize.screenH}")
|
||||
Echo("Screen resized to ${App.scr.width}x${App.scr.height}")
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.console
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import net.torvald.gdx.graphics.PixmapIO2
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ccG
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
|
||||
@@ -15,7 +15,7 @@ object ScreencapNogui: ConsoleCommand {
|
||||
val w = 960
|
||||
val h = 640
|
||||
val p = Pixmap.createFromFrameBuffer((it.width - w).ushr(1), (it.height - h).ushr(1), w, h)
|
||||
PixmapIO2.writeTGA(Gdx.files.absolute(AppLoader.defaultDir + "/Exports/${args[1]}.tga"), p, true)
|
||||
PixmapIO2.writeTGA(Gdx.files.absolute(App.defaultDir + "/Exports/${args[1]}.tga"), p, true)
|
||||
p.dispose()
|
||||
}
|
||||
IngameRenderer.fboRGBexportRequested = true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
@@ -11,14 +11,14 @@ import java.io.IOException
|
||||
internal object SetLocale : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
val prevLocale = AppLoader.GAME_LOCALE
|
||||
AppLoader.GAME_LOCALE = args[1]
|
||||
val prevLocale = App.GAME_LOCALE
|
||||
App.GAME_LOCALE = args[1]
|
||||
try {
|
||||
Echo("Set locale to '" + AppLoader.GAME_LOCALE + "'.")
|
||||
Echo("Set locale to '" + App.GAME_LOCALE + "'.")
|
||||
}
|
||||
catch (e: IOException) {
|
||||
Echo("could not read lang file.")
|
||||
AppLoader.GAME_LOCALE = prevLocale
|
||||
App.GAME_LOCALE = prevLocale
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.torvald.terrarum.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
|
||||
@ConsoleNoExport
|
||||
object TakeScreenshot: ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
AppLoader.requestScreenshot()
|
||||
App.requestScreenshot()
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.console
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.langpack.Lang
|
||||
internal object Version : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
Echo("${AppLoader.GAME_NAME} ${AppLoader.getVERSION_STRING()}")
|
||||
Echo("${App.GAME_NAME} ${App.getVERSION_STRING()}")
|
||||
Echo("Java version: ${System.getProperty("java.version")}")
|
||||
Echo("Polyglot language pack version: ${Lang.POLYGLOT_VERSION}")
|
||||
Echo("GL version: ${Terrarum.GL_VERSION}")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.controller
|
||||
|
||||
import net.torvald.terrarum.AppLoader.gamepadDeadzone
|
||||
import net.torvald.terrarum.AppLoader.getConfigDoubleArray
|
||||
import net.torvald.terrarum.App.gamepadDeadzone
|
||||
import net.torvald.terrarum.App.getConfigDoubleArray
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2019-02-09.
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.controller
|
||||
|
||||
import com.github.strikerx3.jxinput.XInputAxes
|
||||
import com.github.strikerx3.jxinput.XInputDevice
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
@@ -26,8 +26,8 @@ class XinputControllerAdapter(val c: XInputDevice): TerrarumController {
|
||||
5 -> button.rShoulder
|
||||
6 -> button.back
|
||||
7 -> button.start
|
||||
8 -> getAxis(4) >= AppLoader.gamepadDeadzone
|
||||
9 -> getAxis(5) >= AppLoader.gamepadDeadzone
|
||||
8 -> getAxis(4) >= App.gamepadDeadzone
|
||||
9 -> getAxis(5) >= App.gamepadDeadzone
|
||||
10 -> button.lThumb
|
||||
11 -> button.rThumb
|
||||
else -> throw UnsupportedOperationException("Unknown button: $index")
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.spriteanimation.HasAssembledSprite
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.App.printdbgerr
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
@@ -376,7 +376,7 @@ open class ActorWithBody : Actor {
|
||||
val feetPosTile: Point2i = Point2i(0,0)
|
||||
//get() = Point2i(hIntTilewiseHitbox.centeredX.floorInt(), hIntTilewiseHitbox.endY.floorInt())
|
||||
|
||||
override fun run() = update(AppLoader.UPDATE_RATE)
|
||||
override fun run() = update(App.UPDATE_RATE)
|
||||
|
||||
/**
|
||||
* Add vector value to the velocity, in the time unit of single frame.
|
||||
|
||||
@@ -7,9 +7,9 @@ import com.badlogic.gdx.InputAdapter
|
||||
import com.badlogic.gdx.controllers.Controllers
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.App.printdbgerr
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.controller.TerrarumController
|
||||
import net.torvald.terrarum.floorInt
|
||||
@@ -130,8 +130,8 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
// also, some UIs should NOT affect item usage (e.g. quickslot) and ingame's uiOpened property is doing
|
||||
// the very job.
|
||||
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) && !worldPrimaryClickLatched) {
|
||||
terrarumIngame.worldPrimaryClickStart(AppLoader.UPDATE_RATE)
|
||||
if (Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary")) && !worldPrimaryClickLatched) {
|
||||
terrarumIngame.worldPrimaryClickStart(App.UPDATE_RATE)
|
||||
worldPrimaryClickLatched = true
|
||||
}
|
||||
/*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary")) {
|
||||
@@ -141,7 +141,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
// unlatch when:
|
||||
// - not clicking anymore
|
||||
// - using any item that is not fixture (blocks, picks)
|
||||
if (!Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) ||
|
||||
if (!Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary")) ||
|
||||
GameItem.Category.FIXTURE != ItemCodex.get(terrarumIngame.actorNowPlaying?.inventory?.itemEquipped?.get(GameItem.EquipPosition.HAND_GRIP))?.inventoryCategory) {
|
||||
worldPrimaryClickLatched = false
|
||||
}
|
||||
@@ -160,14 +160,14 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
terrarumIngame.actorNowPlaying?.keyDown(keycode)
|
||||
|
||||
// quickslot by number keys
|
||||
val quickslotKeys = AppLoader.getConfigIntArray("config_keyquickslots")
|
||||
val quickslotKeys = App.getConfigIntArray("config_keyquickslots")
|
||||
if (keycode in quickslotKeys) {
|
||||
terrarumIngame.actorNowPlaying?.actorValue?.set(AVKey.__PLAYER_QUICKSLOTSEL, quickslotKeys.indexOf(keycode))
|
||||
}
|
||||
|
||||
// pie menu
|
||||
if (AppLoader.getConfigIntArray("config_keyquickselalt").contains(keycode)
|
||||
|| keycode == AppLoader.getConfigInt("config_keyquicksel")) {
|
||||
if (App.getConfigIntArray("config_keyquickselalt").contains(keycode)
|
||||
|| keycode == App.getConfigInt("config_keyquicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsOpen()
|
||||
terrarumIngame.uiQuickBar.setAsClose()
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
|
||||
// screenshot key
|
||||
if (keycode == Input.Keys.F12 && !f12Down) {
|
||||
AppLoader.requestScreenshot()
|
||||
App.requestScreenshot()
|
||||
f12Down = true
|
||||
println("Screenshot taken.")
|
||||
}
|
||||
@@ -192,8 +192,8 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
}
|
||||
|
||||
private fun tKeyUp(keycode: Int): Boolean {
|
||||
if (AppLoader.getConfigIntArray("config_keyquickselalt").contains(keycode)
|
||||
|| keycode == AppLoader.getConfigInt("config_keyquicksel")) {
|
||||
if (App.getConfigIntArray("config_keyquickselalt").contains(keycode)
|
||||
|| keycode == App.getConfigInt("config_keyquicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsClose()
|
||||
terrarumIngame.uiQuickBar.setAsOpen()
|
||||
}
|
||||
@@ -219,9 +219,9 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
if (terrarumIngame.uiContainer.map { if ((it?.isOpening == true || it?.isOpened == true) && it.mouseUp) 1 else 0 }.sum() == 0) { // no UI on the mouse, right?
|
||||
|
||||
if (
|
||||
button == AppLoader.getConfigInt("config_mouseprimary") ||
|
||||
button == AppLoader.getConfigInt("config_mousesecondary")) {
|
||||
terrarumIngame.worldPrimaryClickEnd(AppLoader.UPDATE_RATE)
|
||||
button == App.getConfigInt("config_mouseprimary") ||
|
||||
button == App.getConfigInt("config_mousesecondary")) {
|
||||
terrarumIngame.worldPrimaryClickEnd(App.UPDATE_RATE)
|
||||
}
|
||||
/*if (button == AppLoader.getConfigInt("config_mousesecondary")) {
|
||||
ingame.worldSecondaryClickEnd(AppLoader.UPDATE_RATE)
|
||||
@@ -230,7 +230,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
}
|
||||
|
||||
// pie menu
|
||||
if (button == AppLoader.getConfigInt("config_mousequicksel")) {
|
||||
if (button == App.getConfigInt("config_mousequicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsClose()
|
||||
terrarumIngame.uiQuickBar.setAsOpen()
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
terrarumIngame.uiContainer.forEach { it?.touchDown(screenX, screenY, pointer, button) }
|
||||
|
||||
// pie menu
|
||||
if (button == AppLoader.getConfigInt("config_mousequicksel")) {
|
||||
if (button == App.getConfigInt("config_mousequicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsOpen()
|
||||
terrarumIngame.uiQuickBar.setAsClose()
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.gameactors.Hitbox
|
||||
import org.dyn4j.geometry.Vector2
|
||||
@@ -20,7 +18,7 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
|
||||
/** Will NOT actually delete from the CircularArray */
|
||||
@Volatile var flagDespawn = false
|
||||
|
||||
override fun run() = update(AppLoader.UPDATE_RATE)
|
||||
override fun run() = update(App.UPDATE_RATE)
|
||||
|
||||
var isNoSubjectToGrav = false
|
||||
var dragCoefficient = 3.0
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.gameworld
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.UnsafeHelper
|
||||
import net.torvald.UnsafePtr
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
|
||||
/**
|
||||
* Memory layout:
|
||||
|
||||
@@ -4,9 +4,8 @@ package net.torvald.terrarum.gameworld
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.Fluid
|
||||
import net.torvald.terrarum.gameactors.ActorID
|
||||
import net.torvald.terrarum.gameactors.WireActor
|
||||
@@ -36,9 +35,9 @@ class GameWorld() : Disposable {
|
||||
var width: Int = 999; private set
|
||||
var height: Int = 999; private set
|
||||
|
||||
var creationTime: Long = AppLoader.getTIME_T()
|
||||
var creationTime: Long = App.getTIME_T()
|
||||
internal set
|
||||
var lastPlayTime: Long = AppLoader.getTIME_T()
|
||||
var lastPlayTime: Long = App.getTIME_T()
|
||||
internal set // there's a case of save-and-continue-playing
|
||||
var totalPlayTime: Long = 0
|
||||
internal set
|
||||
@@ -134,7 +133,7 @@ class GameWorld() : Disposable {
|
||||
this.totalPlayTime = totalPlayTime
|
||||
|
||||
|
||||
AppLoader.tileMaker.tags.forEach {
|
||||
App.tileMaker.tags.forEach {
|
||||
printdbg(this, "tileNumber ${it.value.tileNumber} <-> tileName ${it.key}")
|
||||
|
||||
tileNumberToNameMap[it.value.tileNumber.toLong()] = it.key
|
||||
|
||||
@@ -1,30 +1,18 @@
|
||||
package net.torvald.terrarum.gameworld
|
||||
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.utils.Queue
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.Fluid
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame.Companion.inUpdateRange
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.BlockBoxIndex
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.Electric
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.FixtureBase
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
import net.torvald.util.IntArrayStack
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import org.khelekore.prtree.*
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.experimental.and
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
@@ -93,13 +81,13 @@ object WorldSimulator {
|
||||
|
||||
degrass()
|
||||
|
||||
AppLoader.measureDebugTime("WorldSimulator.fluids") {
|
||||
App.measureDebugTime("WorldSimulator.fluids") {
|
||||
//moveFluids(delta)
|
||||
}
|
||||
AppLoader.measureDebugTime("WorldSimulator.fallables") {
|
||||
App.measureDebugTime("WorldSimulator.fallables") {
|
||||
displaceFallables(delta)
|
||||
}
|
||||
AppLoader.measureDebugTime("WorldSimulator.wires") {
|
||||
App.measureDebugTime("WorldSimulator.wires") {
|
||||
simulateWires(delta)
|
||||
}
|
||||
|
||||
@@ -109,7 +97,7 @@ object WorldSimulator {
|
||||
|
||||
|
||||
fun degrass() {
|
||||
if (ingame.terrainChangeQueue.isNotEmpty()) { AppLoader.measureDebugTime("WorldSimulator.degrass") {
|
||||
if (ingame.terrainChangeQueue.isNotEmpty()) { App.measureDebugTime("WorldSimulator.degrass") {
|
||||
|
||||
//val grassPlacedByPlayer = ArrayList<IngameInstance.BlockChangeQueueItem>()
|
||||
|
||||
@@ -167,7 +155,7 @@ object WorldSimulator {
|
||||
|
||||
simCompression()
|
||||
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
||||
if (App.IS_DEVELOPMENT_BUILD) {
|
||||
monitorIllegalFluidSetup() // non-air non-zero fluid is kinda inevitable
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.torvald.terrarum.itemproperties
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.ReferencingRanges.PREFIX_ACTORITEM
|
||||
@@ -58,7 +58,7 @@ class ItemCodex {
|
||||
* @param: dynamicID string of "dyn:<random id>"
|
||||
*/
|
||||
fun registerNewDynamicItem(dynamicID: ItemID, item: GameItem) {
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
||||
if (App.IS_DEVELOPMENT_BUILD) {
|
||||
printdbg(this, "Registering new dynamic item $dynamicID (from ${item.originalID})")
|
||||
}
|
||||
dynamicItemDescription[dynamicID] = item
|
||||
@@ -121,18 +121,18 @@ class ItemCodex {
|
||||
}
|
||||
// wall
|
||||
else if (itemID.startsWith("wall@")) {
|
||||
val itemSheetNumber = AppLoader.tileMaker.tileIDtoItemSheetNumber(itemID.substring(5))
|
||||
val itemSheetNumber = App.tileMaker.tileIDtoItemSheetNumber(itemID.substring(5))
|
||||
return BlocksDrawer.tileItemWall.get(
|
||||
itemSheetNumber % AppLoader.tileMaker.ITEM_ATLAS_TILES_X,
|
||||
itemSheetNumber / AppLoader.tileMaker.ITEM_ATLAS_TILES_X
|
||||
itemSheetNumber % App.tileMaker.ITEM_ATLAS_TILES_X,
|
||||
itemSheetNumber / App.tileMaker.ITEM_ATLAS_TILES_X
|
||||
)
|
||||
}
|
||||
// terrain
|
||||
else {
|
||||
val itemSheetNumber = AppLoader.tileMaker.tileIDtoItemSheetNumber(itemID)
|
||||
val itemSheetNumber = App.tileMaker.tileIDtoItemSheetNumber(itemID)
|
||||
return BlocksDrawer.tileItemTerrain.get(
|
||||
itemSheetNumber % AppLoader.tileMaker.ITEM_ATLAS_TILES_X,
|
||||
itemSheetNumber / AppLoader.tileMaker.ITEM_ATLAS_TILES_X
|
||||
itemSheetNumber % App.tileMaker.ITEM_ATLAS_TILES_X,
|
||||
itemSheetNumber / App.tileMaker.ITEM_ATLAS_TILES_X
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.itemproperties
|
||||
|
||||
import net.torvald.terrarum.AppLoader.printmsg
|
||||
import net.torvald.terrarum.App.printmsg
|
||||
import net.torvald.terrarum.Codex
|
||||
import net.torvald.terrarum.blockproperties.floatVal
|
||||
import net.torvald.terrarum.blockproperties.intVal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.langpack
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.utils.JsonFetcher
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
@@ -120,17 +120,17 @@ object Lang {
|
||||
fun fallback(): String = langpack["${key}_$FALLBACK_LANG_CODE"] ?: "$$key"
|
||||
|
||||
|
||||
val ret = langpack["${key}_${AppLoader.GAME_LOCALE}"]
|
||||
val ret = langpack["${key}_${App.GAME_LOCALE}"]
|
||||
val ret2 = if (ret.isNullOrEmpty()) fallback() else ret!!
|
||||
|
||||
// special treatment
|
||||
if (key.startsWith("MENU_LABEL_PRESS_START_SYMBOL"))
|
||||
return ret2.replace('>', AppLoader.gamepadLabelStart).capitalize()
|
||||
return ret2.replace('>', App.gamepadLabelStart).capitalize()
|
||||
|
||||
return if (key.getEndTag().contains("bg"))
|
||||
"${AppLoader.fontGame.charsetOverrideBulgarian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideDefault}"
|
||||
"${App.fontGame.charsetOverrideBulgarian}${ret2.capitalize()}${App.fontGame.charsetOverrideDefault}"
|
||||
else if (key.getEndTag().contains("sr"))
|
||||
"${AppLoader.fontGame.charsetOverrideSerbian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideDefault}"
|
||||
"${App.fontGame.charsetOverrideSerbian}${ret2.capitalize()}${App.fontGame.charsetOverrideDefault}"
|
||||
else
|
||||
ret2.capitalize()
|
||||
}
|
||||
@@ -144,7 +144,7 @@ object Lang {
|
||||
fun pluralise(word: String, count: Int): String {
|
||||
if (count < 2) return word
|
||||
|
||||
when (AppLoader.GAME_LOCALE) {
|
||||
when (App.GAME_LOCALE) {
|
||||
"fr" -> {
|
||||
if (Arrays.binarySearch(FRENCH_WORD_NORMAL_PLURAL, word) >= 0) {
|
||||
return word + "s"
|
||||
|
||||
@@ -15,7 +15,6 @@ import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.gameworld.WorldTime
|
||||
import net.torvald.terrarum.modulebasegame.ui.Notification
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIBuildingMakerBlockChooser
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIBuildingMakerPenMenu
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIPaletteSelector
|
||||
@@ -284,11 +283,11 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
uiToolbox.isVisible = true
|
||||
uiToolbox.invocationArgument = arrayOf(this)
|
||||
|
||||
uiPaletteSelector.setPosition(AppLoader.screenSize.screenW - uiPaletteSelector.width, 0)
|
||||
uiPaletteSelector.setPosition(App.scr.width - uiPaletteSelector.width, 0)
|
||||
uiPaletteSelector.isVisible = true
|
||||
|
||||
notifier.setPosition(
|
||||
(AppLoader.screenSize.screenW - notifier.width) / 2, AppLoader.screenSize.screenH - notifier.height)
|
||||
(App.scr.width - notifier.width) / 2, App.scr.height - notifier.height)
|
||||
|
||||
|
||||
actorNowPlaying?.setPosition(512 * 16.0, 149 * 16.0)
|
||||
@@ -318,22 +317,22 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
var i = 0L
|
||||
while (updateAkku >= updateRate) {
|
||||
AppLoader.measureDebugTime("Ingame.Update") { updateGame(updateRate) }
|
||||
App.measureDebugTime("Ingame.Update") { updateGame(updateRate) }
|
||||
updateAkku -= updateRate
|
||||
i += 1
|
||||
}
|
||||
AppLoader.setDebugTime("Ingame.UpdateCounter", i)
|
||||
App.setDebugTime("Ingame.UpdateCounter", i)
|
||||
|
||||
// render? just do it anyway
|
||||
AppLoader.measureDebugTime("Ingame.Render") { renderGame() }
|
||||
AppLoader.setDebugTime("Ingame.Render - (Light + Tiling)",
|
||||
((AppLoader.debugTimers["Ingame.Render"] as? Long) ?: 0) -
|
||||
App.measureDebugTime("Ingame.Render") { renderGame() }
|
||||
App.setDebugTime("Ingame.Render - (Light + Tiling)",
|
||||
((App.debugTimers["Ingame.Render"] as? Long) ?: 0) -
|
||||
(
|
||||
((AppLoader.debugTimers["Renderer.Lanterns"] as? Long) ?: 0) +
|
||||
((AppLoader.debugTimers["Renderer.LightPrecalc"] as? Long) ?: 0) +
|
||||
((AppLoader.debugTimers["Renderer.LightRuns"] as? Long) ?: 0) +
|
||||
((AppLoader.debugTimers["Renderer.LightToScreen"] as? Long) ?: 0) +
|
||||
((AppLoader.debugTimers["Renderer.Tiling"] as? Long) ?: 0)
|
||||
((App.debugTimers["Renderer.Lanterns"] as? Long) ?: 0) +
|
||||
((App.debugTimers["Renderer.LightPrecalc"] as? Long) ?: 0) +
|
||||
((App.debugTimers["Renderer.LightRuns"] as? Long) ?: 0) +
|
||||
((App.debugTimers["Renderer.LightToScreen"] as? Long) ?: 0) +
|
||||
((App.debugTimers["Renderer.Tiling"] as? Long) ?: 0)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -364,19 +363,19 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
// make pen work HERE
|
||||
// when LEFT mouse is down
|
||||
if (!tappedOnUI && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) && !mouseOnUI) {
|
||||
if (!tappedOnUI && Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary")) && !mouseOnUI) {
|
||||
|
||||
makePenWork(Terrarum.mouseTileX, Terrarum.mouseTileY)
|
||||
// TODO drag support using bresenham's algo
|
||||
// for some reason it just doesn't work...
|
||||
}
|
||||
else if (!uiPenMenu.isVisible && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary"))) {
|
||||
else if (!uiPenMenu.isVisible && Gdx.input.isButtonPressed(App.getConfigInt("config_mousesecondary"))) {
|
||||
// open pen menu
|
||||
// position the menu to where the cursor is
|
||||
uiPenMenu.posX = Terrarum.mouseScreenX - uiPenMenu.width / 2
|
||||
uiPenMenu.posY = Terrarum.mouseScreenY - uiPenMenu.height / 2
|
||||
uiPenMenu.posX = uiPenMenu.posX.coerceIn(0, AppLoader.screenSize.screenW - uiPenMenu.width)
|
||||
uiPenMenu.posY = uiPenMenu.posY.coerceIn(0, AppLoader.screenSize.screenH - uiPenMenu.height)
|
||||
uiPenMenu.posX = uiPenMenu.posX.coerceIn(0, App.scr.width - uiPenMenu.width)
|
||||
uiPenMenu.posY = uiPenMenu.posY.coerceIn(0, App.scr.height - uiPenMenu.height)
|
||||
|
||||
// actually open
|
||||
uiPenMenu.setAsOpen()
|
||||
@@ -390,14 +389,14 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
IngameRenderer.invoke(false, actorsRenderOverlay = if (showSelection) actorsRenderOverlay + essentialOverlays else essentialOverlays, uiContainer = uiContainer)
|
||||
|
||||
AppLoader.setDebugTime("Test.MarkerDrawCalls", _testMarkerDrawCalls)
|
||||
App.setDebugTime("Test.MarkerDrawCalls", _testMarkerDrawCalls)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
IngameRenderer.resize(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
IngameRenderer.resize(App.scr.width, App.scr.height)
|
||||
uiToolbox.setPosition(0, 0)
|
||||
notifier.setPosition(
|
||||
(AppLoader.screenSize.screenW - notifier.width) / 2, AppLoader.screenSize.screenH - notifier.height)
|
||||
(App.scr.width - notifier.width) / 2, App.scr.height - notifier.height)
|
||||
|
||||
println("[BuildingMaker] Resize event")
|
||||
}
|
||||
@@ -554,12 +553,12 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, physProp
|
||||
|
||||
// TODO resize-aware
|
||||
private var coerceInStart = Point2d(
|
||||
(AppLoader.screenSize.screenW - hitbox.width) / 2.0,
|
||||
(AppLoader.screenSize.screenH - hitbox.height) / 2.0
|
||||
(App.scr.width - hitbox.width) / 2.0,
|
||||
(App.scr.height - hitbox.height) / 2.0
|
||||
)
|
||||
private var coerceInEnd = Point2d(
|
||||
parent.world.width * TILE_SIZE - (AppLoader.screenSize.screenW - hitbox.width) / 2.0,
|
||||
parent.world.height * TILE_SIZE - (AppLoader.screenSize.screenH - hitbox.height) / 2.0
|
||||
parent.world.width * TILE_SIZE - (App.scr.width - hitbox.width) / 2.0,
|
||||
parent.world.height * TILE_SIZE - (App.scr.height - hitbox.height) / 2.0
|
||||
)
|
||||
|
||||
override fun update(delta: Float) {
|
||||
@@ -582,7 +581,7 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, physProp
|
||||
|
||||
class YamlCommandExit : YamlInvokable {
|
||||
override fun invoke(args: Array<Any>) {
|
||||
AppLoader.setScreen(TitleScreen(AppLoader.batch))
|
||||
App.setScreen(TitleScreen(App.batch))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.torvald.terrarum.modulebasegame
|
||||
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.IS_DEVELOPMENT_BUILD
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.IS_DEVELOPMENT_BUILD
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.blockproperties.BlockProp
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.BlockBase
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.measureDebugTime
|
||||
import net.torvald.terrarum.App.measureDebugTime
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
@@ -58,8 +58,8 @@ object IngameRenderer : Disposable {
|
||||
val shaderAtoGrey: ShaderProgram
|
||||
val shaderPassthru = SpriteBatch.createDefaultShader()
|
||||
|
||||
private val WIDTH = AppLoader.screenSize.screenW
|
||||
private val HEIGHT = AppLoader.screenSize.screenH
|
||||
private val WIDTH = App.scr.width
|
||||
private val HEIGHT = App.scr.height
|
||||
private val WIDTHF = WIDTH.toFloat()
|
||||
private val HEIGHTF = HEIGHT.toFloat()
|
||||
|
||||
@@ -88,25 +88,25 @@ object IngameRenderer : Disposable {
|
||||
// these codes will run regardless of the invocation of the "initialise()" function
|
||||
// the "initialise()" function will also be called
|
||||
init {
|
||||
shaderBlur = AppLoader.loadShaderFromFile("assets/blur.vert", "assets/blur.frag")
|
||||
shaderBlur = App.loadShaderFromFile("assets/blur.vert", "assets/blur.frag")
|
||||
|
||||
|
||||
if (AppLoader.getConfigBoolean("fxdither")) {
|
||||
shaderBayer = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/4096_bayer.frag")
|
||||
if (App.getConfigBoolean("fxdither")) {
|
||||
shaderBayer = App.loadShaderFromFile("assets/4096.vert", "assets/4096_bayer.frag")
|
||||
shaderBayer.bind()
|
||||
shaderBayer.setUniformf("rcount", 64f)
|
||||
shaderBayer.setUniformf("gcount", 64f)
|
||||
shaderBayer.setUniformf("bcount", 64f)
|
||||
}
|
||||
else {
|
||||
shaderBayer = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/passthrurgb.frag")
|
||||
shaderBayer = App.loadShaderFromFile("assets/4096.vert", "assets/passthrurgb.frag")
|
||||
}
|
||||
|
||||
|
||||
shaderBlendGlow = AppLoader.loadShaderFromFile("assets/blendGlow.vert", "assets/blendGlow.frag")
|
||||
shaderBlendGlow = App.loadShaderFromFile("assets/blendGlow.vert", "assets/blendGlow.frag")
|
||||
|
||||
shaderRGBOnly = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/rgbonly.frag")
|
||||
shaderAtoGrey = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/aonly.frag")
|
||||
shaderRGBOnly = App.loadShaderFromFile("assets/4096.vert", "assets/rgbonly.frag")
|
||||
shaderAtoGrey = App.loadShaderFromFile("assets/4096.vert", "assets/aonly.frag")
|
||||
|
||||
|
||||
if (!shaderBlendGlow.isCompiled) {
|
||||
@@ -115,7 +115,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
|
||||
if (AppLoader.getConfigBoolean("fxdither")) {
|
||||
if (App.getConfigBoolean("fxdither")) {
|
||||
if (!shaderBayer.isCompiled) {
|
||||
Gdx.app.log("shaderBayer", shaderBayer.log)
|
||||
exitProcess(1)
|
||||
@@ -132,7 +132,7 @@ object IngameRenderer : Disposable {
|
||||
* actually matter */
|
||||
@JvmStatic fun initialise() {
|
||||
if (!initialisedExternally) {
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
|
||||
// also initialise these sinigletons
|
||||
BlocksDrawer
|
||||
@@ -206,7 +206,7 @@ object IngameRenderer : Disposable {
|
||||
if (!gamePaused || newWorldLoadedLatch) {
|
||||
measureDebugTime("Renderer.ApparentLightRun") {
|
||||
// recalculate for even frames, or if the sign of the cam-x changed
|
||||
if (AppLoader.GLOBAL_RENDER_TIMER % 3 == 0 || WorldCamera.x * oldCamX < 0 || newWorldLoadedLatch)
|
||||
if (App.GLOBAL_RENDER_TIMER % 3 == 0 || WorldCamera.x * oldCamX < 0 || newWorldLoadedLatch)
|
||||
LightmapRenderer.fireRecalculateEvent(actorsRenderBehind, actorsRenderFront, actorsRenderMidTop, actorsRenderMiddle, actorsRenderOverlay)
|
||||
|
||||
oldCamX = WorldCamera.x
|
||||
@@ -601,7 +601,7 @@ object IngameRenderer : Disposable {
|
||||
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
||||
*/
|
||||
private fun setCameraPosition(newX: Float, newY: Float) {
|
||||
camera.position.set((-newX + AppLoader.screenSize.halfScreenW).round(), (-newY + AppLoader.screenSize.halfScreenH).round(), 0f)
|
||||
camera.position.set((-newX + App.scr.halfw).round(), (-newY + App.scr.halfh).round(), 0f)
|
||||
camera.update()
|
||||
batch.projectionMatrix = camera.combined
|
||||
}
|
||||
|
||||
@@ -6,12 +6,10 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.EMDASH
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.*
|
||||
import net.torvald.terrarum.App.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.BlockPropUtil
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
import net.torvald.terrarum.blockstats.BlockStats
|
||||
import net.torvald.terrarum.blockstats.MinimapComposer
|
||||
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||
@@ -22,7 +20,6 @@ import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameactors.WireActor
|
||||
import net.torvald.terrarum.gameactors.faction.FactionCodex
|
||||
import net.torvald.terrarum.gamecontroller.IngameController
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
@@ -30,7 +27,6 @@ import net.torvald.terrarum.gameparticles.ParticleBase
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.WorldSimulator
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.MaterialCodex
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.*
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.physicssolver.CollisionSolver
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.GameEconomy
|
||||
@@ -47,7 +43,6 @@ import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
import net.torvald.util.CircularArray
|
||||
import org.khelekore.prtree.MBRConverter
|
||||
import org.khelekore.prtree.PRTree
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import kotlin.math.roundToInt
|
||||
@@ -68,7 +63,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
* list of Actors that is sorted by Actors' referenceID
|
||||
*/
|
||||
//val ACTORCONTAINER_INITIAL_SIZE = 64
|
||||
val PARTICLES_MAX = AppLoader.getConfigInt("maxparticles")
|
||||
val PARTICLES_MAX = App.getConfigInt("maxparticles")
|
||||
val particlesContainer = CircularArray<ParticleBase>(PARTICLES_MAX, true)
|
||||
val uiContainer = UIContainer()
|
||||
|
||||
@@ -86,14 +81,14 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
companion object {
|
||||
/** Sets camera position so that (0,0) would be top-left of the screen, (width, height) be bottom-right. */
|
||||
fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
||||
camera.position.set((-newX + AppLoader.screenSize.halfScreenW).round(), (-newY + AppLoader.screenSize.halfScreenH).round(), 0f)
|
||||
camera.position.set((-newX + App.scr.halfw).round(), (-newY + App.scr.halfh).round(), 0f)
|
||||
camera.update()
|
||||
batch.projectionMatrix = camera.combined
|
||||
}
|
||||
|
||||
fun getCanonicalTitle() = AppLoader.GAME_NAME +
|
||||
fun getCanonicalTitle() = App.GAME_NAME +
|
||||
" $EMDASH F: ${Gdx.graphics.framesPerSecond}" +
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD)
|
||||
if (App.IS_DEVELOPMENT_BUILD)
|
||||
" (ΔF${Terrarum.updateRateStr})" +
|
||||
" $EMDASH M: J${Terrarum.memJavaHeap}M / N${Terrarum.memNativeHeap}M / U${Terrarum.memUnsafe}M / X${Terrarum.memXmx}M"
|
||||
else
|
||||
@@ -287,12 +282,12 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
printdbg(this, "loaded successfully.")
|
||||
}
|
||||
else {
|
||||
AppLoader.getLoadScreen().addMessage("${AppLoader.GAME_NAME} version ${AppLoader.getVERSION_STRING()}")
|
||||
AppLoader.getLoadScreen().addMessage("Creating new world")
|
||||
App.getLoadScreen().addMessage("${App.GAME_NAME} version ${App.getVERSION_STRING()}")
|
||||
App.getLoadScreen().addMessage("Creating new world")
|
||||
|
||||
|
||||
// init map as chosen size
|
||||
val timeNow = AppLoader.getTIME_T()
|
||||
val timeNow = App.getTIME_T()
|
||||
world = GameWorld(1, worldParams.width, worldParams.height, timeNow, timeNow, 0) // new game, so the creation time is right now
|
||||
gameworldIndices.add(world.worldIndex)
|
||||
world.extraFields["basegame.economy"] = GameEconomy()
|
||||
@@ -322,7 +317,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
savegameArchive = VDUtil.createNewDisk(
|
||||
1L shl 60,
|
||||
actorNowPlaying!!.actorValue.getAsString(AVKey.NAME) ?: "Player ${AppLoader.getTIME_T()}",
|
||||
actorNowPlaying!!.actorValue.getAsString(AVKey.NAME) ?: "Player ${App.getTIME_T()}",
|
||||
Common.CHARSET
|
||||
)
|
||||
}
|
||||
@@ -335,8 +330,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
// make controls work
|
||||
Gdx.input.inputProcessor = ingameController
|
||||
if (AppLoader.gamepad != null) {
|
||||
ingameController.gamepad = AppLoader.gamepad
|
||||
if (App.gamepad != null) {
|
||||
ingameController.gamepad = App.gamepad
|
||||
}
|
||||
|
||||
// init console window
|
||||
@@ -355,11 +350,11 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// quick bar
|
||||
uiQuickBar = UIQuickslotBar()
|
||||
uiQuickBar.isVisible = true
|
||||
uiQuickBar.setPosition((AppLoader.screenSize.screenW - uiQuickBar.width) / 2, AppLoader.screenSize.tvSafeGraphicsHeight)
|
||||
uiQuickBar.setPosition((App.scr.width - uiQuickBar.width) / 2, App.scr.tvSafeGraphicsHeight)
|
||||
|
||||
// pie menu
|
||||
uiPieMenu = UIQuickslotPie()
|
||||
uiPieMenu.setPosition(AppLoader.screenSize.halfScreenW, AppLoader.screenSize.halfScreenH)
|
||||
uiPieMenu.setPosition(App.scr.halfw, App.scr.halfh)
|
||||
|
||||
// vital metre
|
||||
// fill in getter functions by
|
||||
@@ -374,14 +369,14 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
uiWatchTierOne = UITierOneWatch()
|
||||
uiWatchTierOne.setAsAlwaysVisible()
|
||||
uiWatchTierOne.setPosition(
|
||||
((AppLoader.screenSize.screenW - AppLoader.screenSize.tvSafeActionWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||
AppLoader.screenSize.tvSafeGraphicsHeight + 8
|
||||
((App.scr.width - App.scr.tvSafeActionWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||
App.scr.tvSafeGraphicsHeight + 8
|
||||
)
|
||||
|
||||
// basic watch-style notification bar (temperature, new mail)
|
||||
uiBasicInfo = UIBasicInfo()
|
||||
uiBasicInfo.setAsAlwaysVisible()
|
||||
uiBasicInfo.setPosition((uiQuickBar.posX - uiBasicInfo.width - AppLoader.screenSize.tvSafeActionWidth) / 2 + AppLoader.screenSize.tvSafeActionWidth, uiWatchTierOne.posY)
|
||||
uiBasicInfo.setPosition((uiQuickBar.posX - uiBasicInfo.width - App.scr.tvSafeActionWidth) / 2 + App.scr.tvSafeActionWidth, uiWatchTierOne.posY)
|
||||
|
||||
|
||||
|
||||
@@ -418,7 +413,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// these need to appear on top of any others
|
||||
uiContainer.add(notifier)
|
||||
|
||||
AppLoader.setDebugTime("Ingame.UpdateCounter", 0)
|
||||
App.setDebugTime("Ingame.UpdateCounter", 0)
|
||||
|
||||
// some sketchy test code here
|
||||
|
||||
@@ -435,7 +430,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// TODO actorsUnderMouse: support ROUNDWORLD
|
||||
val actorsUnderMouse: List<FixtureBase> = getActorsAt(Terrarum.mouseX, Terrarum.mouseY).filterIsInstance<FixtureBase>()
|
||||
if (actorsUnderMouse.size > 1) {
|
||||
AppLoader.printdbgerr(this, "Multiple fixtures at world coord ${Terrarum.mouseX}, ${Terrarum.mouseY}")
|
||||
App.printdbgerr(this, "Multiple fixtures at world coord ${Terrarum.mouseX}, ${Terrarum.mouseY}")
|
||||
}
|
||||
// scan for the one with non-null UI.
|
||||
// what if there's multiple of such fixtures? whatever, you are supposed to DISALLOW such situation.
|
||||
@@ -521,7 +516,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
// define custom update rate
|
||||
val updateRate = if (KeyToggler.isOn(Input.Keys.APOSTROPHE)) 1f / 8f else AppLoader.UPDATE_RATE
|
||||
val updateRate = if (KeyToggler.isOn(Input.Keys.APOSTROPHE)) 1f / 8f else App.UPDATE_RATE
|
||||
|
||||
// ASYNCHRONOUS UPDATE AND RENDER //
|
||||
|
||||
@@ -822,11 +817,11 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
val actors = actorContainerActive.size.toFloat()
|
||||
// set up indices
|
||||
for (i in 0..AppLoader.THREAD_COUNT - 1) {
|
||||
for (i in 0..App.THREAD_COUNT - 1) {
|
||||
ThreadExecutor.submit(
|
||||
ThreadActorUpdate(
|
||||
actors.div(AppLoader.THREAD_COUNT).times(i).roundToInt(),
|
||||
actors.div(AppLoader.THREAD_COUNT).times(i + 1).roundToInt() - 1
|
||||
actors.div(App.THREAD_COUNT).times(i).roundToInt(),
|
||||
actors.div(App.THREAD_COUNT).times(i + 1).roundToInt() - 1
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -963,7 +958,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
override fun addNewActor(actor: Actor?) {
|
||||
if (actor == null) return
|
||||
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD && theGameHasActor(actor.referenceID)) {
|
||||
if (App.IS_DEVELOPMENT_BUILD && theGameHasActor(actor.referenceID)) {
|
||||
throw ReferencedActorAlreadyExistsException(actor)
|
||||
}
|
||||
else {
|
||||
@@ -978,7 +973,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
fun activateDormantActor(actor: Actor) {
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD && !isInactive(actor.referenceID)) {
|
||||
if (App.IS_DEVELOPMENT_BUILD && !isInactive(actor.referenceID)) {
|
||||
/*if (isActive(actor.referenceID))
|
||||
throw Error("The actor $actor is already activated")
|
||||
else
|
||||
@@ -1033,7 +1028,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
//MegaRainGovernor.resize()
|
||||
|
||||
|
||||
IngameRenderer.resize(AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
IngameRenderer.resize(App.scr.width, App.scr.height)
|
||||
|
||||
|
||||
if (gameInitialised) {
|
||||
@@ -1045,8 +1040,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// resize UIs
|
||||
|
||||
notifier.setPosition(
|
||||
(AppLoader.screenSize.screenW - notifier.width) / 2, AppLoader.screenSize.screenH - notifier.height)
|
||||
uiQuickBar.setPosition((AppLoader.screenSize.screenW - uiQuickBar.width) / 2, AppLoader.screenSize.tvSafeGraphicsHeight)
|
||||
(App.scr.width - notifier.width) / 2, App.scr.height - notifier.height)
|
||||
uiQuickBar.setPosition((App.scr.width - uiQuickBar.width) / 2, App.scr.tvSafeGraphicsHeight)
|
||||
|
||||
// inventory
|
||||
/*uiInventoryPlayer =
|
||||
@@ -1058,10 +1053,10 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
// basic watch-style notification bar (temperature, new mail)
|
||||
uiBasicInfo.setPosition(AppLoader.screenSize.screenW - uiBasicInfo.width, 0)
|
||||
uiBasicInfo.setPosition(App.scr.width - uiBasicInfo.width, 0)
|
||||
uiWatchTierOne.setPosition(
|
||||
((AppLoader.screenSize.screenW - AppLoader.screenSize.tvSafeGraphicsWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||
AppLoader.screenSize.tvSafeGraphicsHeight + 8
|
||||
((App.scr.width - App.scr.tvSafeGraphicsWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||
App.scr.tvSafeGraphicsHeight + 8
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@@ -18,7 +17,7 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
// a Class impl is chosen to make resize-handling easier, there's not much benefit making this a singleton anyway
|
||||
|
||||
init {
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
}
|
||||
|
||||
override var screenToLoad: IngameInstance? = screenToBeLoaded
|
||||
@@ -27,15 +26,15 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
|
||||
companion object {
|
||||
private const val WIDTH_RATIO = 0.7
|
||||
private const val PREVIEW_UPDATE_RATE = AppLoader.UPDATE_RATE
|
||||
private const val PREVIEW_UPDATE_RATE = App.UPDATE_RATE
|
||||
|
||||
private val COL_TERR = Color.WHITE
|
||||
private val COL_WALLED = Color(.5f, .5f, .5f, 1f)
|
||||
private val COL_AIR = Color.BLACK
|
||||
}
|
||||
|
||||
private val previewWidth = (AppLoader.screenSize.screenW * WIDTH_RATIO).roundToInt()
|
||||
private val previewHeight = (AppLoader.screenSize.screenW * WIDTH_RATIO * worldheight / worldwidth).roundToInt()
|
||||
private val previewWidth = (App.scr.width * WIDTH_RATIO).roundToInt()
|
||||
private val previewHeight = (App.scr.width * WIDTH_RATIO * worldheight / worldwidth).roundToInt()
|
||||
|
||||
private lateinit var previewPixmap: Pixmap
|
||||
private lateinit var previewTexture: Texture
|
||||
@@ -66,18 +65,18 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
}
|
||||
|
||||
|
||||
AppLoader.batch.inUse {
|
||||
App.batch.inUse {
|
||||
it.color = Color.WHITE
|
||||
val previewY = (AppLoader.screenSize.screenH - previewHeight.times(1.5f)).div(2f).round()
|
||||
val previewY = (App.scr.height - previewHeight.times(1.5f)).div(2f).round()
|
||||
it.draw(previewTexture,
|
||||
(AppLoader.screenSize.screenW - previewWidth).div(2f).round(),
|
||||
(App.scr.width - previewWidth).div(2f).round(),
|
||||
previewY
|
||||
)
|
||||
val text = messages.getHeadElem() ?: ""
|
||||
AppLoader.fontGame.draw(it,
|
||||
App.fontGame.draw(it,
|
||||
text,
|
||||
(AppLoader.screenSize.screenW - AppLoader.fontGame.getWidth(text)).div(2f).round(),
|
||||
previewY + previewHeight + 98 - AppLoader.fontGame.lineHeight
|
||||
(App.scr.width - App.fontGame.getWidth(text)).div(2f).round(),
|
||||
previewY + previewHeight + 98 - App.fontGame.lineHeight
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.utils.JsonWriter
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
@@ -21,7 +21,7 @@ internal object ExportAV : ConsoleCommand {
|
||||
|
||||
JsonWriter.writeToFile(
|
||||
player,
|
||||
AppLoader.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
App.defaultDir + "/Exports/" + args[1] + ".json")
|
||||
|
||||
Echo("ExportAV: exported to " + args[1] + ".json")
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
import net.torvald.terrarum.utils.RasterWriter
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import net.torvald.terrarum.worlddrawer.toRGBA
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
@@ -33,7 +32,7 @@ internal object ExportMap : ConsoleCommand {
|
||||
var mapDataPointer = 0
|
||||
|
||||
for (tile in world.terrainIterator()) {
|
||||
val colArray = AppLoader.tileMaker.terrainTileColourMap.get(tile)!!.toByteArray()
|
||||
val colArray = App.tileMaker.terrainTileColourMap.get(tile)!!.toByteArray()
|
||||
|
||||
for (i in 0..2) {
|
||||
mapData[mapDataPointer + i] = colArray[i]
|
||||
@@ -42,7 +41,7 @@ internal object ExportMap : ConsoleCommand {
|
||||
mapDataPointer += 3
|
||||
}
|
||||
|
||||
val dir = AppLoader.defaultDir + "/Exports/"
|
||||
val dir = App.defaultDir + "/Exports/"
|
||||
val dirAsFile = File(dir)
|
||||
if (!dirAsFile.exists()) {
|
||||
dirAsFile.mkdir()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import com.badlogic.gdx.utils.Json
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.Terrarum.ingame
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
@@ -11,7 +10,6 @@ import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||
import net.torvald.terrarum.serialise.WriteActor
|
||||
import net.torvald.terrarum.serialise.WriteMeta
|
||||
import net.torvald.terrarum.serialise.WriteWorld
|
||||
import net.torvald.terrarum.utils.JsonWriter
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
@@ -20,9 +18,9 @@ import java.io.IOException
|
||||
object ExportMeta : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
try {
|
||||
val currentPlayTime_t = AppLoader.getTIME_T() - ingame!!.loadedTime_t
|
||||
val currentPlayTime_t = App.getTIME_T() - ingame!!.loadedTime_t
|
||||
val str = WriteMeta(ingame!! as TerrarumIngame, currentPlayTime_t)
|
||||
val writer = java.io.FileWriter(AppLoader.defaultDir + "/Exports/savegame.json", false)
|
||||
val writer = java.io.FileWriter(App.defaultDir + "/Exports/savegame.json", false)
|
||||
writer.write(str)
|
||||
writer.close()
|
||||
Echo("Exportmeta: exported to savegame.json")
|
||||
@@ -43,7 +41,7 @@ object ExportWorld : ConsoleCommand {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
val str = WriteWorld(ingame!! as TerrarumIngame)
|
||||
val writer = java.io.FileWriter(AppLoader.defaultDir + "/Exports/${args[1]}.json", false)
|
||||
val writer = java.io.FileWriter(App.defaultDir + "/Exports/${args[1]}.json", false)
|
||||
writer.write(str)
|
||||
writer.close()
|
||||
Echo("Exportworld: exported to ${args[1]}.json")
|
||||
@@ -71,7 +69,7 @@ object ExportActor : ConsoleCommand {
|
||||
if (player == null) return
|
||||
|
||||
val str = WriteActor(player as IngamePlayer)
|
||||
val writer = java.io.FileWriter(AppLoader.defaultDir + "/Exports/${args[1]}.json", false)
|
||||
val writer = java.io.FileWriter(App.defaultDir + "/Exports/${args[1]}.json", false)
|
||||
writer.write(str)
|
||||
writer.close()
|
||||
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.utils.JsonWriter
|
||||
import java.io.BufferedWriter
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-10.
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.serialise.ReadActor
|
||||
import net.torvald.terrarum.serialise.ReadWorld
|
||||
import net.torvald.terrarum.serialise.WriteMeta
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
@@ -17,7 +16,7 @@ object ImportWorld : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
val reader = java.io.FileReader(AppLoader.defaultDir + "/Exports/${args[1]}.json")
|
||||
val reader = java.io.FileReader(App.defaultDir + "/Exports/${args[1]}.json")
|
||||
ReadWorld.readWorldAndSetNewWorld(Terrarum.ingame!! as TerrarumIngame, reader)
|
||||
Echo("Importworld: imported a world from ${args[1]}.json")
|
||||
}
|
||||
@@ -40,7 +39,7 @@ object ImportActor : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
val reader = java.io.FileReader(AppLoader.defaultDir + "/Exports/${args[1]}.json")
|
||||
val reader = java.io.FileReader(App.defaultDir + "/Exports/${args[1]}.json")
|
||||
ReadActor.readActorAndAddToWorld(Terrarum.ingame!! as TerrarumIngame, reader)
|
||||
Echo("Importactor: imported an actor from ${args[1]}.json")
|
||||
}
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.ELLIPSIS
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ccC
|
||||
import net.torvald.terrarum.ccG
|
||||
import net.torvald.terrarum.ccR
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.ByteArray64Reader
|
||||
import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.EntryFile
|
||||
import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.VDUtil
|
||||
import net.torvald.terrarum.serialise.*
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.StringReader
|
||||
import kotlin.reflect.full.declaredMemberProperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-08-30.
|
||||
@@ -27,7 +23,7 @@ object Load : ConsoleCommand {
|
||||
Echo("${ccC}Changing context, ${ccR}do not touch the controller$ccC and ${ccG}wait$ccC$ELLIPSIS")
|
||||
|
||||
val charset = Common.CHARSET
|
||||
val file = File(AppLoader.defaultDir + "/Exports/${args[1]}")
|
||||
val file = File(App.defaultDir + "/Exports/${args[1]}")
|
||||
val disk = VDUtil.readDiskArchive(file, charset = charset)
|
||||
|
||||
LoadSavegame(disk)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.Terrarum
|
||||
@@ -40,7 +40,7 @@ object Save : ConsoleCommand {
|
||||
val ingame = Terrarum.ingame!! as TerrarumIngame
|
||||
val savename = args[1].trim()
|
||||
val disk = VDUtil.createNewDisk(1L shl 60, savename, Common.CHARSET)
|
||||
val file = File(AppLoader.defaultDir + "/Exports/${args[1]}")
|
||||
val file = File(App.defaultDir + "/Exports/${args[1]}")
|
||||
|
||||
WriteSavegame(disk, file, ingame)
|
||||
|
||||
|
||||
@@ -5,11 +5,10 @@ import com.jme3.math.FastMath
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.spriteanimation.HasAssembledSprite
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.gameactors.*
|
||||
import net.torvald.terrarum.gameactors.faction.Faction
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.realestate.LandUtil
|
||||
import org.dyn4j.geometry.Vector2
|
||||
@@ -224,22 +223,22 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
|
||||
private fun updateGamerControlBox() {
|
||||
if (isGamer) {
|
||||
isUpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyjump"))
|
||||
isUpDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyjump"))
|
||||
|
||||
val gamepad = AppLoader.gamepad
|
||||
val gamepad = App.gamepad
|
||||
|
||||
if (gamepad != null) {
|
||||
axisX = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxislx"))
|
||||
axisY = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisly"))
|
||||
axisRX = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisrx"))
|
||||
axisRY = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisry"))
|
||||
axisX = gamepad.getAxis(App.getConfigInt("config_gamepadaxislx"))
|
||||
axisY = gamepad.getAxis(App.getConfigInt("config_gamepadaxisly"))
|
||||
axisRX = gamepad.getAxis(App.getConfigInt("config_gamepadaxisrx"))
|
||||
axisRY = gamepad.getAxis(App.getConfigInt("config_gamepadaxisry"))
|
||||
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyjump")) ||
|
||||
gamepad.getButton(AppLoader.getConfigInt("config_gamepadltrigger"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyjump")) ||
|
||||
gamepad.getButton(App.getConfigInt("config_gamepadltrigger"))
|
||||
}
|
||||
|
||||
if (isJumpJustDown && jumpJustPressedLatched) {
|
||||
@@ -263,7 +262,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
}
|
||||
|
||||
private inline val hasController: Boolean
|
||||
get() = if (isGamer) AppLoader.gamepad != null
|
||||
get() = if (isGamer) App.gamepad != null
|
||||
else true
|
||||
|
||||
private var playerJumpKeyHeldDown = false
|
||||
@@ -308,11 +307,11 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
// ↑F, ↓S
|
||||
if (isRightDown && !isLeftDown) {
|
||||
walkHorizontal(false, AXIS_KEYBOARD)
|
||||
prevHMoveKey = AppLoader.getConfigInt("config_keyright")
|
||||
prevHMoveKey = App.getConfigInt("config_keyright")
|
||||
} // ↓F, ↑S
|
||||
else if (isLeftDown && !isRightDown) {
|
||||
walkHorizontal(true, AXIS_KEYBOARD)
|
||||
prevHMoveKey = AppLoader.getConfigInt("config_keyleft")
|
||||
prevHMoveKey = App.getConfigInt("config_keyleft")
|
||||
} // ↓F, ↓S
|
||||
/*else if (isLeftDown && isRightDown) {
|
||||
if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT)) {
|
||||
@@ -336,11 +335,11 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
// ↑E, ↓D
|
||||
if (isDownDown && !isUpDown) {
|
||||
walkVertical(false, AXIS_KEYBOARD)
|
||||
prevVMoveKey = AppLoader.getConfigInt("config_keydown")
|
||||
prevVMoveKey = App.getConfigInt("config_keydown")
|
||||
} // ↓E, ↑D
|
||||
else if (isUpDown && !isDownDown) {
|
||||
walkVertical(true, AXIS_KEYBOARD)
|
||||
prevVMoveKey = AppLoader.getConfigInt("config_keyup")
|
||||
prevVMoveKey = App.getConfigInt("config_keyup")
|
||||
} // ↓E, ↓D
|
||||
/*else if (isUpDown && isDownDown) {
|
||||
if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ItemCodex
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
@@ -96,7 +96,7 @@ class ActorInventory() : FixtureInventory() {
|
||||
actor.avStrength / 1000.0
|
||||
else
|
||||
1.0 // TODO variable: scale, strength
|
||||
val swingDmgToFrameDmg = AppLoader.UPDATE_RATE.toDouble() / actor.actorValue.getAsDouble(AVKey.ACTION_INTERVAL)!!
|
||||
val swingDmgToFrameDmg = App.UPDATE_RATE.toDouble() / actor.actorValue.getAsDouble(AVKey.ACTION_INTERVAL)!!
|
||||
|
||||
// damage the item
|
||||
newItem.durability -= (baseDamagePerSwing * swingDmgToFrameDmg).toFloat()
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.IngameInstance
|
||||
import net.torvald.terrarum.Point2i
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.gameactors.ActorID
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameactors.PhysProperties
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import net.torvald.terrarum.*
|
||||
@@ -57,7 +55,7 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
||||
this.inventory = inventory
|
||||
|
||||
if (mainUI != null)
|
||||
AppLoader.disposableSingletonsPool.add(mainUI)
|
||||
App.disposableSingletonsPool.add(mainUI)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,15 +57,15 @@ internal class FixtureStorageChest : FixtureBase {
|
||||
|
||||
|
||||
internal class UIStorageChest : UICanvas(
|
||||
toggleKeyLiteral = AppLoader.getConfigInt("config_keyinventory"),
|
||||
toggleButtonLiteral = AppLoader.getConfigInt("config_gamepadstart"),
|
||||
toggleKeyLiteral = App.getConfigInt("config_keyinventory"),
|
||||
toggleButtonLiteral = App.getConfigInt("config_gamepadstart"),
|
||||
), HasInventory {
|
||||
|
||||
lateinit var chestInventory: FixtureInventory
|
||||
lateinit var chestNameFun: () -> String
|
||||
|
||||
override var width = AppLoader.screenSize.screenW
|
||||
override var height = AppLoader.screenSize.screenH
|
||||
override var width = App.scr.width
|
||||
override var height = App.scr.height
|
||||
override var openCloseTime: Second = 0.0f
|
||||
|
||||
private val shapeRenderer = ShapeRenderer()
|
||||
@@ -127,8 +127,8 @@ internal class UIStorageChest : UICanvas(
|
||||
|
||||
catBar = UIItemInventoryCatBar(
|
||||
this,
|
||||
(AppLoader.screenSize.screenW - catBarWidth) / 2,
|
||||
42 + (AppLoader.screenSize.screenH - internalHeight) / 2,
|
||||
(App.scr.width - catBarWidth) / 2,
|
||||
42 + (App.scr.height - internalHeight) / 2,
|
||||
internalWidth,
|
||||
catBarWidth,
|
||||
false
|
||||
@@ -195,17 +195,17 @@ internal class UIStorageChest : UICanvas(
|
||||
gdxSetBlendNormal()
|
||||
|
||||
|
||||
val gradTopStart = (AppLoader.screenSize.screenH - internalHeight).div(2).toFloat()
|
||||
val gradBottomEnd = AppLoader.screenSize.screenH - gradTopStart
|
||||
val gradTopStart = (App.scr.height - internalHeight).div(2).toFloat()
|
||||
val gradBottomEnd = App.scr.height - gradTopStart
|
||||
|
||||
shapeRenderer.inUse {
|
||||
shapeRenderer.rect(0f, gradTopStart, AppLoader.screenSize.screenWf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradBottomEnd, AppLoader.screenSize.screenWf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradTopStart, App.scr.wf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradBottomEnd, App.scr.wf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
|
||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, AppLoader.screenSize.screenWf, internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, App.scr.wf, internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||
|
||||
shapeRenderer.rect(0f, 0f, AppLoader.screenSize.screenWf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, AppLoader.screenSize.screenHf, AppLoader.screenSize.screenWf, -(AppLoader.screenSize.screenHf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, 0f, App.scr.wf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, App.scr.hf, App.scr.wf, -(App.scr.hf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ internal class UIStorageChest : UICanvas(
|
||||
// encumbrance meter
|
||||
val encumbranceText = Lang["GAME_INVENTORY_ENCUMBRANCE"]
|
||||
val encumbBarXPos = itemListPlayer.posX + itemListPlayer.width - weightBarWidth
|
||||
val encumbBarTextXPos = encumbBarXPos - 6 - AppLoader.fontGame.getWidth(encumbranceText)
|
||||
val encumbBarTextXPos = encumbBarXPos - 6 - App.fontGame.getWidth(encumbranceText)
|
||||
val encumbBarYPos = UIInventoryCells.encumbBarYPos
|
||||
val encumbCol = UIItemInventoryCellCommonRes.getHealthMeterColour(1f - encumbrancePerc, 0f, 1f)
|
||||
val encumbBack = encumbCol mul UIItemInventoryCellCommonRes.meterBackDarkening
|
||||
@@ -250,10 +250,10 @@ internal class UIStorageChest : UICanvas(
|
||||
|
||||
// chest name text
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, chestName, itemListChest.posX + 6f, encumbBarYPos - 3f)
|
||||
App.fontGame.draw(batch, chestName, itemListChest.posX + 6f, encumbBarYPos - 3f)
|
||||
// encumb text
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, encumbranceText, encumbBarTextXPos, encumbBarYPos - 3f)
|
||||
App.fontGame.draw(batch, encumbranceText, encumbBarTextXPos, encumbBarYPos - 3f)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.utils.JsonFetcher
|
||||
import net.torvald.random.Fudge3
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.ActorValue
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.faction.FactionFactory
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import net.torvald.terrarum.*
|
||||
|
||||
@@ -79,7 +76,7 @@ object PlayerBuilderSigrid {
|
||||
|
||||
fun fillTestInventory(inventory: ActorInventory) {
|
||||
|
||||
AppLoader.tileMaker.tags.forEach { t, _ ->
|
||||
App.tileMaker.tags.forEach { t, _ ->
|
||||
inventory.add(t, 9995)
|
||||
try {
|
||||
inventory.add("wall@"+t, 9995) // this code will try to add nonexisting wall items, do not get surprised with NPEs
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.gameactors.ActorValue
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.*
|
||||
|
||||
@@ -36,7 +35,7 @@ interface Pocketed {
|
||||
// Relevant Actorvalue is NOT being updated on time
|
||||
// They're being safely handled by UIItemInventoryElem*.touchDown() and ActorInventory.remove
|
||||
|
||||
item.effectOnUnequip(AppLoader.UPDATE_RATE)
|
||||
item.effectOnUnequip(App.UPDATE_RATE)
|
||||
}
|
||||
|
||||
fun unequipItem(itemID: ItemID?) {
|
||||
@@ -67,7 +66,7 @@ interface Pocketed {
|
||||
|
||||
if (item.equipPosition >= 0) {
|
||||
inventory.itemEquipped[item.equipPosition] = item.dynamicID
|
||||
item.effectWhenEquipped(AppLoader.UPDATE_RATE)
|
||||
item.effectWhenEquipped(App.UPDATE_RATE)
|
||||
}
|
||||
// else do nothing
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import java.util.concurrent.Callable
|
||||
import net.torvald.terrarum.*
|
||||
|
||||
@@ -13,13 +12,13 @@ class ThreadActorUpdate(val startIndex: Int, val endIndex: Int) : Callable<Unit>
|
||||
override fun call() {
|
||||
for (i in startIndex..endIndex) {
|
||||
val it = Terrarum.ingame!!.actorContainerActive[i]
|
||||
it.update(AppLoader.UPDATE_RATE)
|
||||
it.update(App.UPDATE_RATE)
|
||||
|
||||
if (it is Pocketed) {
|
||||
it.inventory.forEach { inventoryEntry ->
|
||||
ItemCodex[inventoryEntry.itm]?.effectWhileInPocket(AppLoader.UPDATE_RATE)
|
||||
ItemCodex[inventoryEntry.itm]?.effectWhileInPocket(App.UPDATE_RATE)
|
||||
if (it.equipped(inventoryEntry.itm)) {
|
||||
ItemCodex[inventoryEntry.itm]?.effectWhenEquipped(AppLoader.UPDATE_RATE)
|
||||
ItemCodex[inventoryEntry.itm]?.effectWhenEquipped(App.UPDATE_RATE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ object FloatDrawer : Disposable {
|
||||
val tile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36)
|
||||
|
||||
init {
|
||||
AppLoader.disposableSingletonsPool.add(this)
|
||||
App.disposableSingletonsPool.add(this)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -26,7 +26,7 @@ class Notification : UICanvas() {
|
||||
|
||||
override var height: Int = 0
|
||||
private val visibleTime = Math.min(
|
||||
AppLoader.getConfigInt("notificationshowuptime"),
|
||||
App.getConfigInt("notificationshowuptime"),
|
||||
SHOWUP_MAX
|
||||
) / 1000f
|
||||
private var displayTimer = 0f
|
||||
@@ -55,15 +55,15 @@ class Notification : UICanvas() {
|
||||
fontCol.a = handler.opacity
|
||||
|
||||
val realTextWidth = 12 + if (message.size == 1)
|
||||
AppLoader.fontGame.getWidth(message[0])
|
||||
App.fontGame.getWidth(message[0])
|
||||
else
|
||||
message.map { AppLoader.fontGame.getWidth(it) }.sorted().last()
|
||||
message.map { App.fontGame.getWidth(it) }.sorted().last()
|
||||
val displayedTextWidth = maxOf(240, realTextWidth)
|
||||
|
||||
// force the UI to the centre of the screen
|
||||
this.posX = (AppLoader.screenSize.screenW - displayedTextWidth) / 2
|
||||
this.posX = (App.scr.width - displayedTextWidth) / 2
|
||||
|
||||
val textHeight = message.size * AppLoader.fontGame.lineHeight
|
||||
val textHeight = message.size * App.fontGame.lineHeight
|
||||
|
||||
batch.color = drawColor
|
||||
|
||||
@@ -72,8 +72,8 @@ class Notification : UICanvas() {
|
||||
batch.color = fontCol
|
||||
message.forEachIndexed { index, s ->
|
||||
val xoff = 6 + (displayedTextWidth - realTextWidth) / 2
|
||||
val y = -textHeight + AppLoader.fontGame.lineHeight * index
|
||||
AppLoader.fontGame.draw(batch, s, LRmargin + xoff, y)
|
||||
val y = -textHeight + App.fontGame.lineHeight * index
|
||||
App.fontGame.draw(batch, s, LRmargin + xoff, y)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class UIBasicInfo() : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(App.getConfigInt("config_keyinteract"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
|
||||
@@ -4,18 +4,15 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.fillRect
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_WHITE
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemImageButton
|
||||
import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||
import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_BACKGROUNDCOL
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import kotlin.math.roundToInt
|
||||
import net.torvald.terrarum.*
|
||||
|
||||
@@ -89,7 +86,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
||||
}
|
||||
|
||||
// respond to click
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
|
||||
if (Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary"))) {
|
||||
// scroll bar
|
||||
if (relativeMouseX in width - SCROLLBAR_SIZE until width && relativeMouseY in 0 until height) {
|
||||
mouseOnScroll = true
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemImageButton
|
||||
@@ -71,8 +70,8 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
{
|
||||
parent.uiPalette.isVisible = true
|
||||
parent.uiPalette.setPosition(Gdx.input.x - parent.uiPalette.width / 2, Gdx.input.y - parent.uiPalette.height / 2)
|
||||
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, AppLoader.screenSize.screenW - parent.uiPalette.width)
|
||||
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, AppLoader.screenSize.screenH - parent.uiPalette.height)
|
||||
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, App.scr.width - parent.uiPalette.width)
|
||||
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, App.scr.height - parent.uiPalette.height)
|
||||
},
|
||||
{
|
||||
parent.currentPenMode = BuildingMaker.PENMODE_PENCIL_ERASE
|
||||
@@ -100,7 +99,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
uiItems.add(button)
|
||||
|
||||
button.clickOnceListener = { _, _, b ->
|
||||
if (b == AppLoader.getConfigInt("config_mouseprimary")) {
|
||||
if (b == App.getConfigInt("config_mouseprimary")) {
|
||||
toolButtonsJob[index].invoke()
|
||||
closeGracefully()
|
||||
}
|
||||
@@ -134,7 +133,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
}
|
||||
|
||||
// primary click
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
|
||||
if (Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary"))) {
|
||||
// close by clicking close button or out-of-boud
|
||||
if (mouseVec.distanceSquared(RADIUS, RADIUS) !in CLOSE_BUTTON_RADIUS.sqr()..RADIUSF.sqr()) {
|
||||
closeGracefully()
|
||||
@@ -176,7 +175,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
batch.draw(ItemCodex.getItemImage(slotConfig[i]), x - 16, y - 16, 32f, 32f)
|
||||
|
||||
// update as well while looping
|
||||
if (i == mouseOnBlocksSlot && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
|
||||
if (i == mouseOnBlocksSlot && Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary"))) {
|
||||
parent.setPencilColour(slotConfig[i])
|
||||
closeGracefully()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.fillRect
|
||||
@@ -16,11 +16,11 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
class UICheatDetected : UICanvas() {
|
||||
|
||||
override var width: Int
|
||||
get() = AppLoader.screenSize.screenW
|
||||
get() = App.scr.width
|
||||
set(value) { throw UnsupportedOperationException() }
|
||||
|
||||
override var height: Int
|
||||
get() = AppLoader.screenSize.screenH
|
||||
get() = App.scr.height
|
||||
set(value) { throw UnsupportedOperationException() }
|
||||
|
||||
override var openCloseTime: Second = 0f
|
||||
@@ -38,10 +38,10 @@ class UICheatDetected : UICanvas() {
|
||||
|
||||
batch.color = Color.WHITE
|
||||
val txt = Lang["ERROR_GENERIC_CHEATING"]
|
||||
val txtW = AppLoader.fontGame.getWidth(txt)
|
||||
val txtH = AppLoader.fontGame.lineHeight.toInt()
|
||||
val txtW = App.fontGame.getWidth(txt)
|
||||
val txtH = App.fontGame.lineHeight.toInt()
|
||||
|
||||
AppLoader.fontGame.draw(batch, txt, width.minus(txtW).ushr(1).toFloat(), height.minus(txtH).ushr(1).toFloat())
|
||||
App.fontGame.draw(batch, txt, width.minus(txtW).ushr(1).toFloat(), height.minus(txtH).ushr(1).toFloat())
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_HOR
|
||||
@@ -22,8 +21,8 @@ internal class UIInventoryCells(
|
||||
val full: UIInventoryFull
|
||||
) : UICanvas() {
|
||||
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = App.scr.height
|
||||
override var openCloseTime: Second = 0.0f
|
||||
|
||||
companion object {
|
||||
@@ -53,7 +52,7 @@ internal class UIInventoryCells(
|
||||
private val equipped: UIItemInventoryEquippedView =
|
||||
UIItemInventoryEquippedView(
|
||||
full,
|
||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (AppLoader.screenSize.screenW - internalWidth) / 2,
|
||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (App.scr.width - internalWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
{ rebuildList() }
|
||||
)
|
||||
@@ -64,7 +63,7 @@ internal class UIInventoryCells(
|
||||
}
|
||||
|
||||
fun rebuildList() {
|
||||
AppLoader.printdbg(this, "rebuilding list")
|
||||
App.printdbg(this, "rebuilding list")
|
||||
|
||||
itemList.rebuild(full.catBar.catIconsMeaning[full.catBar.selectedIcon])
|
||||
equipped.rebuild()
|
||||
@@ -94,21 +93,21 @@ internal class UIInventoryCells(
|
||||
val controlHintXPos = full.offsetX
|
||||
blendNormal(batch)
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, full.listControlHelp, controlHintXPos, full.yEnd - 20)
|
||||
App.fontGame.draw(batch, full.listControlHelp, controlHintXPos, full.yEnd - 20)
|
||||
|
||||
|
||||
// encumbrance meter
|
||||
val encumbranceText = Lang["GAME_INVENTORY_ENCUMBRANCE"]
|
||||
// encumbrance bar will go one row down if control help message is too long
|
||||
val encumbBarXPos = full.xEnd - weightBarWidth
|
||||
val encumbBarTextXPos = encumbBarXPos - 6 - AppLoader.fontGame.getWidth(encumbranceText)
|
||||
val encumbBarTextXPos = encumbBarXPos - 6 - App.fontGame.getWidth(encumbranceText)
|
||||
val encumbBarYPos = full.yEnd-20 + 3f +
|
||||
if (AppLoader.fontGame.getWidth(full.listControlHelp) + 2 + controlHintXPos >= encumbBarTextXPos)
|
||||
AppLoader.fontGame.lineHeight
|
||||
if (App.fontGame.getWidth(full.listControlHelp) + 2 + controlHintXPos >= encumbBarTextXPos)
|
||||
App.fontGame.lineHeight
|
||||
else 0f
|
||||
Companion.encumbBarYPos = encumbBarYPos // q&d hack to share some numbers
|
||||
|
||||
AppLoader.fontGame.draw(batch,
|
||||
App.fontGame.draw(batch,
|
||||
encumbranceText,
|
||||
encumbBarTextXPos,
|
||||
encumbBarYPos - 3f
|
||||
@@ -136,7 +135,7 @@ internal class UIInventoryCells(
|
||||
// debug text
|
||||
batch.color = Color.LIGHT_GRAY
|
||||
if (INVEN_DEBUG_MODE) {
|
||||
AppLoader.fontSmallNumbers.draw(batch,
|
||||
App.fontSmallNumbers.draw(batch,
|
||||
"${full.actor.inventory.capacity}/${full.actor.inventory.maxCapacity}",
|
||||
encumbBarTextXPos,
|
||||
encumbBarYPos + controlHelpHeight - 4f
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.TitleScreen
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
|
||||
@@ -15,8 +15,8 @@ import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_LINE_HEIGH
|
||||
|
||||
class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = App.scr.height
|
||||
override var openCloseTime = 0.0f
|
||||
|
||||
private val gameMenu = arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS")
|
||||
@@ -24,7 +24,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
private val gameMenuListWidth = 400
|
||||
private val gameMenuButtons = UIItemTextButtonList(
|
||||
this, DEFAULT_LINE_HEIGHT, gameMenu,
|
||||
(AppLoader.screenSize.screenW - gameMenuListWidth) / 2,
|
||||
(App.scr.width - gameMenuListWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
|
||||
gameMenuListWidth, gameMenuListHeight,
|
||||
readFromLang = true,
|
||||
@@ -41,7 +41,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
gameMenuButtons.selectionChangeListener = { _, new ->
|
||||
when (new) {
|
||||
0 -> AppLoader.setScreen(TitleScreen(AppLoader.batch))
|
||||
0 -> App.setScreen(TitleScreen(App.batch))
|
||||
1 -> Gdx.app.exit()
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
// control hints
|
||||
blendNormal(batch)
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||
|
||||
// text buttons
|
||||
gameMenuButtons.render(batch, camera)
|
||||
|
||||
@@ -5,12 +5,11 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import net.torvald.ENDASH
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.*
|
||||
import net.torvald.terrarum.App.*
|
||||
import net.torvald.terrarum.blockstats.MinimapComposer
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||
import net.torvald.terrarum.ui.*
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -18,7 +17,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
* Created by minjaesong on 2017-10-21.
|
||||
*/
|
||||
class UIInventoryFull(
|
||||
toggleKeyLiteral: Int? = AppLoader.getConfigInt("config_keyinventory"), toggleButtonLiteral: Int? = AppLoader.getConfigInt("config_gamepadstart"),
|
||||
toggleKeyLiteral: Int? = App.getConfigInt("config_keyinventory"), toggleButtonLiteral: Int? = App.getConfigInt("config_gamepadstart"),
|
||||
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
|
||||
customPositioning: Boolean = false, // mainly used by vital meter
|
||||
doNotWarnConstant: Boolean = false
|
||||
@@ -27,8 +26,8 @@ class UIInventoryFull(
|
||||
val actor: ActorHumanoid
|
||||
get() = Terrarum.ingame!!.actorNowPlaying!!
|
||||
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = App.scr.height
|
||||
override var openCloseTime: Second = 0.0f
|
||||
|
||||
companion object {
|
||||
@@ -36,7 +35,7 @@ class UIInventoryFull(
|
||||
|
||||
const val REQUIRED_MARGIN: Int = 138 // hard-coded value. Don't know the details. Range: [91-146]. I chose MAX-8 because cell gap is 8
|
||||
const val CELLS_HOR = 10
|
||||
val CELLS_VRT: Int; get() = (AppLoader.screenSize.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryItemGrid.listGap) / // 134 is another magic number
|
||||
val CELLS_VRT: Int; get() = (App.scr.height - REQUIRED_MARGIN - 134 + UIItemInventoryItemGrid.listGap) / // 134 is another magic number
|
||||
(UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap)
|
||||
|
||||
const val itemListToEquipViewGap = UIItemInventoryItemGrid.listGap // used to be 24; figured out that the extra gap does nothig
|
||||
@@ -47,8 +46,8 @@ class UIInventoryFull(
|
||||
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.listGap
|
||||
|
||||
val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryItemGrid.listGap
|
||||
val INVENTORY_CELLS_OFFSET_X = 0 + (AppLoader.screenSize.screenW - internalWidth) / 2
|
||||
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.screenSize.screenH - internalHeight) / 2
|
||||
val INVENTORY_CELLS_OFFSET_X = 0 + (App.scr.width - internalWidth) / 2
|
||||
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (App.scr.height - internalHeight) / 2
|
||||
|
||||
val catBarWidth = 330
|
||||
|
||||
@@ -56,7 +55,7 @@ class UIInventoryFull(
|
||||
val gradEndCol = Color(0x000000_70)
|
||||
val gradHeight = 48f
|
||||
|
||||
val controlHelpHeight = AppLoader.fontGame.lineHeight
|
||||
val controlHelpHeight = App.fontGame.lineHeight
|
||||
}
|
||||
|
||||
//val REQUIRED_MARGIN: Int = 138 // hard-coded value. Don't know the details. Range: [91-146]. I chose MAX-8 because cell gap is 8
|
||||
@@ -86,7 +85,7 @@ class UIInventoryFull(
|
||||
|
||||
private val SP = "${0x3000.toChar()} "
|
||||
val listControlHelp: String
|
||||
get() = if (AppLoader.environment == RunningEnvironment.PC)
|
||||
get() = if (App.environment == RunningEnvironment.PC)
|
||||
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
"${0xe006.toChar()} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
||||
"${0xe011.toChar()}$ENDASH${0x2009.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||
@@ -99,7 +98,7 @@ class UIInventoryFull(
|
||||
"$gamepadLabelNorth$gamepadLabelLStick ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||
"$gamepadLabelEast ${Lang["GAME_INVENTORY_DROP"]}"
|
||||
val minimapControlHelp: String
|
||||
get() = if (AppLoader.environment == RunningEnvironment.PC)
|
||||
get() = if (App.environment == RunningEnvironment.PC)
|
||||
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
"${0xe006.toChar()} ${Lang["GAME_ACTION_MOVE_VERB"]}"
|
||||
else
|
||||
@@ -107,7 +106,7 @@ class UIInventoryFull(
|
||||
"$gamepadLabelRStick ${Lang["GAME_ACTION_MOVE_VERB"]}$SP" +
|
||||
"$gamepadLabelRT ${Lang["GAME_INVENTORY"]}"
|
||||
val gameMenuControlHelp: String
|
||||
get() = if (AppLoader.environment == RunningEnvironment.PC)
|
||||
get() = if (App.environment == RunningEnvironment.PC)
|
||||
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}"
|
||||
else
|
||||
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
@@ -115,8 +114,8 @@ class UIInventoryFull(
|
||||
|
||||
val catBar = UIItemInventoryCatBar(
|
||||
this,
|
||||
(AppLoader.screenSize.screenW - catBarWidth) / 2,
|
||||
42 + (AppLoader.screenSize.screenH - internalHeight) / 2,
|
||||
(App.scr.width - catBarWidth) / 2,
|
||||
42 + (App.scr.height - internalHeight) / 2,
|
||||
internalWidth,
|
||||
catBarWidth,
|
||||
true,
|
||||
@@ -129,10 +128,10 @@ class UIInventoryFull(
|
||||
private val transitionalEscMenu = UIInventoryEscMenu(this)
|
||||
private val transitionPanel = UIItemHorizontalFadeSlide(
|
||||
this,
|
||||
(AppLoader.screenSize.screenW - internalWidth) / 2,
|
||||
(App.scr.width - internalWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
AppLoader.screenSize.screenW,
|
||||
AppLoader.screenSize.screenH,
|
||||
App.scr.width,
|
||||
App.scr.height,
|
||||
1f,
|
||||
transitionalMinimap, transitionalItemCells, transitionalEscMenu
|
||||
)
|
||||
@@ -153,9 +152,9 @@ class UIInventoryFull(
|
||||
|
||||
}
|
||||
|
||||
internal var offsetX = ((AppLoader.screenSize.screenW - internalWidth) / 2).toFloat()
|
||||
internal var offsetX = ((App.scr.width - internalWidth) / 2).toFloat()
|
||||
private set
|
||||
internal var offsetY = ((AppLoader.screenSize.screenH - internalHeight) / 2).toFloat()
|
||||
internal var offsetY = ((App.scr.height - internalHeight) / 2).toFloat()
|
||||
private set
|
||||
|
||||
fun requestTransition(target: Int) = transitionPanel.requestTransition(target)
|
||||
@@ -174,9 +173,9 @@ class UIInventoryFull(
|
||||
//private val gradHeight = 48f
|
||||
private val shapeRenderer = ShapeRenderer()
|
||||
|
||||
internal var xEnd = (AppLoader.screenSize.screenW + internalWidth).div(2).toFloat()
|
||||
internal var xEnd = (App.scr.width + internalWidth).div(2).toFloat()
|
||||
private set
|
||||
internal var yEnd = (AppLoader.screenSize.screenH + internalHeight).div(2).toFloat()
|
||||
internal var yEnd = (App.scr.height + internalHeight).div(2).toFloat()
|
||||
private set
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
@@ -187,17 +186,17 @@ class UIInventoryFull(
|
||||
gdxSetBlendNormal()
|
||||
|
||||
|
||||
val gradTopStart = (AppLoader.screenSize.screenH - internalHeight).div(2).toFloat()
|
||||
val gradBottomEnd = AppLoader.screenSize.screenH - gradTopStart
|
||||
val gradTopStart = (App.scr.height - internalHeight).div(2).toFloat()
|
||||
val gradBottomEnd = App.scr.height - gradTopStart
|
||||
|
||||
shapeRenderer.inUse {
|
||||
shapeRenderer.rect(0f, gradTopStart, AppLoader.screenSize.screenWf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradBottomEnd, AppLoader.screenSize.screenWf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradTopStart, App.scr.wf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradBottomEnd, App.scr.wf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
|
||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, AppLoader.screenSize.screenWf, internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, App.scr.wf, internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||
|
||||
shapeRenderer.rect(0f, 0f, AppLoader.screenSize.screenWf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, AppLoader.screenSize.screenHf, AppLoader.screenSize.screenWf, -(AppLoader.screenSize.screenHf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, 0f, App.scr.wf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, App.scr.hf, App.scr.wf, -(App.scr.hf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
}
|
||||
|
||||
|
||||
@@ -257,11 +256,11 @@ class UIInventoryFull(
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
|
||||
offsetX = ((AppLoader.screenSize.screenW - internalWidth) / 2).toFloat()
|
||||
offsetY = ((AppLoader.screenSize.screenH - internalHeight) / 2).toFloat()
|
||||
offsetX = ((App.scr.width - internalWidth) / 2).toFloat()
|
||||
offsetY = ((App.scr.height - internalHeight) / 2).toFloat()
|
||||
|
||||
xEnd = (AppLoader.screenSize.screenW + internalWidth).div(2).toFloat()
|
||||
yEnd = (AppLoader.screenSize.screenH + internalHeight).div(2).toFloat()
|
||||
xEnd = (App.scr.width + internalWidth).div(2).toFloat()
|
||||
yEnd = (App.scr.height + internalHeight).div(2).toFloat()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
private val debugvals = true
|
||||
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = App.scr.height
|
||||
override var openCloseTime = 0.0f
|
||||
|
||||
private val MINIMAP_WIDTH = 800f
|
||||
@@ -44,7 +44,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
// update map panning
|
||||
// if left click is down and cursor is in the map area
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) &&
|
||||
if (Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary")) &&
|
||||
Terrarum.mouseScreenY in INVENTORY_CELLS_OFFSET_Y..INVENTORY_CELLS_OFFSET_Y + INVENTORY_CELLS_UI_HEIGHT) {
|
||||
minimapPanX += Terrarum.mouseDeltaX * 2f / minimapZoom
|
||||
minimapPanY += Terrarum.mouseDeltaY * 2f / minimapZoom
|
||||
@@ -115,23 +115,23 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
batch.begin()
|
||||
|
||||
if (debugvals) {
|
||||
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
|
||||
App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (App.scr.width - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
|
||||
}
|
||||
|
||||
batch.projectionMatrix = camera.combined
|
||||
// 1px stroke
|
||||
batch.color = Color.WHITE
|
||||
batch.fillRect((AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect((AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect(-1 + (AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect(-1 + (App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
|
||||
// control hints
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20)
|
||||
App.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20)
|
||||
|
||||
// the minimap
|
||||
batch.draw(minimapFBO.colorBufferTexture, (AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
|
||||
batch.draw(minimapFBO.colorBufferTexture, (App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {}
|
||||
|
||||
@@ -38,7 +38,7 @@ class UIItemPlayerInfoCell(
|
||||
private val backColInactive = ItemSlotImageFactory.CELLCOLOUR_BLACK
|
||||
private val backColActive = ItemSlotImageFactory.CELLCOLOUR_BLACK_ACTIVE
|
||||
|
||||
private val textRow1 = (((height / 2) - AppLoader.fontGame.lineHeight) / 2).toFloat()
|
||||
private val textRow1 = (((height / 2) - App.fontGame.lineHeight) / 2).toFloat()
|
||||
private val textRow2 = textRow1 + (height / 2)
|
||||
|
||||
private val creationTimeStr: String
|
||||
@@ -62,7 +62,7 @@ class UIItemPlayerInfoCell(
|
||||
|
||||
|
||||
worldCountStr = Lang["CONTEXT_WORLD_COUNT"] + saveInfo.get("worlds").asIntArray().size
|
||||
worldCountStrWidth = AppLoader.fontGame.getWidth(worldCountStr)
|
||||
worldCountStrWidth = App.fontGame.getWidth(worldCountStr)
|
||||
}
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
|
||||
@@ -2,8 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItem
|
||||
import java.io.File
|
||||
@@ -21,7 +20,7 @@ class UIItemSavegameInfoCell(
|
||||
initialY: Int
|
||||
) : UIItem(parent, initialX, initialY) {
|
||||
|
||||
override val height: Int = AppLoader.fontGame.lineHeight.toInt() * 2
|
||||
override val height: Int = App.fontGame.lineHeight.toInt() * 2
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
|
||||
|
||||
@@ -5,12 +5,11 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.fillRect
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -28,7 +27,7 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
|
||||
|
||||
val LINE_HEIGHT = 24
|
||||
val TEXT_OFFSETX = 3f
|
||||
val TEXT_OFFSETY = (LINE_HEIGHT - AppLoader.fontGame.lineHeight) / 2f
|
||||
val TEXT_OFFSETY = (LINE_HEIGHT - App.fontGame.lineHeight) / 2f
|
||||
|
||||
fun mouseOnTitleBar() =
|
||||
relativeMouseX in 0 until width && relativeMouseY in 0 until LINE_HEIGHT
|
||||
@@ -80,7 +79,7 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
|
||||
|
||||
// draw "Pal."
|
||||
batch.color = UINSMenu.DEFAULT_TITLETEXTCOL
|
||||
AppLoader.fontGame.draw(batch, titleText, TEXT_OFFSETX, TEXT_OFFSETY)
|
||||
App.fontGame.draw(batch, titleText, TEXT_OFFSETX, TEXT_OFFSETY)
|
||||
|
||||
// draw background
|
||||
batch.color = CELLCOLOUR_BLACK
|
||||
@@ -91,7 +90,7 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
|
||||
// TODO carve the overlap
|
||||
batch.draw(ItemCodex.getItemImage(back), 14f, 41f)
|
||||
batch.draw(ItemCodex.getItemImage(fore), 6f, 33f)
|
||||
AppLoader.fontSmallNumbers.draw(batch, fore.toString(), 3f, 61f)
|
||||
App.fontSmallNumbers.draw(batch, fore.toString(), 3f, 61f)
|
||||
|
||||
// draw swap icon
|
||||
batch.color = Color.WHITE
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.SanicLoadScreen
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
@@ -32,11 +32,11 @@ class UIProxyNewBuildingMaker : UICanvas() {
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
val ingame = BuildingMaker(AppLoader.batch)
|
||||
val ingame = BuildingMaker(App.batch)
|
||||
|
||||
Terrarum.setCurrentIngameInstance(ingame)
|
||||
SanicLoadScreen.screenToLoad = ingame
|
||||
AppLoader.setLoadScreen(SanicLoadScreen)
|
||||
App.setLoadScreen(SanicLoadScreen)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
|
||||
@@ -3,8 +3,8 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
@@ -37,7 +37,7 @@ class UIProxyNewRandomGame : UICanvas() {
|
||||
printdbg(this, "endOpening")
|
||||
|
||||
|
||||
val ingame = TerrarumIngame(AppLoader.batch)
|
||||
val ingame = TerrarumIngame(App.batch)
|
||||
// val worldParam = TerrarumIngame.NewWorldParameters(2400, 1280, 0x51621DL)
|
||||
val worldParam = TerrarumIngame.NewWorldParameters(2400, 1280, HQRNG().nextLong())
|
||||
|
||||
@@ -52,7 +52,7 @@ class UIProxyNewRandomGame : UICanvas() {
|
||||
//LoadScreen.screenToLoad = ingame
|
||||
//AppLoader.setScreen(LoadScreen)
|
||||
val loadScreen = WorldgenLoadScreen(ingame, worldParam.width, worldParam.height)
|
||||
AppLoader.setLoadScreen(loadScreen)
|
||||
App.setLoadScreen(loadScreen)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
|
||||
@@ -3,12 +3,11 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.*
|
||||
@@ -23,7 +22,7 @@ class UIQuickslotBar : UICanvas() {
|
||||
|
||||
private val gutter = 10 - 6 // do -6 to get a gutter size of not-enlarged cells
|
||||
override var width: Int = cellSize * SLOT_COUNT + gutter * (SLOT_COUNT - 1) // 452
|
||||
override var height: Int = ItemSlotImageFactory.slotImage.tileH + 4 + AppLoader.fontGame.lineHeight.toInt()
|
||||
override var height: Int = ItemSlotImageFactory.slotImage.tileH + 4 + App.fontGame.lineHeight.toInt()
|
||||
/**
|
||||
* In milliseconds
|
||||
*/
|
||||
|
||||
@@ -4,11 +4,10 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.COMMON_OPEN_CLOSE
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.SLOT_COUNT
|
||||
@@ -50,7 +49,7 @@ class UIQuickslotPie : UICanvas() {
|
||||
// update controls
|
||||
if (handler.isOpened || handler.isOpening) {
|
||||
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
|
||||
val centre = Vector2(AppLoader.screenSize.halfScreenW.toDouble(), AppLoader.screenSize.halfScreenH.toDouble())
|
||||
val centre = Vector2(App.scr.halfw.toDouble(), App.scr.halfh.toDouble())
|
||||
val deg = -(centre - cursorPos).direction.toFloat()
|
||||
|
||||
selection = Math.round(deg * slotCount / FastMath.TWO_PI)
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbgerr
|
||||
import net.torvald.terrarum.QNDTreeNode
|
||||
import net.torvald.terrarum.Yaml
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -295,7 +295,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
||||
val remoConWidth = 300
|
||||
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||
val menubarOffX: Int; get() = (0.11 * AppLoader.screenSize.screenW).toInt()
|
||||
val menubarOffY: Int; get() = (0.82 * AppLoader.screenSize.screenH).toInt()
|
||||
val menubarOffX: Int; get() = (0.11 * App.scr.width).toInt()
|
||||
val menubarOffY: Int; get() = (0.82 * App.scr.height).toInt()
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.EMDASH
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumScreenSize
|
||||
import net.torvald.terrarum.keyToIcon
|
||||
@@ -17,13 +17,13 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
* Created by minjaesong on 2019-08-11.
|
||||
*/
|
||||
class UIScreenZoom : UICanvas(
|
||||
AppLoader.getConfigInt("config_keyzoom")
|
||||
App.getConfigInt("config_keyzoom")
|
||||
) {
|
||||
|
||||
val zoomText = "${keyToIcon(handler.toggleKeyLiteral!!)} $EMDASH Zoom Out"
|
||||
|
||||
override var width = AppLoader.fontGame.getWidth(zoomText)
|
||||
override var height = AppLoader.fontGame.lineHeight.toInt()
|
||||
override var width = App.fontGame.getWidth(zoomText)
|
||||
override var height = App.fontGame.lineHeight.toInt()
|
||||
|
||||
override var openCloseTime = 0.15f
|
||||
|
||||
@@ -38,10 +38,10 @@ class UIScreenZoom : UICanvas(
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
batch.color = Color.WHITE
|
||||
|
||||
AppLoader.fontGame.draw(
|
||||
App.fontGame.draw(
|
||||
batch, zoomText,
|
||||
(AppLoader.screenSize.screenW * TerrarumScreenSize.TV_SAFE_GRAPHICS + 1).toInt().toFloat(),
|
||||
(AppLoader.screenSize.screenH - height - AppLoader.screenSize.tvSafeGraphicsHeight).toFloat()
|
||||
(App.scr.width * TerrarumScreenSize.TV_SAFE_GRAPHICS + 1).toInt().toFloat(),
|
||||
(App.scr.height - height - App.scr.tvSafeGraphicsHeight).toFloat()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.gameworld.WorldTime
|
||||
import net.torvald.terrarum.modulebasegame.imagefont.WatchFont
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -46,7 +45,7 @@ class UITierOneWatch() : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(App.getConfigInt("config_keyinteract"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -19,8 +19,8 @@ class UITitleCharactersList : UICanvas() {
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaBorder = 8
|
||||
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - moduleAreaHMargin * 2
|
||||
override var width = App.scr.width - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = App.scr.height - moduleAreaHMargin * 2
|
||||
|
||||
private val moduleInfoCells = ArrayList<UIItemSavegameInfoCell>()
|
||||
// build characters list
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -20,14 +20,14 @@ class UITitleLanguage : UICanvas() {
|
||||
|
||||
|
||||
private val textAreaHMargin = 48
|
||||
override var width = (AppLoader.screenSize.screenW * 0.75).toInt()
|
||||
override var height = AppLoader.screenSize.screenH - textAreaHMargin * 2
|
||||
override var width = (App.scr.width * 0.75).toInt()
|
||||
override var height = App.scr.height - textAreaHMargin * 2
|
||||
|
||||
private val localeList = Lang.languageList.toList().sorted()
|
||||
private val textArea = UIItemTextButtonList(this,
|
||||
24,
|
||||
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(),
|
||||
AppLoader.screenSize.screenW - width, textAreaHMargin,
|
||||
App.scr.width - width, textAreaHMargin,
|
||||
width, height,
|
||||
textAreaWidth = width,
|
||||
readFromLang = false,
|
||||
@@ -51,7 +51,7 @@ class UITitleLanguage : UICanvas() {
|
||||
|
||||
// attach listeners
|
||||
textArea.selectionChangeListener = { _, newSelectionIndex ->
|
||||
AppLoader.GAME_LOCALE = localeList[newSelectionIndex]
|
||||
App.GAME_LOCALE = localeList[newSelectionIndex]
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.blendNormal
|
||||
@@ -21,8 +21,8 @@ class UITitleModules : UICanvas() {
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaBorder = 8
|
||||
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - moduleAreaHMargin * 2
|
||||
override var width = App.scr.width - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = App.scr.height - moduleAreaHMargin * 2
|
||||
|
||||
|
||||
private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Yaml
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ object UITitleRemoConYaml {
|
||||
- MENU_LABEL_RETURN
|
||||
""".trimIndent()*/
|
||||
|
||||
operator fun invoke() = if (AppLoader.IS_DEVELOPMENT_BUILD)
|
||||
operator fun invoke() = if (App.IS_DEVELOPMENT_BUILD)
|
||||
Yaml(menus + "\n" + debugTools).parse()
|
||||
else
|
||||
Yaml(menus).parse()
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CreditSingleton
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -15,8 +15,8 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
|
||||
|
||||
private val textAreaHMargin = 48
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - textAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - textAreaHMargin * 2
|
||||
override var width = App.scr.width - UIRemoCon.remoConWidth - textAreaHMargin
|
||||
override var height = App.scr.height - textAreaHMargin * 2
|
||||
private val textArea = UIItemTextArea(this,
|
||||
UIRemoCon.remoConWidth, textAreaHMargin,
|
||||
width, height
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -28,7 +28,7 @@ class UITooltip : UICanvas() {
|
||||
msgWidth = msgBuffer.maxOf { font.getWidth(it) }
|
||||
}
|
||||
|
||||
private val font = AppLoader.fontGame
|
||||
private val font = App.fontGame
|
||||
private var msgWidth = 0
|
||||
|
||||
val textMarginX = 4
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.colourutil.darkerLab
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -50,8 +50,8 @@ class UIVitalMetre(
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
handler.setPosition(
|
||||
AppLoader.screenSize.halfScreenW,
|
||||
AppLoader.screenSize.halfScreenH
|
||||
App.scr.halfw,
|
||||
App.scr.halfh
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package net.torvald.terrarum.modulebasegame.worldgenerator
|
||||
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.sudoplay.joise.Joise
|
||||
import com.sudoplay.joise.module.ModuleAutoCorrect
|
||||
import com.sudoplay.joise.module.ModuleBasisFunction
|
||||
import com.sudoplay.joise.module.ModuleFractal
|
||||
import com.sudoplay.joise.module.ModuleScaleDomain
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||
import net.torvald.terrarum.concurrent.sliceEvenly
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
import java.util.concurrent.Future
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
@@ -49,7 +47,7 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
|
||||
|
||||
ThreadExecutor.join()
|
||||
|
||||
AppLoader.printdbg(this, "Waking up Worldgen")
|
||||
App.printdbg(this, "Waking up Worldgen")
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -3,14 +3,11 @@ package net.torvald.terrarum.modulebasegame.worldgenerator
|
||||
import com.sudoplay.joise.Joise
|
||||
import com.sudoplay.joise.module.*
|
||||
import net.torvald.random.XXHash32
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||
import net.torvald.terrarum.concurrent.sliceEvenly
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.toInt
|
||||
import java.util.concurrent.Future
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.jme3.math.FastMath
|
||||
import com.sudoplay.joise.Joise
|
||||
import com.sudoplay.joise.module.*
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.concurrent.ThreadParallel
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package net.torvald.terrarum.modulebasegame.worldgenerator
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
/**
|
||||
* New world generator.
|
||||
@@ -35,7 +34,7 @@ object Worldgen {
|
||||
|
||||
val it = jobs[i]
|
||||
|
||||
AppLoader.getLoadScreen().addMessage(it.loadingScreenName)
|
||||
App.getLoadScreen().addMessage(it.loadingScreenName)
|
||||
it.theWork.getDone()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.serialise
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import net.torvald.gdx.graphics.PixmapIO2
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
@@ -45,7 +45,7 @@ object WriteSavegame {
|
||||
|
||||
|
||||
val creation_t = ingame.world.creationTime
|
||||
val time_t = AppLoader.getTIME_T()
|
||||
val time_t = App.getTIME_T()
|
||||
val currentPlayTime_t = time_t - ingame.loadedTime_t
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ object LoadSavegame {
|
||||
private fun getFileReader(disk: VirtualDisk, id: Int): Reader = ByteArray64Reader(getFileBytes(disk, id), Common.CHARSET)
|
||||
|
||||
operator fun invoke(disk: VirtualDisk) {
|
||||
val ingame = TerrarumIngame(AppLoader.batch)
|
||||
val ingame = TerrarumIngame(App.batch)
|
||||
|
||||
// NOTE: do NOT set ingame.actorNowPlaying as one read directly from the disk;
|
||||
// you'll inevitably read the player actor twice, and they're separate instances of the player!
|
||||
@@ -166,7 +166,7 @@ object LoadSavegame {
|
||||
// ModMgr.reloadModules()
|
||||
|
||||
Terrarum.setCurrentIngameInstance(ingame)
|
||||
AppLoader.setScreen(ingame)
|
||||
App.setScreen(ingame)
|
||||
|
||||
Echo("${ccW}Savegame loaded from $ccY${disk.getDiskNameString(Common.CHARSET)}")
|
||||
printdbg(this, "Savegame loaded from ${disk.getDiskNameString(Common.CHARSET)}")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.swingapp
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import java.awt.BorderLayout
|
||||
import java.awt.FlowLayout
|
||||
@@ -45,7 +45,7 @@ class IMStringReader(feedInput: (String) -> Unit, message: String? = null) : JFr
|
||||
this.title = labelTitle
|
||||
defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE
|
||||
|
||||
AppLoader.getINSTANCE().pause()
|
||||
App.getINSTANCE().pause()
|
||||
|
||||
buttonOkay.addMouseListener(object : MouseListener {
|
||||
override fun mouseEntered(e: MouseEvent?) { }
|
||||
@@ -55,7 +55,7 @@ class IMStringReader(feedInput: (String) -> Unit, message: String? = null) : JFr
|
||||
override fun mousePressed(e: MouseEvent?) {
|
||||
userInput = inputArea.text
|
||||
isVisible = false
|
||||
AppLoader.getINSTANCE().resume()
|
||||
App.getINSTANCE().resume()
|
||||
|
||||
feedInput(userInput)
|
||||
|
||||
@@ -71,7 +71,7 @@ class IMStringReader(feedInput: (String) -> Unit, message: String? = null) : JFr
|
||||
override fun mousePressed(e: MouseEvent?) {
|
||||
userInput = ""//null
|
||||
isVisible = false
|
||||
AppLoader.getINSTANCE().resume()
|
||||
App.getINSTANCE().resume()
|
||||
|
||||
dispose()
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class IMStringReader(feedInput: (String) -> Unit, message: String? = null) : JFr
|
||||
override fun keyPressed(e: KeyEvent?) {
|
||||
userInput = inputArea.text
|
||||
isVisible = false
|
||||
AppLoader.getINSTANCE().resume()
|
||||
App.getINSTANCE().resume()
|
||||
|
||||
feedInput(userInput)
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ import com.sudoplay.joise.module.ModuleBasisFunction
|
||||
import com.sudoplay.joise.module.ModuleFractal
|
||||
import com.sudoplay.joise.module.ModuleScaleOffset
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||
import net.torvald.terrarum.concurrent.sliceEvenly
|
||||
import net.torvald.terrarum.inUse
|
||||
@@ -45,11 +44,11 @@ class NoiseGenerator : ScreenAdapter() {
|
||||
Gdx.input.inputProcessor = NoiseGeneratorController(this)
|
||||
|
||||
batch = SpriteBatch()
|
||||
camera = OrthographicCamera(AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
camera = OrthographicCamera(App.scr.wf, App.scr.hf)
|
||||
|
||||
camera.setToOrtho(true, AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf)
|
||||
camera.setToOrtho(true, App.scr.wf, App.scr.hf)
|
||||
camera.update()
|
||||
Gdx.gl20.glViewport(0, 0, AppLoader.screenSize.screenW, AppLoader.screenSize.screenH)
|
||||
Gdx.gl20.glViewport(0, 0, App.scr.width, App.scr.height)
|
||||
|
||||
pixmap = Pixmap(IMAGE_SIZE, IMAGE_SIZE, Pixmap.Format.RGBA8888)
|
||||
texture = Texture(1, 1, Pixmap.Format.RGBA8888)
|
||||
@@ -142,7 +141,7 @@ class NoiseGenerator : ScreenAdapter() {
|
||||
batch.draw(texture, 0f, 0f)
|
||||
|
||||
batch.color = Color.CYAN
|
||||
AppLoader.fontGame.draw(batch, "Tests: $totalTestsDone / ${testSets.size * samplingCount}", 10f, 10f)
|
||||
App.fontGame.draw(batch, "Tests: $totalTestsDone / ${testSets.size * samplingCount}", 10f, 10f)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -258,5 +257,5 @@ fun main(args: Array<String>) {
|
||||
appConfig.setResizable(false)
|
||||
appConfig.setWindowedMode(1024, 1024)
|
||||
|
||||
Lwjgl3Application(AppLoader(appConfig, NoiseGenerator()), appConfig)
|
||||
Lwjgl3Application(App(appConfig, NoiseGenerator()), appConfig)
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class UITestPad1 : ScreenAdapter() {
|
||||
Color.LIME
|
||||
else
|
||||
Color.FIREBRICK
|
||||
AppLoader.fontGame.draw(batch, "Mouse: ${Terrarum.mouseScreenX}, ${Terrarum.mouseScreenY}", 8f, 740 - 28f)
|
||||
App.fontGame.draw(batch, "Mouse: ${Terrarum.mouseScreenX}, ${Terrarum.mouseScreenY}", 8f, 740 - 28f)
|
||||
}
|
||||
|
||||
_dct = (_dct + delta*2) % 10f
|
||||
@@ -156,5 +156,5 @@ fun main(args: Array<String>) {
|
||||
appConfig.setResizable(false)
|
||||
appConfig.setWindowedMode(UITEST1_WIDTH, UITEST1_HEIGHT)
|
||||
|
||||
Lwjgl3Application(AppLoader(appConfig, UITestPad1()), appConfig)
|
||||
Lwjgl3Application(App(appConfig, UITestPad1()), appConfig)
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory
|
||||
import net.torvald.terrarum.realestate.LandUtil
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
|
||||
@@ -25,8 +24,8 @@ import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
*/
|
||||
class BasicDebugInfoWindow : UICanvas() {
|
||||
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = App.scr.height
|
||||
|
||||
override var openCloseTime: Float = 0f
|
||||
|
||||
@@ -78,7 +77,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
|
||||
val hitbox = player?.hitbox
|
||||
|
||||
val updateCount = maxOf(1L, (AppLoader.debugTimers["Ingame.UpdateCounter"] ?: 1L) as Long)
|
||||
val updateCount = maxOf(1L, (App.debugTimers["Ingame.UpdateCounter"] ?: 1L) as Long)
|
||||
|
||||
/**
|
||||
* First column
|
||||
@@ -172,7 +171,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
|
||||
// print time
|
||||
var dbgCnt = 12
|
||||
AppLoader.debugTimers.forEach { t, u ->
|
||||
App.debugTimers.forEach { t, u ->
|
||||
printLine(batch, dbgCnt, "$ccM$t $ccG${formatNanoTime(u as? Long)}$ccY ns")
|
||||
dbgCnt++
|
||||
}
|
||||
@@ -206,9 +205,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
val gamepad = (Terrarum.ingame as? TerrarumIngame)?.ingameController?.gamepad
|
||||
if (gamepad != null) {
|
||||
drawGamepadAxis(gamepad, batch,
|
||||
gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxislx")),
|
||||
gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisly")),
|
||||
AppLoader.screenSize.screenW - 128 - TinyAlphNum.W * 2,
|
||||
gamepad.getAxis(App.getConfigInt("config_gamepadaxislx")),
|
||||
gamepad.getAxis(App.getConfigInt("config_gamepadaxisly")),
|
||||
App.scr.width - 128 - TinyAlphNum.W * 2,
|
||||
line(3).toInt()
|
||||
)
|
||||
}
|
||||
@@ -218,68 +217,68 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
*/
|
||||
|
||||
// memory pressure
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}MEM ", (AppLoader.screenSize.screenW - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}MEM ", (App.scr.width - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
// thread count
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (AppLoader.MULTITHREAD) ccG else ccR}${AppLoader.THREAD_COUNT.toString().padStart(2, ' ')}",
|
||||
(AppLoader.screenSize.screenW - 2 - 8 * TinyAlphNum.W).toFloat(), line(2))
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (App.MULTITHREAD) ccG else ccR}${App.THREAD_COUNT.toString().padStart(2, ' ')}",
|
||||
(App.scr.width - 2 - 8 * TinyAlphNum.W).toFloat(), line(2))
|
||||
|
||||
// memory texts
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
||||
(AppLoader.screenSize.screenW - 19 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
AppLoader.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
||||
(AppLoader.screenSize.screenW - 14 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
||||
(AppLoader.screenSize.screenW - 7 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
App.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
||||
(App.scr.width - 19 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
App.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
||||
(App.scr.width - 14 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
App.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
||||
(App.scr.width - 7 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
// FPS count
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
||||
(AppLoader.screenSize.screenW - 3 - 15 * TinyAlphNum.W).toFloat(), line(2))
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
||||
(App.scr.width - 3 - 15 * TinyAlphNum.W).toFloat(), line(2))
|
||||
// global render counter
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccO}${AppLoader.GLOBAL_RENDER_TIMER.toString().padStart(10, ' ')}",
|
||||
(AppLoader.screenSize.screenW - 35 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
App.fontSmallNumbers.draw(batch, "${ccO}${App.GLOBAL_RENDER_TIMER.toString().padStart(10, ' ')}",
|
||||
(App.scr.width - 35 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
|
||||
/**
|
||||
* Bottom left
|
||||
*/
|
||||
|
||||
if (ingame != null) {
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
|
||||
TinyAlphNum.W * 2f, AppLoader.screenSize.screenH - TinyAlphNum.H * 2f)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
|
||||
(TinyAlphNum.W * 2 + 17 * 8).toFloat(), AppLoader.screenSize.screenH - TinyAlphNum.H * 2f)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
|
||||
(TinyAlphNum.W * 2 + 28 * 8).toFloat(), AppLoader.screenSize.screenH - TinyAlphNum.H * 2f)
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
|
||||
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 2f)
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
|
||||
(TinyAlphNum.W * 2 + 17 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
|
||||
(TinyAlphNum.W * 2 + 28 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
|
||||
if (ingame is TerrarumIngame) {
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}",
|
||||
(TinyAlphNum.W * 2 + 41 * 8).toFloat(), AppLoader.screenSize.screenH - TinyAlphNum.H * 2f)
|
||||
App.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}",
|
||||
(TinyAlphNum.W * 2 + 41 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
|
||||
}
|
||||
}
|
||||
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
||||
TinyAlphNum.W * 2f, AppLoader.screenSize.screenH - TinyAlphNum.H * 3f)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}UIs rendering $ccG${IngameRenderer.renderingUIsCount}",
|
||||
TinyAlphNum.W * 2f + (21 * 8), AppLoader.screenSize.screenH - TinyAlphNum.H * 3f)
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
||||
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 3f)
|
||||
App.fontSmallNumbers.draw(batch, "${ccY}UIs rendering $ccG${IngameRenderer.renderingUIsCount}",
|
||||
TinyAlphNum.W * 2f + (21 * 8), App.scr.height - TinyAlphNum.H * 3f)
|
||||
|
||||
/**
|
||||
* Bottom right
|
||||
*/
|
||||
|
||||
// processor and renderer
|
||||
AppLoader.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
||||
(AppLoader.screenSize.screenW - (totalHardwareName.length + 2) * TinyAlphNum.W).toFloat(), AppLoader.screenSize.screenH - TinyAlphNum.H * 2f)
|
||||
App.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
||||
(App.scr.width - (totalHardwareName.length + 2) * TinyAlphNum.W).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
|
||||
}
|
||||
|
||||
private val processorName = AppLoader.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "") + if (AppLoader.is32BitJVM) " (32-bit)" else ""
|
||||
private val rendererName = AppLoader.renderer
|
||||
private val processorName = App.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "") + if (App.is32BitJVM) " (32-bit)" else ""
|
||||
private val rendererName = App.renderer
|
||||
private val totalHardwareName = "$processorName $rendererName"
|
||||
|
||||
private fun printLine(batch: SpriteBatch, l: Int, s: String) {
|
||||
AppLoader.fontSmallNumbers.draw(batch,
|
||||
App.fontSmallNumbers.draw(batch,
|
||||
s, TinyAlphNum.W * 2f, line(l)
|
||||
)
|
||||
}
|
||||
|
||||
private fun printLineColumn(batch: SpriteBatch, col: Int, row: Int, s: String) {
|
||||
AppLoader.fontSmallNumbers.draw(batch,
|
||||
App.fontSmallNumbers.draw(batch,
|
||||
s, (TinyAlphNum.W * 2f + column(col)), line(row)
|
||||
)
|
||||
}
|
||||
@@ -303,9 +302,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
batch.color = uiColour
|
||||
batch.fillRect(x.toFloat(), y.toFloat(), w.plus(1), h)
|
||||
batch.color = Color.GRAY
|
||||
AppLoader.fontSmallNumbers.draw(batch, "0", x.toFloat(), y.toFloat() + h + 2)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "255", x.toFloat() + w + 1 - 8 * 3, y.toFloat() + h + 2)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "Histogramme", x + w / 2 - 5.5f * 8, y.toFloat() + h + 2)
|
||||
App.fontSmallNumbers.draw(batch, "0", x.toFloat(), y.toFloat() + h + 2)
|
||||
App.fontSmallNumbers.draw(batch, "255", x.toFloat() + w + 1 - 8 * 3, y.toFloat() + h + 2)
|
||||
App.fontSmallNumbers.draw(batch, "Histogramme", x + w / 2 - 5.5f * 8, y.toFloat() + h + 2)
|
||||
|
||||
blendScreen(batch)
|
||||
for (c in 0..3) {
|
||||
@@ -340,7 +339,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
val pointDX = axisX * halfW
|
||||
val pointDY = -axisY * halfH
|
||||
|
||||
val deadzone = AppLoader.gamepadDeadzone
|
||||
val deadzone = App.gamepadDeadzone
|
||||
|
||||
blendNormal(batch)
|
||||
|
||||
@@ -348,16 +347,16 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
gdxSetBlendNormal()
|
||||
Terrarum.inShapeRenderer {
|
||||
it.color = uiColour
|
||||
it.rect(uiX.toFloat(), AppLoader.screenSize.screenH - uiY.toFloat(), w, -h)
|
||||
it.rect(uiX.toFloat(), App.scr.height - uiY.toFloat(), w, -h)
|
||||
it.color = deadzoneColour
|
||||
it.rect(uiX + halfW - (halfW * deadzone), AppLoader.screenSize.screenH - (uiY + halfH - halfH * deadzone), w * deadzone, -h * deadzone)
|
||||
it.rect(uiX + halfW - (halfW * deadzone), App.scr.height - (uiY + halfH - halfH * deadzone), w * deadzone, -h * deadzone)
|
||||
it.color = Color.WHITE
|
||||
it.line(uiX + halfW, AppLoader.screenSize.screenH - (uiY + halfH), uiX + halfW + pointDX, AppLoader.screenSize.screenH - (uiY + halfH + pointDY))
|
||||
it.line(uiX + halfW, App.scr.height - (uiY + halfH), uiX + halfW + pointDX, App.scr.height - (uiY + halfH + pointDY))
|
||||
it.color = Color.GRAY
|
||||
}
|
||||
batch.begin()
|
||||
|
||||
AppLoader.fontSmallNumbers.draw(batch, gamepad.getName(), AppLoader.screenSize.screenW - (gamepad.getName().length + 2f) * TinyAlphNum.W, uiY.toFloat() + h + 2)
|
||||
App.fontSmallNumbers.draw(batch, gamepad.getName(), App.scr.width - (gamepad.getName().length + 2f) * TinyAlphNum.W, uiY.toFloat() + h + 2)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class ConsoleWindow : UICanvas() {
|
||||
private val LINE_HEIGHT = 20
|
||||
private val MESSAGES_DISPLAY_COUNT = 11
|
||||
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var width: Int = App.scr.width
|
||||
override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1)
|
||||
|
||||
override var openCloseTime = 0f
|
||||
@@ -78,12 +78,12 @@ class ConsoleWindow : UICanvas() {
|
||||
batch.fillRect(drawOffX, drawOffY, width.toFloat(), LINE_HEIGHT.toFloat())
|
||||
|
||||
val input = commandInputPool!!.toString()
|
||||
val inputDrawWidth = AppLoader.fontGame.getWidth(input)
|
||||
val inputDrawHeight = AppLoader.fontGame.lineHeight
|
||||
val inputDrawWidth = App.fontGame.getWidth(input)
|
||||
val inputDrawHeight = App.fontGame.lineHeight
|
||||
|
||||
// text and cursor
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, input, 1f + drawOffX, drawOffY)
|
||||
App.fontGame.draw(batch, input, 1f + drawOffX, drawOffY)
|
||||
|
||||
batch.color = Color(0x7f7f7f_ff)
|
||||
batch.fillRect(inputDrawWidth.toFloat() + drawOffX + 1, drawOffY, 2f, inputDrawHeight)
|
||||
@@ -94,7 +94,7 @@ class ConsoleWindow : UICanvas() {
|
||||
// messages
|
||||
for (i in 0..MESSAGES_DISPLAY_COUNT - 1) {
|
||||
val message = messages[messageDisplayPos + i]
|
||||
AppLoader.fontGame.draw(batch, message, 1f + drawOffX, (LINE_HEIGHT * (i + 1)).toFloat() + drawOffY)
|
||||
App.fontGame.draw(batch, message, 1f + drawOffX, (LINE_HEIGHT * (i + 1)).toFloat() + drawOffY)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ class ConsoleWindow : UICanvas() {
|
||||
commandInputPool = StringBuilder()
|
||||
|
||||
if (Authenticator.b()) {
|
||||
sendMessage("$ccE${TerrarumAppConfiguration.GAME_NAME} ${AppLoader.getVERSION_STRING()} $EMDASH ${TerrarumAppConfiguration.COPYRIGHT_DATE_NAME}")
|
||||
sendMessage("$ccE${TerrarumAppConfiguration.GAME_NAME} ${App.getVERSION_STRING()} $EMDASH ${TerrarumAppConfiguration.COPYRIGHT_DATE_NAME}")
|
||||
sendMessage("$ccE${TerrarumAppConfiguration.COPYRIGHT_LICENSE}")
|
||||
sendMessage(Lang["DEV_MESSAGE_CONSOLE_CODEX"])
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.fillRect
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
@@ -26,7 +26,7 @@ object Toolkit {
|
||||
|
||||
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
|
||||
val imageW = image.width
|
||||
val targetW = if (ui == null) AppLoader.screenSize.screenW else ui.width
|
||||
val targetW = if (ui == null) App.scr.width else ui.width
|
||||
|
||||
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import kotlin.math.roundToInt
|
||||
@@ -86,7 +86,7 @@ abstract class UICanvas(
|
||||
get() = _mouseUpThis || handler.mouseUp
|
||||
/** If mouse is hovering over it and mouse is down */
|
||||
val mousePushed: Boolean
|
||||
get() = mouseUp && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))
|
||||
get() = mouseUp && Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary"))
|
||||
|
||||
private val _mouseUpThis: Boolean
|
||||
get() = relativeMouseX in 0..width - 1 && relativeMouseY in 0..height - 1
|
||||
@@ -148,7 +148,7 @@ abstract class UICanvas(
|
||||
uiItems.add(uiItem)
|
||||
}
|
||||
|
||||
fun mouseInScreen(x: Int, y: Int) = x in 0 until AppLoader.screenSize.screenW && y in 0 until AppLoader.screenSize.screenH
|
||||
fun mouseInScreen(x: Int, y: Int) = x in 0 until App.scr.width && y in 0 until App.scr.height
|
||||
|
||||
/**
|
||||
* Called by the screen's InputProcessor
|
||||
@@ -307,13 +307,13 @@ abstract class UICanvas(
|
||||
).roundToInt()
|
||||
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenSize.screenWf,
|
||||
AppLoader.screenSize.screenW - ui.width.toFloat()
|
||||
App.scr.wf,
|
||||
App.scr.width - ui.width.toFloat()
|
||||
).roundToInt()
|
||||
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenSize.screenHf,
|
||||
AppLoader.screenSize.screenH - ui.height.toFloat()
|
||||
App.scr.hf,
|
||||
App.scr.height - ui.height.toFloat()
|
||||
).roundToInt()
|
||||
}
|
||||
}
|
||||
@@ -331,13 +331,13 @@ abstract class UICanvas(
|
||||
).roundToInt()
|
||||
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenSize.screenW - ui.width.toFloat(),
|
||||
AppLoader.screenSize.screenWf
|
||||
App.scr.width - ui.width.toFloat(),
|
||||
App.scr.wf
|
||||
).roundToInt()
|
||||
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenSize.screenH - ui.height.toFloat(),
|
||||
AppLoader.screenSize.screenHf
|
||||
App.scr.height - ui.height.toFloat(),
|
||||
App.scr.hf
|
||||
).roundToInt()
|
||||
}
|
||||
}
|
||||
@@ -345,16 +345,16 @@ abstract class UICanvas(
|
||||
when (position) {
|
||||
Position.LEFT -> ui.handler.posX = 0
|
||||
Position.TOP -> ui.handler.posY = 0
|
||||
Position.RIGHT -> ui.handler.posX = AppLoader.screenSize.screenW - ui.width
|
||||
Position.BOTTOM -> ui.handler.posY = AppLoader.screenSize.screenH - ui.height
|
||||
Position.RIGHT -> ui.handler.posX = App.scr.width - ui.width
|
||||
Position.BOTTOM -> ui.handler.posY = App.scr.height - ui.height
|
||||
}
|
||||
}
|
||||
fun endClosingPopOut(ui: UICanvas, position: Position) {
|
||||
when (position) {
|
||||
Position.LEFT -> ui.handler.posX = -ui.width
|
||||
Position.TOP -> ui.handler.posY = -ui.height
|
||||
Position.RIGHT -> ui.handler.posX = AppLoader.screenSize.screenW
|
||||
Position.BOTTOM -> ui.handler.posY = AppLoader.screenSize.screenH
|
||||
Position.RIGHT -> ui.handler.posX = App.scr.width
|
||||
Position.BOTTOM -> ui.handler.posY = App.scr.height
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user