2D graphics library using OpenGL 3.3, (Vulkan Alpha).
- Shapes: line, circle, rectangle, sprite, etc...
- Lighting: Library supports lighting.
- GUI: (Dear ImGui) Uses Dear ImGui for the GUI.
- Collisions (Box2D):
- 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
./compile_main.sh -DMAIN="examples/engine_demos/engine_demo.cpp", which also compiles fan
- Using
-DBUILD_FAN_LIBRARY=can be set to eitherSTATICorSHARED
- 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); }); }
Check out the examples directory for sample projects demonstrating various features of the library.
Engine Demo that is kept up to date with newest library usage.
A program that demonstrates fan's and the engine's features

Developer console support (F3)

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








