com.jme3.system.JmeContext Java Examples

The following examples show how to use com.jme3.system.JmeContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Handle the error given in parameters by creating a log entry and a dialog window. Internal use only.
 */
@Override
public void handleError(String errMsg, Throwable t){
    // Print error to log.
    logger.log(Level.SEVERE, errMsg, t);
    // Display error message on screen if not in headless mode
    if (context.getType() != JmeContext.Type.Headless) {
        if (t != null) {
            JmeSystem.showErrorDialog(errMsg + "\n" + t.getClass().getSimpleName() +
                    (t.getMessage() != null ? ": " +  t.getMessage() : ""));
        } else {
            JmeSystem.showErrorDialog(errMsg);
        }
    }

    stop(); // stop the application
}
 
Example #2
Source File: TestAppStates.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void start(JmeContext.Type contextType){
    AppSettings settings = new AppSettings(true);
    settings.setResolution(1024, 768);
    setSettings(settings);

    super.start(contextType);
}
 
Example #3
Source File: TestAppStates.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void start(JmeContext.Type contextType){
    AppSettings settings = new AppSettings(true);
    settings.setResolution(1024, 768);
    setSettings(settings);
    
    super.start(contextType);
}
 
Example #4
Source File: LwjglWindow.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public LwjglWindow(final JmeContext.Type type) {

        if (!SUPPORTED_TYPES.contains(type)) {
            throw new IllegalArgumentException("Unsupported type '" + type.name() + "' provided");
        }

        this.type = type;
    }
 
Example #5
Source File: LwjglWindowVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new wrapper class over the GLFW framework in LWJGL 3.
 * @param type the {@link com.jme3.system.JmeContext.Type type} of the display.
 */
public LwjglWindowVR(final JmeContext.Type type) {
    if (!JmeContext.Type.Display.equals(type) && !JmeContext.Type.OffscreenSurface.equals(type) && !JmeContext.Type.Canvas.equals(type)) {
        throw new IllegalArgumentException("Unsupported type '" + type.name() + "' provided");
    }

    this.type = type;
}
 
Example #6
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void initAudio(){
    if (settings.getAudioRenderer() != null && context.getType() != JmeContext.Type.Headless){
        audioRenderer = JmeSystem.newAudioRenderer(settings);
        audioRenderer.initialize();
        AudioContext.setAudioRenderer(audioRenderer);

        listener = new Listener();
        audioRenderer.setListener(listener);
    }
}
 
Example #7
Source File: JmeIosSystem.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public JmeContext newContext(AppSettings settings, JmeContext.Type contextType) {
    initialize(settings);
    JmeContext ctx = null;
    if (settings.getRenderer() == null
            || settings.getRenderer().equals("NULL")
            || contextType == JmeContext.Type.Headless) {
        ctx = new NullContext();
        ctx.setSettings(settings);
    } else {
        ctx = new IGLESContext();
        ctx.setSettings(settings);
    }
    return ctx;
}
 
Example #8
Source File: LwjglOffscreenBufferVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
* Create a new VR oriented LWJGL offscreen buffer.
*/
  public LwjglOffscreenBufferVR() {
      super(JmeContext.Type.OffscreenSurface);
  }
 
Example #9
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public JmeContext getContext(){
    return context;
}
 
Example #10
Source File: LwjglWindowVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @return Type.Display or Type.Canvas
 */
@Override
public JmeContext.Type getType() {
    return type;
}
 
Example #11
Source File: LwjglOffscreenBuffer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public LwjglOffscreenBuffer() {
    super(JmeContext.Type.OffscreenSurface);
}
 
Example #12
Source File: LwjglWindow.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @return Type.Display or Type.Canvas
 */
@Override
public JmeContext.Type getType() {
    return type;
}
 
Example #13
Source File: OpenRTSServer.java    From OpenRTS with MIT License 4 votes vote down vote up
public static void main(String[] args) {
	OpenRTSServer app = new OpenRTSServer();
	app.start(JmeContext.Type.Headless); // headless type for servers!
}
 
Example #14
Source File: AWTContext.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @return new context/
 */
protected JmeContext createBackgroundContext() {
    return JmeSystem.newContext(settings, Type.OffscreenSurface);
}
 
Example #15
Source File: Application.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * @return The {@link JmeContext display context} for the application
 */
public JmeContext getContext(){
    return context;
}
 
Example #16
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Starts the application in {@link com.jme3.system.JmeContext.Type#Display display} mode.
 * @param waitFor if <code>true</code>, the method will wait until the application is started.
 * @see #start(com.jme3.system.JmeContext.Type, boolean)
 */
@Override
public void start(boolean waitFor){
    start(JmeContext.Type.Display, waitFor);
}
 
Example #17
Source File: Application.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Starts the application in {@link Type#Display display} mode.
 * 
 * @see #start(com.jme3.system.JmeContext.Type) 
 */
public void start(){
    start(JmeContext.Type.Display);
}