Skip to content

Commit 7d021ae

Browse files
Evan ComtesseEvan Comtesse
authored andcommitted
feat: added changed tickbox state highlight
1 parent 867cd42 commit 7d021ae

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/RayGUI.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,18 @@ internal static void DrawTextbox(Textbox t, int id)
136136
/// <param name="t">Tickbox to draw.</param>
137137
internal static void DrawTickbox(Tickbox t)
138138
{
139+
DrawRectangleRoundedLines(t.Rectangle, t.Roundness, ROUND_SEGMENTS, t.BorderColor);
139140
if (Hover(t))
140141
{
141142
DrawRectangleRounded(t.Rectangle, t.Roundness, ROUND_SEGMENTS, t.BorderColor);
142143
}
143144
else
144145
{
145146
DrawRectangleRounded(t.Rectangle, t.Roundness, ROUND_SEGMENTS, t.BaseColor);
146-
if (!t.Ticked)
147-
{
148-
DrawRectangleRounded(t.Rectangle, t.Roundness, ROUND_SEGMENTS, t.BaseColor);
149-
}
150-
else if (t.Ticked)
151-
{
152-
DrawRectangleRounded(t.Rectangle, t.Roundness, ROUND_SEGMENTS, t.BorderColor);
153-
}
147+
}
148+
if (t.Ticked)
149+
{
150+
DrawTextPro(Font, "x", t.Position + new Vector2(4, 0), Vector2.Zero, 0, 14, 1, Color.White);
154151
}
155152
}
156153

src/code/components/Component.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Raylib_cs;
1+
using System.Numerics;
2+
using Raylib_cs;
23

34
namespace RayGUI_cs
45
{
@@ -34,6 +35,12 @@ public abstract class Component
3435
/// <summary>Height of the component</summary>
3536
public int Height { get { return (int)Rectangle.Height; } set { Rectangle.Height = Math.Abs(value); } }
3637

38+
/// <summary>Position of the component expressed as a <see cref="Vector2"/>.</summary>
39+
public Vector2 Position { get { return Rectangle.Position; } }
40+
41+
/// <summary>Size of the component expressed as a <see cref="Vector2"/>.</summary>
42+
public Vector2 Size { get { return Rectangle.Size; } }
43+
3744
/// <summary>Defines the roundness of the component's render rectangle.</summary>
3845
public float Roundness { get { return _roundness; } set { _roundness = value; } }
3946

0 commit comments

Comments
 (0)