- Added support for new plugins: IrondashEngineContext and SuperNativeExtensions in the Flutter plugin registrant. - Updated CMake configuration to include new plugins. - Introduced a new dependency, super_clipboard, in pubspec.yaml. - Enhanced the WolfEngine to set the menu background color. - Implemented keyboard shortcuts for renderer mode toggling and ASCII theme cycling in CLI input handling. - Updated menu manager to include a universal menu background color. - Refactored ASCII and Sixel renderers to utilize the new menu background color and improved header drawing logic. - Simplified the drawing of menu options sidebars and header bars across different renderers. - Improved the layout and centering of menu titles in the header bar. Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
80 lines
2.6 KiB
Dart
80 lines
2.6 KiB
Dart
/// Visual browser for decoded sprite assets and their inferred gameplay roles.
|
|
library;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:wolf_3d_dart/wolf_3d_data_types.dart';
|
|
import 'package:wolf_3d_dart/wolf_3d_entities.dart';
|
|
import 'package:wolf_3d_flutter/wolf_3d_flutter.dart';
|
|
import 'package:wolf_3d_renderer/wolf_3d_asset_painter.dart';
|
|
|
|
/// Displays every sprite frame in the active game along with enemy metadata.
|
|
class SpriteGallery extends StatelessWidget {
|
|
/// Shared application facade used to access the active game's sprite set.
|
|
final Wolf3d wolf3d;
|
|
|
|
/// Creates the sprite gallery for [wolf3d].
|
|
const SpriteGallery({super.key, required this.wolf3d});
|
|
|
|
bool get isShareware => wolf3d.activeGame.version == GameVersion.shareware;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Sprite Gallery"),
|
|
automaticallyImplyLeading: true,
|
|
),
|
|
backgroundColor: Colors.black,
|
|
body: GridView.builder(
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 8,
|
|
crossAxisSpacing: 8,
|
|
mainAxisSpacing: 8,
|
|
),
|
|
itemCount: wolf3d.sprites.length,
|
|
itemBuilder: (context, index) {
|
|
String label = "Sprite Index: $index";
|
|
for (final enemy in EnemyType.values) {
|
|
// The gallery infers likely ownership from sprite index ranges so
|
|
// debugging art packs does not require cross-referencing source.
|
|
if (enemy.claimsSpriteIndex(index, isShareware: isShareware)) {
|
|
final EnemyAnimation? animation = enemy.getAnimationFromSprite(
|
|
index,
|
|
isShareware: isShareware,
|
|
);
|
|
|
|
label += "\n${enemy.name}";
|
|
if (animation != null) {
|
|
label += "\n${animation.name}";
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
return Card(
|
|
color: Colors.blueGrey,
|
|
child: Column(
|
|
spacing: 8,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: const TextStyle(color: Colors.white, fontSize: 10),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
Expanded(
|
|
child: Center(
|
|
child: AspectRatio(
|
|
aspectRatio: 1,
|
|
child: WolfAssetPainter.sprite(wolf3d.sprites[index]),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|