draw  0.0.0
draw

C++11 cross-platform GPU-accelerated pixel-space 2D drawing library.

API documentation | Contributing | FAQ

Features

How to use

The project is using CMake as build solution.
You can build the library using one of the modern compiler: Clang, GCC, MSVC.
Some dependencies (GLEW, AGG, FreeType) are required. You can find it in deps folder and build by yourself.

See draw-wxWidgets repo as example of using the library with wxWidgets.

Licensing

The library is licensed under the Simplified BSD License.

Example

using namespace draw;
class MyContext final : public Context {
public:
/*...*/
virtual void setCurrent() final { mySetCurrent(); }
};
auto renderer = makeRenderer(std::move(make_unique<MyContext>(/*...*/)));
auto image = renderer->makeImage({32, 32}, Image::Format::RGBA, true);
image->upload({dataPtr, dataSize});
auto rect = renderer->makeRect();
rect->position({10, 20});
rect->size({30, 30});
rect->color({1.0f, 0.5f, 0.5f});
rect->image(image);
rect->visibility(true);
auto text = renderer->makeText();
text->position({10, 60});
text->font(renderer->makeFont("cour.ttf", 10));
text->text(L"ABCDEFG");
text->visibility(true);
renderer->resize(myScreenSize);
renderer->draw({0.8f, 0.8f, 0.8f});
mySwapBuffers();