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

Add imgui demo to the debug menu #78771

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

moxian
Copy link
Contributor

@moxian moxian commented Dec 26, 2024

Summary

Infrastructure "Added Imgui demo screen (and style editor) to the debug menu"

Purpose of change

Breaking the UI without the need to recompile and/or painstalkingly step line-by-line with a debugger trying to figure out why is my text clipping ever so slightly.

Describe the solution

Shamelessly copy-paste the imgui demo code on the main menu screen into the debug_menu.cpp (without the lorem ipsum window from the former)

Describe alternatives you've considered

Adding it to the global hotkeys so that I can invoke it while having another imgui menu open, but I'm hesitant to pollute global hotkeys with functionality that's exclusively useful for debug purposes. (I'm also not 100% sure it will even re-draw the "other" imgui windows that way, so the point is moot. But i haven't tried either)

Testing

Yes, that's kinda the point.
20241225-223601-cataclysm-tiles

20241225-224147-cataclysm-tiles

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style json-styled JSON lint passed, label assigned by github actions labels Dec 26, 2024
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Dec 26, 2024
@mqrause
Copy link
Contributor

mqrause commented Dec 26, 2024

Instead of duplicating it, you should put the class in a header.

@moxian
Copy link
Contributor Author

moxian commented Dec 26, 2024

Reasonable. But which one? Neither including debug_menu.h in main_menu.cpp nor including main_menu.h in debug_menu.cpp makes a lot of sense.
Would it be okay to create a new imgui_demo.h + .cpp (or perhaps debug_imgui_demo) just for this (and include that in both debug_menu.cpp and main_menu.cpp)?

@mqrause
Copy link
Contributor

mqrause commented Dec 26, 2024

A new file is fine, yeah.

@moxian moxian marked this pull request as draft December 26, 2024 08:37
@github-actions github-actions bot added the Info / User Interface Game - player communication, menus, etc. label Dec 26, 2024
@moxian moxian marked this pull request as ready for review December 26, 2024 10:54
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 26, 2024
#include "translations.h"


debug_imgui_demo_ui::debug_imgui_demo_ui() :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's preferable to keep the name imgui_demo over changing it to debug_imgui_demo.

(Just making sure the name change isn't merged, maybe you knew already.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants