added example file
This commit is contained in:
parent
5661fffed1
commit
f827fb4f18
9 changed files with 43 additions and 13 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
# ---> Beef
|
# ---> Beef
|
||||||
build/
|
**/build
|
||||||
recovery/
|
**/recovery
|
||||||
BeefSpace_User.toml
|
BeefSpace_User.toml
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
6
examples/BeefProj.toml
Normal file
6
examples/BeefProj.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FileVersion = 1
|
||||||
|
Dependencies = {corlib = "*", TheaterGui = "*"}
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
Name = "examples"
|
||||||
|
StartupObject = "examples.Program"
|
5
examples/BeefSpace.toml
Normal file
5
examples/BeefSpace.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
FileVersion = 1
|
||||||
|
Projects = {examples = {Path = "."}, TheaterGui = {Path = ".."}}
|
||||||
|
|
||||||
|
[Workspace]
|
||||||
|
StartupProject = "examples"
|
12
examples/src/MainScreen.bf
Normal file
12
examples/src/MainScreen.bf
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
namespace examples;
|
||||||
|
|
||||||
|
using TheaterGui.Components;
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
11
examples/src/Program.bf
Normal file
11
examples/src/Program.bf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
namespace examples;
|
||||||
|
|
||||||
|
using TheaterGui;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
App.Run<MainScreen>("Example Gui",1920,1080);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ using System;
|
||||||
|
|
||||||
class ScreenGenerator : Compiler.Generator
|
class ScreenGenerator : Compiler.Generator
|
||||||
{
|
{
|
||||||
public override String Name => "TheaterGui -> Generate Screen"
|
public override String Name => "TheaterGui -> Screen"
|
||||||
|
|
||||||
public override void InitUI()
|
public override void InitUI()
|
||||||
{
|
{
|
||||||
|
@ -17,14 +17,14 @@ class ScreenGenerator : Compiler.Generator
|
||||||
if (name.EndsWith(".bf", .OrdinalIgnoreCase))
|
if (name.EndsWith(".bf", .OrdinalIgnoreCase))
|
||||||
name.RemoveFromEnd(3);
|
name.RemoveFromEnd(3);
|
||||||
|
|
||||||
outFileName.Append(scope $"TG{name}");
|
outFileName.Append(scope $"{name}");
|
||||||
|
|
||||||
outText.Append(scope $"""
|
outText.Append(scope $"""
|
||||||
namespace {Namespace};
|
namespace {Namespace};
|
||||||
|
|
||||||
using TheaterGui.Components;
|
using TheaterGui.Components;
|
||||||
|
|
||||||
class TG{name} : Screen
|
class {name} : Screen
|
||||||
{{
|
{{
|
||||||
public this() : base("{name}")
|
public this() : base("{name}")
|
||||||
{{
|
{{
|
||||||
|
|
12
src/Input.bf
12
src/Input.bf
|
@ -52,15 +52,11 @@ class Input
|
||||||
|
|
||||||
internal static void HandleRightClick()
|
internal static void HandleRightClick()
|
||||||
{
|
{
|
||||||
if (App.[Friend]_Popups.Count > 0)
|
//We dont stack up rightclicks
|
||||||
{
|
if (App.GetTopmostPopup() case .Ok(let top))
|
||||||
var top = App.[Friend]_Popups[App.[Friend]_Popups.Count - 1];
|
|
||||||
if (top is RightClickPopup)
|
if (top is RightClickPopup)
|
||||||
{
|
delete App.[Friend]_Popups.GetAndRemove(top).Value;
|
||||||
App.[Friend]_Popups.Remove(top);
|
|
||||||
delete top;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Toolbar.ToolbarCategory popupCat = new .("Items");
|
Toolbar.ToolbarCategory popupCat = new .("Items");
|
||||||
App.CurrentScreen.OnRightClick((.)App.Mouse.x, (.)App.Mouse.y, popupCat);
|
App.CurrentScreen.OnRightClick((.)App.Mouse.x, (.)App.Mouse.y, popupCat);
|
||||||
if (popupCat.Items.Count > 0)
|
if (popupCat.Items.Count > 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue