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.


Messages - megamen128

Pages: [1]
1
Graphics / Re: Sprite click trigger
« on: December 16, 2016, 08:56:38 pm »
Its game of life simulation so i think it has to be infinite loop . But i also want be able to pause or speed up or down while the simulation in going

2
Graphics / Re: Sprite click trigger
« on: December 16, 2016, 08:33:32 pm »
Like i said Pauza button triggers whenever i cover the button spirit with mouse . It should trigger when i click on it. While loop end when i cover pauze button

3
Graphics / Sprite click trigger
« on: December 16, 2016, 07:37:19 pm »
Hi
Im beginner in SFML and i have one problem.
I wrote my own OnSpriteClick method witch works great untill i used it in if statement .
the second IsSpiritClicked (Pauza.IsSpiteClicked) trigger whenever i cover spirit with mouse.

if (Start.IsSpiteClicked(Window, Start.Sprite, Event))
         {
         bool end = false;
            while (end != true)
            {
               if (Pauza.IsSpiteClicked(Window, Pauza.Sprite, Event))
                  end = true;
                                     /* OTHER CODE */
                                }
                           }


And this is the method

bool Buttom::IsSpiteClicked(sf::RenderWindow &x, sf::Sprite &y , sf::Event &event)
{
   sf::Vector2f mouse(sf::Mouse::getPosition(x));
   if (event.type == sf::Event::MouseButtonPressed && event.key.code == sf::Mouse::Left && y.getGlobalBounds().contains(mouse))
      return true;
   else return false;
}

event is a sf::Event
Window is a sf::RenderWindow
Start is my own class Button

Pages: [1]
anything