[Android] Updated example to handle screen rotation events (#531)
This commit is contained in:
parent
6302cc0762
commit
775277b8fb
2 changed files with 10 additions and 1 deletions
|
@ -23,6 +23,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
music.play();
|
||||
|
||||
sf::View view = window.getDefaultView();
|
||||
|
||||
while (window.isOpen())
|
||||
{
|
||||
sf::Event event;
|
||||
|
@ -33,6 +35,13 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
window.close();
|
||||
}
|
||||
|
||||
if (event.type == sf::Event::Resized)
|
||||
{
|
||||
view.setSize(event.size.width, event.size.height);
|
||||
view.setCenter(event.size.width/2, event.size.height/2);
|
||||
window.setView(view);
|
||||
}
|
||||
}
|
||||
|
||||
if (sf::Touch::isDown(0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue