Hey ..
im doing a game project with sfml and i countered a small problem ,here is my code :

    #include <SFML/Graphics.hpp>
    #include <string>
    #include <iostream>
    using namespace std;
    using namespace sf;
    int main ()
    {

    sf::RenderWindow Window;
    Window.create(sf::VideoMode(490, 485),"My First Sfml Game");

    sf::Texture pTexture1;
    sf::Sprite playerImage;



    if(!pTexture1.loadFromFile("Data/dots.png"))
    std::cout<<"error could not load player image"<<std::endl;

    playerImage.setTexture(pTexture1);

    sf::Texture pTexture2;
    sf::Sprite lineImage;
    if(!pTexture2.loadFromFile("Data/line.png"))
    std::cout<<"error could not load player image"<<std::endl;
    lineImage.setTexture(pTexture2);

    int v;

    while (Window. isOpen())
    {
    sf::Event event;
    while (Window.pollEvent(event))
    {
    switch(event.type)
    {
    case sf::Event::Closed:
    Window.close();
    break;
    case Event::KeyPressed:
    if (event.key.code==Keyboard::Right)
    lineImage.move(5,0);
    else if (event.key.code==Keyboard::Left)
    lineImage.move(-5,0);
    else if (event.key.code==Keyboard::Up)
    lineImage.move(0,-5);
    else if (event.key.code==Keyboard::Down)
    lineImage.move(0,5);
    else if (event.key.code==Keyboard::Space)
    lineImage.setRotation(90);
    break;
    case Event::KeyReleased:
    if (event.key.code==Keyboard::Right)
    lineImage.move(0,0);
    else if (event.key.code==Keyboard::Left)
    lineImage.move(-0,0);
    else if (event.key.code==Keyboard::Up)
    lineImage.move(0,-0);
    else if (event.key.code==Keyboard::Down)
    lineImage.move(0,0);
    else if (event.key.code==Keyboard::Space)
    lineImage.setRotation(90);
    break;
    }
    if (event.type==Event::KeyReleased && event.key.code==Keyboard::Space)
    lineImage.setRotation(180);
    }



    Window.draw(playerImage);
    Window.draw(lineImage);
    Window.display();
    }
    return 0;
    }

Images in the code here : postimg.org/gallery/71ufmoi/da508bc3/

the problem is that i need to rotate the lineImage when i click the space but when i click space it rotate 90 then back again 90 !! i need to make it stable when i click space it rotate 90 then when i click space again it rotate 90 to the original !
and another problem .. i'm doing dots game so ,how can i make the logic of the line , so i can let it between two points when i hit enter ?

sorry for my bad English and any silly question , and thanks in advance ^^

What is the "small problem" ?? Or do you want us to guess? My guess is that you hold your knose when you tried to compile it.

Did you read the whole post !?? -_- , or you wanna be funny ! , cuz you're not .

Be nice. So you want to alternate rotation. In that case you need a little bit more logic like so:

if( isSpaceKeyPressed()){
  int currentRotation = line.getRotation();
  if(currentRotation == 90){ //is horizontal( flat line )
    line.setRotation(0); //make it straight line
  }else{
    line.setRotation(90); //make it flat line
  }
}

Did you read the whole post !??

Yes I did -- nowhere does it say what the problem is, unless I'm blind or something.

its all the way on the bottom Ancient lol... it took a while :D

So it is -- my apologies. I actually thought that was something called "related posts" because of the dark purple color. Must be a recent change to this forum format.