Basic usage
The game requires you to specify either fullscreen or windowed mode when launching.Command syntax
Available options
| Option | Description | SDL Flags |
|---|---|---|
-f | Fullscreen mode | SDL_FULLSCREEN |
-w | Windowed mode | Default (no fullscreen) |
-h | Display help | Shows usage information |
Display modes
The game supports two primary display modes.- Windowed mode
- Fullscreen mode
Launch the game in a window:Characteristics:
- Runs in a 320x200 window
- Allows switching to other applications
- Maintains desktop resolution
- Best for testing and development
You must specify either
-f or -w. Running ./pacman without options will display the help message and exit.Resolution management
The game includes sophisticated resolution management to preserve your display configuration.How it works
When the game starts, it automatically:Detect primary monitor
Uses GLFW to detect your primary monitor and current video mode:Saves: width, height, and refresh rate
Generate restoration script
Creates
/tmp/restaurar_xrandr.sh with commands to restore:- Original resolution for each connected display
- Relative position between monitors
- Which display is the primary output
Resolution restoration details
The restoration script generated at startup contains commands like:Multi-monitor setup
The game fully supports multi-monitor configurations.Extended display mode
If you have multiple monitors in extended mode:How multi-monitor restoration works
How multi-monitor restoration works
The game uses This preserves your extended desktop across multiple displays.
xrandr to query and save:- Each connected output - All active displays (HDMI, DisplayPort, etc.)
- Resolution and position - Mode (e.g., 1920x1080) and position (e.g., +1920+0)
- Primary display - Which monitor is marked as primary
--pos and --primary flags to restore the exact layout:Restoration timing
Manual restoration
If the automatic restoration fails, you can manually run:xrandr integration
The game relies on xrandr for display management on X11 systems.Checking xrandr availability
When the game starts, it verifies xrandr is available:- xrandr available
- xrandr missing
Installing xrandr
If xrandr is not available:Running examples
Common scenarios for launching the game.Single monitor setup
For a typical single monitor configuration:Dual monitor extended desktop
With monitors arranged side-by-side (e.g., 1920x1080 + 1920x1080):Different resolution monitors
With mixed resolutions (e.g., 2560x1440 primary + 1920x1080 secondary):High refresh rate displays
For monitors with high refresh rates (e.g., 144Hz, 240Hz):Display configuration
Understanding the SDL configuration used by the game.SDL flags
The game configures SDL with these flags:Understanding SDL flags
Understanding SDL flags
- SDL_SWSURFACE - Use software rendering surface
- SDL_HWPALETTE - Use hardware palette (for indexed color)
- SDL_DOUBLEBUF - Enable double buffering to prevent tearing
- SDL_FULLSCREEN - Set fullscreen video mode (with
-fonly)
Game resolution
The game renders at a fixed resolution:Exit behavior
Understanding what happens when you quit the game.Normal exit
When you exit the game normally (ESC key or close window):-
Resolution restoration executes
-
Script runs automatically
-
Display returns to original state
- All monitors restore their resolution
- Position and layout restored
- Primary monitor designation restored
Abnormal termination
If the game crashes or is forcibly killed:Performance considerations
Optimizing game performance on different systems.Fullscreen vs windowed
Fullscreen mode typically provides:- Lower input latency
- Better frame pacing
- Fewer context switches
- Optimal for gameplay
- Development and debugging
- Multi-tasking
- Screen recording
- Testing
Frame timing
The game uses a timer-based frame rate:Troubleshooting
Common issues when running the game.Game won’t start
Issue: No display mode specified Solution:Resolution not restored
Issue: Display stays at wrong resolution after exit Solution:Multi-monitor layout broken
Issue: Monitors not in correct position after game Solution:SDL initialization fails
Issue: Error message about SDL initialization Solution:Wayland compatibility
This game is designed for X11 and uses xrandr. On Wayland, you may need to run under XWayland. Some display management features may not work correctly.
Next steps
Now that you know how to run the game:- Learn the game controls and how to play
- Explore the building guide to customize the game
- Review the source code in
src/main.cfor initialization details