diff --git a/.github/.cspell/people_usernames.txt b/.github/.cspell/people_usernames.txt index a8155a585..7bfcc866e 100644 --- a/.github/.cspell/people_usernames.txt +++ b/.github/.cspell/people_usernames.txt @@ -6,6 +6,7 @@ erickzanardo # github.com/erickzanardo feroult # github.com/feroult fröber # github.com/Brixto gnarhard # github.com/gnarhard +kenney # kenney.nl Klingsbo # github.com/spydon luanpotter # github.com/luanpotter Lukas # github.com/spydon diff --git a/packages/flame_kenney_xml/.metadata b/packages/flame_kenney_xml/.metadata new file mode 100644 index 000000000..2b377030c --- /dev/null +++ b/packages/flame_kenney_xml/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "7482962148e8d758338d8a28f589f317e1e42ba4" + channel: "stable" + +project_type: package diff --git a/packages/flame_kenney_xml/CHANGELOG.md b/packages/flame_kenney_xml/CHANGELOG.md new file mode 100644 index 000000000..b208df87e --- /dev/null +++ b/packages/flame_kenney_xml/CHANGELOG.md @@ -0,0 +1,4 @@ +## 0.1.0 + + - **FEAT**: Add initial version of `flame_kenney_xml`. + diff --git a/packages/flame_kenney_xml/LICENSE b/packages/flame_kenney_xml/LICENSE new file mode 100644 index 000000000..0cf87ff46 --- /dev/null +++ b/packages/flame_kenney_xml/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 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. diff --git a/packages/flame_kenney_xml/README.md b/packages/flame_kenney_xml/README.md new file mode 100644 index 000000000..e1bda7d67 --- /dev/null +++ b/packages/flame_kenney_xml/README.md @@ -0,0 +1,41 @@ + +
+
+
+
+
+Adds support for parsing XML sprite sheets from https://kenney.nl, and other sprite sheets on the same format. +
+ + + +--- + + + +## Getting started + +To get started, first add `flame_kenney_xml` as a dependency in your flutter project. + +```bash +flutter pub add flame_kenney_xml +``` + +Then place the `spritesheet.json` in `assets/` and `spritesheet.png` in `assets/images/` +(or whatever the names of the files are). + +Then load the image and the spritesheet using: + +```dart +final spritesheet = await XmlSpriteSheet.load( + image: 'spritesheet.png', + xml: 'spritesheet.xml`, +); +``` diff --git a/packages/flame_kenney_xml/analysis_options.yaml b/packages/flame_kenney_xml/analysis_options.yaml new file mode 100644 index 000000000..85732fa02 --- /dev/null +++ b/packages/flame_kenney_xml/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flame_lint/analysis_options.yaml diff --git a/packages/flame_kenney_xml/example/.gitignore b/packages/flame_kenney_xml/example/.gitignore new file mode 100644 index 000000000..29a3a5017 --- /dev/null +++ b/packages/flame_kenney_xml/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/flame_kenney_xml/example/.metadata b/packages/flame_kenney_xml/example/.metadata new file mode 100644 index 000000000..36786568e --- /dev/null +++ b/packages/flame_kenney_xml/example/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + - platform: linux + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/flame_kenney_xml/example/README.md b/packages/flame_kenney_xml/example/README.md new file mode 100644 index 000000000..c7c39f28b --- /dev/null +++ b/packages/flame_kenney_xml/example/README.md @@ -0,0 +1,3 @@ +# flame_kenney_xml example + +An example of how to use the flame_kenney_xml package. diff --git a/packages/flame_kenney_xml/example/analysis_options.yaml b/packages/flame_kenney_xml/example/analysis_options.yaml new file mode 100644 index 000000000..85732fa02 --- /dev/null +++ b/packages/flame_kenney_xml/example/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flame_lint/analysis_options.yaml diff --git a/packages/flame_kenney_xml/example/assets/images/spritesheet_stone.png b/packages/flame_kenney_xml/example/assets/images/spritesheet_stone.png new file mode 100644 index 000000000..83be767c5 Binary files /dev/null and b/packages/flame_kenney_xml/example/assets/images/spritesheet_stone.png differ diff --git a/packages/flame_kenney_xml/example/assets/license.txt b/packages/flame_kenney_xml/example/assets/license.txt new file mode 100644 index 000000000..188521c56 --- /dev/null +++ b/packages/flame_kenney_xml/example/assets/license.txt @@ -0,0 +1,14 @@ + +############################################################################### + + Physics asset pack by Kenney Vleugels (www.kenney.nl) + + ------------------------------ + + License (CC0) + http://creativecommons.org/publicdomain/zero/1.0/ + + You may use these graphics in personal and commercial projects. + Credit (Kenney or www.kenney.nl) would be nice but is not mandatory. + +############################################################################### \ No newline at end of file diff --git a/packages/flame_kenney_xml/example/assets/spritesheet_stone.xml b/packages/flame_kenney_xml/example/assets/spritesheet_stone.xml new file mode 100644 index 000000000..d1940c1d9 --- /dev/null +++ b/packages/flame_kenney_xml/example/assets/spritesheet_stone.xml @@ -0,0 +1,57 @@ +