RAUI-labs / raui

Rust implementation of Renderer Agnostic User Interface
https://raui-labs.github.io/raui/
Other
396 stars 10 forks source link

Color & Linear Algebra Types Interop #69

Open zicklag opened 3 years ago

zicklag commented 3 years ago

I was thinking maybe it would be good to try out the cint and mint crates for allowing RAUI to use any kind of color or math types instead of being forced to use the vek types and RAUI's built-in Color types.

I haven't use either crate before and I'd have to see how it would turn out, but it would be really nice if I didn't have to isolate my UI code from the bevy prelude because of the Vec3 and Color types being different inside of RAUI.

I've seen other crates add features for which math types they want to use. So RAUI could have vek, glam, and nalgebra features that would set type-aliases for the math types expected for Vec2, Vec3, etc., and using mint we could make sure those types are converted to the vec types if necessary when we need to do operations that require specific functions, maybe?

I'm not positive this is a good idea or not, but I thought it worth thinking about.

PsichiX commented 3 years ago

i'm totally ok with mint for interoperability (i've tested it and works for me), for the cint i'll have to see what is it

PsichiX commented 3 years ago

i've looked at cint and i see it serves exactly the same goals as mint - i'm just curious about how would you like to handle these interop types - are you planning to make them as new vec2/rect/color types or you want original types implement From/Into with interop types?

zicklag commented 3 years ago

i'm totally ok with mint for interoperability (i've tested it and works for me),

Cool!

i'm just curious about how would you like to handle these interop types - are you planning to make them as new vec2/rect/color types or you want original types implement From/Into with interop types?

Honestly I didn't know exactly how to approach it yet. I hadn't looked into it enough to know. The pain point I wanted to solve, though, was while using RAUI in Bevy I would like to be able to use the glam::Vec2 type that comes with the Bevy Prelude, without it causing problems if I try to include both the Bevy and RAUI preludes at the same time, because of overlapping and different Vec2 types from the Bevy and RAUI preludes.

However we accomplish that I'm good with it I think. I'd like to look into it a bit more to understand what that might look like in practice, but I'm not sure when I'll get the chance and I don't care if somebody else does it first.