64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
using System.Numerics;
|
|
using System.Runtime.CompilerServices;
|
|
using ImGuiNET;
|
|
using SDL3_TestingSuite.SDL3;
|
|
using SDL3;
|
|
|
|
namespace SDL3_TestingSuite;
|
|
|
|
public class Program
|
|
{
|
|
private static bool _demoWindowVisible = true;
|
|
|
|
public static void Main()
|
|
{
|
|
const SDL.WindowFlags flags = SDL.WindowFlags.Resizable | SDL.WindowFlags.HighPixelDensity | SDL.WindowFlags.Transparent;
|
|
SDL3Window window = new SDL3Window("SDL3 Testing Suite", 100, 100, 1280, 720, flags);
|
|
window.RenderCallback = () =>
|
|
{
|
|
ImGuiViewportPtr viewport = ImGui.GetMainViewport();
|
|
ImGui.SetNextWindowPos(viewport.WorkPos);
|
|
ImGui.SetNextWindowSize(viewport.WorkSize);
|
|
|
|
ImGui.Begin("MainWindow", ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoBringToFrontOnFocus);
|
|
|
|
if (ImGui.BeginMenuBar())
|
|
{
|
|
if (ImGui.BeginMenu("Stuff"))
|
|
{
|
|
if (ImGui.MenuItem("Quit"))
|
|
{
|
|
window.ShouldClose = true;
|
|
}
|
|
|
|
ImGui.EndMenu();
|
|
}
|
|
ImGui.Spacing();
|
|
ImGui.MenuItem("Demo Window", "", ref _demoWindowVisible);
|
|
|
|
ImGui.EndMenuBar();
|
|
}
|
|
|
|
ImGui.End();
|
|
|
|
if (_demoWindowVisible)
|
|
{
|
|
ImGui.ShowDemoWindow(ref _demoWindowVisible);
|
|
}
|
|
};
|
|
|
|
window.Run();
|
|
}
|
|
|
|
public static class Logger
|
|
{
|
|
public static void Log(string? str, [CallerMemberName] string caller = "", [CallerLineNumber] int line = 0)
|
|
{
|
|
Console.WriteLine($"{caller}({line}): {str}");
|
|
}
|
|
public static void Log(object? str, [CallerMemberName] string caller = "", [CallerLineNumber] int line = 0)
|
|
{
|
|
Log(str?.ToString(), caller, line);
|
|
}
|
|
}
|
|
} |