Initial flame_lua_runtime package
This commit is contained in:
41
example/lib/main.dart
Normal file
41
example/lib/main.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flame_spine/flame_spine.dart' as spine;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flame_lua_runtime/flame_lua_runtime.dart';
|
||||
|
||||
const _serverUrl = String.fromEnvironment('LUA_GAME_SERVER');
|
||||
const _gameId = String.fromEnvironment('LUA_GAME_ID', defaultValue: 'showcase');
|
||||
const _locale = String.fromEnvironment('LUA_GAME_LOCALE');
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await spine.initSpineFlutter();
|
||||
runApp(const FlameLuaRuntimeShowcaseApp());
|
||||
}
|
||||
|
||||
class FlameLuaRuntimeShowcaseApp extends StatelessWidget {
|
||||
const FlameLuaRuntimeShowcaseApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'Flame Lua Runtime Showcase',
|
||||
theme: ThemeData.dark(useMaterial3: true),
|
||||
home: Scaffold(
|
||||
body: SafeArea(
|
||||
child: LuaGameWidget(
|
||||
gameId: _gameId,
|
||||
serverUrl: _serverUrl.isEmpty ? null : Uri.parse(_serverUrl),
|
||||
runtimeOptions: const RuntimeOptions(
|
||||
runtimeLuaRoot: 'packages/flame_lua_runtime/assets/runtime/lua',
|
||||
),
|
||||
localeOverride: _locale.isEmpty
|
||||
? null
|
||||
: RuntimeLocaleResolver.localeFromTag(_locale),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user