Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro mouse left right and middle exist ?

This thread is locked; no one can reply to it. rss feed Print
Allegro mouse left right and middle exist ?
faustf
Member #23,511
September 2022

Hi guys is possible discern if i click mouse left or mouse right or middle mouse in Allegro ?? thanks

torhu
Member #2,727
September 2002
avatar

Yes, both with events and polling.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

faustf
Member #23,511
September 2022

thanks for rply sorry i am very newbie you have some example for do that easy example ??? thanks somuch
:)

DanielH
Member #934
January 2001
avatar

Did you RTFM? ;D;D

Just kidding.

Question: Allegro 4 or 5?

Assuming 5.

Check your events. If a button was pressed, you'll get this event triggered.

ALLEGRO_EVENT_MOUSE_BUTTON_DOWN

This is from the docs

mouse.button (unsigned)
The mouse button which was pressed, numbering from 1.

if (event.mouse.button == 1) std::cout << "Left button pressed!" << std::endl;

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: