Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LayerManager::render()
- {
- // Render all objects
- for(auto it: m_renderables)
- {
- // All objects in the zero layer have to be rendered with big parrallax
- if(it.first == 0)
- {
- Vector<int> offset(m_camera->getPosition().x() / 4, m_camera->getPosition().y() / 4 + 100);
- it.second->setOffset(offset);
- }
- // All objects in the first layer have to be rendered with small parrallax
- if(it.first == 1)
- {
- Vector<int> offset(m_camera->getPosition().x() / 2, m_camera->getPosition().y() / 2 + 100);
- it.second->setOffset(offset);
- }
- // Otherwise render without parrallax
- else
- {
- it.second->setOffset(m_camera->getPosition());
- }
- // Render the object
- it.second->render();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement