-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotation-example.cpp
48 lines (48 loc) · 1.92 KB
/
rotation-example.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
//#include "shapegame.hpp"
//using namespace shapegame;
//
//const int SCREEN_WIDTH = 400;
//const int SCREEN_HEIGHT = 600;
//
//int main() {
// /* Create a new Game object with window width, height, and title */
// Game game(SCREEN_WIDTH, SCREEN_HEIGHT, "SHMUP");
// // Set the background color of the scene
// game.scene->setBackgroundColor(Color::BLUE);
//
// //[> Add a convenience key handler that closes the window when escape is pressed <]
// game.scene->addChild(std::make_unique<DebugKeyHandler>());
//
// Circle* circle = game.scene->addChildAs<Circle>(std::make_unique<Circle>(Position(100, 100), 200, Color::BLACK));
//
// Triangle* triangle = game.scene->addChildAs<Triangle>(std::make_unique<Triangle>(Position(100, 300), Point(200, 300), Point(150, 400), Color::GREEN));
// //std::cout << triangle->pos << std::endl;
// //triangle->rotate(1);
// //circle->rotate(1);
// //std::cout << circle->getNextRotation() << std::endl;
// //std::cout << triangle->pos << std::endl;
// game.scene->addChild(std::make_unique<Timer>(10, true, true, [&triangle, &circle]() {
// //triangle->translate(0, 0);
// triangle->rotateAround(1, *circle);
// circle->rotate(-1);
// std::cout << triangle->getRotation() << std::endl;
// //std::cout << triangle->getNextRotation() << std::endl;
// //if (triangle->getRotation() >= 90) {
// // triangle->setRotation(0);
// // //std::cout << triangle->getRotation() << std::endl;
// // //std::cout << triangle->getNextRotation() << std::endl;
// //}
// //std::cout << circle->pos << std::endl;
// //std::cout << triangle->pos << std::endl;
// //std::cout << triangle->pos << std::endl;
// //std::cout << triangle->second << std::endl;
// }));
// //triangle->rotate(60);
// //triangle->rotate(1);
// //triangle->rotate(90);
// // finally starting the game
// game.run();
// // exercise for the reader:
// // - Give all object shadows (HINT: Make them MultiShapes)
// // - Make all movement 'frame rate independent'
//}