summaryrefslogtreecommitdiff
path: root/meta/3rd/love2d/library/love.mouse.lua
blob: d25808bafa459315390ce6c8fb847dfc4dffd25c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
---@meta

---
---Provides an interface to the user's mouse.
---
---@class love.mouse
love.mouse = {}

---
---Gets the current Cursor.
---
---@return love.Cursor cursor # The current cursor, or nil if no cursor is set.
function love.mouse.getCursor() end

---
---Returns the current position of the mouse.
---
function love.mouse.getPosition() end

---
---Gets whether relative mode is enabled for the mouse.
---
---If relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen.
---
---The reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated.
---
---@return boolean enabled # True if relative mode is enabled, false if it's disabled.
function love.mouse.getRelativeMode() end

---
---Gets a Cursor object representing a system-native hardware cursor.
---
---Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates.
---
---@param ctype love.CursorType # The type of system cursor to get. 
---@return love.Cursor cursor # The Cursor object representing the system cursor type.
function love.mouse.getSystemCursor(ctype) end

---
---Returns the current x-position of the mouse.
---
function love.mouse.getX() end

---
---Returns the current y-position of the mouse.
---
function love.mouse.getY() end

---
---Gets whether cursor functionality is supported.
---
---If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors.
---
---@return boolean supported # Whether the system has cursor functionality.
function love.mouse.isCursorSupported() end

---
---Checks whether a certain mouse button is down.
---
---This function does not detect mouse wheel scrolling; you must use the love.wheelmoved (or love.mousepressed in version 0.9.2 and older) callback for that. 
---
---@param button number # The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependant.
---@return boolean down # True if any specified button is down.
function love.mouse.isDown(button) end

---
---Checks if the mouse is grabbed.
---
---@return boolean grabbed # True if the cursor is grabbed, false if it is not.
function love.mouse.isGrabbed() end

---
---Checks if the cursor is visible.
---
---@return boolean visible # True if the cursor to visible, false if the cursor is hidden.
function love.mouse.isVisible() end

---
---Creates a new hardware Cursor object from an image file or ImageData.
---
---Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates.
---
---The hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is. For example, the normal arrow pointer normally has its hot spot at the top left of the image, but a crosshair cursor might have it in the middle.
---
---@overload fun(filename: string, hotx: number, hoty: number):love.Cursor
---@overload fun(fileData: love.FileData, hotx: number, hoty: number):love.Cursor
---@param imageData love.ImageData # The ImageData to use for the new Cursor.
---@param hotx number # The x-coordinate in the ImageData of the cursor's hot spot.
---@param hoty number # The y-coordinate in the ImageData of the cursor's hot spot.
---@return love.Cursor cursor # The new Cursor object.
function love.mouse.newCursor(imageData, hotx, hoty) end

---
---Sets the current mouse cursor.
---
---@overload fun()
---@param cursor love.Cursor # The Cursor object to use as the current mouse cursor.
function love.mouse.setCursor(cursor) end

---
---Grabs the mouse and confines it to the window.
---
---@param grab boolean # True to confine the mouse, false to let it leave the window.
function love.mouse.setGrabbed(grab) end

---
---Sets the current position of the mouse. Non-integer values are floored.
---
function love.mouse.setPosition() end

---
---Sets whether relative mode is enabled for the mouse.
---
---When relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen.
---
---The reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated.
---
---@param enable boolean # True to enable relative mode, false to disable it.
function love.mouse.setRelativeMode(enable) end

---
---Sets the current visibility of the cursor.
---
---@param visible boolean # True to set the cursor to visible, false to hide the cursor.
function love.mouse.setVisible(visible) end

---
---Sets the current X position of the mouse.
---
---Non-integer values are floored.
---
function love.mouse.setX() end

---
---Sets the current Y position of the mouse.
---
---Non-integer values are floored.
---
function love.mouse.setY() end

---
---Represents a hardware cursor.
---
---@class love.Cursor: love.Object
local Cursor = {}

---
---Gets the type of the Cursor.
---
---@return love.CursorType ctype # The type of the Cursor.
function Cursor:getType() end

---
---Types of hardware cursors.
---
---@class love.CursorType
---
---The cursor is using a custom image.
---
---@field image integer
---
---An arrow pointer.
---
---@field arrow integer
---
---An I-beam, normally used when mousing over editable or selectable text.
---
---@field ibeam integer
---
---Wait graphic.
---
---@field wait integer
---
---Small wait cursor with an arrow pointer.
---
---@field waitarrow integer
---
---Crosshair symbol.
---
---@field crosshair integer
---
---Double arrow pointing to the top-left and bottom-right.
---
---@field sizenwse integer
---
---Double arrow pointing to the top-right and bottom-left.
---
---@field sizenesw integer
---
---Double arrow pointing left and right.
---
---@field sizewe integer
---
---Double arrow pointing up and down.
---
---@field sizens integer
---
---Four-pointed arrow pointing up, down, left, and right.
---
---@field sizeall integer
---
---Slashed circle or crossbones.
---
---@field no integer
---
---Hand symbol.
---
---@field hand integer