Search in sources :

Example 21 with AppSettings

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

the class TestCanvas method createCanvas.

public static void createCanvas(String appClass) {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    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.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas();
    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
}
Also used : AppSettings(com.jme3.system.AppSettings) LegacyApplication(com.jme3.app.LegacyApplication)

Example 22 with AppSettings

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

the class TestSafeCanvas method main.

public static void main(String[] args) throws InterruptedException {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    final TestSafeCanvas app = new TestSafeCanvas();
    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas(true);
    JmeCanvasContext context = (JmeCanvasContext) app.getContext();
    Canvas canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
    Thread.sleep(3000);
    JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            app.stop();
        }
    });
    frame.getContentPane().add(canvas);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    Thread.sleep(3000);
    frame.getContentPane().remove(canvas);
    Thread.sleep(3000);
    frame.getContentPane().add(canvas);
}
Also used : JmeCanvasContext(com.jme3.system.JmeCanvasContext) AppSettings(com.jme3.system.AppSettings) JFrame(javax.swing.JFrame) Canvas(java.awt.Canvas) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter)

Example 23 with AppSettings

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

the class TestBatchNodeTower method main.

public static void main(String[] args) {
    TestBatchNodeTower f = new TestBatchNodeTower();
    AppSettings s = new AppSettings(true);
    f.setSettings(s);
    f.start();
}
Also used : AppSettings(com.jme3.system.AppSettings)

Example 24 with AppSettings

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

the class TestMusicPlayer method initAudioPlayer.

private void initAudioPlayer() {
    AppSettings settings = new AppSettings(true);
    // disable rendering
    settings.setRenderer(null);
    settings.setAudioRenderer("LWJGL");
    ar = JmeSystem.newAudioRenderer(settings);
    ar.initialize();
    ar.setListener(listener);
    AudioContext.setAudioRenderer(ar);
}
Also used : AppSettings(com.jme3.system.AppSettings)

Example 25 with AppSettings

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

the class TestApplet method createCanvas.

public static void createCanvas(String appClass) {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    //        settings.setRenderer(AppSettings.JOGL);
    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(settings.getWidth(), settings.getHeight());
}
Also used : AppSettings(com.jme3.system.AppSettings) LegacyApplication(com.jme3.app.LegacyApplication)

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