From 35301b0d274e7d5ab97f843009057395b7ab4aa7 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Fri, 28 Nov 2014 20:05:57 +0100 Subject: [PATCH] Add a config switch for antialiasing rendering hints. --- src/de/teamteamteam/spacescooter/GameFrame.java | 6 ++++-- src/de/teamteamteam/spacescooter/brain/GameConfig.java | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/GameFrame.java b/src/de/teamteamteam/spacescooter/GameFrame.java index d9b752d..9143e02 100644 --- a/src/de/teamteamteam/spacescooter/GameFrame.java +++ b/src/de/teamteamteam/spacescooter/GameFrame.java @@ -159,8 +159,10 @@ public class GameFrame extends JFrame { * KEY_ANTIALIASING is very expensive and doesn't do much more over KEY_TEXT_ANTIALIASING */ private void applyRenderingHints(Graphics2D bufferedGraphics) { - //bufferedGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - bufferedGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + if(GameConfig.antialiasing == true) { + bufferedGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + bufferedGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + } } /** diff --git a/src/de/teamteamteam/spacescooter/brain/GameConfig.java b/src/de/teamteamteam/spacescooter/brain/GameConfig.java index 5606cdb..420d175 100644 --- a/src/de/teamteamteam/spacescooter/brain/GameConfig.java +++ b/src/de/teamteamteam/spacescooter/brain/GameConfig.java @@ -25,6 +25,11 @@ public class GameConfig { */ public static String windowTitle = "SpaceScooter!"; + /** + * Whether or not anti aliasing rendering hints will be used. + */ + public static boolean antialiasing = false; + /** * Private constructor, this class will never be instantiated.