tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

Clicking "Quit" on the menu screen closes the game #450

Closed TheoPannetier closed 2 years ago

TheoPannetier commented 2 years ago

Depends on

Nice menu we have, but so far it is a bit static. Let's start giving it a proper use! First step would be to be able to quit the game from the menu, i.e ., clicking the red "Quit" button closes the window. This can be achieved using the sf::Mouse class. Read the tutorial here, maybe the doc of the class too, and check out how events are processed in the game.

This may be a difficult issue, good luck! Unfortunately, there is no way to test Events AFAICS, so you'll have to rely on trying manually whether the game works as intended or not :)

To be clear, the game should exit when:

  1. The mouse position is within the area of the Quit button, and
  2. The mouse is clicked

game_menu

TheoPannetier commented 2 years ago

Done !