├── .gitignore ├── config.json ├── README.md ├── update.sh └── library ├── love ├── touch.lua ├── timer.lua ├── video.lua ├── system.lua ├── event.lua ├── sound.lua ├── thread.lua ├── font.lua ├── mouse.lua ├── data.lua ├── joystick.lua ├── window.lua ├── image.lua ├── filesystem.lua ├── keyboard.lua └── math.lua └── love.lua /.gitignore: -------------------------------------------------------------------------------- 1 | lua-language-server -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "LÖVE", 3 | "words" : ["love%.%w+"], 4 | "settings" : { 5 | "Lua.runtime.version" : "LuaJIT", 6 | "Lua.runtime.special" : { 7 | "love.filesystem.load" : "loadfile" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LÖVE Definitions 2 | 3 | Definitions for the LÖVE 2D game framework, generated from 4 | [love-api](https://github.com/love2d-community/love-api) using 5 | [LLSs meta build script](https://github.com/LuaLS/lua-language-server/blob/master/tools/build-3rd-meta.lua) 6 | 7 | ## Usage 8 | 9 | Run [`update.sh`](update.sh) to update, commit, and push changes. 10 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | # Update LLS source 2 | [ ! -d "lua-language-server" ] && git clone --recurse-submodules -j8 https://github.com/LuaLS/lua-language-server.git 3 | cd lua-language-server || exit 4 | git pull 5 | 6 | # Build LLS 7 | ./make.sh 8 | 9 | # Update love-api 10 | git submodule update --remote 3rd/love-api 11 | 12 | # Build 3rd meta 13 | ./bin/lua-language-server ./tools/build-3rd-meta.lua 14 | 15 | # Copy 3rd meta to addon 16 | cd .. || exit 17 | rm -r library 18 | cp -r lua-language-server/meta/3rd/love2d/library/ library 19 | 20 | # Install and run formatter 21 | cargo install stylua --features luajit 22 | export PATH="~/.cargo/bin:$PATH" 23 | stylua library 24 | 25 | # Commit changes 26 | git add library 27 | git commit -m "Updated meta files" 28 | git push -------------------------------------------------------------------------------- /library/love/touch.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to touch-screen presses. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.touch) 8 | --- 9 | ---@class love.touch 10 | love.touch = {} 11 | 12 | --- 13 | ---Gets the current position of the specified touch-press, in pixels. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.touch.getPosition) 17 | --- 18 | ---@param id lightuserdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. 19 | ---@return number x # The position along the x-axis of the touch-press inside the window, in pixels. 20 | ---@return number y # The position along the y-axis of the touch-press inside the window, in pixels. 21 | function love.touch.getPosition(id) end 22 | 23 | --- 24 | ---Gets the current pressure of the specified touch-press. 25 | --- 26 | --- 27 | ---[Open in Browser](https://love2d.org/wiki/love.touch.getPressure) 28 | --- 29 | ---@param id lightuserdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. 30 | ---@return number pressure # The pressure of the touch-press. Most touch screens aren't pressure sensitive, in which case the pressure will be 1. 31 | function love.touch.getPressure(id) end 32 | 33 | --- 34 | ---Gets a list of all active touch-presses. 35 | --- 36 | --- 37 | ---[Open in Browser](https://love2d.org/wiki/love.touch.getTouches) 38 | --- 39 | ---@return lightuserdata[] touches # A list of active touch-press id values, which can be used with love.touch.getPosition. 40 | function love.touch.getTouches() end 41 | -------------------------------------------------------------------------------- /library/love/timer.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to the user's clock. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.timer) 8 | --- 9 | ---@class love.timer 10 | love.timer = {} 11 | 12 | --- 13 | ---Returns the average delta time (seconds per frame) over the last second. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.timer.getAverageDelta) 17 | --- 18 | ---@return number delta # The average delta time over the last second. 19 | function love.timer.getAverageDelta() end 20 | 21 | --- 22 | ---Returns the time between the last two frames. 23 | --- 24 | --- 25 | ---[Open in Browser](https://love2d.org/wiki/love.timer.getDelta) 26 | --- 27 | ---@return number dt # The time passed (in seconds). 28 | function love.timer.getDelta() end 29 | 30 | --- 31 | ---Returns the current frames per second. 32 | --- 33 | --- 34 | ---[Open in Browser](https://love2d.org/wiki/love.timer.getFPS) 35 | --- 36 | ---@return number fps # The current FPS. 37 | function love.timer.getFPS() end 38 | 39 | --- 40 | ---Returns the value of a timer with an unspecified starting time. 41 | --- 42 | ---This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown. 43 | --- 44 | --- 45 | ---[Open in Browser](https://love2d.org/wiki/love.timer.getTime) 46 | --- 47 | ---@return number time # The time in seconds. Given as a decimal, accurate to the microsecond. 48 | function love.timer.getTime() end 49 | 50 | --- 51 | ---Pauses the current thread for the specified amount of time. 52 | --- 53 | --- 54 | ---[Open in Browser](https://love2d.org/wiki/love.timer.sleep) 55 | --- 56 | ---@param s number # Seconds to sleep for. 57 | function love.timer.sleep(s) end 58 | 59 | --- 60 | ---Measures the time between two frames. 61 | --- 62 | ---Calling this changes the return value of love.timer.getDelta. 63 | --- 64 | --- 65 | ---[Open in Browser](https://love2d.org/wiki/love.timer.step) 66 | --- 67 | ---@return number dt # The time passed (in seconds). 68 | function love.timer.step() end 69 | -------------------------------------------------------------------------------- /library/love/video.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---This module is responsible for decoding, controlling, and streaming video files. 5 | --- 6 | ---It can't draw the videos, see love.graphics.newVideo and Video objects for that. 7 | --- 8 | --- 9 | ---[Open in Browser](https://love2d.org/wiki/love.video) 10 | --- 11 | ---@class love.video 12 | love.video = {} 13 | 14 | --- 15 | ---Creates a new VideoStream. Currently only Ogg Theora video files are supported. VideoStreams can't draw videos, see love.graphics.newVideo for that. 16 | --- 17 | --- 18 | ---[Open in Browser](https://love2d.org/wiki/love.video.newVideoStream) 19 | --- 20 | ---@overload fun(file: love.File):love.VideoStream 21 | ---@param filename string # The file path to the Ogg Theora video file. 22 | ---@return love.VideoStream videostream # A new VideoStream. 23 | function love.video.newVideoStream(filename) end 24 | 25 | --- 26 | ---An object which decodes, streams, and controls Videos. 27 | --- 28 | --- 29 | ---[Open in Browser](https://love2d.org/wiki/love.video) 30 | --- 31 | ---@class love.VideoStream: love.Object 32 | local VideoStream = {} 33 | 34 | --- 35 | ---Gets the filename of the VideoStream. 36 | --- 37 | --- 38 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:getFilename) 39 | --- 40 | ---@return string filename # The filename of the VideoStream 41 | function VideoStream:getFilename() end 42 | 43 | --- 44 | ---Gets whether the VideoStream is playing. 45 | --- 46 | --- 47 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:isPlaying) 48 | --- 49 | ---@return boolean playing # Whether the VideoStream is playing. 50 | function VideoStream:isPlaying() end 51 | 52 | --- 53 | ---Pauses the VideoStream. 54 | --- 55 | --- 56 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:pause) 57 | --- 58 | function VideoStream:pause() end 59 | 60 | --- 61 | ---Plays the VideoStream. 62 | --- 63 | --- 64 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:play) 65 | --- 66 | function VideoStream:play() end 67 | 68 | --- 69 | ---Rewinds the VideoStream. Synonym to VideoStream:seek(0). 70 | --- 71 | --- 72 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:rewind) 73 | --- 74 | function VideoStream:rewind() end 75 | 76 | --- 77 | ---Sets the current playback position of the VideoStream. 78 | --- 79 | --- 80 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:seek) 81 | --- 82 | ---@param offset number # The time in seconds since the beginning of the VideoStream. 83 | function VideoStream:seek(offset) end 84 | 85 | --- 86 | ---Gets the current playback position of the VideoStream. 87 | --- 88 | --- 89 | ---[Open in Browser](https://love2d.org/wiki/VideoStream:tell) 90 | --- 91 | ---@return number seconds # The number of seconds sionce the beginning of the VideoStream. 92 | function VideoStream:tell() end 93 | -------------------------------------------------------------------------------- /library/love/system.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides access to information about the user's system. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.system) 8 | --- 9 | ---@class love.system 10 | love.system = {} 11 | 12 | --- 13 | ---Gets text from the clipboard. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.system.getClipboardText) 17 | --- 18 | ---@return string text # The text currently held in the system's clipboard. 19 | function love.system.getClipboardText() end 20 | 21 | --- 22 | ---Gets the current operating system. In general, LÖVE abstracts away the need to know the current operating system, but there are a few cases where it can be useful (especially in combination with os.execute.) 23 | --- 24 | --- 25 | ---[Open in Browser](https://love2d.org/wiki/love.system.getOS) 26 | --- 27 | ---@return string osString # The current operating system. 'OS X', 'Windows', 'Linux', 'Android' or 'iOS'. 28 | function love.system.getOS() end 29 | 30 | --- 31 | ---Gets information about the system's power supply. 32 | --- 33 | --- 34 | ---[Open in Browser](https://love2d.org/wiki/love.system.getPowerInfo) 35 | --- 36 | ---@return love.PowerState state # The basic state of the power supply. 37 | ---@return number percent # Percentage of battery life left, between 0 and 100. nil if the value can't be determined or there's no battery. 38 | ---@return number seconds # Seconds of battery life left. nil if the value can't be determined or there's no battery. 39 | function love.system.getPowerInfo() end 40 | 41 | --- 42 | ---Gets the amount of logical processor in the system. 43 | --- 44 | --- 45 | ---[Open in Browser](https://love2d.org/wiki/love.system.getProcessorCount) 46 | --- 47 | ---@return number processorCount # Amount of logical processors. 48 | function love.system.getProcessorCount() end 49 | 50 | --- 51 | ---Gets whether another application on the system is playing music in the background. 52 | --- 53 | ---Currently this is implemented on iOS and Android, and will always return false on other operating systems. The t.audio.mixwithsystem flag in love.conf can be used to configure whether background audio / music from other apps should play while LÖVE is open. 54 | --- 55 | --- 56 | ---[Open in Browser](https://love2d.org/wiki/love.system.hasBackgroundMusic) 57 | --- 58 | ---@return boolean backgroundmusic # True if the user is playing music in the background via another app, false otherwise. 59 | function love.system.hasBackgroundMusic() end 60 | 61 | --- 62 | ---Opens a URL with the user's web or file browser. 63 | --- 64 | --- 65 | ---[Open in Browser](https://love2d.org/wiki/love.system.openURL) 66 | --- 67 | ---@param url string # The URL to open. Must be formatted as a proper URL. 68 | ---@return boolean success # Whether the URL was opened successfully. 69 | function love.system.openURL(url) end 70 | 71 | --- 72 | ---Puts text in the clipboard. 73 | --- 74 | --- 75 | ---[Open in Browser](https://love2d.org/wiki/love.system.setClipboardText) 76 | --- 77 | ---@param text string # The new text to hold in the system's clipboard. 78 | function love.system.setClipboardText(text) end 79 | 80 | --- 81 | ---Causes the device to vibrate, if possible. Currently this will only work on Android and iOS devices that have a built-in vibration motor. 82 | --- 83 | --- 84 | ---[Open in Browser](https://love2d.org/wiki/love.system.vibrate) 85 | --- 86 | ---@param seconds? number # The duration to vibrate for. If called on an iOS device, it will always vibrate for 0.5 seconds due to limitations in the iOS system APIs. 87 | function love.system.vibrate(seconds) end 88 | 89 | --- 90 | ---The basic state of the system's power supply. 91 | --- 92 | --- 93 | ---[Open in Browser](https://love2d.org/wiki/PowerState) 94 | --- 95 | ---@alias love.PowerState 96 | --- 97 | ---Cannot determine power status. 98 | --- 99 | ---| "unknown" 100 | --- 101 | ---Not plugged in, running on a battery. 102 | --- 103 | ---| "battery" 104 | --- 105 | ---Plugged in, no battery available. 106 | --- 107 | ---| "nobattery" 108 | --- 109 | ---Plugged in, charging battery. 110 | --- 111 | ---| "charging" 112 | --- 113 | ---Plugged in, battery is fully charged. 114 | --- 115 | ---| "charged" 116 | -------------------------------------------------------------------------------- /library/love/event.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Manages events, like keypresses. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.event) 8 | --- 9 | ---@class love.event 10 | love.event = {} 11 | 12 | --- 13 | ---Clears the event queue. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.event.clear) 17 | --- 18 | function love.event.clear() end 19 | 20 | --- 21 | ---Returns an iterator for messages in the event queue. 22 | --- 23 | --- 24 | ---[Open in Browser](https://love2d.org/wiki/love.event.poll) 25 | --- 26 | ---@return function i # Iterator function usable in a for loop. 27 | function love.event.poll() end 28 | 29 | --- 30 | ---Pump events into the event queue. 31 | --- 32 | ---This is a low-level function, and is usually not called by the user, but by love.run. 33 | --- 34 | ---Note that this does need to be called for any OS to think you're still running, 35 | --- 36 | ---and if you want to handle OS-generated events at all (think callbacks). 37 | --- 38 | --- 39 | ---[Open in Browser](https://love2d.org/wiki/love.event.pump) 40 | --- 41 | function love.event.pump() end 42 | 43 | --- 44 | ---Adds an event to the event queue. 45 | --- 46 | ---From 0.10.0 onwards, you may pass an arbitrary amount of arguments with this function, though the default callbacks don't ever use more than six. 47 | --- 48 | --- 49 | ---[Open in Browser](https://love2d.org/wiki/love.event.push) 50 | --- 51 | ---@param n love.Event # The name of the event. 52 | ---@param a? any # First event argument. 53 | ---@param b? any # Second event argument. 54 | ---@param c? any # Third event argument. 55 | ---@param d? any # Fourth event argument. 56 | ---@param e? any # Fifth event argument. 57 | ---@param f? any # Sixth event argument. 58 | ---@vararg any # Further event arguments may follow. 59 | function love.event.push(n, a, b, c, d, e, f, ...) end 60 | 61 | --- 62 | ---Adds the quit event to the queue. 63 | --- 64 | ---The quit event is a signal for the event handler to close LÖVE. It's possible to abort the exit process with the love.quit callback. 65 | --- 66 | --- 67 | ---[Open in Browser](https://love2d.org/wiki/love.event.quit) 68 | --- 69 | ---@overload fun(restart: string|'restart') 70 | ---@param exitstatus? number # The program exit status to use when closing the application. 71 | function love.event.quit(exitstatus) end 72 | 73 | --- 74 | ---Like love.event.poll(), but blocks until there is an event in the queue. 75 | --- 76 | --- 77 | ---[Open in Browser](https://love2d.org/wiki/love.event.wait) 78 | --- 79 | ---@return love.Event n # The name of event. 80 | ---@return any a # First event argument. 81 | ---@return any b # Second event argument. 82 | ---@return any c # Third event argument. 83 | ---@return any d # Fourth event argument. 84 | ---@return any e # Fifth event argument. 85 | ---@return any f # Sixth event argument. 86 | function love.event.wait() end 87 | 88 | --- 89 | ---Arguments to love.event.push() and the like. 90 | --- 91 | ---Since 0.8.0, event names are no longer abbreviated. 92 | --- 93 | --- 94 | ---[Open in Browser](https://love2d.org/wiki/Event) 95 | --- 96 | ---@alias love.Event 97 | --- 98 | ---Window focus gained or lost 99 | --- 100 | ---| "focus" 101 | --- 102 | ---Joystick pressed 103 | --- 104 | ---| "joystickpressed" 105 | --- 106 | ---Joystick released 107 | --- 108 | ---| "joystickreleased" 109 | --- 110 | ---Key pressed 111 | --- 112 | ---| "keypressed" 113 | --- 114 | ---Key released 115 | --- 116 | ---| "keyreleased" 117 | --- 118 | ---Mouse pressed 119 | --- 120 | ---| "mousepressed" 121 | --- 122 | ---Mouse released 123 | --- 124 | ---| "mousereleased" 125 | --- 126 | ---Quit 127 | --- 128 | ---| "quit" 129 | --- 130 | ---Window size changed by the user 131 | --- 132 | ---| "resize" 133 | --- 134 | ---Window is minimized or un-minimized by the user 135 | --- 136 | ---| "visible" 137 | --- 138 | ---Window mouse focus gained or lost 139 | --- 140 | ---| "mousefocus" 141 | --- 142 | ---A Lua error has occurred in a thread 143 | --- 144 | ---| "threaderror" 145 | --- 146 | ---Joystick connected 147 | --- 148 | ---| "joystickadded" 149 | --- 150 | ---Joystick disconnected 151 | --- 152 | ---| "joystickremoved" 153 | --- 154 | ---Joystick axis motion 155 | --- 156 | ---| "joystickaxis" 157 | --- 158 | ---Joystick hat pressed 159 | --- 160 | ---| "joystickhat" 161 | --- 162 | ---Joystick's virtual gamepad button pressed 163 | --- 164 | ---| "gamepadpressed" 165 | --- 166 | ---Joystick's virtual gamepad button released 167 | --- 168 | ---| "gamepadreleased" 169 | --- 170 | ---Joystick's virtual gamepad axis moved 171 | --- 172 | ---| "gamepadaxis" 173 | --- 174 | ---User entered text 175 | --- 176 | ---| "textinput" 177 | --- 178 | ---Mouse position changed 179 | --- 180 | ---| "mousemoved" 181 | --- 182 | ---Running out of memory on mobile devices system 183 | --- 184 | ---| "lowmemory" 185 | --- 186 | ---Candidate text for an IME changed 187 | --- 188 | ---| "textedited" 189 | --- 190 | ---Mouse wheel moved 191 | --- 192 | ---| "wheelmoved" 193 | --- 194 | ---Touch screen touched 195 | --- 196 | ---| "touchpressed" 197 | --- 198 | ---Touch screen stop touching 199 | --- 200 | ---| "touchreleased" 201 | --- 202 | ---Touch press moved inside touch screen 203 | --- 204 | ---| "touchmoved" 205 | --- 206 | ---Directory is dragged and dropped onto the window 207 | --- 208 | ---| "directorydropped" 209 | --- 210 | ---File is dragged and dropped onto the window. 211 | --- 212 | ---| "filedropped" 213 | --- 214 | ---Joystick pressed 215 | --- 216 | ---| "jp" 217 | --- 218 | ---Joystick released 219 | --- 220 | ---| "jr" 221 | --- 222 | ---Key pressed 223 | --- 224 | ---| "kp" 225 | --- 226 | ---Key released 227 | --- 228 | ---| "kr" 229 | --- 230 | ---Mouse pressed 231 | --- 232 | ---| "mp" 233 | --- 234 | ---Mouse released 235 | --- 236 | ---| "mr" 237 | --- 238 | ---Quit 239 | --- 240 | ---| "q" 241 | --- 242 | ---Window focus gained or lost 243 | --- 244 | ---| "f" 245 | -------------------------------------------------------------------------------- /library/love/sound.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---This module is responsible for decoding sound files. It can't play the sounds, see love.audio for that. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.sound) 8 | --- 9 | ---@class love.sound 10 | love.sound = {} 11 | 12 | --- 13 | ---Attempts to find a decoder for the encoded sound data in the specified file. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.sound.newDecoder) 17 | --- 18 | ---@overload fun(filename: string, buffer?: number):love.Decoder 19 | ---@param file love.File # The file with encoded sound data. 20 | ---@param buffer? number # The size of each decoded chunk, in bytes. 21 | ---@return love.Decoder decoder # A new Decoder object. 22 | function love.sound.newDecoder(file, buffer) end 23 | 24 | --- 25 | ---Creates new SoundData from a filepath, File, or Decoder. It's also possible to create SoundData with a custom sample rate, channel and bit depth. 26 | --- 27 | ---The sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way. 28 | --- 29 | --- 30 | ---[Open in Browser](https://love2d.org/wiki/love.sound.newSoundData) 31 | --- 32 | ---@overload fun(file: love.File):love.SoundData 33 | ---@overload fun(decoder: love.Decoder):love.SoundData 34 | ---@overload fun(samples: number, rate?: number, bits?: number, channels?: number):love.SoundData 35 | ---@param filename string # The file name of the file to load. 36 | ---@return love.SoundData soundData # A new SoundData object. 37 | function love.sound.newSoundData(filename) end 38 | 39 | --- 40 | ---An object which can gradually decode a sound file. 41 | --- 42 | --- 43 | ---[Open in Browser](https://love2d.org/wiki/love.sound) 44 | --- 45 | ---@class love.Decoder: love.Object 46 | local Decoder = {} 47 | 48 | --- 49 | ---Creates a new copy of current decoder. 50 | --- 51 | ---The new decoder will start decoding from the beginning of the audio stream. 52 | --- 53 | --- 54 | ---[Open in Browser](https://love2d.org/wiki/Decoder:clone) 55 | --- 56 | ---@return love.Decoder decoder # New copy of the decoder. 57 | function Decoder:clone() end 58 | 59 | --- 60 | ---Decodes the audio and returns a SoundData object containing the decoded audio data. 61 | --- 62 | --- 63 | ---[Open in Browser](https://love2d.org/wiki/Decoder:decode) 64 | --- 65 | ---@return love.SoundData soundData # Decoded audio data. 66 | function Decoder:decode() end 67 | 68 | --- 69 | ---Returns the number of bits per sample. 70 | --- 71 | --- 72 | ---[Open in Browser](https://love2d.org/wiki/Decoder:getBitDepth) 73 | --- 74 | ---@return number bitDepth # Either 8, or 16. 75 | function Decoder:getBitDepth() end 76 | 77 | --- 78 | ---Returns the number of channels in the stream. 79 | --- 80 | --- 81 | ---[Open in Browser](https://love2d.org/wiki/Decoder:getChannelCount) 82 | --- 83 | ---@return number channels # 1 for mono, 2 for stereo. 84 | function Decoder:getChannelCount() end 85 | 86 | --- 87 | ---Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all. 88 | --- 89 | --- 90 | ---[Open in Browser](https://love2d.org/wiki/Decoder:getDuration) 91 | --- 92 | ---@return number duration # The duration of the sound file in seconds, or -1 if it cannot be determined. 93 | function Decoder:getDuration() end 94 | 95 | --- 96 | ---Returns the sample rate of the Decoder. 97 | --- 98 | --- 99 | ---[Open in Browser](https://love2d.org/wiki/Decoder:getSampleRate) 100 | --- 101 | ---@return number rate # Number of samples per second. 102 | function Decoder:getSampleRate() end 103 | 104 | --- 105 | ---Sets the currently playing position of the Decoder. 106 | --- 107 | --- 108 | ---[Open in Browser](https://love2d.org/wiki/Decoder:seek) 109 | --- 110 | ---@param offset number # The position to seek to, in seconds. 111 | function Decoder:seek(offset) end 112 | 113 | --- 114 | ---Contains raw audio samples. 115 | --- 116 | ---You can not play SoundData back directly. You must wrap a Source object around it. 117 | --- 118 | --- 119 | ---[Open in Browser](https://love2d.org/wiki/love.sound) 120 | --- 121 | ---@class love.SoundData: love.Data, love.Object 122 | local SoundData = {} 123 | 124 | --- 125 | ---Returns the number of bits per sample. 126 | --- 127 | --- 128 | ---[Open in Browser](https://love2d.org/wiki/SoundData:getBitDepth) 129 | --- 130 | ---@return number bitdepth # Either 8, or 16. 131 | function SoundData:getBitDepth() end 132 | 133 | --- 134 | ---Returns the number of channels in the SoundData. 135 | --- 136 | --- 137 | ---[Open in Browser](https://love2d.org/wiki/SoundData:getChannelCount) 138 | --- 139 | ---@return number channels # 1 for mono, 2 for stereo. 140 | function SoundData:getChannelCount() end 141 | 142 | --- 143 | ---Gets the duration of the sound data. 144 | --- 145 | --- 146 | ---[Open in Browser](https://love2d.org/wiki/SoundData:getDuration) 147 | --- 148 | ---@return number duration # The duration of the sound data in seconds. 149 | function SoundData:getDuration() end 150 | 151 | --- 152 | ---Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order. 153 | --- 154 | --- 155 | ---[Open in Browser](https://love2d.org/wiki/SoundData:getSample) 156 | --- 157 | ---@overload fun(self: love.SoundData, i: number, channel: number):number 158 | ---@param i number # An integer value specifying the position of the sample (starting at 0). 159 | ---@return number sample # The normalized samplepoint (range -1.0 to 1.0). 160 | function SoundData:getSample(i) end 161 | 162 | --- 163 | ---Returns the number of samples per channel of the SoundData. 164 | --- 165 | --- 166 | ---[Open in Browser](https://love2d.org/wiki/SoundData:getSampleCount) 167 | --- 168 | ---@return number count # Total number of samples. 169 | function SoundData:getSampleCount() end 170 | 171 | --- 172 | ---Returns the sample rate of the SoundData. 173 | --- 174 | --- 175 | ---[Open in Browser](https://love2d.org/wiki/SoundData:getSampleRate) 176 | --- 177 | ---@return number rate # Number of samples per second. 178 | function SoundData:getSampleRate() end 179 | 180 | --- 181 | ---Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order. 182 | --- 183 | --- 184 | ---[Open in Browser](https://love2d.org/wiki/SoundData:setSample) 185 | --- 186 | ---@overload fun(self: love.SoundData, i: number, channel: number, sample: number) 187 | ---@param i number # An integer value specifying the position of the sample (starting at 0). 188 | ---@param sample number # The normalized samplepoint (range -1.0 to 1.0). 189 | function SoundData:setSample(i, sample) end 190 | -------------------------------------------------------------------------------- /library/love/thread.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Allows you to work with threads. 5 | --- 6 | ---Threads are separate Lua environments, running in parallel to the main code. As their code runs separately, they can be used to compute complex operations without adversely affecting the frame rate of the main thread. However, as they are separate environments, they cannot access the variables and functions of the main thread, and communication between threads is limited. 7 | --- 8 | ---All LOVE objects (userdata) are shared among threads so you'll only have to send their references across threads. You may run into concurrency issues if you manipulate an object on multiple threads at the same time. 9 | --- 10 | ---When a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require. 11 | --- 12 | --- 13 | ---[Open in Browser](https://love2d.org/wiki/love.thread) 14 | --- 15 | ---@class love.thread 16 | love.thread = {} 17 | 18 | --- 19 | ---Creates or retrieves a named thread channel. 20 | --- 21 | --- 22 | ---[Open in Browser](https://love2d.org/wiki/love.thread.getChannel) 23 | --- 24 | ---@param name string # The name of the channel you want to create or retrieve. 25 | ---@return love.Channel channel # The Channel object associated with the name. 26 | function love.thread.getChannel(name) end 27 | 28 | --- 29 | ---Create a new unnamed thread channel. 30 | --- 31 | ---One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel. 32 | --- 33 | --- 34 | ---[Open in Browser](https://love2d.org/wiki/love.thread.newChannel) 35 | --- 36 | ---@return love.Channel channel # The new Channel object. 37 | function love.thread.newChannel() end 38 | 39 | --- 40 | ---Creates a new Thread from a filename, string or FileData object containing Lua code. 41 | --- 42 | --- 43 | ---[Open in Browser](https://love2d.org/wiki/love.thread.newThread) 44 | --- 45 | ---@overload fun(fileData: love.FileData):love.Thread 46 | ---@overload fun(codestring: string):love.Thread 47 | ---@param filename string # The name of the Lua file to use as the source. 48 | ---@return love.Thread thread # A new Thread that has yet to be started. 49 | function love.thread.newThread(filename) end 50 | 51 | --- 52 | ---An object which can be used to send and receive data between different threads. 53 | --- 54 | --- 55 | ---[Open in Browser](https://love2d.org/wiki/love.thread) 56 | --- 57 | ---@class love.Channel: love.Object 58 | local Channel = {} 59 | 60 | --- 61 | ---Clears all the messages in the Channel queue. 62 | --- 63 | --- 64 | ---[Open in Browser](https://love2d.org/wiki/Channel:clear) 65 | --- 66 | function Channel:clear() end 67 | 68 | --- 69 | ---Retrieves the value of a Channel message and removes it from the message queue. 70 | --- 71 | ---It waits until a message is in the queue then returns the message value. 72 | --- 73 | --- 74 | ---[Open in Browser](https://love2d.org/wiki/Channel:demand) 75 | --- 76 | ---@overload fun(self: love.Channel, timeout: number):any 77 | ---@return any value # The contents of the message. 78 | function Channel:demand() end 79 | 80 | --- 81 | ---Retrieves the number of messages in the thread Channel queue. 82 | --- 83 | --- 84 | ---[Open in Browser](https://love2d.org/wiki/Channel:getCount) 85 | --- 86 | ---@return number count # The number of messages in the queue. 87 | function Channel:getCount() end 88 | 89 | --- 90 | ---Gets whether a pushed value has been popped or otherwise removed from the Channel. 91 | --- 92 | --- 93 | ---[Open in Browser](https://love2d.org/wiki/Channel:hasRead) 94 | --- 95 | ---@param id number # An id value previously returned by Channel:push. 96 | ---@return boolean hasread # Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear. 97 | function Channel:hasRead(id) end 98 | 99 | --- 100 | ---Retrieves the value of a Channel message, but leaves it in the queue. 101 | --- 102 | ---It returns nil if there's no message in the queue. 103 | --- 104 | --- 105 | ---[Open in Browser](https://love2d.org/wiki/Channel:peek) 106 | --- 107 | ---@return any value # The contents of the message. 108 | function Channel:peek() end 109 | 110 | --- 111 | ---Executes the specified function atomically with respect to this Channel. 112 | --- 113 | ---Calling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel's methods at the same time, the different calls on each Thread might end up interleaved (e.g. one or more of the second thread's calls may happen in between the first thread's calls.) 114 | --- 115 | ---This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned. 116 | --- 117 | --- 118 | ---[Open in Browser](https://love2d.org/wiki/Channel:performAtomic) 119 | --- 120 | ---@param func function # The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called. 121 | ---@vararg any # Additional arguments that the given function will receive when it is called. 122 | ---@return any ret1 # The first return value of the given function (if any.) 123 | function Channel:performAtomic(func, ...) end 124 | 125 | --- 126 | ---Retrieves the value of a Channel message and removes it from the message queue. 127 | --- 128 | ---It returns nil if there are no messages in the queue. 129 | --- 130 | --- 131 | ---[Open in Browser](https://love2d.org/wiki/Channel:pop) 132 | --- 133 | ---@return any value # The contents of the message. 134 | function Channel:pop() end 135 | 136 | --- 137 | ---Send a message to the thread Channel. 138 | --- 139 | ---See Variant for the list of supported types. 140 | --- 141 | --- 142 | ---[Open in Browser](https://love2d.org/wiki/Channel:push) 143 | --- 144 | ---@param value any # The contents of the message. 145 | ---@return number id # Identifier which can be supplied to Channel:hasRead 146 | function Channel:push(value) end 147 | 148 | --- 149 | ---Send a message to the thread Channel and wait for a thread to accept it. 150 | --- 151 | ---See Variant for the list of supported types. 152 | --- 153 | --- 154 | ---[Open in Browser](https://love2d.org/wiki/Channel:supply) 155 | --- 156 | ---@overload fun(self: love.Channel, value: any, timeout: number):boolean 157 | ---@param value any # The contents of the message. 158 | ---@return boolean success # Whether the message was successfully supplied (always true). 159 | function Channel:supply(value) end 160 | 161 | --- 162 | ---A Thread is a chunk of code that can run in parallel with other threads. Data can be sent between different threads with Channel objects. 163 | --- 164 | --- 165 | ---[Open in Browser](https://love2d.org/wiki/love.thread) 166 | --- 167 | ---@class love.Thread: love.Object 168 | local Thread = {} 169 | 170 | --- 171 | ---Retrieves the error string from the thread if it produced an error. 172 | --- 173 | --- 174 | ---[Open in Browser](https://love2d.org/wiki/Thread:getError) 175 | --- 176 | ---@return string err # The error message, or nil if the Thread has not caused an error. 177 | function Thread:getError() end 178 | 179 | --- 180 | ---Returns whether the thread is currently running. 181 | --- 182 | ---Threads which are not running can be (re)started with Thread:start. 183 | --- 184 | --- 185 | ---[Open in Browser](https://love2d.org/wiki/Thread:isRunning) 186 | --- 187 | ---@return boolean value # True if the thread is running, false otherwise. 188 | function Thread:isRunning() end 189 | 190 | --- 191 | ---Starts the thread. 192 | --- 193 | ---Beginning with version 0.9.0, threads can be restarted after they have completed their execution. 194 | --- 195 | --- 196 | ---[Open in Browser](https://love2d.org/wiki/Thread:start) 197 | --- 198 | ---@overload fun(self: love.Thread, ...) 199 | function Thread:start() end 200 | 201 | --- 202 | ---Wait for a thread to finish. 203 | --- 204 | ---This call will block until the thread finishes. 205 | --- 206 | --- 207 | ---[Open in Browser](https://love2d.org/wiki/Thread:wait) 208 | --- 209 | function Thread:wait() end 210 | -------------------------------------------------------------------------------- /library/love/font.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Allows you to work with fonts. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.font) 8 | --- 9 | ---@class love.font 10 | love.font = {} 11 | 12 | --- 13 | ---Creates a new BMFont Rasterizer. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.font.newBMFontRasterizer) 17 | --- 18 | ---@overload fun(fileName: string, glyphs: string, dpiscale?: number):love.Rasterizer 19 | ---@param imageData love.ImageData # The image data containing the drawable pictures of font glyphs. 20 | ---@param glyphs string # The sequence of glyphs in the ImageData. 21 | ---@param dpiscale? number # DPI scale. 22 | ---@return love.Rasterizer rasterizer # The rasterizer. 23 | function love.font.newBMFontRasterizer(imageData, glyphs, dpiscale) end 24 | 25 | --- 26 | ---Creates a new GlyphData. 27 | --- 28 | --- 29 | ---[Open in Browser](https://love2d.org/wiki/love.font.newGlyphData) 30 | --- 31 | ---@param rasterizer love.Rasterizer # The Rasterizer containing the font. 32 | ---@param glyph number # The character code of the glyph. 33 | function love.font.newGlyphData(rasterizer, glyph) end 34 | 35 | --- 36 | ---Creates a new Image Rasterizer. 37 | --- 38 | --- 39 | ---[Open in Browser](https://love2d.org/wiki/love.font.newImageRasterizer) 40 | --- 41 | ---@param imageData love.ImageData # Font image data. 42 | ---@param glyphs string # String containing font glyphs. 43 | ---@param extraSpacing? number # Font extra spacing. 44 | ---@param dpiscale? number # Font DPI scale. 45 | ---@return love.Rasterizer rasterizer # The rasterizer. 46 | function love.font.newImageRasterizer(imageData, glyphs, extraSpacing, dpiscale) end 47 | 48 | --- 49 | ---Creates a new Rasterizer. 50 | --- 51 | --- 52 | ---[Open in Browser](https://love2d.org/wiki/love.font.newRasterizer) 53 | --- 54 | ---@overload fun(data: love.FileData):love.Rasterizer 55 | ---@overload fun(size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer 56 | ---@overload fun(fileName: string, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer 57 | ---@overload fun(fileData: love.FileData, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer 58 | ---@overload fun(imageData: love.ImageData, glyphs: string, dpiscale?: number):love.Rasterizer 59 | ---@overload fun(fileName: string, glyphs: string, dpiscale?: number):love.Rasterizer 60 | ---@param filename string # The font file. 61 | ---@return love.Rasterizer rasterizer # The rasterizer. 62 | function love.font.newRasterizer(filename) end 63 | 64 | --- 65 | ---Creates a new TrueType Rasterizer. 66 | --- 67 | --- 68 | ---[Open in Browser](https://love2d.org/wiki/love.font.newTrueTypeRasterizer) 69 | --- 70 | ---@overload fun(fileName: string, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer 71 | ---@overload fun(fileData: love.FileData, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer 72 | ---@param size? number # The font size. 73 | ---@param hinting? love.HintingMode # True Type hinting mode. 74 | ---@param dpiscale? number # The font DPI scale. 75 | ---@return love.Rasterizer rasterizer # The rasterizer. 76 | function love.font.newTrueTypeRasterizer(size, hinting, dpiscale) end 77 | 78 | --- 79 | ---A GlyphData represents a drawable symbol of a font Rasterizer. 80 | --- 81 | --- 82 | ---[Open in Browser](https://love2d.org/wiki/love.font) 83 | --- 84 | ---@class love.GlyphData: love.Data, love.Object 85 | local GlyphData = {} 86 | 87 | --- 88 | ---Gets glyph advance. 89 | --- 90 | --- 91 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getAdvance) 92 | --- 93 | ---@return number advance # Glyph advance. 94 | function GlyphData:getAdvance() end 95 | 96 | --- 97 | ---Gets glyph bearing. 98 | --- 99 | --- 100 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getBearing) 101 | --- 102 | ---@return number bx # Glyph bearing X. 103 | ---@return number by # Glyph bearing Y. 104 | function GlyphData:getBearing() end 105 | 106 | --- 107 | ---Gets glyph bounding box. 108 | --- 109 | --- 110 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getBoundingBox) 111 | --- 112 | ---@return number x # Glyph position x. 113 | ---@return number y # Glyph position y. 114 | ---@return number width # Glyph width. 115 | ---@return number height # Glyph height. 116 | function GlyphData:getBoundingBox() end 117 | 118 | --- 119 | ---Gets glyph dimensions. 120 | --- 121 | --- 122 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getDimensions) 123 | --- 124 | ---@return number width # Glyph width. 125 | ---@return number height # Glyph height. 126 | function GlyphData:getDimensions() end 127 | 128 | --- 129 | ---Gets glyph pixel format. 130 | --- 131 | --- 132 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getFormat) 133 | --- 134 | ---@return love.PixelFormat format # Glyph pixel format. 135 | function GlyphData:getFormat() end 136 | 137 | --- 138 | ---Gets glyph number. 139 | --- 140 | --- 141 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getGlyph) 142 | --- 143 | ---@return number glyph # Glyph number. 144 | function GlyphData:getGlyph() end 145 | 146 | --- 147 | ---Gets glyph string. 148 | --- 149 | --- 150 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getGlyphString) 151 | --- 152 | ---@return string glyph # Glyph string. 153 | function GlyphData:getGlyphString() end 154 | 155 | --- 156 | ---Gets glyph height. 157 | --- 158 | --- 159 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getHeight) 160 | --- 161 | ---@return number height # Glyph height. 162 | function GlyphData:getHeight() end 163 | 164 | --- 165 | ---Gets glyph width. 166 | --- 167 | --- 168 | ---[Open in Browser](https://love2d.org/wiki/GlyphData:getWidth) 169 | --- 170 | ---@return number width # Glyph width. 171 | function GlyphData:getWidth() end 172 | 173 | --- 174 | ---A Rasterizer handles font rendering, containing the font data (image or TrueType font) and drawable glyphs. 175 | --- 176 | --- 177 | ---[Open in Browser](https://love2d.org/wiki/love.font) 178 | --- 179 | ---@class love.Rasterizer: love.Object 180 | local Rasterizer = {} 181 | 182 | --- 183 | ---Gets font advance. 184 | --- 185 | --- 186 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getAdvance) 187 | --- 188 | ---@return number advance # Font advance. 189 | function Rasterizer:getAdvance() end 190 | 191 | --- 192 | ---Gets ascent height. 193 | --- 194 | --- 195 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getAscent) 196 | --- 197 | ---@return number height # Ascent height. 198 | function Rasterizer:getAscent() end 199 | 200 | --- 201 | ---Gets descent height. 202 | --- 203 | --- 204 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getDescent) 205 | --- 206 | ---@return number height # Descent height. 207 | function Rasterizer:getDescent() end 208 | 209 | --- 210 | ---Gets number of glyphs in font. 211 | --- 212 | --- 213 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getGlyphCount) 214 | --- 215 | ---@return number count # Glyphs count. 216 | function Rasterizer:getGlyphCount() end 217 | 218 | --- 219 | ---Gets glyph data of a specified glyph. 220 | --- 221 | --- 222 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getGlyphData) 223 | --- 224 | ---@overload fun(self: love.Rasterizer, glyphNumber: number):love.GlyphData 225 | ---@param glyph string # Glyph 226 | ---@return love.GlyphData glyphData # Glyph data 227 | function Rasterizer:getGlyphData(glyph) end 228 | 229 | --- 230 | ---Gets font height. 231 | --- 232 | --- 233 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getHeight) 234 | --- 235 | ---@return number height # Font height 236 | function Rasterizer:getHeight() end 237 | 238 | --- 239 | ---Gets line height of a font. 240 | --- 241 | --- 242 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:getLineHeight) 243 | --- 244 | ---@return number height # Line height of a font. 245 | function Rasterizer:getLineHeight() end 246 | 247 | --- 248 | ---Checks if font contains specified glyphs. 249 | --- 250 | --- 251 | ---[Open in Browser](https://love2d.org/wiki/Rasterizer:hasGlyphs) 252 | --- 253 | ---@param glyph1 string|number # Glyph 254 | ---@param glyph2 string|number # Glyph 255 | ---@vararg string|number # Additional glyphs 256 | ---@return boolean hasGlyphs # Whatever font contains specified glyphs. 257 | function Rasterizer:hasGlyphs(glyph1, glyph2, ...) end 258 | 259 | --- 260 | ---True Type hinting mode. 261 | --- 262 | --- 263 | ---[Open in Browser](https://love2d.org/wiki/HintingMode) 264 | --- 265 | ---@alias love.HintingMode 266 | --- 267 | ---Default hinting. Should be preferred for typical antialiased fonts. 268 | --- 269 | ---| "normal" 270 | --- 271 | ---Results in fuzzier text but can sometimes preserve the original glyph shapes of the text better than normal hinting. 272 | --- 273 | ---| "light" 274 | --- 275 | ---Results in aliased / unsmoothed text with either full opacity or completely transparent pixels. Should be used when antialiasing is not desired for the font. 276 | --- 277 | ---| "mono" 278 | --- 279 | ---Disables hinting for the font. Results in fuzzier text. 280 | --- 281 | ---| "none" 282 | -------------------------------------------------------------------------------- /library/love/mouse.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to the user's mouse. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.mouse) 8 | --- 9 | ---@class love.mouse 10 | love.mouse = {} 11 | 12 | --- 13 | ---Gets the current Cursor. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.getCursor) 17 | --- 18 | ---@return love.Cursor cursor # The current cursor, or nil if no cursor is set. 19 | function love.mouse.getCursor() end 20 | 21 | --- 22 | ---Returns the current position of the mouse. 23 | --- 24 | --- 25 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.getPosition) 26 | --- 27 | ---@return number x # The position of the mouse along the x-axis. 28 | ---@return number y # The position of the mouse along the y-axis. 29 | function love.mouse.getPosition() end 30 | 31 | --- 32 | ---Gets whether relative mode is enabled for the mouse. 33 | --- 34 | ---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. 35 | --- 36 | ---The reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated. 37 | --- 38 | --- 39 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.getRelativeMode) 40 | --- 41 | ---@return boolean enabled # True if relative mode is enabled, false if it's disabled. 42 | function love.mouse.getRelativeMode() end 43 | 44 | --- 45 | ---Gets a Cursor object representing a system-native hardware cursor. 46 | --- 47 | ---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. 48 | --- 49 | --- 50 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.getSystemCursor) 51 | --- 52 | ---@param ctype love.CursorType # The type of system cursor to get. 53 | ---@return love.Cursor cursor # The Cursor object representing the system cursor type. 54 | function love.mouse.getSystemCursor(ctype) end 55 | 56 | --- 57 | ---Returns the current x-position of the mouse. 58 | --- 59 | --- 60 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.getX) 61 | --- 62 | ---@return number x # The position of the mouse along the x-axis. 63 | function love.mouse.getX() end 64 | 65 | --- 66 | ---Returns the current y-position of the mouse. 67 | --- 68 | --- 69 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.getY) 70 | --- 71 | ---@return number y # The position of the mouse along the y-axis. 72 | function love.mouse.getY() end 73 | 74 | --- 75 | ---Gets whether cursor functionality is supported. 76 | --- 77 | ---If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors. 78 | --- 79 | --- 80 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.isCursorSupported) 81 | --- 82 | ---@return boolean supported # Whether the system has cursor functionality. 83 | function love.mouse.isCursorSupported() end 84 | 85 | --- 86 | ---Checks whether a certain mouse button is down. 87 | --- 88 | ---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. 89 | --- 90 | --- 91 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.isDown) 92 | --- 93 | ---@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. 94 | ---@vararg number # Additional button numbers to check. 95 | ---@return boolean down # True if any specified button is down. 96 | function love.mouse.isDown(button, ...) end 97 | 98 | --- 99 | ---Checks if the mouse is grabbed. 100 | --- 101 | --- 102 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.isGrabbed) 103 | --- 104 | ---@return boolean grabbed # True if the cursor is grabbed, false if it is not. 105 | function love.mouse.isGrabbed() end 106 | 107 | --- 108 | ---Checks if the cursor is visible. 109 | --- 110 | --- 111 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.isVisible) 112 | --- 113 | ---@return boolean visible # True if the cursor to visible, false if the cursor is hidden. 114 | function love.mouse.isVisible() end 115 | 116 | --- 117 | ---Creates a new hardware Cursor object from an image file or ImageData. 118 | --- 119 | ---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. 120 | --- 121 | ---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. 122 | --- 123 | --- 124 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.newCursor) 125 | --- 126 | ---@overload fun(filename: string, hotx?: number, hoty?: number):love.Cursor 127 | ---@overload fun(fileData: love.FileData, hotx?: number, hoty?: number):love.Cursor 128 | ---@param imageData love.ImageData # The ImageData to use for the new Cursor. 129 | ---@param hotx? number # The x-coordinate in the ImageData of the cursor's hot spot. 130 | ---@param hoty? number # The y-coordinate in the ImageData of the cursor's hot spot. 131 | ---@return love.Cursor cursor # The new Cursor object. 132 | function love.mouse.newCursor(imageData, hotx, hoty) end 133 | 134 | --- 135 | ---Sets the current mouse cursor. 136 | --- 137 | --- 138 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setCursor) 139 | --- 140 | ---@overload fun() 141 | ---@param cursor love.Cursor # The Cursor object to use as the current mouse cursor. 142 | function love.mouse.setCursor(cursor) end 143 | 144 | --- 145 | ---Grabs the mouse and confines it to the window. 146 | --- 147 | --- 148 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setGrabbed) 149 | --- 150 | ---@param grab boolean # True to confine the mouse, false to let it leave the window. 151 | function love.mouse.setGrabbed(grab) end 152 | 153 | --- 154 | ---Sets the current position of the mouse. Non-integer values are floored. 155 | --- 156 | --- 157 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setPosition) 158 | --- 159 | ---@param x number # The new position of the mouse along the x-axis. 160 | ---@param y number # The new position of the mouse along the y-axis. 161 | function love.mouse.setPosition(x, y) end 162 | 163 | --- 164 | ---Sets whether relative mode is enabled for the mouse. 165 | --- 166 | ---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. 167 | --- 168 | ---The reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated. 169 | --- 170 | --- 171 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setRelativeMode) 172 | --- 173 | ---@param enable boolean # True to enable relative mode, false to disable it. 174 | function love.mouse.setRelativeMode(enable) end 175 | 176 | --- 177 | ---Sets the current visibility of the cursor. 178 | --- 179 | --- 180 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setVisible) 181 | --- 182 | ---@param visible boolean # True to set the cursor to visible, false to hide the cursor. 183 | function love.mouse.setVisible(visible) end 184 | 185 | --- 186 | ---Sets the current X position of the mouse. 187 | --- 188 | ---Non-integer values are floored. 189 | --- 190 | --- 191 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setX) 192 | --- 193 | ---@param x number # The new position of the mouse along the x-axis. 194 | function love.mouse.setX(x) end 195 | 196 | --- 197 | ---Sets the current Y position of the mouse. 198 | --- 199 | ---Non-integer values are floored. 200 | --- 201 | --- 202 | ---[Open in Browser](https://love2d.org/wiki/love.mouse.setY) 203 | --- 204 | ---@param y number # The new position of the mouse along the y-axis. 205 | function love.mouse.setY(y) end 206 | 207 | --- 208 | ---Represents a hardware cursor. 209 | --- 210 | --- 211 | ---[Open in Browser](https://love2d.org/wiki/love.mouse) 212 | --- 213 | ---@class love.Cursor: love.Object 214 | local Cursor = {} 215 | 216 | --- 217 | ---Gets the type of the Cursor. 218 | --- 219 | --- 220 | ---[Open in Browser](https://love2d.org/wiki/Cursor:getType) 221 | --- 222 | ---@return love.CursorType ctype # The type of the Cursor. 223 | function Cursor:getType() end 224 | 225 | --- 226 | ---Types of hardware cursors. 227 | --- 228 | --- 229 | ---[Open in Browser](https://love2d.org/wiki/CursorType) 230 | --- 231 | ---@alias love.CursorType 232 | --- 233 | ---The cursor is using a custom image. 234 | --- 235 | ---| "image" 236 | --- 237 | ---An arrow pointer. 238 | --- 239 | ---| "arrow" 240 | --- 241 | ---An I-beam, normally used when mousing over editable or selectable text. 242 | --- 243 | ---| "ibeam" 244 | --- 245 | ---Wait graphic. 246 | --- 247 | ---| "wait" 248 | --- 249 | ---Small wait cursor with an arrow pointer. 250 | --- 251 | ---| "waitarrow" 252 | --- 253 | ---Crosshair symbol. 254 | --- 255 | ---| "crosshair" 256 | --- 257 | ---Double arrow pointing to the top-left and bottom-right. 258 | --- 259 | ---| "sizenwse" 260 | --- 261 | ---Double arrow pointing to the top-right and bottom-left. 262 | --- 263 | ---| "sizenesw" 264 | --- 265 | ---Double arrow pointing left and right. 266 | --- 267 | ---| "sizewe" 268 | --- 269 | ---Double arrow pointing up and down. 270 | --- 271 | ---| "sizens" 272 | --- 273 | ---Four-pointed arrow pointing up, down, left, and right. 274 | --- 275 | ---| "sizeall" 276 | --- 277 | ---Slashed circle or crossbones. 278 | --- 279 | ---| "no" 280 | --- 281 | ---Hand symbol. 282 | --- 283 | ---| "hand" 284 | -------------------------------------------------------------------------------- /library/love/data.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides functionality for creating and transforming data. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.data) 8 | --- 9 | ---@class love.data 10 | love.data = {} 11 | 12 | --- 13 | ---Compresses a string or data using a specific compression algorithm. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.data.compress) 17 | --- 18 | ---@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, data: love.Data, level?: number):love.CompressedData|string 19 | ---@param container love.ContainerType # What type to return the compressed data as. 20 | ---@param format love.CompressedDataFormat # The format to use when compressing the string. 21 | ---@param rawstring string # The raw (un-compressed) string to compress. 22 | ---@param level? number # The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used. 23 | ---@return love.CompressedData|string compressedData # CompressedData/string which contains the compressed version of rawstring. 24 | function love.data.compress(container, format, rawstring, level) end 25 | 26 | --- 27 | ---Decode Data or a string from any of the EncodeFormats to Data or string. 28 | --- 29 | --- 30 | ---[Open in Browser](https://love2d.org/wiki/love.data.decode) 31 | --- 32 | ---@overload fun(container: love.ContainerType, format: love.EncodeFormat, sourceData: love.Data):love.ByteData|string 33 | ---@param container love.ContainerType # What type to return the decoded data as. 34 | ---@param format love.EncodeFormat # The format of the input data. 35 | ---@param sourceString string # The raw (encoded) data to decode. 36 | ---@return love.ByteData|string decoded # ByteData/string which contains the decoded version of source. 37 | function love.data.decode(container, format, sourceString) end 38 | 39 | --- 40 | ---Decompresses a CompressedData or previously compressed string or Data object. 41 | --- 42 | --- 43 | ---[Open in Browser](https://love2d.org/wiki/love.data.decompress) 44 | --- 45 | ---@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, compressedString: string):love.Data|string 46 | ---@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, data: love.Data):love.Data|string 47 | ---@param container love.ContainerType # What type to return the decompressed data as. 48 | ---@param compressedData love.CompressedData # The compressed data to decompress. 49 | ---@return love.Data|string decompressedData # Data/string containing the raw decompressed data. 50 | function love.data.decompress(container, compressedData) end 51 | 52 | --- 53 | ---Encode Data or a string to a Data or string in one of the EncodeFormats. 54 | --- 55 | --- 56 | ---[Open in Browser](https://love2d.org/wiki/love.data.encode) 57 | --- 58 | ---@overload fun(container: love.ContainerType, format: love.EncodeFormat, sourceData: love.Data, linelength?: number):love.ByteData|string 59 | ---@param container love.ContainerType # What type to return the encoded data as. 60 | ---@param format love.EncodeFormat # The format of the output data. 61 | ---@param sourceString string # The raw data to encode. 62 | ---@param linelength? number # The maximum line length of the output. Only supported for base64, ignored if 0. 63 | ---@return love.ByteData|string encoded # ByteData/string which contains the encoded version of source. 64 | function love.data.encode(container, format, sourceString, linelength) end 65 | 66 | --- 67 | ---Gets the size in bytes that a given format used with love.data.pack will use. 68 | --- 69 | ---This function behaves the same as Lua 5.3's string.packsize. 70 | --- 71 | --- 72 | ---[Open in Browser](https://love2d.org/wiki/love.data.getPackedSize) 73 | --- 74 | ---@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings. 75 | ---@return number size # The size in bytes that the packed data will use. 76 | function love.data.getPackedSize(format) end 77 | 78 | --- 79 | ---Compute the message digest of a string using a specified hash algorithm. 80 | --- 81 | --- 82 | ---[Open in Browser](https://love2d.org/wiki/love.data.hash) 83 | --- 84 | ---@overload fun(hashFunction: love.HashFunction, data: love.Data):string 85 | ---@param hashFunction love.HashFunction # Hash algorithm to use. 86 | ---@param string string # String to hash. 87 | ---@return string rawdigest # Raw message digest string. 88 | function love.data.hash(hashFunction, string) end 89 | 90 | --- 91 | ---Creates a new Data object containing arbitrary bytes. 92 | --- 93 | ---Data:getPointer along with LuaJIT's FFI can be used to manipulate the contents of the ByteData object after it has been created. 94 | --- 95 | --- 96 | ---[Open in Browser](https://love2d.org/wiki/love.data.newByteData) 97 | --- 98 | ---@overload fun(Data: love.Data, offset?: number, size?: number):love.ByteData 99 | ---@overload fun(size: number):love.ByteData 100 | ---@param datastring string # The byte string to copy. 101 | ---@return love.ByteData bytedata # The new Data object. 102 | function love.data.newByteData(datastring) end 103 | 104 | --- 105 | ---Creates a new Data referencing a subsection of an existing Data object. 106 | --- 107 | --- 108 | ---[Open in Browser](https://love2d.org/wiki/love.data.newDataView) 109 | --- 110 | ---@param data love.Data # The Data object to reference. 111 | ---@param offset number # The offset of the subsection to reference, in bytes. 112 | ---@param size number # The size in bytes of the subsection to reference. 113 | ---@return love.Data view # The new Data view. 114 | function love.data.newDataView(data, offset, size) end 115 | 116 | --- 117 | ---Packs (serializes) simple Lua values. 118 | --- 119 | ---This function behaves the same as Lua 5.3's string.pack. 120 | --- 121 | --- 122 | ---[Open in Browser](https://love2d.org/wiki/love.data.pack) 123 | --- 124 | ---@param container love.ContainerType # What type to return the encoded data as. 125 | ---@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings. 126 | ---@param v1 number|boolean|string # The first value (number, boolean, or string) to serialize. 127 | ---@vararg number|boolean|string # Additional values to serialize. 128 | ---@return love.Data|string data # Data/string which contains the serialized data. 129 | function love.data.pack(container, format, v1, ...) end 130 | 131 | --- 132 | ---Unpacks (deserializes) a byte-string or Data into simple Lua values. 133 | --- 134 | ---This function behaves the same as Lua 5.3's string.unpack. 135 | --- 136 | --- 137 | ---[Open in Browser](https://love2d.org/wiki/love.data.unpack) 138 | --- 139 | ---@overload fun(format: string, data: love.Data, pos?: number):number|boolean|string, number|boolean|string, number 140 | ---@param format string # A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings. 141 | ---@param datastring string # A string containing the packed (serialized) data. 142 | ---@param pos? number # Where to start reading in the string. Negative values can be used to read relative from the end of the string. 143 | ---@return number|boolean|string v1 # The first value (number, boolean, or string) that was unpacked. 144 | ---@return number index # The index of the first unread byte in the data string. 145 | function love.data.unpack(format, datastring, pos) end 146 | 147 | --- 148 | ---Data object containing arbitrary bytes in an contiguous memory. 149 | --- 150 | ---There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but Data:getPointer can be used with LuaJIT's FFI to access and write to the contents directly. 151 | --- 152 | --- 153 | ---[Open in Browser](https://love2d.org/wiki/love.data) 154 | --- 155 | ---@class love.ByteData: love.Object, love.Data 156 | local ByteData = {} 157 | 158 | --- 159 | ---Represents byte data compressed using a specific algorithm. 160 | --- 161 | ---love.data.decompress can be used to de-compress the data (or love.math.decompress in 0.10.2 or earlier). 162 | --- 163 | --- 164 | ---[Open in Browser](https://love2d.org/wiki/love.data) 165 | --- 166 | ---@class love.CompressedData: love.Data, love.Object 167 | local CompressedData = {} 168 | 169 | --- 170 | ---Gets the compression format of the CompressedData. 171 | --- 172 | --- 173 | ---[Open in Browser](https://love2d.org/wiki/CompressedData:getFormat) 174 | --- 175 | ---@return love.CompressedDataFormat format # The format of the CompressedData. 176 | function CompressedData:getFormat() end 177 | 178 | --- 179 | ---Compressed data formats. 180 | --- 181 | --- 182 | ---[Open in Browser](https://love2d.org/wiki/CompressedDataFormat) 183 | --- 184 | ---@alias love.CompressedDataFormat 185 | --- 186 | ---The LZ4 compression format. Compresses and decompresses very quickly, but the compression ratio is not the best. LZ4-HC is used when compression level 9 is specified. Some benchmarks are available here. 187 | --- 188 | ---| "lz4" 189 | --- 190 | ---The zlib format is DEFLATE-compressed data with a small bit of header data. Compresses relatively slowly and decompresses moderately quickly, and has a decent compression ratio. 191 | --- 192 | ---| "zlib" 193 | --- 194 | ---The gzip format is DEFLATE-compressed data with a slightly larger header than zlib. Since it uses DEFLATE it has the same compression characteristics as the zlib format. 195 | --- 196 | ---| "gzip" 197 | --- 198 | ---Raw DEFLATE-compressed data (no header). 199 | --- 200 | ---| "deflate" 201 | 202 | --- 203 | ---Return type of various data-returning functions. 204 | --- 205 | --- 206 | ---[Open in Browser](https://love2d.org/wiki/ContainerType) 207 | --- 208 | ---@alias love.ContainerType 209 | --- 210 | ---Return type is ByteData. 211 | --- 212 | ---| "data" 213 | --- 214 | ---Return type is string. 215 | --- 216 | ---| "string" 217 | 218 | --- 219 | ---Encoding format used to encode or decode data. 220 | --- 221 | --- 222 | ---[Open in Browser](https://love2d.org/wiki/EncodeFormat) 223 | --- 224 | ---@alias love.EncodeFormat 225 | --- 226 | ---Encode/decode data as base64 binary-to-text encoding. 227 | --- 228 | ---| "base64" 229 | --- 230 | ---Encode/decode data as hexadecimal string. 231 | --- 232 | ---| "hex" 233 | 234 | --- 235 | ---Hash algorithm of love.data.hash. 236 | --- 237 | --- 238 | ---[Open in Browser](https://love2d.org/wiki/HashFunction) 239 | --- 240 | ---@alias love.HashFunction 241 | --- 242 | ---MD5 hash algorithm (16 bytes). 243 | --- 244 | ---| "md5" 245 | --- 246 | ---SHA1 hash algorithm (20 bytes). 247 | --- 248 | ---| "sha1" 249 | --- 250 | ---SHA2 hash algorithm with message digest size of 224 bits (28 bytes). 251 | --- 252 | ---| "sha224" 253 | --- 254 | ---SHA2 hash algorithm with message digest size of 256 bits (32 bytes). 255 | --- 256 | ---| "sha256" 257 | --- 258 | ---SHA2 hash algorithm with message digest size of 384 bits (48 bytes). 259 | --- 260 | ---| "sha384" 261 | --- 262 | ---SHA2 hash algorithm with message digest size of 512 bits (64 bytes). 263 | --- 264 | ---| "sha512" 265 | -------------------------------------------------------------------------------- /library/love.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | -- version: 11.5 4 | --- 5 | ---[Open in Browser](https://love2d.org/wiki/love) 6 | --- 7 | ---@class love 8 | love = {} 9 | 10 | --- 11 | ---Gets the current running version of LÖVE. 12 | --- 13 | --- 14 | ---[Open in Browser](https://love2d.org/wiki/love.getVersion) 15 | --- 16 | ---@return number major # The major version of LÖVE, i.e. 0 for version 0.9.1. 17 | ---@return number minor # The minor version of LÖVE, i.e. 9 for version 0.9.1. 18 | ---@return number revision # The revision version of LÖVE, i.e. 1 for version 0.9.1. 19 | ---@return string codename # The codename of the current version, i.e. 'Baby Inspector' for version 0.9.1. 20 | function love.getVersion() end 21 | 22 | --- 23 | ---Gets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise. 24 | --- 25 | ---When deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console. 26 | --- 27 | --- 28 | ---[Open in Browser](https://love2d.org/wiki/love.hasDeprecationOutput) 29 | --- 30 | ---@return boolean enabled # Whether deprecation output is enabled. 31 | function love.hasDeprecationOutput() end 32 | 33 | --- 34 | ---Gets whether the given version is compatible with the current running version of LÖVE. 35 | --- 36 | --- 37 | ---[Open in Browser](https://love2d.org/wiki/love.isVersionCompatible) 38 | --- 39 | ---@overload fun(major: number, minor: number, revision: number):boolean 40 | ---@param version string # The version to check (for example '11.3' or '0.10.2'). 41 | ---@return boolean compatible # Whether the given version is compatible with the current running version of LÖVE. 42 | function love.isVersionCompatible(version) end 43 | 44 | --- 45 | ---Sets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise. 46 | --- 47 | ---When deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console. 48 | --- 49 | --- 50 | ---[Open in Browser](https://love2d.org/wiki/love.setDeprecationOutput) 51 | --- 52 | ---@param enable boolean # Whether to enable or disable deprecation output. 53 | function love.setDeprecationOutput(enable) end 54 | 55 | --- 56 | ---The superclass of all data. 57 | --- 58 | --- 59 | ---[Open in Browser](https://love2d.org/wiki/love) 60 | --- 61 | ---@class love.Data: love.Object 62 | local Data = {} 63 | 64 | --- 65 | ---Creates a new copy of the Data object. 66 | --- 67 | --- 68 | ---[Open in Browser](https://love2d.org/wiki/Data:clone) 69 | --- 70 | ---@return love.Data clone # The new copy. 71 | function Data:clone() end 72 | 73 | --- 74 | ---Gets an FFI pointer to the Data. 75 | --- 76 | ---This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used. 77 | --- 78 | --- 79 | ---[Open in Browser](https://love2d.org/wiki/Data:getFFIPointer) 80 | --- 81 | ---@return ffi.cdata* pointer # A raw void* pointer to the Data, or nil if FFI is unavailable. 82 | function Data:getFFIPointer() end 83 | 84 | --- 85 | ---Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI. 86 | --- 87 | --- 88 | ---[Open in Browser](https://love2d.org/wiki/Data:getPointer) 89 | --- 90 | ---@return lightuserdata pointer # A raw pointer to the Data. 91 | function Data:getPointer() end 92 | 93 | --- 94 | ---Gets the Data's size in bytes. 95 | --- 96 | --- 97 | ---[Open in Browser](https://love2d.org/wiki/Data:getSize) 98 | --- 99 | ---@return number size # The size of the Data in bytes. 100 | function Data:getSize() end 101 | 102 | --- 103 | ---Gets the full Data as a string. 104 | --- 105 | --- 106 | ---[Open in Browser](https://love2d.org/wiki/Data:getString) 107 | --- 108 | ---@return string data # The raw data. 109 | function Data:getString() end 110 | 111 | --- 112 | ---The superclass of all LÖVE types. 113 | --- 114 | --- 115 | ---[Open in Browser](https://love2d.org/wiki/love) 116 | --- 117 | ---@class love.Object 118 | local Object = {} 119 | 120 | --- 121 | ---Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. 122 | --- 123 | ---This method can be used to immediately clean up resources without waiting for Lua's garbage collector. 124 | --- 125 | --- 126 | ---[Open in Browser](https://love2d.org/wiki/Object:release) 127 | --- 128 | ---@return boolean success # True if the object was released by this call, false if it had been previously released. 129 | function Object:release() end 130 | 131 | --- 132 | ---Gets the type of the object as a string. 133 | --- 134 | --- 135 | ---[Open in Browser](https://love2d.org/wiki/Object:type) 136 | --- 137 | ---@return string type # The type as a string. 138 | function Object:type() end 139 | 140 | --- 141 | ---Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. 142 | --- 143 | --- 144 | ---[Open in Browser](https://love2d.org/wiki/Object:typeOf) 145 | --- 146 | ---@param name string # The name of the type to check for. 147 | ---@return boolean b # True if the object is of the specified type, false otherwise. 148 | function Object:typeOf(name) end 149 | 150 | --- 151 | ---If a file called conf.lua is present in your game folder (or .love file), it is run before the LÖVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LÖVE 'boot' script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff. 152 | --- 153 | ---@alias love.conf fun(t: table) 154 | 155 | --- 156 | ---Callback function triggered when a directory is dragged and dropped onto the window. 157 | --- 158 | ---@alias love.directorydropped fun(path: string) 159 | 160 | --- 161 | ---Called when the device display orientation changed, for example, user rotated their phone 180 degrees. 162 | --- 163 | ---@alias love.displayrotated fun(index: number, orientation: love.DisplayOrientation) 164 | 165 | --- 166 | ---Callback function used to draw on the screen every frame. 167 | --- 168 | ---@alias love.draw fun() 169 | 170 | --- 171 | ---The error handler, used to display error messages. 172 | --- 173 | ---@alias love.errorhandler fun(msg: string):function 174 | 175 | --- 176 | ---Callback function triggered when a file is dragged and dropped onto the window. 177 | --- 178 | ---@alias love.filedropped fun(file: love.DroppedFile) 179 | 180 | --- 181 | ---Callback function triggered when window receives or loses focus. 182 | --- 183 | ---@alias love.focus fun(focus: boolean) 184 | 185 | --- 186 | ---Called when a Joystick's virtual gamepad axis is moved. 187 | --- 188 | ---@alias love.gamepadaxis fun(joystick: love.Joystick, axis: love.GamepadAxis, value: number) 189 | 190 | --- 191 | ---Called when a Joystick's virtual gamepad button is pressed. 192 | --- 193 | ---@alias love.gamepadpressed fun(joystick: love.Joystick, button: love.GamepadButton) 194 | 195 | --- 196 | ---Called when a Joystick's virtual gamepad button is released. 197 | --- 198 | ---@alias love.gamepadreleased fun(joystick: love.Joystick, button: love.GamepadButton) 199 | 200 | --- 201 | ---Called when a Joystick is connected. 202 | --- 203 | ---@alias love.joystickadded fun(joystick: love.Joystick) 204 | 205 | --- 206 | ---Called when a joystick axis moves. 207 | --- 208 | ---@alias love.joystickaxis fun(joystick: love.Joystick, axis: number, value: number) 209 | 210 | --- 211 | ---Called when a joystick hat direction changes. 212 | --- 213 | ---@alias love.joystickhat fun(joystick: love.Joystick, hat: number, direction: love.JoystickHat) 214 | 215 | --- 216 | ---Called when a joystick button is pressed. 217 | --- 218 | ---@alias love.joystickpressed fun(joystick: love.Joystick, button: number) 219 | 220 | --- 221 | ---Called when a joystick button is released. 222 | --- 223 | ---@alias love.joystickreleased fun(joystick: love.Joystick, button: number) 224 | 225 | --- 226 | ---Called when a Joystick is disconnected. 227 | --- 228 | ---@alias love.joystickremoved fun(joystick: love.Joystick) 229 | 230 | --- 231 | ---Callback function triggered when a key is pressed. 232 | --- 233 | ---@alias love.keypressed fun(key: love.KeyConstant, scancode: love.Scancode, isrepeat: boolean)|fun(key: love.KeyConstant, isrepeat: boolean) 234 | 235 | --- 236 | ---Callback function triggered when a keyboard key is released. 237 | --- 238 | ---@alias love.keyreleased fun(key: love.KeyConstant, scancode: love.Scancode) 239 | 240 | --- 241 | ---This function is called exactly once at the beginning of the game. 242 | --- 243 | ---@alias love.load fun(arg: table, unfilteredArg: table) 244 | 245 | --- 246 | ---Callback function triggered when the system is running out of memory on mobile devices. 247 | --- 248 | ---Mobile operating systems may forcefully kill the game if it uses too much memory, so any non-critical resource should be removed if possible (by setting all variables referencing the resources to '''nil'''), when this event is triggered. Sounds and images in particular tend to use the most memory. 249 | --- 250 | ---@alias love.lowmemory fun() 251 | 252 | --- 253 | ---Callback function triggered when window receives or loses mouse focus. 254 | --- 255 | ---@alias love.mousefocus fun(focus: boolean) 256 | 257 | --- 258 | ---Callback function triggered when the mouse is moved. 259 | --- 260 | ---@alias love.mousemoved fun(x: number, y: number, dx: number, dy: number, istouch: boolean) 261 | 262 | --- 263 | ---Callback function triggered when a mouse button is pressed. 264 | --- 265 | ---@alias love.mousepressed fun(x: number, y: number, button: number, istouch: boolean, presses: number) 266 | 267 | --- 268 | ---Callback function triggered when a mouse button is released. 269 | --- 270 | ---@alias love.mousereleased fun(x: number, y: number, button: number, istouch: boolean, presses: number) 271 | 272 | --- 273 | ---Callback function triggered when the game is closed. 274 | --- 275 | ---@alias love.quit fun():boolean 276 | 277 | --- 278 | ---Called when the window is resized, for example if the user resizes the window, or if love.window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size. 279 | --- 280 | ---@alias love.resize fun(w: number, h: number) 281 | 282 | --- 283 | ---The main function, containing the main loop. A sensible default is used when left out. 284 | --- 285 | ---@alias love.run fun():function 286 | 287 | --- 288 | ---Called when the candidate text for an IME (Input Method Editor) has changed. 289 | --- 290 | ---The candidate text is not the final text that the user will eventually choose. Use love.textinput for that. 291 | --- 292 | ---@alias love.textedited fun(text: string, start: number, length: number) 293 | 294 | --- 295 | ---Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text '@' will be generated. 296 | --- 297 | ---@alias love.textinput fun(text: string) 298 | 299 | --- 300 | ---Callback function triggered when a Thread encounters an error. 301 | --- 302 | ---@alias love.threaderror fun(thread: love.Thread, errorstr: string) 303 | 304 | --- 305 | ---Callback function triggered when a touch press moves inside the touch screen. 306 | --- 307 | ---@alias love.touchmoved fun(id: lightuserdata, x: number, y: number, dx: number, dy: number, pressure: number) 308 | 309 | --- 310 | ---Callback function triggered when the touch screen is touched. 311 | --- 312 | ---@alias love.touchpressed fun(id: lightuserdata, x: number, y: number, dx: number, dy: number, pressure: number) 313 | 314 | --- 315 | ---Callback function triggered when the touch screen stops being touched. 316 | --- 317 | ---@alias love.touchreleased fun(id: lightuserdata, x: number, y: number, dx: number, dy: number, pressure: number) 318 | 319 | --- 320 | ---Callback function used to update the state of the game every frame. 321 | --- 322 | ---@alias love.update fun(dt: number) 323 | 324 | --- 325 | ---Callback function triggered when window is minimized/hidden or unminimized by the user. 326 | --- 327 | ---@alias love.visible fun(visible: boolean) 328 | 329 | --- 330 | ---Callback function triggered when the mouse wheel is moved. 331 | --- 332 | ---@alias love.wheelmoved fun(x: number, y: number) 333 | 334 | return love 335 | -------------------------------------------------------------------------------- /library/love/joystick.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to the user's joystick. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.joystick) 8 | --- 9 | ---@class love.joystick 10 | love.joystick = {} 11 | 12 | --- 13 | ---Gets the full gamepad mapping string of the Joysticks which have the given GUID, or nil if the GUID isn't recognized as a gamepad. 14 | --- 15 | ---The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings. 16 | --- 17 | --- 18 | ---[Open in Browser](https://love2d.org/wiki/love.joystick.getGamepadMappingString) 19 | --- 20 | ---@param guid string # The GUID value to get the mapping string for. 21 | ---@return string mappingstring # A string containing the Joystick's gamepad mappings, or nil if the GUID is not recognized as a gamepad. 22 | function love.joystick.getGamepadMappingString(guid) end 23 | 24 | --- 25 | ---Gets the number of connected joysticks. 26 | --- 27 | --- 28 | ---[Open in Browser](https://love2d.org/wiki/love.joystick.getJoystickCount) 29 | --- 30 | ---@return number joystickcount # The number of connected joysticks. 31 | function love.joystick.getJoystickCount() end 32 | 33 | --- 34 | ---Gets a list of connected Joysticks. 35 | --- 36 | --- 37 | ---[Open in Browser](https://love2d.org/wiki/love.joystick.getJoysticks) 38 | --- 39 | ---@return love.Joystick[] joysticks # The list of currently connected Joysticks. 40 | function love.joystick.getJoysticks() end 41 | 42 | --- 43 | ---Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings. 44 | --- 45 | ---It also recognizes any SDL gamecontroller mapping string, such as those created with Steam's Big Picture controller configure interface, or this nice database. If a new mapping is loaded for an already known controller GUID, the later version will overwrite the one currently loaded. 46 | --- 47 | --- 48 | ---[Open in Browser](https://love2d.org/wiki/love.joystick.loadGamepadMappings) 49 | --- 50 | ---@overload fun(mappings: string) 51 | ---@param filename string # The filename to load the mappings string from. 52 | function love.joystick.loadGamepadMappings(filename) end 53 | 54 | --- 55 | ---Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified. 56 | --- 57 | ---The mappings are stored as a string for use with love.joystick.loadGamepadMappings. 58 | --- 59 | --- 60 | ---[Open in Browser](https://love2d.org/wiki/love.joystick.saveGamepadMappings) 61 | --- 62 | ---@overload fun():string 63 | ---@param filename string # The filename to save the mappings string to. 64 | ---@return string mappings # The mappings string that was written to the file. 65 | function love.joystick.saveGamepadMappings(filename) end 66 | 67 | --- 68 | ---Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. For example, if this function is used with a GUID returned by a Dualshock 3 controller in OS X, the binding will affect Joystick:getGamepadAxis and Joystick:isGamepadDown for ''all'' Dualshock 3 controllers used with the game when run in OS X. 69 | --- 70 | ---LÖVE includes built-in gamepad bindings for many common controllers. This function lets you change the bindings or add new ones for types of Joysticks which aren't recognized as gamepads by default. 71 | --- 72 | ---The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout. 73 | --- 74 | --- 75 | ---[Open in Browser](https://love2d.org/wiki/love.joystick.setGamepadMapping) 76 | --- 77 | ---@overload fun(guid: string, axis: love.GamepadAxis, inputtype: love.JoystickInputType, inputindex: number, hatdir?: love.JoystickHat):boolean 78 | ---@param guid string # The OS-dependent GUID for the type of Joystick the binding will affect. 79 | ---@param button love.GamepadButton # The virtual gamepad button to bind. 80 | ---@param inputtype love.JoystickInputType # The type of input to bind the virtual gamepad button to. 81 | ---@param inputindex number # The index of the axis, button, or hat to bind the virtual gamepad button to. 82 | ---@param hatdir? love.JoystickHat # The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise. 83 | ---@return boolean success # Whether the virtual gamepad button was successfully bound. 84 | function love.joystick.setGamepadMapping(guid, button, inputtype, inputindex, hatdir) end 85 | 86 | --- 87 | ---Represents a physical joystick. 88 | --- 89 | --- 90 | ---[Open in Browser](https://love2d.org/wiki/love.joystick) 91 | --- 92 | ---@class love.Joystick: love.Object 93 | local Joystick = {} 94 | 95 | --- 96 | ---Gets the direction of each axis. 97 | --- 98 | --- 99 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getAxes) 100 | --- 101 | ---@return number axisDir1 # Direction of axis1. 102 | ---@return number axisDir2 # Direction of axis2. 103 | ---@return number axisDirN # Direction of axisN. 104 | function Joystick:getAxes() end 105 | 106 | --- 107 | ---Gets the direction of an axis. 108 | --- 109 | --- 110 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getAxis) 111 | --- 112 | ---@param axis number # The index of the axis to be checked. 113 | ---@return number direction # Current value of the axis. 114 | function Joystick:getAxis(axis) end 115 | 116 | --- 117 | ---Gets the number of axes on the joystick. 118 | --- 119 | --- 120 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getAxisCount) 121 | --- 122 | ---@return number axes # The number of axes available. 123 | function Joystick:getAxisCount() end 124 | 125 | --- 126 | ---Gets the number of buttons on the joystick. 127 | --- 128 | --- 129 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getButtonCount) 130 | --- 131 | ---@return number buttons # The number of buttons available. 132 | function Joystick:getButtonCount() end 133 | 134 | --- 135 | ---Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems. 136 | --- 137 | ---Can be used to show different icons, etc. for different gamepads. 138 | --- 139 | --- 140 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getDeviceInfo) 141 | --- 142 | ---@return number vendorID # The USB vendor ID of the joystick. 143 | ---@return number productID # The USB product ID of the joystick. 144 | ---@return number productVersion # The product version of the joystick. 145 | function Joystick:getDeviceInfo() end 146 | 147 | --- 148 | ---Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent. 149 | --- 150 | --- 151 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getGUID) 152 | --- 153 | ---@return string guid # The Joystick type's OS-dependent unique identifier. 154 | function Joystick:getGUID() end 155 | 156 | --- 157 | ---Gets the direction of a virtual gamepad axis. If the Joystick isn't recognized as a gamepad or isn't connected, this function will always return 0. 158 | --- 159 | --- 160 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getGamepadAxis) 161 | --- 162 | ---@param axis love.GamepadAxis # The virtual axis to be checked. 163 | ---@return number direction # Current value of the axis. 164 | function Joystick:getGamepadAxis(axis) end 165 | 166 | --- 167 | ---Gets the button, axis or hat that a virtual gamepad input is bound to. 168 | --- 169 | --- 170 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getGamepadMapping) 171 | --- 172 | ---@overload fun(self: love.Joystick, button: love.GamepadButton):love.JoystickInputType, number, love.JoystickHat 173 | ---@param axis love.GamepadAxis # The virtual gamepad axis to get the binding for. 174 | ---@return love.JoystickInputType inputtype # The type of input the virtual gamepad axis is bound to. 175 | ---@return number inputindex # The index of the Joystick's button, axis or hat that the virtual gamepad axis is bound to. 176 | ---@return love.JoystickHat hatdirection # The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise. 177 | function Joystick:getGamepadMapping(axis) end 178 | 179 | --- 180 | ---Gets the full gamepad mapping string of this Joystick, or nil if it's not recognized as a gamepad. 181 | --- 182 | ---The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings. 183 | --- 184 | --- 185 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getGamepadMappingString) 186 | --- 187 | ---@return string mappingstring # A string containing the Joystick's gamepad mappings, or nil if the Joystick is not recognized as a gamepad. 188 | function Joystick:getGamepadMappingString() end 189 | 190 | --- 191 | ---Gets the direction of the Joystick's hat. 192 | --- 193 | --- 194 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getHat) 195 | --- 196 | ---@param hat number # The index of the hat to be checked. 197 | ---@return love.JoystickHat direction # The direction the hat is pushed. 198 | function Joystick:getHat(hat) end 199 | 200 | --- 201 | ---Gets the number of hats on the joystick. 202 | --- 203 | --- 204 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getHatCount) 205 | --- 206 | ---@return number hats # How many hats the joystick has. 207 | function Joystick:getHatCount() end 208 | 209 | --- 210 | ---Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it '''will''' change when the game is re-launched. 211 | --- 212 | --- 213 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getID) 214 | --- 215 | ---@return number id # The Joystick's unique identifier. Remains the same as long as the game is running. 216 | ---@return number instanceid # Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected. 217 | function Joystick:getID() end 218 | 219 | --- 220 | ---Gets the name of the joystick. 221 | --- 222 | --- 223 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getName) 224 | --- 225 | ---@return string name # The name of the joystick. 226 | function Joystick:getName() end 227 | 228 | --- 229 | ---Gets the current vibration motor strengths on a Joystick with rumble support. 230 | --- 231 | --- 232 | ---[Open in Browser](https://love2d.org/wiki/Joystick:getVibration) 233 | --- 234 | ---@return number left # Current strength of the left vibration motor on the Joystick. 235 | ---@return number right # Current strength of the right vibration motor on the Joystick. 236 | function Joystick:getVibration() end 237 | 238 | --- 239 | ---Gets whether the Joystick is connected. 240 | --- 241 | --- 242 | ---[Open in Browser](https://love2d.org/wiki/Joystick:isConnected) 243 | --- 244 | ---@return boolean connected # True if the Joystick is currently connected, false otherwise. 245 | function Joystick:isConnected() end 246 | 247 | --- 248 | ---Checks if a button on the Joystick is pressed. 249 | --- 250 | ---LÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1. 251 | --- 252 | --- 253 | ---[Open in Browser](https://love2d.org/wiki/Joystick:isDown) 254 | --- 255 | ---@param buttonN number # The index of a button to check. 256 | ---@return boolean anyDown # True if any supplied button is down, false if not. 257 | function Joystick:isDown(buttonN) end 258 | 259 | --- 260 | ---Gets whether the Joystick is recognized as a gamepad. If this is the case, the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis, Joystick:isGamepadDown, love.gamepadpressed, and related functions. 261 | --- 262 | ---LÖVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with love.joystick.setGamepadMapping. 263 | --- 264 | --- 265 | ---[Open in Browser](https://love2d.org/wiki/Joystick:isGamepad) 266 | --- 267 | ---@return boolean isgamepad # True if the Joystick is recognized as a gamepad, false otherwise. 268 | function Joystick:isGamepad() end 269 | 270 | --- 271 | ---Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false. 272 | --- 273 | --- 274 | ---[Open in Browser](https://love2d.org/wiki/Joystick:isGamepadDown) 275 | --- 276 | ---@param buttonN love.GamepadButton # The gamepad button to check. 277 | ---@return boolean anyDown # True if any supplied button is down, false if not. 278 | function Joystick:isGamepadDown(buttonN) end 279 | 280 | --- 281 | ---Gets whether the Joystick supports vibration. 282 | --- 283 | --- 284 | ---[Open in Browser](https://love2d.org/wiki/Joystick:isVibrationSupported) 285 | --- 286 | ---@return boolean supported # True if rumble / force feedback vibration is supported on this Joystick, false if not. 287 | function Joystick:isVibrationSupported() end 288 | 289 | --- 290 | ---Sets the vibration motor speeds on a Joystick with rumble support. Most common gamepads have this functionality, although not all drivers give proper support. Use Joystick:isVibrationSupported to check. 291 | --- 292 | --- 293 | ---[Open in Browser](https://love2d.org/wiki/Joystick:setVibration) 294 | --- 295 | ---@overload fun(self: love.Joystick):boolean 296 | ---@overload fun(self: love.Joystick, left: number, right: number, duration?: number):boolean 297 | ---@param left number # Strength of the left vibration motor on the Joystick. Must be in the range of 1. 298 | ---@param right number # Strength of the right vibration motor on the Joystick. Must be in the range of 1. 299 | ---@return boolean success # True if the vibration was successfully applied, false if not. 300 | function Joystick:setVibration(left, right) end 301 | 302 | --- 303 | ---Virtual gamepad axes. 304 | --- 305 | --- 306 | ---[Open in Browser](https://love2d.org/wiki/GamepadAxis) 307 | --- 308 | ---@alias love.GamepadAxis 309 | --- 310 | ---The x-axis of the left thumbstick. 311 | --- 312 | ---| "leftx" 313 | --- 314 | ---The y-axis of the left thumbstick. 315 | --- 316 | ---| "lefty" 317 | --- 318 | ---The x-axis of the right thumbstick. 319 | --- 320 | ---| "rightx" 321 | --- 322 | ---The y-axis of the right thumbstick. 323 | --- 324 | ---| "righty" 325 | --- 326 | ---Left analog trigger. 327 | --- 328 | ---| "triggerleft" 329 | --- 330 | ---Right analog trigger. 331 | --- 332 | ---| "triggerright" 333 | 334 | --- 335 | ---Virtual gamepad buttons. 336 | --- 337 | --- 338 | ---[Open in Browser](https://love2d.org/wiki/GamepadButton) 339 | --- 340 | ---@alias love.GamepadButton 341 | --- 342 | ---Bottom face button (A). 343 | --- 344 | ---| "a" 345 | --- 346 | ---Right face button (B). 347 | --- 348 | ---| "b" 349 | --- 350 | ---Left face button (X). 351 | --- 352 | ---| "x" 353 | --- 354 | ---Top face button (Y). 355 | --- 356 | ---| "y" 357 | --- 358 | ---Back button. 359 | --- 360 | ---| "back" 361 | --- 362 | ---Guide button. 363 | --- 364 | ---| "guide" 365 | --- 366 | ---Start button. 367 | --- 368 | ---| "start" 369 | --- 370 | ---Left stick click button. 371 | --- 372 | ---| "leftstick" 373 | --- 374 | ---Right stick click button. 375 | --- 376 | ---| "rightstick" 377 | --- 378 | ---Left bumper. 379 | --- 380 | ---| "leftshoulder" 381 | --- 382 | ---Right bumper. 383 | --- 384 | ---| "rightshoulder" 385 | --- 386 | ---D-pad up. 387 | --- 388 | ---| "dpup" 389 | --- 390 | ---D-pad down. 391 | --- 392 | ---| "dpdown" 393 | --- 394 | ---D-pad left. 395 | --- 396 | ---| "dpleft" 397 | --- 398 | ---D-pad right. 399 | --- 400 | ---| "dpright" 401 | 402 | --- 403 | ---Joystick hat positions. 404 | --- 405 | --- 406 | ---[Open in Browser](https://love2d.org/wiki/JoystickHat) 407 | --- 408 | ---@alias love.JoystickHat 409 | --- 410 | ---Centered 411 | --- 412 | ---| "c" 413 | --- 414 | ---Down 415 | --- 416 | ---| "d" 417 | --- 418 | ---Left 419 | --- 420 | ---| "l" 421 | --- 422 | ---Left+Down 423 | --- 424 | ---| "ld" 425 | --- 426 | ---Left+Up 427 | --- 428 | ---| "lu" 429 | --- 430 | ---Right 431 | --- 432 | ---| "r" 433 | --- 434 | ---Right+Down 435 | --- 436 | ---| "rd" 437 | --- 438 | ---Right+Up 439 | --- 440 | ---| "ru" 441 | --- 442 | ---Up 443 | --- 444 | ---| "u" 445 | 446 | --- 447 | ---Types of Joystick inputs. 448 | --- 449 | --- 450 | ---[Open in Browser](https://love2d.org/wiki/JoystickInputType) 451 | --- 452 | ---@alias love.JoystickInputType 453 | --- 454 | ---Analog axis. 455 | --- 456 | ---| "axis" 457 | --- 458 | ---Button. 459 | --- 460 | ---| "button" 461 | --- 462 | ---8-direction hat value. 463 | --- 464 | ---| "hat" 465 | -------------------------------------------------------------------------------- /library/love/window.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface for modifying and retrieving information about the program's window. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.window) 8 | --- 9 | ---@class love.window 10 | love.window = {} 11 | 12 | --- 13 | ---Closes the window. It can be reopened with love.window.setMode. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.window.close) 17 | --- 18 | function love.window.close() end 19 | 20 | --- 21 | ---Converts a number from pixels to density-independent units. 22 | --- 23 | ---The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.fromPixels(1600) would return 800 in that case. 24 | --- 25 | ---This function converts coordinates from pixels to the size users are expecting them to display at onscreen. love.window.toPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. 26 | --- 27 | ---Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. 28 | --- 29 | --- 30 | ---[Open in Browser](https://love2d.org/wiki/love.window.fromPixels) 31 | --- 32 | ---@overload fun(px: number, py: number):number, number 33 | ---@param pixelvalue number # A number in pixels to convert to density-independent units. 34 | ---@return number value # The converted number, in density-independent units. 35 | function love.window.fromPixels(pixelvalue) end 36 | 37 | --- 38 | ---Gets the DPI scale factor associated with the window. 39 | --- 40 | ---The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.getDPIScale() would return 2.0 in that case. 41 | --- 42 | ---The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. 43 | --- 44 | ---The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. 45 | --- 46 | --- 47 | ---[Open in Browser](https://love2d.org/wiki/love.window.getDPIScale) 48 | --- 49 | ---@return number scale # The pixel scale factor associated with the window. 50 | function love.window.getDPIScale() end 51 | 52 | --- 53 | ---Gets the width and height of the desktop. 54 | --- 55 | --- 56 | ---[Open in Browser](https://love2d.org/wiki/love.window.getDesktopDimensions) 57 | --- 58 | ---@param displayindex? number # The index of the display, if multiple monitors are available. 59 | ---@return number width # The width of the desktop. 60 | ---@return number height # The height of the desktop. 61 | function love.window.getDesktopDimensions(displayindex) end 62 | 63 | --- 64 | ---Gets the number of connected monitors. 65 | --- 66 | --- 67 | ---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayCount) 68 | --- 69 | ---@return number count # The number of currently connected displays. 70 | function love.window.getDisplayCount() end 71 | 72 | --- 73 | ---Gets the name of a display. 74 | --- 75 | --- 76 | ---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayName) 77 | --- 78 | ---@param displayindex? number # The index of the display to get the name of. 79 | ---@return string name # The name of the specified display. 80 | function love.window.getDisplayName(displayindex) end 81 | 82 | --- 83 | ---Gets current device display orientation. 84 | --- 85 | --- 86 | ---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayOrientation) 87 | --- 88 | ---@param displayindex? number # Display index to get its display orientation, or nil for default display index. 89 | ---@return love.DisplayOrientation orientation # Current device display orientation. 90 | function love.window.getDisplayOrientation(displayindex) end 91 | 92 | --- 93 | ---Gets whether the window is fullscreen. 94 | --- 95 | --- 96 | ---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreen) 97 | --- 98 | ---@return boolean fullscreen # True if the window is fullscreen, false otherwise. 99 | ---@return love.FullscreenType fstype # The type of fullscreen mode used. 100 | function love.window.getFullscreen() end 101 | 102 | --- 103 | ---Gets a list of supported fullscreen modes. 104 | --- 105 | --- 106 | ---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreenModes) 107 | --- 108 | ---@param displayindex? number # The index of the display, if multiple monitors are available. 109 | ---@return {width: number, height: number} modes # A table of width/height pairs. (Note that this may not be in order.) 110 | function love.window.getFullscreenModes(displayindex) end 111 | 112 | --- 113 | ---Gets the window icon. 114 | --- 115 | --- 116 | ---[Open in Browser](https://love2d.org/wiki/love.window.getIcon) 117 | --- 118 | ---@return love.ImageData imagedata # The window icon imagedata, or nil if no icon has been set with love.window.setIcon. 119 | function love.window.getIcon() end 120 | 121 | --- 122 | ---Gets the display mode and properties of the window. 123 | --- 124 | --- 125 | ---[Open in Browser](https://love2d.org/wiki/love.window.getMode) 126 | --- 127 | ---@return number width # Window width. 128 | ---@return number height # Window height. 129 | ---@return {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, refreshrate: number, x: number, y: number, srgb: boolean} flags # Table with the window properties: 130 | function love.window.getMode() end 131 | 132 | --- 133 | ---Gets the position of the window on the screen. 134 | --- 135 | ---The window position is in the coordinate space of the display it is currently in. 136 | --- 137 | --- 138 | ---[Open in Browser](https://love2d.org/wiki/love.window.getPosition) 139 | --- 140 | ---@return number x # The x-coordinate of the window's position. 141 | ---@return number y # The y-coordinate of the window's position. 142 | ---@return number displayindex # The index of the display that the window is in. 143 | function love.window.getPosition() end 144 | 145 | --- 146 | ---Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user. 147 | --- 148 | --- 149 | ---[Open in Browser](https://love2d.org/wiki/love.window.getSafeArea) 150 | --- 151 | ---@return number x # Starting position of safe area (x-axis). 152 | ---@return number y # Starting position of safe area (y-axis). 153 | ---@return number w # Width of safe area. 154 | ---@return number h # Height of safe area. 155 | function love.window.getSafeArea() end 156 | 157 | --- 158 | ---Gets the window title. 159 | --- 160 | --- 161 | ---[Open in Browser](https://love2d.org/wiki/love.window.getTitle) 162 | --- 163 | ---@return string title # The current window title. 164 | function love.window.getTitle() end 165 | 166 | --- 167 | ---Gets current vertical synchronization (vsync). 168 | --- 169 | --- 170 | ---[Open in Browser](https://love2d.org/wiki/love.window.getVSync) 171 | --- 172 | ---@return number vsync # Current vsync status. 1 if enabled, 0 if disabled, and -1 for adaptive vsync. 173 | function love.window.getVSync() end 174 | 175 | --- 176 | ---Checks if the game window has keyboard focus. 177 | --- 178 | --- 179 | ---[Open in Browser](https://love2d.org/wiki/love.window.hasFocus) 180 | --- 181 | ---@return boolean focus # True if the window has the focus or false if not. 182 | function love.window.hasFocus() end 183 | 184 | --- 185 | ---Checks if the game window has mouse focus. 186 | --- 187 | --- 188 | ---[Open in Browser](https://love2d.org/wiki/love.window.hasMouseFocus) 189 | --- 190 | ---@return boolean focus # True if the window has mouse focus or false if not. 191 | function love.window.hasMouseFocus() end 192 | 193 | --- 194 | ---Gets whether the display is allowed to sleep while the program is running. 195 | --- 196 | ---Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. 197 | --- 198 | --- 199 | ---[Open in Browser](https://love2d.org/wiki/love.window.isDisplaySleepEnabled) 200 | --- 201 | ---@return boolean enabled # True if system display sleep is enabled / allowed, false otherwise. 202 | function love.window.isDisplaySleepEnabled() end 203 | 204 | --- 205 | ---Gets whether the Window is currently maximized. 206 | --- 207 | ---The window can be maximized if it is not fullscreen and is resizable, and either the user has pressed the window's Maximize button or love.window.maximize has been called. 208 | --- 209 | --- 210 | ---[Open in Browser](https://love2d.org/wiki/love.window.isMaximized) 211 | --- 212 | ---@return boolean maximized # True if the window is currently maximized in windowed mode, false otherwise. 213 | function love.window.isMaximized() end 214 | 215 | --- 216 | ---Gets whether the Window is currently minimized. 217 | --- 218 | --- 219 | ---[Open in Browser](https://love2d.org/wiki/love.window.isMinimized) 220 | --- 221 | ---@return boolean minimized # True if the window is currently minimized, false otherwise. 222 | function love.window.isMinimized() end 223 | 224 | --- 225 | ---Checks if the window is open. 226 | --- 227 | --- 228 | ---[Open in Browser](https://love2d.org/wiki/love.window.isOpen) 229 | --- 230 | ---@return boolean open # True if the window is open, false otherwise. 231 | function love.window.isOpen() end 232 | 233 | --- 234 | ---Checks if the game window is visible. 235 | --- 236 | ---The window is considered visible if it's not minimized and the program isn't hidden. 237 | --- 238 | --- 239 | ---[Open in Browser](https://love2d.org/wiki/love.window.isVisible) 240 | --- 241 | ---@return boolean visible # True if the window is visible or false if not. 242 | function love.window.isVisible() end 243 | 244 | --- 245 | ---Makes the window as large as possible. 246 | --- 247 | ---This function has no effect if the window isn't resizable, since it essentially programmatically presses the window's 'maximize' button. 248 | --- 249 | --- 250 | ---[Open in Browser](https://love2d.org/wiki/love.window.maximize) 251 | --- 252 | function love.window.maximize() end 253 | 254 | --- 255 | ---Minimizes the window to the system's task bar / dock. 256 | --- 257 | --- 258 | ---[Open in Browser](https://love2d.org/wiki/love.window.minimize) 259 | --- 260 | function love.window.minimize() end 261 | 262 | --- 263 | ---Causes the window to request the attention of the user if it is not in the foreground. 264 | --- 265 | ---In Windows the taskbar icon will flash, and in OS X the dock icon will bounce. 266 | --- 267 | --- 268 | ---[Open in Browser](https://love2d.org/wiki/love.window.requestAttention) 269 | --- 270 | ---@param continuous? boolean # Whether to continuously request attention until the window becomes active, or to do it only once. 271 | function love.window.requestAttention(continuous) end 272 | 273 | --- 274 | ---Restores the size and position of the window if it was minimized or maximized. 275 | --- 276 | --- 277 | ---[Open in Browser](https://love2d.org/wiki/love.window.restore) 278 | --- 279 | function love.window.restore() end 280 | 281 | --- 282 | ---Sets whether the display is allowed to sleep while the program is running. 283 | --- 284 | ---Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. 285 | --- 286 | --- 287 | ---[Open in Browser](https://love2d.org/wiki/love.window.setDisplaySleepEnabled) 288 | --- 289 | ---@param enable boolean # True to enable system display sleep, false to disable it. 290 | function love.window.setDisplaySleepEnabled(enable) end 291 | 292 | --- 293 | ---Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected. 294 | --- 295 | --- 296 | ---[Open in Browser](https://love2d.org/wiki/love.window.setFullscreen) 297 | --- 298 | ---@overload fun(fullscreen: boolean, fstype: love.FullscreenType):boolean 299 | ---@param fullscreen boolean # Whether to enter or exit fullscreen mode. 300 | ---@return boolean success # True if an attempt to enter fullscreen was successful, false otherwise. 301 | function love.window.setFullscreen(fullscreen) end 302 | 303 | --- 304 | ---Sets the window icon until the game is quit. Not all operating systems support very large icon images. 305 | --- 306 | --- 307 | ---[Open in Browser](https://love2d.org/wiki/love.window.setIcon) 308 | --- 309 | ---@param imagedata love.ImageData # The window icon image. 310 | ---@return boolean success # Whether the icon has been set successfully. 311 | function love.window.setIcon(imagedata) end 312 | 313 | --- 314 | ---Sets the display mode and properties of the window. 315 | --- 316 | ---If width or height is 0, setMode will use the width and height of the desktop. 317 | --- 318 | ---Changing the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with canvases beforehand or re-draw to them afterward if you need to. 319 | --- 320 | --- 321 | ---[Open in Browser](https://love2d.org/wiki/love.window.setMode) 322 | --- 323 | ---@param width number # Display width. 324 | ---@param height number # Display height. 325 | ---@param flags? {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, stencil: boolean, depth: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number, usedpiscale: boolean, srgb: boolean} # The flags table with the options: 326 | ---@return boolean success # True if successful, false otherwise. 327 | function love.window.setMode(width, height, flags) end 328 | 329 | --- 330 | ---Sets the position of the window on the screen. 331 | --- 332 | ---The window position is in the coordinate space of the specified display. 333 | --- 334 | --- 335 | ---[Open in Browser](https://love2d.org/wiki/love.window.setPosition) 336 | --- 337 | ---@param x number # The x-coordinate of the window's position. 338 | ---@param y number # The y-coordinate of the window's position. 339 | ---@param displayindex? number # The index of the display that the new window position is relative to. 340 | function love.window.setPosition(x, y, displayindex) end 341 | 342 | --- 343 | ---Sets the window title. 344 | --- 345 | --- 346 | ---[Open in Browser](https://love2d.org/wiki/love.window.setTitle) 347 | --- 348 | ---@param title string # The new window title. 349 | function love.window.setTitle(title) end 350 | 351 | --- 352 | ---Sets vertical synchronization mode. 353 | --- 354 | --- 355 | ---[Open in Browser](https://love2d.org/wiki/love.window.setVSync) 356 | --- 357 | ---@param vsync number # VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync. 358 | function love.window.setVSync(vsync) end 359 | 360 | --- 361 | ---Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons. 362 | --- 363 | --- 364 | ---[Open in Browser](https://love2d.org/wiki/love.window.showMessageBox) 365 | --- 366 | ---@overload fun(title: string, message: string, buttonlist: table, type?: love.MessageBoxType, attachtowindow?: boolean):number 367 | ---@param title string # The title of the message box. 368 | ---@param message string # The text inside the message box. 369 | ---@param type? love.MessageBoxType # The type of the message box. 370 | ---@param attachtowindow? boolean # Whether the message box should be attached to the love window or free-floating. 371 | ---@return boolean success # Whether the message box was successfully displayed. 372 | function love.window.showMessageBox(title, message, type, attachtowindow) end 373 | 374 | --- 375 | ---Converts a number from density-independent units to pixels. 376 | --- 377 | ---The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.toPixels(800) would return 1600 in that case. 378 | --- 379 | ---This is used to convert coordinates from the size users are expecting them to display at onscreen to pixels. love.window.fromPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. 380 | --- 381 | ---Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. 382 | --- 383 | --- 384 | ---[Open in Browser](https://love2d.org/wiki/love.window.toPixels) 385 | --- 386 | ---@overload fun(x: number, y: number):number, number 387 | ---@param value number # A number in density-independent units to convert to pixels. 388 | ---@return number pixelvalue # The converted number, in pixels. 389 | function love.window.toPixels(value) end 390 | 391 | --- 392 | ---Sets the display mode and properties of the window, without modifying unspecified properties. 393 | --- 394 | ---If width or height is 0, updateMode will use the width and height of the desktop. 395 | --- 396 | ---Changing the display mode may have side effects: for example, canvases will be cleared. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to. 397 | --- 398 | --- 399 | ---[Open in Browser](https://love2d.org/wiki/love.window.updateMode) 400 | --- 401 | ---@param width number # Window width. 402 | ---@param height number # Window height. 403 | ---@param settings {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number} # The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode. 404 | ---@return boolean success # True if successful, false otherwise. 405 | function love.window.updateMode(width, height, settings) end 406 | 407 | --- 408 | ---Types of device display orientation. 409 | --- 410 | --- 411 | ---[Open in Browser](https://love2d.org/wiki/DisplayOrientation) 412 | --- 413 | ---@alias love.DisplayOrientation 414 | --- 415 | ---Orientation cannot be determined. 416 | --- 417 | ---| "unknown" 418 | --- 419 | ---Landscape orientation. 420 | --- 421 | ---| "landscape" 422 | --- 423 | ---Landscape orientation (flipped). 424 | --- 425 | ---| "landscapeflipped" 426 | --- 427 | ---Portrait orientation. 428 | --- 429 | ---| "portrait" 430 | --- 431 | ---Portrait orientation (flipped). 432 | --- 433 | ---| "portraitflipped" 434 | 435 | --- 436 | ---Types of fullscreen modes. 437 | --- 438 | --- 439 | ---[Open in Browser](https://love2d.org/wiki/FullscreenType) 440 | --- 441 | ---@alias love.FullscreenType 442 | --- 443 | ---Sometimes known as borderless fullscreen windowed mode. A borderless screen-sized window is created which sits on top of all desktop UI elements. The window is automatically resized to match the dimensions of the desktop, and its size cannot be changed. 444 | --- 445 | ---| "desktop" 446 | --- 447 | ---Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor. 448 | --- 449 | ---| "exclusive" 450 | --- 451 | ---Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor. 452 | --- 453 | ---| "normal" 454 | 455 | --- 456 | ---Types of message box dialogs. Different types may have slightly different looks. 457 | --- 458 | --- 459 | ---[Open in Browser](https://love2d.org/wiki/MessageBoxType) 460 | --- 461 | ---@alias love.MessageBoxType 462 | --- 463 | ---Informational dialog. 464 | --- 465 | ---| "info" 466 | --- 467 | ---Warning dialog. 468 | --- 469 | ---| "warning" 470 | --- 471 | ---Error dialog. 472 | --- 473 | ---| "error" 474 | -------------------------------------------------------------------------------- /library/love/image.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to decode encoded image data. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.image) 8 | --- 9 | ---@class love.image 10 | love.image = {} 11 | 12 | --- 13 | ---Determines whether a file can be loaded as CompressedImageData. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.image.isCompressed) 17 | --- 18 | ---@overload fun(fileData: love.FileData):boolean 19 | ---@param filename string # The filename of the potentially compressed image file. 20 | ---@return boolean compressed # Whether the file can be loaded as CompressedImageData or not. 21 | function love.image.isCompressed(filename) end 22 | 23 | --- 24 | ---Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page. 25 | --- 26 | --- 27 | ---[Open in Browser](https://love2d.org/wiki/love.image.newCompressedData) 28 | --- 29 | ---@overload fun(fileData: love.FileData):love.CompressedImageData 30 | ---@param filename string # The filename of the compressed image file. 31 | ---@return love.CompressedImageData compressedImageData # The new CompressedImageData object. 32 | function love.image.newCompressedData(filename) end 33 | 34 | --- 35 | ---Creates a new ImageData object. 36 | --- 37 | --- 38 | ---[Open in Browser](https://love2d.org/wiki/love.image.newImageData) 39 | --- 40 | ---@overload fun(width: number, height: number, format?: love.PixelFormat, data?: string):love.ImageData 41 | ---@overload fun(width: number, height: number, data: string):love.ImageData 42 | ---@overload fun(filename: string):love.ImageData 43 | ---@overload fun(filedata: love.FileData):love.ImageData 44 | ---@param width number # The width of the ImageData. 45 | ---@param height number # The height of the ImageData. 46 | ---@return love.ImageData imageData # The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero. 47 | function love.image.newImageData(width, height) end 48 | 49 | --- 50 | ---Represents compressed image data designed to stay compressed in RAM. 51 | --- 52 | ---CompressedImageData encompasses standard compressed texture formats such as DXT1, DXT5, and BC5 / 3Dc. 53 | --- 54 | ---You can't draw CompressedImageData directly to the screen. See Image for that. 55 | --- 56 | --- 57 | ---[Open in Browser](https://love2d.org/wiki/love.image) 58 | --- 59 | ---@class love.CompressedImageData: love.Data, love.Object 60 | local CompressedImageData = {} 61 | 62 | --- 63 | ---Gets the width and height of the CompressedImageData. 64 | --- 65 | --- 66 | ---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getDimensions) 67 | --- 68 | ---@overload fun(self: love.CompressedImageData, level: number):number, number 69 | ---@return number width # The width of the CompressedImageData. 70 | ---@return number height # The height of the CompressedImageData. 71 | function CompressedImageData:getDimensions() end 72 | 73 | --- 74 | ---Gets the format of the CompressedImageData. 75 | --- 76 | --- 77 | ---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getFormat) 78 | --- 79 | ---@return love.CompressedImageFormat format # The format of the CompressedImageData. 80 | function CompressedImageData:getFormat() end 81 | 82 | --- 83 | ---Gets the height of the CompressedImageData. 84 | --- 85 | --- 86 | ---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getHeight) 87 | --- 88 | ---@overload fun(self: love.CompressedImageData, level: number):number 89 | ---@return number height # The height of the CompressedImageData. 90 | function CompressedImageData:getHeight() end 91 | 92 | --- 93 | ---Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count. 94 | --- 95 | --- 96 | ---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getMipmapCount) 97 | --- 98 | ---@return number mipmaps # The number of mipmap levels stored in the CompressedImageData. 99 | function CompressedImageData:getMipmapCount() end 100 | 101 | --- 102 | ---Gets the width of the CompressedImageData. 103 | --- 104 | --- 105 | ---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getWidth) 106 | --- 107 | ---@overload fun(self: love.CompressedImageData, level: number):number 108 | ---@return number width # The width of the CompressedImageData. 109 | function CompressedImageData:getWidth() end 110 | 111 | --- 112 | ---Raw (decoded) image data. 113 | --- 114 | ---You can't draw ImageData directly to screen. See Image for that. 115 | --- 116 | --- 117 | ---[Open in Browser](https://love2d.org/wiki/love.image) 118 | --- 119 | ---@class love.ImageData: love.Data, love.Object 120 | local ImageData = {} 121 | 122 | --- 123 | ---Encodes the ImageData and optionally writes it to the save directory. 124 | --- 125 | --- 126 | ---[Open in Browser](https://love2d.org/wiki/ImageData:encode) 127 | --- 128 | ---@overload fun(self: love.ImageData, outFile: string) 129 | ---@overload fun(self: love.ImageData, outFile: string, format: love.ImageFormat) 130 | ---@param format love.ImageFormat # The format to encode the image as. 131 | ---@param filename? string # The filename to write the file to. If nil, no file will be written but the FileData will still be returned. 132 | ---@return love.FileData filedata # The encoded image as a new FileData object. 133 | function ImageData:encode(format, filename) end 134 | 135 | --- 136 | ---Gets the width and height of the ImageData in pixels. 137 | --- 138 | --- 139 | ---[Open in Browser](https://love2d.org/wiki/ImageData:getDimensions) 140 | --- 141 | ---@return number width # The width of the ImageData in pixels. 142 | ---@return number height # The height of the ImageData in pixels. 143 | function ImageData:getDimensions() end 144 | 145 | --- 146 | ---Gets the height of the ImageData in pixels. 147 | --- 148 | --- 149 | ---[Open in Browser](https://love2d.org/wiki/ImageData:getHeight) 150 | --- 151 | ---@return number height # The height of the ImageData in pixels. 152 | function ImageData:getHeight() end 153 | 154 | --- 155 | ---Gets the color of a pixel at a specific position in the image. 156 | --- 157 | ---Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored. 158 | --- 159 | ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. 160 | --- 161 | --- 162 | ---[Open in Browser](https://love2d.org/wiki/ImageData:getPixel) 163 | --- 164 | ---@param x number # The position of the pixel on the x-axis. 165 | ---@param y number # The position of the pixel on the y-axis. 166 | ---@return number r # The red component (0-1). 167 | ---@return number g # The green component (0-1). 168 | ---@return number b # The blue component (0-1). 169 | ---@return number a # The alpha component (0-1). 170 | function ImageData:getPixel(x, y) end 171 | 172 | --- 173 | ---Gets the width of the ImageData in pixels. 174 | --- 175 | --- 176 | ---[Open in Browser](https://love2d.org/wiki/ImageData:getWidth) 177 | --- 178 | ---@return number width # The width of the ImageData in pixels. 179 | function ImageData:getWidth() end 180 | 181 | --- 182 | ---Transform an image by applying a function to every pixel. 183 | --- 184 | ---This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData. 185 | --- 186 | ---The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel. 187 | --- 188 | ---function pixelFunction(x, y, r, g, b, a) 189 | --- 190 | --- -- template for defining your own pixel mapping function 191 | --- 192 | --- -- perform computations giving the new values for r, g, b and a 193 | --- 194 | --- -- ... 195 | --- 196 | --- return r, g, b, a 197 | --- 198 | ---end 199 | --- 200 | ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. 201 | --- 202 | --- 203 | ---[Open in Browser](https://love2d.org/wiki/ImageData:mapPixel) 204 | --- 205 | ---@param pixelFunction function # Function to apply to every pixel. 206 | ---@param x? number # The x-axis of the top-left corner of the area within the ImageData to apply the function to. 207 | ---@param y? number # The y-axis of the top-left corner of the area within the ImageData to apply the function to. 208 | ---@param width? number # The width of the area within the ImageData to apply the function to. 209 | ---@param height? number # The height of the area within the ImageData to apply the function to. 210 | function ImageData:mapPixel(pixelFunction, x, y, width, height) end 211 | 212 | --- 213 | ---Paste into ImageData from another source ImageData. 214 | --- 215 | --- 216 | ---[Open in Browser](https://love2d.org/wiki/ImageData:paste) 217 | --- 218 | ---@param source love.ImageData # Source ImageData from which to copy. 219 | ---@param dx number # Destination top-left position on x-axis. 220 | ---@param dy number # Destination top-left position on y-axis. 221 | ---@param sx number # Source top-left position on x-axis. 222 | ---@param sy number # Source top-left position on y-axis. 223 | ---@param sw number # Source width. 224 | ---@param sh number # Source height. 225 | function ImageData:paste(source, dx, dy, sx, sy, sw, sh) end 226 | 227 | --- 228 | ---Sets the color of a pixel at a specific position in the image. 229 | --- 230 | ---Valid x and y values start at 0 and go up to image width and height minus 1. 231 | --- 232 | ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. 233 | --- 234 | --- 235 | ---[Open in Browser](https://love2d.org/wiki/ImageData:setPixel) 236 | --- 237 | ---@overload fun(self: love.ImageData, x: number, y: number, color: table) 238 | ---@param x number # The position of the pixel on the x-axis. 239 | ---@param y number # The position of the pixel on the y-axis. 240 | ---@param r number # The red component (0-1). 241 | ---@param g number # The green component (0-1). 242 | ---@param b number # The blue component (0-1). 243 | ---@param a number # The alpha component (0-1). 244 | function ImageData:setPixel(x, y, r, g, b, a) end 245 | 246 | --- 247 | ---Gets the pixel format of the ImageData. 248 | --- 249 | --- 250 | ---[Open in Browser](https://love2d.org/wiki/ImageData:getFormat) 251 | --- 252 | ---@return love.PixelFormat format # The pixel format the ImageData was created with. 253 | function ImageData:getFormat() end 254 | 255 | --- 256 | ---Compressed image data formats. Here and here are a couple overviews of many of the formats. 257 | --- 258 | ---Unlike traditional PNG or jpeg, these formats stay compressed in RAM and in the graphics card's VRAM. This is good for saving memory space as well as improving performance, since the graphics card will be able to keep more of the image's pixels in its fast-access cache when drawing it. 259 | --- 260 | --- 261 | ---[Open in Browser](https://love2d.org/wiki/CompressedImageFormat) 262 | --- 263 | ---@alias love.CompressedImageFormat 264 | --- 265 | ---The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems. 266 | --- 267 | ---| "DXT1" 268 | --- 269 | ---The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format. 270 | --- 271 | ---| "DXT3" 272 | --- 273 | ---The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems. 274 | --- 275 | ---| "DXT5" 276 | --- 277 | ---The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel. 278 | --- 279 | ---| "BC4" 280 | --- 281 | ---The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. 282 | --- 283 | ---| "BC4s" 284 | --- 285 | ---The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel. 286 | --- 287 | ---| "BC5" 288 | --- 289 | ---The signed variant of the BC5 format. 290 | --- 291 | ---| "BC5s" 292 | --- 293 | ---The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems. 294 | --- 295 | ---| "BC6h" 296 | --- 297 | ---The signed variant of the BC6H format. Stores RGB data in the range of +65504. 298 | --- 299 | ---| "BC6hs" 300 | --- 301 | ---The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel. 302 | --- 303 | ---| "BC7" 304 | --- 305 | ---The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices. 306 | --- 307 | ---| "ETC1" 308 | --- 309 | ---The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices. 310 | --- 311 | ---| "ETC2rgb" 312 | --- 313 | ---The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices. 314 | --- 315 | ---| "ETC2rgba" 316 | --- 317 | ---The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel. 318 | --- 319 | ---| "ETC2rgba1" 320 | --- 321 | ---The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel. 322 | --- 323 | ---| "EACr" 324 | --- 325 | ---The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. 326 | --- 327 | ---| "EACrs" 328 | --- 329 | ---The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel. 330 | --- 331 | ---| "EACrg" 332 | --- 333 | ---The signed two-channel variant of the EAC format. 334 | --- 335 | ---| "EACrgs" 336 | --- 337 | ---The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized. 338 | --- 339 | ---| "PVR1rgb2" 340 | --- 341 | ---The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel. 342 | --- 343 | ---| "PVR1rgb4" 344 | --- 345 | ---The 2 bit per pixel RGBA variant of the PVRTC1 format. 346 | --- 347 | ---| "PVR1rgba2" 348 | --- 349 | ---The 4 bit per pixel RGBA variant of the PVRTC1 format. 350 | --- 351 | ---| "PVR1rgba4" 352 | --- 353 | ---The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel. 354 | --- 355 | ---| "ASTC4x4" 356 | --- 357 | ---The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel. 358 | --- 359 | ---| "ASTC5x4" 360 | --- 361 | ---The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel. 362 | --- 363 | ---| "ASTC5x5" 364 | --- 365 | ---The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel. 366 | --- 367 | ---| "ASTC6x5" 368 | --- 369 | ---The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel. 370 | --- 371 | ---| "ASTC6x6" 372 | --- 373 | ---The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel. 374 | --- 375 | ---| "ASTC8x5" 376 | --- 377 | ---The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel. 378 | --- 379 | ---| "ASTC8x6" 380 | --- 381 | ---The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel. 382 | --- 383 | ---| "ASTC8x8" 384 | --- 385 | ---The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel. 386 | --- 387 | ---| "ASTC10x5" 388 | --- 389 | ---The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel. 390 | --- 391 | ---| "ASTC10x6" 392 | --- 393 | ---The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel. 394 | --- 395 | ---| "ASTC10x8" 396 | --- 397 | ---The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel. 398 | --- 399 | ---| "ASTC10x10" 400 | --- 401 | ---The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel. 402 | --- 403 | ---| "ASTC12x10" 404 | --- 405 | ---The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel. 406 | --- 407 | ---| "ASTC12x12" 408 | 409 | --- 410 | ---Encoded image formats. 411 | --- 412 | --- 413 | ---[Open in Browser](https://love2d.org/wiki/ImageFormat) 414 | --- 415 | ---@alias love.ImageFormat 416 | --- 417 | ---Targa image format. 418 | --- 419 | ---| "tga" 420 | --- 421 | ---PNG image format. 422 | --- 423 | ---| "png" 424 | --- 425 | ---JPG image format. 426 | --- 427 | ---| "jpg" 428 | --- 429 | ---BMP image format. 430 | --- 431 | ---| "bmp" 432 | 433 | --- 434 | ---Pixel formats for Textures, ImageData, and CompressedImageData. 435 | --- 436 | --- 437 | ---[Open in Browser](https://love2d.org/wiki/PixelFormat) 438 | --- 439 | ---@alias love.PixelFormat 440 | --- 441 | ---Indicates unknown pixel format, used internally. 442 | --- 443 | ---| "unknown" 444 | --- 445 | ---Alias for rgba8, or srgba8 if gamma-correct rendering is enabled. 446 | --- 447 | ---| "normal" 448 | --- 449 | ---A format suitable for high dynamic range content - an alias for the rgba16f format, normally. 450 | --- 451 | ---| "hdr" 452 | --- 453 | ---Single-channel (red component) format (8 bpp). 454 | --- 455 | ---| "r8" 456 | --- 457 | ---Two channels (red and green components) with 8 bits per channel (16 bpp). 458 | --- 459 | ---| "rg8" 460 | --- 461 | ---8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders). 462 | --- 463 | ---| "rgba8" 464 | --- 465 | ---gamma-correct version of rgba8. 466 | --- 467 | ---| "srgba8" 468 | --- 469 | ---Single-channel (red component) format (16 bpp). 470 | --- 471 | ---| "r16" 472 | --- 473 | ---Two channels (red and green components) with 16 bits per channel (32 bpp). 474 | --- 475 | ---| "rg16" 476 | --- 477 | ---16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders). 478 | --- 479 | ---| "rgba16" 480 | --- 481 | ---Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504]. 482 | --- 483 | ---| "r16f" 484 | --- 485 | ---Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504]. 486 | --- 487 | ---| "rg16f" 488 | --- 489 | ---Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504]. 490 | --- 491 | ---| "rgba16f" 492 | --- 493 | ---Floating point single-channel format (32 bpp). 494 | --- 495 | ---| "r32f" 496 | --- 497 | ---Floating point two-channel format with 32 bits per channel (64 bpp). 498 | --- 499 | ---| "rg32f" 500 | --- 501 | ---Floating point RGBA with 32 bits per channel (128 bpp). 502 | --- 503 | ---| "rgba32f" 504 | --- 505 | ---Same as rg8, but accessed as (L, L, L, A) 506 | --- 507 | ---| "la8" 508 | --- 509 | ---4 bits per channel (16 bpp) RGBA. 510 | --- 511 | ---| "rgba4" 512 | --- 513 | ---RGB with 5 bits each, and a 1-bit alpha channel (16 bpp). 514 | --- 515 | ---| "rgb5a1" 516 | --- 517 | ---RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format. 518 | --- 519 | ---| "rgb565" 520 | --- 521 | ---RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp). 522 | --- 523 | ---| "rgb10a2" 524 | --- 525 | ---Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024]. 526 | --- 527 | ---| "rg11b10f" 528 | --- 529 | ---No depth buffer and 8-bit stencil buffer. 530 | --- 531 | ---| "stencil8" 532 | --- 533 | ---16-bit depth buffer and no stencil buffer. 534 | --- 535 | ---| "depth16" 536 | --- 537 | ---24-bit depth buffer and no stencil buffer. 538 | --- 539 | ---| "depth24" 540 | --- 541 | ---32-bit float depth buffer and no stencil buffer. 542 | --- 543 | ---| "depth32f" 544 | --- 545 | ---24-bit depth buffer and 8-bit stencil buffer. 546 | --- 547 | ---| "depth24stencil8" 548 | --- 549 | ---32-bit float depth buffer and 8-bit stencil buffer. 550 | --- 551 | ---| "depth32fstencil8" 552 | --- 553 | ---The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems. 554 | --- 555 | ---| "DXT1" 556 | --- 557 | ---The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format. 558 | --- 559 | ---| "DXT3" 560 | --- 561 | ---The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems. 562 | --- 563 | ---| "DXT5" 564 | --- 565 | ---The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel. 566 | --- 567 | ---| "BC4" 568 | --- 569 | ---The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. 570 | --- 571 | ---| "BC4s" 572 | --- 573 | ---The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel. 574 | --- 575 | ---| "BC5" 576 | --- 577 | ---The signed variant of the BC5 format. 578 | --- 579 | ---| "BC5s" 580 | --- 581 | ---The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems. 582 | --- 583 | ---| "BC6h" 584 | --- 585 | ---The signed variant of the BC6H format. Stores RGB data in the range of +65504. 586 | --- 587 | ---| "BC6hs" 588 | --- 589 | ---The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel. 590 | --- 591 | ---| "BC7" 592 | --- 593 | ---The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices. 594 | --- 595 | ---| "ETC1" 596 | --- 597 | ---The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices. 598 | --- 599 | ---| "ETC2rgb" 600 | --- 601 | ---The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices. 602 | --- 603 | ---| "ETC2rgba" 604 | --- 605 | ---The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel. 606 | --- 607 | ---| "ETC2rgba1" 608 | --- 609 | ---The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel. 610 | --- 611 | ---| "EACr" 612 | --- 613 | ---The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. 614 | --- 615 | ---| "EACrs" 616 | --- 617 | ---The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel. 618 | --- 619 | ---| "EACrg" 620 | --- 621 | ---The signed two-channel variant of the EAC format. 622 | --- 623 | ---| "EACrgs" 624 | --- 625 | ---The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized. 626 | --- 627 | ---| "PVR1rgb2" 628 | --- 629 | ---The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel. 630 | --- 631 | ---| "PVR1rgb4" 632 | --- 633 | ---The 2 bit per pixel RGBA variant of the PVRTC1 format. 634 | --- 635 | ---| "PVR1rgba2" 636 | --- 637 | ---The 4 bit per pixel RGBA variant of the PVRTC1 format. 638 | --- 639 | ---| "PVR1rgba4" 640 | --- 641 | ---The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel. 642 | --- 643 | ---| "ASTC4x4" 644 | --- 645 | ---The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel. 646 | --- 647 | ---| "ASTC5x4" 648 | --- 649 | ---The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel. 650 | --- 651 | ---| "ASTC5x5" 652 | --- 653 | ---The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel. 654 | --- 655 | ---| "ASTC6x5" 656 | --- 657 | ---The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel. 658 | --- 659 | ---| "ASTC6x6" 660 | --- 661 | ---The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel. 662 | --- 663 | ---| "ASTC8x5" 664 | --- 665 | ---The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel. 666 | --- 667 | ---| "ASTC8x6" 668 | --- 669 | ---The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel. 670 | --- 671 | ---| "ASTC8x8" 672 | --- 673 | ---The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel. 674 | --- 675 | ---| "ASTC10x5" 676 | --- 677 | ---The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel. 678 | --- 679 | ---| "ASTC10x6" 680 | --- 681 | ---The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel. 682 | --- 683 | ---| "ASTC10x8" 684 | --- 685 | ---The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel. 686 | --- 687 | ---| "ASTC10x10" 688 | --- 689 | ---The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel. 690 | --- 691 | ---| "ASTC12x10" 692 | --- 693 | ---The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel. 694 | --- 695 | ---| "ASTC12x12" 696 | -------------------------------------------------------------------------------- /library/love/filesystem.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to the user's filesystem. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem) 8 | --- 9 | ---@class love.filesystem 10 | love.filesystem = {} 11 | 12 | --- 13 | ---Append data to an existing file. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.append) 17 | --- 18 | ---@overload fun(name: string, data: love.Data, size?: number):boolean, string 19 | ---@param name string # The name (and path) of the file. 20 | ---@param data string # The string data to append to the file. 21 | ---@param size? number # How many bytes to write. 22 | ---@return boolean success # True if the operation was successful, or nil if there was an error. 23 | ---@return string errormsg # The error message on failure. 24 | function love.filesystem.append(name, data, size) end 25 | 26 | --- 27 | ---Gets whether love.filesystem follows symbolic links. 28 | --- 29 | --- 30 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.areSymlinksEnabled) 31 | --- 32 | ---@return boolean enable # Whether love.filesystem follows symbolic links. 33 | function love.filesystem.areSymlinksEnabled() end 34 | 35 | --- 36 | ---Recursively creates a directory. 37 | --- 38 | ---When called with 'a/b' it creates both 'a' and 'a/b', if they don't exist already. 39 | --- 40 | --- 41 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.createDirectory) 42 | --- 43 | ---@param name string # The directory to create. 44 | ---@return boolean success # True if the directory was created, false if not. 45 | function love.filesystem.createDirectory(name) end 46 | 47 | --- 48 | ---Returns the application data directory (could be the same as getUserDirectory) 49 | --- 50 | --- 51 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getAppdataDirectory) 52 | --- 53 | ---@return string path # The path of the application data directory 54 | function love.filesystem.getAppdataDirectory() end 55 | 56 | --- 57 | ---Gets the filesystem paths that will be searched for c libraries when require is called. 58 | --- 59 | ---The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) Additionally, any occurrence of a double question mark ('??') will be replaced by the name passed to require and the default library extension for the platform. 60 | --- 61 | ---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. 62 | --- 63 | --- 64 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getCRequirePath) 65 | --- 66 | ---@return string paths # The paths that the ''require'' function will check for c libraries in love's filesystem. 67 | function love.filesystem.getCRequirePath() end 68 | 69 | --- 70 | ---Returns a table with the names of files and subdirectories in the specified path. The table is not sorted in any way; the order is undefined. 71 | --- 72 | ---If the path passed to the function exists in the game and the save directory, it will list the files and directories from both places. 73 | --- 74 | --- 75 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getDirectoryItems) 76 | --- 77 | ---@overload fun(dir: string, callback: function):table 78 | ---@param dir string # The directory. 79 | ---@return string[] files # A sequence with the names of all files and subdirectories as strings. 80 | function love.filesystem.getDirectoryItems(dir) end 81 | 82 | --- 83 | ---Gets the write directory name for your game. 84 | --- 85 | ---Note that this only returns the name of the folder to store your files in, not the full path. 86 | --- 87 | --- 88 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getIdentity) 89 | --- 90 | ---@return string name # The identity that is used as write directory. 91 | function love.filesystem.getIdentity() end 92 | 93 | --- 94 | ---Gets information about the specified file or directory. 95 | --- 96 | --- 97 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getInfo) 98 | --- 99 | ---@overload fun(path: string, info: table):table 100 | ---@overload fun(path: string, filtertype: love.FileType, info: table):table 101 | ---@param path string # The file or directory path to check. 102 | ---@param filtertype? love.FileType # If supplied, this parameter causes getInfo to only return the info table if the item at the given path matches the specified file type. 103 | ---@return {type: love.FileType, size: number, modtime: number} info # A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields: 104 | function love.filesystem.getInfo(path, filtertype) end 105 | 106 | --- 107 | ---Gets the platform-specific absolute path of the directory containing a filepath. 108 | --- 109 | ---This can be used to determine whether a file is inside the save directory or the game's source .love. 110 | --- 111 | --- 112 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getRealDirectory) 113 | --- 114 | ---@param filepath string # The filepath to get the directory of. 115 | ---@return string realdir # The platform-specific full path of the directory containing the filepath. 116 | function love.filesystem.getRealDirectory(filepath) end 117 | 118 | --- 119 | ---Gets the filesystem paths that will be searched when require is called. 120 | --- 121 | ---The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) 122 | --- 123 | ---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. 124 | --- 125 | --- 126 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getRequirePath) 127 | --- 128 | ---@return string paths # The paths that the ''require'' function will check in love's filesystem. 129 | function love.filesystem.getRequirePath() end 130 | 131 | --- 132 | ---Gets the full path to the designated save directory. 133 | --- 134 | ---This can be useful if you want to use the standard io library (or something else) to 135 | --- 136 | ---read or write in the save directory. 137 | --- 138 | --- 139 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getSaveDirectory) 140 | --- 141 | ---@return string dir # The absolute path to the save directory. 142 | function love.filesystem.getSaveDirectory() end 143 | 144 | --- 145 | ---Returns the full path to the the .love file or directory. If the game is fused to the LÖVE executable, then the executable is returned. 146 | --- 147 | --- 148 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getSource) 149 | --- 150 | ---@return string path # The full platform-dependent path of the .love file or directory. 151 | function love.filesystem.getSource() end 152 | 153 | --- 154 | ---Returns the full path to the directory containing the .love file. If the game is fused to the LÖVE executable, then the directory containing the executable is returned. 155 | --- 156 | ---If love.filesystem.isFused is true, the path returned by this function can be passed to love.filesystem.mount, which will make the directory containing the main game (e.g. C:\Program Files\coolgame\) readable by love.filesystem. 157 | --- 158 | --- 159 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getSourceBaseDirectory) 160 | --- 161 | ---@return string path # The full platform-dependent path of the directory containing the .love file. 162 | function love.filesystem.getSourceBaseDirectory() end 163 | 164 | --- 165 | ---Returns the path of the user's directory 166 | --- 167 | --- 168 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getUserDirectory) 169 | --- 170 | ---@return string path # The path of the user's directory 171 | function love.filesystem.getUserDirectory() end 172 | 173 | --- 174 | ---Gets the current working directory. 175 | --- 176 | --- 177 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.getWorkingDirectory) 178 | --- 179 | ---@return string cwd # The current working directory. 180 | function love.filesystem.getWorkingDirectory() end 181 | 182 | --- 183 | ---Initializes love.filesystem, will be called internally, so should not be used explicitly. 184 | --- 185 | --- 186 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.init) 187 | --- 188 | ---@param appname string # The name of the application binary, typically love. 189 | function love.filesystem.init(appname) end 190 | 191 | --- 192 | ---Gets whether the game is in fused mode or not. 193 | --- 194 | ---If a game is in fused mode, its save directory will be directly in the Appdata directory instead of Appdata/LOVE/. The game will also be able to load C Lua dynamic libraries which are located in the save directory. 195 | --- 196 | ---A game is in fused mode if the source .love has been fused to the executable (see Game Distribution), or if '--fused' has been given as a command-line argument when starting the game. 197 | --- 198 | --- 199 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.isFused) 200 | --- 201 | ---@return boolean fused # True if the game is in fused mode, false otherwise. 202 | function love.filesystem.isFused() end 203 | 204 | --- 205 | ---Iterate over the lines in a file. 206 | --- 207 | --- 208 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.lines) 209 | --- 210 | ---@param name string # The name (and path) of the file 211 | ---@return function iterator # A function that iterates over all the lines in the file 212 | function love.filesystem.lines(name) end 213 | 214 | --- 215 | ---Loads a Lua file (but does not run it). 216 | --- 217 | --- 218 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.load) 219 | --- 220 | ---@param name string # The name (and path) of the file. 221 | ---@return function chunk # The loaded chunk. 222 | ---@return string errormsg # The error message if file could not be opened. 223 | function love.filesystem.load(name) end 224 | 225 | --- 226 | ---Mounts a zip file or folder in the game's save directory for reading. 227 | --- 228 | ---It is also possible to mount love.filesystem.getSourceBaseDirectory if the game is in fused mode. 229 | --- 230 | --- 231 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.mount) 232 | --- 233 | ---@overload fun(filedata: love.FileData, mountpoint: string, appendToPath?: boolean):boolean 234 | ---@overload fun(data: love.Data, archivename: string, mountpoint: string, appendToPath?: boolean):boolean 235 | ---@param archive string # The folder or zip file in the game's save directory to mount. 236 | ---@param mountpoint string # The new path the archive will be mounted to. 237 | ---@param appendToPath? boolean # Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories. 238 | ---@return boolean success # True if the archive was successfully mounted, false otherwise. 239 | function love.filesystem.mount(archive, mountpoint, appendToPath) end 240 | 241 | --- 242 | ---Creates a new File object. 243 | --- 244 | ---It needs to be opened before it can be accessed. 245 | --- 246 | --- 247 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.newFile) 248 | --- 249 | ---@overload fun(filename: string, mode: love.FileMode):love.File, string 250 | ---@param filename string # The filename of the file. 251 | ---@return love.File file # The new File object. 252 | function love.filesystem.newFile(filename) end 253 | 254 | --- 255 | ---Creates a new FileData object from a file on disk, or from a string in memory. 256 | --- 257 | --- 258 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.newFileData) 259 | --- 260 | ---@overload fun(originaldata: love.Data, name: string):love.FileData 261 | ---@overload fun(filepath: string):love.FileData, string 262 | ---@param contents string # The contents of the file in memory represented as a string. 263 | ---@param name string # The name of the file. The extension may be parsed and used by LÖVE when passing the FileData object into love.audio.newSource. 264 | ---@return love.FileData data # The new FileData. 265 | function love.filesystem.newFileData(contents, name) end 266 | 267 | --- 268 | ---Read the contents of a file. 269 | --- 270 | --- 271 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.read) 272 | --- 273 | ---@overload fun(container: love.ContainerType, name: string, size?: number):love.FileData|string, number, nil, string 274 | ---@param name string # The name (and path) of the file. 275 | ---@param size? number # How many bytes to read. 276 | ---@return string contents # The file contents. 277 | ---@return number size # How many bytes have been read. 278 | ---@return nil contents # returns nil as content. 279 | ---@return string error # returns an error message. 280 | function love.filesystem.read(name, size) end 281 | 282 | --- 283 | ---Removes a file or empty directory. 284 | --- 285 | --- 286 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.remove) 287 | --- 288 | ---@param name string # The file or directory to remove. 289 | ---@return boolean success # True if the file/directory was removed, false otherwise. 290 | function love.filesystem.remove(name) end 291 | 292 | --- 293 | ---Sets the filesystem paths that will be searched for c libraries when require is called. 294 | --- 295 | ---The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) Additionally, any occurrence of a double question mark ('??') will be replaced by the name passed to require and the default library extension for the platform. 296 | --- 297 | ---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. 298 | --- 299 | --- 300 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.setCRequirePath) 301 | --- 302 | ---@param paths string # The paths that the ''require'' function will check in love's filesystem. 303 | function love.filesystem.setCRequirePath(paths) end 304 | 305 | --- 306 | ---Sets the write directory for your game. 307 | --- 308 | ---Note that you can only set the name of the folder to store your files in, not the location. 309 | --- 310 | --- 311 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.setIdentity) 312 | --- 313 | ---@overload fun(name: string) 314 | ---@param name string # The new identity that will be used as write directory. 315 | function love.filesystem.setIdentity(name) end 316 | 317 | --- 318 | ---Sets the filesystem paths that will be searched when require is called. 319 | --- 320 | ---The paths string given to this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) 321 | --- 322 | ---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. 323 | --- 324 | --- 325 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.setRequirePath) 326 | --- 327 | ---@param paths string # The paths that the ''require'' function will check in love's filesystem. 328 | function love.filesystem.setRequirePath(paths) end 329 | 330 | --- 331 | ---Sets the source of the game, where the code is present. This function can only be called once, and is normally automatically done by LÖVE. 332 | --- 333 | --- 334 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.setSource) 335 | --- 336 | ---@param path string # Absolute path to the game's source folder. 337 | function love.filesystem.setSource(path) end 338 | 339 | --- 340 | ---Sets whether love.filesystem follows symbolic links. It is enabled by default in version 0.10.0 and newer, and disabled by default in 0.9.2. 341 | --- 342 | --- 343 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.setSymlinksEnabled) 344 | --- 345 | ---@param enable boolean # Whether love.filesystem should follow symbolic links. 346 | function love.filesystem.setSymlinksEnabled(enable) end 347 | 348 | --- 349 | ---Unmounts a zip file or folder previously mounted for reading with love.filesystem.mount. 350 | --- 351 | --- 352 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.unmount) 353 | --- 354 | ---@param archive string # The folder or zip file in the game's save directory which is currently mounted. 355 | ---@return boolean success # True if the archive was successfully unmounted, false otherwise. 356 | function love.filesystem.unmount(archive) end 357 | 358 | --- 359 | ---Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents. 360 | --- 361 | --- 362 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem.write) 363 | --- 364 | ---@overload fun(name: string, data: love.Data, size?: number):boolean, string 365 | ---@param name string # The name (and path) of the file. 366 | ---@param data string # The string data to write to the file. 367 | ---@param size? number # How many bytes to write. 368 | ---@return boolean success # If the operation was successful. 369 | ---@return string message # Error message if operation was unsuccessful. 370 | function love.filesystem.write(name, data, size) end 371 | 372 | --- 373 | ---Represents a file dropped onto the window. 374 | --- 375 | ---Note that the DroppedFile type can only be obtained from love.filedropped callback, and can't be constructed manually by the user. 376 | --- 377 | --- 378 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem) 379 | --- 380 | ---@class love.DroppedFile: love.File, love.Object 381 | local DroppedFile = {} 382 | 383 | --- 384 | ---Represents a file on the filesystem. A function that takes a file path can also take a File. 385 | --- 386 | --- 387 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem) 388 | --- 389 | ---@class love.File: love.Object 390 | local File = {} 391 | 392 | --- 393 | ---Closes a File. 394 | --- 395 | --- 396 | ---[Open in Browser](https://love2d.org/wiki/File:close) 397 | --- 398 | ---@return boolean success # Whether closing was successful. 399 | function File:close() end 400 | 401 | --- 402 | ---Flushes any buffered written data in the file to the disk. 403 | --- 404 | --- 405 | ---[Open in Browser](https://love2d.org/wiki/File:flush) 406 | --- 407 | ---@return boolean success # Whether the file successfully flushed any buffered data to the disk. 408 | ---@return string err # The error string, if an error occurred and the file could not be flushed. 409 | function File:flush() end 410 | 411 | --- 412 | ---Gets the buffer mode of a file. 413 | --- 414 | --- 415 | ---[Open in Browser](https://love2d.org/wiki/File:getBuffer) 416 | --- 417 | ---@return love.BufferMode mode # The current buffer mode of the file. 418 | ---@return number size # The maximum size in bytes of the file's buffer. 419 | function File:getBuffer() end 420 | 421 | --- 422 | ---Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path. 423 | --- 424 | --- 425 | ---[Open in Browser](https://love2d.org/wiki/File:getFilename) 426 | --- 427 | ---@return string filename # The filename of the File. 428 | function File:getFilename() end 429 | 430 | --- 431 | ---Gets the FileMode the file has been opened with. 432 | --- 433 | --- 434 | ---[Open in Browser](https://love2d.org/wiki/File:getMode) 435 | --- 436 | ---@return love.FileMode mode # The mode this file has been opened with. 437 | function File:getMode() end 438 | 439 | --- 440 | ---Returns the file size. 441 | --- 442 | --- 443 | ---[Open in Browser](https://love2d.org/wiki/File:getSize) 444 | --- 445 | ---@return number size # The file size in bytes. 446 | function File:getSize() end 447 | 448 | --- 449 | ---Gets whether end-of-file has been reached. 450 | --- 451 | --- 452 | ---[Open in Browser](https://love2d.org/wiki/File:isEOF) 453 | --- 454 | ---@return boolean eof # Whether EOF has been reached. 455 | function File:isEOF() end 456 | 457 | --- 458 | ---Gets whether the file is open. 459 | --- 460 | --- 461 | ---[Open in Browser](https://love2d.org/wiki/File:isOpen) 462 | --- 463 | ---@return boolean open # True if the file is currently open, false otherwise. 464 | function File:isOpen() end 465 | 466 | --- 467 | ---Iterate over all the lines in a file. 468 | --- 469 | --- 470 | ---[Open in Browser](https://love2d.org/wiki/File:lines) 471 | --- 472 | ---@return function iterator # The iterator (can be used in for loops). 473 | function File:lines() end 474 | 475 | --- 476 | ---Open the file for write, read or append. 477 | --- 478 | --- 479 | ---[Open in Browser](https://love2d.org/wiki/File:open) 480 | --- 481 | ---@param mode love.FileMode # The mode to open the file in. 482 | ---@return boolean ok # True on success, false otherwise. 483 | ---@return string err # The error string if an error occurred. 484 | function File:open(mode) end 485 | 486 | --- 487 | ---Read a number of bytes from a file. 488 | --- 489 | --- 490 | ---[Open in Browser](https://love2d.org/wiki/File:read) 491 | --- 492 | ---@overload fun(self: love.File, container: love.ContainerType, bytes?: number):love.FileData|string, number 493 | ---@param bytes? number # The number of bytes to read. 494 | ---@return string contents # The contents of the read bytes. 495 | ---@return number size # How many bytes have been read. 496 | function File:read(bytes) end 497 | 498 | --- 499 | ---Seek to a position in a file 500 | --- 501 | --- 502 | ---[Open in Browser](https://love2d.org/wiki/File:seek) 503 | --- 504 | ---@param pos number # The position to seek to 505 | ---@return boolean success # Whether the operation was successful 506 | function File:seek(pos) end 507 | 508 | --- 509 | ---Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode. 510 | --- 511 | ---File:flush will force any buffered data to be written to the disk. 512 | --- 513 | --- 514 | ---[Open in Browser](https://love2d.org/wiki/File:setBuffer) 515 | --- 516 | ---@param mode love.BufferMode # The buffer mode to use. 517 | ---@param size? number # The maximum size in bytes of the file's buffer. 518 | ---@return boolean success # Whether the buffer mode was successfully set. 519 | ---@return string errorstr # The error string, if the buffer mode could not be set and an error occurred. 520 | function File:setBuffer(mode, size) end 521 | 522 | --- 523 | ---Returns the position in the file. 524 | --- 525 | --- 526 | ---[Open in Browser](https://love2d.org/wiki/File:tell) 527 | --- 528 | ---@return number pos # The current position. 529 | function File:tell() end 530 | 531 | --- 532 | ---Write data to a file. 533 | --- 534 | --- 535 | ---[Open in Browser](https://love2d.org/wiki/File:write) 536 | --- 537 | ---@overload fun(self: love.File, data: love.Data, size?: number):boolean, string 538 | ---@param data string # The string data to write. 539 | ---@param size? number # How many bytes to write. 540 | ---@return boolean success # Whether the operation was successful. 541 | ---@return string err # The error string if an error occurred. 542 | function File:write(data, size) end 543 | 544 | --- 545 | ---Data representing the contents of a file. 546 | --- 547 | --- 548 | ---[Open in Browser](https://love2d.org/wiki/love.filesystem) 549 | --- 550 | ---@class love.FileData: love.Data, love.Object 551 | local FileData = {} 552 | 553 | --- 554 | ---Gets the extension of the FileData. 555 | --- 556 | --- 557 | ---[Open in Browser](https://love2d.org/wiki/FileData:getExtension) 558 | --- 559 | ---@return string ext # The extension of the file the FileData represents. 560 | function FileData:getExtension() end 561 | 562 | --- 563 | ---Gets the filename of the FileData. 564 | --- 565 | --- 566 | ---[Open in Browser](https://love2d.org/wiki/FileData:getFilename) 567 | --- 568 | ---@return string name # The name of the file the FileData represents. 569 | function FileData:getFilename() end 570 | 571 | --- 572 | ---Buffer modes for File objects. 573 | --- 574 | --- 575 | ---[Open in Browser](https://love2d.org/wiki/BufferMode) 576 | --- 577 | ---@alias love.BufferMode 578 | --- 579 | ---No buffering. The result of write and append operations appears immediately. 580 | --- 581 | ---| "none" 582 | --- 583 | ---Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached. 584 | --- 585 | ---| "line" 586 | --- 587 | ---Full buffering. Write and append operations are always buffered until the buffer size limit is reached. 588 | --- 589 | ---| "full" 590 | 591 | --- 592 | ---How to decode a given FileData. 593 | --- 594 | --- 595 | ---[Open in Browser](https://love2d.org/wiki/FileDecoder) 596 | --- 597 | ---@alias love.FileDecoder 598 | --- 599 | ---The data is unencoded. 600 | --- 601 | ---| "file" 602 | --- 603 | ---The data is base64-encoded. 604 | --- 605 | ---| "base64" 606 | 607 | --- 608 | ---The different modes you can open a File in. 609 | --- 610 | --- 611 | ---[Open in Browser](https://love2d.org/wiki/FileMode) 612 | --- 613 | ---@alias love.FileMode 614 | --- 615 | ---Open a file for read. 616 | --- 617 | ---| "r" 618 | --- 619 | ---Open a file for write. 620 | --- 621 | ---| "w" 622 | --- 623 | ---Open a file for append. 624 | --- 625 | ---| "a" 626 | --- 627 | ---Do not open a file (represents a closed file.) 628 | --- 629 | ---| "c" 630 | 631 | --- 632 | ---The type of a file. 633 | --- 634 | --- 635 | ---[Open in Browser](https://love2d.org/wiki/FileType) 636 | --- 637 | ---@alias love.FileType 638 | --- 639 | ---Regular file. 640 | --- 641 | ---| "file" 642 | --- 643 | ---Directory. 644 | --- 645 | ---| "directory" 646 | --- 647 | ---Symbolic link. 648 | --- 649 | ---| "symlink" 650 | --- 651 | ---Something completely different like a device. 652 | --- 653 | ---| "other" 654 | -------------------------------------------------------------------------------- /library/love/keyboard.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides an interface to the user's keyboard. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard) 8 | --- 9 | ---@class love.keyboard 10 | love.keyboard = {} 11 | 12 | --- 13 | ---Gets the key corresponding to the given hardware scancode. 14 | --- 15 | ---Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. 16 | --- 17 | ---Scancodes are useful for creating default controls that have the same physical locations on on all systems. 18 | --- 19 | --- 20 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.getKeyFromScancode) 21 | --- 22 | ---@param scancode love.Scancode # The scancode to get the key from. 23 | ---@return love.KeyConstant key # The key corresponding to the given scancode, or 'unknown' if the scancode doesn't map to a KeyConstant on the current system. 24 | function love.keyboard.getKeyFromScancode(scancode) end 25 | 26 | --- 27 | ---Gets the hardware scancode corresponding to the given key. 28 | --- 29 | ---Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. 30 | --- 31 | ---Scancodes are useful for creating default controls that have the same physical locations on on all systems. 32 | --- 33 | --- 34 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.getScancodeFromKey) 35 | --- 36 | ---@param key love.KeyConstant # The key to get the scancode from. 37 | ---@return love.Scancode scancode # The scancode corresponding to the given key, or 'unknown' if the given key has no known physical representation on the current system. 38 | function love.keyboard.getScancodeFromKey(key) end 39 | 40 | --- 41 | ---Gets whether key repeat is enabled. 42 | --- 43 | --- 44 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.hasKeyRepeat) 45 | --- 46 | ---@return boolean enabled # Whether key repeat is enabled. 47 | function love.keyboard.hasKeyRepeat() end 48 | 49 | --- 50 | ---Gets whether screen keyboard is supported. 51 | --- 52 | --- 53 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.hasScreenKeyboard) 54 | --- 55 | ---@return boolean supported # Whether screen keyboard is supported. 56 | function love.keyboard.hasScreenKeyboard() end 57 | 58 | --- 59 | ---Gets whether text input events are enabled. 60 | --- 61 | --- 62 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.hasTextInput) 63 | --- 64 | ---@return boolean enabled # Whether text input events are enabled. 65 | function love.keyboard.hasTextInput() end 66 | 67 | --- 68 | ---Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased. 69 | --- 70 | --- 71 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.isDown) 72 | --- 73 | ---@overload fun(key: love.KeyConstant, ...):boolean 74 | ---@param key love.KeyConstant # The key to check. 75 | ---@return boolean down # True if the key is down, false if not. 76 | function love.keyboard.isDown(key) end 77 | 78 | --- 79 | ---Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased. 80 | --- 81 | ---Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode 'w' is used if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. 82 | --- 83 | --- 84 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.isScancodeDown) 85 | --- 86 | ---@param scancode love.Scancode # A Scancode to check. 87 | ---@vararg love.Scancode # Additional Scancodes to check. 88 | ---@return boolean down # True if any supplied Scancode is down, false if not. 89 | function love.keyboard.isScancodeDown(scancode, ...) end 90 | 91 | --- 92 | ---Enables or disables key repeat for love.keypressed. It is disabled by default. 93 | --- 94 | --- 95 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.setKeyRepeat) 96 | --- 97 | ---@param enable boolean # Whether repeat keypress events should be enabled when a key is held down. 98 | function love.keyboard.setKeyRepeat(enable) end 99 | 100 | --- 101 | ---Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android. 102 | --- 103 | ---On touch devices, this shows the system's native on-screen keyboard when it's enabled. 104 | --- 105 | --- 106 | ---[Open in Browser](https://love2d.org/wiki/love.keyboard.setTextInput) 107 | --- 108 | ---@overload fun(enable: boolean, x: number, y: number, w: number, h: number) 109 | ---@param enable boolean # Whether text input events should be enabled. 110 | function love.keyboard.setTextInput(enable) end 111 | 112 | --- 113 | ---All the keys you can press. Note that some keys may not be available on your keyboard or system. 114 | --- 115 | --- 116 | ---[Open in Browser](https://love2d.org/wiki/KeyConstant) 117 | --- 118 | ---@alias love.KeyConstant 119 | --- 120 | ---The A key 121 | --- 122 | ---| "a" 123 | --- 124 | ---The B key 125 | --- 126 | ---| "b" 127 | --- 128 | ---The C key 129 | --- 130 | ---| "c" 131 | --- 132 | ---The D key 133 | --- 134 | ---| "d" 135 | --- 136 | ---The E key 137 | --- 138 | ---| "e" 139 | --- 140 | ---The F key 141 | --- 142 | ---| "f" 143 | --- 144 | ---The G key 145 | --- 146 | ---| "g" 147 | --- 148 | ---The H key 149 | --- 150 | ---| "h" 151 | --- 152 | ---The I key 153 | --- 154 | ---| "i" 155 | --- 156 | ---The J key 157 | --- 158 | ---| "j" 159 | --- 160 | ---The K key 161 | --- 162 | ---| "k" 163 | --- 164 | ---The L key 165 | --- 166 | ---| "l" 167 | --- 168 | ---The M key 169 | --- 170 | ---| "m" 171 | --- 172 | ---The N key 173 | --- 174 | ---| "n" 175 | --- 176 | ---The O key 177 | --- 178 | ---| "o" 179 | --- 180 | ---The P key 181 | --- 182 | ---| "p" 183 | --- 184 | ---The Q key 185 | --- 186 | ---| "q" 187 | --- 188 | ---The R key 189 | --- 190 | ---| "r" 191 | --- 192 | ---The S key 193 | --- 194 | ---| "s" 195 | --- 196 | ---The T key 197 | --- 198 | ---| "t" 199 | --- 200 | ---The U key 201 | --- 202 | ---| "u" 203 | --- 204 | ---The V key 205 | --- 206 | ---| "v" 207 | --- 208 | ---The W key 209 | --- 210 | ---| "w" 211 | --- 212 | ---The X key 213 | --- 214 | ---| "x" 215 | --- 216 | ---The Y key 217 | --- 218 | ---| "y" 219 | --- 220 | ---The Z key 221 | --- 222 | ---| "z" 223 | --- 224 | ---The zero key 225 | --- 226 | ---| "0" 227 | --- 228 | ---The one key 229 | --- 230 | ---| "1" 231 | --- 232 | ---The two key 233 | --- 234 | ---| "2" 235 | --- 236 | ---The three key 237 | --- 238 | ---| "3" 239 | --- 240 | ---The four key 241 | --- 242 | ---| "4" 243 | --- 244 | ---The five key 245 | --- 246 | ---| "5" 247 | --- 248 | ---The six key 249 | --- 250 | ---| "6" 251 | --- 252 | ---The seven key 253 | --- 254 | ---| "7" 255 | --- 256 | ---The eight key 257 | --- 258 | ---| "8" 259 | --- 260 | ---The nine key 261 | --- 262 | ---| "9" 263 | --- 264 | ---Space key 265 | --- 266 | ---| "space" 267 | --- 268 | ---Exclamation mark key 269 | --- 270 | ---| "!" 271 | --- 272 | ---Double quote key 273 | --- 274 | ---| "\"" 275 | --- 276 | ---Hash key 277 | --- 278 | ---| "#" 279 | --- 280 | ---Dollar key 281 | --- 282 | ---| "$" 283 | --- 284 | ---Ampersand key 285 | --- 286 | ---| "&" 287 | --- 288 | ---Single quote key 289 | --- 290 | ---| "'" 291 | --- 292 | ---Left parenthesis key 293 | --- 294 | ---| "(" 295 | --- 296 | ---Right parenthesis key 297 | --- 298 | ---| ")" 299 | --- 300 | ---Asterisk key 301 | --- 302 | ---| "*" 303 | --- 304 | ---Plus key 305 | --- 306 | ---| "+" 307 | --- 308 | ---Comma key 309 | --- 310 | ---| "," 311 | --- 312 | ---Hyphen-minus key 313 | --- 314 | ---| "-" 315 | --- 316 | ---Full stop key 317 | --- 318 | ---| "." 319 | --- 320 | ---Slash key 321 | --- 322 | ---| "/" 323 | --- 324 | ---Colon key 325 | --- 326 | ---| ":" 327 | --- 328 | ---Semicolon key 329 | --- 330 | ---| ";" 331 | --- 332 | ---Less-than key 333 | --- 334 | ---| "<" 335 | --- 336 | ---Equal key 337 | --- 338 | ---| "=" 339 | --- 340 | ---Greater-than key 341 | --- 342 | ---| ">" 343 | --- 344 | ---Question mark key 345 | --- 346 | ---| "?" 347 | --- 348 | ---At sign key 349 | --- 350 | ---| "@" 351 | --- 352 | ---Left square bracket key 353 | --- 354 | ---| "[" 355 | --- 356 | ---Backslash key 357 | --- 358 | ---| "\\" 359 | --- 360 | ---Right square bracket key 361 | --- 362 | ---| "]" 363 | --- 364 | ---Caret key 365 | --- 366 | ---| "^" 367 | --- 368 | ---Underscore key 369 | --- 370 | ---| "_" 371 | --- 372 | ---Grave accent key 373 | --- 374 | ---| "`" 375 | --- 376 | ---The numpad zero key 377 | --- 378 | ---| "kp0" 379 | --- 380 | ---The numpad one key 381 | --- 382 | ---| "kp1" 383 | --- 384 | ---The numpad two key 385 | --- 386 | ---| "kp2" 387 | --- 388 | ---The numpad three key 389 | --- 390 | ---| "kp3" 391 | --- 392 | ---The numpad four key 393 | --- 394 | ---| "kp4" 395 | --- 396 | ---The numpad five key 397 | --- 398 | ---| "kp5" 399 | --- 400 | ---The numpad six key 401 | --- 402 | ---| "kp6" 403 | --- 404 | ---The numpad seven key 405 | --- 406 | ---| "kp7" 407 | --- 408 | ---The numpad eight key 409 | --- 410 | ---| "kp8" 411 | --- 412 | ---The numpad nine key 413 | --- 414 | ---| "kp9" 415 | --- 416 | ---The numpad decimal point key 417 | --- 418 | ---| "kp." 419 | --- 420 | ---The numpad division key 421 | --- 422 | ---| "kp/" 423 | --- 424 | ---The numpad multiplication key 425 | --- 426 | ---| "kp*" 427 | --- 428 | ---The numpad substraction key 429 | --- 430 | ---| "kp-" 431 | --- 432 | ---The numpad addition key 433 | --- 434 | ---| "kp+" 435 | --- 436 | ---The numpad enter key 437 | --- 438 | ---| "kpenter" 439 | --- 440 | ---The numpad equals key 441 | --- 442 | ---| "kp=" 443 | --- 444 | ---Up cursor key 445 | --- 446 | ---| "up" 447 | --- 448 | ---Down cursor key 449 | --- 450 | ---| "down" 451 | --- 452 | ---Right cursor key 453 | --- 454 | ---| "right" 455 | --- 456 | ---Left cursor key 457 | --- 458 | ---| "left" 459 | --- 460 | ---Home key 461 | --- 462 | ---| "home" 463 | --- 464 | ---End key 465 | --- 466 | ---| "end" 467 | --- 468 | ---Page up key 469 | --- 470 | ---| "pageup" 471 | --- 472 | ---Page down key 473 | --- 474 | ---| "pagedown" 475 | --- 476 | ---Insert key 477 | --- 478 | ---| "insert" 479 | --- 480 | ---Backspace key 481 | --- 482 | ---| "backspace" 483 | --- 484 | ---Tab key 485 | --- 486 | ---| "tab" 487 | --- 488 | ---Clear key 489 | --- 490 | ---| "clear" 491 | --- 492 | ---Return key 493 | --- 494 | ---| "return" 495 | --- 496 | ---Delete key 497 | --- 498 | ---| "delete" 499 | --- 500 | ---The 1st function key 501 | --- 502 | ---| "f1" 503 | --- 504 | ---The 2nd function key 505 | --- 506 | ---| "f2" 507 | --- 508 | ---The 3rd function key 509 | --- 510 | ---| "f3" 511 | --- 512 | ---The 4th function key 513 | --- 514 | ---| "f4" 515 | --- 516 | ---The 5th function key 517 | --- 518 | ---| "f5" 519 | --- 520 | ---The 6th function key 521 | --- 522 | ---| "f6" 523 | --- 524 | ---The 7th function key 525 | --- 526 | ---| "f7" 527 | --- 528 | ---The 8th function key 529 | --- 530 | ---| "f8" 531 | --- 532 | ---The 9th function key 533 | --- 534 | ---| "f9" 535 | --- 536 | ---The 10th function key 537 | --- 538 | ---| "f10" 539 | --- 540 | ---The 11th function key 541 | --- 542 | ---| "f11" 543 | --- 544 | ---The 12th function key 545 | --- 546 | ---| "f12" 547 | --- 548 | ---The 13th function key 549 | --- 550 | ---| "f13" 551 | --- 552 | ---The 14th function key 553 | --- 554 | ---| "f14" 555 | --- 556 | ---The 15th function key 557 | --- 558 | ---| "f15" 559 | --- 560 | ---Num-lock key 561 | --- 562 | ---| "numlock" 563 | --- 564 | ---Caps-lock key 565 | --- 566 | ---| "capslock" 567 | --- 568 | ---Scroll-lock key 569 | --- 570 | ---| "scrollock" 571 | --- 572 | ---Right shift key 573 | --- 574 | ---| "rshift" 575 | --- 576 | ---Left shift key 577 | --- 578 | ---| "lshift" 579 | --- 580 | ---Right control key 581 | --- 582 | ---| "rctrl" 583 | --- 584 | ---Left control key 585 | --- 586 | ---| "lctrl" 587 | --- 588 | ---Right alt key 589 | --- 590 | ---| "ralt" 591 | --- 592 | ---Left alt key 593 | --- 594 | ---| "lalt" 595 | --- 596 | ---Right meta key 597 | --- 598 | ---| "rmeta" 599 | --- 600 | ---Left meta key 601 | --- 602 | ---| "lmeta" 603 | --- 604 | ---Left super key 605 | --- 606 | ---| "lsuper" 607 | --- 608 | ---Right super key 609 | --- 610 | ---| "rsuper" 611 | --- 612 | ---Mode key 613 | --- 614 | ---| "mode" 615 | --- 616 | ---Compose key 617 | --- 618 | ---| "compose" 619 | --- 620 | ---Pause key 621 | --- 622 | ---| "pause" 623 | --- 624 | ---Escape key 625 | --- 626 | ---| "escape" 627 | --- 628 | ---Help key 629 | --- 630 | ---| "help" 631 | --- 632 | ---Print key 633 | --- 634 | ---| "print" 635 | --- 636 | ---System request key 637 | --- 638 | ---| "sysreq" 639 | --- 640 | ---Break key 641 | --- 642 | ---| "break" 643 | --- 644 | ---Menu key 645 | --- 646 | ---| "menu" 647 | --- 648 | ---Power key 649 | --- 650 | ---| "power" 651 | --- 652 | ---Euro (€) key 653 | --- 654 | ---| "euro" 655 | --- 656 | ---Undo key 657 | --- 658 | ---| "undo" 659 | --- 660 | ---WWW key 661 | --- 662 | ---| "www" 663 | --- 664 | ---Mail key 665 | --- 666 | ---| "mail" 667 | --- 668 | ---Calculator key 669 | --- 670 | ---| "calculator" 671 | --- 672 | ---Application search key 673 | --- 674 | ---| "appsearch" 675 | --- 676 | ---Application home key 677 | --- 678 | ---| "apphome" 679 | --- 680 | ---Application back key 681 | --- 682 | ---| "appback" 683 | --- 684 | ---Application forward key 685 | --- 686 | ---| "appforward" 687 | --- 688 | ---Application refresh key 689 | --- 690 | ---| "apprefresh" 691 | --- 692 | ---Application bookmarks key 693 | --- 694 | ---| "appbookmarks" 695 | 696 | --- 697 | ---Keyboard scancodes. 698 | --- 699 | ---Scancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. 700 | --- 701 | ---Using scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate 'unknown' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support. 702 | --- 703 | ---One could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can't get modifiers on their own from it, only the final symbols that were generated. 704 | --- 705 | --- 706 | ---[Open in Browser](https://love2d.org/wiki/Scancode) 707 | --- 708 | ---@alias love.Scancode 709 | --- 710 | ---The 'A' key on an American layout. 711 | --- 712 | ---| "a" 713 | --- 714 | ---The 'B' key on an American layout. 715 | --- 716 | ---| "b" 717 | --- 718 | ---The 'C' key on an American layout. 719 | --- 720 | ---| "c" 721 | --- 722 | ---The 'D' key on an American layout. 723 | --- 724 | ---| "d" 725 | --- 726 | ---The 'E' key on an American layout. 727 | --- 728 | ---| "e" 729 | --- 730 | ---The 'F' key on an American layout. 731 | --- 732 | ---| "f" 733 | --- 734 | ---The 'G' key on an American layout. 735 | --- 736 | ---| "g" 737 | --- 738 | ---The 'H' key on an American layout. 739 | --- 740 | ---| "h" 741 | --- 742 | ---The 'I' key on an American layout. 743 | --- 744 | ---| "i" 745 | --- 746 | ---The 'J' key on an American layout. 747 | --- 748 | ---| "j" 749 | --- 750 | ---The 'K' key on an American layout. 751 | --- 752 | ---| "k" 753 | --- 754 | ---The 'L' key on an American layout. 755 | --- 756 | ---| "l" 757 | --- 758 | ---The 'M' key on an American layout. 759 | --- 760 | ---| "m" 761 | --- 762 | ---The 'N' key on an American layout. 763 | --- 764 | ---| "n" 765 | --- 766 | ---The 'O' key on an American layout. 767 | --- 768 | ---| "o" 769 | --- 770 | ---The 'P' key on an American layout. 771 | --- 772 | ---| "p" 773 | --- 774 | ---The 'Q' key on an American layout. 775 | --- 776 | ---| "q" 777 | --- 778 | ---The 'R' key on an American layout. 779 | --- 780 | ---| "r" 781 | --- 782 | ---The 'S' key on an American layout. 783 | --- 784 | ---| "s" 785 | --- 786 | ---The 'T' key on an American layout. 787 | --- 788 | ---| "t" 789 | --- 790 | ---The 'U' key on an American layout. 791 | --- 792 | ---| "u" 793 | --- 794 | ---The 'V' key on an American layout. 795 | --- 796 | ---| "v" 797 | --- 798 | ---The 'W' key on an American layout. 799 | --- 800 | ---| "w" 801 | --- 802 | ---The 'X' key on an American layout. 803 | --- 804 | ---| "x" 805 | --- 806 | ---The 'Y' key on an American layout. 807 | --- 808 | ---| "y" 809 | --- 810 | ---The 'Z' key on an American layout. 811 | --- 812 | ---| "z" 813 | --- 814 | ---The '1' key on an American layout. 815 | --- 816 | ---| "1" 817 | --- 818 | ---The '2' key on an American layout. 819 | --- 820 | ---| "2" 821 | --- 822 | ---The '3' key on an American layout. 823 | --- 824 | ---| "3" 825 | --- 826 | ---The '4' key on an American layout. 827 | --- 828 | ---| "4" 829 | --- 830 | ---The '5' key on an American layout. 831 | --- 832 | ---| "5" 833 | --- 834 | ---The '6' key on an American layout. 835 | --- 836 | ---| "6" 837 | --- 838 | ---The '7' key on an American layout. 839 | --- 840 | ---| "7" 841 | --- 842 | ---The '8' key on an American layout. 843 | --- 844 | ---| "8" 845 | --- 846 | ---The '9' key on an American layout. 847 | --- 848 | ---| "9" 849 | --- 850 | ---The '0' key on an American layout. 851 | --- 852 | ---| "0" 853 | --- 854 | ---The 'return' / 'enter' key on an American layout. 855 | --- 856 | ---| "return" 857 | --- 858 | ---The 'escape' key on an American layout. 859 | --- 860 | ---| "escape" 861 | --- 862 | ---The 'backspace' key on an American layout. 863 | --- 864 | ---| "backspace" 865 | --- 866 | ---The 'tab' key on an American layout. 867 | --- 868 | ---| "tab" 869 | --- 870 | ---The spacebar on an American layout. 871 | --- 872 | ---| "space" 873 | --- 874 | ---The minus key on an American layout. 875 | --- 876 | ---| "-" 877 | --- 878 | ---The equals key on an American layout. 879 | --- 880 | ---| "=" 881 | --- 882 | ---The left-bracket key on an American layout. 883 | --- 884 | ---| "[" 885 | --- 886 | ---The right-bracket key on an American layout. 887 | --- 888 | ---| "]" 889 | --- 890 | ---The backslash key on an American layout. 891 | --- 892 | ---| "\\" 893 | --- 894 | ---The non-U.S. hash scancode. 895 | --- 896 | ---| "nonus#" 897 | --- 898 | ---The semicolon key on an American layout. 899 | --- 900 | ---| ";" 901 | --- 902 | ---The apostrophe key on an American layout. 903 | --- 904 | ---| "'" 905 | --- 906 | ---The back-tick / grave key on an American layout. 907 | --- 908 | ---| "`" 909 | --- 910 | ---The comma key on an American layout. 911 | --- 912 | ---| "," 913 | --- 914 | ---The period key on an American layout. 915 | --- 916 | ---| "." 917 | --- 918 | ---The forward-slash key on an American layout. 919 | --- 920 | ---| "/" 921 | --- 922 | ---The capslock key on an American layout. 923 | --- 924 | ---| "capslock" 925 | --- 926 | ---The F1 key on an American layout. 927 | --- 928 | ---| "f1" 929 | --- 930 | ---The F2 key on an American layout. 931 | --- 932 | ---| "f2" 933 | --- 934 | ---The F3 key on an American layout. 935 | --- 936 | ---| "f3" 937 | --- 938 | ---The F4 key on an American layout. 939 | --- 940 | ---| "f4" 941 | --- 942 | ---The F5 key on an American layout. 943 | --- 944 | ---| "f5" 945 | --- 946 | ---The F6 key on an American layout. 947 | --- 948 | ---| "f6" 949 | --- 950 | ---The F7 key on an American layout. 951 | --- 952 | ---| "f7" 953 | --- 954 | ---The F8 key on an American layout. 955 | --- 956 | ---| "f8" 957 | --- 958 | ---The F9 key on an American layout. 959 | --- 960 | ---| "f9" 961 | --- 962 | ---The F10 key on an American layout. 963 | --- 964 | ---| "f10" 965 | --- 966 | ---The F11 key on an American layout. 967 | --- 968 | ---| "f11" 969 | --- 970 | ---The F12 key on an American layout. 971 | --- 972 | ---| "f12" 973 | --- 974 | ---The F13 key on an American layout. 975 | --- 976 | ---| "f13" 977 | --- 978 | ---The F14 key on an American layout. 979 | --- 980 | ---| "f14" 981 | --- 982 | ---The F15 key on an American layout. 983 | --- 984 | ---| "f15" 985 | --- 986 | ---The F16 key on an American layout. 987 | --- 988 | ---| "f16" 989 | --- 990 | ---The F17 key on an American layout. 991 | --- 992 | ---| "f17" 993 | --- 994 | ---The F18 key on an American layout. 995 | --- 996 | ---| "f18" 997 | --- 998 | ---The F19 key on an American layout. 999 | --- 1000 | ---| "f19" 1001 | --- 1002 | ---The F20 key on an American layout. 1003 | --- 1004 | ---| "f20" 1005 | --- 1006 | ---The F21 key on an American layout. 1007 | --- 1008 | ---| "f21" 1009 | --- 1010 | ---The F22 key on an American layout. 1011 | --- 1012 | ---| "f22" 1013 | --- 1014 | ---The F23 key on an American layout. 1015 | --- 1016 | ---| "f23" 1017 | --- 1018 | ---The F24 key on an American layout. 1019 | --- 1020 | ---| "f24" 1021 | --- 1022 | ---The left control key on an American layout. 1023 | --- 1024 | ---| "lctrl" 1025 | --- 1026 | ---The left shift key on an American layout. 1027 | --- 1028 | ---| "lshift" 1029 | --- 1030 | ---The left alt / option key on an American layout. 1031 | --- 1032 | ---| "lalt" 1033 | --- 1034 | ---The left GUI (command / windows / super) key on an American layout. 1035 | --- 1036 | ---| "lgui" 1037 | --- 1038 | ---The right control key on an American layout. 1039 | --- 1040 | ---| "rctrl" 1041 | --- 1042 | ---The right shift key on an American layout. 1043 | --- 1044 | ---| "rshift" 1045 | --- 1046 | ---The right alt / option key on an American layout. 1047 | --- 1048 | ---| "ralt" 1049 | --- 1050 | ---The right GUI (command / windows / super) key on an American layout. 1051 | --- 1052 | ---| "rgui" 1053 | --- 1054 | ---The printscreen key on an American layout. 1055 | --- 1056 | ---| "printscreen" 1057 | --- 1058 | ---The scroll-lock key on an American layout. 1059 | --- 1060 | ---| "scrolllock" 1061 | --- 1062 | ---The pause key on an American layout. 1063 | --- 1064 | ---| "pause" 1065 | --- 1066 | ---The insert key on an American layout. 1067 | --- 1068 | ---| "insert" 1069 | --- 1070 | ---The home key on an American layout. 1071 | --- 1072 | ---| "home" 1073 | --- 1074 | ---The numlock / clear key on an American layout. 1075 | --- 1076 | ---| "numlock" 1077 | --- 1078 | ---The page-up key on an American layout. 1079 | --- 1080 | ---| "pageup" 1081 | --- 1082 | ---The forward-delete key on an American layout. 1083 | --- 1084 | ---| "delete" 1085 | --- 1086 | ---The end key on an American layout. 1087 | --- 1088 | ---| "end" 1089 | --- 1090 | ---The page-down key on an American layout. 1091 | --- 1092 | ---| "pagedown" 1093 | --- 1094 | ---The right-arrow key on an American layout. 1095 | --- 1096 | ---| "right" 1097 | --- 1098 | ---The left-arrow key on an American layout. 1099 | --- 1100 | ---| "left" 1101 | --- 1102 | ---The down-arrow key on an American layout. 1103 | --- 1104 | ---| "down" 1105 | --- 1106 | ---The up-arrow key on an American layout. 1107 | --- 1108 | ---| "up" 1109 | --- 1110 | ---The non-U.S. backslash scancode. 1111 | --- 1112 | ---| "nonusbackslash" 1113 | --- 1114 | ---The application key on an American layout. Windows contextual menu, compose key. 1115 | --- 1116 | ---| "application" 1117 | --- 1118 | ---The 'execute' key on an American layout. 1119 | --- 1120 | ---| "execute" 1121 | --- 1122 | ---The 'help' key on an American layout. 1123 | --- 1124 | ---| "help" 1125 | --- 1126 | ---The 'menu' key on an American layout. 1127 | --- 1128 | ---| "menu" 1129 | --- 1130 | ---The 'select' key on an American layout. 1131 | --- 1132 | ---| "select" 1133 | --- 1134 | ---The 'stop' key on an American layout. 1135 | --- 1136 | ---| "stop" 1137 | --- 1138 | ---The 'again' key on an American layout. 1139 | --- 1140 | ---| "again" 1141 | --- 1142 | ---The 'undo' key on an American layout. 1143 | --- 1144 | ---| "undo" 1145 | --- 1146 | ---The 'cut' key on an American layout. 1147 | --- 1148 | ---| "cut" 1149 | --- 1150 | ---The 'copy' key on an American layout. 1151 | --- 1152 | ---| "copy" 1153 | --- 1154 | ---The 'paste' key on an American layout. 1155 | --- 1156 | ---| "paste" 1157 | --- 1158 | ---The 'find' key on an American layout. 1159 | --- 1160 | ---| "find" 1161 | --- 1162 | ---The keypad forward-slash key on an American layout. 1163 | --- 1164 | ---| "kp/" 1165 | --- 1166 | ---The keypad '*' key on an American layout. 1167 | --- 1168 | ---| "kp*" 1169 | --- 1170 | ---The keypad minus key on an American layout. 1171 | --- 1172 | ---| "kp-" 1173 | --- 1174 | ---The keypad plus key on an American layout. 1175 | --- 1176 | ---| "kp+" 1177 | --- 1178 | ---The keypad equals key on an American layout. 1179 | --- 1180 | ---| "kp=" 1181 | --- 1182 | ---The keypad enter key on an American layout. 1183 | --- 1184 | ---| "kpenter" 1185 | --- 1186 | ---The keypad '1' key on an American layout. 1187 | --- 1188 | ---| "kp1" 1189 | --- 1190 | ---The keypad '2' key on an American layout. 1191 | --- 1192 | ---| "kp2" 1193 | --- 1194 | ---The keypad '3' key on an American layout. 1195 | --- 1196 | ---| "kp3" 1197 | --- 1198 | ---The keypad '4' key on an American layout. 1199 | --- 1200 | ---| "kp4" 1201 | --- 1202 | ---The keypad '5' key on an American layout. 1203 | --- 1204 | ---| "kp5" 1205 | --- 1206 | ---The keypad '6' key on an American layout. 1207 | --- 1208 | ---| "kp6" 1209 | --- 1210 | ---The keypad '7' key on an American layout. 1211 | --- 1212 | ---| "kp7" 1213 | --- 1214 | ---The keypad '8' key on an American layout. 1215 | --- 1216 | ---| "kp8" 1217 | --- 1218 | ---The keypad '9' key on an American layout. 1219 | --- 1220 | ---| "kp9" 1221 | --- 1222 | ---The keypad '0' key on an American layout. 1223 | --- 1224 | ---| "kp0" 1225 | --- 1226 | ---The keypad period key on an American layout. 1227 | --- 1228 | ---| "kp." 1229 | --- 1230 | ---The 1st international key on an American layout. Used on Asian keyboards. 1231 | --- 1232 | ---| "international1" 1233 | --- 1234 | ---The 2nd international key on an American layout. 1235 | --- 1236 | ---| "international2" 1237 | --- 1238 | ---The 3rd international key on an American layout. Yen. 1239 | --- 1240 | ---| "international3" 1241 | --- 1242 | ---The 4th international key on an American layout. 1243 | --- 1244 | ---| "international4" 1245 | --- 1246 | ---The 5th international key on an American layout. 1247 | --- 1248 | ---| "international5" 1249 | --- 1250 | ---The 6th international key on an American layout. 1251 | --- 1252 | ---| "international6" 1253 | --- 1254 | ---The 7th international key on an American layout. 1255 | --- 1256 | ---| "international7" 1257 | --- 1258 | ---The 8th international key on an American layout. 1259 | --- 1260 | ---| "international8" 1261 | --- 1262 | ---The 9th international key on an American layout. 1263 | --- 1264 | ---| "international9" 1265 | --- 1266 | ---Hangul/English toggle scancode. 1267 | --- 1268 | ---| "lang1" 1269 | --- 1270 | ---Hanja conversion scancode. 1271 | --- 1272 | ---| "lang2" 1273 | --- 1274 | ---Katakana scancode. 1275 | --- 1276 | ---| "lang3" 1277 | --- 1278 | ---Hiragana scancode. 1279 | --- 1280 | ---| "lang4" 1281 | --- 1282 | ---Zenkaku/Hankaku scancode. 1283 | --- 1284 | ---| "lang5" 1285 | --- 1286 | ---The mute key on an American layout. 1287 | --- 1288 | ---| "mute" 1289 | --- 1290 | ---The volume up key on an American layout. 1291 | --- 1292 | ---| "volumeup" 1293 | --- 1294 | ---The volume down key on an American layout. 1295 | --- 1296 | ---| "volumedown" 1297 | --- 1298 | ---The audio next track key on an American layout. 1299 | --- 1300 | ---| "audionext" 1301 | --- 1302 | ---The audio previous track key on an American layout. 1303 | --- 1304 | ---| "audioprev" 1305 | --- 1306 | ---The audio stop key on an American layout. 1307 | --- 1308 | ---| "audiostop" 1309 | --- 1310 | ---The audio play key on an American layout. 1311 | --- 1312 | ---| "audioplay" 1313 | --- 1314 | ---The audio mute key on an American layout. 1315 | --- 1316 | ---| "audiomute" 1317 | --- 1318 | ---The media select key on an American layout. 1319 | --- 1320 | ---| "mediaselect" 1321 | --- 1322 | ---The 'WWW' key on an American layout. 1323 | --- 1324 | ---| "www" 1325 | --- 1326 | ---The Mail key on an American layout. 1327 | --- 1328 | ---| "mail" 1329 | --- 1330 | ---The calculator key on an American layout. 1331 | --- 1332 | ---| "calculator" 1333 | --- 1334 | ---The 'computer' key on an American layout. 1335 | --- 1336 | ---| "computer" 1337 | --- 1338 | ---The AC Search key on an American layout. 1339 | --- 1340 | ---| "acsearch" 1341 | --- 1342 | ---The AC Home key on an American layout. 1343 | --- 1344 | ---| "achome" 1345 | --- 1346 | ---The AC Back key on an American layout. 1347 | --- 1348 | ---| "acback" 1349 | --- 1350 | ---The AC Forward key on an American layout. 1351 | --- 1352 | ---| "acforward" 1353 | --- 1354 | ---Th AC Stop key on an American layout. 1355 | --- 1356 | ---| "acstop" 1357 | --- 1358 | ---The AC Refresh key on an American layout. 1359 | --- 1360 | ---| "acrefresh" 1361 | --- 1362 | ---The AC Bookmarks key on an American layout. 1363 | --- 1364 | ---| "acbookmarks" 1365 | --- 1366 | ---The system power scancode. 1367 | --- 1368 | ---| "power" 1369 | --- 1370 | ---The brightness-down scancode. 1371 | --- 1372 | ---| "brightnessdown" 1373 | --- 1374 | ---The brightness-up scancode. 1375 | --- 1376 | ---| "brightnessup" 1377 | --- 1378 | ---The display switch scancode. 1379 | --- 1380 | ---| "displayswitch" 1381 | --- 1382 | ---The keyboard illumination toggle scancode. 1383 | --- 1384 | ---| "kbdillumtoggle" 1385 | --- 1386 | ---The keyboard illumination down scancode. 1387 | --- 1388 | ---| "kbdillumdown" 1389 | --- 1390 | ---The keyboard illumination up scancode. 1391 | --- 1392 | ---| "kbdillumup" 1393 | --- 1394 | ---The eject scancode. 1395 | --- 1396 | ---| "eject" 1397 | --- 1398 | ---The system sleep scancode. 1399 | --- 1400 | ---| "sleep" 1401 | --- 1402 | ---The alt-erase key on an American layout. 1403 | --- 1404 | ---| "alterase" 1405 | --- 1406 | ---The sysreq key on an American layout. 1407 | --- 1408 | ---| "sysreq" 1409 | --- 1410 | ---The 'cancel' key on an American layout. 1411 | --- 1412 | ---| "cancel" 1413 | --- 1414 | ---The 'clear' key on an American layout. 1415 | --- 1416 | ---| "clear" 1417 | --- 1418 | ---The 'prior' key on an American layout. 1419 | --- 1420 | ---| "prior" 1421 | --- 1422 | ---The 'return2' key on an American layout. 1423 | --- 1424 | ---| "return2" 1425 | --- 1426 | ---The 'separator' key on an American layout. 1427 | --- 1428 | ---| "separator" 1429 | --- 1430 | ---The 'out' key on an American layout. 1431 | --- 1432 | ---| "out" 1433 | --- 1434 | ---The 'oper' key on an American layout. 1435 | --- 1436 | ---| "oper" 1437 | --- 1438 | ---The 'clearagain' key on an American layout. 1439 | --- 1440 | ---| "clearagain" 1441 | --- 1442 | ---The 'crsel' key on an American layout. 1443 | --- 1444 | ---| "crsel" 1445 | --- 1446 | ---The 'exsel' key on an American layout. 1447 | --- 1448 | ---| "exsel" 1449 | --- 1450 | ---The keypad 00 key on an American layout. 1451 | --- 1452 | ---| "kp00" 1453 | --- 1454 | ---The keypad 000 key on an American layout. 1455 | --- 1456 | ---| "kp000" 1457 | --- 1458 | ---The thousands-separator key on an American layout. 1459 | --- 1460 | ---| "thsousandsseparator" 1461 | --- 1462 | ---The decimal separator key on an American layout. 1463 | --- 1464 | ---| "decimalseparator" 1465 | --- 1466 | ---The currency unit key on an American layout. 1467 | --- 1468 | ---| "currencyunit" 1469 | --- 1470 | ---The currency sub-unit key on an American layout. 1471 | --- 1472 | ---| "currencysubunit" 1473 | --- 1474 | ---The 'app1' scancode. 1475 | --- 1476 | ---| "app1" 1477 | --- 1478 | ---The 'app2' scancode. 1479 | --- 1480 | ---| "app2" 1481 | --- 1482 | ---An unknown key. 1483 | --- 1484 | ---| "unknown" 1485 | -------------------------------------------------------------------------------- /library/love/math.lua: -------------------------------------------------------------------------------- 1 | ---@meta 2 | 3 | --- 4 | ---Provides system-independent mathematical functions. 5 | --- 6 | --- 7 | ---[Open in Browser](https://love2d.org/wiki/love.math) 8 | --- 9 | ---@class love.math 10 | love.math = {} 11 | 12 | --- 13 | ---Converts a color from 0..255 to 0..1 range. 14 | --- 15 | --- 16 | ---[Open in Browser](https://love2d.org/wiki/love.math.colorFromBytes) 17 | --- 18 | ---@param rb number # Red color component in 0..255 range. 19 | ---@param gb number # Green color component in 0..255 range. 20 | ---@param bb number # Blue color component in 0..255 range. 21 | ---@param ab? number # Alpha color component in 0..255 range. 22 | ---@return number r # Red color component in 0..1 range. 23 | ---@return number g # Green color component in 0..1 range. 24 | ---@return number b # Blue color component in 0..1 range. 25 | ---@return number a # Alpha color component in 0..1 range or nil if alpha is not specified. 26 | function love.math.colorFromBytes(rb, gb, bb, ab) end 27 | 28 | --- 29 | ---Converts a color from 0..1 to 0..255 range. 30 | --- 31 | --- 32 | ---[Open in Browser](https://love2d.org/wiki/love.math.colorToBytes) 33 | --- 34 | ---@param r number # Red color component. 35 | ---@param g number # Green color component. 36 | ---@param b number # Blue color component. 37 | ---@param a? number # Alpha color component. 38 | ---@return number rb # Red color component in 0..255 range. 39 | ---@return number gb # Green color component in 0..255 range. 40 | ---@return number bb # Blue color component in 0..255 range. 41 | ---@return number ab # Alpha color component in 0..255 range or nil if alpha is not specified. 42 | function love.math.colorToBytes(r, g, b, a) end 43 | 44 | --- 45 | ---Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LÖVE doesn't handle conversions automatically. 46 | --- 47 | ---Read more about gamma-correct rendering here, here, and here. 48 | --- 49 | ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. 50 | --- 51 | --- 52 | ---[Open in Browser](https://love2d.org/wiki/love.math.gammaToLinear) 53 | --- 54 | ---@overload fun(color: table):number, number, number 55 | ---@overload fun(c: number):number 56 | ---@param r number # The red channel of the sRGB color to convert. 57 | ---@param g number # The green channel of the sRGB color to convert. 58 | ---@param b number # The blue channel of the sRGB color to convert. 59 | ---@return number lr # The red channel of the converted color in linear RGB space. 60 | ---@return number lg # The green channel of the converted color in linear RGB space. 61 | ---@return number lb # The blue channel of the converted color in linear RGB space. 62 | function love.math.gammaToLinear(r, g, b) end 63 | 64 | --- 65 | ---Gets the seed of the random number generator. 66 | --- 67 | ---The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed can be an integer value up to 2^64. 68 | --- 69 | --- 70 | ---[Open in Browser](https://love2d.org/wiki/love.math.getRandomSeed) 71 | --- 72 | ---@return number low # Integer number representing the lower 32 bits of the random number generator's 64 bit seed value. 73 | ---@return number high # Integer number representing the higher 32 bits of the random number generator's 64 bit seed value. 74 | function love.math.getRandomSeed() end 75 | 76 | --- 77 | ---Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with love.math.setRandomState or RandomGenerator:setState. 78 | --- 79 | ---This is different from love.math.getRandomSeed in that getRandomState gets the random number generator's current state, whereas getRandomSeed gets the previously set seed number. 80 | --- 81 | --- 82 | ---[Open in Browser](https://love2d.org/wiki/love.math.getRandomState) 83 | --- 84 | ---@return string state # The current state of the random number generator, represented as a string. 85 | function love.math.getRandomState() end 86 | 87 | --- 88 | ---Checks whether a polygon is convex. 89 | --- 90 | ---PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons. 91 | --- 92 | --- 93 | ---[Open in Browser](https://love2d.org/wiki/love.math.isConvex) 94 | --- 95 | ---@overload fun(x1: number, y1: number, x2: number, y2: number, ...):boolean 96 | ---@param vertices number[] # The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. 97 | ---@return boolean convex # Whether the given polygon is convex. 98 | function love.math.isConvex(vertices) end 99 | 100 | --- 101 | ---Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing. 102 | --- 103 | ---In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-converted. Colors calculated using math are often in the linear RGB space. 104 | --- 105 | ---Read more about gamma-correct rendering here, here, and here. 106 | --- 107 | ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. 108 | --- 109 | --- 110 | ---[Open in Browser](https://love2d.org/wiki/love.math.linearToGamma) 111 | --- 112 | ---@overload fun(color: table):number, number, number 113 | ---@overload fun(lc: number):number 114 | ---@param lr number # The red channel of the linear RGB color to convert. 115 | ---@param lg number # The green channel of the linear RGB color to convert. 116 | ---@param lb number # The blue channel of the linear RGB color to convert. 117 | ---@return number cr # The red channel of the converted color in gamma sRGB space. 118 | ---@return number cg # The green channel of the converted color in gamma sRGB space. 119 | ---@return number cb # The blue channel of the converted color in gamma sRGB space. 120 | function love.math.linearToGamma(lr, lg, lb) end 121 | 122 | --- 123 | ---Creates a new BezierCurve object. 124 | --- 125 | ---The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc. 126 | --- 127 | --- 128 | ---[Open in Browser](https://love2d.org/wiki/love.math.newBezierCurve) 129 | --- 130 | ---@overload fun(x1: number, y1: number, x2: number, y2: number, ...):love.BezierCurve 131 | ---@param vertices number[] # The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. 132 | ---@return love.BezierCurve curve # A Bézier curve object. 133 | function love.math.newBezierCurve(vertices) end 134 | 135 | --- 136 | ---Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions. 137 | --- 138 | --- 139 | ---[Open in Browser](https://love2d.org/wiki/love.math.newRandomGenerator) 140 | --- 141 | ---@overload fun(seed: number):love.RandomGenerator 142 | ---@overload fun(low: number, high: number):love.RandomGenerator 143 | ---@return love.RandomGenerator rng # The new Random Number Generator object. 144 | function love.math.newRandomGenerator() end 145 | 146 | --- 147 | ---Creates a new Transform object. 148 | --- 149 | --- 150 | ---[Open in Browser](https://love2d.org/wiki/love.math.newTransform) 151 | --- 152 | ---@overload fun(x: number, y: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number):love.Transform 153 | ---@return love.Transform transform # The new Transform object. 154 | function love.math.newTransform() end 155 | 156 | --- 157 | ---Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments. 158 | --- 159 | ---Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation. 160 | --- 161 | ---There are many webpages which discuss Perlin and Simplex noise in detail. 162 | --- 163 | --- 164 | ---[Open in Browser](https://love2d.org/wiki/love.math.noise) 165 | --- 166 | ---@overload fun(x: number, y: number):number 167 | ---@overload fun(x: number, y: number, z: number):number 168 | ---@overload fun(x: number, y: number, z: number, w: number):number 169 | ---@param x number # The number used to generate the noise value. 170 | ---@return number value # The noise value in the range of 1. 171 | function love.math.noise(x) end 172 | 173 | --- 174 | ---Generates a pseudo-random number in a platform independent manner. The default love.run seeds this function at startup, so you generally don't need to seed it yourself. 175 | --- 176 | --- 177 | ---[Open in Browser](https://love2d.org/wiki/love.math.random) 178 | --- 179 | ---@overload fun(max: number):number 180 | ---@overload fun(min: number, max: number):number 181 | ---@return number number # The pseudo-random number. 182 | function love.math.random() end 183 | 184 | --- 185 | ---Get a normally distributed pseudo random number. 186 | --- 187 | --- 188 | ---[Open in Browser](https://love2d.org/wiki/love.math.randomNormal) 189 | --- 190 | ---@param stddev? number # Standard deviation of the distribution. 191 | ---@param mean? number # The mean of the distribution. 192 | ---@return number number # Normally distributed random number with variance (stddev)² and the specified mean. 193 | function love.math.randomNormal(stddev, mean) end 194 | 195 | --- 196 | ---Sets the seed of the random number generator using the specified integer number. This is called internally at startup, so you generally don't need to call it yourself. 197 | --- 198 | --- 199 | ---[Open in Browser](https://love2d.org/wiki/love.math.setRandomSeed) 200 | --- 201 | ---@overload fun(low: number, high: number) 202 | ---@param seed number # The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1. 203 | function love.math.setRandomSeed(seed) end 204 | 205 | --- 206 | ---Sets the current state of the random number generator. The value used as an argument for this function is an opaque implementation-dependent string and should only originate from a previous call to love.math.getRandomState. 207 | --- 208 | ---This is different from love.math.setRandomSeed in that setRandomState directly sets the random number generator's current implementation-dependent state, whereas setRandomSeed gives it a new seed value. 209 | --- 210 | --- 211 | ---[Open in Browser](https://love2d.org/wiki/love.math.setRandomState) 212 | --- 213 | ---@param state string # The new state of the random number generator, represented as a string. This should originate from a previous call to love.math.getRandomState. 214 | function love.math.setRandomState(state) end 215 | 216 | --- 217 | ---Decomposes a simple convex or concave polygon into triangles. 218 | --- 219 | --- 220 | ---[Open in Browser](https://love2d.org/wiki/love.math.triangulate) 221 | --- 222 | ---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):table 223 | ---@param polygon table # Polygon to triangulate. Must not intersect itself. 224 | ---@return table triangles # List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}. 225 | function love.math.triangulate(polygon) end 226 | 227 | --- 228 | ---A Bézier curve object that can evaluate and render Bézier curves of arbitrary degree. 229 | --- 230 | ---For more information on Bézier curves check this great article on Wikipedia. 231 | --- 232 | --- 233 | ---[Open in Browser](https://love2d.org/wiki/love.math) 234 | --- 235 | ---@class love.BezierCurve: love.Object 236 | local BezierCurve = {} 237 | 238 | --- 239 | ---Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive). 240 | --- 241 | ---This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose. 242 | --- 243 | --- 244 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:evaluate) 245 | --- 246 | ---@param t number # Where to evaluate the curve. 247 | ---@return number x # x coordinate of the curve at parameter t. 248 | ---@return number y # y coordinate of the curve at parameter t. 249 | function BezierCurve:evaluate(t) end 250 | 251 | --- 252 | ---Get coordinates of the i-th control point. Indices start with 1. 253 | --- 254 | --- 255 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:getControlPoint) 256 | --- 257 | ---@param i number # Index of the control point. 258 | ---@return number x # Position of the control point along the x axis. 259 | ---@return number y # Position of the control point along the y axis. 260 | function BezierCurve:getControlPoint(i) end 261 | 262 | --- 263 | ---Get the number of control points in the Bézier curve. 264 | --- 265 | --- 266 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:getControlPointCount) 267 | --- 268 | ---@return number count # The number of control points. 269 | function BezierCurve:getControlPointCount() end 270 | 271 | --- 272 | ---Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1. 273 | --- 274 | --- 275 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:getDegree) 276 | --- 277 | ---@return number degree # Degree of the Bézier curve. 278 | function BezierCurve:getDegree() end 279 | 280 | --- 281 | ---Get the derivative of the Bézier curve. 282 | --- 283 | ---This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t. 284 | --- 285 | --- 286 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:getDerivative) 287 | --- 288 | ---@return love.BezierCurve derivative # The derivative curve. 289 | function BezierCurve:getDerivative() end 290 | 291 | --- 292 | ---Gets a BezierCurve that corresponds to the specified segment of this BezierCurve. 293 | --- 294 | --- 295 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:getSegment) 296 | --- 297 | ---@param startpoint number # The starting point along the curve. Must be between 0 and 1. 298 | ---@param endpoint number # The end of the segment. Must be between 0 and 1. 299 | ---@return love.BezierCurve curve # A BezierCurve that corresponds to the specified segment. 300 | function BezierCurve:getSegment(startpoint, endpoint) end 301 | 302 | --- 303 | ---Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc. 304 | --- 305 | --- 306 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:insertControlPoint) 307 | --- 308 | ---@param x number # Position of the control point along the x axis. 309 | ---@param y number # Position of the control point along the y axis. 310 | ---@param i? number # Index of the control point. 311 | function BezierCurve:insertControlPoint(x, y, i) end 312 | 313 | --- 314 | ---Removes the specified control point. 315 | --- 316 | --- 317 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:removeControlPoint) 318 | --- 319 | ---@param index number # The index of the control point to remove. 320 | function BezierCurve:removeControlPoint(index) end 321 | 322 | --- 323 | ---Get a list of coordinates to be used with love.graphics.line. 324 | --- 325 | ---This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter. 326 | --- 327 | ---If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate. 328 | --- 329 | --- 330 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:render) 331 | --- 332 | ---@param depth? number # Number of recursive subdivision steps. 333 | ---@return number[] coordinates # List of x,y-coordinate pairs of points on the curve. 334 | function BezierCurve:render(depth) end 335 | 336 | --- 337 | ---Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line. 338 | --- 339 | ---This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter. 340 | --- 341 | ---If you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate. 342 | --- 343 | --- 344 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:renderSegment) 345 | --- 346 | ---@param startpoint number # The starting point along the curve. Must be between 0 and 1. 347 | ---@param endpoint number # The end of the segment to render. Must be between 0 and 1. 348 | ---@param depth? number # Number of recursive subdivision steps. 349 | ---@return number[] coordinates # List of x,y-coordinate pairs of points on the specified part of the curve. 350 | function BezierCurve:renderSegment(startpoint, endpoint, depth) end 351 | 352 | --- 353 | ---Rotate the Bézier curve by an angle. 354 | --- 355 | --- 356 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:rotate) 357 | --- 358 | ---@param angle number # Rotation angle in radians. 359 | ---@param ox? number # X coordinate of the rotation center. 360 | ---@param oy? number # Y coordinate of the rotation center. 361 | function BezierCurve:rotate(angle, ox, oy) end 362 | 363 | --- 364 | ---Scale the Bézier curve by a factor. 365 | --- 366 | --- 367 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:scale) 368 | --- 369 | ---@param s number # Scale factor. 370 | ---@param ox? number # X coordinate of the scaling center. 371 | ---@param oy? number # Y coordinate of the scaling center. 372 | function BezierCurve:scale(s, ox, oy) end 373 | 374 | --- 375 | ---Set coordinates of the i-th control point. Indices start with 1. 376 | --- 377 | --- 378 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:setControlPoint) 379 | --- 380 | ---@param i number # Index of the control point. 381 | ---@param x number # Position of the control point along the x axis. 382 | ---@param y number # Position of the control point along the y axis. 383 | function BezierCurve:setControlPoint(i, x, y) end 384 | 385 | --- 386 | ---Move the Bézier curve by an offset. 387 | --- 388 | --- 389 | ---[Open in Browser](https://love2d.org/wiki/BezierCurve:translate) 390 | --- 391 | ---@param dx number # Offset along the x axis. 392 | ---@param dy number # Offset along the y axis. 393 | function BezierCurve:translate(dx, dy) end 394 | 395 | --- 396 | ---A random number generation object which has its own random state. 397 | --- 398 | --- 399 | ---[Open in Browser](https://love2d.org/wiki/love.math) 400 | --- 401 | ---@class love.RandomGenerator: love.Object 402 | local RandomGenerator = {} 403 | 404 | --- 405 | ---Gets the seed of the random number generator object. 406 | --- 407 | ---The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1. 408 | --- 409 | --- 410 | ---[Open in Browser](https://love2d.org/wiki/RandomGenerator:getSeed) 411 | --- 412 | ---@return number low # Integer number representing the lower 32 bits of the RandomGenerator's 64 bit seed value. 413 | ---@return number high # Integer number representing the higher 32 bits of the RandomGenerator's 64 bit seed value. 414 | function RandomGenerator:getSeed() end 415 | 416 | --- 417 | ---Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE. 418 | --- 419 | ---This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number. 420 | --- 421 | --- 422 | ---[Open in Browser](https://love2d.org/wiki/RandomGenerator:getState) 423 | --- 424 | ---@return string state # The current state of the RandomGenerator object, represented as a string. 425 | function RandomGenerator:getState() end 426 | 427 | --- 428 | ---Generates a pseudo-random number in a platform independent manner. 429 | --- 430 | --- 431 | ---[Open in Browser](https://love2d.org/wiki/RandomGenerator:random) 432 | --- 433 | ---@overload fun(self: love.RandomGenerator, max: number):number 434 | ---@overload fun(self: love.RandomGenerator, min: number, max: number):number 435 | ---@return number number # The pseudo-random number. 436 | function RandomGenerator:random() end 437 | 438 | --- 439 | ---Get a normally distributed pseudo random number. 440 | --- 441 | --- 442 | ---[Open in Browser](https://love2d.org/wiki/RandomGenerator:randomNormal) 443 | --- 444 | ---@param stddev? number # Standard deviation of the distribution. 445 | ---@param mean? number # The mean of the distribution. 446 | ---@return number number # Normally distributed random number with variance (stddev)² and the specified mean. 447 | function RandomGenerator:randomNormal(stddev, mean) end 448 | 449 | --- 450 | ---Sets the seed of the random number generator using the specified integer number. 451 | --- 452 | --- 453 | ---[Open in Browser](https://love2d.org/wiki/RandomGenerator:setSeed) 454 | --- 455 | ---@overload fun(self: love.RandomGenerator, low: number, high: number) 456 | ---@param seed number # The integer number with which you want to seed the randomization. Must be within the range of 2^53. 457 | function RandomGenerator:setSeed(seed) end 458 | 459 | --- 460 | ---Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE. 461 | --- 462 | ---This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value. 463 | --- 464 | --- 465 | ---[Open in Browser](https://love2d.org/wiki/RandomGenerator:setState) 466 | --- 467 | ---@param state string # The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState. 468 | function RandomGenerator:setState(state) end 469 | 470 | --- 471 | ---Object containing a coordinate system transformation. 472 | --- 473 | ---The love.graphics module has several functions and function variants which accept Transform objects. 474 | --- 475 | --- 476 | ---[Open in Browser](https://love2d.org/wiki/love.math) 477 | --- 478 | ---@class love.Transform: love.Object 479 | local Transform = {} 480 | 481 | --- 482 | ---Applies the given other Transform object to this one. 483 | --- 484 | ---This effectively multiplies this Transform's internal transformation matrix with the other Transform's (i.e. self * other), and stores the result in this object. 485 | --- 486 | --- 487 | ---[Open in Browser](https://love2d.org/wiki/Transform:apply) 488 | --- 489 | ---@param other love.Transform # The other Transform object to apply to this Transform. 490 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 491 | function Transform:apply(other) end 492 | 493 | --- 494 | ---Creates a new copy of this Transform. 495 | --- 496 | --- 497 | ---[Open in Browser](https://love2d.org/wiki/Transform:clone) 498 | --- 499 | ---@return love.Transform clone # The copy of this Transform. 500 | function Transform:clone() end 501 | 502 | --- 503 | ---Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order. 504 | --- 505 | --- 506 | ---[Open in Browser](https://love2d.org/wiki/Transform:getMatrix) 507 | --- 508 | ---@return number e1_1 # The first column of the first row of the matrix. 509 | ---@return number e1_2 # The second column of the first row of the matrix. 510 | ---@return number e1_3 # The third column of the first row of the matrix. 511 | ---@return number e1_4 # The fourth column of the first row of the matrix. 512 | ---@return number e2_1 # The first column of the second row of the matrix. 513 | ---@return number e2_2 # The second column of the second row of the matrix. 514 | ---@return number e2_3 # The third column of the second row of the matrix. 515 | ---@return number e2_4 # The fourth column of the second row of the matrix. 516 | ---@return number e3_1 # The first column of the third row of the matrix. 517 | ---@return number e3_2 # The second column of the third row of the matrix. 518 | ---@return number e3_3 # The third column of the third row of the matrix. 519 | ---@return number e3_4 # The fourth column of the third row of the matrix. 520 | ---@return number e4_1 # The first column of the fourth row of the matrix. 521 | ---@return number e4_2 # The second column of the fourth row of the matrix. 522 | ---@return number e4_3 # The third column of the fourth row of the matrix. 523 | ---@return number e4_4 # The fourth column of the fourth row of the matrix. 524 | function Transform:getMatrix() end 525 | 526 | --- 527 | ---Creates a new Transform containing the inverse of this Transform. 528 | --- 529 | --- 530 | ---[Open in Browser](https://love2d.org/wiki/Transform:inverse) 531 | --- 532 | ---@return love.Transform inverse # A new Transform object representing the inverse of this Transform's matrix. 533 | function Transform:inverse() end 534 | 535 | --- 536 | ---Applies the reverse of the Transform object's transformation to the given 2D position. 537 | --- 538 | ---This effectively converts the given position from the local coordinate space of the Transform into global coordinates. 539 | --- 540 | ---One use of this method can be to convert a screen-space mouse position into global world coordinates, if the given Transform has transformations applied that are used for a camera system in-game. 541 | --- 542 | --- 543 | ---[Open in Browser](https://love2d.org/wiki/Transform:inverseTransformPoint) 544 | --- 545 | ---@param localX number # The x component of the position with the transform applied. 546 | ---@param localY number # The y component of the position with the transform applied. 547 | ---@return number globalX # The x component of the position in global coordinates. 548 | ---@return number globalY # The y component of the position in global coordinates. 549 | function Transform:inverseTransformPoint(localX, localY) end 550 | 551 | --- 552 | ---Checks whether the Transform is an affine transformation. 553 | --- 554 | --- 555 | ---[Open in Browser](https://love2d.org/wiki/Transform:isAffine2DTransform) 556 | --- 557 | ---@return boolean affine # true if the transform object is an affine transformation, false otherwise. 558 | function Transform:isAffine2DTransform() end 559 | 560 | --- 561 | ---Resets the Transform to an identity state. All previously applied transformations are erased. 562 | --- 563 | --- 564 | ---[Open in Browser](https://love2d.org/wiki/Transform:reset) 565 | --- 566 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 567 | function Transform:reset() end 568 | 569 | --- 570 | ---Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations. 571 | --- 572 | --- 573 | ---[Open in Browser](https://love2d.org/wiki/Transform:rotate) 574 | --- 575 | ---@param angle number # The relative angle in radians to rotate this Transform by. 576 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 577 | function Transform:rotate(angle) end 578 | 579 | --- 580 | ---Scales the Transform's coordinate system. This method does not reset any previously applied transformations. 581 | --- 582 | --- 583 | ---[Open in Browser](https://love2d.org/wiki/Transform:scale) 584 | --- 585 | ---@param sx number # The relative scale factor along the x-axis. 586 | ---@param sy? number # The relative scale factor along the y-axis. 587 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 588 | function Transform:scale(sx, sy) end 589 | 590 | --- 591 | ---Directly sets the Transform's internal 4x4 transformation matrix. 592 | --- 593 | --- 594 | ---[Open in Browser](https://love2d.org/wiki/Transform:setMatrix) 595 | --- 596 | ---@overload fun(self: love.Transform, layout: love.MatrixLayout, e1_1: number, e1_2: number, e1_3: number, e1_4: number, e2_1: number, e2_2: number, e2_3: number, e2_4: number, e3_1: number, e3_2: number, e3_3: number, e3_4: number, e4_1: number, e4_2: number, e4_3: number, e4_4: number):love.Transform 597 | ---@overload fun(self: love.Transform, layout: love.MatrixLayout, matrix: table):love.Transform 598 | ---@overload fun(self: love.Transform, layout: love.MatrixLayout, matrix: table):love.Transform 599 | ---@param e1_1 number # The first column of the first row of the matrix. 600 | ---@param e1_2 number # The second column of the first row of the matrix. 601 | ---@param e1_3 number # The third column of the first row of the matrix. 602 | ---@param e1_4 number # The fourth column of the first row of the matrix. 603 | ---@param e2_1 number # The first column of the second row of the matrix. 604 | ---@param e2_2 number # The second column of the second row of the matrix. 605 | ---@param e2_3 number # The third column of the second row of the matrix. 606 | ---@param e2_4 number # The fourth column of the second row of the matrix. 607 | ---@param e3_1 number # The first column of the third row of the matrix. 608 | ---@param e3_2 number # The second column of the third row of the matrix. 609 | ---@param e3_3 number # The third column of the third row of the matrix. 610 | ---@param e3_4 number # The fourth column of the third row of the matrix. 611 | ---@param e4_1 number # The first column of the fourth row of the matrix. 612 | ---@param e4_2 number # The second column of the fourth row of the matrix. 613 | ---@param e4_3 number # The third column of the fourth row of the matrix. 614 | ---@param e4_4 number # The fourth column of the fourth row of the matrix. 615 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 616 | function Transform:setMatrix( 617 | e1_1, 618 | e1_2, 619 | e1_3, 620 | e1_4, 621 | e2_1, 622 | e2_2, 623 | e2_3, 624 | e2_4, 625 | e3_1, 626 | e3_2, 627 | e3_3, 628 | e3_4, 629 | e4_1, 630 | e4_2, 631 | e4_3, 632 | e4_4 633 | ) 634 | end 635 | 636 | --- 637 | ---Resets the Transform to the specified transformation parameters. 638 | --- 639 | --- 640 | ---[Open in Browser](https://love2d.org/wiki/Transform:setTransformation) 641 | --- 642 | ---@param x number # The position of the Transform on the x-axis. 643 | ---@param y number # The position of the Transform on the y-axis. 644 | ---@param angle? number # The orientation of the Transform in radians. 645 | ---@param sx? number # Scale factor on the x-axis. 646 | ---@param sy? number # Scale factor on the y-axis. 647 | ---@param ox? number # Origin offset on the x-axis. 648 | ---@param oy? number # Origin offset on the y-axis. 649 | ---@param kx? number # Shearing / skew factor on the x-axis. 650 | ---@param ky? number # Shearing / skew factor on the y-axis. 651 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 652 | function Transform:setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky) end 653 | 654 | --- 655 | ---Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations. 656 | --- 657 | --- 658 | ---[Open in Browser](https://love2d.org/wiki/Transform:shear) 659 | --- 660 | ---@param kx number # The shear factor along the x-axis. 661 | ---@param ky number # The shear factor along the y-axis. 662 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 663 | function Transform:shear(kx, ky) end 664 | 665 | --- 666 | ---Applies the Transform object's transformation to the given 2D position. 667 | --- 668 | ---This effectively converts the given position from global coordinates into the local coordinate space of the Transform. 669 | --- 670 | --- 671 | ---[Open in Browser](https://love2d.org/wiki/Transform:transformPoint) 672 | --- 673 | ---@param globalX number # The x component of the position in global coordinates. 674 | ---@param globalY number # The y component of the position in global coordinates. 675 | ---@return number localX # The x component of the position with the transform applied. 676 | ---@return number localY # The y component of the position with the transform applied. 677 | function Transform:transformPoint(globalX, globalY) end 678 | 679 | --- 680 | ---Applies a translation to the Transform's coordinate system. This method does not reset any previously applied transformations. 681 | --- 682 | --- 683 | ---[Open in Browser](https://love2d.org/wiki/Transform:translate) 684 | --- 685 | ---@param dx number # The relative translation along the x-axis. 686 | ---@param dy number # The relative translation along the y-axis. 687 | ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. 688 | function Transform:translate(dx, dy) end 689 | 690 | --- 691 | ---The layout of matrix elements (row-major or column-major). 692 | --- 693 | --- 694 | ---[Open in Browser](https://love2d.org/wiki/MatrixLayout) 695 | --- 696 | ---@alias love.MatrixLayout 697 | --- 698 | ---The matrix is row-major: 699 | --- 700 | ---| "row" 701 | --- 702 | ---The matrix is column-major: 703 | --- 704 | ---| "column" 705 | --------------------------------------------------------------------------------