mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Fix compilation error and remove warnings from examples (#380)
This commit is contained in:
@ -256,12 +256,12 @@ int main()
|
|||||||
GuiLabel((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width, fontSize }, "Position");
|
GuiLabel((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width, fontSize }, "Position");
|
||||||
contentRect.height += fontSize;
|
contentRect.height += fontSize;
|
||||||
|
|
||||||
if (!editValueBox[i][0]) gcvt(p->position.x, 6, valTextBox[i][0]); // Transform x position to string
|
if (!editValueBox[i][0]) gcvt(p->position.x, 6, (char *)valTextBox[i][0]); // Transform x position to string
|
||||||
|
|
||||||
if (!editValueBox[i][1]) gcvt(curves[i].start + (curves[i].end-curves[i].start)*p->position.y, 6, valTextBox[i][1]); // Transform y position to string
|
if (!editValueBox[i][1]) gcvt(curves[i].start + (curves[i].end-curves[i].start)*p->position.y, 6, (char *)valTextBox[i][1]); // Transform y position to string
|
||||||
|
|
||||||
// X pos
|
// X pos
|
||||||
if (GuiTextBox((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2-margin, 1.5f*fontSize }, valTextBox[i][0], 20, editValueBox[i][0]))
|
if (GuiTextBox((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2-margin, 1.5f*fontSize }, (char *)valTextBox[i][0], 20, editValueBox[i][0]))
|
||||||
{
|
{
|
||||||
editValueBox[i][0] = !editValueBox[i][0];
|
editValueBox[i][0] = !editValueBox[i][0];
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Y pos
|
// Y pos
|
||||||
if (GuiTextBox((Rectangle){ contentRect.x + contentRect.width/2, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2.0f, 1.5f*fontSize }, valTextBox[i][1], 20, editValueBox[i][1]))
|
if (GuiTextBox((Rectangle){ contentRect.x + contentRect.width/2, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2.0f, 1.5f*fontSize }, (char *)valTextBox[i][1], 20, editValueBox[i][1]))
|
||||||
{
|
{
|
||||||
editValueBox[i][1] = !editValueBox[i][1];
|
editValueBox[i][1] = !editValueBox[i][1];
|
||||||
|
|
||||||
@ -303,12 +303,12 @@ int main()
|
|||||||
GuiLabel((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width, fontSize }, "Tangents");
|
GuiLabel((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width, fontSize }, "Tangents");
|
||||||
contentRect.height += fontSize;
|
contentRect.height += fontSize;
|
||||||
|
|
||||||
if (!editValueBox[i][2]) gcvt(p->tangents.x, 6, valTextBox[i][2]); // Transform left tangent to string
|
if (!editValueBox[i][2]) gcvt(p->tangents.x, 6, (char *)valTextBox[i][2]); // Transform left tangent to string
|
||||||
|
|
||||||
if (!editValueBox[i][3]) gcvt(p->tangents.y, 6, valTextBox[i][3]); // Transform right tangent to string
|
if (!editValueBox[i][3]) gcvt(p->tangents.y, 6, (char *)valTextBox[i][3]); // Transform right tangent to string
|
||||||
|
|
||||||
// Left tan
|
// Left tan
|
||||||
if (GuiTextBox((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2 - margin, 1.5f*fontSize }, valTextBox[i][2], 20, editValueBox[i][2]))
|
if (GuiTextBox((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2 - margin, 1.5f*fontSize }, (char *)valTextBox[i][2], 20, editValueBox[i][2]))
|
||||||
{
|
{
|
||||||
editValueBox[i][2] = !editValueBox[i][2];
|
editValueBox[i][2] = !editValueBox[i][2];
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Right tan
|
// Right tan
|
||||||
if (GuiTextBox((Rectangle){ contentRect.x + contentRect.width/2.0f, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2.0f, 1.5f*fontSize }, valTextBox[i][3], 20, editValueBox[i][3]))
|
if (GuiTextBox((Rectangle){ contentRect.x + contentRect.width/2.0f, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width/2.0f, 1.5f*fontSize }, (char *)valTextBox[i][3], 20, editValueBox[i][3]))
|
||||||
{
|
{
|
||||||
editValueBox[i][3] = !editValueBox[i][3];
|
editValueBox[i][3] = !editValueBox[i][3];
|
||||||
|
|
||||||
|
|||||||
@ -256,7 +256,6 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
|
|||||||
{
|
{
|
||||||
// editRightTangent == true implies selectedIndex != -1
|
// editRightTangent == true implies selectedIndex != -1
|
||||||
GuiCurveEditorPoint *p = &state->points[state->selectedIndex];
|
GuiCurveEditorPoint *p = &state->points[state->selectedIndex];
|
||||||
const Vector2 screenPos = (Vector2){ p->position.x*innerBounds.width + innerBounds.x, innerBounds.y + innerBounds.height-p->position.y*innerBounds.height };
|
|
||||||
const Vector2 dir = (Vector2){ mouseLocal.x - p->position.x, mouseLocal.y - p->position.y};
|
const Vector2 dir = (Vector2){ mouseLocal.x - p->position.x, mouseLocal.y - p->position.y};
|
||||||
|
|
||||||
// Calculate right tangent slope
|
// Calculate right tangent slope
|
||||||
@ -275,7 +274,6 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
|
|||||||
{
|
{
|
||||||
// editLeftTangent == true implies selectedIndex != -1
|
// editLeftTangent == true implies selectedIndex != -1
|
||||||
GuiCurveEditorPoint *p = &state->points[state->selectedIndex];
|
GuiCurveEditorPoint *p = &state->points[state->selectedIndex];
|
||||||
const Vector2 screenPos = (Vector2){ p->position.x*innerBounds.width + innerBounds.x, innerBounds.y + innerBounds.height-p->position.y*innerBounds.height };
|
|
||||||
const Vector2 dir = (Vector2){ mouseLocal.x - p->position.x, mouseLocal.y - p->position.y };
|
const Vector2 dir = (Vector2){ mouseLocal.x - p->position.x, mouseLocal.y - p->position.y };
|
||||||
|
|
||||||
// Calculate left tangent slope
|
// Calculate left tangent slope
|
||||||
@ -294,7 +292,6 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
|
|||||||
{
|
{
|
||||||
state->selectedIndex = hoveredPointIndex;
|
state->selectedIndex = hoveredPointIndex;
|
||||||
const GuiCurveEditorPoint *p = &state->points[state->selectedIndex];
|
const GuiCurveEditorPoint *p = &state->points[state->selectedIndex];
|
||||||
const Vector2 screenPos = (Vector2){ p->position.x*innerBounds.width + innerBounds.x, innerBounds.y + innerBounds.height - p->position.y*innerBounds.height };
|
|
||||||
state->mouseOffset = (Vector2){ p->position.x - mouseLocal.x, p->position.y - mouseLocal.y };
|
state->mouseOffset = (Vector2){ p->position.x - mouseLocal.x, p->position.y - mouseLocal.y };
|
||||||
}
|
}
|
||||||
// Remove a point (check against bounds)
|
// Remove a point (check against bounds)
|
||||||
@ -430,22 +427,18 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
|
|||||||
const Rectangle controlRect = (Rectangle){ control.x - handleSize/2.0f, control.y - handleSize/2.0f, handleSize, handleSize };
|
const Rectangle controlRect = (Rectangle){ control.x - handleSize/2.0f, control.y - handleSize/2.0f, handleSize, handleSize };
|
||||||
|
|
||||||
Color controlColor = { 0 };
|
Color controlColor = { 0 };
|
||||||
Color controlBorderColor = { 0 };
|
|
||||||
|
|
||||||
if (state->editLeftTangent)
|
if (state->editLeftTangent)
|
||||||
{
|
{
|
||||||
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_PRESSED));
|
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_PRESSED));
|
||||||
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
|
|
||||||
}
|
}
|
||||||
else if (CheckCollisionPointRec(mouse, controlRect))
|
else if (CheckCollisionPointRec(mouse, controlRect))
|
||||||
{
|
{
|
||||||
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_FOCUSED));
|
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_FOCUSED));
|
||||||
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
controlColor = GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL));
|
controlColor = GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL));
|
||||||
controlBorderColor = GetColor(GuiGetStyle(BUTTON, BORDER_COLOR_NORMAL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawLine(screenPos.x,screenPos.y, control.x, control.y, controlColor);
|
DrawLine(screenPos.x,screenPos.y, control.x, control.y, controlColor);
|
||||||
@ -463,22 +456,18 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
|
|||||||
const Rectangle controlRect = (Rectangle){ control.x - handleSize/2.0f, control.y - handleSize/2.0f, handleSize, handleSize };
|
const Rectangle controlRect = (Rectangle){ control.x - handleSize/2.0f, control.y - handleSize/2.0f, handleSize, handleSize };
|
||||||
|
|
||||||
Color controlColor = { 0 };
|
Color controlColor = { 0 };
|
||||||
Color controlBorderColor = { 0 };
|
|
||||||
|
|
||||||
if (state->editRightTangent)
|
if (state->editRightTangent)
|
||||||
{
|
{
|
||||||
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_PRESSED));
|
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_PRESSED));
|
||||||
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
|
|
||||||
}
|
}
|
||||||
else if (CheckCollisionPointRec(mouse, controlRect))
|
else if (CheckCollisionPointRec(mouse, controlRect))
|
||||||
{
|
{
|
||||||
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_FOCUSED));
|
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_FOCUSED));
|
||||||
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
controlColor = GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL));
|
controlColor = GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL));
|
||||||
controlBorderColor = GetColor(GuiGetStyle(BUTTON, BORDER_COLOR_NORMAL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawLine(screenPos.x,screenPos.y, control.x, control.y, controlColor);
|
DrawLine(screenPos.x,screenPos.y, control.x, control.y, controlColor);
|
||||||
|
|||||||
@ -93,8 +93,6 @@ int main()
|
|||||||
int listViewExFocus = -1;
|
int listViewExFocus = -1;
|
||||||
const char *listViewExList[8] = { "This", "is", "a", "list view", "with", "disable", "elements", "amazing!" };
|
const char *listViewExList[8] = { "This", "is", "a", "list view", "with", "disable", "elements", "amazing!" };
|
||||||
|
|
||||||
char multiTextBoxText[256] = "Multi text box";
|
|
||||||
bool multiTextBoxEditMode = false;
|
|
||||||
Color colorPickerValue = RED;
|
Color colorPickerValue = RED;
|
||||||
|
|
||||||
float sliderValue = 50.0f;
|
float sliderValue = 50.0f;
|
||||||
|
|||||||
@ -106,7 +106,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging)
|
if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
|
|||||||
@ -59,11 +59,6 @@ int main()
|
|||||||
bool exitWindow = false;
|
bool exitWindow = false;
|
||||||
bool showMessageBox = false;
|
bool showMessageBox = false;
|
||||||
|
|
||||||
char textInput[256] = { 0 };
|
|
||||||
bool showTextInputBox = false;
|
|
||||||
|
|
||||||
char textInputFileName[256] = { 0 };
|
|
||||||
|
|
||||||
// Load default style
|
// Load default style
|
||||||
GuiLoadStyleBluish();
|
GuiLoadStyleBluish();
|
||||||
int visualStyleActive = 4;
|
int visualStyleActive = 4;
|
||||||
@ -81,8 +76,6 @@ int main()
|
|||||||
|
|
||||||
if (IsKeyPressed(KEY_ESCAPE)) showMessageBox = !showMessageBox;
|
if (IsKeyPressed(KEY_ESCAPE)) showMessageBox = !showMessageBox;
|
||||||
|
|
||||||
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_S)) showTextInputBox = true;
|
|
||||||
|
|
||||||
if (IsFileDropped())
|
if (IsFileDropped())
|
||||||
{
|
{
|
||||||
FilePathList droppedFiles = LoadDroppedFiles();
|
FilePathList droppedFiles = LoadDroppedFiles();
|
||||||
|
|||||||
Reference in New Issue
Block a user