Skip to content

A multi-platform windowing, mouse/keyboard handling, and rendering toolkit.

License

Notifications You must be signed in to change notification settings

n-stuff/window-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windowing Toolkit

This repository provides building blocks to write cross-platform GUI applications in pure .NET.

The code only relies on .NET Core 5.0 64bit, and on a minimal set of functionalities from those APIs:

  • Win32 on Windows
  • Cocoa on macOS
  • Xlib on Linux
  • the OpenGL libraries shipped with those three operating systems.

Native interoperability with these APIs is achieved in C# through P/Invoke: the dotnet tool is the only one needed to build the libraries.

Examples

The code is developed on Windows 10, macOS Catalina, and Ubuntu 20.04. Once .NET Core is installed, samples and tests work out-of-the-box.

To run the samples launcher use the following command:

dotnet run -p test/WindowSystem.ManualTest

Then choose a sample by typing a letter. Samples demontrate how to:

  • create windows and handle events
  • draw polygons and textures using OpenGL
  • animate 3D objects using OpenGL
  • create a minecraft-like procedural world and move inside it using OpenGL
  • display OpenType font glyphs as images or triangles
  • decode a simple SVG file containing paths and render it
  • build a simple text area widget from the supplied building blocks

OpenGL bindings

A tool is provided (dotnet run -p build/MakeOpenGLInterop) that generates C# OpenGL bindings automatically from the file used to generate the official C headers, from a file written for this tool that tries to fix the mess in the first file, and from an input file listing the wanted APIs.

Acknowledgments

  • OpenGL.Context and WindowSystem projects borrow some ideas from GLFW and SDL
  • Tessellation project is based on the algorithm from GLU libtess
  • Geometry project is approximating Bézier curves using recursive subdivision as described in an article on antigrain.com (site mostly down).
  • The Typography.Font OpenType decoding code is inspired by this public domain C code
  • The font rasterization code of the Typography.Typesetting project is inspired by that article.

Releases

No releases published

Packages

No packages published

Languages