Esempio n. 1
0
void World::update(const Buttons& buttons,uint32_t frame_counter) {

  Point topLeft(_background.getTopLeft());
  uint16_t i;
  float f;

  // sample the navigation buttons

  if(buttons.isRightPressed() && topLeft.Y>0)
    topLeft.Y-=4;
  else if(buttons.isLeftPressed() && topLeft.Y!=1920-640)
    topLeft.Y+=4;

  if(buttons.isUpPressed() && topLeft.X>0)
    topLeft.X-=4;
  else if(buttons.isDownPressed() && topLeft.X!=1280-360)
    topLeft.X+=4;

  // set the new position

  _background.setTopLeft(topLeft);

  // update the components

  _background.update();

  f=static_cast<float>(frame_counter);
  for(i=0;i<_levelDef.ActorCount;i++)
    _actors[i]->update(f,_background.getTopLeft());
}