Closed AlmasB closed 5 years ago
This question is related to the exit dialog box.
Is there a way to modify the size of the dark mask of the exit dialog after the initialization ?
When I hit ESC, the exit dialog normally pops up at the center as well as masking the rest of the window with a darker color.
My main menu is always 1024 x 768 but the main app itself has the default size set to whatever the screen resolution of the user machine. So in my case, it's 1920 x 1080.
@Override
protected void initSettings(GameSettings settings) {
settings.setWidth(1024);
settings.setHeight(768);
....
}
I have no problem setting to the JavaFX's stage in the main app to 1920 x 1080 but how do I change the the size of the dark mask ?
I don't think you can, it's locked to whatever settings.setWidth / setHeight
values are. When fullscreen is added, the values will be scaled up / down to fit the viewport but again only within the context of FXGL.
It may be an important feature for a game app to have. I imagine that
(1) the app will load up a main menu. (2) it let users choose what resolution the users are interested in. (3) the width/height of the Viewpoint or GameSettings will be reset to whatever the user has selected (assuming the windowed mode, not the full screen mode). ...
Where's the class responsible for creating the exit dialog ? I've been trying to hunt it down.
If it were the FXGLMenu class, I'd like to modify in such a way that the width and height of the current stage/window right will be detected right before I create the the exit dialog's mask as follows :
public FXGLMenu(GameApplication app, MenuType type) {
this.app = app;
this.type = type;
this.listener = (MenuEventHandler) app.getMenuListener();
// Find the current window width
int w = (int) getContentRoot().getScene().getWindow().getWidth();
// Find the current window height
int h = (int) getContentRoot().getScene().getWindow().getHeight();
getContentRoot().getChildren().addAll(
//createBackground(app.getWidth(), app.getHeight()),
createBackground(w, h),
createTitleView(app.getSettings().getTitle()),
createVersionView(makeVersionString()),
menuRoot, contentRoot);
...
Here's the file.
FXGL was not designed for multiple resolution textures. Instead, the developer chooses his target resolution, e.g. 1920x1080, so that he can adjust all of his assets to that size. FXGL will have the ability to set the resolution, however, it will only change the size of the window, nothing else. The entire FXGL infrastructure will use the target resolution, e.g. 1920x1080, which will be scaled correctly to whatever the user has set. This ensures that on all monitors the game will look the same.
Also, I do appreciate that you want to give FXGL a go, but are you sure it's the right framework for your project? It sounds like you'll better off using JavaFX directly...
We want the dialogs to be easily styleable by framework users. It seems the best way is to apply overridable CSS? Currently only the font can be styled. Alternatively,
DialogFactory
implementation can be provided.