-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathExample06.cpp
More file actions
83 lines (83 loc) · 1.89 KB
/
Example06.cpp
File metadata and controls
83 lines (83 loc) · 1.89 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//#include<iostream>
//#include"SFML\Graphics.hpp"
//#include"SFML\Window.hpp"
//#include"SFML\System.hpp"
//
//using namespace sf;
//
//void Update(int &keyTime, RectangleShape &square, RenderWindow &window);
//void Draw(RenderWindow &window, RectangleShape &square);
//
//int main()
//{
// int keyTime = 8;
// RenderWindow window(VideoMode(640, 480), "Simple Square Swag");
// window.setFramerateLimit(60);
//
// RectangleShape square(Vector2f(100.f, 100.f));
// square.setFillColor(Color::Red);
// square.setPosition(window.getSize().x / 2, window.getSize().y / 2);
//
// while (window.isOpen())
// {
//
// Event event;
// while (window.pollEvent(event))
// {
// if (event.type == Event::Closed)
// window.close();
//
// if (event.KeyPressed && event.key.code == Keyboard::Escape)
// window.close();
// }
//
// Update(keyTime, square, window);
// Draw(window, square);
// }
//
// return 0;
//}
//
//void Update(int &keyTime, RectangleShape &square, RenderWindow &window)
//{
// if(keyTime < 8)
// keyTime++;
//
// if (Keyboard::isKeyPressed(Keyboard::A) && square.getPosition().x > 0)
// {
// square.move(-5.f, 0.f);
// keyTime = 0;
// }
// if (Keyboard::isKeyPressed(Keyboard::D) && square.getPosition().x + square.getSize().x < window.getSize().x)
// {
// square.move(5.f, 0.f);
// keyTime = 0;
// }
// if (Keyboard::isKeyPressed(Keyboard::W) && square.getPosition().y > 0)
// {
// square.move(0.f, -5.f);
// keyTime = 0;
// }
// if (Keyboard::isKeyPressed(Keyboard::S) && square.getPosition().y + square.getSize().y < window.getSize().y)
// {
// square.move(0.f, 5.f);
// keyTime = 0;
// }
//
// if (Mouse::isButtonPressed(Mouse::Left))
// {
// square.setFillColor(Color::Blue);
// }
// else
// square.setFillColor(Color::Red);
//}
//
//void Draw(RenderWindow &window, RectangleShape &square)
//{
// window.clear(Color::White);
//
// //Draw stuff
// window.draw(square);
//
// window.display();
//}