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.
@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];
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!
@@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;"
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.
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 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.
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 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);
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.
do you know a fix?
@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];
Lets go new vid !!!
Great Video, Skyed!
I have one question though. Is there any way to make the login page close after a successful login?
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!
@@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;"
@@jay.5749 good job!
hey do you know how to remove the background window saying dear imgui direct11x window example
Im new to Imgui but is there any way to get rid of the Dear ImGui DirecrX11 Example window?
how to remove the baground dear imgui direct x 11 example please help
fire thumbnail!
for sure, thanks a lot mate!
good job tbh, it looks great
idk why but mine keeps writing the same text on input password text. I read docs before but I have no idea whats wrong
I am having the same problem. Did you find a solution?
@@johnhouser3673 I wish I did. I would probably ask on stack over flow for help.
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.
@@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();
}
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!
like a windows message bix or a notification?
@@skyeddev Windows message box
MessageBox(NULL, "Invalid Password", "Error", MB_OK | MB_ICONERROR);
Hi! I got a "program cant start because libmysq;.dll was not found" error, any idea how I can fix it?
if youre using d3d9 add d3d9.lib
Work in android?
New mod
Hi how do you remove imgui app login page in android
mine has ????????????? and ************** already in the entry boxes then it does not let me type anything in when I click on them
make sure you have a char* as your buf and that char should be defined globally, outside any loops
@@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.
@@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);
My exe closes after clicking on the username box (this started after i added CHAR_MAX)
me too
nice bro
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?
hi have u fix id?
@@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);
can you give src?
Can you upgrade this video to work with a database?
probably w keyauth a tuto
This is work on aide?
and how do I disable the render window ?
did you find a way?
Can you make a new version that works? I found a fix but still
whats the fix?
@@fitnastifter28 I forgot
@@fitnastifter28 You need to declare a char buffer, not just a single char. So change:
char inputusername;
to
char inputusername[CHAR_MAX];
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?
use sizeof(char) then
@@skyeddev it dosnt work either
any idea?
@@dark_st9389 just write a numerical value then, like 100
@@skyeddev ahh, i got it. just had to change this: char pass_word[255];
🇨🇵🏳
i love it can you explain to me or make video about make random key to imgui like free keys in cheats bro
keyauth
@@jinzuval7293 which func in keyauth can make free keys like skip ads and generate key can you help me with it ?
I posted the correct code on his server : #general | en