asge::video::IRenderer abstract
#include <Renderer.hpp>Inherited by asge::video::SDLRenderer.
Inheritance
classDiagram
class N1["asge::video::IRenderer"]
class N2["asge::video::SDLRenderer"]
N1 <|-- N2
click N1 href "classasge_1_1video_1_1IRenderer.html"
click N2 href "classasge_1_1video_1_1SDLRenderer.html"
Public Member Functions
virtual ~IRenderer()=defaultvirtual void Clear(graphics::RGBA_Color const &inColor) const =0virtual void DrawRect(math::Rect const &inRect, graphics::RGBA_Color const &inColor, bool inFill) const =0Draw a rectangle to screen.
Draw a rectangle to screen given the input position (X, Y), the dimension (W = width, H = height) and the filling color (RGBA).
virtual void DrawLine(math::Float2 const &inC1, math::Float2 const &inC2, graphics::RGBA_Color const &inColor) const =0virtual void DrawCircle(math::Int2 const &inCenter, int inRadius, graphics::RGBA_Color const &inColor, bool inFill) const =0Draw a circle to screen.
Draws the outline (or filled interior) of a circle, rasterized via math::MidpointCirclePoints.
virtual void DrawTexture(ITexture const &inTexture, math::Rect const &inDestRect) const noexcept=0Draw a texture to screen, scaled into the given destination rect.
inTexture | the texture to draw |
inDestRect | the destination rectangle (position + size) to draw into |
virtual void DrawTexture(ITexture const &inTexture, math::Float2 const &inPosition) const noexcept=0Draw a texture to screen at native size.
Draws the texture at the given position using its own width/height (from ITexture::Size()) — no scaling.
inTexture | the texture to draw |
inPosition | the top-left position to draw at |
virtual void DrawTexture(ITexture const &inTexture, math::Rect const &inSrcRect, math::Rect const &inDestRect) const noexcept=0Draw a sub-region of a texture, scaled into the given destination rect.
Draws only the portion of inTexture within inSrcRect, stretched to fill inDestRect. Used for atlas-backed content (e.g. glyphs) where each draw call needs one small slice of a shared texture rather than the whole thing.
inTexture | the texture to draw from |
inSrcRect | the source rectangle within inTexture, in pixels |
inDestRect | the destination rectangle (position + size) to draw into |
virtual void DrawTexture9Grid(ITexture const &inTexture, float inLeft, float inRight, float inTop, float inBottom, math::Rect const &inDestRect) const noexcept=0Draw a texture using nine-slice (9-grid) scaling.
Splits the texture into a 3x3 grid using the given margins. Corners are drawn unscaled, edges stretch along one axis, and the center stretches to fill the remaining space — keeps borders/corners crisp regardless of destination size. Typical use: UI panels, buttons, dialog boxes.
inTexture | the texture to draw |
inLeft | width of the left margin, in texture pixels |
inRight | width of the right margin, in texture pixels |
inTop | height of the top margin, in texture pixels |
inBottom | height of the bottom margin, in texture pixels |
inDestRect | the destination rectangle to fill |
virtual void DrawTextureTiled(ITexture const &inTexture, float inScale, math::Rect const &inDestRect) const noexcept=0Draw a texture repeated (tiled) to fill a destination rectangle.
Instead of stretching the source texture to fit, repeats it like a wallpaper pattern, clipped to inDestRect. Typical use: backgrounds, tilemaps, scrolling layers.
inTexture | the texture to draw |
inScale | scale applied to each tile before repeating (1.0 = native size) |
inDestRect | the destination rectangle to fill |
virtual void DrawTextureAffine(ITexture const &inTexture, math::Float2 const &inOrigin, math::Float2 const &inRight, math::Float2 const &inDown) const noexcept=0Draw a texture using an arbitrary affine transform.
Maps the texture's (0,0)/(w,0)/(0,h) corners to inOrigin/inRight/inDown on screen. Supports rotation, shear, and non-uniform scale in one call.
inTexture | the texture to draw |
inOrigin | where the texture's top-left (0,0) lands on screen |
inRight | where the texture's top-right (w,0) lands on screen |
inDown | where the texture's bottom-left (0,h) lands on screen |
virtual void DrawTextureAffine(ITexture const &inTexture, math::Rect const &inSrcRect, math::Float2 const &inOrigin, math::Float2 const &inRight, math::Float2 const &inDown) const noexcept=0Draw a sub-region of a texture using an arbitrary affine transform.
Same mapping as the whole-texture DrawTextureAffine overload, except inOrigin/inRight/inDown correspond to inSrcRect's own top-left/ top-right/bottom-left corners rather than the whole texture's — needed to draw a rotated sprite cropped to one cell of a larger spritesheet (e.g. an animation frame).
inTexture | the texture to draw from |
inSrcRect | the source rectangle within inTexture, in pixels |
inOrigin | where inSrcRect's top-left corner lands on screen |
inRight | where inSrcRect's top-right corner lands on screen |
inDown | where inSrcRect's bottom-left corner lands on screen |
virtual void DrawString(str::StringView inText, media::Font const &inFont, ITexture &inTexture, math::Float2 const &inPosition, graphics::RGBA_Color const &inColor) const noexcept=0Draw a string of text using a baked Font and its uploaded atlas texture.
Renders characters from a fixed baked ASCII range (see Font::Load). Codepoints outside that range are skipped. Tints the shared atlas texture via inTexture's color mod before drawing, so all glyphs in this call share inColor.
inFont | the loaded font providing glyph metrics |
inTexture | the atlas texture uploaded from inFont.GetAtlasImage() |
inText | the text to draw |
inPosition | the baseline-relative pen start position |
inColor | tint applied to the (alpha-only) atlas glyphs |
virtual void Present() const =0virtual bool IsValid() const =0virtual void * NativeHandle() const noexcept=0virtual void SetCamera(Camera const &inCamera)=0Sets the camera every subsequent draw call is transformed through.
Every draw call (DrawRect, DrawTexture*, DrawLine, DrawCircle, ...) maps its world-space coordinates to screen space via inCamera before rendering see Camera.hpp's WorldToScreen/TransformRect.
virtual void SetViewport(Viewport const &inViewport)=0Sets the screen-space viewport draw calls are clipped/offset into.
Backed by the native renderer's own viewport support (e.g. SDL_SetRenderViewport), so clipping outside inViewport is handled by the backend rather than by this class.