Watch
2
0
Fork
You've already forked raylib-cs
0

chore: clean up linter warnings

This commit is contained in:
tiger tiger tiger 2026-07-29 19:58:47 +02:00
commit dfc34997bc
No known key found for this signature in database
217 changed files with 1863 additions and 1077 deletions

View file

@ -15,8 +15,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shapes;
public partial class DrawRectangleRounded : IExample
@ -119,27 +117,51 @@ public partial class DrawRectangleRounded : IExample
if (hover && IsMouseButtonDown(MouseButton.Left))
{
value = minValue + ((mouse.X - bounds.X) / bounds.Width) * (maxValue - minValue);
if (value < minValue) value = minValue;
if (value > maxValue) value = maxValue;
if (value < minValue)
{
value = minValue;
}
if (value > maxValue)
{
value = maxValue;
}
}
DrawRectangleRec(bounds, Color.LightGray);
float pct = (value - minValue) / (maxValue - minValue);
DrawRectangleRec(new Rectangle(bounds.X, bounds.Y, bounds.Width * pct, bounds.Height), Color.SkyBlue);
DrawRectangleLinesEx(bounds, 1, Color.Gray);
if (!string.IsNullOrEmpty(textLeft)) DrawText(textLeft, (int)bounds.X - MeasureText(textLeft, 10) - 5, (int)(bounds.Y + bounds.Height / 2 - 5), 10, Color.DarkGray);
if (!string.IsNullOrEmpty(textRight)) DrawText(textRight, (int)(bounds.X + bounds.Width + 5), (int)(bounds.Y + bounds.Height / 2 - 5), 10, Color.DarkGray);
if (!string.IsNullOrEmpty(textLeft))
{
DrawText(textLeft, (int)bounds.X - MeasureText(textLeft, 10) - 5, (int)(bounds.Y + bounds.Height / 2 - 5), 10, Color.DarkGray);
}
if (!string.IsNullOrEmpty(textRight))
{
DrawText(textRight, (int)(bounds.X + bounds.Width + 5), (int)(bounds.Y + bounds.Height / 2 - 5), 10, Color.DarkGray);
}
}
private static void GuiCheckBox(Rectangle bounds, string text, ref bool active)
{
Vector2 mouse = GetMousePosition();
bool hover = CheckCollisionPointRec(mouse, bounds);
if (hover && IsMouseButtonPressed(MouseButton.Left)) active = !active;
if (hover && IsMouseButtonPressed(MouseButton.Left))
{
active = !active;
}
DrawRectangleLinesEx(bounds, 1, hover ? Color.DarkBlue : Color.Gray);
if (active) DrawRectangle((int)bounds.X + 4, (int)bounds.Y + 4, (int)bounds.Width - 8, (int)bounds.Height - 8, Color.DarkGray);
if (text != null) DrawText(text, (int)(bounds.X + bounds.Width + 8), (int)(bounds.Y + bounds.Height / 2 - 5), 10, Color.DarkGray);
if (active)
{
DrawRectangle((int)bounds.X + 4, (int)bounds.Y + 4, (int)bounds.Width - 8, (int)bounds.Height - 8, Color.DarkGray);
}
if (text != null)
{
DrawText(text, (int)(bounds.X + bounds.Width + 8), (int)(bounds.Y + bounds.Height / 2 - 5), 10, Color.DarkGray);
}
}
public static int Main()