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

Author Topic: simultaneous animations in a single (render)window  (Read 902 times)

0 Members and 1 Guest are viewing this topic.

njoshi3

  • Newbie
  • *
  • Posts: 4
    • View Profile
simultaneous animations in a single (render)window
« on: December 17, 2012, 07:32:30 pm »
Hi,

I am developing a game with SFML2.0 in which I need to show two simultaneously running related, but not necessarily same scenes in the same window. For example, let's say I want to show a player navigating a maze in the upper part of the window, while the lower (Say 1/3rd) part of the same window shows what interactions are happening inside the brain of the player. How should I do it? Can someone post a small example snippet for the same? What I have for now is something like this:


while (window.isOpen()) {
      sf::Event event;
      while (window.pollEvent(event)){
           if (event.type == sf::Event::Closed)
                  window.close();
           else { .... perform some configuration update and go.}
      }

     // clear earlier scene
    window.clear();

    // animate scene A in the upper half
   sceneA.animate(window, areaSceneA);

    // animate scene B in the lower half
    sceneB.animate(window, areaSceneB);

}
   
 

Right now, what happens (which is clear from the way it is designed) is that first the scene A animation is displayed frame by frame and only then scene B animation starts in the lower part.

What I want is something like:


sceneA, animInstr1
sceneB, animInstr1

sceneA, animInstr2
sceneB, animInstr2
...

Is it possible to do this way?

TIA,
Nikhil