X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Finit.cpp;h=6fa2dfd6c0b9722c2856de9cc528ac035fdaac7b;hb=695918769a616db82dbebb987ea91f3204dee8a9;hp=a56674c309506b5ac8f0876be5338b8241dfebf3;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;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); }