This repository has been archived on 2023-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_cpp/seminar11_events/02_slider/slider.cpp
2023-01-04 00:18:42 +03:00

36 lines
805 B
C++

#include <iostream>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include "slider.hpp"
int main()
{
int result;
sf::RenderWindow window(sf::VideoMode(800, 600), "Slider");
window.setFramerateLimit(60);
sf::Font font;
if (!font.loadFromFile("consolas.ttf")) {
std::cout << "Can't load button font" << std::endl;
}
Slider slider(window, font);
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
result = slider.handleEvent(event);
std::cout << result << std::endl;
}
window.clear(sf::Color::Black);
slider.draw();
window.display();
}
return 0;
}