TouchCPLib
1.0.0
A touch-enabled GUI interface based on SDL and libTS. It provides a simple desktop-free UI for your embedded Raspberry projects.
Rect.h
Go to the documentation of this file.
1
#pragma once
2
13
#include <SDL2/SDL.h>
14
#include <algorithm>
15
#include "
Point.h
"
16
17
struct
Rect
18
{
19
int
x
,
y
,
width
,
height
;
20
21
static
Rect
fromCoords
(
Point
p1,
Point
p2)
22
{
23
int
xMin = std::min(p1.
x
, p2.
x
);
24
int
yMin = std::min(p1.
y
, p2.
y
);
25
26
return
{
27
xMin,
28
yMin,
29
std::abs(p1.
x
- p2.
x
),
30
std::abs(p1.
y
- p2.
y
)};
31
}
32
33
operator
SDL_Rect()
const
34
{
35
return
SDL_Rect{
36
x
,
y
,
width
, height};
37
}
38
};
Rect::fromCoords
static Rect fromCoords(Point p1, Point p2)
Definition:
Rect.h:21
Point::x
int x
Definition:
Point.h:18
Point::y
int y
Definition:
Point.h:18
Rect::y
int y
Definition:
Rect.h:19
Point.h
Rect::height
int height
Definition:
Rect.h:19
Rect::width
int width
Definition:
Rect.h:19
Rect::x
int x
Definition:
Rect.h:19
Point
Definition:
Point.h:16
Rect
Definition:
Rect.h:17
include
TouchCP
Rect.h
Generated by
1.8.13