AlmasB / FXGL

Java / JavaFX / Kotlin Game Library (Engine)
http://almasb.github.io/FXGL/
MIT License
4.45k stars 556 forks source link

If I want to use javafx.application.Application How to add some custom code to the start method of Application, that is, rewrite this method, in the 21 version of fxgl? #1372

Closed huayunliufeng closed 6 months ago

huayunliufeng commented 6 months ago

Because I want to use the Atlantafx framework( https://github.com/mkpaz/atlantafx )To use it, you must add code similar to the following in the start method: `public class Launcher extends Application {

public static void main(String[] args) {
    launch(args);
}

@Override
public void start(Stage stage) {
    // find more themes in 'atlantafx.base.theme' package
    Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
    Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());

    // the rest of the code ...
}

}`

AlmasB commented 6 months ago

Hi, you can use FXGL with its embedded mode. See sample where the top level is just a normal JavaFX application.

huayunliufeng commented 6 months ago

Thank you very much. After using your solution, my problem has been resolved.