aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLContext.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 19:18:41 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 19:18:41 +0100
commitcffa9f014c67133dc48569beb53a5bd6cb166faa (patch)
treeddbc7e83cb71f1b94f0052ebc912b0027b4be921 /src/crepe/facade/SDLContext.cpp
parent9e1d1f0952ed09ee4b0c241fad3d0d66b380b1a3 (diff)
rendering color working
Diffstat (limited to 'src/crepe/facade/SDLContext.cpp')
-rw-r--r--src/crepe/facade/SDLContext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index cfe79d2..aaaec6b 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -1,4 +1,5 @@
#include <SDL2/SDL.h>
+#include <SDL2/SDL_blendmode.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_keycode.h>
#include <SDL2/SDL_rect.h>
@@ -9,6 +10,7 @@
#include <cstddef>
#include <cstdint>
#include <functional>
+#include <iostream>
#include <memory>
#include <stdexcept>
@@ -215,6 +217,7 @@ SDLContext::texture_from_path(const std::string & path) {
std::unique_ptr<SDL_Texture, std::function<void(SDL_Texture *)>> img_texture;
img_texture = {tmp_texture, [](SDL_Texture * texture) { SDL_DestroyTexture(texture); }};
+ SDL_SetTextureBlendMode(img_texture.get(), SDL_BLENDMODE_BLEND);
return img_texture;
}
int SDLContext::get_width(const Texture & ctx) const {
@@ -235,5 +238,6 @@ void SDLContext::set_rbg_texture(const Texture & texture, const uint8_t & r,
}
void SDLContext::set_alpha_texture(const Texture & texture,
const uint8_t & alpha) {
+
SDL_SetTextureAlphaMod(texture.texture.get(), alpha);
}