diff options
-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; } |