diff options
author | zedarider <ymherklotz@gmail.com> | 2016-12-06 15:59:34 +0000 |
---|---|---|
committer | zedarider <ymherklotz@gmail.com> | 2016-12-06 15:59:34 +0000 |
commit | 1c36505258649bf89ca7c6e55bb5592e34b852f4 (patch) | |
tree | f009616d0a55f4411e377d2595f9c6e2294d388b | |
parent | 73ff5968a2dc294514b37006d72daa6070d7250b (diff) | |
download | A-star-algorithm-1c36505258649bf89ca7c6e55bb5592e34b852f4.tar.gz A-star-algorithm-1c36505258649bf89ca7c6e55bb5592e34b852f4.zip |
adding files
-rwxr-xr-x | bin/main | bin | 0 -> 134624 bytes | |||
-rw-r--r-- | src/main.cpp | 35 |
2 files changed, 35 insertions, 0 deletions
diff --git a/bin/main b/bin/main Binary files differnew file mode 100755 index 0000000..3eabafc --- /dev/null +++ b/bin/main diff --git a/src/main.cpp b/src/main.cpp index 7781db3..bd01b23 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,8 @@ */ +#include <SFML/Graphics.hpp> + #include <iostream> using namespace std; @@ -14,5 +16,38 @@ using namespace std; int main(int argc, char *argv[]) { cout << "executing " << argv[0] << endl; cout << "arguments given: " << argc-1 << endl; + + sf::RectangleShape rect(sf::Vector2f(25, 25)); + rect.setFillColor(sf::Color(100, 100, 100)); + + sf::RenderWindow window(sf::VideoMode(800, 600), "A* Algorithm"); + + while(window.isOpen()) { + sf::Event event; + while(window.pollEvent(event)) { + if(event.type == sf::Event::Closed) { + window.close(); + } + } + + if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && rect.getPosition().x > 0) { + rect.move(-0.5f, 0); + } + if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) { + rect.move(0.5f, 0); + } + if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) { + rect.move(0, -0.5f); + } + if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) { + rect.move(0, 0.5f); + } + + + window.clear(sf::Color(47, 47, 47)); + window.draw(rect); + window.display(); + } + return 0; } |