fledge_window

Window management plugin for Fledge games. Fullscreen, borderless, and windowed modes with runtime switching.

pub package

Features

  • Window Modes: Fullscreen, borderless, and windowed
  • Runtime Switching: Toggle modes during gameplay
  • Display Info: Query monitor resolution and properties
  • Window Events: React to resize, focus, and mode changes

Installation

dependencies:
  fledge_window: ^0.1.0

Quick Start

import 'package:fledge_ecs/fledge_ecs.dart';
import 'package:fledge_window/fledge_window.dart';

void main() async {
  // Fullscreen game
  final app = App()
    ..addPlugin(WindowPlugin.fullscreen(title: 'My Game'))
    ..addPlugin(TimePlugin());

  await app.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 fullscreen
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}');

Documentation

See the Window Guide for detailed documentation.

License

Apache 2.0 - See LICENSE for details.

Libraries

fledge_window
Window management plugin for the Fledge ECS game framework.