Sleep with the zzz() function
This commit is contained in:
parent
fe89f4e0af
commit
969089eee5
@ -4,5 +4,5 @@ class Palette {
|
||||
static const defaultBg = Colors.black;
|
||||
static const defaultFg = Colors.white;
|
||||
|
||||
static const subtitle = Colors.yellow;
|
||||
static const subtitle = Colors.red;
|
||||
}
|
||||
|
@ -8,5 +8,13 @@ void main() async {
|
||||
.bg(Palette.subtitle)
|
||||
.fg(Palette.defaultBg)
|
||||
.big()
|
||||
.puts("BEWARE OF THE BAT!\nA cool bat.");
|
||||
.puts("BEWARE OF THE BAT!\nA cool bat!");
|
||||
|
||||
await zzz(1.0);
|
||||
|
||||
at(4, 8)
|
||||
.bg(Palette.subtitle)
|
||||
.fg(Palette.defaultBg)
|
||||
.big()
|
||||
.puts("A strong bat!");
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
void main() {
|
||||
game.main();
|
||||
runApp(const App());
|
||||
}
|
||||
|
||||
@ -44,7 +45,6 @@ class _ViewerState extends State<Viewer> {
|
||||
ticker = Ticker(tick);
|
||||
ticker!.start();
|
||||
input.startListening();
|
||||
game.main();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -247,3 +247,7 @@ void clear() {
|
||||
Cursor at(int x, int y) {
|
||||
return Cursor(t: _terminal, x: x, y: y);
|
||||
}
|
||||
|
||||
Future<void> zzz(double t) async {
|
||||
await Future.delayed(Duration(milliseconds: (t * 1000).toInt()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user