Search in sources :

Example 16 with AppSettings

use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.

the class VRMouseManager method centerMouse.

/**
     * Center the mouse on the display.
     */
public void centerMouse() {
    if (environment != null) {
        if (environment.getApplication() != null) {
            // set mouse in center of the screen if newly added
            Vector2f size = environment.getVRGUIManager().getCanvasSize();
            MouseInput mi = environment.getApplication().getContext().getMouseInput();
            AppSettings as = environment.getApplication().getContext().getSettings();
            if (mi instanceof GlfwMouseInputVR)
                ((GlfwMouseInputVR) mi).setCursorPosition((int) (as.getWidth() / 2f), (int) (as.getHeight() / 2f));
            if (environment.isInVR()) {
                cursorPos.x = size.x / 2f;
                cursorPos.y = size.y / 2f;
                recentCenterCount = 2;
            }
        } else {
            throw new IllegalStateException("This VR environment is not attached to any application.");
        }
    } else {
        throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
    }
}
Also used : GlfwMouseInputVR(com.jme3.input.lwjgl.GlfwMouseInputVR) AppSettings(com.jme3.system.AppSettings) Vector2f(com.jme3.math.Vector2f) MouseInput(com.jme3.input.MouseInput)

Example 17 with AppSettings

use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.

the class SimpleApplication method start.

@Override
public void start() {
    // set some default settings in-case
    // settings dialog is not shown
    boolean loadSettings = false;
    if (settings == null) {
        setSettings(new AppSettings(true));
        loadSettings = true;
    }
    // show settings dialog
    if (showSettings) {
        if (!JmeSystem.showSettingsDialog(settings, loadSettings)) {
            return;
        }
    }
    //re-setting settings they can have been merged from the registry.
    setSettings(settings);
    super.start();
}
Also used : AppSettings(com.jme3.system.AppSettings)

Example 18 with AppSettings

use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.

the class JmeAndroidSystem method newAudioRenderer.

@Override
public AudioRenderer newAudioRenderer(AppSettings settings) {
    ALC alc = new AndroidALC();
    AL al = new AndroidAL();
    EFX efx = new AndroidEFX();
    return new ALAudioRenderer(al, alc, efx);
}
Also used : AndroidALC(com.jme3.audio.android.AndroidALC) AndroidEFX(com.jme3.audio.android.AndroidEFX) AndroidEFX(com.jme3.audio.android.AndroidEFX) EFX(com.jme3.audio.openal.EFX) ALC(com.jme3.audio.openal.ALC) AndroidALC(com.jme3.audio.android.AndroidALC) AL(com.jme3.audio.openal.AL) AndroidAL(com.jme3.audio.android.AndroidAL) AndroidAL(com.jme3.audio.android.AndroidAL) ALAudioRenderer(com.jme3.audio.openal.ALAudioRenderer)

Example 19 with AppSettings

use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.

the class AndroidHarnessFragment method onCreate.

/**
     * This Fragment uses setRetainInstance(true) so the onCreate method will only
     * be called once. During device configuration changes, the instance of
     * this Fragment will be reused in the new Activity.  This method should not
     * contain any View related objects.  They are created and destroyed by
     * other methods.  View related objects should not be reused, but rather
     * created and destroyed along with the Activity.
     *
     * @param savedInstanceState
     */
@Override
public void onCreate(Bundle savedInstanceState) {
    initializeLogHandler();
    logger.fine("onCreate");
    super.onCreate(savedInstanceState);
    // Create Settings
    logger.log(Level.FINE, "Creating settings");
    AppSettings settings = new AppSettings(true);
    settings.setEmulateMouse(mouseEventsEnabled);
    settings.setEmulateMouseFlipAxis(mouseEventsInvertX, mouseEventsInvertY);
    settings.setUseJoysticks(joystickEventsEnabled);
    settings.setEmulateKeyboard(keyEventsEnabled);
    settings.setBitsPerPixel(eglBitsPerPixel);
    settings.setAlphaBits(eglAlphaBits);
    settings.setDepthBits(eglDepthBits);
    settings.setSamples(eglSamples);
    settings.setStencilBits(eglStencilBits);
    settings.setAudioRenderer(audioRendererType);
    settings.setFrameRate(frameRate);
    // Create application instance
    try {
        if (app == null) {
            @SuppressWarnings("unchecked") Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
            app = clazz.newInstance();
        }
        app.setSettings(settings);
        app.start();
    } catch (Exception ex) {
        handleError("Class " + appClass + " init failed", ex);
    }
    OGLESContext ctx = (OGLESContext) app.getContext();
    // AndroidHarness wraps the app as a SystemListener.
    ctx.setSystemListener(this);
    setRetainInstance(true);
}
Also used : AppSettings(com.jme3.system.AppSettings) OGLESContext(com.jme3.system.android.OGLESContext)

Example 20 with AppSettings

use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.

the class TestBetterCharacter method main.

public static void main(String[] args) {
    TestBetterCharacter app = new TestBetterCharacter();
    AppSettings settings = new AppSettings(true);
    settings.setRenderer(AppSettings.LWJGL_OPENGL2);
    settings.setAudioRenderer(AppSettings.LWJGL_OPENAL);
    app.setSettings(settings);
    app.start();
}
Also used : AppSettings(com.jme3.system.AppSettings)

Aggregations

AppSettings (com.jme3.system.AppSettings)40 LegacyApplication (com.jme3.app.LegacyApplication)5 IOException (java.io.IOException)4 AL (com.jme3.audio.openal.AL)3 ALAudioRenderer (com.jme3.audio.openal.ALAudioRenderer)3 ALC (com.jme3.audio.openal.ALC)3 EFX (com.jme3.audio.openal.EFX)2 MouseInput (com.jme3.input.MouseInput)2 Vector2f (com.jme3.math.Vector2f)2 Mesh (com.jme3.scene.Mesh)2 JmeToJFXApplication (com.jme3x.jfx.injfx.JmeToJFXApplication)2 GraphicsDevice (java.awt.GraphicsDevice)2 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 InputStream (java.io.InputStream)2 TextView (android.widget.TextView)1 JmeUtil (com.cas.sim.tis.util.JmeUtil)1 SettingsDialog (com.jme3.app.SettingsDialog)1 SelectionListener (com.jme3.app.SettingsDialog.SelectionListener)1 AssetNotFoundException (com.jme3.asset.AssetNotFoundException)1