Skip to content

Commit

Permalink
startup screen size setting
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Apr 27, 2024
1 parent 5af7aa7 commit 2c855d0
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -762,31 +762,25 @@ public void start(Stage primaryStage) {
.getDisplayMode().getWidth();
double sh = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.getDisplayMode().getHeight();
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
Rectangle2D primaryScreenBounds = javafx.stage.Screen.getPrimary().getVisualBounds();
double scalew = primaryScreenBounds.getWidth();
double screenZoom = sw/scalew;
sw=primaryScreenBounds.getWidth();
sh=primaryScreenBounds.getHeight();

if (FontSizeManager.getDefaultSize() == FontSizeManager.systemDefaultFontSize) {
double newSize= sw/2256.0*(2*FontSizeManager.systemDefaultFontSize)/screenZoom;
if(newSize<FontSizeManager.systemDefaultFontSize)
newSize=FontSizeManager.systemDefaultFontSize;
FontSizeManager.setFontSize((int)Math.round(newSize));
System.out.println("Screen "+sw+"x"+sh);
}
double scale = FontSizeManager.getDefaultSize()/12;
if(scale<1)
scale=1;
double w = 1174.0*scale;
double h = 768*scale;
if(w>sw)
w=sw-100;
if(h>sh)
h=sh-100;
sw=primaryScreenBounds.getWidth();
sh=primaryScreenBounds.getHeight();
double w ;
double h ;
w=sw-40;
h=sh-40;

Scene scene = new Scene(root, w, h, true);

setBowlerStudioCSS(scene);
BowlerStudio.runLater(() -> {

Expand Down

0 comments on commit 2c855d0

Please sign in to comment.