Skip to content

6413/fan

Repository files navigation

fan

License

2D graphics library for OpenGL, designed to support various shapes, lighting, GUI elements, collisions, and particle effects.

Features

  • Shapes: Draw lines, rectangles, and sprite.
  • Lighting: Illuminate your scenes with customizable lighting effects.
  • GUI: Easily integrate graphical user interfaces into your applications.
  • Collisions Simple collisions Circle<->Circle, Rectangle<->Circle (no rotation for rectangles)

Limitations

  • Limited shapes for collisions
  • The library is still in development, bugs and missing features to be expected

Getting Started

Installation

Requires c++20

Windows

  1. Clone the repository: git clone https://github.com/6413/fan.git
  2. Using Visual Studio use fan.sln. Alternatively compile using clang++/g++ using make_imgui, make_pch, make, in order

Linux

  1. Install required dependencies libx11-dev, libxrandr-dev, libwebp-dev, libxcursor-dev, llvm, clang/gcc, libopus-dev, OpenGL, GLFW
  sudo apt install clang -y &&
  sudo apt install make -y &&
  sudo apt install libwebp-dev -y &&
  sudo apt install llvm -y &&
  sudo apt install clang -y &&
  sudo apt install libfmt-dev -y &&
  sudo apt install libglfw3-dev -y &&
  sudo apt install libopus-dev -y &&
  sudo apt install libx11-dev -y
  1. Clone the repository: git clone https://github.com/6413/fan.git
  2. Setup and compile using make -B -f make_imgui, make -f make_pch, make, in order

Main file can be controlled by MAIN-make variable for example make MAIN=examples/graphics/2D/shapes/rectangle.cpp

Notes for compiling with Makefile

Using the library from outside the project, change ROOT_PATH in Makefiles

Usage

  1. Hello world rectangle
    #include fan_pch
    
    int main() {
      loco_t loco;
    
      fan::graphics::rectangle_t rect{{
          .position = 400,
          .size = 200,
          .color = fan::colors::red
      }};
      
      loco.loop([&] {
    
      });
    }

Examples

Check out the examples directory for sample projects demonstrating various features of the library.

Demos

Game demo using fan

image

Developer console support (F3) image

quadtree_visualize image_2023-11-11_20-24-01

particles image_2023-11-11_20-29-09

tilemap_editor image_2023-11-11_20-32-21

sort_visualizer image_2023-11-11_20-33-48

function_graph image_2023-11-11_20-36-10

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

fan - opengl graphics lib

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages