I can imagine you could use this for a Starcraft I look, but I would like one jME pixel to be one screen pixel. How can I get the height and width of my screen? Is there jME support for that or do I have to use some other library?
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int w = gd.getDisplayMode().getWidth();
int h = gd.getDisplayMode().getHeight();
@mitm’s solution would probably also have worked.
Thanks for the input!
No, that gives me the width and height of the jME window.
I needed to know what the width and height are of the screen (monitor), so I can set the width and height through the appsettings.
The application is fullscreen.
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import com.jme3.app.SimpleApplication;
import com.jme3.system.AppSettings;
public class Main extends SimpleApplication {
public static void main( String... args ) {
System.out.println(Long.parseLong("2013224671"));
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int w = gd.getDisplayMode().getWidth();
int h = gd.getDisplayMode().getHeight();
System.out.println("w,h: " + w + "," + h);
AppSettings sets = new AppSettings(true);
sets.setTitle("LightNodeViewer");
//Mess with these 2 values below:
sets.setWidth(w);
sets.setHeight(h);
sets.setFullscreen(true);
Main main = new Main();
main.setSettings(sets);
main.start();
}
public void simpleInitApp() {
System.out.println("w,h: " + cam.getWidth() + "," + cam.getHeight());
Geometry geom = new Geometry("something", new Box(1, 1, 1));
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
}
If you mess with it a bit, you will notice that the values you set through the AppState (before camera is even accessible) change the resolution.
So, to be clear, you want to set the app full screen but at the resolution of the desktop when the app was started… regardless of what the user might actually want as their screen resolution?
Yes, then the way you’ve done it is the only way.
…and folks with hires desktops but medium-grade graphics cards will curse your name.