-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshapes.cpp
More file actions
30 lines (23 loc) · 736 Bytes
/
Copy pathshapes.cpp
File metadata and controls
30 lines (23 loc) · 736 Bytes
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
#include "tinygl-cpp.h"
using namespace tinygl;
class MyWindow : public Window {
public:
MyWindow(int w, int h) : Window(w, h) {}
void setup() override {
std::cout << "Window size: " << width() << ", " << height() << std::endl;
}
void draw() override {
background(0.2f, 0.2f, 0.2f); // parameters: r, g, b
color(0.5, 1.0, 0.25); // parameters: r, g, b
square(300, 150, 200, 50); // parameters: x, y, width, height
circle(50, 30, 100); // parameters: x, y, radius
color(1, 0, 0, 0.5);
triangle(350, 150, 50, 100);
color(1, 0, 1, 0.5);
ellipsoid(150, 350+25*sin(elapsedTime()), 100, 100);
}
};
int main() {
MyWindow window(500, 500);
window.run();
}