Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <SFML/Window.hpp>
- #include <windows.h>
- using namespace std;
- int main()
- {
- sf::Window window(sf::VideoMode(800, 600), "Generic name for a window");
- sf::Event event;
- while (window.isOpen())
- {
- while (window.pollEvent(event))
- {
- if (event.type == sf::Event::Closed)
- window.close();
- else if (event.type == sf::Event::KeyPressed)
- cout << "The player pressed a key" << endl;
- else if (event.type == sf::Event::Resized) //This code gets triggered when the window is resized by the user
- {
- std::cout << "new width: " << event.size.width << std::endl;
- std::cout << "new height: " << event.size.height << std::endl;
- }
- else if (event.type == sf::Event::MouseMoved)
- {
- cout << "New width of cursor: " << event.mouseMove.x<< endl;
- cout << "New height of cursor: " << event.mouseMove.y << endl;
- }
- }
- }
- int pause; cin >> pause; //Pause the program
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement