~zenomat/javatorio

40519c2e7b7be942e63cbfba338df98d3bffc5d9 — zeno 1 year, 4 months ago f933dab main
update
M .project => .project +2 -2
@@ 16,12 16,12 @@
	</natures>
	<filteredResources>
		<filter>
			<id>0</id>
			<id>1671488836987</id>
			<name></name>
			<type>30</type>
			<matcher>
				<id>org.eclipse.core.resources.regexFilterMatcher</id>
				<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
			</matcher>
		</filter>
	</filteredResources>

M .settings/org.eclipse.buildship.core.prefs => .settings/org.eclipse.buildship.core.prefs +2 -2
@@ 1,11 1,11 @@
arguments=
arguments=--init-script /home/zeno/.cache/jdtls/config/org.eclipse.osgi/51/0/.cp/gradle/init/init.gradle
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/usr/lib/jvm/java-18-openjdk
java.home=/usr/lib/jvm/java-17-openjdk
jvm.arguments=
offline.mode=false
override.workspace.settings=true

M app/.classpath => app/.classpath +1 -7
@@ 6,12 6,6 @@
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/main" path="src/main/resources">
		<attributes>
			<attribute name="gradle_scope" value="main"/>
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="bin/test" path="src/test/java">
		<attributes>
			<attribute name="gradle_scope" value="test"/>


@@ 26,7 20,7 @@
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-18/"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
	<classpathentry kind="output" path="bin/default"/>
</classpath>

M app/.project => app/.project +2 -2
@@ 22,12 22,12 @@
	</natures>
	<filteredResources>
		<filter>
			<id>1651222388966</id>
			<id>1671488836984</id>
			<name></name>
			<type>30</type>
			<matcher>
				<id>org.eclipse.core.resources.regexFilterMatcher</id>
				<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
			</matcher>
		</filter>
	</filteredResources>

M app/.settings/org.eclipse.jdt.core.prefs => app/.settings/org.eclipse.jdt.core.prefs +3 -3
@@ 1,4 1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=18
org.eclipse.jdt.core.compiler.compliance=18
org.eclipse.jdt.core.compiler.source=18
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.source=17

M app/src/main/java/javatorio/app/App.java => app/src/main/java/javatorio/app/App.java +34 -29
@@ 19,10 19,10 @@ public class App {

	public static void main(String[] args) {
		// All the initalizations
		//      - initalize Screen
		//      - initalize GameState
		//      - initalize UIHandler
		//      - initalize EventHandler
		// - initalize Screen
		// - initalize GameState
		// - initalize UIHandler
		// - initalize EventHandler
		Terminal terminal = Terminal.getInstance();
		UIHandler uiHandler = UIHandler.getInstance();
		GameState gameState = GameState.getInstance();


@@ 33,54 33,54 @@ public class App {
		// Register the Map UI
		uiHandler.registerUIElement(
				new GameMap("GameMap", 1, 1, 120, 20));
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)uiHandler.findUIElement("GameMap"));
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) uiHandler.findUIElement("GameMap"));

		// Intantiate the player after the gamemap, because for it's constructor it depends on the Map
		// Intantiate the player after the gamemap, because for it's constructor it
		// depends on the Map
		Player player = Player.getInstance();

		// Register the log message UI
		uiHandler.registerUIElement(
				new LogUI());
		LogUI logUI = (LogUI)uiHandler.findUIElement("LogUI");
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)logUI);
		LogUI logUI = (LogUI) uiHandler.findUIElement("LogUI");
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) logUI);

		// Register the field display UI
		uiHandler.registerUIElement(
				new Display("FieldDisplay", Terminal.getInstance().screen.getTerminalSize().getColumns() - 80 - 1, Terminal.getInstance().screen.getTerminalSize().getRows() - 13, 80, 1));
		Display fieldDisplay = (Display)uiHandler.findUIElement("FieldDisplay");
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)fieldDisplay);
				new Display("FieldDisplay", Terminal.getInstance().screen.getTerminalSize().getColumns() - 80 - 1,
						Terminal.getInstance().screen.getTerminalSize().getRows() - 13, 80, 1));
		Display fieldDisplay = (Display) uiHandler.findUIElement("FieldDisplay");
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) fieldDisplay);

		// Initalize Cursor
		uiHandler.registerUIElement(
				new Cursor()
				);
				new Cursor());
		// Initalize Player
		uiHandler.registerUIElement(
				player
				);
				player);

		BuildMenu buildMenu = new BuildMenu();
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)buildMenu);
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) buildMenu);
		uiHandler.registerUIElement(buildMenu);

		CraftingMenu craftingMenu = new CraftingMenu();
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)craftingMenu);
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) craftingMenu);
		uiHandler.registerUIElement(craftingMenu);

		// We don't register Cursor and Player for KeyEvents, eventhough they need them,
		// because that gets taken care of by `setEnbaled()`,
		// as they don't always listen to KeyEvents, only when they are enabled
		Cursor cursor = (Cursor)uiHandler.findUIElement("Cursor");
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)cursor);
		Cursor cursor = (Cursor) uiHandler.findUIElement("Cursor");
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) cursor);

		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener)player);
		eventHandler.registerEvent(DrawEvent.class.getSimpleName(), (EventListener) player);

		// Register Player for TickEvent, because he uses it to move every tick,
		// till he reached the target position
		eventHandler.registerEvent(TickEvent.class.getSimpleName(), (EventListener)player);
		eventHandler.registerEvent(TickEvent.class.getSimpleName(), (EventListener) player);

		// Set the active Overlay to cursor
		cursor.setEnabled(true, (EventListener)cursor);
		cursor.setEnabled(true, (EventListener) cursor);

		// PlayerInventory.getInstance().addItemToInventory(new PrimitiveDrill());
		// PlayerInventory.getInstance().addItemToInventory(new ElectricalDrill());


