Refactor and enhance documentation across the Wolf3D project
- Updated library imports to use the correct package paths for consistency. - Added detailed documentation comments to various classes and methods, improving code readability and maintainability. - Refined the GameSelectScreen, SpriteGallery, and VgaGallery classes with clearer descriptions of their functionality. - Enhanced the CliInput class to better explain the input handling process and its interaction with the engine. - Improved the SixelRasterizer and Opl2Emulator classes with comprehensive comments on their operations and state management. - Removed the deprecated wolf_3d.dart file and consolidated its functionality into wolf_3d_flutter.dart for a cleaner architecture. - Updated the Wolf3dFlutterInput class to clarify its role in merging keyboard and pointer events. - Enhanced the rendering classes to provide better context on their purpose and usage within the Flutter framework. Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
/// Active gameplay screen for the Flutter host.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:wolf_3d_dart/wolf_3d_data_types.dart';
|
||||
@@ -6,13 +9,24 @@ import 'package:wolf_3d_flutter/wolf_3d_input_flutter.dart';
|
||||
import 'package:wolf_3d_renderer/wolf_3d_ascii_renderer.dart';
|
||||
import 'package:wolf_3d_renderer/wolf_3d_flutter_renderer.dart';
|
||||
|
||||
/// Owns a [WolfEngine] instance and exposes renderer/input integrations to Flutter.
|
||||
class GameScreen extends StatefulWidget {
|
||||
/// Fully parsed game data for the selected version.
|
||||
final WolfensteinData data;
|
||||
|
||||
/// Difficulty applied when creating the engine session.
|
||||
final Difficulty difficulty;
|
||||
|
||||
/// Episode index used as the starting world.
|
||||
final int startingEpisode;
|
||||
|
||||
/// Shared audio backend reused across menu and gameplay screens.
|
||||
final EngineAudio audio;
|
||||
|
||||
/// Flutter input adapter that translates widget events into engine input.
|
||||
final Wolf3dFlutterInput input;
|
||||
|
||||
/// Creates a gameplay screen with the supplied game session configuration.
|
||||
const GameScreen({
|
||||
required this.data,
|
||||
required this.difficulty,
|
||||
@@ -55,6 +69,8 @@ class _GameScreenState extends State<GameScreen> {
|
||||
onPointerHover: widget.input.onPointerMove,
|
||||
child: Stack(
|
||||
children: [
|
||||
// Keep both renderers behind the same engine so mode switching does
|
||||
// not reset level state or audio playback.
|
||||
_useAsciiMode
|
||||
? WolfAsciiRenderer(engine: _engine)
|
||||
: WolfFlutterRenderer(engine: _engine),
|
||||
@@ -80,7 +96,7 @@ class _GameScreenState extends State<GameScreen> {
|
||||
),
|
||||
),
|
||||
|
||||
// TAB listener
|
||||
// Tab toggles the renderer implementation for quick visual debugging.
|
||||
Focus(
|
||||
autofocus: true,
|
||||
onKeyEvent: (node, event) {
|
||||
@@ -94,7 +110,8 @@ class _GameScreenState extends State<GameScreen> {
|
||||
child: const SizedBox.shrink(),
|
||||
),
|
||||
|
||||
// Loading Overlay
|
||||
// A second full-screen overlay keeps the presentation simple while
|
||||
// the engine is still warming up or decoding the first frame.
|
||||
if (!_engine.isInitialized)
|
||||
Container(
|
||||
color: Colors.black,
|
||||
|
||||
Reference in New Issue
Block a user