JNGL
shapes.hpp
Go to the documentation of this file.
1 // Copyright 2012-2020 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
5 #pragma once
6 
7 #include "Color.hpp"
8 #include "Vec2.hpp"
9 
10 namespace jngl {
11 
16 
17 void setColor(jngl::Color, unsigned char alpha);
18 
19 void setColor(unsigned char red, unsigned char green, unsigned char blue);
20 
21 void setColor(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha);
22 
25 void setAlpha(uint8_t alpha);
26 
27 void pushAlpha(unsigned char alpha);
28 
29 void popAlpha();
30 
31 void setLineWidth(float width);
32 
33 void drawLine(Vec2 start, Vec2 end);
34 
35 void drawLine(double xstart, double ystart, double xend, double yend);
36 
37 void drawEllipse(float xmid, float ymid, float width, float height, float startAngle = 0);
38 
39 void drawEllipse(Vec2, float width, float height, float startAngle = 0);
40 
41 void drawCircle(Vec2, float radius, float startAngle = 0);
42 
43 void drawPoint(double x, double y);
44 
45 void drawTriangle(Vec2 a, Vec2 b, Vec2 c);
46 
47 void drawTriangle(double A_x, double A_y, double B_x, double B_y, double C_x, double C_y);
48 
49 void drawRect(double xposition, double yposition, double width, double height);
50 
54 void drawRect(Vec2 position, Vec2 size);
55 
56 template <class Vect> void drawRect(Vect pos, Vect size) {
57  drawRect(pos.x, pos.y, size.x, size.y);
58 }
59 
60 } // namespace jngl
jngl::setAlpha
void setAlpha(uint8_t alpha)
Sets the alpha value which should be used to draw primitives (0 = fully transparent,...
jngl
JNGL's main namespace.
Definition: App.hpp:9
Vec2.hpp
jngl::Color
Object representing a RGB color.
Definition: Color.hpp:24
Color.hpp
jngl::Vec2
Two-dimensional vector.
Definition: Vec2.hpp:14
jngl::setColor
void setColor(jngl::Color rgb)
Sets the color which should be used to draw primitives.