Moved everything to a monorepo and fixed the CLI app rendering
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
@@ -5,7 +5,6 @@ import 'package:wolf_3d_data/wolf_3d_data.dart';
|
|||||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||||
import 'package:wolf_3d_engine/wolf_3d_engine.dart';
|
import 'package:wolf_3d_engine/wolf_3d_engine.dart';
|
||||||
import 'package:wolf_3d_input/wolf_3d_input.dart';
|
import 'package:wolf_3d_input/wolf_3d_input.dart';
|
||||||
import 'package:wolf_3d_synth/wolf_3d_synth.dart';
|
|
||||||
|
|
||||||
// Helper to gracefully exit and restore the terminal
|
// Helper to gracefully exit and restore the terminal
|
||||||
void exitCleanly(int code) {
|
void exitCleanly(int code) {
|
||||||
@@ -22,11 +21,21 @@ void main() async {
|
|||||||
// HIDE the blinking cursor and clear the screen to prep the canvas
|
// HIDE the blinking cursor and clear the screen to prep the canvas
|
||||||
stdout.write('\x1b[?25l\x1b[2J');
|
stdout.write('\x1b[?25l\x1b[2J');
|
||||||
|
|
||||||
// ... (Keep your game discovery and instantiation exactly the same) ...
|
print("Discovering game data...");
|
||||||
|
// 1. Get the absolute URI of where this exact script lives
|
||||||
|
final scriptUri = Platform.script;
|
||||||
|
|
||||||
|
// 2. Resolve the path mathematically.
|
||||||
|
final targetUri = scriptUri.resolve(
|
||||||
|
'../../../packages/wolf_3d_assets/assets/retail',
|
||||||
|
);
|
||||||
|
final targetPath = targetUri.toFilePath();
|
||||||
|
|
||||||
final availableGames = await WolfensteinLoader.discover(
|
final availableGames = await WolfensteinLoader.discover(
|
||||||
directoryPath: 'assets/shareware',
|
directoryPath: targetPath,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
final data = availableGames.values.first;
|
final data = availableGames.values.first;
|
||||||
|
|
||||||
final input = CliInput();
|
final input = CliInput();
|
||||||
@@ -87,6 +96,8 @@ void main() async {
|
|||||||
// Move cursor to top-left (0,0) before drawing the frame
|
// Move cursor to top-left (0,0) before drawing the frame
|
||||||
stdout.write('\x1b[H');
|
stdout.write('\x1b[H');
|
||||||
|
|
||||||
|
input.update();
|
||||||
|
|
||||||
engine.tick(elapsed, input.currentInput);
|
engine.tick(elapsed, input.currentInput);
|
||||||
rasterizer.render(engine, buffer);
|
rasterizer.render(engine, buffer);
|
||||||
rasterizer.finalizeFrame();
|
rasterizer.finalizeFrame();
|
||||||
16
apps/wolf_3d_cli/pubspec.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: wolf_3d_cli
|
||||||
|
description: A pure Dart CLI for Wolfenstein 3D.
|
||||||
|
publish_to: "none"
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: ^3.11.1
|
||||||
|
|
||||||
|
resolution: workspace
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
wolf_3d_data:
|
||||||
|
wolf_3d_data_types:
|
||||||
|
wolf_3d_engine:
|
||||||
|
wolf_3d_input:
|
||||||
|
wolf_3d_synth:
|
||||||
|
wolf_3d_assets:
|
||||||
4
apps/wolf_3d_gui/analysis_options.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
formatter:
|
||||||
|
trailing_commas: preserve
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
||||||
import 'package:wolf_dart/screens/game_select_screen.dart';
|
import 'package:wolf_3d_gui/screens/game_select_screen.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||||
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
||||||
import 'package:wolf_dart/screens/difficulty_screen.dart';
|
import 'package:wolf_3d_gui/screens/difficulty_screen.dart';
|
||||||
import 'package:wolf_dart/screens/sprite_gallery.dart';
|
import 'package:wolf_3d_gui/screens/sprite_gallery.dart';
|
||||||
import 'package:wolf_dart/screens/vga_gallery.dart';
|
import 'package:wolf_3d_gui/screens/vga_gallery.dart';
|
||||||
|
|
||||||
class EpisodeScreen extends StatefulWidget {
|
class EpisodeScreen extends StatefulWidget {
|
||||||
const EpisodeScreen({super.key});
|
const EpisodeScreen({super.key});
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||||
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
||||||
import 'package:wolf_dart/screens/episode_screen.dart';
|
import 'package:wolf_3d_gui/screens/episode_screen.dart';
|
||||||
|
|
||||||
class GameSelectScreen extends StatelessWidget {
|
class GameSelectScreen extends StatelessWidget {
|
||||||
const GameSelectScreen({super.key});
|
const GameSelectScreen({super.key});
|
||||||
30
apps/wolf_3d_gui/pubspec.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: wolf_3d_gui
|
||||||
|
description: "A new Flutter project."
|
||||||
|
publish_to: "none"
|
||||||
|
version: 0.1.0+1
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: ^3.11.1
|
||||||
|
|
||||||
|
resolution: workspace
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
wolf_3d_data: any
|
||||||
|
wolf_3d_data_types: any
|
||||||
|
wolf_3d_synth: any
|
||||||
|
wolf_3d_engine: any
|
||||||
|
wolf_3d_entities: any
|
||||||
|
wolf_3d_renderer: any
|
||||||
|
wolf_3d_input: any
|
||||||
|
wolf_3d_flutter: any
|
||||||
|
|
||||||
|
flutter:
|
||||||
|
sdk: flutter
|
||||||
|
|
||||||
|
dev_dependencies:
|
||||||
|
flutter_test:
|
||||||
|
sdk: flutter
|
||||||
|
flutter_lints: ^6.0.0
|
||||||
|
|
||||||
|
flutter:
|
||||||
|
uses-material-design: true
|
||||||
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 917 B |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
15
packages/wolf_3d_assets/pubspec.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: wolf_3d_assets
|
||||||
|
description: "Shared game assets for Wolfenstein 3D apps."
|
||||||
|
publish_to: "none"
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: ^3.11.1
|
||||||
|
|
||||||
|
resolution: workspace
|
||||||
|
|
||||||
|
# This tells Flutter to bundle these files when a dependent app builds!
|
||||||
|
flutter:
|
||||||
|
assets:
|
||||||
|
- assets/retail/
|
||||||
|
- assets/shareware/
|
||||||
@@ -10,5 +10,6 @@ export 'src/managers/door_manager.dart';
|
|||||||
export 'src/managers/pushwall_manager.dart';
|
export 'src/managers/pushwall_manager.dart';
|
||||||
export 'src/player/player.dart';
|
export 'src/player/player.dart';
|
||||||
export 'src/rasterizer.dart';
|
export 'src/rasterizer.dart';
|
||||||
|
export 'src/silent_renderer.dart';
|
||||||
export 'src/software_rasterizer.dart';
|
export 'src/software_rasterizer.dart';
|
||||||
export 'src/wolf_3d_engine_base.dart';
|
export 'src/wolf_3d_engine_base.dart';
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ class Wolf3d {
|
|||||||
for (final version in versionsToTry) {
|
for (final version in versionsToTry) {
|
||||||
try {
|
try {
|
||||||
final ext = version.version.fileExtension;
|
final ext = version.version.fileExtension;
|
||||||
final folder = 'assets/${version.path}';
|
// final folder = 'assets/${version.path}';
|
||||||
|
final folder = 'packages/wolf_3d_assets/assets/${version.path}';
|
||||||
|
|
||||||
final data = WolfensteinLoader.loadFromBytes(
|
final data = WolfensteinLoader.loadFromBytes(
|
||||||
version: version.version,
|
version: version.version,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ dependencies:
|
|||||||
wolf_3d_engine: any
|
wolf_3d_engine: any
|
||||||
wolf_3d_entities: any
|
wolf_3d_entities: any
|
||||||
wolf_3d_input: any
|
wolf_3d_input: any
|
||||||
|
wolf_3d_assets: any
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -3,5 +3,4 @@
|
|||||||
/// More dartdocs go here.
|
/// More dartdocs go here.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
export 'src/silent_renderer.dart' show CliSilentAudio;
|
|
||||||
export 'src/wolf_3d_audio.dart' show WolfAudio;
|
export 'src/wolf_3d_audio.dart' show WolfAudio;
|
||||||
|
|||||||
29
pubspec.yaml
@@ -1,35 +1,11 @@
|
|||||||
name: wolf_dart
|
name: wolf_dart
|
||||||
description: "A new Flutter project."
|
|
||||||
publish_to: "none"
|
|
||||||
version: 0.1.0+1
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.11.1
|
sdk: ^3.11.1
|
||||||
|
|
||||||
dependencies:
|
|
||||||
wolf_3d_data: any
|
|
||||||
wolf_3d_data_types: any
|
|
||||||
wolf_3d_synth: any
|
|
||||||
wolf_3d_engine: any
|
|
||||||
wolf_3d_entities: any
|
|
||||||
wolf_3d_renderer: any
|
|
||||||
wolf_3d_input: any
|
|
||||||
wolf_3d_flutter: any
|
|
||||||
flutter:
|
|
||||||
sdk: flutter
|
|
||||||
|
|
||||||
dev_dependencies:
|
|
||||||
flutter_test:
|
|
||||||
sdk: flutter
|
|
||||||
flutter_lints: ^6.0.0
|
|
||||||
|
|
||||||
flutter:
|
|
||||||
uses-material-design: true
|
|
||||||
assets:
|
|
||||||
- assets/retail/
|
|
||||||
- assets/shareware/
|
|
||||||
|
|
||||||
workspace:
|
workspace:
|
||||||
|
- apps/wolf_3d_gui/
|
||||||
|
- apps/wolf_3d_cli/
|
||||||
- packages/wolf_3d_data/
|
- packages/wolf_3d_data/
|
||||||
- packages/wolf_3d_data_types/
|
- packages/wolf_3d_data_types/
|
||||||
- packages/wolf_3d_synth/
|
- packages/wolf_3d_synth/
|
||||||
@@ -38,3 +14,4 @@ workspace:
|
|||||||
- packages/wolf_3d_renderer/
|
- packages/wolf_3d_renderer/
|
||||||
- packages/wolf_3d_input/
|
- packages/wolf_3d_input/
|
||||||
- packages/wolf_3d_flutter/
|
- packages/wolf_3d_flutter/
|
||||||
|
- packages/wolf_3d_assets/
|
||||||
|
|||||||