1 #ifndef DRAWCONTEXT_HPP
2 #define DRAWCONTEXT_HPP
74 void SetColor(
short r,
short g,
short b,
short a = 255);
82 void DrawLineEx(
float x1,
float y1,
float x2,
float y2,
float width = 1.0);
97 void DrawRect(
int x,
int y,
int w,
int h);
122 void Push(std::shared_ptr<SDLTexture>,
int width,
int height);
156 float base_scale = 1.0, scale = 1.0;
158 inline float TotalScale(){
return base_scale * scale;}
162 SDL_Renderer* renderer;
166 std::shared_ptr<SDLTexture> current_target =
nullptr;
169 DCLevel(std::shared_ptr<SDLTexture> t,
int x,
int y,
int w,
int h,
Point2D off,
float bs,
float s) :
170 target(t), xoffset(x), yoffset(y), width(w), height(h), offset(off), base_scale(bs), scale(s) {}
171 std::shared_ptr<SDLTexture> target;
172 int xoffset, yoffset, width, height;
174 float base_scale, scale;
177 std::stack<DCLevel> context_stack;
179 void SwitchToTarget(std::shared_ptr<SDLTexture>);
181 void UpdateClipRect();
186 #endif // DRAWCONTEXT_HPP
void DrawRect(Rect r)
Definition: DrawContext.hpp:98
Size2D Size()
Definition: DrawContext.hpp:108
void SetScale(float s)
Definition: DrawContext.hpp:132
Definition: Utilities.hpp:104
void DrawCubicBezier(Point2D p1, Point2D p2, Point2D p3, Point2D p4, float width, unsigned int segments=15)
void DrawText(std::shared_ptr< SDLTextTexture > text, Color c, Point2D p=Point2D(0, 0))
Definition: DrawContext.hpp:65
void DrawLine(int x1, int y1, int x2, int y2)
Definition: DrawContext.hpp:80
Point2D_< int > Point2D
Definition: Utilities.hpp:35
int height
Definition: Utilities.hpp:46
void ResetOffset()
Definition: DrawContext.hpp:130
void SetOffset(Point2D off)
Definition: DrawContext.hpp:128
void Push(Rect r)
Definition: DrawContext.hpp:116
void Push(Point2D p, Size2D s)
Definition: Utilities.hpp:34
int width
Definition: Utilities.hpp:46
void DrawRectBorder(Rect r)
T x
Definition: Utilities.hpp:62
Definition: Alertable.hpp:26
void DrawLineEx(float x1, float y1, float x2, float y2, float width=1.0)
Point2D a
Definition: Utilities.hpp:105
Size2D Size() const
Definition: Utilities.hpp:118
void * SDL_GLContext
Definition: DrawContext.hpp:31
T y
Definition: Utilities.hpp:62
void DrawTexture(std::shared_ptr< SDLTexture > texture, Point2D p=Point2D(0, 0))
void DrawRect(int x, int y, int w, int h)
void MarkApiTrace(int no)
void SetColor(short r, short g, short b, short a=255)
DrawContext()
Definition: DrawContext.hpp:67
Definition: Utilities.hpp:40