add bindings
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
build
|
||||
recovery
|
||||
BeefSpace_User.toml
|
||||
BeefSpace_Lock.toml
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "microui"]
|
||||
path = microui
|
||||
url = https://github.com/rxi/microui.git
|
||||
@@ -0,0 +1,10 @@
|
||||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "MicroUI"
|
||||
TargetType = "BeefLib"
|
||||
StartupObject = "MicroUI.Program"
|
||||
|
||||
[Dependencies]
|
||||
corlib = "*"
|
||||
"CxxBuildTool.git" = {Git = "https://git.unicon-gmbh.de/Rune/CxxBuildTool.git"}
|
||||
@@ -0,0 +1,8 @@
|
||||
FileVersion = 1
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "MicroUI"
|
||||
|
||||
[Projects]
|
||||
MicroUI = {Path = "."}
|
||||
"CxxBuildTool.git" = {Git = "https://git.unicon-gmbh.de/Rune/CxxBuildTool.git"}
|
||||
@@ -0,0 +1,9 @@
|
||||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "MicroUI.Setup"
|
||||
StartupObject = "MicroUI.Setup.Program"
|
||||
|
||||
[Dependencies]
|
||||
corlib = "*"
|
||||
"Cpp2Beef.git" = {Git = "https://git.unicon-gmbh.de/Rune/Cpp2Beef.git"}
|
||||
@@ -0,0 +1,8 @@
|
||||
FileVersion = 1
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "MicroUI.Setup"
|
||||
|
||||
[Projects]
|
||||
"MicroUI.Setup" = {Path = "."}
|
||||
"Cpp2Beef.git" = {Git = "https://git.unicon-gmbh.de/Rune/Cpp2Beef.git"}
|
||||
@@ -0,0 +1,254 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Cpp2Beef;
|
||||
using LibClang;
|
||||
|
||||
namespace MicroUI.Setup;
|
||||
|
||||
class MicroUIGenerator : Cpp2BeefGenerator, this(Span<char8*> args)
|
||||
{
|
||||
protected override Span<char8*> Args => args;
|
||||
protected override Flags Flags => .None;
|
||||
|
||||
StreamWriter writer = new .()..Create("../src/MicroUI.bf")..Write("""
|
||||
// This file was generated by Cpp2Beef
|
||||
|
||||
using System;
|
||||
using System.Interop;
|
||||
|
||||
namespace MicroUI;
|
||||
|
||||
|
||||
""") ~ delete _;
|
||||
|
||||
protected override StreamWriter GetWriterForHeader(StringView header)
|
||||
{
|
||||
if (header.EndsWith("microui.h"))
|
||||
return writer;
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override Block GetCursorBlock(CXCursor cursor)
|
||||
{
|
||||
if (cursor.kind == .FunctionDecl)
|
||||
return .CustomBlock("MicroUI");
|
||||
return base.GetCursorBlock(cursor);
|
||||
}
|
||||
|
||||
static int enumParentLen;
|
||||
protected override void HandleCursor(CXCursor cursor)
|
||||
{
|
||||
switch (cursor.kind)
|
||||
{
|
||||
case .MacroDefinition:
|
||||
let spelling = GetCursorSpelling!(cursor);
|
||||
if (spelling == "MU_REAL")
|
||||
return;
|
||||
case .EnumDecl:
|
||||
BeginCursor(cursor);
|
||||
Clang.VisitChildren(cursor, (cursor, parent, client_data) =>
|
||||
{
|
||||
(Self self, int* parentLen) = *(.)client_data;
|
||||
var spelling = GetCursorSpelling!(cursor);
|
||||
Runtime.Assert(spelling.StartsWith("MU_"));
|
||||
spelling.RemoveFromStart(3);
|
||||
spelling = spelling[..<spelling.IndexOf('_')];
|
||||
*parentLen = spelling.Length + 4;
|
||||
self.str.Append("[CRepr] enum mu_");
|
||||
self.str.Append(spelling);
|
||||
return .Break;
|
||||
}, &(this, &enumParentLen));
|
||||
BeginBody!(cursor);
|
||||
Clang.VisitChildren(cursor, (cursor, parent, client_data) =>
|
||||
{
|
||||
Self self = (.)Internal.UnsafeCastToObject(client_data);
|
||||
self.HandleCursor(cursor);
|
||||
return .Continue;
|
||||
}, Internal.UnsafeCastToPtr(this));
|
||||
enumParentLen = 0;
|
||||
case .StructDecl:
|
||||
if (Clang.GetCursorSemanticParent(cursor).kind == .StructDecl)
|
||||
return;
|
||||
if (Clang.VisitChildren(cursor, (cursor, parent, client_data) =>
|
||||
{
|
||||
return .Break;
|
||||
}, null) == 0) return;
|
||||
BeginCursor(cursor);
|
||||
Record(cursor);
|
||||
return;
|
||||
case .FieldDecl:
|
||||
let spelling = GetCursorSpelling!(cursor);
|
||||
if (spelling.EndsWith("_stack") || spelling.EndsWith("_list"))
|
||||
{
|
||||
BeginCursor(cursor);
|
||||
str.Append("[CRepr] ");
|
||||
AccessSpecifier(cursor);
|
||||
str.Append("struct { public c_int idx; public c_char[MU_");
|
||||
for (let char in spelling)
|
||||
if (char.IsLetter)
|
||||
str.Append(char.ToUpper);
|
||||
str.Append("_SIZE] items; } ", spelling);
|
||||
str.Append(';');
|
||||
return;
|
||||
}
|
||||
default:
|
||||
}
|
||||
base.HandleCursor(cursor);
|
||||
}
|
||||
|
||||
protected override void GetNameInBindings(CXCursor cursor, String outString)
|
||||
{
|
||||
if (!cGetNameInBindings(cursor, outString))
|
||||
base.GetNameInBindings(cursor, outString);
|
||||
}
|
||||
|
||||
protected override void Type(CXType type, TypeParamMode paramMode = .None)
|
||||
{
|
||||
if (!cType(type, str, currentCursor))
|
||||
base.Type(type, paramMode);
|
||||
}
|
||||
|
||||
public static bool cGetNameInBindings(LibClang.CXCursor cursor, String outString)
|
||||
{
|
||||
switch (cursor.kind)
|
||||
{
|
||||
case .FunctionDecl:
|
||||
var spelling = GetCursorSpelling!(cursor);
|
||||
Runtime.Assert(spelling.StartsWith("mu_"));
|
||||
spelling.RemoveFromStart(3);
|
||||
UpperSnakeCase2PascalCase(spelling, outString);
|
||||
case .EnumConstantDecl:
|
||||
var spelling = GetCursorSpelling!(cursor);
|
||||
spelling.RemoveFromStart(enumParentLen);
|
||||
UpperSnakeCase2PascalCase(spelling, outString);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool cType(CXType type, String str, CXCursor cursor)
|
||||
{
|
||||
if (type.kind == .Int && cursor.kind == .FieldDecl || cursor.kind == .ParmDecl)
|
||||
{
|
||||
let spelling = GetCursorSpelling!(cursor);
|
||||
switch (spelling)
|
||||
{
|
||||
case "key": str.Append("mu_KEY");
|
||||
case "type": str.Append("mu_COMMAND");
|
||||
case "colorid": str.Append("mu_COLOR");
|
||||
case "opt": str.Append("mu_OPT");
|
||||
case "icon": str.Append("mu_ICON");
|
||||
case "btn": str.Append("mu_MOUSE");
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (type.kind == .Int && cursor.kind == .FunctionDecl)
|
||||
{
|
||||
str.Append("mu_RES");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class MicroUIWrapperGenerator : Cpp2BeefGenerator, this(Span<char8*> args)
|
||||
{
|
||||
protected override Span<char8*> Args => args;
|
||||
protected override Flags Flags => .None;
|
||||
|
||||
StreamWriter writer = new .()..Create("../src/Wrapper.bf")..Write("""
|
||||
// This file was generated by Cpp2Beef
|
||||
|
||||
using System;
|
||||
using System.Interop;
|
||||
|
||||
namespace MicroUI;
|
||||
|
||||
extension MicroUIContext
|
||||
{
|
||||
|
||||
""") ~ delete _..Write("}\n");
|
||||
|
||||
protected override StreamWriter GetWriterForHeader(StringView header)
|
||||
{
|
||||
if (header.EndsWith("microui.h"))
|
||||
return writer;
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override Block GetCursorBlock(CXCursor cursor)
|
||||
{
|
||||
return .NoBlock;
|
||||
}
|
||||
|
||||
protected override void GetNameInBindings(CXCursor cursor, String outString)
|
||||
{
|
||||
if (!MicroUIGenerator.cGetNameInBindings(cursor, outString))
|
||||
base.GetNameInBindings(cursor, outString);
|
||||
}
|
||||
|
||||
protected override void Type(CXType type, TypeParamMode paramMode = .None)
|
||||
{
|
||||
if (!MicroUIGenerator.cType(type, str, currentCursor))
|
||||
base.Type(type, paramMode);
|
||||
}
|
||||
|
||||
protected override void HandleCursor(CXCursor cursor)
|
||||
{
|
||||
if (cursor.kind != .FunctionDecl || GetCursorSpelling!(cursor) == "mu_init") return;
|
||||
Flush();
|
||||
Method_Parameters(cursor);
|
||||
StringView parameters = scope String(str);
|
||||
str.Clear();
|
||||
if (!parameters.StartsWith("mu_Context* ctx"))
|
||||
return;
|
||||
parameters.RemoveFromStart("mu_Context* ctx".Length);
|
||||
if (parameters.StartsWith(", "))
|
||||
parameters.RemoveFromStart(2);
|
||||
BeginCursor(cursor);
|
||||
AccessSpecifier(cursor);
|
||||
WriteTypeAndName(cursor, Clang.GetCursorResultType(cursor));
|
||||
str.Append('(');
|
||||
str.Append(parameters, ") => MicroUI.");
|
||||
GetNameInBindings(cursor, str);
|
||||
str.Append("(&");
|
||||
|
||||
let numArgs = Clang.Cursor_GetNumArguments(cursor);
|
||||
for (let i < numArgs)
|
||||
{
|
||||
if (i > 0) str.Append(", ");
|
||||
str.Append(GetCursorSpelling!(Clang.Cursor_GetArgument(cursor, (.)i)));
|
||||
}
|
||||
if (Clang.Cursor_IsVariadic(cursor) != 0)
|
||||
{
|
||||
if (numArgs > 0) str.Append(", ");
|
||||
str.Append("...");
|
||||
}
|
||||
str.Append(");");
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
[CLink] static extern int32 system(char8*);
|
||||
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
if (system("git -C .. submodule update") != 0)
|
||||
{
|
||||
Console.WriteLine("Failed to fetch microui, check your internet connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
scope MicroUIGenerator(char8*[?]("--language=c")).Generate("../microui/src/microui.h");
|
||||
scope MicroUIWrapperGenerator(char8*[?]("--language=c")).Generate("../microui/src/microui.h");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Submodule
+1
Submodule microui added at 0850aba860
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Interop;
|
||||
|
||||
using CxxBuildTool;
|
||||
|
||||
namespace MicroUI;
|
||||
|
||||
static class MicroUI
|
||||
{
|
||||
[OnCompile(.TypeDone)]
|
||||
private static void Build()
|
||||
{
|
||||
if (!Compiler.IsBuilding) return;
|
||||
CxxBuildTool.Ninja(Compiler.ProjectDir + "/microui/src", Compiler.BuildDir + "/" + Compiler.ProjectName, "microui", "", "microui.c");
|
||||
}
|
||||
}
|
||||
|
||||
class MicroUIContext
|
||||
{
|
||||
public mu_Context ctx;
|
||||
|
||||
public this()
|
||||
{
|
||||
MicroUI.Init(&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
extension mu_RES
|
||||
{
|
||||
public static operator bool(Self s) => s != 0;
|
||||
}
|
||||
|
||||
extension mu_Vec2 { public this(c_int x, c_int y) { this.x = x; this.y = y; } }
|
||||
extension mu_Rect { public this(c_int x, c_int y, c_int w, c_int h) { this.x = x; this.y = y; this.w = w; this.h = h; } }
|
||||
extension mu_Color { public this(c_uchar r, c_uchar g, c_uchar b, c_uchar a) { this.r = r; this.g = g; this.b = b; this.a = a; } }
|
||||
+310
@@ -0,0 +1,310 @@
|
||||
// This file was generated by Cpp2Beef
|
||||
|
||||
using System;
|
||||
using System.Interop;
|
||||
|
||||
namespace MicroUI;
|
||||
|
||||
static
|
||||
{
|
||||
/*
|
||||
** Copyright (c) 2024 rxi
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or modify it
|
||||
** under the terms of the MIT license. See `microui.c` for details.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
public const let MU_VERSION = "2.02";
|
||||
|
||||
public const let MU_COMMANDLIST_SIZE = (256 * 1024);
|
||||
public const let MU_ROOTLIST_SIZE = 32;
|
||||
public const let MU_CONTAINERSTACK_SIZE = 32;
|
||||
public const let MU_CLIPSTACK_SIZE = 32;
|
||||
public const let MU_IDSTACK_SIZE = 32;
|
||||
public const let MU_LAYOUTSTACK_SIZE = 16;
|
||||
public const let MU_CONTAINERPOOL_SIZE = 48;
|
||||
public const let MU_TREENODEPOOL_SIZE = 48;
|
||||
public const let MU_MAX_WIDTHS = 16;
|
||||
|
||||
public const let MU_REAL_FMT = "%.3g";
|
||||
public const let MU_SLIDER_FMT = "%.2f";
|
||||
public const let MU_MAX_FMT = 127;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[CRepr] enum mu_CLIP {
|
||||
Part = 1,
|
||||
All,
|
||||
}
|
||||
|
||||
[CRepr] enum mu_COMMAND {
|
||||
Jump = 1,
|
||||
Clip,
|
||||
Rect,
|
||||
Text,
|
||||
Icon,
|
||||
Max,
|
||||
}
|
||||
|
||||
[CRepr] enum mu_COLOR {
|
||||
Text,
|
||||
Border,
|
||||
Windowbg,
|
||||
Titlebg,
|
||||
Titletext,
|
||||
Panelbg,
|
||||
Button,
|
||||
Buttonhover,
|
||||
Buttonfocus,
|
||||
Base,
|
||||
Basehover,
|
||||
Basefocus,
|
||||
Scrollbase,
|
||||
Scrollthumb,
|
||||
Max,
|
||||
}
|
||||
|
||||
[CRepr] enum mu_ICON {
|
||||
Close = 1,
|
||||
Check,
|
||||
Collapsed,
|
||||
Expanded,
|
||||
Max,
|
||||
}
|
||||
|
||||
[CRepr] enum mu_RES {
|
||||
Active = (1 << 0),
|
||||
Submit = (1 << 1),
|
||||
Change = (1 << 2),
|
||||
}
|
||||
|
||||
[CRepr] enum mu_OPT {
|
||||
Aligncenter = (1 << 0),
|
||||
Alignright = (1 << 1),
|
||||
Nointeract = (1 << 2),
|
||||
Noframe = (1 << 3),
|
||||
Noresize = (1 << 4),
|
||||
Noscroll = (1 << 5),
|
||||
Noclose = (1 << 6),
|
||||
Notitle = (1 << 7),
|
||||
Holdfocus = (1 << 8),
|
||||
Autosize = (1 << 9),
|
||||
Popup = (1 << 10),
|
||||
Closed = (1 << 11),
|
||||
Expanded = (1 << 12),
|
||||
}
|
||||
|
||||
[CRepr] enum mu_MOUSE {
|
||||
Left = (1 << 0),
|
||||
Right = (1 << 1),
|
||||
Middle = (1 << 2),
|
||||
}
|
||||
|
||||
[CRepr] enum mu_KEY {
|
||||
Shift = (1 << 0),
|
||||
Ctrl = (1 << 1),
|
||||
Alt = (1 << 2),
|
||||
Backspace = (1 << 3),
|
||||
Return = (1 << 4),
|
||||
}
|
||||
|
||||
|
||||
|
||||
public typealias mu_Id = c_uint;
|
||||
public typealias mu_Real = float;
|
||||
public typealias mu_Font = void*;
|
||||
|
||||
[CRepr] public struct mu_Vec2 { public c_int x; public c_int y; }
|
||||
[CRepr] public struct mu_Rect { public c_int x; public c_int y; public c_int w; public c_int h; }
|
||||
[CRepr] public struct mu_Color { public c_uchar r; public c_uchar g; public c_uchar b; public c_uchar a; }
|
||||
[CRepr] public struct mu_PoolItem { public mu_Id id; public c_int last_update; }
|
||||
|
||||
[CRepr] public struct mu_BaseCommand { public mu_COMMAND type; public c_int size; }
|
||||
[CRepr] public struct mu_JumpCommand { public mu_BaseCommand @base; public void* dst; }
|
||||
[CRepr] public struct mu_ClipCommand { public mu_BaseCommand @base; public mu_Rect rect; }
|
||||
[CRepr] public struct mu_RectCommand { public mu_BaseCommand @base; public mu_Rect rect; public mu_Color color; }
|
||||
[CRepr] public struct mu_TextCommand { public mu_BaseCommand @base; public mu_Font font; public mu_Vec2 pos; public mu_Color color; public c_char[1] str; }
|
||||
[CRepr] public struct mu_IconCommand { public mu_BaseCommand @base; public mu_Rect rect; public c_int id; public mu_Color color; }
|
||||
|
||||
[CRepr, Union] public struct mu_Command {
|
||||
public mu_COMMAND type;
|
||||
public mu_BaseCommand @base;
|
||||
public mu_JumpCommand jump;
|
||||
public mu_ClipCommand clip;
|
||||
public mu_RectCommand rect;
|
||||
public mu_TextCommand text;
|
||||
public mu_IconCommand icon;
|
||||
}
|
||||
|
||||
[CRepr] public struct mu_Layout {
|
||||
public mu_Rect body;
|
||||
public mu_Rect next;
|
||||
public mu_Vec2 position;
|
||||
public mu_Vec2 size;
|
||||
public mu_Vec2 max;
|
||||
public c_int[16] widths;
|
||||
public c_int items;
|
||||
public c_int item_index;
|
||||
public c_int next_row;
|
||||
public c_int next_type;
|
||||
public c_int indent;
|
||||
}
|
||||
|
||||
[CRepr] public struct mu_Container {
|
||||
public mu_Command* head; public mu_Command* tail;
|
||||
public mu_Rect rect;
|
||||
public mu_Rect body;
|
||||
public mu_Vec2 content_size;
|
||||
public mu_Vec2 scroll;
|
||||
public c_int zindex;
|
||||
public c_int open;
|
||||
}
|
||||
|
||||
[CRepr] public struct mu_Style {
|
||||
public mu_Font font;
|
||||
public mu_Vec2 size;
|
||||
public c_int padding;
|
||||
public c_int spacing;
|
||||
public c_int indent;
|
||||
public c_int title_height;
|
||||
public c_int scrollbar_size;
|
||||
public c_int thumb_size;
|
||||
public mu_Color[14] colors;
|
||||
}
|
||||
|
||||
[CRepr] public struct mu_Context {
|
||||
/* callbacks */
|
||||
public function c_int(mu_Font font, c_char* str, c_int len) text_width;
|
||||
public function c_int(mu_Font font) text_height;
|
||||
public function void(mu_Context* ctx, mu_Rect rect, c_int colorid) draw_frame;
|
||||
/* core state */
|
||||
public mu_Style _style;
|
||||
public mu_Style* style;
|
||||
public mu_Id hover;
|
||||
public mu_Id focus;
|
||||
public mu_Id last_id;
|
||||
public mu_Rect last_rect;
|
||||
public c_int last_zindex;
|
||||
public c_int updated_focus;
|
||||
public c_int frame;
|
||||
public mu_Container* hover_root;
|
||||
public mu_Container* next_hover_root;
|
||||
public mu_Container* scroll_target;
|
||||
public c_char[127] number_edit_buf;
|
||||
public mu_Id number_edit;
|
||||
/* stacks */
|
||||
[CRepr] public struct { public c_int idx; public c_char[MU_COMMANDLIST_SIZE] items; } command_list;
|
||||
[CRepr] public struct { public c_int idx; public c_char[MU_ROOTLIST_SIZE] items; } root_list;
|
||||
[CRepr] public struct { public c_int idx; public c_char[MU_CONTAINERSTACK_SIZE] items; } container_stack;
|
||||
[CRepr] public struct { public c_int idx; public c_char[MU_CLIPSTACK_SIZE] items; } clip_stack;
|
||||
[CRepr] public struct { public c_int idx; public c_char[MU_IDSTACK_SIZE] items; } id_stack;
|
||||
[CRepr] public struct { public c_int idx; public c_char[MU_LAYOUTSTACK_SIZE] items; } layout_stack;
|
||||
/* retained state pools */
|
||||
public mu_PoolItem[48] container_pool;
|
||||
public mu_Container[48] containers;
|
||||
public mu_PoolItem[48] treenode_pool;
|
||||
/* input state */
|
||||
public mu_Vec2 mouse_pos;
|
||||
public mu_Vec2 last_mouse_pos;
|
||||
public mu_Vec2 mouse_delta;
|
||||
public mu_Vec2 scroll_delta;
|
||||
public c_int mouse_down;
|
||||
public c_int mouse_pressed;
|
||||
public c_int key_down;
|
||||
public c_int key_pressed;
|
||||
public c_char[32] input_text;
|
||||
}
|
||||
|
||||
|
||||
extension MicroUI
|
||||
{
|
||||
[LinkName("mu_vec2")] public static extern mu_Vec2 Vec2(c_int x, c_int y);
|
||||
[LinkName("mu_rect")] public static extern mu_Rect Rect(c_int x, c_int y, c_int w, c_int h);
|
||||
[LinkName("mu_color")] public static extern mu_Color Color(c_int r, c_int g, c_int b, c_int a);
|
||||
|
||||
[LinkName("mu_init")] public static extern void Init(mu_Context* ctx);
|
||||
[LinkName("mu_begin")] public static extern void Begin(mu_Context* ctx);
|
||||
[LinkName("mu_end")] public static extern void End(mu_Context* ctx);
|
||||
[LinkName("mu_set_focus")] public static extern void SetFocus(mu_Context* ctx, mu_Id id);
|
||||
[LinkName("mu_get_id")] public static extern mu_Id GetId(mu_Context* ctx, void* data, c_int size);
|
||||
[LinkName("mu_push_id")] public static extern void PushId(mu_Context* ctx, void* data, c_int size);
|
||||
[LinkName("mu_pop_id")] public static extern void PopId(mu_Context* ctx);
|
||||
[LinkName("mu_push_clip_rect")] public static extern void PushClipRect(mu_Context* ctx, mu_Rect rect);
|
||||
[LinkName("mu_pop_clip_rect")] public static extern void PopClipRect(mu_Context* ctx);
|
||||
[LinkName("mu_get_clip_rect")] public static extern mu_Rect GetClipRect(mu_Context* ctx);
|
||||
[LinkName("mu_check_clip")] public static extern mu_RES CheckClip(mu_Context* ctx, mu_Rect r);
|
||||
[LinkName("mu_get_current_container")] public static extern mu_Container* GetCurrentContainer(mu_Context* ctx);
|
||||
[LinkName("mu_get_container")] public static extern mu_Container* GetContainer(mu_Context* ctx, c_char* name);
|
||||
[LinkName("mu_bring_to_front")] public static extern void BringToFront(mu_Context* ctx, mu_Container* cnt);
|
||||
|
||||
[LinkName("mu_pool_init")] public static extern mu_RES PoolInit(mu_Context* ctx, mu_PoolItem* items, c_int len, mu_Id id);
|
||||
[LinkName("mu_pool_get")] public static extern mu_RES PoolGet(mu_Context* ctx, mu_PoolItem* items, c_int len, mu_Id id);
|
||||
[LinkName("mu_pool_update")] public static extern void PoolUpdate(mu_Context* ctx, mu_PoolItem* items, c_int idx);
|
||||
|
||||
[LinkName("mu_input_mousemove")] public static extern void InputMousemove(mu_Context* ctx, c_int x, c_int y);
|
||||
[LinkName("mu_input_mousedown")] public static extern void InputMousedown(mu_Context* ctx, c_int x, c_int y, mu_MOUSE btn);
|
||||
[LinkName("mu_input_mouseup")] public static extern void InputMouseup(mu_Context* ctx, c_int x, c_int y, mu_MOUSE btn);
|
||||
[LinkName("mu_input_scroll")] public static extern void InputScroll(mu_Context* ctx, c_int x, c_int y);
|
||||
[LinkName("mu_input_keydown")] public static extern void InputKeydown(mu_Context* ctx, mu_KEY key);
|
||||
[LinkName("mu_input_keyup")] public static extern void InputKeyup(mu_Context* ctx, mu_KEY key);
|
||||
[LinkName("mu_input_text")] public static extern void InputText(mu_Context* ctx, c_char* text);
|
||||
|
||||
[LinkName("mu_push_command")] public static extern mu_Command* PushCommand(mu_Context* ctx, mu_COMMAND type, c_int size);
|
||||
[LinkName("mu_next_command")] public static extern mu_RES NextCommand(mu_Context* ctx, mu_Command** cmd);
|
||||
[LinkName("mu_set_clip")] public static extern void SetClip(mu_Context* ctx, mu_Rect rect);
|
||||
[LinkName("mu_draw_rect")] public static extern void DrawRect(mu_Context* ctx, mu_Rect rect, mu_Color color);
|
||||
[LinkName("mu_draw_box")] public static extern void DrawBox(mu_Context* ctx, mu_Rect rect, mu_Color color);
|
||||
[LinkName("mu_draw_text")] public static extern void DrawText(mu_Context* ctx, mu_Font font, c_char* str, c_int len, mu_Vec2 pos, mu_Color color);
|
||||
[LinkName("mu_draw_icon")] public static extern void DrawIcon(mu_Context* ctx, c_int id, mu_Rect rect, mu_Color color);
|
||||
|
||||
[LinkName("mu_layout_row")] public static extern void LayoutRow(mu_Context* ctx, c_int items, c_int* widths, c_int height);
|
||||
[LinkName("mu_layout_width")] public static extern void LayoutWidth(mu_Context* ctx, c_int width);
|
||||
[LinkName("mu_layout_height")] public static extern void LayoutHeight(mu_Context* ctx, c_int height);
|
||||
[LinkName("mu_layout_begin_column")] public static extern void LayoutBeginColumn(mu_Context* ctx);
|
||||
[LinkName("mu_layout_end_column")] public static extern void LayoutEndColumn(mu_Context* ctx);
|
||||
[LinkName("mu_layout_set_next")] public static extern void LayoutSetNext(mu_Context* ctx, mu_Rect r, c_int relative);
|
||||
[LinkName("mu_layout_next")] public static extern mu_Rect LayoutNext(mu_Context* ctx);
|
||||
|
||||
[LinkName("mu_draw_control_frame")] public static extern void DrawControlFrame(mu_Context* ctx, mu_Id id, mu_Rect rect, mu_COLOR colorid, mu_OPT opt);
|
||||
[LinkName("mu_draw_control_text")] public static extern void DrawControlText(mu_Context* ctx, c_char* str, mu_Rect rect, mu_COLOR colorid, mu_OPT opt);
|
||||
[LinkName("mu_mouse_over")] public static extern mu_RES MouseOver(mu_Context* ctx, mu_Rect rect);
|
||||
[LinkName("mu_update_control")] public static extern void UpdateControl(mu_Context* ctx, mu_Id id, mu_Rect rect, mu_OPT opt);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[LinkName("mu_text")] public static extern void Text(mu_Context* ctx, c_char* text);
|
||||
[LinkName("mu_label")] public static extern void Label(mu_Context* ctx, c_char* text);
|
||||
[LinkName("mu_button_ex")] public static extern mu_RES ButtonEx(mu_Context* ctx, c_char* label, mu_ICON icon, mu_OPT opt);
|
||||
[LinkName("mu_checkbox")] public static extern mu_RES Checkbox(mu_Context* ctx, c_char* label, c_int* state);
|
||||
[LinkName("mu_textbox_raw")] public static extern mu_RES TextboxRaw(mu_Context* ctx, c_char* buf, c_int bufsz, mu_Id id, mu_Rect r, mu_OPT opt);
|
||||
[LinkName("mu_textbox_ex")] public static extern mu_RES TextboxEx(mu_Context* ctx, c_char* buf, c_int bufsz, mu_OPT opt);
|
||||
[LinkName("mu_slider_ex")] public static extern mu_RES SliderEx(mu_Context* ctx, mu_Real* value, mu_Real low, mu_Real high, mu_Real step, c_char* fmt, mu_OPT opt);
|
||||
[LinkName("mu_number_ex")] public static extern mu_RES NumberEx(mu_Context* ctx, mu_Real* value, mu_Real step, c_char* fmt, mu_OPT opt);
|
||||
[LinkName("mu_header_ex")] public static extern mu_RES HeaderEx(mu_Context* ctx, c_char* label, mu_OPT opt);
|
||||
[LinkName("mu_begin_treenode_ex")] public static extern mu_RES BeginTreenodeEx(mu_Context* ctx, c_char* label, mu_OPT opt);
|
||||
[LinkName("mu_end_treenode")] public static extern void EndTreenode(mu_Context* ctx);
|
||||
[LinkName("mu_begin_window_ex")] public static extern mu_RES BeginWindowEx(mu_Context* ctx, c_char* title, mu_Rect rect, mu_OPT opt);
|
||||
[LinkName("mu_end_window")] public static extern void EndWindow(mu_Context* ctx);
|
||||
[LinkName("mu_open_popup")] public static extern void OpenPopup(mu_Context* ctx, c_char* name);
|
||||
[LinkName("mu_begin_popup")] public static extern mu_RES BeginPopup(mu_Context* ctx, c_char* name);
|
||||
[LinkName("mu_end_popup")] public static extern void EndPopup(mu_Context* ctx);
|
||||
[LinkName("mu_begin_panel_ex")] public static extern void BeginPanelEx(mu_Context* ctx, c_char* name, mu_OPT opt);
|
||||
[LinkName("mu_end_panel")] public static extern void EndPanel(mu_Context* ctx);
|
||||
}
|
||||
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
// This file was generated by Cpp2Beef
|
||||
|
||||
using System;
|
||||
using System.Interop;
|
||||
|
||||
namespace MicroUI;
|
||||
|
||||
extension MicroUIContext
|
||||
{
|
||||
/*
|
||||
** Copyright (c) 2024 rxi
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or modify it
|
||||
** under the terms of the MIT license. See `microui.c` for details.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* callbacks */
|
||||
|
||||
|
||||
|
||||
/* core state */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* stacks */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* retained state pools */
|
||||
|
||||
|
||||
|
||||
/* input state */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void Begin() => MicroUI.Begin(&ctx);
|
||||
public void End() => MicroUI.End(&ctx);
|
||||
public void SetFocus(mu_Id id) => MicroUI.SetFocus(&ctx, id);
|
||||
public mu_Id GetId(void* data, c_int size) => MicroUI.GetId(&ctx, data, size);
|
||||
public void PushId(void* data, c_int size) => MicroUI.PushId(&ctx, data, size);
|
||||
public void PopId() => MicroUI.PopId(&ctx);
|
||||
public void PushClipRect(mu_Rect rect) => MicroUI.PushClipRect(&ctx, rect);
|
||||
public void PopClipRect() => MicroUI.PopClipRect(&ctx);
|
||||
public mu_Rect GetClipRect() => MicroUI.GetClipRect(&ctx);
|
||||
public mu_RES CheckClip(mu_Rect r) => MicroUI.CheckClip(&ctx, r);
|
||||
public mu_Container* GetCurrentContainer() => MicroUI.GetCurrentContainer(&ctx);
|
||||
public mu_Container* GetContainer(c_char* name) => MicroUI.GetContainer(&ctx, name);
|
||||
public void BringToFront(mu_Container* cnt) => MicroUI.BringToFront(&ctx, cnt);
|
||||
|
||||
public mu_RES PoolInit(mu_PoolItem* items, c_int len, mu_Id id) => MicroUI.PoolInit(&ctx, items, len, id);
|
||||
public mu_RES PoolGet(mu_PoolItem* items, c_int len, mu_Id id) => MicroUI.PoolGet(&ctx, items, len, id);
|
||||
public void PoolUpdate(mu_PoolItem* items, c_int idx) => MicroUI.PoolUpdate(&ctx, items, idx);
|
||||
|
||||
public void InputMousemove(c_int x, c_int y) => MicroUI.InputMousemove(&ctx, x, y);
|
||||
public void InputMousedown(c_int x, c_int y, mu_MOUSE btn) => MicroUI.InputMousedown(&ctx, x, y, btn);
|
||||
public void InputMouseup(c_int x, c_int y, mu_MOUSE btn) => MicroUI.InputMouseup(&ctx, x, y, btn);
|
||||
public void InputScroll(c_int x, c_int y) => MicroUI.InputScroll(&ctx, x, y);
|
||||
public void InputKeydown(mu_KEY key) => MicroUI.InputKeydown(&ctx, key);
|
||||
public void InputKeyup(mu_KEY key) => MicroUI.InputKeyup(&ctx, key);
|
||||
public void InputText(c_char* text) => MicroUI.InputText(&ctx, text);
|
||||
|
||||
public mu_Command* PushCommand(mu_COMMAND type, c_int size) => MicroUI.PushCommand(&ctx, type, size);
|
||||
public mu_RES NextCommand(mu_Command** cmd) => MicroUI.NextCommand(&ctx, cmd);
|
||||
public void SetClip(mu_Rect rect) => MicroUI.SetClip(&ctx, rect);
|
||||
public void DrawRect(mu_Rect rect, mu_Color color) => MicroUI.DrawRect(&ctx, rect, color);
|
||||
public void DrawBox(mu_Rect rect, mu_Color color) => MicroUI.DrawBox(&ctx, rect, color);
|
||||
public void DrawText(mu_Font font, c_char* str, c_int len, mu_Vec2 pos, mu_Color color) => MicroUI.DrawText(&ctx, font, str, len, pos, color);
|
||||
public void DrawIcon(c_int id, mu_Rect rect, mu_Color color) => MicroUI.DrawIcon(&ctx, id, rect, color);
|
||||
|
||||
public void LayoutRow(c_int items, c_int* widths, c_int height) => MicroUI.LayoutRow(&ctx, items, widths, height);
|
||||
public void LayoutWidth(c_int width) => MicroUI.LayoutWidth(&ctx, width);
|
||||
public void LayoutHeight(c_int height) => MicroUI.LayoutHeight(&ctx, height);
|
||||
public void LayoutBeginColumn() => MicroUI.LayoutBeginColumn(&ctx);
|
||||
public void LayoutEndColumn() => MicroUI.LayoutEndColumn(&ctx);
|
||||
public void LayoutSetNext(mu_Rect r, c_int relative) => MicroUI.LayoutSetNext(&ctx, r, relative);
|
||||
public mu_Rect LayoutNext() => MicroUI.LayoutNext(&ctx);
|
||||
|
||||
public void DrawControlFrame(mu_Id id, mu_Rect rect, mu_COLOR colorid, mu_OPT opt) => MicroUI.DrawControlFrame(&ctx, id, rect, colorid, opt);
|
||||
public void DrawControlText(c_char* str, mu_Rect rect, mu_COLOR colorid, mu_OPT opt) => MicroUI.DrawControlText(&ctx, str, rect, colorid, opt);
|
||||
public mu_RES MouseOver(mu_Rect rect) => MicroUI.MouseOver(&ctx, rect);
|
||||
public void UpdateControl(mu_Id id, mu_Rect rect, mu_OPT opt) => MicroUI.UpdateControl(&ctx, id, rect, opt);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void Text(c_char* text) => MicroUI.Text(&ctx, text);
|
||||
public void Label(c_char* text) => MicroUI.Label(&ctx, text);
|
||||
public mu_RES ButtonEx(c_char* label, mu_ICON icon, mu_OPT opt) => MicroUI.ButtonEx(&ctx, label, icon, opt);
|
||||
public mu_RES Checkbox(c_char* label, c_int* state) => MicroUI.Checkbox(&ctx, label, state);
|
||||
public mu_RES TextboxRaw(c_char* buf, c_int bufsz, mu_Id id, mu_Rect r, mu_OPT opt) => MicroUI.TextboxRaw(&ctx, buf, bufsz, id, r, opt);
|
||||
public mu_RES TextboxEx(c_char* buf, c_int bufsz, mu_OPT opt) => MicroUI.TextboxEx(&ctx, buf, bufsz, opt);
|
||||
public mu_RES SliderEx(mu_Real* value, mu_Real low, mu_Real high, mu_Real step, c_char* fmt, mu_OPT opt) => MicroUI.SliderEx(&ctx, value, low, high, step, fmt, opt);
|
||||
public mu_RES NumberEx(mu_Real* value, mu_Real step, c_char* fmt, mu_OPT opt) => MicroUI.NumberEx(&ctx, value, step, fmt, opt);
|
||||
public mu_RES HeaderEx(c_char* label, mu_OPT opt) => MicroUI.HeaderEx(&ctx, label, opt);
|
||||
public mu_RES BeginTreenodeEx(c_char* label, mu_OPT opt) => MicroUI.BeginTreenodeEx(&ctx, label, opt);
|
||||
public void EndTreenode() => MicroUI.EndTreenode(&ctx);
|
||||
public mu_RES BeginWindowEx(c_char* title, mu_Rect rect, mu_OPT opt) => MicroUI.BeginWindowEx(&ctx, title, rect, opt);
|
||||
public void EndWindow() => MicroUI.EndWindow(&ctx);
|
||||
public void OpenPopup(c_char* name) => MicroUI.OpenPopup(&ctx, name);
|
||||
public mu_RES BeginPopup(c_char* name) => MicroUI.BeginPopup(&ctx, name);
|
||||
public void EndPopup() => MicroUI.EndPopup(&ctx);
|
||||
public void BeginPanelEx(c_char* name, mu_OPT opt) => MicroUI.BeginPanelEx(&ctx, name, opt);
|
||||
public void EndPanel() => MicroUI.EndPanel(&ctx);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user