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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user