X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Finit.cpp;h=6fa2dfd6c0b9722c2856de9cc528ac035fdaac7b;hb=282d731ea8f10342efa82012028de7043b3dd639;hp=a56674c309506b5ac8f0876be5338b8241dfebf3;hpb=19dfd78d4269d56bd34ab72f6b701be9f84b9719;p=blank.git diff --git a/src/app/init.cpp b/src/app/init.cpp index a56674c..6fa2dfd 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,15 @@ 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::DisableAlphaBlending() noexcept { + glDisable(GL_BLEND); +} + void GLContext::Clear() noexcept { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }