Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. void LayerManager::render()
  2. {
  3. // Render all objects
  4. for(auto it: m_renderables)
  5. {
  6. // All objects in the zero layer have to be rendered with big parrallax
  7. if(it.first == 0)
  8. {
  9. Vector<int> offset(m_camera->getPosition().x() / 4, m_camera->getPosition().y() / 4 + 100);
  10. it.second->setOffset(offset);
  11. }
  12. // All objects in the first layer have to be rendered with small parrallax
  13. if(it.first == 1)
  14. {
  15. Vector<int> offset(m_camera->getPosition().x() / 2, m_camera->getPosition().y() / 2 + 100);
  16. it.second->setOffset(offset);
  17. }
  18. // Otherwise render without parrallax
  19. else
  20. {
  21. it.second->setOffset(m_camera->getPosition());
  22. }
  23.  
  24. // Render the object
  25. it.second->render();
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement