Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window rounding #146

Open
Janrupf opened this issue Jun 5, 2020 · 7 comments
Open

Window rounding #146

Janrupf opened this issue Jun 5, 2020 · 7 comments

Comments

@Janrupf
Copy link

Janrupf commented Jun 5, 2020

Currently, setting style->window.rounding does not seem to have any effect, and I also couldn't find any use of this variable in the source code. Am I missing something here is or is window rounding not implemented?

@riri
Copy link
Contributor

riri commented Jun 6, 2020

Did you try

nk_style_push_float(ctx, &ctx->style.window.rounding, window_rounding_flow_value);

@Janrupf
Copy link
Author

Janrupf commented Jun 6, 2020

I basicially did context->style.window.rounding = 50f

@riri
Copy link
Contributor

riri commented Jun 6, 2020

Actually you are right, the panel creation does not use the rounding setting, but in any case, I think changing style setting implies using nk_style_push_***() functions so that changed are stacked.
The result will also depends on the backend, if rounded rectangles are possible or not (no problem with opengl* at least).

@Janrupf
Copy link
Author

Janrupf commented Jun 6, 2020

Might make a PR for that then, sounds like someone put it there and then forgot about it.

(Yeah, I'm using OpenGL through Java, ported from the C backend, rounding works fine for buttons)

@riri
Copy link
Contributor

riri commented Jun 6, 2020

I had a look in the panel code to find out if it was applied. Then I realized it's not as simple as it seems because of clipping I guess. The way a window is drawn might need to change because of the presence of the header (for now, the window "content" is drawn below the header, so that rounding would not work as expected). I leave that to nuklear expert ;-)

@Janrupf
Copy link
Author

Janrupf commented Jun 6, 2020

I think rounding the content would be fine. I also looked at the panel code, but currently I don't think there is a way to just round one corner of a rectangle, so I totally agree that rounding would look weird. It would be cool to still have rounding for just the content nevertheless, I actually don't need the titlebar and border for the rounded window

@riri
Copy link
Contributor

riri commented Jun 6, 2020

The problem is that the PR would need to handle the header.
For your exact case, I suppose using the rounding style at nuklear_panel.c(297) would be enough:

        else nk_fill_rect(out, body, style->window.rounding, style->window.fixed_background.data.color);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants