fledge_ui 0.3.1 copy "fledge_ui: ^0.3.1" to clipboard
fledge_ui: ^0.3.1 copied to clipboard

Retained-mode game HUD/UI for Fledge — anchor-based layout, containers, text, images, and solid panels rendered on top of the sprite pipeline.

example/example.dart

import 'dart:ui' show Color;

import 'package:fledge_ecs/fledge_ecs.dart';
import 'package:fledge_render_2d/fledge_render_2d.dart';
import 'package:fledge_ui/fledge_ui.dart';

/// Minimal fledge_ui example.
///
/// [UiPlugin] wires the retained-mode HUD pipeline on top of
/// [RenderPlugin]: a [LayoutSystem] in `Schedules.postUpdate` walks
/// the UI hierarchy and writes each entity's screen-space rect, then
/// [UiExtractor] hands the laid-out nodes to the render world.
///
/// A UI entity carries [UiNode] as its marker, a [UiAnchorComponent]
/// naming which parent-edge it pins to, an optional [UiOffset] +
/// [UiSize], and one of the visual node kinds — [UiText] here.
void main() async {
  final app = App()
    ..addPlugin(const WallTimePlugin())
    ..addPlugin(RenderPlugin())
    ..addPlugin(const UiPlugin());

  // Top-left HUD counter — 12px inset from each edge.
  app.world.spawn()
    ..insert(const UiNode())
    ..insert(const UiAnchorComponent(UiAnchor.topLeft))
    ..insert(const UiOffset(x: 12, y: 12))
    ..insert(const UiSize(width: 200, height: 20))
    ..insert(
      UiText(text: 'Score: 0', fontSize: 14, color: const Color(0xFFFFFFFF)),
    );

  await app.tick();
}
0
likes
160
points
456
downloads

Documentation

API reference

Publisher

verified publisherfledge-framework.dev

Weekly Downloads

Retained-mode game HUD/UI for Fledge — anchor-based layout, containers, text, images, and solid panels rendered on top of the sprite pipeline.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ecs #game-engine #ui #hud #flutter-games

License

Apache-2.0 (license)

Dependencies

fledge_assets, fledge_camera_2d, fledge_ecs, fledge_render_2d, flutter, meta, vector_math

More

Packages that depend on fledge_ui