Game Development Reference
In-Depth Information
Typically, centering the view on the main character is a simple and effective technique to
carry out the camera position logic. Also, it requires only two lines of code in the update
frame:
Note that we need to call
RenderWindow::setView()
and pass
view
again since
RenderWindow
only holds a copy of
view
. Just changing our old
view
instance will
not affect
view
stored in
RenderWindow
.