A library to draw 2D primitives shapes quickly and efficiently.
About The Project • How To Use • Examples • Dependencies
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
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)
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
This project depend on 2 libraries :