courselab / sucury

Sucury game
GNU General Public License v3.0
8 stars 7 forks source link

feat: enhance main menu navigation support both keyboard and mouse interaction #148

Closed rubenszinho closed 10 months ago

rubenszinho commented 10 months ago

This Pull Request addresses issue #147 in the Sucury project. Previously, the main menu was navigable only through mouse interactions. This update adds keyboard navigation alongside existing mouse interaction capabilities, providing a more versatile and accessible user experience. Users can now navigate the main menu using both the keyboard and the mouse, selecting options like "PLAY", "OPTIONS", and "QUIT" with either method.

Proposed Changes

  1. Main Menu Keyboard Navigation: Introduced keyboard navigation in the main_menu() function. Users can navigate between menu items using the up and down arrow keys and select an option with the Enter key.
  2. Simultaneous Mouse and Keyboard Support: Maintained the existing mouse interaction capabilities while integrating the new keyboard navigation, allowing users to choose their preferred method of interaction.
  3. Code Refactoring: Minor refactoring in the main_menu() function for cleaner integration of the new feature.

How to Test

  1. Launch the Game: Start the Sucury game.
  2. Navigate the Main Menu: Use the up and down arrow keys to navigate through the menu options. Press the Enter key to select an option.
  3. Mouse Interaction: Alternatively, use the mouse to click on the menu options.
  4. Switch Between Methods: Try switching between keyboard and mouse navigation to ensure both methods work seamlessly.
  5. Access All Options: Ensure that all menu options ("PLAY", "OPTIONS", "QUIT") are accessible and functional using both interaction methods.