# SDL\_Mouse\_event

**URL:** <https://discourse.libsdl.org/t/sdl-mouse-event/25569>\
**Category:** SDL Development\
**Created:** [January 8, 2019, 7:26am UTC](https://discourse.libsdl.org/t/sdl-mouse-event/25569 "2019-01-08T07:26:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trando](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/t/d2c977/32.png) [@trando](https://discourse.libsdl.org/u/trando)\
**Post date:** [January 8, 2019, 7:26am UTC](https://discourse.libsdl.org/t/sdl-mouse-event/25569/1 "2019-01-08T07:26:40Z")

</div>

Can I ask: there is any way to detect the mouse hold event?

---

<div class="post-metadata">

**Author:** ![Smiles](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@Smiles](https://discourse.libsdl.org/u/Smiles)\
**Post date:** [January 8, 2019, 9:19am UTC](https://discourse.libsdl.org/t/sdl-mouse-event/25569/2 "2019-01-08T09:19:59Z")

</div>

I believe SDL only handles mouse down and mouse up.

Theres 2 things you could do.  
When pressed set a bool to true and when released set it to false. While its true you know its held down.

Or

Store previous and current state for mouse clicks to determine if mouse if pressed, held or released.

---

<div class="post-metadata">

**Author:** ![JonnyD](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/jonnyd/32/1604_2.png) [@JonnyD](https://discourse.libsdl.org/u/JonnyD)\
**Post date:** [January 8, 2019, 2:53pm UTC](https://discourse.libsdl.org/t/sdl-mouse-event/25569/3 "2019-01-08T14:53:41Z")

</div>

You can also use SDL\_GetMouseState() to see which mouse buttons are currently down. There’s an SDL\_MOUSEMOTION event, too, if that helps what you’re trying to do.
