Fixed exitWindow error

This commit is contained in:
Ray
2018-05-28 13:48:33 +02:00
parent 18fd0cbc80
commit 9717a11942

View File

@ -348,6 +348,7 @@ int main(int argc, char *argv[])
//SetConfigFlags(FLAG_WINDOW_RESIZABLE); //SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(screenWidth, screenHeight, "rGuiStyler v2.0 - raygui style editor"); InitWindow(screenWidth, screenHeight, "rGuiStyler v2.0 - raygui style editor");
SetExitKey(0);
int dropsCount = 0; int dropsCount = 0;
char **droppedFiles; char **droppedFiles;
@ -384,9 +385,6 @@ int main(int argc, char *argv[])
// Keep a backup for style // Keep a backup for style
memcpy(styleBackup, style, NUM_PROPERTIES*sizeof(int)); memcpy(styleBackup, style, NUM_PROPERTIES*sizeof(int));
SetTargetFPS(60);
//------------------------------------------------------------
// Gui controls data // Gui controls data
//----------------------------------------------------------- //-----------------------------------------------------------
bool toggle = false; bool toggle = false;
@ -435,9 +433,9 @@ int main(int argc, char *argv[])
// Exit variables // Exit variables
bool exitWindow = false; bool exitWindow = false;
bool closingWindowActive = false; bool closingWindowActive = false;
SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //------------------------------------------------------------
// Main game loop // Main game loop
while (!exitWindow) // Detect window close button or ESC key while (!exitWindow) // Detect window close button or ESC key
@ -446,14 +444,14 @@ int main(int argc, char *argv[])
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
framesCounter++; framesCounter++;
// Check for changed controls if (WindowShouldClose()) exitWindow = true;
// Check for changed controls
if ((framesCounter%120) == 0) if ((framesCounter%120) == 0)
{ {
changedControlsCounter = 0; changedControlsCounter = 0;
for (int i = 0; i < NUM_PROPERTIES; i++) if (styleBackup[i] != style[i]) changedControlsCounter++; for (int i = 0; i < NUM_PROPERTIES; i++) if (styleBackup[i] != style[i]) changedControlsCounter++;
} }
if (WindowShouldClose()) exitWindow = true;
// Show save layout message window on ESC // Show save layout message window on ESC
if (IsKeyPressed(KEY_ESCAPE)) if (IsKeyPressed(KEY_ESCAPE))
@ -600,7 +598,7 @@ int main(int argc, char *argv[])
if (checked) GuiDisable(); if (checked) GuiDisable();
GuiLabel((Rectangle){ anchor02.x + 11, anchor02.y + 35, 80, 30 }, "rGuiStyler"); GuiLabel((Rectangle){ anchor02.x + 11, anchor02.y + 35, 80, 25 }, "rGuiStyler");
if (GuiLabelButton(bounds[LABELBUTTON], "github.com/raysan5/raygui")) {} if (GuiLabelButton(bounds[LABELBUTTON], "github.com/raysan5/raygui")) {}
@ -622,7 +620,7 @@ int main(int argc, char *argv[])
progressValue = GuiProgressBarEx(bounds[PROGRESSBAR], progressValue, 0, 1, true); progressValue = GuiProgressBarEx(bounds[PROGRESSBAR], progressValue, 0, 1, true);
spinnerValue = GuiSpinner(bounds[SPINNER], spinnerValue, 32, 35); spinnerValue = GuiSpinner(bounds[SPINNER], spinnerValue, 32, 24);
comboActive = GuiComboBox(bounds[COMBOBOX], comboText, comboNum, comboActive); comboActive = GuiComboBox(bounds[COMBOBOX], comboText, comboNum, comboActive);
@ -728,8 +726,10 @@ static void BtnSaveStyle(const char *defaultName, bool binary)
if (fileName != NULL) if (fileName != NULL)
{ {
if (GetExtension(fileName) == NULL) strcat(fileName, ".rgs\0"); // No extension provided char outFileName[64] = { 0 };
if (fileName != NULL) SaveStyleRGS(fileName, binary); // Save style file (text or binary) strcpy(outFileName, fileName);
if (GetExtension(outFileName) == NULL) strcat(outFileName, ".rgs\0"); // No extension provided
if (outFileName != NULL) SaveStyleRGS(outFileName, binary); // Save style file (text or binary)
cancelSave = true; cancelSave = true;
} }
} }