fledge_window library
Window management plugin for the Fledge ECS game framework.
Provides fullscreen, borderless, and windowed modes with runtime switching.
Quick Start
import 'package:fledge_ecs/fledge_ecs.dart';
import 'package:fledge_window/fledge_window.dart';
void main() async {
// Fullscreen game
await App()
.addPlugin(WindowPlugin.fullscreen(title: 'My Game'))
.addPlugin(TimePlugin())
.run();
}
Window Modes
Three modes are supported:
- Fullscreen: True exclusive fullscreen
- Borderless: Frameless window matching display size
- Windowed: Standard window with title bar
Runtime Mode Switching
// Toggle with F11
if (actions.justPressed(toggleFullscreen)) {
world.toggleFullscreen();
}
// Set specific mode
world.setWindowMode(WindowMode.borderless);
// Cycle through modes
world.cycleWindowMode();
Listening to Events
for (final event in world.eventReader<WindowModeChanged>().read()) {
print('Mode: ${event.previousMode} -> ${event.newMode}');
}
for (final event in world.eventReader<WindowResized>().read()) {
// Update camera viewport
}
for (final event in world.eventReader<WindowFocusChanged>().read()) {
if (!event.isFocused) {
// Pause game
}
}
Querying State
final state = world.windowState;
print('Mode: ${state?.mode}');
print('Size: ${state?.size}');
final info = world.displayInfo;
print('Primary: ${info?.primary.name}');
print('Resolution: ${info?.primary.size}');
Classes
- Display
- Information about a single display/monitor.
- DisplayInfo
- Resource containing information about all connected displays.
- DisplaySyncSystem
- System that periodically syncs display information.
- SetWindowModeRequest
- Request to change the window mode.
- SetWindowPositionRequest
- Request to move the window (windowed mode only).
- SetWindowSizeRequest
- Request to resize the window (windowed mode only).
- WindowConfig
- Configuration for window initialization.
- WindowEventSystem
- System that processes window change requests.
- WindowFocusChanged
- Event fired when window focus changes.
- WindowInitSystem
- System that initializes the window on app startup.
- WindowModeChanged
- Event fired when the window mode changes.
- WindowMoved
- Event fired when the window is moved.
- WindowPlugin
- Plugin that adds window management to a Fledge app.
- WindowResized
- Event fired when the window is resized.
- WindowState
- Resource containing the current window state.
Enums
- WindowMode
- Window display modes.
Extensions
- AppWindowCommands on App
-
Extension methods for window control on
App. - WindowCommands on World
-
Extension methods for window control on
World.