#imgui checkbox

47 messages · Page 1 of 1 (latest)

weak cypress
#

yes

open hamlet
weak cypress
#

id need your code for that

open hamlet
#
    ImGui::SetCursorPos(ImVec2(8.000f, 109.000f));
    ImGui::Checkbox("Inf Fuel", &fuel);
#

would it go under there

weak cypress
#
if (ImGui::Checkbox("Inf Fuel", &fuel);
   if (ImGui::IsKeyPressed(/*the key you want to use*/))
      fuel != fuel;
#

windows and linux use SDL2 keycodes, you can look them up

#

but generally SDL_SCANCODE_A for example will work

open hamlet
open hamlet
#

just confirming

#

like this??

weak cypress
#

just do IsKeyPressed(SDL_SCANCODE_F1)

#

no point in converting keycodes theyre already defined in the header

open hamlet
#

it needs another )

#

and its undefined

weak cypress
#

included the header?

open hamlet
#

nope

weak cypress
#

do that

open hamlet
#

can you send me them

#

i dont wanna get the wrong one

weak cypress
#

look it up

#

its not hard to find

#

"SDL2 header cpp"

#

ships with win and linux

open hamlet
#

bro wtf is this

#

there is so many files and folders

#

@weak cypress these?

#

@weak cypress i got the headers in but now the key doesnt actually disable and enable the checkbox

weak cypress
#

oh sorry, they shouldnt be linked to one another

open hamlet
#
    if (ImGui::Checkbox("Inf Fuel", &fuel));
        if (ImGui::IsKeyPressed(SDL_SCANCODE_F1))
            fuel != fuel;
weak cypress
#
if (ImGui::Checkbox("Inf Fuel", &fuel);
{
//your logic here
}
if (ImGui::IsKeyPressed(/SDL_SCANCODE_F1))
      fuel != fuel;
#

try that

open hamlet
#

nope

open hamlet
#

@weak cypress yeah im pasting in the same code and fixing it then the F1 key does nothing

weak cypress
#

The is key pressed should be running in your main loop. Not in the render function

open hamlet
#

what

#
    if (ImGui::Checkbox("Inf Fuel", &fuel));
    {

    }
    if (ImGui::IsKeyPressed(SDL_SCANCODE_F1))
        fuel != fuel;
open hamlet
#

my whole screen is now gone

open hamlet
open hamlet
#

i found another way of doing it