-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphics.h
More file actions
36 lines (30 loc) · 1.06 KB
/
Copy pathGraphics.h
File metadata and controls
36 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <memory>
#include <stdexcept>
#include <cmath>
#include <string>
#include <SDL2/SDL.h>
constexpr auto PI_CONV = 3.1415926 / 180.0;
/**
* Graphics
*
* Обертка над SDL_Renderer для рисования примитивов (линии, круги, прямоугольники).
* Предоставляет простой API, похожий на Java AWT Graphics или J2ME Graphics.
*/
class Graphics {
private:
SDL_Renderer* renderer;
SDL_Color currentColor;
void _putpixel(int x, int y);
public:
Graphics(SDL_Renderer* renderer);
// Установка цвета (RGB)
void setColor(int r, int g, int b);
// Установка области клиппинга (отсечения)
void setClip(int x, int y, int w, int h);
// Рисование примитивов
void fillRect(int x, int y, int w, int h);
void drawArc(int x, int y, int w, int h, int startAngle, int arcAngle);
void drawLine(int x1, int y1, int x2, int y2);
void fillCircle(int x, int y, int radius);
};