Mouse Loc

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Lividpayment
Posts: 10
Joined: April 13th, 2020, 8:47 pm

Mouse Loc

Post by Lividpayment » January 21st, 2021, 9:22 pm

How do the coordinates of the mouse as a seperate raw int? I'm trying to create a little 2D draw tool that places a pixel whenever you press the left mouse button, but i'm stuck as my pixels just keep following the mouse :)
Thanks!

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Mouse Loc

Post by albinopapa » February 1st, 2021, 5:01 am

There are two modes of use for the mouse and keyboard. One is state and one is event driven. If you use if( mouse.LeftIsPressed() ) then for however many frames you hold the left mouse button down, this function returns true.

If you want a single button press event, you must use mouse.Read() to get a Mouse::Event object. Then you must verify the event is a button down or button up event and handle it that way.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply