mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-05 15:56:32 +02:00
Add Panel, ProgressBar, RadioButton, and Slider UI controls and test windows
This commit is contained in:
+89
-15
@@ -3,6 +3,8 @@ using RemSox.UI.GUI.Rendering;
|
||||
using RemSox.UI.GUI.UIEelements.Controls;
|
||||
using RemSox.UI.GUI.Windows;
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace RemSox.Processes;
|
||||
|
||||
internal class DesktopProcess() : Process("Desktop Manager")
|
||||
@@ -17,31 +19,30 @@ internal class DesktopProcess() : Process("Desktop Manager")
|
||||
isGraphicsInitialized = true;
|
||||
}
|
||||
|
||||
// Force existing windows to redraw onto the new canvas renderer
|
||||
WindowManager.InvalidateAll();
|
||||
|
||||
// Create a test window for new UI controls
|
||||
Window testWindow = WindowManager.CreateWindow(this, "UI Controls Test", new System.Drawing.Size(200, 180));
|
||||
// Test window 1: interactive controls
|
||||
Window testWindow = WindowManager.CreateWindow(this, "UI Controls", new Size(280, 260));
|
||||
testWindow.AutoFlush = true;
|
||||
|
||||
Button button = testWindow.CreateUIElement<UI.GUI.UIEelements.Controls.Button>(b =>
|
||||
Button button = testWindow.CreateUIElement<Button>(b =>
|
||||
{
|
||||
b.Position = new System.Drawing.Point(20, 30);
|
||||
b.Size = new System.Drawing.Size(200, 30);
|
||||
b.Position = new Point(20, 30);
|
||||
b.Size = new Size(240, 25);
|
||||
b.Text = "Click Me";
|
||||
b.BackgroundColor = System.Drawing.Color.LightBlue;
|
||||
b.BackgroundColor = Color.LightBlue;
|
||||
});
|
||||
|
||||
button.OnClick += (s, e) =>
|
||||
{
|
||||
button.Text = "Clicked!";
|
||||
button.BackgroundColor = System.Drawing.Color.LightGreen;
|
||||
button.BackgroundColor = Color.LightGreen;
|
||||
};
|
||||
|
||||
CheckBox check = testWindow.CreateUIElement<UI.GUI.UIEelements.Controls.CheckBox>(c =>
|
||||
CheckBox check = testWindow.CreateUIElement<CheckBox>(c =>
|
||||
{
|
||||
c.Position = new System.Drawing.Point(20, 80);
|
||||
c.Size = new System.Drawing.Size(200, 30);
|
||||
c.Position = new Point(20, 65);
|
||||
c.Size = new Size(240, 20);
|
||||
c.Text = "Check Me";
|
||||
c.IsChecked = true;
|
||||
});
|
||||
@@ -51,12 +52,85 @@ internal class DesktopProcess() : Process("Desktop Manager")
|
||||
check.Text = check.IsChecked ? "Checked!" : "Unchecked!";
|
||||
};
|
||||
|
||||
_ = testWindow.CreateUIElement<UI.GUI.UIEelements.Shapes.Line>(l =>
|
||||
RadioButton radio = testWindow.CreateUIElement<RadioButton>(r =>
|
||||
{
|
||||
l.Position = new System.Drawing.Point(20, 130);
|
||||
l.EndPosition = new System.Drawing.Point(180, 130);
|
||||
l.Color = System.Drawing.Color.Red;
|
||||
r.Position = new Point(20, 95);
|
||||
r.Size = new Size(240, 20);
|
||||
r.Text = "Radio Option";
|
||||
r.IsChecked = true;
|
||||
});
|
||||
|
||||
Slider slider = testWindow.CreateUIElement<Slider>(s =>
|
||||
{
|
||||
s.Position = new Point(20, 130);
|
||||
s.Size = new Size(240, 24);
|
||||
s.BackgroundColor = Color.SteelBlue;
|
||||
s.Value = 60;
|
||||
});
|
||||
|
||||
ProgressBar progress = testWindow.CreateUIElement<ProgressBar>(p =>
|
||||
{
|
||||
p.Position = new Point(20, 170);
|
||||
p.Size = new Size(240, 20);
|
||||
p.BackgroundColor = Color.DimGray;
|
||||
p.FillColor = Color.LimeGreen;
|
||||
p.Value = 60;
|
||||
});
|
||||
|
||||
slider.OnValueChanged += (_, _) =>
|
||||
{
|
||||
progress.Value = slider.Value;
|
||||
};
|
||||
|
||||
// Test window 2: shapes and panel
|
||||
Window shapesWin = WindowManager.CreateWindow(this, "Shapes & Panel", new Size(200, 220));
|
||||
shapesWin.AutoFlush = true;
|
||||
|
||||
_ = shapesWin.CreateUIElement<Panel>(p =>
|
||||
{
|
||||
p.Position = new Point(10, 25);
|
||||
p.Size = new Size(180, 80);
|
||||
p.BackgroundColor = Color.FromArgb(48, 48, 48);
|
||||
});
|
||||
|
||||
_ = shapesWin.CreateUIElement<UI.GUI.UIEelements.Shapes.Circle>(c =>
|
||||
{
|
||||
c.Position = new Point(20, 35);
|
||||
c.Radius = 10;
|
||||
c.Color = Color.Coral;
|
||||
});
|
||||
|
||||
_ = shapesWin.CreateUIElement<UI.GUI.UIEelements.Shapes.Rectangle>(r =>
|
||||
{
|
||||
r.Position = new Point(60, 35);
|
||||
r.Size = new Size(50, 30);
|
||||
r.Color = Color.CornflowerBlue;
|
||||
r.IsFilled = true;
|
||||
});
|
||||
|
||||
_ = shapesWin.CreateUIElement<UI.GUI.UIEelements.Shapes.Text>(t =>
|
||||
{
|
||||
t.Position = new Point(10, 120);
|
||||
t.Content = "Hello from the desktop!";
|
||||
t.Color = Color.White;
|
||||
t.FontSize = 14;
|
||||
});
|
||||
|
||||
_ = shapesWin.CreateUIElement<UI.GUI.UIEelements.Shapes.Line>(l =>
|
||||
{
|
||||
l.Position = new Point(10, 150);
|
||||
l.EndPosition = new Point(180, 180);
|
||||
l.Color = Color.Orange;
|
||||
});
|
||||
|
||||
CheckBox shapesCheck = shapesWin.CreateUIElement<CheckBox>(c =>
|
||||
{
|
||||
c.Position = new Point(10, 185);
|
||||
c.Size = new Size(180, 20);
|
||||
c.Text = "Toggle";
|
||||
});
|
||||
|
||||
shapesCheck.OnCheckedChanged += (_, _) => { };
|
||||
}
|
||||
|
||||
internal override void Tick()
|
||||
|
||||
Reference in New Issue
Block a user