Created
October 11, 2014 10:54
-
-
Save Mischa-Alff/f9798fa0f816664e7b47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <SFML/Window.hpp> | |
int main() | |
{ | |
sf::Window window(sf::VideoMode(800, 600), "test"); | |
const sf::Vector2i desired_position(200, 200); | |
while(window.isOpen()) | |
{ | |
sf::Event event; | |
while(window.pollEvent(event)) | |
{ | |
if(event.type == sf::Event::Closed) | |
window.close(); | |
if(event.type == sf::Event::KeyPressed) | |
{ | |
switch(event.key.code) | |
{ | |
case sf::Keyboard::T: | |
window.setPosition(desired_position); | |
std::cout<<"Setting window position to: "<<desired_position.x<<", "<<desired_position.y<<std::endl; | |
break; | |
default: | |
break; | |
} | |
} | |
} | |
sf::Vector2i current_position = window.getPosition(); | |
std::cout<<"Current window position: "<<current_position.x<<", "<<current_position.y<<std::endl; | |
window.display(); | |
sf::sleep(sf::milliseconds(200)); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment