Bladeren bron

JmeContext: add a getSystemListener() method (#1894)

Stephen Gold 2 jaren geleden
bovenliggende
commit
29e07614ec

+ 11 - 1
jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2021 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -257,6 +257,16 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex
         }
     }
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return listener;
+    }
+
     @Override
     public void setSystemListener(SystemListener listener) {
         this.listener = listener;

+ 8 - 1
jme3-core/src/main/java/com/jme3/system/JmeContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2021 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -92,6 +92,13 @@ public interface JmeContext {
      */
     public void setSettings(AppSettings settings);
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    public SystemListener getSystemListener();
+
     /**
      * Sets the listener that will receive events relating to context
      * creation, update, and destroy.

+ 11 - 1
jme3-core/src/main/java/com/jme3/system/NullContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,16 @@ public class NullContext implements JmeContext, Runnable {
         return Type.Headless;
     }
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return listener;
+    }
+
     @Override
     public void setSystemListener(SystemListener listener){
         this.listener = listener;

+ 11 - 1
jme3-desktop/src/main/java/com/jme3/system/AWTContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2018 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -149,6 +149,16 @@ public class AWTContext implements JmeContext {
       this.backgroundContext.setSettings(settings);
   }
 
+    /**
+     * Accesses the listener that receives events related to this context.
+    *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return backgroundContext.getSystemListener();
+    }
+
   @Override
   public void setSystemListener(final SystemListener listener) {
       backgroundContext.setSystemListener(listener);

+ 11 - 1
jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanelsContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2021 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -120,6 +120,16 @@ public class AwtPanelsContext implements JmeContext {
         return Type.OffscreenSurface;
     }
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return listener;
+    }
+
     @Override
     public void setSystemListener(SystemListener listener) {
         this.listener = listener;

+ 12 - 1
jme3-ios/src/main/java/com/jme3/system/ios/IGLESContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -83,6 +83,17 @@ public class IGLESContext implements JmeContext {
         }
     }
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        logger.log(Level.FINE, "IGLESContext getSystemListener");
+        return listener;
+    }
+
     @Override
     public void setSystemListener(SystemListener listener) {
         logger.log(Level.FINE, "IGLESContext setSystemListener");

+ 11 - 1
jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2022 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -91,6 +91,16 @@ public abstract class LwjglContext implements JmeContext {
     protected LwjglPlatform clPlatform;
     protected com.jme3.opencl.lwjgl.LwjglContext clContext;
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return listener;
+    }
+
     @Override
     public void setSystemListener(SystemListener listener) {
         this.listener = listener;

+ 11 - 1
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2022 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -133,6 +133,16 @@ public abstract class LwjglContext implements JmeContext {
     
     protected com.jme3.opencl.lwjgl.LwjglContext clContext;
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return listener;
+    }
+
     @Override
     public void setSystemListener(final SystemListener listener) {
         this.listener = listener;

+ 11 - 1
jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java

@@ -1,7 +1,7 @@
 package com.jme3.system.lwjgl;
 
 /*
- * Copyright (c) 2009-2022 jMonkeyEngine
+ * Copyright (c) 2009-2023 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -79,6 +79,16 @@ public abstract class LwjglContextVR implements JmeContext {
     protected Timer timer;
     protected SystemListener listener;
 
+    /**
+     * Accesses the listener that receives events related to this context.
+     *
+     * @return the pre-existing instance
+     */
+    @Override
+    public SystemListener getSystemListener() {
+        return listener;
+    }
+
     @Override
     public void setSystemListener(SystemListener listener) {
         this.listener = listener;