Moved all widgets and logic from gui app to Flutter package
- Implemented DebugToolsScreen for navigation to asset galleries. - Created GameScreen to manage gameplay and renderer integrations. - Added NoGameDataScreen to handle scenarios with missing game data. - Developed SpriteGallery for visual browsing of sprite assets. - Introduced VgaGallery for displaying VGA images from game data. - Added GalleryGameSelector widget for selecting game variants in galleries. - Created Wolf3dApp as the main application shell for managing game states. - Implemented WolfMenuShell for consistent menu layouts across screens. - Enhanced Wolf3d class to support debug mode and related functionalities. - Updated pubspec.yaml to include window_manager dependency. - Added tests for game screen lifecycle and debug mode functionalities. Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -8,96 +8,20 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:wolf_3d_flutter/wolf_3d_flutter.dart';
|
||||
import 'package:wolf_3d_gui/screens/game_screen.dart';
|
||||
|
||||
/// Creates the application shell after loading available Wolf3D data sets.
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
if (_supportsDesktopWindowing) {
|
||||
if (supportsDesktopWindowing) {
|
||||
await windowManager.ensureInitialized();
|
||||
}
|
||||
|
||||
final Wolf3d wolf3d = await Wolf3d().init();
|
||||
final Wolf3d wolf3d = await Wolf3d().init(debug: kDebugMode);
|
||||
|
||||
runApp(
|
||||
MaterialApp(
|
||||
darkTheme: ThemeData.dark(useMaterial3: true),
|
||||
theme: ThemeData.light(useMaterial3: true),
|
||||
themeMode: ThemeMode.system,
|
||||
home: wolf3d.availableGames.isEmpty
|
||||
? const _NoGameDataScreen()
|
||||
: GameScreen(wolf3d: wolf3d),
|
||||
home: Wolf3dApp(wolf3d: wolf3d),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Whether desktop window-management APIs should be initialized for this host.
|
||||
bool get _supportsDesktopWindowing {
|
||||
if (kIsWeb) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return switch (defaultTargetPlatform) {
|
||||
TargetPlatform.linux ||
|
||||
TargetPlatform.windows ||
|
||||
TargetPlatform.macOS => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
class _NoGameDataScreen extends StatelessWidget {
|
||||
const _NoGameDataScreen();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF140000),
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 640),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF590002),
|
||||
border: Border.all(color: const Color(0xFFB00000), width: 2),
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'WOLF3D DATA NOT FOUND',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFFFF700),
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'No game files were discovered.\n\n'
|
||||
'Add Wolfenstein 3D data files to one of these locations:\n'
|
||||
'- packages/wolf_3d_assets/assets/retail\n'
|
||||
'- packages/wolf_3d_assets/assets/shareware\n'
|
||||
'- or a discoverable local game-data folder.\n\n'
|
||||
'Restart the app after adding the files.',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 15,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user