PixieLib 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PixieLib --version 0.1.0
                    
NuGet\Install-Package PixieLib -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PixieLib" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PixieLib" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PixieLib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PixieLib --version 0.1.0
                    
#r "nuget: PixieLib, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PixieLib@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PixieLib&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PixieLib&version=0.1.0
                    
Install as a Cake Tool

PixieLib

Primitives and math for C++ and C#, with one vocabulary and one memory layout. A PxRect made in C# crosses P/Invoke and arrives in C++ as a pxRect, with no conversion.

  • Points, sizes, rectangles, regions, paddings, and RGBA and HSL colors, in double, float and int.
  • Vectors and matrices, with the 2D transforms and the 3D projections. In C++ they are GLM's; C# follows GLM's formulas, in the same order, so both sides give the same bits.
  • In C++ only: events with the shape of C#'s (+=, -=, and subscriptions that end on their own).

It is not an engine: no window, rendering, input or assets, and no dependency on a UI framework. The C# package is fully managed and calls no native code.

C#

dotnet add package PixieLib

For .NET 10 and .NET Framework 4.8.1. A name without a suffix is double; f is float and i is int (PxPoint, PxPointf, PxPointi).

using PixieLib;

var screen = new PxRect(0, 0, 640, 480);
bool inside = screen.Contains(new PxPoint(100, 50));     // true
var orange = new PxColorRgba(255, 128, 0);                // alpha last, 255 by default
var turn = PxMat3.Rotate(PxMat3.Identity, Math.PI / 2);  // 2D transforms on a 3x3 matrix
PxVec3 moved = turn * new PxVec3(1, 0, 1);                // the vector is a column: M * v

C++

C++20 and CMake 3.20. The CMake project is in cpp/:

include(FetchContent)
FetchContent_Declare(pixielib
    GIT_REPOSITORY https://github.com/Sakamoto0110/PixieLib.git
    GIT_TAG v0.1.0
    SOURCE_SUBDIR cpp)
FetchContent_MakeAvailable(pixielib)

target_link_libraries(engine PRIVATE pixie::pixie pixie::events pixie::math)
  • pixie::pixie: the primitives, only headers.
  • pixie::events: the events, only headers.
  • pixie::math: the vectors and matrices. It brings GLM 1.0.3; PIXIE_SYSTEM_GLM=ON takes GLM from find_package instead, and PIXIE_MATH=OFF leaves the math (and GLM) out.
#include <pixie/pxRect.hpp>
#include <pixie/events/pxEvent.hpp>
#include <pixie/math/pxMat.hpp>

class Button {
public:
    pxEvent<Button, Button&> Click;  // only Button can raise it
    void Press() { Click(*this); }
};

void Example() {
    pxRect screen(0, 0, 640, 480);
    bool inside = screen.Contains(pxPoint(100, 50));  // true

    Button button;
    pxSubscription s = button.Click.Subscribe([](Button&) { /* ... */ });
    button.Press();

    pxMat4 projection = pxOrtho2D(640.0, 480.0);  // 2D keeps Y down
}

The same bits on both sides

The layout and the rules both sides follow are in docs/layout.md. The math gives the same bits in C++ and C# when the C++ compiler does not fuse a multiply and an add into one instruction: GCC and Clang need -ffp-contract=off, and MSVC does not fuse with its default /fp:precise. GLM compiled by MSVC adds the dot product of a vec4 in sequence instead of in pairs, so there the last bit of a few vec4 and mat4 operations can differ.

The decisions behind the library, with their reasons, are in docs/notas.md, in Portuguese.

License

MIT, in LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8.1

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PixieLib:

Package Downloads
PixieInspector

A reflection-based object inspector for .NET: point it at a type, bind one or more objects, and it builds a tree of the members, reads and writes them, and reports what it could not do. The core knows no UI framework; a view package shows the tree and edits it.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 248 10/12/2026
0.1.0 99 10/9/2026