fledge_calendar 0.3.1
fledge_calendar: ^0.3.1 copied to clipboard
Calendar and in-game time system for Fledge games with configurable day/night cycles, seasons, and time scaling.
fledge_calendar #
In-game calendar and time-of-day system for Fledge games. Day/night cycles, seasons, and configurable time scaling.
Previously published as
fledge_time. The old package name still resolves via a re-export shim for one release — new code should depend onfledge_calendardirectly.
Installation #
dependencies:
fledge_calendar: ^0.2.1
Quick Start #
import 'package:fledge_ecs/fledge_ecs.dart';
import 'package:fledge_calendar/fledge_calendar.dart';
void main() async {
final app = App()
..addPlugin(WallTimePlugin())
..addPlugin(CalendarPlugin(config: CalendarConfig.farmingSim()));
await app.tick();
final calendar = app.world.getResource<Calendar>()!;
print(calendar.timeString); // "6:00 AM"
print(calendar.calendarString); // "Mon, Spring 1, Year 1"
await app.run();
}
Skipping Time #
// e.g. from a sleep or curfew handler, in any schedule
calendar.skipToNextMorning();
skipToNextMorning(), skipToHour() and setTime() can be called from any schedule: CalendarSystem emits exactly one DayChangedEvent / HourChangedEvent (and season/year events when crossed) for the change on its next run. The day counter increments at midnight, so skipping at 2 AM stays on the same day and just moves to dayStartHour; a pre-midnight curfew does not re-trigger after midnight.
Documentation #
See the Fledge documentation site for guides, API reference, and advanced usage.
License #
Apache 2.0 - See LICENSE for details.