From dba0f6990ea5a37a7da15bcd10bb443f1b6178e9 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sun, 30 Nov 2014 11:11:35 +0100 Subject: [PATCH] Actually make the instance of GraphicsSettings private. --- src/de/teamteamteam/spacescooter/Main.java | 2 +- .../spacescooter/utility/GraphicsSettings.java | 8 +++++++- src/de/teamteamteam/spacescooter/utility/Loader.java | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/Main.java b/src/de/teamteamteam/spacescooter/Main.java index 00be404..f8e32f2 100644 --- a/src/de/teamteamteam/spacescooter/Main.java +++ b/src/de/teamteamteam/spacescooter/Main.java @@ -25,7 +25,7 @@ public class Main { * @param args Command line arguments. */ public static void main(String[] args) { - final GraphicsSettings gs = GraphicsSettings.instance; // Get settings + final GraphicsSettings gs = GraphicsSettings.getInstance(); // Get settings // Initialize SuperScreen and add to GameFrame, so we can call doPaint() // on it. diff --git a/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java b/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java index 143377e..1df4f45 100644 --- a/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java +++ b/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java @@ -44,7 +44,7 @@ public class GraphicsSettings { /** * Instance holder for GraphicsSettings. */ - public static GraphicsSettings instance; + private static GraphicsSettings instance; /** @@ -124,4 +124,10 @@ public class GraphicsSettings { return compatibleImage; } + /** + * Get the instance of GraphicsSettings + */ + public static GraphicsSettings getInstance() { + return GraphicsSettings.instance; + } } diff --git a/src/de/teamteamteam/spacescooter/utility/Loader.java b/src/de/teamteamteam/spacescooter/utility/Loader.java index 52e6bbd..e9c9c44 100644 --- a/src/de/teamteamteam/spacescooter/utility/Loader.java +++ b/src/de/teamteamteam/spacescooter/utility/Loader.java @@ -185,10 +185,10 @@ public class Loader { * current ScreenDevice. */ private static BufferedImage createCompatibleImage(BufferedImage storedImage) { - if(GraphicsSettings.instance.getColorModel().equals(storedImage.getColorModel())) { + if(GraphicsSettings.getInstance().getColorModel().equals(storedImage.getColorModel())) { return storedImage; } else { - return GraphicsSettings.instance.createCompatibleBufferedImage(storedImage); + return GraphicsSettings.getInstance().createCompatibleBufferedImage(storedImage); } }