That is wrong, check the event tutorial again.
Also use [code=cpp][/code] tag when posting code to the forum.
#include <SFML/Graphics.hpp>
using namespace sf;
using namespace std;
String CurrentlyAt = "Menu";
int Lal = 1;
int main()
{
RenderWindow window(VideoMode(1244, 772), "Test");
Texture TextureMenu;
TextureMenu.loadFromFile("Menu.png");
Sprite Menu(TextureMenu);
Texture TextureOptionsInMenu;
TextureOptionsInMenu.loadFromFile("1.png");
Sprite OptionsInMenu(TextureOptionsInMenu);
OptionsInMenu.setPosition(487, 293);
window.setKeyRepeatEnabled(false);
while (window.isOpen())
{
window.clear();
// Process events
Event event;
while (window.pollEvent(event))
{
switch (event.type)
{
// window closed
case sf::Event::Closed:
window.close();
break;
// key pressed
case sf::Event::KeyPressed:
if (Keyboard::isKeyPressed(Keyboard::Key::W))
{
if (CurrentlyAt == "Menu")
{
if (Lal == 2)
{
OptionsInMenu.setPosition(487, 293);
Lal = 1;
}
else if (Lal == 1)
{
OptionsInMenu.setPosition(487, 236);
Lal = 0;
}
}
}
if (Keyboard::isKeyPressed(Keyboard::Key::S))
{
if (CurrentlyAt == "Menu")
{
if (Lal == 0)
{
OptionsInMenu.setPosition(487, 293);
Lal = 1;
}
else if (Lal == 1)
{
OptionsInMenu.setPosition(487, 348);
Lal = 2;
}
}
}
break;
// we don't process other types of events
default:
break;
}
}
window.draw(Menu);
window.draw(OptionsInMenu);
window.display();
}
return 0;
}
Thx for spending your time on me
I hope this is the right one.