Skip to content

Carbone13/mather

Repository files navigation


Logo
Mather

GitHub Actions License: MIT

A library to draw 2D primitives shapes quickly and efficiently.

About The ProjectHow To UseExamplesDependencies

About The Project

Mather is a library that allow you to quickly create a windows and to draw simple 2D Shapes.

Currently supporting :

  • Line
  • Poly Line
  • Circle
  • Rect
  • Polygon

How to Use

Importing

Add the library as a dependencies, the most elegant way is to clone it as a git submodule :

git submodule add https://github.com/Carbone13/mather.git
git submodule update --init --recursive

Then add it to your CMakeLists.txt and link to your executable :

add_subdirectory(path/to/mather)
...
target_link_libraries(your_project mather)

Usage

The code below demonstrate how to spawn the window and start a rendering loop

#include "mather.hpp"

int main()
{
    mather::Context ctx = mather::Context();
    while (!ctx.closeRequested())
    {
        ctx.beginFrame();
        // Here come your rendering code !
        ctx.endFrame();
    }

    return 0;
}

You don't need to use this loop at all, you can instead use your own one, just note that you need to surround any draw calls with beginFrame() and endFrame()

The closeRequested() is set to true when the user click on the close button of the window.

TODO : Support custom surface plugging

Examples

See main.cpp in demo

Dependencies

This project depend on 2 libraries :

  • GLFW for windowing and creating the surface
  • AGG for sub-pixel anti-aliasing

About

C++ Primitive rendering library.

Resources

License

Stars

Watchers

Forks