Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaUserA committed Sep 6, 2018
1 parent 55cc2bc commit a6d0066
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/PowerHigh"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PowerHighWindow</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=9
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=9
43 changes: 43 additions & 0 deletions src/org/powerhigh/addon/window/WindowUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.powerhigh.addon.window;

import java.awt.Color;
import java.awt.Image;
import org.lggl.SizedViewport;
import org.lggl.game.SimpleGame;
import org.lggl.graphics.Window;
import org.lggl.utils.debug.DebugLogger;

public class WindowUtils {

public static void launchDebug(SimpleGame game, boolean isLaunchDebugEnabled) {
game.enableLaunchDebug = isLaunchDebugEnabled;
}

public static void setWindowIcon(Window win, Image icon) {
win.setIcon(icon);
}

public static void createWindow(Window win, Color bgc, boolean isWindowVisible, boolean isViewportManagerEnabled, boolean isWindowResizable, int WIDTH, int HEIGHT, String TITLE) {
win.setVisible(isWindowVisible);
win.setSize(WIDTH, HEIGHT);
win.setBackground(bgc);
win.setResizable(isWindowResizable);
win.setTitle(TITLE);
if (isViewportManagerEnabled == true) {
win.setViewportManager(new SizedViewport(WIDTH, HEIGHT));
}
}

public static void updateWindow(Window win, boolean debugCountedFPS, boolean isViewportEnabled, int WIDTH, int HEIGHT) {
if (win.isClosed()) {
System.exit(0);
}
if (debugCountedFPS == true) {
System.out.println("FPS: " + win.getFPS());
}
if (isViewportEnabled == true) {
win.setViewport(0, 0, WIDTH, HEIGHT);
}
}

}
26 changes: 26 additions & 0 deletions src/test/org/powerhigh/addon/window/AddonTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package test.org.powerhigh.addon.window;

import org.powerhigh.addon.window.WindowUtils;

import java.awt.Color;

import org.lggl.game.SimpleGame;
import org.lggl.graphics.Window;

public class AddonTest extends SimpleGame {

public static void main(String[] args) {
new AddonTest().start();
}

@Override
public void init(Window win) {
WindowUtils.createWindow(win, Color.BLUE, true, true, true, 800, 600, "Addon Test");
}

@Override
public void update(Window win, double delta) {
WindowUtils.updateWindow(win, true, false, 800, 600);
}

}

0 comments on commit a6d0066

Please sign in to comment.