use of com.jme3.system.AppSettings in project Lina by MisterCavespider.
the class Test method main.
public static void main(String[] args) {
Test t = new Test();
AppSettings sets = new AppSettings(true);
sets.setFrameRate(60);
t.setSettings(sets);
t.start();
}
use of com.jme3.system.AppSettings in project TeachingInSimulation by ScOrPiOzzy.
the class TestJmeToJFXCanvas method makeJmeApplication.
@NotNull
private static JmeToJFXApplication makeJmeApplication() {
final AppSettings settings = JmeToJFXIntegrator.prepareSettings(new AppSettings(true), 60);
final JmeToJFXApplication application = new JmeToJFXApplication() {
protected Geometry player;
Boolean isRunning = true;
@Override
public void simpleInitApp() {
super.simpleInitApp();
flyCam.setDragToRotate(true);
Box b = new Box(1, 1, 1);
player = new Geometry("Player", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
player.setMaterial(mat);
rootNode.attachChild(player);
// 添加鼠标监听
inputManager.addMapping("pick", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener((ActionListener) (name, isPressed, tpf) -> {
if (isPressed) {
System.out.println(inputManager.getCursorPosition());
System.out.println(settings.getWidth());
System.out.println(settings.getHeight());
// @Nullable
// Geometry picked = JmeUtil.getGeometryFromCursor(root, cam, inputManager);
// if (picked != null) {
// System.err.println(picked);
// }
@Nullable Vector3f point = JmeUtil.getContactPointFromCursor(rootNode, cam, inputManager);
if (point != null) {
Geometry ball = JmeUtil.getSphere(assetManager, 32, 0.1f, ColorRGBA.Red);
rootNode.attachChild(ball);
ball.setLocalTranslation(point);
}
}
}, "pick");
// initKeys(); // load my custom keybinding
}
};
application.setSettings(settings);
application.setShowSettings(false);
return application;
}
use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.
the class JmeDesktopSystem method showSettingsDialog.
@Override
public boolean showSettingsDialog(AppSettings sourceSettings, final boolean loadFromRegistry) {
if (SwingUtilities.isEventDispatchThread()) {
throw new IllegalStateException("Cannot run from EDT");
}
if (GraphicsEnvironment.isHeadless()) {
throw new IllegalStateException("Cannot show dialog in headless environment");
}
final AppSettings settings = new AppSettings(false);
settings.copyFrom(sourceSettings);
String iconPath = sourceSettings.getSettingsDialogImage();
if (iconPath == null) {
iconPath = "";
}
final URL iconUrl = JmeSystem.class.getResource(iconPath.startsWith("/") ? iconPath : "/" + iconPath);
if (iconUrl == null) {
throw new AssetNotFoundException(sourceSettings.getSettingsDialogImage());
}
final AtomicBoolean done = new AtomicBoolean();
final AtomicInteger result = new AtomicInteger();
final Object lock = new Object();
final SelectionListener selectionListener = new SelectionListener() {
public void onSelection(int selection) {
synchronized (lock) {
done.set(true);
result.set(selection);
lock.notifyAll();
}
}
};
SwingUtilities.invokeLater(new Runnable() {
public void run() {
synchronized (lock) {
SettingsDialog dialog = new SettingsDialog(settings, iconUrl, loadFromRegistry);
dialog.setSelectionListener(selectionListener);
dialog.showDialog();
}
}
});
synchronized (lock) {
while (!done.get()) {
try {
lock.wait();
} catch (InterruptedException ex) {
}
}
}
sourceSettings.copyFrom(settings);
return result.get() == SettingsDialog.APPROVE_SELECTION;
}
use of com.jme3.system.AppSettings in project jmonkeyengine by jMonkeyEngine.
the class TestApplication method main.
public static void main(String[] args) throws InterruptedException {
System.out.println("Creating application..");
LegacyApplication app = new LegacyApplication();
System.out.println("Starting application in LWJGL mode..");
app.start();
System.out.println("Waiting 5 seconds");
Thread.sleep(5000);
System.out.println("Closing application..");
app.stop();
Thread.sleep(2000);
System.out.println("Starting in fullscreen mode");
app = new LegacyApplication();
AppSettings settings = new AppSettings(true);
settings.setFullscreen(true);
// current width/height
settings.setResolution(-1, -1);
app.setSettings(settings);
app.start();
Thread.sleep(5000);
app.stop();
Thread.sleep(2000);
System.out.println("Creating offscreen buffer application");
app = new LegacyApplication();
app.start(Type.OffscreenSurface);
Thread.sleep(3000);
System.out.println("Destroying offscreen buffer");
app.stop();
}
use of com.jme3.system.AppSettings 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();
}
Aggregations