Initial flame_lua_runtime package

This commit is contained in:
gem
2026-06-07 22:53:58 +08:00
commit 733b2fb798
262 changed files with 28439 additions and 0 deletions

41
example/lib/main.dart Normal file
View 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),
),
),
),
);
}
}