ADDED: GuiTextInputBox()

This commit is contained in:
Ray
2019-08-02 17:19:00 +02:00
parent 32d6ba6f5a
commit b2b7528709
2 changed files with 62 additions and 14 deletions

View File

@ -95,6 +95,9 @@ int main()
bool exitWindow = false;
bool showMessageBox = false;
char textInput[256] = { 0 };
bool showTextInputBox = false;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
@ -108,6 +111,8 @@ int main()
if (IsKeyPressed(KEY_ESCAPE)) showMessageBox = !showMessageBox;
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_S)) showTextInputBox = true;
if (IsFileDropped())
{
int dropsCount = 0;
@ -188,10 +193,20 @@ int main()
if (showMessageBox)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
int message = GuiMessageBox((Rectangle){ GetScreenWidth()/2 - 125, GetScreenHeight()/2 - 50, 250, 100 }, GuiIconText(RICON_EXIT, "Closing rTexPacker"), "Do you really want to exit?", "Yes;No");
int result = GuiMessageBox((Rectangle){ GetScreenWidth()/2 - 125, GetScreenHeight()/2 - 50, 250, 100 }, GuiIconText(RICON_EXIT, "Closing rTexPacker"), "Do you really want to exit?", "Yes;No");
if ((message == 0) || (message == 2)) showMessageBox = false;
else if (message == 1) exitWindow = true;
if ((result == 0) || (result == 2)) showMessageBox = false;
else if (result == 1) exitWindow = true;
}
if (showTextInputBox)
{
char textInputTemp[256] = { 0 };
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
int result = GuiTextInputBox((Rectangle){ GetScreenWidth()/2 - 120, GetScreenHeight()/2 - 60, 240, 120 }, GuiIconText(RICON_FILE_SAVE, "Save file as..."), textInputTemp, "Ok;Cancel");
if ((result == 0) || (result == 2)) showTextInputBox = false;
else if (result == 1) strcpy(textInput, textInputTemp);
}
//GuiEnable();