@@ 103,13 103,16 @@ public class App {
					// emit KeyPress event
					switch (ks.getKeyType()) {
						case Enter:
							eventHandler.emitEvent(new KeyEvent("Ret", ks.isCtrlDown(), ks.isAltDown(), ks.isShiftDown()));
							eventHandler
									.emitEvent(new KeyEvent("Ret", ks.isCtrlDown(), ks.isAltDown(), ks.isShiftDown()));
							break;
						case Escape:
							eventHandler.emitEvent(new KeyEvent("Esc", ks.isCtrlDown(), ks.isAltDown(), ks.isShiftDown()));
							eventHandler
									.emitEvent(new KeyEvent("Esc", ks.isCtrlDown(), ks.isAltDown(), ks.isShiftDown()));
							break;
						case Character:
							eventHandler.emitEvent(new KeyEvent(ks.getCharacter().toString(), ks.isCtrlDown(), ks.isAltDown(), ks.isShiftDown()));
							eventHandler.emitEvent(new KeyEvent(ks.getCharacter().toString(), ks.isCtrlDown(),
									ks.isAltDown(), ks.isShiftDown()));
							break;
						default:
							break;


@@ 132,12 135,14 @@ public class App {
			// calculate the time the current processing-cycle took
			long timestamp2 = System.currentTimeMillis();
			long delta = timestamp2 - timestamp1;
			// take a total of 33 ms (30 fps) for the current loop -> 33 ms - time elapsed (delta)
			// take a total of 33 ms (30 fps) for the current loop -> 33 ms - time elapsed
			// (delta)
			try {
				Thread.sleep((long)33.0 - delta);
				Thread.sleep((long) 33.0 - delta);
			} catch (IllegalArgumentException ex) {
				logUI.addLogMessage("System", "WARNING: current loop took to long to compute. Took " + ((long)33.0 - delta) + " miliseconds to long");
			} catch (Exception e)  {
				logUI.addLogMessage("System", "WARNING: current loop took to long to compute. Took "
						+ ((long) 33.0 - delta) + " miliseconds to long");
			} catch (Exception e) {
				try {
					terminal.screen.stopScreen();
					System.err.println("ERROR: This is an internal error, report it to the developer");

M buildSrc/build/libs/buildSrc.jar => buildSrc/build/libs/buildSrc.jar +0 -0
M buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties => buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties +1 -1
@@ 1,1 1,1 @@
implementation-classpath=/home/adrian/code/javatorio/buildSrc/build/classes/java/main\:/home/adrian/code/javatorio/buildSrc/build/classes/groovy/main\:/home/adrian/code/javatorio/buildSrc/build/resources/main\:/home/adrian/code/javatorio/buildSrc/build/groovy-dsl-plugins/output/plugin-classes\:/home/adrian/code/javatorio/buildSrc/build/groovy-dsl-plugins/output/plugin-requests-staging
implementation-classpath=/home/zeno/code/javatorio/buildSrc/build/classes/java/main\:/home/zeno/code/javatorio/buildSrc/build/classes/groovy/main\:/home/zeno/code/javatorio/buildSrc/build/resources/main\:/home/zeno/code/javatorio/buildSrc/build/groovy-dsl-plugins/output/plugin-classes\:/home/zeno/code/javatorio/buildSrc/build/groovy-dsl-plugins/output/plugin-requests-staging

M buildSrc/build/tmp/compileJava/previous-compilation-data.bin => buildSrc/build/tmp/compileJava/previous-compilation-data.bin +0 -0
M libraries/.classpath => libraries/.classpath +1 -1
@@ 6,7 6,7 @@
			<attribute name="gradle_used_by_scope" value="main,test"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-18/"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
	<classpathentry kind="output" path="bin/default"/>
</classpath>

M libraries/.project => libraries/.project +2 -2
@@ 22,12 22,12 @@
	</natures>
	<filteredResources>
		<filter>
			<id>1651222388968</id>
			<id>1671488836991</id>
			<name></name>
			<type>30</type>
			<matcher>
				<id>org.eclipse.core.resources.regexFilterMatcher</id>
				<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
			</matcher>
		</filter>
	</filteredResources>

M libraries/.settings/org.eclipse.jdt.core.prefs => libraries/.settings/org.eclipse.jdt.core.prefs +3 -3
@@ 1,4 1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=18
org.eclipse.jdt.core.compiler.compliance=18
org.eclipse.jdt.core.compiler.source=18
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.source=17