Unified game screen and abstracted input

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-16 16:10:12 +01:00
parent 0963869b0c
commit b702c50d30
9 changed files with 22 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ import 'dart:math' as math;
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
import 'package:wolf_3d_engine/wolf_3d_engine.dart';
import 'package:wolf_3d_entities/wolf_3d_entities.dart';
import 'package:wolf_3d_input/wolf_3d_input.dart';
class WolfEngine {
WolfEngine({
@@ -11,6 +12,7 @@ class WolfEngine {
required this.startingEpisode,
required this.onGameWon,
required this.audio,
required this.input,
}) : doorManager = DoorManager(
onPlaySound: (sfxId) => audio.playSoundEffect(sfxId),
);
@@ -28,6 +30,7 @@ class WolfEngine {
// Managers
final DoorManager doorManager;
final Wolf3dInput input;
final PushwallManager pushwallManager = PushwallManager();
@@ -51,12 +54,15 @@ class WolfEngine {
}
// Expect standard Dart Duration. The host app is responsible for the loop.
void tick(Duration elapsed, EngineInput input) {
void tick(Duration elapsed) {
if (!isInitialized) return;
_timeAliveMs += elapsed.inMilliseconds;
final inputResult = _processInputs(elapsed, input);
input.update();
final currentInput = input.currentInput;
final inputResult = _processInputs(elapsed, currentInput);
doorManager.update(elapsed);
pushwallManager.update(elapsed, currentLevel);