#pragma once /** @file Renderer.hpp * @brief HDK sdl video header only wrapper for SDL_Renderer struct & related functions */ #include #include #include /** Renderers are used to render 2D graphics in SDL */ namespace hdk::sdl { class Window; /** * @brief Wraps the SDL_Renderer struct and related functions in a C++ class that uses shared_ptr for lifetime management. * * */ class Renderer : public hdk::grid::SharedPtrWrapper { public: friend class Window; friend std::pair CreateWindowAndRenderer( const char* title, int width, int height, SDL_WindowFlags window_flags); /** Inherit constructors from SharedPtrWrapper */ using hdk::grid::SharedPtrWrapper::SharedPtrWrapper; /// @todo https://wiki.libsdl.org/SDL3/SDL_AddVulkanRenderSemaphores /// @todo https://wiki.libsdl.org/SDL3/SDL_ConvertEventToRenderCoordinates /// @todo https://wiki.libsdl.org/SDL3/SDL_CreateGPURenderer /// @todo https://wiki.libsdl.org/SDL3/SDL_CreateGPURenderState /** @see https://wiki.libsdl.org/SDL3/SDL_CreateRenderer * @brief Create a renderer for a window. * @param window The window to create the renderer for. If the window is invalid, this function will return an * invalid renderer. * @param driverName The name of the rendering driver to initialize. If NULL, the first is used. * @return Renderer The created renderer. If the creation fails, returns an invalid renderer. */ static Renderer Create(SDL_Window* window, const char* driverName) { return Renderer(get_or_cache(SDL_CreateRenderer(window, driverName), SDL_DestroyRenderer)); } // SDL_CreateRendererWithProperties // https://wiki.libsdl.org/SDL3/SDL_CreateSoftwareRenderer static Renderer CreateSoftware(SDL_Surface* surface) { return Renderer(get_or_cache(SDL_CreateSoftwareRenderer(surface), SDL_DestroyRenderer)); } // https://wiki.libsdl.org/SDL3/SDL_CreateWindowAndRenderer // https://wiki.libsdl.org/SDL3/SDL_DestroyGPURenderState // https://wiki.libsdl.org/SDL3/SDL_DestroyRenderer /** @see https://wiki.libsdl.org/SDL3/SDL_FlushRenderer * @brief Flush the current rendering commands to the screen. * @return bool True if the renderer was successfully flushed, false otherwise. */ bool Flush() const { return SDL_FlushRenderer(*this); } // https://wiki.libsdl.org/SDL3/SDL_GDKResumeRenderer // https://wiki.libsdl.org/SDL3/SDL_GDKSuspendRenderer /** https://wiki.libsdl.org/SDL3/SDL_GetCurrentRenderOutputSize * @brief Get the output size in pixels of the current render target. * @param w A pointer to an int to be filled in with the width of the render output. If the renderer is invalid, * this will be set to 0. * @param h A pointer to an int to be filled in with the height of the render output. If the renderer is invalid, * this will be set to 0. * @return bool True if the output size was successfully retrieved, false otherwise. */ bool GetOutputSize(int* w, int* h) const { return SDL_GetRenderOutputSize(*this, w, h); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetDefaultTextureScaleMode * @brief Get the default texture scale mode for the renderer. * @param scaleMode A pointer to an SDL_ScaleMode variable to be filled in with the default texture scale mode for * the renderer. If the renderer is invalid, this will be set to SDL_ScaleMode_None. * @return bool True if the default texture scale mode was successfully retrieved, false otherwise. */ bool GetDefaultTextureScaleMode(SDL_ScaleMode* scaleMode) const { return SDL_GetDefaultTextureScaleMode(*this, scaleMode); } // https://wiki.libsdl.org/SDL3/SDL_GetGPURendererDevice // https://wiki.libsdl.org/SDL3/SDL_GetNumRenderDrivers /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderClipRect * @brief Get the clip rectangle for the current rendering target. * @param rect A pointer to an SDL_Rect structure to be filled in with the clip rectangle for the current * rendering target. If the renderer is invalid, this will be set to {0, 0, 0, 0}. * @return bool True if the clip rectangle was successfully retrieved, false otherwise. */ bool GetClipRect(SDL_Rect* rect) const { return SDL_GetRenderClipRect(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderColorScale * @brief Get the color scale for the renderer. * @param scale A pointer to a float to be filled in with the color scale for the renderer. If the renderer is * invalid, this will be set to 0.0f. * @return bool True if the color scale was successfully retrieved, false otherwise. */ bool GetColorScale(float* scale) const { return SDL_GetRenderColorScale(*this, scale); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderDrawBlendMode * @brief Get the blend mode used for drawing operations (Fill and Line). * @param blendMode A pointer to an SDL_BlendMode variable to be filled in with the blend mode used for drawing * operations. If the renderer is invalid, this will be set to SDL_BlendMode_None. * @return bool True if the blend mode was successfully retrieved, false otherwise. */ bool GetDrawBlendMode(SDL_BlendMode* blendMode) const { return SDL_GetRenderDrawBlendMode(*this, blendMode); } /* @see https://wiki.libsdl.org/SDL3/SDL_GetRenderDrawColor * @brief Get the color used for drawing operations (Fill and Line). * @param r A pointer to a Uint8 to be filled in with the red component of the drawing color. If the renderer is * invalid, this will be set to 0. * @param g A pointer to a Uint8 to be filled in with the green component of the drawing color. If the renderer is * invalid, this will be set to 0. * @param b A pointer to a Uint8 to be filled in with the blue component of the drawing color. If the renderer is * invalid, this will be set to 0. * @param a A pointer to a Uint8 to be filled in with the alpha component of the drawing color. If the renderer is * invalid, this will be set to 0. * @return bool True if the drawing color was successfully retrieved, false otherwise. */ bool GetDrawColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const { return SDL_GetRenderDrawColor(*this, r, g, b, a); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderDrawColorFloat * @brief Get the color used for drawing operations (Fill and Line) as floats. * @param r A pointer to a float to be filled in with the red component of the drawing color. If the renderer is * invalid, this will be set to 0.0f. * @param g A pointer to a float to be filled in with the green component of the drawing color. If the renderer is * invalid, this will be set to 0.0f. * @param b A pointer to a float to be filled in with the blue component of the drawing color. If the renderer is * invalid, this will be set to 0.0f. * @param a A pointer to a float to be filled in with the alpha component of the drawing color. If the renderer is * invalid, this will be set to 0.0f. * @return bool True if the drawing color was successfully retrieved, false otherwise. */ bool GetDrawColorFloat(float* r, float* g, float* b, float* a) const { return SDL_GetRenderDrawColorFloat(*this, r, g, b, a); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderDriver * @brief Get the name of a renderer driver specified by an index. * @param index The index of display driver to query, starting at 0. * @return const char* driver name string */ static const char* GetDriver(int index) { return SDL_GetRenderDriver(index); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderer * @brief Get the renderer associated with a window. * @param window The window to query * @return Renderer The renderer associated with the window */ static Renderer Get(SDL_Window* window) { /** we may not have created the renderer we get back, if not we will not own it. */ return Renderer(get_or_view(SDL_GetRenderer(window))); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRendererFromTexture * @brief Get the renderer associated with a texture. * @param texture The texture to query * @return Renderer The renderer associated with the texture */ static Renderer GetFromTexture(SDL_Texture* texture) { /** we may not have created the renderer we get back, if not we will not own it. */ return Renderer(get_or_view(SDL_GetRendererFromTexture(texture))); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRendererName * @brief Get the name of a renderer. * @return const char* The name of the renderer */ const char* GetName() const { return SDL_GetRendererName(*this); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRendererProperties * @brief Get the properties of a renderer. * @returns Properties associated with the renderer. */ Properties GetProperties() const { return Properties(SDL_GetRendererProperties(*this)); } /** @see https://wiki.libsdl.org/SDL_GetRenderLogicalPresentation * @brief device independent resolution and presentation mode * @param w pointer to store width * @param h pointer to store height * @param mode sdl enum value to store presentation mode * @return bool true on success */ bool GetLogicalPresentation(int* w, int* h, SDL_RendererLogicalPresentation* mode) const { return SDL_GetRenderLogicalPresentation(*this, w, h, mode); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderLogicalPresentationRect * @brief Get the logical presentation rectangle of a renderer. * @param rect pointer to store the logical presentation rectangle * @return bool true on success */ bool GetLogicalPresentationRect(SDL_FRect* rect) const { return SDL_GetRenderLogicalPresentationRect(*this, rect); } /** * @todo https://wiki.libsdl.org/SDL3/SDL_GetRenderMetalCommandEncoder * @todo https://wiki.libsdl.org/SDL3/SDL_GetRenderMetalLayer */ bool GetSafeArea(SDL_Rect* rect) const { return SDL_GetRenderSafeArea(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderScale * @brief Get the scale of the current render target. * @param scaleX A pointer to a float to be filled in with the horizontal scale factor. * @param scaleY A pointer to a float to be filled in with the vertical scale factor. * @return bool True on success */ bool GetScale(float* scaleX, float* scaleY) const { return SDL_GetRenderScale(*this, scaleX, scaleY); } /** @todo https://wiki.libsdl.org/SDL3/SDL_GetRenderTarget **/ /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderTextureAddressMode * @brief Get the texture address mode for the current render target. * @param u_mode A pointer to an SDL_TextureAddressMode variable * @param v_mode A pointer to an SDL_TextureAddressMode variable * @return bool True on success */ bool GetTextureAddressMode(SDL_TextureAddressMode* u_mode, SDL_TextureAddressMode* v_mode) const { return SDL_GetRenderTextureAddressMode(*this, u_mode, v_mode); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderViewport * @brief Get the viewport for the current render target. * @param rect A pointer to an SDL_Rect structure to be filled in with the viewport * @return bool True on success */ bool GetViewport(SDL_Rect* rect) const { return SDL_GetRenderViewport(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_GetRenderVSync * @brief Get the vertical sync setting for the current renderer. * @param vsync A pointer to an int to store the vertical sync setting * @return bool True on success */ bool GetVSync(int* vsync) const { return SDL_GetRenderVSync(*this, vsync); } /** @todo https://wiki.libsdl.org/SDL3/SDL_GetRenderWindow **/ /** @see https://wiki.libsdl.org/SDL3/SDL_RenderClear * @brief Clear the current rendering target with the drawing color. * @return bool True if the renderer was successfully cleared, false otherwise. */ bool Clear() const { return SDL_RenderClear(*this); } // /** @see https://wiki.libsdl.org/SDL3/SDL_RenderClipEnabled * @brief Check whether clipping is enabled for the current render target. * @return bool True if clipping is enabled, false otherwise. */ // https://wiki.libsdl.org/SDL3/SDL_RenderCoordinatesFromWindow /** @see https://wiki.libsdl.org/SDL3/SDL_RenderCoordinatesFromWindow * @brief Convert window coordinates to renderer coordinates. * @param windowX The x coordinate in window space * @param windowY The y coordinate in window space * @param rendererX A pointer to a float to be filled in with the x coordinate * @param rendererY A pointer to a float to be filled in with the y coordinate * @return bool True if the coordinates were successfully converted, false otherwise. */ bool CoordinatesFromWindow(float windowX, float windowY, float* rendererX, float* rendererY) const { return SDL_RenderCoordinatesFromWindow(*this, windowX, windowY, rendererX, rendererY); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderCoordinatesToWindow * @brief Convert renderer coordinates to window coordinates. * @param rendererX The x coordinate in renderer space * @param rendererY The y coordinate in renderer space * @param windowX A pointer to a float to be filled in with the x coordinate * @param windowY A pointer to a float to be filled in with the y coordinate * @return bool True if the coordinates were successfully converted, false otherwise. */ bool CoordinatesToWindow(float rendererX, float rendererY, float* windowX, float* windowY) const { return SDL_RenderCoordinatesToWindow(*this, rendererX, rendererY, windowX, windowY); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderDebugText * @brief Render debug text at a specific position in the current render target. * @param x The x coordinate of the text position * @param y The y coordinate of the text position * @param text The text to render * @return bool True if the text was successfully rendered, false otherwise. */ bool DebugText(float x, float y, const char* text) const { return SDL_RenderDebugText(*this, x, y, text); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderDebugTextFormat * @brief Render formatted debug text at a specific position in the current render target. * @param x The x coordinate of the text position * @param y The y coordinate of the text position * @param fmt The formatted text to render (printf-style format string) * @param args The arguments for the formatted text * @return bool True if the text was successfully rendered, false otherwise. */ template bool DebugTextFormat(float x, float y, const char* fmt, Args... args) const { return SDL_RenderDebugTextFormat(*this, x, y, fmt, args...); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderFillRect * @brief fill rectangle with current draw color * @param rect pointer to rectangle to fill, or NULL to fill the entire render target * @return bool true on success */ bool FillRect(const SDL_FRect* rect) const { return SDL_RenderFillRect(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderFillRects * @brief fill multiple rectangles with current draw color * @param rects pointer to array of rectangles to fill * @param count number of rectangles in the array * @return bool true on success */ bool FillRects(const SDL_FRect* rects, int count) const { return SDL_RenderFillRects(*this, rects, count); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderGeometry * @brief Render geometry with the current render target * @param texture The texture to use for rendering * @param vertices Pointer to an array of vertices * @param numVertices Number of vertices in the array * @param indices Pointer to an array of indices * @param numIndices Number of indices in the array * @return bool True on success, false on failure */ bool RenderGeometry( SDL_Texture* texture, const SDL_Vertex* vertices, int numVertices, const int* indices, int numIndices) const { return SDL_RenderGeometry(*this, texture, vertices, numVertices, indices, numIndices); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderGeometryRaw * @brief render a list of triangles with optional texture and index data * @param texture The texture to use for rendering, or NULL for no texture * @param xy Pointer to an array of 2D vertex positions (x, y) in normalized coordinates (0.0 to 1.0) * @param xy_stride The byte stride between consecutive vertex positions in the xy array * @param color Pointer to an array of vertex colors * @param color_stride The byte stride between consecutive vertex colors in the color array * @param uv Pointer to an array of texture coordinates (u, v) in normalized coordinates (0.0 to 1.0), or NULL if * not using textures * @param uv_stride The byte stride between consecutive texture coordinates in the uv array * @param numVertices The number of vertices in the xy, color, and uv arrays * @param indices Pointer to an array of vertex indices that define the triangles to render, or NULL to render the * vertices in sequential order * @param numIndices The number of indices * @param sizeIndices The byte size of each index in the indices array (1, 2, or 4 bytes) * @return bool True on success */ bool RenderGeometryRaw(SDL_Texture* texture, const float* xy, int xy_stride, const SDL_FColor* color, int color_stride, const float* uv, int uv_stride, int numVertices, const void* indices, int numIndices, int sizeIndices) const { return SDL_RenderGeometryRaw(*this, texture, xy, xy_stride, color, color_stride, uv, uv_stride, numVertices, indices, numIndices, sizeIndices); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderLine * @brief render line with current draw color * @param x1 * @param y1 * @param x2 * @param y2 * @return bool true on success */ bool RenderLine(float x1, float y1, float x2, float y2) const { return SDL_RenderLine(*this, x1, y1, x2, y2); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderLines * @brief render multiple lines with current draw color * @param points * @param count number of points in the array * @return bool true on success */ bool RenderLines(const SDL_FPoint* points, int count) const { return SDL_RenderLines(*this, points, count); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderPoint * @brief render point with current draw color * @param x * @param y * @return bool true on success */ bool RenderPoint(float x, float y) const { return SDL_RenderPoint(*this, x, y); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderPoints * @brief render multiple points with current draw color * @param points * @param count number of points in the array * @return bool true on success */ bool RenderPoints(const SDL_FPoint* points, int count) const { return SDL_RenderPoints(*this, points, count); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderPresent * @brief Update the screen with any rendering performed since the previous call. * @return bool True if the screen was successfully updated, false otherwise. */ bool Present() const { return SDL_RenderPresent(*this); } /** @todo https://wiki.libsdl.org/SDL3/SDL_RenderReadPixels */ /** @see https://wiki.libsdl.org/SDL3/SDL_RenderRect * @brief render rectangle outline with current draw color * @param rect pointer to rectangle to outline, or NULL to outline the entire render target * @return bool true on success */ bool RenderRect(const SDL_FRect* rect) const { return SDL_RenderRect(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderRects * @brief render multiple rectangle outlines with current draw color * @param rects pointer to array of rectangles to outline * @param count number of rectangles in the array * @return bool true on success */ bool RenderRects(const SDL_FRect* rects, int count) const { return SDL_RenderRects(*this, rects, count); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderTexture * @brief Render texture * @param texture * @param src * @param dst * @return bool true on success */ bool RenderTexture(SDL_Texture* texture, const SDL_FRect* src, const SDL_FRect* dst) const { return SDL_RenderTexture(*this, texture, src, dst); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderTexture9Grid * @brief Render a texture with 9-grid scaling * @param texture * @param src * @param left_width * @param right_width * @param top_height * @param bottom_height * @param scale * @param dst * @return bool true on success */ bool RenderTexture9Grid(SDL_Texture* texture, const SDL_FRect* src, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect* dst) const { return SDL_RenderTexture9Grid( *this, texture, src, left_width, right_width, top_height, bottom_height, scale, dst); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderTexture9GridTiled * @brief Render a texture with 9-grid scaling and tiling * @param texture * @param src * @param left_width * @param right_width * @param top_height * @param bottom_height * @param scale * @param dst * @param tile_scale * @return bool true on success */ bool RenderTexture9GridTiled(SDL_Texture* texture, const SDL_FRect* src, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect* dst, float tile_scale) const { return SDL_RenderTexture9GridTiled( *this, texture, src, left_width, right_width, top_height, bottom_height, scale, dst, tile_scale); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderTextureAffine * @brief Render a texture with affine transformations * @param texture * @param src * @param origin * @param right * @param down * @return bool true on success */ bool RenderTextureAffine(SDL_Texture* texture, const SDL_FRect* src, const SDL_FPoint* origin, const SDL_FPoint* right, const SDL_FPoint* down) const { return SDL_RenderTextureAffine(*this, texture, src, origin, right, down); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderTextureRotated * @brief Render a texture with rotation and flipping * @param texture * @param srcrect * @param dstrect * @param angle * @param center * @param flip * @return bool true on success */ bool RenderTextureRotated(SDL_Texture* texture, const SDL_FRect* srcrect, const SDL_FRect* dstrect, double angle, const SDL_FPoint* center, SDL_FlipMode flip) const { return SDL_RenderTextureRotated(*this, texture, srcrect, dstrect, angle, center, flip); } /** @see https://wiki.libsdl.org/SDL3/SDL_RenderTextureTiled * @brief Render a texture with tiling * @param texture * @param srcrect * @param scale * @param dstrect * @param tile_scale * @return bool true on success */ bool RenderTextureTiled( SDL_Texture* texture, const SDL_FRect* srcrect, float scale, const SDL_FRect* dstrect, float tile_scale) const { return SDL_RenderTextureTiled(*this, texture, srcrect, scale, dstrect); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetDefaultTextureScaleMode * @brief Set the default texture scale mode for the renderer. * @param scaleMode The default texture scale mode for the renderer. * @return bool True if the default texture scale mode was successfully set, false otherwise. */ bool SetDefaultTextureScaleMode(SDL_ScaleMode scaleMode) const { return SDL_SetDefaultTextureScaleMode(*this, scaleMode); } /** @todo https://wiki.libsdl.org/SDL3/SDL_SetGPURenderState // https://wiki.libsdl.org/SDL3/SDL_SetGPURenderStateFragmentUniforms // https://wiki.libsdl.org/SDL3/SDL_SetGPURenderStateSamplerBindings // https://wiki.libsdl.org/SDL3/SDL_SetGPURenderStateStorageBuffers // https://wiki.libsdl.org/SDL3/SDL_SetGPURenderStateStorageTextures **/ /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderClipRect * @brief Set the clip rectangle for the current rendering target. * @param rect * @return bool true on success */ bool SetClipRect(const SDL_Rect* rect) const { return SDL_SetRenderClipRect(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderColorScale * @brief Set the color scale for the renderer. * @param scale The color scale for the renderer. * @return bool true on success */ bool SetRenderColorScale(float scale) const { return SDL_SetRenderColorScale(*this, scale); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderDrawBlendMode * @brief Set the blend mode used for drawing operations (Fill and Line). * @param blendMode The blend mode used for drawing operations. * @return bool true on success */ bool SetDrawBlendMode(SDL_BlendMode blendMode) const { return SDL_SetRenderDrawBlendMode(*this, blendMode); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderDrawColor * @brief Set the color used for drawing operations (Fill and Line). * @param r The red component of the drawing color * @param g The green component of the drawing color * @param b The blue component of the drawing color * @param a The alpha component of the drawing color * @return bool true on success */ bool SetDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) const { return SDL_SetRenderDrawColor(*this, r, g, b, a); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderDrawColorFloat * @brief Set the color used for drawing operations (Fill and Line) as floats. * @param r The red component of the drawing color * @param g The green component of the drawing color * @param b The blue component of the drawing color * @param a The alpha component of the drawing color * @return bool true on success */ bool SetDrawColorFloat(float r, float g, float b, float a) const { return SDL_SetRenderDrawColorFloat(*this, r, g, b, a); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderLogicalPresentation * @brief Set the logical presentation for the renderer. * @param w The width of the logical presentation * @param h The height of the logical presentation * @param mode The presentation mode for the logical presentation * @return bool true on success */ bool SetLogicalPresentation(int w, int h, SDL_RendererLogicalPresentation mode) const { return SDL_SetRenderLogicalPresentation(*this, w, h, mode); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderScale * @brief Set the scale for the current render target. * @param scaleX The horizontal scale factor * @param scaleY The vertical scale factor * @return bool true on success */ bool SetScale(float scaleX, float scaleY) const { return SDL_SetRenderScale(*this, scaleX, scaleY); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderTarget * @brief Set the render target to a texture or the default render target. * @param texture The texture to set as the render target, or NULL to set the default render target * @return bool true on success */ bool SetRenderTarget(SDL_Texture* texture) const { return SDL_SetRenderTarget(*this, texture); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderTextureAddressMode * @brief Set the texture address mode for the current render target. * @param u_mode The texture address mode for the horizontal direction * @param v_mode The texture address mode for the vertical direction * @return bool true on success */ bool SetTextureAddressMode(SDL_TextureAddressMode u_mode, SDL_TextureAddressMode v_mode) const { return SDL_SetRenderTextureAddressMode(*this, u_mode, v_mode); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderViewport * @brief Set the viewport for the current render target. * @param rect A pointer to an SDL_Rect structure representing the viewport, or NULL to use the entire render * target. * @return bool True if the viewport was successfully set, false otherwise. */ bool SetViewport(const SDL_Rect* rect) const { return SDL_SetRenderViewport(*this, rect); } /** @see https://wiki.libsdl.org/SDL3/SDL_SetRenderVSync * @brief Set the vertical sync setting for the current renderer. * @param vsync The vertical sync setting to use (0 for no vsync, 1 for vsync, -1 for adaptive vsync) * @return bool True on success, false on failure */ bool SetVSync(int vsync) const { return SDL_SetRenderVSync(*this, vsync); } /// Forward declare: implemented in ../video.hpp to avoid circular dependency Window GetWindow() const; }; }