use of com.jme3.app.LegacyApplication in project jmonkeyengine by jMonkeyEngine.
the class TestContextRestart method main.
public static void main(String[] args) throws InterruptedException {
AppSettings settings = new AppSettings(true);
final LegacyApplication app = new LegacyApplication();
app.setSettings(settings);
app.start();
Thread.sleep(3000);
settings.setFullscreen(true);
settings.setResolution(-1, -1);
app.setSettings(settings);
app.restart();
Thread.sleep(3000);
app.stop();
}
use of com.jme3.app.LegacyApplication 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();
}
use of com.jme3.app.LegacyApplication 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();
}
Aggregations