zxvnme / zgui

zxvnme's graphical user interface
MIT License
399 stars 53 forks source link

Checkbox not working [BUG] (CS GO) #44

Closed brunph closed 5 years ago

brunph commented 5 years ago

Describe the bug Checkboxes are not working for me.

To Reproduce Steps to reproduce the behavior:

  1. Setup gui in paint_traverse and run input in painttraverse also.
  2. Add a checkbox.
  3. Compile
  4. Try and click and it won't work.

Expected behavior I would think the checkbox would check but it doesn't.

Screenshots No screenshot to add.

Desktop (please complete the following information):

zxvnme commented 5 years ago

Hey @brunph thanks for reporting that issue. Are checkboxes the only controls that don't work properly?

brunph commented 5 years ago

Hey @brunph thanks for reporting that issue. Are checkboxes the only controls that don't work properly?

Wow the fast response! well checkboxes and buttons. My buttons seems to not accept the label argument? Somehow the button doesn't have a title even tho the title is 100% correct.zgui::button("button#button_1", { 120, 30 }); this is the one i'm using as an example, which provides an empty title. And from your documentation the values before the "#" should be displayed.

zxvnme commented 5 years ago

That's strange... Could you provide me video/gif of this occurence?

brunph commented 5 years ago

video of this in action, i agree this is really weird. Could it be the input loop being placed in the wrong part? but all the other controls are working tho. Maybe the boolean values.

zxvnme commented 5 years ago

Are your boolean variables static?

patrykkolodziej commented 5 years ago

Can you show us your full code of hook and menu implementation? I don't have any problems with zgui in my code, I'm using also Paint Traverse. https://i.imgur.com/DnU9J6T.png

brunph commented 5 years ago

Paint traverse

else if (_panel == panel) {
        zgui::poll_input("main");
        if (zgui::begin_window("main", { 500, 350 }, render::get( ).watermark_font, zgui::zgui_window_flags_no_ontoggle_animation))
        {
            zgui::checkbox("sample checkbox #example", example);
            zgui::checkbox("sample checkbox #test", test);

            zgui::button("button#button_1", { 120, 30 });

            // value before hash is visible ^
            zgui::slider_int("#sample_slider", 0, 40, example_int);
            //                ^ value after hash is hidden"
            //
            // Hashing is demystified in zgui.hh
            // Search for [hashing controls names] to get more details.
            zgui::end_window();
        }
    }

Boolean declaration static bool example = false; bool test = false; static int example_int = 10;

most of this code is for testing so don't mind the bad formatting and bad code etc.

patrykkolodziej commented 5 years ago

Change zgui::poll_input("main"); To zgui::poll_input("Counter-Strike: Global Offensive");

zxvnme commented 5 years ago

@brunph something is wrong with your input/hooking or draw manager. Check if these things are coded/done properly. I pasted your menu code into my base and everything was working fine. I've just changed thing mentioned in @patrykkolodziej comment.

brunph commented 5 years ago

Isn't zgui handling the input? how could the input manager be wrong then. Sorry if i'm really stupid, just a new framework to work with.

patrykkolodziej commented 5 years ago

Did you set input to csgo as I write earlier?

zxvnme commented 5 years ago

Isn't zgui handling the input? how could the input manager be wrong then. Sorry if i'm really stupid, just a new framework to work with.

It is, but you have not done it properly.

Your code: zgui::poll_input("main"); <-- Here should be name of process window, not name of zgui window.

Proper code: zgui::poll_input("Counter-Strike: Global Offensive"); <-- Proper way of reading input from window with name "Counter-Strike: Global Offensive".

brunph commented 5 years ago

Got it, where would be the recommended place to put this?