Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mouse button constants #1584

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MarkOates
Copy link
Contributor

@MarkOates MarkOates commented Sep 28, 2024

Mouse button numbering can be confusing. Adding constants could help.

This PR adds ALLEGRO_MOUSE_BUTTON_LEFT, ALLEGRO_MOUSE_BUTTON_RIGHT, and ALLEGRO_MOUSE_BUTTON_MIDDLE. This would make code like the following available:

switch (event.mouse.button)
{
   case ALLEGRO_MOUSE_BUTTON_LEFT:
      printf("left button pressed!\n");
   break;

   case ALLEGRO_MOUSE_BUTTON_RIGHT:
      printf("right button pressed!\n");
   break;

   case ALLEGRO_MOUSE_BUTTON_MIDDLE:
      printf("middle button pressed!\n");
   break;
}

Additions/revisions to the mouse and events documentation are included as well as disclaimers about the possibility of more/fewer mouse buttons. Also, a typo is fixed in docs/src/refman/keyboard.txt.

Some questions

  • Do I need to "make" the docs?
  • ALLEGRO_MOUSE_BUTTON_UNDEF is not included, should it be?
  • There may be other example programs that could be updated to include the constants. Should we worry about including that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant