Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Kleath

Pages: [1]
1
Hello,
Im making a Pong Game with SFML. But when i start the Game it just draws the Background of whatever is behind the window. If I start the Game with the Dektop behind the Game Window it just draws the Desktop-Background. But it worked previously. Is it possible that the OS is causing the problems ?

2
General / [SOLVED]TextPosition relative to window size
« on: April 28, 2016, 04:44:31 pm »
Hello, I'm making a Pong Game, and for this i made a MainMenu gamestate. There's a text for Start Game and one for End Game. Now i made this do change the color of the text if I'm moving my mous over it:

if (txtStartGame.getGlobalBounds().contains(
      sf::Mouse::getPosition(game.window).x,
      sf::Mouse::getPosition(game.window).y) &&
      txtStartGame.getColor() != sf::Color::Green)
        {
            //changecolor
        }

now this works great, but only if I dont change the size of my window. If I change the size of the window, i have to move the mouse on another spot to change the color of the text i want to change.

im making the window like this:

window.create(sf::VideoMode(1280, 720), "Pong");

and the text im making like this:

        txtStartGame.setFont(font);
   txtStartGame.setString("Start Game");
   txtStartGame.setCharacterSize(30);
   txtStartGame.setPosition(400.f, 500.f);


So what am I doing wrong ?

(Sorry for my bad English by the way xD)

3
Hello, i have a little Problem. I'm programming a little Pong Game. For this I'm using two Gamestates, the MainMenu and the Playstate. Now if I am at the Playstate, i want the ESCPAE Button to go back to the MainMenu.
Now if I'm in the Playstate and move the mouse to the left side of the window, it also goes back to the MainMenu.

With this code :

 if (event.type = sf::Event::KeyPressed)
      {
         if (event.key.code == sf::Keyboard::Escape)
         {
            game.ChangeState(Game::gameStates::MAINMENU);
         }
      }

I'm checking if ESCAPE was pressed. Now if I dont use this code, it doesnt move back to the MainMenu if i move the mouse to the left of the window.

Do you have any ideas what I'm doing wrong?

Pages: [1]
anything