Search in sources :

Example 36 with AppSettings

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

the class TestToneMapFilter method main.

public static void main(String[] args) {
    TestToneMapFilter app = new TestToneMapFilter();
    AppSettings settings = new AppSettings(true);
    // Must turn on gamma correction, as otherwise it looks too dark.
    settings.setGammaCorrection(true);
    app.setSettings(settings);
    app.start();
}
Also used : AppSettings(com.jme3.system.AppSettings)

Example 37 with AppSettings

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

the class AppletHarness method createCanvas.

private void createCanvas() {
    AppSettings settings = new AppSettings(true);
    // load app cfg
    if (appCfg != null) {
        InputStream in = null;
        try {
            in = appCfg.openStream();
            settings.load(in);
            in.close();
        } catch (IOException ex) {
            // Called before application has been created ....
            // Display error message through AWT
            JOptionPane.showMessageDialog(this, "An error has occured while " + "loading applet configuration" + ex.getMessage(), "jME3 Applet", JOptionPane.ERROR_MESSAGE);
            ex.printStackTrace();
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch (IOException ex) {
                }
        }
    }
    if (assetCfg != null) {
        settings.putString("AssetConfigURL", assetCfg.toString());
    }
    settings.setWidth(getWidth());
    settings.setHeight(getHeight());
    JmeSystem.setLowPermissions(true);
    try {
        Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
        app = clazz.newInstance();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    }
    appToApplet.put(app, this);
    app.setSettings(settings);
    app.createCanvas();
    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(getWidth(), getHeight());
    add(canvas);
    app.startCanvas();
}
Also used : AppSettings(com.jme3.system.AppSettings) InputStream(java.io.InputStream) IOException(java.io.IOException)

Example 38 with AppSettings

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

the class TestBatchNodeCluster method main.

public static void main(String[] args) {
    TestBatchNodeCluster app = new TestBatchNodeCluster();
    settingst = new AppSettings(true);
    //settingst.setFrameRate(75);
    settingst.setResolution(640, 480);
    settingst.setVSync(false);
    settingst.setFullscreen(false);
    app.setSettings(settingst);
    app.setShowSettings(false);
    app.start();
}
Also used : AppSettings(com.jme3.system.AppSettings)

Example 39 with AppSettings

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

the class AppHarness method createCanvas.

private void createCanvas() {
    AppSettings settings = new AppSettings(true);
    // load app cfg
    if (appCfg != null) {
        try {
            InputStream in = appCfg.openStream();
            settings.load(in);
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    settings.setWidth(getWidth());
    settings.setHeight(getHeight());
    settings.setAudioRenderer(null);
    JmeSystem.setLowPermissions(true);
    try {
        Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
        app = clazz.newInstance();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    }
    app.setSettings(settings);
    app.createCanvas();
    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(getWidth(), getHeight());
    add(canvas);
    app.startCanvas();
}
Also used : AppSettings(com.jme3.system.AppSettings) InputStream(java.io.InputStream) IOException(java.io.IOException) LegacyApplication(com.jme3.app.LegacyApplication)

Example 40 with AppSettings

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

the class TestAwtPanels method main.

public static void main(String[] args) {
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);
    app = new TestAwtPanels();
    app.setShowSettings(false);
    AppSettings settings = new AppSettings(true);
    settings.setCustomRenderer(AwtPanelsContext.class);
    settings.setFrameRate(60);
    app.setSettings(settings);
    app.start();
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            /*
                 * Sleep 2 seconds to ensure there's no race condition.
                 * The sleep is not required for correctness.
                 */
            try {
                Thread.sleep(2000);
            } catch (InterruptedException exception) {
                return;
            }
            final AwtPanelsContext ctx = (AwtPanelsContext) app.getContext();
            panel = ctx.createPanel(PaintMode.Accelerated);
            panel.setPreferredSize(new Dimension(400, 300));
            ctx.setInputSource(panel);
            panel2 = ctx.createPanel(PaintMode.Accelerated);
            panel2.setPreferredSize(new Dimension(400, 300));
            createWindowForPanel(panel, 300);
            createWindowForPanel(panel2, 700);
            /*
                 * Both panels are ready.
                 */
            panelsAreReady.countDown();
        }
    });
}
Also used : AppSettings(com.jme3.system.AppSettings) Dimension(java.awt.Dimension) AwtPanelsContext(com.jme3.system.awt.AwtPanelsContext)

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