further changes, lazy loading, new modular backend system

This commit is contained in:
Booklordofthedings 2024-10-06 22:23:40 +02:00
parent c0e0c30eb8
commit c0dd04127c
68 changed files with 735 additions and 2865 deletions

View file

@ -1,5 +1,5 @@
FileVersion = 1
Dependencies = {corlib = "*", TheaterGui = "*"}
Dependencies = {corlib = "*", TheaterGui = "*", raylib-backend = "*"}
[Project]
Name = "examples"

View file

@ -1,15 +0,0 @@
namespace examples;
using TheaterGui.Components;
class Box : Container
{
public this() : base("Box")
{
//Add ui items here via AddChild() and terminate the row via EndRow()
Margin = 5;
AddChild(new Checkb());
AddChild(new Radios());
}
}

View file

@ -1,45 +0,0 @@
namespace examples;
using TheaterGui.Components;
class StandartButton : Button
{
public this() : base("Basic Button")
{
Margin = 5;
}
//What happens when the button is clicked
public override void ClickAction()
{
}
}
class LButton : LargeButton
{
public this() : base("Large Button")
{
Margin = 5;
}
//What happens when the button is clicked
public override void ClickAction()
{
}
}
class CButton : NButton
{
public this() : base(400, 50, "Custom sized button")
{
Margin = 5;
}
//What happens when the button is clicked
public override void ClickAction()
{
}
}

View file

@ -1,18 +0,0 @@
namespace examples;
using TheaterGui.Components;
class Checkb : Checkbox
{
public this() : base("Check me!")
{
Checked = true;
Description = "Beef is awesome";
}
//What happens when the button is clicked
public override void OnCheck(bool checkValue)
{
}
}

View file

@ -1,37 +0,0 @@
namespace examples;
using TheaterGui.Components;
class ExampleToolbar : Toolbar
{
public this() : base("Toolbar")
{
AddToolbarCategories(
new .("Help",
new .("Version", new => PrintVersion)
),
new .("About",
new .("TheaterGui", new => PrintAbout),
new .("Booklordofthedings", new => PrintAbout)
)
);
}
public void PrintVersion()
{
#if !BF_PLATFORM_WASM
System.Console.WriteLine("1.0");
#endif
}
public void PrintAbout()
{
#if !BF_PLATFORM_WASM
System.Console.WriteLine("""
TheaterGui by Booklordofthedings
A simple easy to use gui library for tools
""");
#endif
}
}

View file

@ -1,25 +0,0 @@
namespace examples;
using TheaterGui.Components;
class HorSlider : HSlider
{
public this() : base("HorSlider")
{
//Use the thing above to set the length of the bar
Min = 0;
Max = 100;
Value = 50;
ReactToValueChange = true; //This indicates wether OnValueChange gets actually called
Description = "A default horizontal slider";
MarginTop = 50;
}
public override void OnValueChange(float newVal)
{
#if !BF_PLATFORM_WASM
System.Console.WriteLine(Value);
#endif
}
}

View file

@ -1,48 +0,0 @@
namespace examples;
using TheaterGui.Components;
class MainScreen : Screen
{
public this() : base("MainScreen")
{
//Add ui items here via AddChild() and terminate the row via EndRow()
AddChild(new ExampleToolbar());
AddChild(new Label("Changing the width allows you to see these buttons reordered"));
EndRow();
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
AddChild(new OpenButton());
EndRow();
AddChild(new StandartButton());
AddChild(new LButton());
AddChild(new CButton());
EndRow();
AddChild(new HorSlider());
AddChild(new VertSlider());
EndRow();
AddChild(new Box());
AddChild(new Box());
}
}

View file

@ -1,21 +0,0 @@
namespace examples;
using TheaterGui.Components;
class OpenButton : IconButton
{
public this() : base("OpenButton")
{
Icon = .Icon_Folder; //Use this to set the icon sprite
Margin = 5;
MarginTop = 40;
MarginBottom = 40;
Description = "Open a file dialogue";
}
//What happens when the button is clicked
public override void ClickAction()
{
}
}

View file

@ -1,11 +1,34 @@
namespace examples;
using TheaterGui;
using TheaterGui.Core;
using TheaterGui.Components;
class Program
{
public static void Main()
{
App.Run<MainScreen>("Example Gui",1920,1080);
scope App()
..SetName("TheaterGui Application")
..SetStartingSize(1280, 720)
..SetPlatformLayer(new raylib_backend.PlatformRaylib())
.Run(new MainScreen());
}
}
}
class MainScreen : Container
{
public this()
{
AddChild("Main Button", new Button());
AddChild("Other Button", new Button());
Layout = new (val, width) =>
{
val.Component("Main Button", 5);
val.Component("Other Button", 10);
};
}
}

View file

@ -1,19 +0,0 @@
namespace examples;
using TheaterGui.Components;
class Radios : RadioButton
{
public this() : base("Radios")
{
Description = "";
//Use SetBoxes(int, params StringView) to set the elements of the radio buttons
SetBoxes(3, "Windows", "Linux", "Mac", "Web");
}
//React to the check event, or use the Checked field to get the value directly
public override void OnCheck(int32 value)
{
}
}

View file

@ -1,20 +0,0 @@
namespace examples;
using TheaterGui.Components;
class VertSlider : VSlider
{
public this() : base("VertSlider")
{
//Use the thing above to set the length of the bar
Min = 0;
Max = 100;
Value = 50;
ReactToValueChange = true; //This indicates wether OnValueChange gets actually called
}
public override void OnValueChange(float newVal)
{
}
}