Skip to content

Repository files navigation

bevy_pages


Buy Me A Coffee

A lightweight and elegant framework to upgrade your Bevy UI experience.


crates.io docs.rs Following released Bevy versions


This is a crate extending bevy to add support for XML-based UI pages. Kinda like an HTML page, but supercharged and with XML.

Features

  • 🪽 Lightweight: Bevy is already huge enough. This crate only enables actually necessary features and has a minimal set of dependencies.

  • ⚡ Fast: The only existent overhead is parsing the XML files, which is already very fast. Widgets and internal systems are written with ECS-filtering and optimized queries.

  • 📜 Expressive: Use the power of XML to create interactive UIs with ease. You can even have multiple pages activated at once and use custom CSS-like <Styles></Styles>.

  • ✒️ Fully documented: I added my signature #[warn(missing_docs)] and you can also look at the official guide to learn more about the framework.

  • 👁️ Built-in Auto-Completion: Use the official XSD Schema to enable auto-completion inside your favorite IDE.

  • 🔥 Integrated Hot-Reloading: Use the hot-reload feature to enable integrated asset hot-reloading.

  • ✨ Extended Widget Catalog: The framework has a set of basic and advanced widgets with optimal performance and customizability:

    • <Node></Node>
    • <Button></Button>
    • <Text></Text>
    • <Checkbox/>
    • <Divider/>
    • <Slider/>
    • <Dropdown></Dropdown>
    • <ScrollView></ScrollView>
    • <ProgressBar/>
    • <TextInput/>
    • <Tooltip></Tooltip>
    • <Image/>
    • <Switch/>
    • <Notifier/>

Getting Started

After adding bevy_pages to your project, you can start coding your XML pages.

An XML page roughly looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Page
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/DraftedDev/bevy_pages/master/schema.xsd">
    <Text>Hello World!</Text>
</Page>

NOTE: If you have issues with the remote schema.xsd, you are free to download it locally and link it in your XML.

You will also need to add the PagesPlugin to your app and use the PageManager to spawn and manage your page:

fn spawn_my_page(mut commands: Commands, assets: Res<AssetServer>, mut manager: ResMut<PageManager>) {
    let handle = assets.load("my_page.xml");

    manager.spawn("my_page", handle);
    // Pages are inactive by default
    manager.set_active("my_page", true);
}

See more in this Tutorial.

Learning Resources

Bevy Support

The following table shows the supported bevy versions:

bevy bevy_pages
0.19 0.1.0 - latest

About

A lightweight and elegant framework to upgrade your Bevy UI experience.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages