raylib_dartified 5.5.2 copy "raylib_dartified: ^5.5.2" to clipboard
raylib_dartified: ^5.5.2 copied to clipboard

Dart-native Raylib bindings that don't make you feel like you're writing C.

example/main.dart

// Draws a semi-transparent circle that follows the cursor, with live coordinates
// displayed at the center of the screen. Demonstrates window setup, the render
// loop, mouse input, text measurement, and basic drawing via the D-layer API.
import 'package:raylib_dartified/raylib.dart';

void main() {
  final rl = findRaylib('raylib-5.5_linux_amd64/lib');

  final width = 800, height = 450;

  rl.CoreD.InitWindow(width, height, 'pub.dev example');

  while(!rl.CoreD.WindowShouldClose()) {
    rl.CoreD.BeginDrawing();

      rl.CoreD.ClearBackground(.BLACK);

      final mouse = rl.CoreD.GetMousePosition();

      final text = '$mouse'; // Vector2D(x: <x>, y: <y>)
      final textWidth = rl.CoreD.MeasureText(text, 32);
      rl.CoreD.DrawText(text, width / 2 - (textWidth / 2), height / 2, 32, .WHITE);

      rl.CoreD.DrawCircleV(mouse, 32, rl.CoreD.Fade(.RED, .5));

    rl.CoreD.EndDrawing();
  }

  rl.CloseWindowAndDispose();
}
1
likes
140
points
66
downloads

Documentation

API reference

Publisher

verified publisherxyzt.cz

Weekly Downloads

Dart-native Raylib bindings that don't make you feel like you're writing C.

Repository (GitHub)
View/report issues

License

Zlib (license)

Dependencies

ffi, logging, meta, path

More

Packages that depend on raylib_dartified