-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.h
114 lines (100 loc) · 2.95 KB
/
tools.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef __TOOLS_H_
#define __TOOLS_H_
#define TOOLS_FADE_OFFSET 255
#define TOOLS_FADE_SPEED 8
/** @brief Create a Sprite Quad object
* @param quad Quad data
* @param spriteId Sprite ID
*/
void CreateSpriteQuad(jo_3d_quad * quad, const int spriteId);
/** @brief Free sprite quad object
* @param quad Sprite quad
*/
void FreeSpriteQuadData(jo_3d_quad * quad);
/** @brief Fast length of 3D vector (Thx GValiente for solution).
* For more info about how it works see: https://math.stackexchange.com/questions/1282435/alpha-max-plus-beta-min-algorithm-for-three-numbers
* And also: https://en.wikipedia.org/wiki/Alpha_max_plus_beta_min_algorithm
* @param vector Vector to measure
* @return Approximation of the vector length
*/
jo_fixed ToolsFastVectorLength(const jo_vector_fixed *vector);
/** @brief Enable specific layer
* @param layer Layer number
*/
void ToolsEnableLayer(Uint16 layer);
/** @brief Disable specific layer
* @param layer Layer number
*/
void ToolsDisableLayer(Uint16 layer);
/** @brief Fade in effect
* @param layer Layer number
* @param draw_loop Draw function to call while fading
*/
void ToolsFadeIn(Uint16 layer, void (*drawLoop)(void));
/** @brief Fade out effect
* @param layer Layer number
* @param draw_loop Draw function to call while fading
*/
void ToolsFadeOut(Uint16 layer, void (*drawLoop)(void));
/** @brief Draw rectangle line
* @param first First point
* @param second Second point
* @param z Depth coordinate
* @param color Line color
*/
void ToolsDrawLine(
const jo_pos2D *first,
const jo_pos2D *second,
int z,
jo_color color);
/** @brief Draw polygon
* @param first First point
* @param second Second point
* @param third Third point
* @param fourth Fourth point
* @param z Depth coordinate
* @param color Line color
* @param filled Is polygon filled
*/
void ToolsDrawPolygon(
const jo_pos2D *first,
const jo_pos2D *second,
const jo_pos2D *third,
const jo_pos2D *fourth,
const int z,
const jo_color color,
const bool filled);
/** @brief Draw rectangle line
* @param center Center point
* @param size Rectangle size
* @param angle Rotation angle
* @param z Depth coordinate
* @param color Line color
* @param filled Is rectangle filled
*/
void ToolsDrawRotatedRectangle(
const jo_pos2D *center,
const jo_size *size,
const ANGLE angle,
const int z,
const jo_color color,
const bool filled);
/** @brief Draw rectangle
* @param center Center point
* @param size Rectangle size
* @param z Depth coordinate
* @param color Line color
* @param filled Is rectangle filled
*/
void ToolsDrawRectangle(
const jo_pos2D *center,
const jo_size *size,
const int z,
const jo_color color,
const bool filled);
/** @brief Really fast acos, can have up to 10 deg of error, but good enough
* @param angle Angle to get arcus cosin of
* @return jo_fixed Arcus cosin
*/
jo_fixed ToolsFastAcos(const jo_fixed angle);
#endif