Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.cspell/flame_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Supabase # Supabase, one of our sponsors https://supabase.com/
terminui # A terminal UI library for Flutter
texturepacker # a packed spritesheet format
Tilemap # What tile maps are called within Tiled
typled # A grid map and sprite sheet tool https://github.com/erickzanardo/typled
vantablack # brand name for a famous super-black ink known as the darkest ever made
Weasley # Ron Weasley, a character from the book Harry Potter
Wyrmsun # An open-source real-time strategy game https://www.indiedb.com/games/wyrmsun
Expand Down
7 changes: 7 additions & 0 deletions doc/bridge_packages/bridge_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ Load sprite sheets created by TexturePacker tool (bridge package for
[TexturePacker]).
:::

:::{package} flame_typled

Load Typled sprite atlases with edge-repeated padding (bridge package for [Typled]).
:::

:::{package} flame_tiled

2D tilemap level editor (bridge package for [Tiled]).
Expand All @@ -102,6 +107,7 @@ Load sprite sheets created by TexturePacker tool (bridge package for
[Spine]: https://pub.dev/packages/spine_flutter
[TexturePacker]: https://www.codeandweb.com/texturepacker
[Tiled]: https://www.mapeditor.org/
[Typled]: https://pub.dev/packages/typled
[flutter_svg]: https://github.com/dnfield/flutter_svg


Expand All @@ -124,4 +130,5 @@ flame_spine <flame_spine/flame_spine.md>
flame_svg <flame_svg/flame_svg.md>
flame_texturepacker <flame_texturepacker/flame_texturepacker.md>
flame_tiled <flame_tiled/flame_tiled.md>
flame_typled <flame_typled/flame_typled.md>
```
33 changes: 33 additions & 0 deletions doc/bridge_packages/flame_typled/flame_typled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# flame_typled

flame_typled provides integration between [Typled](https://pub.dev/packages/typled) sprite atlases
Comment thread
luanpotter marked this conversation as resolved.
and Flame.

Typled is simple text based format to map sprite sheets, tile sets and tile maps. It provides a dart
package to parse the text files into usable dart models and an application to allow visualization of
the files.

Import the `TypledSpriteAtlas` class from `'package:flame_typled/flame_typled.dart'` and load your
atlas:

```dart
final atlas = await TypledSpriteAtlas.load('assets/atlas.typled');
```

Then retrieve individual sprites by their typled id:

```dart
final mySprite = atlas.sprite('player_idle');
```

Note that this will create a new instance of Sprite, so you might want to save it.

Or create a `SpriteBatch` for efficient batch rendering:

```dart
final batch = atlas.toBatch(useAtlas: false);
```

By default, Flame Typled will add a Ghost Line busting padding of 1 pixel all around
(2 pixels total) for each tile. You can change this by passing `disablePadding: true`
to the `TypledSpriteAtlas.load()`.
21 changes: 21 additions & 0 deletions packages/flame_typled/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Blue Fire

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions packages/flame_typled/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- markdownlint-disable MD013 -->
<p align="center">
<a href="https://flame-engine.org">
<img alt="flame" width="200px" src="https://user-images.githubusercontent.com/6718144/101553774-3bc7b000-39ad-11eb-8a6a-de2daa31bd64.png">
</a>
</p>

<p align="center">
Adds support for loading <a href="https://pub.dev/packages/typled">Typled</a> sprite atlases as Sprites in your <a href="https://github.com/flame-engine/flame">Flame</a> games.
</p>

<p align="center">
<a title="Pub" href="https://pub.dev/packages/flame_typled" ><img src="https://img.shields.io/pub/v/flame_typled.svg?style=popout" /></a>
<a title="Test" href="https://github.com/flame-engine/flame/actions?query=workflow%3Acicd+branch%3Amain"><img src="https://github.com/flame-engine/flame/actions/workflows/cicd.yml/badge.svg?branch=main&event=push"/></a>
<a title="Discord" href="https://discord.gg/pxrBmy4"><img src="https://img.shields.io/discord/509714518008528896.svg"/></a>
<a title="Melos" href="https://github.com/invertase/melos"><img src="https://img.shields.io/badge/maintained%20with-melos-f700ff.svg"/></a>
</p>

---

<!-- markdownlint-enable MD013 -->

<!-- markdownlint-disable-next-line MD002 -->

# flame_typled

Package to add Typled sprite atlas support Flame's sprites.
Comment thread
luanpotter marked this conversation as resolved.

Typled is simple text based format to map sprite sheets, tile sets and tile maps. It provides a dart
package to parse the text files into usable dart models and an application to allow visualization of
the files.

More [here](https://docs.flame-engine.org/main/bridge_packages/flame_typled/flame_typled.html).
5 changes: 5 additions & 0 deletions packages/flame_typled/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: package:flame_lint/analysis_options_with_dcm.yaml

linter:
rules:
- public_member_api_docs
3 changes: 3 additions & 0 deletions packages/flame_typled/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# flame_typled example

A simple example of how to use the `flame_typled` package.
1 change: 1 addition & 0 deletions packages/flame_typled/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:flame_lint/analysis_options.yaml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/flame_typled/example/assets/mini-dungeon.typled_atlas
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[atlas]
imagePath = mini-dungeon.png
tileSize = 8

[sprites]
top_left_dirt = 0, 0
top_middle_dirt = 1, 0
top_right_dirt = 2, 0

green_globin = 0, 4
red_globin = 1, 4

rock = 0, 3

tree_leaves = 1, 5, 3, 3

[hitboxes]
rock = 3, 6, 3, 2
red_globin = 2, 3, 4, 4
56 changes: 56 additions & 0 deletions packages/flame_typled/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'dart:async';

import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame_typled/flame_typled.dart';
import 'package:flutter/material.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: GameWidget.controlled(
gameFactory: TypledExample.new,
),
);
}
}

class TypledExample extends FlameGame {
@override
Color backgroundColor() => const Color(0xFF2A1D3A);

@override
Future<void> onLoad() async {
final atlas = await TypledSpriteAtlas.load('mini-dungeon.typled_atlas');
final scale = Vector2.all(16);

add(
SpriteComponent(
sprite: atlas.sprite('rock'),
position: Vector2(50, 50),
scale: scale,
),
);
add(
SpriteComponent(
sprite: atlas.sprite('green_globin'),
position: Vector2(200, 220),
scale: scale,
),
);
add(
SpriteComponent(
sprite: atlas.sprite('red_globin'),
position: Vector2(10, 300),
scale: scale,
),
);
}
}
25 changes: 25 additions & 0 deletions packages/flame_typled/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: flame_typled_example
resolution: workspace
description: "An example for the TypledSpriteAtlas."

publish_to: "none"

version: 1.0.0+1

environment:
sdk: ">=3.11.0 <4.0.0"

dependencies:
flame: ^1.36.0
flame_typled: ^0.1.0
flutter:
sdk: flutter

dev_dependencies:
flame_lint: ^1.4.3

flutter:
uses-material-design: false
assets:
- assets/images/
- assets/
3 changes: 3 additions & 0 deletions packages/flame_typled/lib/flame_typled.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library flame_typled;

export 'typled_sprite_atlas.dart';
Loading
Loading