Dimchikkk / bevy_cosmic_edit

Apache License 2.0
86 stars 9 forks source link

refactor + move rendering fns to own file #84

Closed bytemunch closed 1 year ago

bytemunch commented 1 year ago

Merged cosmic_edit_redraw_buffer and cosmic_edit_redraw_buffer_ui into a single function, in order to make placeholder and password (#81) code easier.

Placeholders were not implemented for sprite based widgets, this PR fixes that.

Moved most of redraw_buffer_common into the single redraw function.

I'm having type wrangling issues with the image replace function which I left separate in replace_target_image. Think I need to look into dereferencing more, and understand that block of code a bit better.

Dimchikkk commented 1 year ago

Nice one.

Since I want to be able style widget using shaders... and shaders as for now only play nicely with sprites but not bevy_ui entity... and I don't like that we separate in code on sprite and bevy_ui that much.... we could refactor and have one way in theory....

Let me try to explain...

If user creates CosmicUIBundle....

we spawn button but make it invisible and use sprite on top of it and draw into sprite always.... button is only used for sync of position/width/height.

So essentially CosmicUIBundle becomes exactly the same as CosmicSpriteBundle... the only difference is... transparent button is spawn that used for syncing positioning between button and sprite, etc.

Not related to this PR change directly, just sharing ideas until I remember :)

bytemunch commented 1 year ago

I see what you mean, I'll open an issue for it and see where I can get with it