22#ifndef SDL2PP_RENDERER_HH
23#define SDL2PP_RENDERER_HH
25#include <SDL_stdinc.h>
26#include <SDL_blendmode.h>
28#include <SDL2pp/Config.hh>
29#include <SDL2pp/Optional.hh>
30#include <SDL2pp/Point.hh>
31#include <SDL2pp/Rect.hh>
32#include <SDL2pp/Export.hh>
33#include <SDL2pp/Color.hh>
35struct SDL_RendererInfo;
54 SDL_Renderer* renderer_;
63 explicit Renderer(SDL_Renderer* renderer);
129 SDL_Renderer* Get()
const;
176 void GetInfo(SDL_RendererInfo& info);
194 Renderer& Copy(
Texture& texture,
const Optional<Rect>& srcrect = NullOpt,
const Optional<Rect>& dstrect = NullOpt);
237 Renderer& Copy(
Texture& texture,
const Optional<Rect>& srcrect,
const Optional<Rect>& dstrect,
double angle,
const Optional<Point>& center = NullOpt,
int flip = 0);
263 Renderer& Copy(
Texture& texture,
const Optional<Rect>& srcrect,
const SDL2pp::Point& dstpoint,
double angle,
const Optional<Point>& center = NullOpt,
int flip = 0);
286 Renderer& FillCopy(
Texture& texture,
const Optional<Rect>& srcrect = NullOpt,
const Optional<Rect>& dstrect = NullOpt,
const Point& offset =
Point(0, 0),
int flip = 0);
303 Renderer& SetDrawColor(Uint8 r = 0, Uint8 g = 0, Uint8 b = 0, Uint8 a = 255);
359 Renderer& SetDrawBlendMode(SDL_BlendMode blendMode = SDL_BLENDMODE_NONE);
420 Renderer& DrawLine(
int x1,
int y1,
int x2,
int y2);
467 Renderer& DrawRect(
int x1,
int y1,
int x2,
int y2);
528 Renderer& FillRect(
int x1,
int y1,
int x2,
int y2);
591 void ReadPixels(
const Optional<Rect>& rect, Uint32 format,
void* pixels,
int pitch);
606 Renderer& SetClipRect(
const Optional<Rect>& rect = NullOpt);
621 Renderer& SetLogicalSize(
int w,
int h);
636 Renderer& SetScale(
float scaleX,
float scaleY);
651 Renderer& SetViewport(
const Optional<Rect>& rect = NullOpt);
662 bool TargetSupported()
const;
673 Optional<Rect> GetClipRect()
const;
687 Point GetLogicalSize()
const;
701 int GetLogicalWidth()
const;
715 int GetLogicalHeight()
const;
726 void GetScale(
float& scalex,
float& scaley)
const;
736 float GetXScale()
const;
746 float GetYScale()
const;
756 Rect GetViewport()
const;
768 SDL_BlendMode GetDrawBlendMode()
const;
780 Color GetDrawColor()
const;
795 void GetDrawColor(Uint8& r, Uint8& g, Uint8& b, Uint8& a)
const;
807 Point GetOutputSize()
const;
819 int GetOutputWidth()
const;
831 int GetOutputHeight()
const;
RGB color with Alpha.
Definition: Color.hh:48
2D point
Definition: Point.hh:51
2D rectangle
Definition: Rect.hh:50
2D rendering context
Definition: Renderer.hh:52
Renderer & operator=(const Renderer &other)=delete
Deleted assignment operator.
Renderer(const Renderer &other)=delete
Deleted copy constructor.
Image stored in the graphics card memory that can be used for fast drawing.
Definition: Texture.hh:53
GUI window object.
Definition: Window.hh:67