diff options
Diffstat (limited to '')
-rw-r--r-- | src/subconscious/Actor.java | 2 | ||||
-rw-r--r-- | src/subconscious/Subconscious.java | 5 | ||||
-rw-r--r-- | src/subconscious/Tile.java | 1 | ||||
-rw-r--r-- | src/subconscious/graphics/Scene.java | 13 |
4 files changed, 20 insertions, 1 deletions
diff --git a/src/subconscious/Actor.java b/src/subconscious/Actor.java index 6551dab..8280fe8 100644 --- a/src/subconscious/Actor.java +++ b/src/subconscious/Actor.java @@ -10,7 +10,7 @@ public class Actor { private int x; private int y; - public class SkillSet { + public static class SkillSet { public int agility = 0; // public int strenght; // public int defense; diff --git a/src/subconscious/Subconscious.java b/src/subconscious/Subconscious.java index bf57424..60b52e5 100644 --- a/src/subconscious/Subconscious.java +++ b/src/subconscious/Subconscious.java @@ -7,6 +7,11 @@ import java.lang.Thread; public class Subconscious { public static void main(String[] args) { + // antialias fonts + System.setProperty("awt.useSystemAAFontSettings","on"); + // use hw accelleration + System.setProperty("sun.java2d.opengl", "true"); + // for debugging Thread.currentThread().setName("Main"); diff --git a/src/subconscious/Tile.java b/src/subconscious/Tile.java index 79a8a83..703b196 100644 --- a/src/subconscious/Tile.java +++ b/src/subconscious/Tile.java @@ -3,6 +3,7 @@ package subconscious; import java.util.ArrayList; public class Tile { + // TODO: create an EnumSet for other modifiers public enum Type { CLEAR, GRASS, WATER, MOUNTAIN, NONE }; diff --git a/src/subconscious/graphics/Scene.java b/src/subconscious/graphics/Scene.java index 5188ab4..113a46f 100644 --- a/src/subconscious/graphics/Scene.java +++ b/src/subconscious/graphics/Scene.java @@ -6,12 +6,14 @@ import subconscious.graphics.widget.Widget; import subconscious.graphics.widget.Clickable; import java.util.ArrayList; +import java.util.Map; import java.awt.Canvas; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.BorderLayout; import java.awt.Panel; +import java.awt.RenderingHints; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; @@ -45,6 +47,14 @@ public abstract class Scene extends Panel protected final long DESIRED_FPS = 60; protected final long DESIRED_DELTA_LOOP = (1000*1000*1000)/DESIRED_FPS; + protected final Map<RenderingHints.Key, ?> RENDERING_HINTS = Map.of( + RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON, + RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON, + RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED, + RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR, + // RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR, + RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED + ); protected ArrayList<Widget> widgets = new ArrayList<>(); @@ -95,6 +105,8 @@ public abstract class Scene extends Panel this(game, ""); } + /* */ + /* abstract methods */ // runs when the the scene thread starts protected abstract void build(); @@ -175,6 +187,7 @@ public abstract class Scene extends Panel do { do { Graphics2D g = (Graphics2D) this.buffer.getDrawGraphics(); + g.addRenderingHints(this.RENDERING_HINTS); this.render(g); this.renderWidgets(g); g.dispose(); |