Giter Club home page Giter Club logo

trve_bevy_image's Introduction

trve_bevy_image

An opinionated Bevy plugin to load Image Assets quickly and easily. Ideal for Game Jams.

How to use

This plugin is meant to be a convenience tool to load all image assets for your game at startup, ideal for small projects and prototypes.

To use it, add it to your Cargo.toml file like this:

trve_bevy_image = { git = "https://github.com/mnmaita/trve_bevy_image" }

Remember you can also target tags, commits and branches with this method:

trve_bevy_image = { git = "https://github.com/mnmaita/trve_bevy_image", tag = "v0.3.0" }
trve_bevy_image = { git = "https://github.com/mnmaita/trve_bevy_image", branch = "test" }
trve_bevy_image = { git = "https://github.com/mnmaita/trve_bevy_image", rev = "03ee540ad7afba7822a73139169c635093127fba" }

Default usage and overriding default behavior

By default, it will load all assets from an "img" directory under your "assets" folder. You can override this directory by using the ImageAssetFolder Resource:

let mut app = App::new();

// Your plugins go here.
app.add_plugins(TrveImagePlugin);

// You insert this Resource and use the `new` function
// which accepts any parameter that can be turned into an `AssetPath`.
app.insert_resource(ImageAssetFolder::new("images"));

This will load all assets from assets/images by using AssetServer's load_folder method.

Loading a list of assets

Certain platforms, like web, can't use load_folder to load assets so this library provides an override via the ImageAssetList Resource. This allows you to load a list of assets from your assets folder.

    app.insert_resource(ImageAssetList::new(
        [
            "textures/player.png",
            "textures/enemy.png",
            "textures/background.png",
        ]
        .into(),
    ));

If you insert this Resource, ImageAssetFolder will be ignored and the plugin will only load assets based on the provided list.

Bevy version compatibility

trve_bevy_image bevy
0.3 0.14
0.2 0.13
0.1 0.12

trve_bevy_image's People

Contributors

mnmaita avatar

Stargazers

 avatar

Watchers

 avatar

trve_bevy_image's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.