libwtk-sdl2
0.0.1
include
geometry.hpp
1
#ifndef LIBWTK_SDL2_GEOMETRY_HPP
2
#define LIBWTK_SDL2_GEOMETRY_HPP
3
4
#include <SDL2/SDL.h>
5
6
struct
point
7
{
8
int
x;
9
int
y;
10
};
11
12
struct
vec
13
{
14
int
w;
15
int
h;
16
};
17
18
int
square(
int
i);
19
20
bool
within_bound(
int
val,
int
lower,
int
length);
21
22
// checks whether a point lies within a rectangle
23
bool
within_rect(
point
p, SDL_Rect
const
& r);
24
25
point
rect_center(SDL_Rect
const
& r);
26
point
rect_origin(SDL_Rect
const
& r);
27
28
// Create a rectangle with zero origin.
29
SDL_Rect rect(
vec
v);
30
31
vec
operator+(
vec
v,
vec
u);
32
point
operator+(
point
p,
vec
v);
33
vec
operator-(
vec
v);
34
point
operator-(
point
p,
vec
v);
35
bool
operator<(
vec
v,
vec
w);
36
vec
operator*(
vec
v,
int
s);
37
38
vec
abs(
vec
v);
39
40
vec
operator-(
point
p,
point
q);
41
42
43
#endif
44
vec
Definition:
geometry.hpp:12
point
Definition:
geometry.hpp:6
Generated by
1.8.14