jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.77k stars 1.12k forks source link

LWJGL3 Window Utilities #1152

Open louhy opened 5 years ago

louhy commented 5 years ago

Since this is purely aimed at conveniences, I can see opinion going either way on this, so checking interest before I bother with a PR.

Suggest an LwjglUtil class (for LWJGL3 only, since 2 already has this) which would have static methods for common window or display manipulation, something like this:

    public static int getWindowX(JmeContext context);
    public static int getWindowY(JmeContext context);
    public static void setWindowPosition(JmeContext context, int xPos, int yPos);

    public static int getWindowWidth(JmeContext context);
    public static int getWindowHeight(JmeContext context);
    public static void setWindowSize(JmeContext context, int width, int height);

    public static int getPrimaryMonitorWidth();
    public static int getPrimaryMonitorHeight();

LWJGL2 already has something like this in Display (ex. Display.setLocation()), but I don't believe 3 has a similar interface, and it looks a little more inconvenient to interact with (point me in the right direction if I'm missing something). This would be in jme3-lwjgl3, probably com.jme3.util.

pspeed42 commented 5 years ago

You will get more eyes on proposals like this on the forum. I think like five people read this and most are "gatekeepers"... where as on the forum you may get fans to help you push, etc..

In general, this is unlikely to be added as a part of JME because it's an lwjgl-specific feature. You might propose that lwjgl add something like this if you are ok with your app being tied to a specific OpenGL binding + version.

louhy commented 5 years ago

It's fine, this is a good enough answer for me - I was uncertain myself. I figured the eyes reading here have a good sense of what's considered in-scope for JME, where on the forums, many will get behind it because "it's easier" (but is it a good idea?).

Testing this would have been a pain anyway since jme3-examples doesn't have the correct dependencies.

pspeed42 commented 5 years ago

re: Forum... makes sense in this case.

riccardobl commented 5 years ago

Are those informations inaccessible with the current code?

empirephoenix commented 5 years ago

I would kinda propose a slightly more tiered approach, eg. make a generic interface for this kinds of behaviours, that different renderes can (optionally) implement (add a way to query abilities). This would no longer be limited to LWJGL, and allow users of jogl for example to implement similar functions into their code. (Kinda like the memory allocator functionality, that can use a LWJGL specific one, but is in no way only tailored for it). So if you feel up for it please make a forum post to discuss this more generic approach :)

louhy commented 5 years ago

Okay then, maybe I take back what I said above. :smile: We'll give the idea a chance.

@riccardobl It's not inaccessible, but they aren't one-line calls like LWJGL2 offers.

@empirephoenix Not a bad idea, I'll think it over a bit and we can do the forum thing.

louhy commented 4 years ago

Funny timing, just remembered this recently. Will try to get an update on the forum thread soon.

louhy commented 4 years ago

Posted an update on the forums, feedback welcome. https://hub.jmonkeyengine.org/t/lwjgl3-window-utilities/42128/6