diff --git a/ExampleGui.png b/ExampleGui.png deleted file mode 100644 index b4f39c6..0000000 Binary files a/ExampleGui.png and /dev/null differ diff --git a/README.md b/README.md index 512905a..71a5b05 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ __Visit the wiki tab to get information on how to get started or on how this library works internally__ -![Image](/docs/ExampleGui.png) \ No newline at end of file +![Image](/example.png) \ No newline at end of file diff --git a/example.png b/example.png new file mode 100644 index 0000000..371c242 Binary files /dev/null and b/example.png differ diff --git a/examples/src/Box.bf b/examples/src/Box.bf new file mode 100644 index 0000000..e9e4331 --- /dev/null +++ b/examples/src/Box.bf @@ -0,0 +1,15 @@ +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()); + } +} \ No newline at end of file diff --git a/examples/src/Buttons.bf b/examples/src/Buttons.bf new file mode 100644 index 0000000..396a91f --- /dev/null +++ b/examples/src/Buttons.bf @@ -0,0 +1,45 @@ +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() + { + + } +} \ No newline at end of file diff --git a/examples/src/Checkb.bf b/examples/src/Checkb.bf new file mode 100644 index 0000000..075de89 --- /dev/null +++ b/examples/src/Checkb.bf @@ -0,0 +1,18 @@ +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) + { + + } +} \ No newline at end of file diff --git a/examples/src/ExampleToolbar.bf b/examples/src/ExampleToolbar.bf new file mode 100644 index 0000000..f16f77f --- /dev/null +++ b/examples/src/ExampleToolbar.bf @@ -0,0 +1,33 @@ +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() + { + System.Console.WriteLine("1.0"); + } + + public void PrintAbout() + { + System.Console.WriteLine(""" + TheaterGui by Booklordofthedings + A simple easy to use gui library for tools + """); + } +} \ No newline at end of file diff --git a/examples/src/HorSlider.bf b/examples/src/HorSlider.bf new file mode 100644 index 0000000..29465fc --- /dev/null +++ b/examples/src/HorSlider.bf @@ -0,0 +1,23 @@ +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) + { + System.Console.WriteLine(Value); + } +} \ No newline at end of file diff --git a/examples/src/MainScreen.bf b/examples/src/MainScreen.bf index 6bcfcb7..fd4d5e0 100644 --- a/examples/src/MainScreen.bf +++ b/examples/src/MainScreen.bf @@ -7,6 +7,42 @@ class MainScreen : Screen public this() : base("MainScreen") { //Add ui items here via AddChild() and terminate the row via EndRow() - //The padding object can be used to add padding to every ui object + 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()); } } \ No newline at end of file diff --git a/examples/src/OpenButton.bf b/examples/src/OpenButton.bf new file mode 100644 index 0000000..a0dad75 --- /dev/null +++ b/examples/src/OpenButton.bf @@ -0,0 +1,21 @@ +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() + { + + } +} \ No newline at end of file diff --git a/examples/src/Radios.bf b/examples/src/Radios.bf new file mode 100644 index 0000000..501c580 --- /dev/null +++ b/examples/src/Radios.bf @@ -0,0 +1,19 @@ +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) + { + } +} \ No newline at end of file diff --git a/examples/src/VertSlider.bf b/examples/src/VertSlider.bf new file mode 100644 index 0000000..fd2eb66 --- /dev/null +++ b/examples/src/VertSlider.bf @@ -0,0 +1,20 @@ +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) + { + + } +} \ No newline at end of file diff --git a/src/Generators/ButtonGenerator.bf b/src/Generators/ButtonGenerator.bf index 016aff4..a4e7541 100644 --- a/src/Generators/ButtonGenerator.bf +++ b/src/Generators/ButtonGenerator.bf @@ -4,7 +4,7 @@ using System; class ButtonGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Button" + public override String Name => "TheaterGui -> Button" public override void InitUI() { @@ -22,14 +22,14 @@ class ButtonGenerator : Compiler.Generator var enabled = bool.Parse(mParams["enabled"]); var description = mParams["description"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : Button + class {name} : Button {{ public this() : base("{name}") {{ diff --git a/src/Generators/CheckboxGenerator.bf b/src/Generators/CheckboxGenerator.bf index 4d44a86..92c173b 100644 --- a/src/Generators/CheckboxGenerator.bf +++ b/src/Generators/CheckboxGenerator.bf @@ -4,7 +4,7 @@ using System; class CheckboxGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Checkbox" + public override String Name => "TheaterGui -> Checkbox" public override void InitUI() { @@ -22,14 +22,14 @@ class CheckboxGenerator : Compiler.Generator var enabled = bool.Parse(mParams["enabled"]); var description = mParams["description"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : Checkbox + class {name} : Checkbox {{ public this() : base("{name}") {{ diff --git a/src/Generators/ContainerGenerator.bf b/src/Generators/ContainerGenerator.bf index 6ba2829..f62d444 100644 --- a/src/Generators/ContainerGenerator.bf +++ b/src/Generators/ContainerGenerator.bf @@ -4,7 +4,7 @@ using System; class ContainerGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Container" + public override String Name => "TheaterGui -> Container" public override void InitUI() { @@ -17,18 +17,19 @@ class ContainerGenerator : Compiler.Generator if (name.EndsWith(".bf", .OrdinalIgnoreCase)) name.RemoveFromEnd(3); - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : Screen + class {name} : Container {{ public this() : base("{name}") {{ //Add ui items here via AddChild() and terminate the row via EndRow() + Margin = 5; }} }} """); diff --git a/src/Generators/DropdownGenerator.bf b/src/Generators/DropdownGenerator.bf index 605b9a9..5d88842 100644 --- a/src/Generators/DropdownGenerator.bf +++ b/src/Generators/DropdownGenerator.bf @@ -23,7 +23,7 @@ class DropdownGenerator : Compiler.Generator var entries = mParams["content"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; diff --git a/src/Generators/IconButtonGenerator.bf b/src/Generators/IconButtonGenerator.bf index e7aae63..2219c07 100644 --- a/src/Generators/IconButtonGenerator.bf +++ b/src/Generators/IconButtonGenerator.bf @@ -4,7 +4,7 @@ using System; class IconButtonGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Icon Button" + public override String Name => "TheaterGui -> Icon Button" public override void InitUI() { @@ -22,14 +22,14 @@ class IconButtonGenerator : Compiler.Generator var enabled = bool.Parse(mParams["enabled"]); var description = mParams["description"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : IconButton + class {name} : IconButton {{ public this() : base("{name}") {{ diff --git a/src/Generators/LargeButtonGenerator.bf b/src/Generators/LargeButtonGenerator.bf index 6804efc..29b4c6b 100644 --- a/src/Generators/LargeButtonGenerator.bf +++ b/src/Generators/LargeButtonGenerator.bf @@ -4,7 +4,7 @@ using System; class LargeButtonGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Large Button" + public override String Name => "TheaterGui -> Large Button" public override void InitUI() { @@ -22,14 +22,14 @@ class LargeButtonGenerator : Compiler.Generator var enabled = bool.Parse(mParams["enabled"]); var description = mParams["description"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : LargeButton + class {name} : LargeButton {{ public this() : base("{name}") {{ diff --git a/src/Generators/NButtonGenerator.bf b/src/Generators/NButtonGenerator.bf index 4620e39..d1e0141 100644 --- a/src/Generators/NButtonGenerator.bf +++ b/src/Generators/NButtonGenerator.bf @@ -4,7 +4,7 @@ using System; class NButtonGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate NButton" + public override String Name => "TheaterGui -> NButton" public override void InitUI() { @@ -22,14 +22,14 @@ class NButtonGenerator : Compiler.Generator var enabled = bool.Parse(mParams["enabled"]); var description = mParams["description"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : NButton + class {name} : NButton {{ public this() : base("{name}") {{ diff --git a/src/Generators/RadioButtonGenerator.bf b/src/Generators/RadioButtonGenerator.bf index 1b3797a..ab19139 100644 --- a/src/Generators/RadioButtonGenerator.bf +++ b/src/Generators/RadioButtonGenerator.bf @@ -4,11 +4,11 @@ using System; class RadioButtonGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Radio Button" + public override String Name => "TheaterGui -> Radio Button" public override void InitUI() { - AddEdit("name", "ComponentName Name", ""); + AddEdit("name", "Component Name", ""); AddCheckbox("enabled", "Enabled", true); AddEdit("description", "Description", ""); } @@ -22,14 +22,14 @@ class RadioButtonGenerator : Compiler.Generator var enabled = bool.Parse(mParams["enabled"]); var description = mParams["description"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : RadioButton + class {name} : RadioButton {{ public this() : base("{name}") {{ diff --git a/src/Generators/ScreenGenerator.bf b/src/Generators/ScreenGenerator.bf index 7b275be..9c9c4c3 100644 --- a/src/Generators/ScreenGenerator.bf +++ b/src/Generators/ScreenGenerator.bf @@ -28,8 +28,7 @@ class ScreenGenerator : Compiler.Generator {{ public this() : base("{name}") {{ - //Add ui items here via AddChild() and terminate the row via EndRow() - //The padding object can be used to add padding to every ui object + //Add UI items here via AddChild() and terminate the row via EndRow() }} }} """); diff --git a/src/Generators/SliderGenerator.bf b/src/Generators/SliderGenerator.bf index 0e2d55c..1ab378b 100644 --- a/src/Generators/SliderGenerator.bf +++ b/src/Generators/SliderGenerator.bf @@ -4,7 +4,7 @@ using System; class SliderGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Slider" + public override String Name => "TheaterGui -> Slider" public override void InitUI() { @@ -29,14 +29,14 @@ class SliderGenerator : Compiler.Generator var dfault = mParams["dfault"]; - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : {(fixedLength == "True") ? "" : "N" }{(orientation == "Horizontal") ? "H" : "V"}Slider + class {name} : {(fixedLength == "True") ? "" : "N" }{(orientation == "Horizontal") ? "H" : "V"}Slider {{ public this() : base({(fixedLength == "True") ? "" : "64, "}"{name}") {{ diff --git a/src/Generators/ToolbarGenerator.bf b/src/Generators/ToolbarGenerator.bf index 1d7421a..d0c2906 100644 --- a/src/Generators/ToolbarGenerator.bf +++ b/src/Generators/ToolbarGenerator.bf @@ -4,7 +4,7 @@ using System; class ToolbarGenerator : Compiler.Generator { - public override String Name => "TheaterGui -> Generate Toolbar" + public override String Name => "TheaterGui -> Toolbar" public override void InitUI() { @@ -18,14 +18,14 @@ class ToolbarGenerator : Compiler.Generator name.RemoveFromEnd(3); - outFileName.Append(scope $"TG{name}"); + outFileName.Append(scope $"{name}"); outText.Append(scope $""" namespace {Namespace}; using TheaterGui.Components; - class TG{name} : Toolbar + class {name} : Toolbar {{ public this() : base("{name}") {{