Added some inline wrappers for SDL_SetTexture* functions

This commit is contained in:
Charles Dang 2017-06-20 18:35:45 +11:00
parent ca44435550
commit f7de368551
2 changed files with 23 additions and 1 deletions

View file

@ -106,3 +106,24 @@ using render_clip_rect_setter = render_raii_rect_setter_base<
using render_viewport_setter = render_raii_rect_setter_base<
&SDL_RenderGetViewport,
&SDL_RenderSetViewport>;
/*
* TEXTURE SETTERS =========================================================================
* Need to decide if these need their own file.
*/
inline void set_texture_alpha(texture& t, uint8_t amount)
{
SDL_SetTextureAlphaMod(t, amount);
}
inline void set_texture_blend_color(texture& t, uint8_t r, uint8_t g, uint8_t b)
{
SDL_SetTextureColorMod(t, r, g, b);
}
inline void set_texture_blend_mode(texture& t, SDL_BlendMode mode)
{
SDL_SetTextureBlendMode(t, mode);
}

View file

@ -14,6 +14,7 @@
#include "sdl/texture.hpp"
#include "log.hpp"
#include "sdl/render_utils.hpp"
#include "sdl/surface.hpp"
#include "video.hpp"
@ -71,7 +72,7 @@ texture::texture(int w, int h, SDL_TextureAccess access)
void texture::finalize()
{
SDL_SetTextureBlendMode(texture_.get(), SDL_BLENDMODE_BLEND);
set_texture_blend_mode(*this, SDL_BLENDMODE_BLEND);
}
void texture::reset(int w, int h, SDL_TextureAccess access)