Interface JmeContext

All Known Subinterfaces:
JmeCanvasContext
All Known Implementing Classes:
AWTContext, AwtPanelsContext, IGLESContext, LwjglAbstractDisplay, LwjglCanvas, LwjglContext, LwjglContextVR, LwjglDisplay, LwjglDisplayVR, LwjglOffscreenBuffer, LwjglOffscreenBufferVR, LwjglWindow, LwjglWindowVR, NullContext, OGLESContext

public interface JmeContext
Represents a rendering context within the engine.
  • Method Details

    • getType

      JmeContext.Type getType()
      Returns:
      The type of the context.
    • setSettings

      void setSettings(AppSettings settings)
      Parameters:
      settings - the display settings to use for the created context. If the context has already been created, then restart() must be called for the changes to be applied.
    • getSystemListener

      SystemListener getSystemListener()
      Accesses the listener that receives events related to this context.
      Returns:
      the pre-existing instance
    • setSystemListener

      void setSystemListener(SystemListener listener)
      Sets the listener that will receive events relating to context creation, update, and destroy.
      Parameters:
      listener - the desired listener
    • getSettings

      AppSettings getSettings()
      Returns:
      The current display settings. Note that they might be different from the ones set with setDisplaySettings() if the context was restarted or the settings changed internally.
    • getRenderer

      Renderer getRenderer()
      Returns:
      The renderer for this context, or null if not created yet.
    • getOpenCLContext

      Context getOpenCLContext()
      Returns:
      The OpenCL context if available.
    • getMouseInput

      MouseInput getMouseInput()
      Returns:
      Mouse input implementation. May be null if not available.
    • getKeyInput

      KeyInput getKeyInput()
      Returns:
      Keyboard input implementation. May be null if not available.
    • getJoyInput

      JoyInput getJoyInput()
      Returns:
      Joystick input implementation. May be null if not available.
    • getTouchInput

      TouchInput getTouchInput()
      Returns:
      Touch device input implementation. May be null if not available.
    • getTimer

      Timer getTimer()
      Returns:
      The timer for this context, or null if not created yet.
    • setTitle

      void setTitle(String title)
      Sets the title of the display (if available). This does nothing for fullscreen, headless, or canvas contexts.
      Parameters:
      title - The new title of the display.
    • isCreated

      boolean isCreated()
      Returns:
      True if the context has been created but not yet destroyed.
    • isRenderable

      boolean isRenderable()
      Returns:
      True if the context contains a valid render surface, if any of the rendering methods in Renderer are called while this is false, then the result is undefined.
    • setAutoFlushFrames

      void setAutoFlushFrames(boolean enabled)
      Parameters:
      enabled - If enabled, the context will automatically flush frames to the video card (swap buffers) after an update cycle.
    • create

      void create(boolean waitFor)
      Creates the context and makes it active.
      Parameters:
      waitFor - If true, will wait until context has initialized.
    • restart

      void restart()
      Destroys and then re-creates the context. This should be called after the display settings have been changed.
    • destroy

      void destroy(boolean waitFor)
      Destroys the context completely, making it inactive.
      Parameters:
      waitFor - If true, will wait until the context is destroyed fully.
    • getFramebufferHeight

      int getFramebufferHeight()
      Returns the height of the framebuffer.
      Returns:
      the height (in pixels)
      Throws:
      IllegalStateException - for a headless or null context
    • getFramebufferWidth

      int getFramebufferWidth()
      Returns the width of the framebuffer.
      Returns:
      the width (in pixels)
      Throws:
      IllegalStateException - for a headless or null context
    • getWindowXPosition

      int getWindowXPosition()
      Returns the screen X coordinate of the left edge of the content area.
      Returns:
      the screen X coordinate
      Throws:
      IllegalStateException - for a headless or null context
    • getWindowYPosition

      int getWindowYPosition()
      Returns the screen Y coordinate of the top edge of the content area.
      Returns:
      the screen Y coordinate
      Throws:
      IllegalStateException - for a headless or null context