2023-09-11 02:00:06 +00:00
|
|
|
import 'dart:developer';
|
2023-09-20 04:02:04 +00:00
|
|
|
import 'dart:math' as math;
|
2023-09-20 02:19:26 +00:00
|
|
|
import 'package:dartterm/assets.dart';
|
2023-09-10 01:40:56 +00:00
|
|
|
import 'package:dartterm/colors.dart';
|
2023-09-20 04:02:04 +00:00
|
|
|
import 'package:dartterm/gen/generator.dart';
|
2023-09-10 01:40:56 +00:00
|
|
|
import 'package:dartterm/terminal.dart';
|
2023-09-20 02:19:26 +00:00
|
|
|
import 'package:dartterm/world/level.dart';
|
2023-09-10 01:40:56 +00:00
|
|
|
|
2023-09-20 02:19:26 +00:00
|
|
|
void main() async {
|
2023-09-20 04:02:04 +00:00
|
|
|
Vaults vaults;
|
2023-09-20 02:19:26 +00:00
|
|
|
while (true) {
|
|
|
|
log("about to load template");
|
|
|
|
at(0, 0).clear();
|
|
|
|
at(0, 0).puts("Loading template!");
|
2023-09-20 04:02:04 +00:00
|
|
|
Vaults? maybeVaults =
|
|
|
|
getVaultsIfAvailable("assets/images/wfc/bighouse2.png");
|
2023-09-20 02:19:26 +00:00
|
|
|
|
2023-09-20 04:02:04 +00:00
|
|
|
if (maybeVaults != null) {
|
2023-09-20 02:19:26 +00:00
|
|
|
log("wasn't null!");
|
2023-09-20 04:02:04 +00:00
|
|
|
vaults = maybeVaults;
|
2023-09-20 02:19:26 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
await zzz(0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
at(0, 0).clear();
|
2023-09-20 04:02:04 +00:00
|
|
|
at(0, 0).puts("Loaded! $vaults");
|
2023-09-20 02:19:26 +00:00
|
|
|
|
2023-09-20 04:02:04 +00:00
|
|
|
Vault output = vaults.generateBoxed(
|
|
|
|
math.Random(2),
|
|
|
|
Requirement(
|
|
|
|
16,
|
|
|
|
16,
|
|
|
|
DirectionSet({
|
|
|
|
Direction.up,
|
|
|
|
Direction.left,
|
|
|
|
Direction.right,
|
|
|
|
Direction.down
|
|
|
|
})));
|
|
|
|
var w = output.vx;
|
|
|
|
var h = output.vy;
|
|
|
|
for (var y = 0; y < w; y++) {
|
|
|
|
for (var x = 0; x < h; x++) {
|
2023-09-20 02:19:26 +00:00
|
|
|
var cursor = at(x * 2, y * 2).big();
|
2023-09-20 04:02:04 +00:00
|
|
|
switch (output.tiles[x + y * w]) {
|
2023-09-20 02:19:26 +00:00
|
|
|
case LevelTile.floor:
|
|
|
|
cursor.puts(" ");
|
|
|
|
case LevelTile.door:
|
|
|
|
cursor.puts("d");
|
|
|
|
case LevelTile.wall:
|
|
|
|
cursor.puts("#");
|
|
|
|
case LevelTile.exit:
|
|
|
|
cursor.puts("X");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
2023-09-10 01:40:56 +00:00
|
|
|
void main() async {
|
2023-09-11 02:00:06 +00:00
|
|
|
var descriptor = "generic";
|
|
|
|
while (true) {
|
|
|
|
at(0, 0).clear();
|
|
|
|
at(0, 0).puts("Hello, bats!");
|
|
|
|
at(0, 2).fg(Palette.subtitle).small().puts("Beware of the bat!");
|
|
|
|
at(4, 4)
|
|
|
|
.bg(Palette.subtitle)
|
|
|
|
.fg(Palette.defaultBg)
|
|
|
|
.big()
|
|
|
|
.highlight()
|
|
|
|
.act(Act(
|
|
|
|
isDefault: true,
|
|
|
|
label: "Strong!",
|
|
|
|
callback: () async {
|
|
|
|
log("strong!");
|
|
|
|
descriptor = "strong";
|
|
|
|
}))
|
|
|
|
.act(Act(
|
|
|
|
label: "Nocturnal!",
|
|
|
|
callback: () async {
|
|
|
|
log("nocturnal!");
|
|
|
|
descriptor = "nocturnal";
|
|
|
|
}))
|
|
|
|
.puts("ALTER BAT");
|
2023-09-10 22:29:51 +00:00
|
|
|
|
2023-09-11 02:00:06 +00:00
|
|
|
at(4, 8).normal().puts("A $descriptor bat!");
|
2023-09-10 22:29:51 +00:00
|
|
|
|
2023-09-11 02:00:06 +00:00
|
|
|
// await zzz(1.0);
|
|
|
|
await waitMenu();
|
|
|
|
}
|
2023-09-10 01:40:56 +00:00
|
|
|
}
|
2023-09-20 02:19:26 +00:00
|
|
|
*/
|