2D graphics library using OpenGL 3.3, (Vulkan Alpha).
- Shapes: lines, circles, rectangles, sprites, etc.
- Depth sorting
- Batch rendering
- Lighting
- GUI
- Collisions:
- Continuous collision detection
- Contact events and sensors
- Convex polygons, capsules, circles, rounded polygons, segments, and chains
- Multiple shapes per body
- Collision filtering
- Ray casts, shape casts, and overlap queries
- Image formats:
- JPEG (baseline & progressive)
- PNG (1/2/4/8/16-bit-per-channel)
- TGA (a subset)
- BMP (non-1bpp, non-RLE)
- PSD (composited view only, no extra channels, 8/16 bit-per-channel)
- GIF (always reports as 4-channel)
- HDR (radiance rgbE format)
- PIC (Softimage PIC)
- PNM (PPM and PGM binary only)
- WebP
- Audio: Currently only SAC is supported.
- Requirements:
- C++23 (modules)
- Clang >= 20
- CMake >= 2.8.*
- Ninja >= 1.11.1
-
Clone the repository:
git clone https://github.com/6413/fan.git -
Install required dependencies:
sudo ./apt_install.sh(optional)./install.sh(
./uninstall.sh) to remove repos from /usr/local/include/* -
Main usage:
- To compile main use
./xcompile_main.sh, which also compiles fan
- Clone the repository:
git clone https://github.com/6413/fan.git - Code compiles using Visual Studio, external libraries are to be installed.
- Hello world rectangle:
// Creates graphics engine that opens a window and draws: // red rectangle at the position (400, 400), size 200x200 in pixels. import fan; int main() { fan::graphics::engine_t engine; fan::graphics::rectangle_t rect{{ .position = 400, .size = 200, .color = fan::colors::red }}; engine.loop(); }
- Text rendering:
// Creates graphics engine that opens a window and draws: // red text at the top-left of window (0, 0) and // green text at the bottom-right using immediate-mode GUI. import fan; int main() { fan::graphics::engine_t engine; engine.loop([]{ fan::graphics::gui::text("top left", fan::vec2(0, 0), fan::colors::red); fan::graphics::gui::text_bottom_right("bottom right", fan::colors::green); }); }
tilemap editor
Older versions

This project is licensed under the MIT License, however some external libraries might have different license - see the LICENSE file for details.





