-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathExample13.cpp
More file actions
64 lines (64 loc) · 1.57 KB
/
Example13.cpp
File metadata and controls
64 lines (64 loc) · 1.57 KB
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
//#include<iostream>
//#include"SFML\Graphics.hpp"
//#include"SFML\Window.hpp"
//#include"SFML\System.hpp"
//
//using namespace sf;
//
//int main()
//{
// RenderWindow window(VideoMode(800, 600), "Rotation", Style::Default);
// window.setFramerateLimit(60);
//
// RectangleShape rectangle;
// rectangle.setFillColor(Color::White);
// rectangle.setSize(Vector2f(100.f, 50.f));
// rectangle.setOrigin(50.f, 25.f);
//
// CircleShape circle;
// circle.setFillColor(Color::Green);
// circle.setRadius(10.f);
// circle.setOrigin(10.f, 10.f);
// circle.setPosition(window.getSize().x / 2.f, window.getSize().y / 2.f);
//
// while (window.isOpen())
// {
// Event event;
// while (window.pollEvent(event))
// {
// if (event.type == Event::Closed)
// window.close();
// if (event.type == Event::KeyPressed && event.key.code == Keyboard::Escape)
// window.close();
// }
//
// //Update
// if (Keyboard::isKeyPressed(Keyboard::A))
// rectangle.move(-10.f, 0.f);
// if (Keyboard::isKeyPressed(Keyboard::D))
// rectangle.move(10.f, 0.f);
// if (Keyboard::isKeyPressed(Keyboard::W))
// rectangle.move(0.f, -10.f);
// if (Keyboard::isKeyPressed(Keyboard::S))
// rectangle.move(0.f, 10.f);
//
// if (Keyboard::isKeyPressed(Keyboard::R))
// rectangle.rotate(10.f);
//
// if (rectangle.getGlobalBounds().intersects(circle.getGlobalBounds()))
// circle.setFillColor(Color::Red);
// else
// circle.setFillColor(Color::Green);
//
// //Draw
// window.clear();
//
// //Draw everything
// window.draw(rectangle);
// window.draw(circle);
//
// window.display();
// }
//
// return 0;
//}