-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrigonometricFunction.cpp
51 lines (44 loc) · 1.83 KB
/
TrigonometricFunction.cpp
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
#include "lib/framework.hpp"
enum Size {
WIDTH = 800,
HEIGHT = 600
};
int main() {
AppEnv env(Size::WIDTH, Size::HEIGHT);
float angle = 0.0F;
while (env.isOpen()) {
env.begin();
Vec2f pos = env.mousePosition();
angle += 0.1F;
float x = pos.x() + (std::cos(angle));
float y = pos.y() + (std::sin(angle));
float c = std::abs(std::sin(angle));
// a = ++i; aが1
// a = i++; aが0
//drawFillBox(x, y, 32, 32, Color(c, c, c));
/*for (int i = 0; i < 100; i++) {
float r = angle + i * 0.05;
float x = std::cos(r) * 200.0F;
float y = std::sin(r * 0.7F) * 150.0F;
float c = i / 100.0F;
drawFillBox(x, y, 32, 32, Color(c, c, c));
}*/
drawFillBox(pos.x() + (c * 120), pos.y() + (c * 120), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x() - (c * 120), pos.y() + (c * 120), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x() + (c * 120), pos.y() - (c * 120), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x() - (c * 120), pos.y() - (c * 120), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x() + (c * 220), pos.y() + (c * 220), 64, 64, Color(1, c, c));
drawFillBox(pos.x() - (c * 220), pos.y() + (c * 220), 64, 64, Color(c, c, c));
drawFillBox(pos.x() + (c * 220), pos.y() - (c * 220), 64, 64, Color(c, 1, 1));
drawFillBox(pos.x() - (c * 220), pos.y() - (c * 220), 64, 64, Color(1, 1, c));
drawFillBox(pos.x(), pos.y() + (c * 120), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x(), pos.y() + (c * 220), 64, 64, Color(1, c, 1));
drawFillBox(pos.x() + (c * 120), pos.y(), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x() + (c * 220), pos.y(), 64, 64, Color(1, c, c));
drawFillBox(pos.x() - (c * 120), pos.y(), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x() - (c * 220), pos.y(), 64, 64, Color(c, 1, c));
drawFillBox(pos.x(), pos.y() - (c * 120), 64, 64, Color(1, 1, 1));
drawFillBox(pos.x(), pos.y() - (c * 220), 64, 64, Color(c, c, 1));
env.end();
}
}