GithubHelp home page GithubHelp logo

rive-bevy's People

Contributors

dragostis avatar hayesgordon avatar simbleau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rive-bevy's Issues

`wasm32-unknown-unknown` build tracking

The wasm32 architecture should be supported, otherwise there's a big risk this rust bevy runtime doesn't amount to much. There are some pretty big issues with this, particularly that rive-rs ( the parser library companion to this ) is heavily relied on by C++ and build.rs magic (see rive-app/rive-rs#3).

Filing this issue to track wasm32 support.

Issue with Separate Layers

I am developing an RTS game using Bevy with the Rive plugin for handling animations. I've encountered a problem concerning the selection and deselection of a building in the game. The selection logic (triggered by the S key) and building animation (triggered by the B key) are implemented. The issue arises in the way these interactions are handled across different layers: the selection logic is implemented in a separate layer from the main logic layer.

The building is expected to be selected when I press S and deselected when I press it again. However, the building remains marked as selected until I press the B key for the building animation at least once. This issue with the S and B logic in separate layers is just an isolated example within my project.

Expected Behavior:
Pressing S in the selection layer should select the building, and pressing it again should deselect it, regardless of the state of the building animation in the main layer.

Actual Behavior:
The building remains selected until I activate the building animation with the B key at least once, even after pressing S to deselect.

Code for reproduction:

use bevy::{prelude::*, render::render_resource::Extent3d, window};
use rive_bevy::{RivePlugin, SceneTarget, SpriteEntity, StateMachine, RiveStateMachine};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(RivePlugin)
        .add_systems(Startup, setup_animation)
        .add_systems(Update, (window::close_on_esc, update))
        .run()
}

fn setup_animation(
    mut commands: Commands,
    mut images: ResMut<Assets<Image>>,
    asset_server: Res<AssetServer>,
) {
    let mut image = Image::default();

    image.resize(Extent3d {
        width: 128,
        height: 128,
        ..default()
    });

    let image_handle = images.add(image.clone());

    commands.spawn(Camera2dBundle { ..default() });

    let sprite_entity = commands
        .spawn(SpriteBundle {
            texture: image_handle.clone(),
            transform: Transform::from_scale(Vec3::splat(1.0)),
            ..default()
        })
        .id();

    let state_machine = StateMachine {
        riv: asset_server.load("genesis.riv"),
        ..default()
    };

    commands.spawn(state_machine).insert(SceneTarget {
        image: image_handle,
        sprite: SpriteEntity {
            entity: Some(sprite_entity),
        },
        ..default()
    });
}

fn update(input: Res<Input<KeyCode>>, query: Query<&mut RiveStateMachine>) {
    let state_machine = query.single();

    if input.just_pressed(KeyCode::C) {
        state_machine.get_number("progress").unwrap().set(100.0);
    }

    if input.just_pressed(KeyCode::S) {
        let mut selected = state_machine.get_bool("selected").unwrap();
        selected.set(!selected.get());
    }

    if input.just_pressed(KeyCode::B) {
        let mut build = state_machine.get_bool("build").unwrap();
        build.set(!build.get());
    }
}

Important: You need to press C first after application startup, to show the "building".

Attachments:
genesis.rev.txt
genesis.riv.txt

I had to rename with .txt extension to attach to issue.

Dependencies of Cargo.toml:

[dependencies]
bevy = "0.12.0"
rive-bevy = { git = "https://github.com/rive-app/rive-bevy" }

bevy 0.13.0 support

This repository doesn't compile with bevy 0.13.0. Would be cool if we could fix it. :)

dynamic resizing

One of the core features of vector graphics is to be resizable. I don't see an example that allows dynamic resizing. In all of the examples the size is explicitly hardcoded.

e.g. -

    animation_image.resize(Extent3d {
        width: 1024,
        height: 1024,
        ..default()
    });

It would make sense to have an example that resizes all of the images when there's a bevy resize event.

image

"Pointer Down" listener triggered when mouse button released.

Hi!
Thanks for the great work so far.

I'm seeing unwanted "pointer down" listeners firing when I release the mouse button.
Steps to reproduce

  • Open the simple_2d example (heart rating)
  • Press and hold a heart
  • move your cursor to a different heart and release

mouse_up_bug

Note: This makes press-and-hold interactions impossible at the moment, as no "Pointer Up" listener is ever called.

simple text example

All of the examples use the Bevy text sections, but how would one programmatically create text that is rendered by vello?

Is this out of scope and needs to be created separately, e.g. bevy-vello-fonts, or is this something rive-bevy should support?

We did this in bevy-vello already, to take a font, and allow rendering to the surface. I would be happy adding a PR here, if needed.

The reason is pretty simple - It's inconvenient and seems unnecessary to need to create an Artboard or a use a file, and then change the text within it like in the rive-input example.

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.