Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision |
new:mouse [2018/02/17 12:11] – korshun | new:mouse [2018/02/19 11:04] (current) – korshun |
---|
| |
The cursor library doesn't handle mouse clicks, as ZDoom doesn't provide access to mouse buttons. To read mouse clicks, use [[zdoom>GetPlayerInput]] with ''BT_ATTACK'' (left mouse button) and ''BT_ALTATTACK'' (right mouse button). Better yet, use ACSUtils [[input|GetPlayerInput wrappers]] for simpler input handling that will not register multiple clicks if the player holds a mouse button. | The cursor library doesn't handle mouse clicks, as ZDoom doesn't provide access to mouse buttons. To read mouse clicks, use [[zdoom>GetPlayerInput]] with ''BT_ATTACK'' (left mouse button) and ''BT_ALTATTACK'' (right mouse button). Better yet, use ACSUtils [[input|GetPlayerInput wrappers]] for simpler input handling that will not register multiple clicks if the player holds a mouse button. |
| |
| To check if a button is clicked on screen, check that the cursor is inside the button's rectangle and was clicked. |
| |
<note important>The cursor library **cannot be used serverside**. | <note important>The cursor library **cannot be used serverside**. |
===== A complete example ===== | ===== A complete example ===== |
| |
An example using [[HudMessage]] (''[[rounding|floor()]]'' is used to clear alignment flags): | An example using [[zdoom>HudMessage]] (''[[rounding|floor()]]'' is used to clear alignment flags): |
| |
<code> | <code> |