Game Development Reference
In-Depth Information
As you can see, viewports are extremely useful for having multiple views at the same
time. This makes it possible to create local split screen multiplayer games quite easily.
Apart from that, we can use a different view for our UI as an example. To do this, we
render our game with the game camera, then switch to the UI camera (which doesn't move
with the world), and render our game's UI. Maps and minimaps are the perfect targets for
views, since we are essentially rendering the world inside another window (or view).
In general, views are extremely useful but they have one weakness—the window coordin-
ates do not correspond with the view's contents once we start manipulating the cameras.
For example, if we try to handle a click event, the mouse position will not point to the
same position in the scene for different views. As always, SFML has got us covered—by
introducing coordinate mapping.
Search WWH ::




Custom Search