Fraglib 0.3.3
dotnet add package Fraglib --version 0.3.3
NuGet\Install-Package Fraglib -Version 0.3.3
<PackageReference Include="Fraglib" Version="0.3.3" />
<PackageVersion Include="Fraglib" Version="0.3.3" />
<PackageReference Include="Fraglib" />
paket add Fraglib --version 0.3.3
#r "nuget: Fraglib, 0.3.3"
#:package Fraglib@0.3.3
#addin nuget:?package=Fraglib&version=0.3.3
#tool nuget:?package=Fraglib&version=0.3.3
Fraglib
A powerful and simple-to-learn library that allows you to use C# like a fragment shader.
NOTE: This library is still in very early stages of development, and is in no way final. See Fraglib on NuGet to see what the latest version is.
Index
Features
- DrawClear Mode: Individual control over every pixel on the window + helpful methods such as FillPolygon, DrawTexture, etc..
- PerPixel Mode: A perPixel function that runs for every pixel on the window and a perFrame function that runs each frame.
- Many customizable settings: Fraglib has lots of settings to get the ideal setup for your project, e.g. you can set the pixel size to any number (>= 1) without making other changes to your program.
- Time-saving functions: Fraglib provides a large library containing many functions that are commonly used in development, e.g. a deterministic random or common GLSL functions like Fract.
Getting Started
Fraglib can be easily installed as a NuGet package.
dotnet add package Fraglib --version *
PerPixel Mode Example
using Fraglib;
// VSync must be off to set TargetFramerate
FL.Settings.VSync = false;
FL.Settings.TargetFramerate = 60;
// x = pixel x, y = pixel y, u = uniforms
FL.Init(1024, 768, "Window", (x, y, u) => {
float uvx = (float)x / u.Width, uvy = (float)y / u.Height;
return FL.NewColor(uvx, uvy, 0f);
}, () => { // no parameters = called once per frame
FL.DrawString("UV Gradient", 12, 12, 9, FL.White);
});
FL.Run();
/* inlined code above could also be written as below
FL.Init(1024, 768, "Window", PerPixel, PerFrame);
FL.Run();
uint PerPixel(int x, int y, Uniforms u) {
// ...
}
void PerFrame() {
// ...
}
*/
DrawClear Mode Example
using Fraglib;
const int W = 1024, H = 768;
float ballX = W / 2f;
float ballY = H / 2f;
float ballRadius = 50f;
float ballSpeedX = 700f;
float ballSpeedY = 700f;
FL.Init(W, H, "Rainbow Ball", () => {
// clear the last frame
FL.Clear();
// update ball position
ballX += ballSpeedX * FL.DeltaTime;
ballY += ballSpeedY * FL.DeltaTime;
// handle collision with screen edges
if (ballX + ballRadius >= FL.Width || ballX - ballRadius <= 0) {
ballSpeedX *= -1f;
}
if (ballY + ballRadius >= FL.Height || ballY - ballRadius <= 0) {
ballSpeedY *= -1f;
}
// draw the ball
FL.FillCircle((int)ballX, (int)ballY, (int)ballRadius, FL.Rainbow());
});
FL.Run();
You may have noticed there is nothing like "FL.Close()", which is on purpose. There's no unbinding, unloading, etc., everything is done for you behind the scenes.
If you're intrigued by these snippets, I implore you to check out the gallery or tutorial.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net7.0
- OpenTK (>= 4.7.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.3.3 | 219 | 1/11/2024 |
0.3.1 | 196 | 12/25/2023 |
0.3.0 | 176 | 12/10/2023 |
0.2.6 | 137 | 12/1/2023 |
0.2.5 | 154 | 11/15/2023 |
0.2.4 | 132 | 11/12/2023 |
0.2.3 | 168 | 10/1/2023 |
0.2.2 | 142 | 9/24/2023 |
0.2.1 | 157 | 9/17/2023 |
0.2.0 | 179 | 9/7/2023 |
0.1.8 | 165 | 9/6/2023 |
0.1.7 | 174 | 8/29/2023 |
0.1.6 | 158 | 8/17/2023 |
0.1.5 | 179 | 8/15/2023 |
0.1.4 | 196 | 8/4/2023 |
0.1.3 | 186 | 7/28/2023 |
0.1.2 | 196 | 7/18/2023 |
0.1.1 | 197 | 7/16/2023 |
0.1.0 | 200 | 7/16/2023 |