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

Author Topic: How do views work?  (Read 1555 times)

0 Members and 1 Guest are viewing this topic.

TheGuerilla

  • Newbie
  • *
  • Posts: 27
  • Cynical Prick.exe
    • View Profile
    • Email
How do views work?
« on: May 06, 2016, 08:24:17 pm »
I don't quite understand how they work. I assumed originally that I could just define a view width/height/port width/height and have it display that portion of the game world, but it appears otherwise. Say I want to draw the player to the all the 4 views, because for the purpose of this example this is a 4 player split screen game. When I render the player do I have to do something like
for (int i = 0; i < views.size(); i++) {
    window.setView(views[i]);
    window.draw(playerSprite);
to draw it to all views, or can I just draw it to the default one? The documentation is fairly confusing with this issue.

Thanks

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
AW: How do views work?
« Reply #1 on: May 06, 2016, 09:16:49 pm »
Did you read the tutorial on views?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

TheGuerilla

  • Newbie
  • *
  • Posts: 27
  • Cynical Prick.exe
    • View Profile
    • Email
Re: How do views work?
« Reply #2 on: May 06, 2016, 10:33:30 pm »
I did not, nor did I realize there was one. I will read it right now, thanks!