feat: Integrate window manager for desktop windowing support and enhance input handling

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-20 11:25:05 +01:00
parent 10eaef9690
commit c81eb6750d
6 changed files with 128 additions and 0 deletions

View File

@@ -4,7 +4,9 @@
/// before presenting the game-selection flow.
library;
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';
@@ -12,6 +14,10 @@ import 'package:wolf_3d_gui/screens/game_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
if (_supportsDesktopWindowing) {
await windowManager.ensureInitialized();
}
final Wolf3d wolf3d = await Wolf3d().init();
runApp(
@@ -23,6 +29,19 @@ void main() async {
);
}
bool get _supportsDesktopWindowing {
if (kIsWeb) {
return false;
}
return switch (defaultTargetPlatform) {
TargetPlatform.linux ||
TargetPlatform.windows ||
TargetPlatform.macOS => true,
_ => false,
};
}
class _NoGameDataScreen extends StatelessWidget {
const _NoGameDataScreen();