Pixel art and full screen
The stage size and the window
new Window(480, 360) decides the size of the stage: 480 × 360 stage
pixels. When the player makes the window larger, or plays in full screen, the
stage is scaled up to fit. Your code does not change: x still goes from -240 to
240.
Pick a stage size with the shape of most screens, 16 : 9, if your game should fill a full screen: for example 480 × 270 or 640 × 360.
Pixel art
Small pixel pictures look blurry when they are scaled up smoothly. Pixel-art
mode keeps every pixel a sharp square. Call it before new Window:
There are two pixel-art modes:
Window.useSmoothPixelArt() |
Window.usePixelArt() |
|
|---|---|---|
| Pixels | sharp squares | sharp squares |
| Scaling | fills the window at any size | whole numbers only (2×, 3×, …), with black bars around |
| Movement | glides smoothly | jumps from pixel to pixel |
| Good for | most games, and any game with a moving camera | a strict retro look |
Both use a pixel font for texts.
Full screen
Window.useFullScreen()beforenew Windowstarts the game in full screen.- Players switch with F11 or Alt+Enter.
-
Window.getInstance().setFullScreen(true)switches from your options menu, andisFullScreen()asks.
Full screen is a borderless window as large as the screen. Alt+Tab to other programs works as usual.
In the browser, a page may only go full screen right after a click or a key press. Use the full-screen button of the page there.
Next
- Menus: a toggle for full screen
- Sharing your game