-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |