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,21 +1,30 @@
|
||||
/// Shared Flutter renderer shell for driving the Wolf3D engine from a widget tree.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:wolf_3d_dart/wolf_3d_engine.dart';
|
||||
|
||||
// 1. The widget now only requires the engine!
|
||||
/// Base widget for renderers that present frames from a [WolfEngine].
|
||||
abstract class BaseWolfRenderer extends StatefulWidget {
|
||||
/// Engine instance that owns world state and the shared framebuffer.
|
||||
final WolfEngine engine;
|
||||
|
||||
/// Creates a renderer bound to [engine].
|
||||
const BaseWolfRenderer({
|
||||
required this.engine,
|
||||
super.key,
|
||||
});
|
||||
}
|
||||
|
||||
/// Base [State] implementation that provides a ticker-driven render loop.
|
||||
abstract class BaseWolfRendererState<T extends BaseWolfRenderer>
|
||||
extends State<T>
|
||||
with SingleTickerProviderStateMixin {
|
||||
/// Per-frame ticker used to advance the engine and request renders.
|
||||
late final Ticker gameLoop;
|
||||
|
||||
/// Focus node used by the enclosing [KeyboardListener].
|
||||
final FocusNode focusNode = FocusNode();
|
||||
|
||||
Duration _lastTick = Duration.zero;
|
||||
@@ -50,8 +59,13 @@ abstract class BaseWolfRendererState<T extends BaseWolfRenderer>
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// Renders the latest engine state into the concrete renderer's output type.
|
||||
void performRender();
|
||||
|
||||
/// Builds the visible viewport widget for the latest rendered frame.
|
||||
Widget buildViewport(BuildContext context);
|
||||
|
||||
/// Background color used by the surrounding scaffold.
|
||||
Color get scaffoldColor;
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user