Fix compilation error and remove warnings from examples (#380)

This commit is contained in:
aiafrasinei
2024-02-29 12:45:31 +02:00
committed by GitHub
parent bc67f42209
commit b3fea57382
5 changed files with 9 additions and 29 deletions

View File

@ -256,12 +256,12 @@ int main()
GuiLabel((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width, fontSize }, "Position");
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
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];
@ -277,7 +277,7 @@ int main()
}
// 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];
@ -303,12 +303,12 @@ int main()
GuiLabel((Rectangle){ contentRect.x, contentRect.y + contentRect.height + scrollOffset.y, contentRect.width, fontSize }, "Tangents");
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
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];
@ -323,7 +323,7 @@ int main()
}
// 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];

View File

@ -256,7 +256,6 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
{
// editRightTangent == true implies selectedIndex != -1
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};
// Calculate right tangent slope
@ -275,7 +274,6 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
{
// editLeftTangent == true implies selectedIndex != -1
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 };
// Calculate left tangent slope
@ -294,7 +292,6 @@ void GuiCurveEditor(GuiCurveEditorState *state, Rectangle bounds)
{
state->selectedIndex = hoveredPointIndex;
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 };
}
// 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 };
Color controlColor = { 0 };
Color controlBorderColor = { 0 };
if (state->editLeftTangent)
{
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_PRESSED));
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
}
else if (CheckCollisionPointRec(mouse, controlRect))
{
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_FOCUSED));
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
}
else
{
controlColor = GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL));
controlBorderColor = GetColor(GuiGetStyle(BUTTON, BORDER_COLOR_NORMAL));
}
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 };
Color controlColor = { 0 };
Color controlBorderColor = { 0 };
if (state->editRightTangent)
{
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_PRESSED));
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
}
else if (CheckCollisionPointRec(mouse, controlRect))
{
controlColor = GetColor(GuiGetStyle(DEFAULT, BASE_COLOR_FOCUSED));
controlBorderColor = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_NORMAL));
}
else
{
controlColor = GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL));
controlBorderColor = GetColor(GuiGetStyle(BUTTON, BORDER_COLOR_NORMAL));
}
DrawLine(screenPos.x,screenPos.y, control.x, control.y, controlColor);