X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Finit.cpp;h=9c97c9f4b31432b212149efc1e2d30338eb317d0;hb=2c2c02796e9df82d0cda12b59aad638d40b4e8b4;hp=a56674c309506b5ac8f0876be5338b8241dfebf3;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/app/init.cpp b/src/app/init.cpp index a56674c..9c97c9f 100644 --- a/src/app/init.cpp +++ b/src/app/init.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,17 @@ InitIMG::~InitIMG() { } +InitTTF::InitTTF() { + if (TTF_Init() != 0) { + sdl_error("TTF_Init()"); + } +} + +InitTTF::~InitTTF() { + TTF_Quit(); +} + + InitGL::InitGL(bool double_buffer, int sample_size) { if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3) != 0) { sdl_error("SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)"); @@ -158,6 +170,20 @@ void GLContext::EnableBackfaceCulling() noexcept { glEnable(GL_CULL_FACE); } +void GLContext::EnableAlphaBlending() noexcept { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +} + +void GLContext::EnableInvertBlending() noexcept { + glEnable(GL_BLEND); + glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); +} + +void GLContext::DisableBlending() noexcept { + glDisable(GL_BLEND); +} + void GLContext::Clear() noexcept { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }