Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
Other
9.06k stars 542 forks source link

Fix nk_draw_button_text_* to use nk_flags align passed from nk_menu_item_image_text etc #551

Open wuxxerno opened 1 year ago

wuxxerno commented 1 year ago

nk_flags align were lost in transit and not passed to the final draw functions, where a NK_TEXT_CENTERED was in its place.

Dodzey commented 6 days ago

Could this not use the text_alignment from the passed in nk_style_button* ? Rather than having a new argument? I had a local fix to this where the alignment passed to eg. nk_button_image_label would determine whether the text was to the left or right of the image, and the relevant button style text_alignment would determine the alignment of the text itself.

Dodzey commented 6 days ago

I have implemented an alternative to this here: https://github.com/Immediate-Mode-UI/Nuklear/pull/674 In my implementation the align passed to nk_button_image_label etc continues to switch from text to right of image or text to left of image, and the button style text_alignment flag is used to select the alignment of the text within the 'content' region of the button.