StarArawn / kayak_ui

Other
469 stars 50 forks source link

Track resource as context #205

Closed CrmsnDragoon closed 1 year ago

CrmsnDragoon commented 1 year ago

I'm trying to make something more strategy esque (think pikmin), and I'm using a resource, not an entity, to track unit counts as it's global state

The issue I've been running into is that since I'm using a resource, there's currently no way to update the UI without changing the resource into a component and keeping it on an entity

Can there please be a way to track resources as context?

StarArawn commented 1 year ago

I'm trying to make something more strategy esque (think pikmin), and I'm using a resource, not an entity, to track unit counts as it's global state

The issue I've been running into is that since I'm using a resource, there's currently no way to update the UI without changing the resource into a component and keeping it on an entity

Can there please be a way to track resources as context?

You can already manually track resources using something like this: https://github.com/StarArawn/kayak_ui/blob/main/src/widgets/app.rs#L44

I do want to add a more generic version of this and offer it for users to use.

CrmsnDragoon commented 1 year ago

Thanks for pointing me in the right direction, I've got it to work using this.