Files
2026-05-11 10:28:21 +00:00

26 lines
1.2 KiB
C++

#pragma once
/// @file render.hpp
/// For complete documentation, see src/render.cpp
#include <hdk/sdl/render/Renderer.hpp>
#include <hdk/sdl/render/Texture.hpp>
namespace hdk::sdl {
inline Renderer Texture::GetRenderer() const {
/** we may not have created the renderer we get back, if not we will not own it. */
return Renderer(Renderer::get_or_view(SDL_GetRendererFromTexture(*this)));
}
inline Texture Renderer::CreateTexture(SDL_PixelFormat format, SDL_TextureAccess access, int w, int h) const {
return Texture(Texture::get_or_cache(SDL_CreateTexture(*this, format, access, w, h), SDL_DestroyTexture));
}
inline Texture Renderer::CreateTextureFromSurface(SDL_Surface* surface) const {
return Texture(Texture::get_or_cache(SDL_CreateTextureFromSurface(*this, surface), SDL_DestroyTexture));
}
inline Texture Renderer::CreateTextureWithProperties(SDL_PropertiesID properties) const {
return Texture(Texture::get_or_cache(SDL_CreateTextureWithProperties(*this, properties), SDL_DestroyTexture));
}
inline Texture Renderer::GetRenderTarget() const {
/** we may not have created the texture we get back, if not we will not own it. */
return Texture(Texture::get_or_view(SDL_GetRenderTarget(*this)));
}
}