#include <SFML/Window.hpp>
#include <iostream>
#include <Windows.h>
#include <string>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <cstdio>
using namespace std;
using namespace sf;
int main(int argc, char** argv)
{
RenderWindow window(VideoMode(1920, 1080), "Goku's GT Adventures", Style::Fullscreen);
window.setFramerateLimit(100);
Texture texture;
if (!texture.loadFromFile("grafika/goku_menu.png"))
{
cout << "hello";
}
Sprite obrazek(texture);
obrazek.setTexture(texture);
Texture menu;
if (!menu.loadFromFile("grafika/menu.png"))
{
cout << "hello menu";
}
IntRect rectSourceSprite(454, 187, 454, 187);
Sprite obrazek2(menu,rectSourceSprite);
obrazek2.setTexture(menu);
obrazek2.setPosition(866.f, 667.f);
menu.setSmooth(true);
Sprite obrazek3;
Texture menu2;
menu2.loadFromFile("grafika/menu2.png");
Clock clock;
while (window.isOpen())
{
Event event;
while (window.pollEvent(event))
{
if (event.type == Event::Closed)
window.close();
if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
window.close();
}
// handle input
if (Keyboard::isKeyPressed(Keyboard::Down))
{
obrazek2.setTexture(menu2);
}
if (Keyboard::isKeyPressed(Keyboard::Up))
{
obrazek3.move(0.0f, -1.0f);
}
if (clock.getElapsedTime().asSeconds() > 0.10f)
{
if (rectSourceSprite.left == 908)
rectSourceSprite.left = 0;
else
rectSourceSprite.left += 454;
obrazek2.setTextureRect(rectSourceSprite);
clock.restart();
}
window.clear(Color::Black);
window.draw(obrazek);
window.draw(obrazek2);
window.display();
}
return 0;
}