Skip to content
CrossFly is 100% open sourceFollow us on GitHub
CrossFlyCrossFly
Get started

This page was machine-translated from Portuguese and may contain errors. The Portuguese version is canonical.

Desktop (LWJGL3) 🖥️

Always start with desktop: it is the fast-iteration loop. There is no Java hot-reload, but the cold start takes seconds — you validate the UI before suffering through mobile build cycles.

Run

gradlew :lwjgl3:run

The Lwjgl3Launcher creates the application: new Main(true, getCommandline(args)) — canStart=true brings the UI up immediately. mainClassName = dev.crossfly.lwjgl3.Lwjgl3Launcher.

Title, size and rotation

Main.setDesktopTitle("Minha App");   // only takes effect on desktop
main.rotate();                        // simulates rotation (swaps width/height) on desktop

Dimensions and scale come from Screen (Screen.width/height/scale/minSize).

⚠️ Two desktop prerequisites

  • crossfly-lib (JNI) must be on the java.library.path — Main.create() calls SharedLibraryLoader.load("crossfly-lib") at startup (on all targets, except WebGL).
  • macOS requires the JVM flag -XstartOnFirstThread (an LWJGL3/GLFW requirement on Mac). Without it, the app does not open a window.

Diagnostics

  • The global exception handler funnels failures (see Errors and logging).
  • Debug.showFPS = true to see the frame rate.
  • Generate screenshots (docs/store): Main.getScreenShot(true).toPng("prefixo_").

Best practices

  • Develop and validate the UI on desktop; only move to mobile when the screen is ready.
  • Test rotation (rotate()) and different window sizes to check responsiveness.

Common mistakes

  • Forgetting -XstartOnFirstThread on macOS (window does not open).
  • crossfly-lib outside the java.library.path (startup failure).

See also

Was this page helpful?