All Projects → sbarisic → Nukleardotnet

sbarisic / Nukleardotnet

Licence: other
.NET binding for the Nuklear immediate mode GUI

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Nukleardotnet

Cimgui
c-api for imgui (https://github.com/ocornut/imgui) Look at: https://github.com/cimgui for other widgets
Stars: ✭ 707 (+461.11%)
Mutual labels:  gui, binding, imgui
Imgui Sfml
Dear ImGui binding for use with SFML
Stars: ✭ 596 (+373.02%)
Mutual labels:  gui, binding, imgui
Cvui
A (very) simple UI lib built on top of OpenCV drawing primitives
Stars: ✭ 619 (+391.27%)
Mutual labels:  gui, imgui
Imgui
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
Stars: ✭ 33,574 (+26546.03%)
Mutual labels:  gui, imgui
Wtk
📺 A cross-platform immediate mode user-interface library. Public domain.
Stars: ✭ 30 (-76.19%)
Mutual labels:  gui, imgui
Layout
Single-file library for calculating 2D UI layouts using stacking boxes. Compiles as C99 or C++.
Stars: ✭ 551 (+337.3%)
Mutual labels:  gui, imgui
Imgui markdown
Markdown for Dear ImGui
Stars: ✭ 594 (+371.43%)
Mutual labels:  gui, imgui
Giu
Cross platform rapid GUI framework for golang based on Dear ImGui.
Stars: ✭ 862 (+584.13%)
Mutual labels:  gui, imgui
Asap app imgui
Starter project for portable app with optional GUI (GLFW/ImGui) and a rich builtin debug UI. Includes docked windows, log viewer, settings editor, configuration load/save, etc...
Stars: ✭ 70 (-44.44%)
Mutual labels:  gui, imgui
Swiftgui
SwiftGUI is an API inspired by SwiftUI DSL, using Dear ImGui as renderer and running on macOS 10.13+ and iOS 11+
Stars: ✭ 74 (-41.27%)
Mutual labels:  gui, imgui
Imgui Rs
Rust bindings for Dear ImGui
Stars: ✭ 1,258 (+898.41%)
Mutual labels:  gui, imgui
Hello imgui
Hello, Dear ImGui: cross-platform Gui apps for Windows / Mac / Linux / iOS / Android / Emscripten with the simplicity of a "Hello World" app
Stars: ✭ 120 (-4.76%)
Mutual labels:  gui, imgui
Qtsharp
Mono/.NET bindings for Qt
Stars: ✭ 532 (+322.22%)
Mutual labels:  gui, binding
Implot
Immediate Mode Plotting
Stars: ✭ 2,014 (+1498.41%)
Mutual labels:  gui, imgui
Dearpygui
Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
Stars: ✭ 6,631 (+5162.7%)
Mutual labels:  gui, imgui
Iconfontcppheaders
C, C++ headers and C# classes for icon fonts: Font Awesome, Fork Awesome, Material Design, Kenney game icons and Fontaudio
Stars: ✭ 509 (+303.97%)
Mutual labels:  gui, imgui
Nuklear
A single-header ANSI C immediate mode cross-platform GUI library
Stars: ✭ 5,055 (+3911.9%)
Mutual labels:  gui, imgui
Imgui Go
Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)
Stars: ✭ 499 (+296.03%)
Mutual labels:  gui, imgui
Crunchyroll Downloader
A little GUI to download crap from crunchyroll.
Stars: ✭ 54 (-57.14%)
Mutual labels:  dotnet-framework, gui
Horus ui
HorusUI Immediate Mode Graphical User Interface
Stars: ✭ 106 (-15.87%)
Mutual labels:  gui, imgui

NuklearDotNet

LICENSE: Dual-licensed under MIT and The Unlicense. Your choice.

.NET binding for the Nuklear immediate mode GUI https://github.com/vurtun/nuklear

NuklearSharp ( https://github.com/leafi/NuklearSharp ) was my original inspiration for this, i am not a fan of the original way the bindings were loaded. It was too much code duplication and i don't really understand why P/Invoke wasn't used.

No original nuklear source files were modified. A project was created with some support code to build Nuklear.dll (x64) with all API functions exported and ready to be used from .NET

Updating should be as easy as updating the submodule and rebuilding the project.

Currently this binding is used in my game engine project, so i implement stuff as i need it. https://github.com/sbarisic/libTech

Contributions welcome.

Screenshots

alt text

Code samples

The custom device class implements actual drawing functions, it has to inherit from at least NuklearDevice. NuklearDeviceTex allows you to specify your custom texture class which replaces the internal texture handle integers, just for convenience. You can return your own texture handle integers in NuklearDevice and handle textures manually.

Optionally it can implement the IFrameBuffered interface which calls the Render function only when the GUI actually changes. It it supposed to be rendered to a framebuffer which is in turn rendered to the screen every frame in RenderFinal

class Device : NuklearDeviceTex<Texture>, IFrameBuffered {
	public override Texture CreateTexture(int W, int H, IntPtr Data) {
		// Create a texture from raw image data
		return null;
	}

	void IFrameBuffered.BeginBuffering() {
		// Begin rendering to framebuffer
	}
	
	public override void SetBuffer(NkVertex[] VertexBuffer, ushort[] IndexBuffer) {
		// Called once before Render, upload your vertex buffer and index buffer here
	}

	public override void Render(NkHandle Userdata, Texture Texture, NkRect ClipRect, uint Offset, uint Count) {
		// Render to either framebuffer or screen
		// If IFrameBuffered isn't implemented, it's called every frame, else only when the GUI actually changes
		// Called multiple times per frame, uses the vertex and index buffer that has been sent to SetBuffer
	}

	void IFrameBuffered.EndBuffering() {
		// End rendering to frame buffer
	}

	void IFrameBuffered.RenderFinal() {
		// Called each frame, render to screen finally
	}
}

Sending events; just call these when you capture the events from your input API. It's irrelevant when they're called. They are internally queued and dispatched to Nuklear on every frame.

	Device.OnMouseButton(Button, X, Y, Down)
	Device.OnMouseMove(X, Y)
	Device.OnScroll(X, Y)
	Device.OnText(Text)
	Device.OnKey(Key, Down)

Using the GUI, note that the while loop represents an OnRender function in your renderer code. At the end of the Frame call, the actual rendering functions are dispatched.

NuklearAPI.Init(Device);

while (true) {

	// Optional
	NuklearAPI.SetDeltaTime(Dt);
	
	NuklearAPI.Frame(() => {
		NuklearAPI.Window("Test Window", 100, 100, 200, 200, Flags, () => {
			NuklearAPI.LayoutRowDynamic(35);
			
			if (NuklearAPI.ButtonLabel("Some Button"))
				Console.WriteLine("You pressed Some Button!");
		});
	});

}

TODO

  • Demo application
  • Higher level binding
  • Support for multiple contexts, want to draw a GUI and some example on a 3D in-game screen at the same time?
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].