otavepto / gbe_fork

Fork of https://gitlab.com/Mr_Goldberg/goldberg_emulator
https://gitlab.com/Mr_Goldberg/goldberg_emulator
GNU Lesser General Public License v3.0
183 stars 51 forks source link

Hiding individual buttons in Overlay from .ini #211

Open ghost opened 3 weeks ago

ghost commented 3 weeks ago

I know it's a lot to request, but it would be nice to have this feature. Even better would be the ability to hide all the buttons in the Overlay.

Detanup01 commented 3 weeks ago

At this point just dont use overlay.. (for removing all button)

What would you do with that, like genuinely, why?

ghost commented 3 weeks ago

It may sound childish, but I just want this emulator to be perfect in appearance. Otherwise it's a perfect emulator. As I said, if it sounds too childish, you can mark it as not planned. I have no problem with that.

ghost commented 3 weeks ago

(for removing all button)

I guess I didn't make my point clear, like being able to hide the Settings button in configs.overlay.ini. Or Test Achievement.

Detanup01 commented 3 weeks ago

Oh I thought you mean remove every ui element, well I think it's viable. Individual button hide? I guess.

Detanup01 commented 3 weeks ago

viable yes, but definitly NOT for me :D I could add the settings but have 0 fucking idea where to actually add those..

otavepto commented 3 weeks ago

if you'd like to give it a try these are the places, the function ImGui::Button() returns true if the button was clicked. https://github.com/otavepto/gbe_fork/blob/a384994ac2ef2711589ad03390de00b57b95abe4/overlay_experimental/steam_overlay.cpp#L1325-L1333

this happens every frame, and ImGui stores the last button state until you read it. example, if the user clicked on a button, in the next frame the function will return true, and once you consume this value any time (by simply calling the function), the function will no longer return true. that way the if condition will be satisfied only once whenever the user presses the button.

as you can see, the code will check for this every frame and set a bool var, and a couple of lines later it will check this bool var and show the corresponding list/popup https://github.com/otavepto/gbe_fork/blob/a384994ac2ef2711589ad03390de00b57b95abe4/overlay_experimental/steam_overlay.cpp#L1395-L1397