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

Drawing custom shapes (was: improving Custom Title Bar) #7185

Closed
luis605 opened this issue Jan 1, 2024 · 2 comments
Closed

Drawing custom shapes (was: improving Custom Title Bar) #7185

luis605 opened this issue Jan 1, 2024 · 2 comments

Comments

@luis605
Copy link

luis605 commented Jan 1, 2024

dear imgui, v1.89.2
Branch: docking

Back-end/Renderer/Compiler/OS
Back-ends: rlImGui
Operating System: Linux Mint 21.1 Vera

My Question:
I made a custom title bar for my game engine using dear imgui. At the moment, the title bar is too basic. So, I want to add more detail to it. I believe I can add more detail to it using dear imgui, but I don't know how. I came here with a possible design in mind, and I'd like to know how I implement it.

Screenshots
Original Title Bar:
Screenshot at 2024-01-01 14-18-11

Photoshoped Title Bar:
image

How did I implement my title bar:
The code uses BeginMainMenuBar() to create the title bar. It draws Lit Engine's logo at the left of the title bar using ImGui::Image(). It also displays "Lit Engine" in the middle of the bar as well as other buttons and menus.

@ocornut
Copy link
Owner

ocornut commented Jan 3, 2024

It seems like your question is solely a drawing question.
You can use ImDrawList functions PathLineTo(), PathArcTo() to create a path, then PathFillConvex() to fill it. Note that it will only support convex shapes, so it is best is you create your shape in multiple convex parts.

Concave shapes are more difficult to draw (a concave polygon triangular was posted #760 (comment))

@ocornut ocornut changed the title Improving Custom Title Bar Drawing custom shapes (was: improving Custom Title Bar) Jan 3, 2024
@luis605
Copy link
Author

luis605 commented Jan 6, 2024

It is working. Thank you!

@luis605 luis605 closed this as completed Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants