@@ -36,11 +36,14 @@ public class FastJEngine {
3636
3737 /** Default engine value for "frames per second" of at least {@code 60}, depending on the monitor's refresh rate. */
3838 public static final int DefaultFPS = Math .max (DisplayUtil .getDefaultMonitorRefreshRate (), 60 );
39+
3940 /** Default engine value for "updates per second" of {@code 60}. */
4041 public static final int DefaultUPS = 60 ;
42+
4143 /** Default engine value for the window resolution of the {@link Display} of {@code 1280*720}. */
4244 public static final Point DefaultWindowResolution = new Point (1280 , 720 );
43- /** Default engine value for the internal resolution of the {@link Display} of {@code 1280*720}. */
45+
46+ /** Default engine value for the window resolution of the {@link Display} of {@code 1280*720}. */
4447 public static final Point DefaultInternalResolution = new Point (1280 , 720 );
4548
4649 // engine speed variables
@@ -188,18 +191,24 @@ public static void configureInternalResolution(Point internalResolution) {
188191 public static void configureHardwareAcceleration (HWAccel hardwareAcceleration ) {
189192 runningCheck ();
190193
191- if (hardwareAcceleration .equals (HWAccel .Direct3D )) {
192- if (System .getProperty ("os.name" ).startsWith ("Win" )) {
193- HWAccel .setHardwareAcceleration (HWAccel .Direct3D );
194- hwAccel = hardwareAcceleration ;
195- } else {
196- warning ("This OS doesn't support Direct3D hardware acceleration. Configuration will be left at default." );
197- configureHardwareAcceleration (HWAccel .Default );
198- }
199- } else {
194+ if (isSystemSupportingHA (hardwareAcceleration )) {
200195 HWAccel .setHardwareAcceleration (hardwareAcceleration );
201196 hwAccel = hardwareAcceleration ;
197+ } else {
198+ warning (String .format ("This OS doesn't support %s hardware acceleration. Configuration will be left at default." , hardwareAcceleration .name ()));
199+ HWAccel .setHardwareAcceleration (HWAccel .Default );
200+ hwAccel = HWAccel .Default ;
201+ }
202+ }
203+
204+ private static boolean isSystemSupportingHA (HWAccel hardwareAcceleration ) {
205+ if (hardwareAcceleration .equals (HWAccel .Direct3D )) {
206+ return System .getProperty ("os.name" ).startsWith ("Win" );
207+ }
208+ else if (hardwareAcceleration .equals (HWAccel .X11 )) {
209+ return System .getProperty ("os.name" ).startsWith ("Linux" );
202210 }
211+ return true ;
203212 }
204213
205214 /**
0 commit comments