[Dear ImGui C++] How to Make A Working Login Form

Поделиться
HTML-код
  • Опубликовано: 26 сен 2024

Комментарии • 60

  • @iforce2d
    @iforce2d 7 месяцев назад +7

    When you make a single char and then write past the 'end' of it like that, it will corrupt whatever memory follows it. That's why people in the comments are complaining about crashes and the password content becoming the same as the username content. You really should make a pinned comment to explain this, and I would also suggest that you figure out how pointers work before making tutorials. Other than that, I still found this tutorial useful, thanks.

    • @luda.assist
      @luda.assist 5 месяцев назад

      do you know a fix?

    • @s7davidj
      @s7davidj Месяц назад

      @iforce2d no need to be an asswipe about it, you could have just given the solution yourself...
      But yes, as iforce2d said the `char` datatype is only used to store a single character (byte). When we try to store multiple characters in a variable only meant to store one, it just bleeds over into the next variable. If you want to store a "string" (cstring) of characters, you need to allocate enough memory to actually store the other characters. By adding the [256] we are essentially telling the program that we want to reserve the next 256 characters (bytes) in memory for our variable, so that our text doesn't accidentally bleed into the next variable.
      So, this is the correct definition for the input username & password buffers:
      char inputusername[256];
      char inputpassword[256];

  • @PurpzC4D3
    @PurpzC4D3 2 года назад +2

    Lets go new vid !!!

  • @jay.5749
    @jay.5749 2 года назад +1

    Great Video, Skyed!
    I have one question though. Is there any way to make the login page close after a successful login?

    • @skyeddev
      @skyeddev  2 года назад +1

      sure, use an if statement for the login window like you do for the second one. if logged == false then shiw the first window. After you login, logged will be true, the second window will show but the login one wont!

    • @jay.5749
      @jay.5749 2 года назад +2

      @@skyeddev thank you. i just did it by myself! I added: static bool showWindow = true; and after that, i put "if (showWindow)" around the code for the Login window. And if the login was successful, i did "showWindow = false;"

    • @skyeddev
      @skyeddev  2 года назад +1

      @@jay.5749 good job!

  • @2muchfaith_
    @2muchfaith_ Месяц назад

    hey do you know how to remove the background window saying dear imgui direct11x window example

  • @XYZ_x7x1
    @XYZ_x7x1 5 месяцев назад

    Im new to Imgui but is there any way to get rid of the Dear ImGui DirecrX11 Example window?

  • @Brxnin69
    @Brxnin69 2 месяца назад

    how to remove the baground dear imgui direct x 11 example please help

  • @exibaby
    @exibaby 2 года назад +1

    fire thumbnail!

    • @skyeddev
      @skyeddev  2 года назад

      for sure, thanks a lot mate!

    • @skyeddev
      @skyeddev  2 года назад

      good job tbh, it looks great

  • @gow9476
    @gow9476 2 года назад +1

    idk why but mine keeps writing the same text on input password text. I read docs before but I have no idea whats wrong

    • @johnhouser3673
      @johnhouser3673 2 года назад +1

      I am having the same problem. Did you find a solution?

    • @gow9476
      @gow9476 2 года назад

      @@johnhouser3673 I wish I did. I would probably ask on stack over flow for help.

    • @iforce2d
      @iforce2d 7 месяцев назад

      It's because he declares a single char and then writes past the 'end' of that memory space, which will overwrite the password, and potentially a bunch of other variables as well. I'm not sure if he really understands how pointers work.

    • @ScaryMc
      @ScaryMc 4 месяца назад

      @@gow9476 if (ImGui::Begin("Login Form", NULL,ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse))
      {
      char inputusername[32];
      char inputpassword[32];
      ImGui::Text("Username: ");
      ImGui::InputText("##usernameinput", inputusername, CHAR_MAX);
      ImGui::Text("Password: ");
      ImGui::InputText("##passwordinput", inputpassword, CHAR_MAX, ImGuiInputTextFlags_Password);
      if (ImGui::Button("Login")) {
      if (inputusername == username && inputpassword == password) {
      logged = true;
      }
      }
      }ImGui::End();
      if (logged == true) {
      ImGui::SetNextWindowSize(ImVec2(200,200));
      if (ImGui::Begin("Window 2")) {
      ImGui::Text("Hello World");
      }ImGui::End();
      }

  • @jay.5749
    @jay.5749 2 года назад +1

    I got a Video idea! I saw many people´s ImGui projects, and when they for example entered a wrong username, there was a "popup menu" where it said "invalid username". Would be great if you could explain these!

    • @skyeddev
      @skyeddev  2 года назад

      like a windows message bix or a notification?

    • @jay.5749
      @jay.5749 2 года назад

      @@skyeddev Windows message box

    • @krapfen170
      @krapfen170 Год назад +1

      MessageBox(NULL, "Invalid Password", "Error", MB_OK | MB_ICONERROR);

  • @iamnab6124
    @iamnab6124 Год назад

    Hi! I got a "program cant start because libmysq;.dll was not found" error, any idea how I can fix it?

    • @zahyra-w9k
      @zahyra-w9k 9 месяцев назад

      if youre using d3d9 add d3d9.lib

  • @error404_newmod
    @error404_newmod Год назад +2

    Work in android?

  • @AlienEditxz
    @AlienEditxz Год назад

    Hi how do you remove imgui app login page in android

  • @johnsknows3135
    @johnsknows3135 Год назад

    mine has ????????????? and ************** already in the entry boxes then it does not let me type anything in when I click on them

    • @skyeddev
      @skyeddev  Год назад +1

      make sure you have a char* as your buf and that char should be defined globally, outside any loops

    • @johnsknows3135
      @johnsknows3135 Год назад

      @@skyeddev Hey man.
      I can type in it now but the prefilled ????? are still their and it throws up an error if i delete them all.
      I use a &char like you do in your video. I tried to define inputUsername as a char* and then not use the & but this crashes the program.

    • @Ser0zine
      @Ser0zine Год назад

      @@johnsknows3135 Try this:
      char InputUsername[256];
      char InputPassword[256];
      std::memset(InputUsername, '\0', 256);
      std::memset(InputPassword, '\0', 256);
      ImGui::Text("Username:");
      ImGui::InputText("##InputUsername", InputUsername, CHAR_MAX);
      ImGui::Text("Password");
      ImGui::InputText("##InputPassword", InputPassword, CHAR_MAX, ImGuiInputTextFlags_Password);

  • @Gneey2Smooth
    @Gneey2Smooth Год назад

    My exe closes after clicking on the username box (this started after i added CHAR_MAX)

  • @CEOcat-k4r
    @CEOcat-k4r Год назад

    nice bro

  • @katzus3307
    @katzus3307 Год назад

    Nice video,
    But the inputbox always shows "??0?" How can I fix that
    and after typing in the inputbox it dissapears again :( anyone knows how to fix that?

    • @asyrictarkov
      @asyrictarkov Год назад

      hi have u fix id?

    • @RedBloodCat1
      @RedBloodCat1 Год назад +2

      @@asyrictarkov The way to fix it is to do
      char InputUsername[256] = "";
      char InputPassword[256] = "";
      and
      ImGui::Text("Input username"); ImGui::SameLine();
      ImGui::InputText("##UsernameInput", InputUsername, CHAR_MAX);
      ImGui::Text("Input password"); ImGui::SameLine();
      ImGui::InputText("##PasswordInput", InputPassword, CHAR_MAX, ImGuiInputTextFlags_Password);

  • @gonzo6598
    @gonzo6598 11 месяцев назад

    can you give src?

  • @ra1n792
    @ra1n792 2 года назад

    Can you upgrade this video to work with a database?

    • @skyeddev
      @skyeddev  2 года назад

      probably w keyauth a tuto

  • @darkmanipulatave.a
    @darkmanipulatave.a Год назад

    This is work on aide?

  • @dkkogmaw1311
    @dkkogmaw1311 Год назад

    and how do I disable the render window ?

  • @Ser0zine
    @Ser0zine Год назад

    Can you make a new version that works? I found a fix but still

    • @fitnastifter28
      @fitnastifter28 7 месяцев назад

      whats the fix?

    • @Ser0zine
      @Ser0zine 7 месяцев назад

      @@fitnastifter28 I forgot

    • @iforce2d
      @iforce2d 7 месяцев назад

      @@fitnastifter28 You need to declare a char buffer, not just a single char. So change:
      char inputusername;
      to
      char inputusername[CHAR_MAX];

  • @dark_st9389
    @dark_st9389 2 года назад +1

    hey awsome vid, but i got 1 issue the CHAR_MAX thing after i type in more then 2 anything it crashes. any idea how to fix it?

    • @skyeddev
      @skyeddev  2 года назад

      use sizeof(char) then

    • @dark_st9389
      @dark_st9389 2 года назад

      @@skyeddev it dosnt work either

    • @dark_st9389
      @dark_st9389 2 года назад

      any idea?

    • @skyeddev
      @skyeddev  2 года назад

      @@dark_st9389 just write a numerical value then, like 100

    • @dark_st9389
      @dark_st9389 2 года назад +1

      @@skyeddev ahh, i got it. just had to change this: char pass_word[255];

  • @Cipsko
    @Cipsko 2 года назад +2

    🇨🇵🏳

  • @jamesakaiz0124
    @jamesakaiz0124 Год назад

    i love it can you explain to me or make video about make random key to imgui like free keys in cheats bro

    • @jinzuval7293
      @jinzuval7293 Год назад +1

      keyauth

    • @jamesakaiz0124
      @jamesakaiz0124 Год назад

      @@jinzuval7293 which func in keyauth can make free keys like skip ads and generate key can you help me with it ?

  • @Ismaref1409
    @Ismaref1409 11 месяцев назад

    I posted the correct code on his server : #general | en