diff options
Diffstat (limited to 'meta')
20 files changed, 2841 insertions, 0 deletions
diff --git a/meta/3rd/love2d/library/love.audio.lua b/meta/3rd/love2d/library/love.audio.lua new file mode 100644 index 00000000..b323fc64 --- /dev/null +++ b/meta/3rd/love2d/library/love.audio.lua @@ -0,0 +1,191 @@ +---@class love.audio +love.audio = {} + +--- +---Gets a list of the names of the currently enabled effects. +--- +---@return table effects # The list of the names of the currently enabled effects. +function love.audio.getActiveEffects() end + +--- +---Gets the current number of simultaneously playing sources. +--- +---@return number count # The current number of simultaneously playing sources. +function love.audio.getActiveSourceCount() end + +--- +---Returns the distance attenuation model. +--- +---@return DistanceModel model # The current distance model. The default is 'inverseclamped'. +function love.audio.getDistanceModel() end + +--- +---Gets the current global scale factor for velocity-based doppler effects. +--- +---@return number scale # The current doppler scale factor. +function love.audio.getDopplerScale() end + +--- +---Gets the settings associated with an effect. +--- +---@param name string # The name of the effect. +---@return table settings # The settings associated with the effect. +function love.audio.getEffect(name) end + +--- +---Gets the maximum number of active effects supported by the system. +--- +---@return number maximum # The maximum number of active effects. +function love.audio.getMaxSceneEffects() end + +--- +---Gets the maximum number of active Effects in a single Source object, that the system can support. +--- +---@return number maximum # The maximum number of active Effects per Source. +function love.audio.getMaxSourceEffects() end + +--- +---Returns the orientation of the listener. +--- +---@return number fx, fy, fz # Forward vector of the listener orientation. +---@return number ux, uy, uz # Up vector of the listener orientation. +function love.audio.getOrientation() end + +--- +---Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources. +--- +---@return number x # The X position of the listener. +---@return number y # The Y position of the listener. +---@return number z # The Z position of the listener. +function love.audio.getPosition() end + +--- +---Gets a list of RecordingDevices on the system. +--- +---The first device in the list is the user's default recording device. The list may be empty if there are no microphones connected to the system. +--- +---Audio recording is currently not supported on iOS. +--- +---@return table devices # The list of connected recording devices. +function love.audio.getRecordingDevices() end + +--- +---Gets the current number of simultaneously playing sources. +--- +---@return number numSources # The current number of simultaneously playing sources. +function love.audio.getSourceCount() end + +--- +---Returns the velocity of the listener. +--- +---@return number x # The X velocity of the listener. +---@return number y # The Y velocity of the listener. +---@return number z # The Z velocity of the listener. +function love.audio.getVelocity() end + +--- +---Returns the master volume. +--- +---@return number volume # The current master volume +function love.audio.getVolume() end + +--- +---Gets whether audio effects are supported in the system. +--- +---@return boolean supported # True if effects are supported, false otherwise. +function love.audio.isEffectsSupported() end + +--- +---Creates a new Source usable for real-time generated sound playback with Source:queue. +--- +---@param samplerate number # Number of samples per second when playing. +---@param bitdepth number # Bits per sample (8 or 16). +---@param channels number # 1 for mono or 2 for stereo. +---@param buffercount number # The number of buffers that can be queued up at any given time with Source:queue. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified. +---@return Source source # The new Source usable with Source:queue. +function love.audio.newQueueableSource(samplerate, bitdepth, channels, buffercount) end + +--- +---Creates a new Source from a filepath, File, Decoder or SoundData. +--- +---Sources created from SoundData are always static. +--- +---@param filename string # The filepath to the audio file. +---@param type SourceType # Streaming or static source. +---@return Source source # A new Source that can play the specified audio. +function love.audio.newSource(filename, type) end + +--- +---Pauses specific or all currently played Sources. +--- +---@return table Sources # A table containing a list of Sources that were paused by this call. +function love.audio.pause() end + +--- +---Plays the specified Source. +--- +---@param source Source # The Source to play. +function love.audio.play(source) end + +--- +---Sets the distance attenuation model. +--- +---@param model DistanceModel # The new distance model. +function love.audio.setDistanceModel(model) end + +--- +---Sets a global scale factor for velocity-based doppler effects. The default scale value is 1. +--- +---@param scale number # The new doppler scale factor. The scale must be greater than 0. +function love.audio.setDopplerScale(scale) end + +--- +---Defines an effect that can be applied to a Source. +--- +---Not all system supports audio effects. Use love.audio.isEffectsSupported to check. +--- +---@param name string # The name of the effect. +---@param settings table # The settings to use for this effect, with the following fields: +---@return boolean success # Whether the effect was successfully created. +function love.audio.setEffect(name, settings) end + +--- +---Sets whether the system should mix the audio with the system's audio. +--- +---@param mix boolean # True to enable mixing, false to disable it. +---@return boolean success # True if the change succeeded, false otherwise. +function love.audio.setMixWithSystem(mix) end + +--- +---Sets the orientation of the listener. +--- +---@param fx, fy, fz number # Forward vector of the listener orientation. +---@param ux, uy, uz number # Up vector of the listener orientation. +function love.audio.setOrientation(fx, fy, fz, ux, uy, uz) end + +--- +---Sets the position of the listener, which determines how sounds play. +--- +---@param x number # The x position of the listener. +---@param y number # The y position of the listener. +---@param z number # The z position of the listener. +function love.audio.setPosition(x, y, z) end + +--- +---Sets the velocity of the listener. +--- +---@param x number # The X velocity of the listener. +---@param y number # The Y velocity of the listener. +---@param z number # The Z velocity of the listener. +function love.audio.setVelocity(x, y, z) end + +--- +---Sets the master volume. +--- +---@param volume number # 1.0 is max and 0.0 is off. +function love.audio.setVolume(volume) end + +--- +---Stops currently played sources. +--- +function love.audio.stop() end diff --git a/meta/3rd/love2d/library/love.data.lua b/meta/3rd/love2d/library/love.data.lua new file mode 100644 index 00000000..7e7141a7 --- /dev/null +++ b/meta/3rd/love2d/library/love.data.lua @@ -0,0 +1,99 @@ +---@class love.data +love.data = {} + +--- +---Compresses a string or data using a specific compression algorithm. +--- +---@param container ContainerType # What type to return the compressed data as. +---@param format CompressedDataFormat # The format to use when compressing the string. +---@param rawstring string # The raw (un-compressed) string to compress. +---@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. +---@return CompressedData or string compressedData # CompressedData/string which contains the compressed version of rawstring. +function love.data.compress(container, format, rawstring, level) end + +--- +---Decode Data or a string from any of the EncodeFormats to Data or string. +--- +---@param container ContainerType # What type to return the decoded data as. +---@param format EncodeFormat # The format of the input data. +---@param sourceString string # The raw (encoded) data to decode. +---@return ByteData or string decoded # ByteData/string which contains the decoded version of source. +function love.data.decode(container, format, sourceString) end + +--- +---Decompresses a CompressedData or previously compressed string or Data object. +--- +---@param container ContainerType # What type to return the decompressed data as. +---@param compressedData CompressedData # The compressed data to decompress. +---@return Data or string decompressedData # Data/string containing the raw decompressed data. +function love.data.decompress(container, compressedData) end + +--- +---Encode Data or a string to a Data or string in one of the EncodeFormats. +--- +---@param container ContainerType # What type to return the encoded data as. +---@param format EncodeFormat # The format of the output data. +---@param sourceString string # The raw data to encode. +---@param linelength number # The maximum line length of the output. Only supported for base64, ignored if 0. +---@return ByteData or string encoded # ByteData/string which contains the encoded version of source. +function love.data.encode(container, format, sourceString, linelength) end + +--- +---Gets the size in bytes that a given format used with love.data.pack will use. +--- +---This function behaves the same as Lua 5.3's string.packsize. +--- +---@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings. +---@return number size # The size in bytes that the packed data will use. +function love.data.getPackedSize(format) end + +--- +---Compute the message digest of a string using a specified hash algorithm. +--- +---@param hashFunction HashFunction # Hash algorithm to use. +---@param string string # String to hash. +---@return string rawdigest # Raw message digest string. +function love.data.hash(hashFunction, string) end + +--- +---Creates a new Data object containing arbitrary bytes. +--- +---Data:getPointer along with LuaJIT's FFI can be used to manipulate the contents of the ByteData object after it has been created. +--- +---@param datastring string # The byte string to copy. +---@return ByteData bytedata # The new Data object. +function love.data.newByteData(datastring) end + +--- +---Creates a new Data referencing a subsection of an existing Data object. +--- +---@param data Data # The Data object to reference. +---@param offset number # The offset of the subsection to reference, in bytes. +---@param size number # The size in bytes of the subsection to reference. +---@return Data view # The new Data view. +function love.data.newDataView(data, offset, size) end + +--- +---Packs (serializes) simple Lua values. +--- +---This function behaves the same as Lua 5.3's string.pack. +--- +---@param container ContainerType # What type to return the encoded data as. +---@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings. +---@param v1 number or boolean or string # The first value (number, boolean, or string) to serialize. +---@param ... number or boolean or string # Additional values to serialize. +---@return Data or string data # Data/string which contains the serialized data. +function love.data.pack(container, format, v1, ...) end + +--- +---Unpacks (deserializes) a byte-string or Data into simple Lua values. +--- +---This function behaves the same as Lua 5.3's string.unpack. +--- +---@param format string # A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings. +---@param datastring string # A string containing the packed (serialized) data. +---@param pos number # Where to start reading in the string. Negative values can be used to read relative from the end of the string. +---@return number or boolean or string v1 # The first value (number, boolean, or string) that was unpacked. +---@return number or boolean or string ... # Additional unpacked values. +---@return number index # The index of the first unread byte in the data string. +function love.data.unpack(format, datastring, pos) end diff --git a/meta/3rd/love2d/library/love.event.lua b/meta/3rd/love2d/library/love.event.lua new file mode 100644 index 00000000..2cd65d46 --- /dev/null +++ b/meta/3rd/love2d/library/love.event.lua @@ -0,0 +1,60 @@ +---@class love.event +love.event = {} + +--- +---Clears the event queue. +--- +function love.event.clear() end + +--- +---Returns an iterator for messages in the event queue. +--- +---@return function i # Iterator function usable in a for loop. +function love.event.poll() end + +--- +---Pump events into the event queue. +--- +---This is a low-level function, and is usually not called by the user, but by love.run. +--- +---Note that this does need to be called for any OS to think you're still running, +--- +---and if you want to handle OS-generated events at all (think callbacks). +--- +function love.event.pump() end + +--- +---Adds an event to the event queue. +--- +---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. +--- +---@param n Event # The name of the event. +---@param a Variant # First event argument. +---@param b Variant # Second event argument. +---@param c Variant # Third event argument. +---@param d Variant # Fourth event argument. +---@param e Variant # Fifth event argument. +---@param f Variant # Sixth event argument. +---@param ... Variant # Further event arguments may follow. +function love.event.push(n, a, b, c, d, e, f, ...) end + +--- +---Adds the quit event to the queue. +--- +---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. +--- +---@param exitstatus number # The program exit status to use when closing the application. +function love.event.quit(exitstatus) end + +--- +---Like love.event.poll(), but blocks until there is an event in the queue. +--- +---@return Event n # The name of event. +---@return Variant a # First event argument. +---@return Variant b # Second event argument. +---@return Variant c # Third event argument. +---@return Variant d # Fourth event argument. +---@return Variant e # Fifth event argument. +---@return Variant f # Sixth event argument. +---@return Variant ... # Further event arguments may follow. +function love.event.wait() end diff --git a/meta/3rd/love2d/library/love.filesystem.lua b/meta/3rd/love2d/library/love.filesystem.lua new file mode 100644 index 00000000..13b3b5c5 --- /dev/null +++ b/meta/3rd/love2d/library/love.filesystem.lua @@ -0,0 +1,257 @@ +---@class love.filesystem +love.filesystem = {} + +--- +---Append data to an existing file. +--- +---@param name string # The name (and path) of the file. +---@param data string # The string data to append to the file. +---@param size number # How many bytes to write. +---@return boolean success # True if the operation was successful, or nil if there was an error. +---@return string errormsg # The error message on failure. +function love.filesystem.append(name, data, size) end + +--- +---Gets whether love.filesystem follows symbolic links. +--- +---@return boolean enable # Whether love.filesystem follows symbolic links. +function love.filesystem.areSymlinksEnabled() end + +--- +---Recursively creates a directory. +--- +---When called with 'a/b' it creates both 'a' and 'a/b', if they don't exist already. +--- +---@param name string # The directory to create. +---@return boolean success # True if the directory was created, false if not. +function love.filesystem.createDirectory(name) end + +--- +---Returns the application data directory (could be the same as getUserDirectory) +--- +---@return string path # The path of the application data directory +function love.filesystem.getAppdataDirectory() end + +--- +---Gets the filesystem paths that will be searched for c libraries when require is called. +--- +---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. +--- +---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. +--- +---@return string paths # The paths that the ''require'' function will check for c libraries in love's filesystem. +function love.filesystem.getCRequirePath() end + +--- +---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. +--- +---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. +--- +---@param dir string # The directory. +---@return table files # A sequence with the names of all files and subdirectories as strings. +function love.filesystem.getDirectoryItems(dir) end + +--- +---Gets the write directory name for your game. +--- +---Note that this only returns the name of the folder to store your files in, not the full path. +--- +---@return string name # The identity that is used as write directory. +function love.filesystem.getIdentity() end + +--- +---Gets information about the specified file or directory. +--- +---@param path string # The file or directory path to check. +---@param filtertype 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. +---@return table info # A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields: +function love.filesystem.getInfo(path, filtertype) end + +--- +---Gets the platform-specific absolute path of the directory containing a filepath. +--- +---This can be used to determine whether a file is inside the save directory or the game's source .love. +--- +---@param filepath string # The filepath to get the directory of. +---@return string realdir # The platform-specific full path of the directory containing the filepath. +function love.filesystem.getRealDirectory(filepath) end + +--- +---Gets the filesystem paths that will be searched when require is called. +--- +---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.) +--- +---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. +--- +---@return string paths # The paths that the ''require'' function will check in love's filesystem. +function love.filesystem.getRequirePath() end + +--- +---Gets the full path to the designated save directory. +--- +---This can be useful if you want to use the standard io library (or something else) to +--- +---read or write in the save directory. +--- +---@return string dir # The absolute path to the save directory. +function love.filesystem.getSaveDirectory() end + +--- +---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. +--- +---@return string path # The full platform-dependent path of the .love file or directory. +function love.filesystem.getSource() end + +--- +---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. +--- +---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. +--- +---@return string path # The full platform-dependent path of the directory containing the .love file. +function love.filesystem.getSourceBaseDirectory() end + +--- +---Returns the path of the user's directory +--- +---@return string path # The path of the user's directory +function love.filesystem.getUserDirectory() end + +--- +---Gets the current working directory. +--- +---@return string cwd # The current working directory. +function love.filesystem.getWorkingDirectory() end + +--- +---Initializes love.filesystem, will be called internally, so should not be used explicitly. +--- +---@param appname string # The name of the application binary, typically love. +function love.filesystem.init(appname) end + +--- +---Gets whether the game is in fused mode or not. +--- +---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. +--- +---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. +--- +---@return boolean fused # True if the game is in fused mode, false otherwise. +function love.filesystem.isFused() end + +--- +---Iterate over the lines in a file. +--- +---@param name string # The name (and path) of the file +---@return function iterator # A function that iterates over all the lines in the file +function love.filesystem.lines(name) end + +--- +---Loads a Lua file (but does not run it). +--- +---@param name string # The name (and path) of the file. +---@return function chunk # The loaded chunk. +---@return string errormsg # The error message if file could not be opened. +function love.filesystem.load(name) end + +--- +---Mounts a zip file or folder in the game's save directory for reading. +--- +---It is also possible to mount love.filesystem.getSourceBaseDirectory if the game is in fused mode. +--- +---@param archive string # The folder or zip file in the game's save directory to mount. +---@param mountpoint string # The new path the archive will be mounted to. +---@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. +---@return boolean success # True if the archive was successfully mounted, false otherwise. +function love.filesystem.mount(archive, mountpoint, appendToPath) end + +--- +---Creates a new File object. +--- +---It needs to be opened before it can be accessed. +--- +---@param filename string # The filename of the file. +---@return File file # The new File object. +function love.filesystem.newFile(filename) end + +--- +---Creates a new FileData object. +--- +---@param contents string # The contents of the file. +---@param name string # The name of the file. +---@return FileData data # Your new FileData. +function love.filesystem.newFileData(contents, name) end + +--- +---Read the contents of a file. +--- +---@param name string # The name (and path) of the file. +---@param size number # How many bytes to read. +---@return string contents # The file contents. +---@return number size # How many bytes have been read. +---@return nil contents # returns nil as content. +---@return string error # returns an error message. +function love.filesystem.read(name, size) end + +--- +---Removes a file or empty directory. +--- +---@param name string # The file or directory to remove. +---@return boolean success # True if the file/directory was removed, false otherwise. +function love.filesystem.remove(name) end + +--- +---Sets the filesystem paths that will be searched for c libraries when require is called. +--- +---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. +--- +---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. +--- +---@param paths string # The paths that the ''require'' function will check in love's filesystem. +function love.filesystem.setCRequirePath(paths) end + +--- +---Sets the write directory for your game. +--- +---Note that you can only set the name of the folder to store your files in, not the location. +--- +---@param name string # The new identity that will be used as write directory. +function love.filesystem.setIdentity(name) end + +--- +---Sets the filesystem paths that will be searched when require is called. +--- +---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.) +--- +---The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. +--- +---@param paths string # The paths that the ''require'' function will check in love's filesystem. +function love.filesystem.setRequirePath(paths) end + +--- +---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. +--- +---@param path string # Absolute path to the game's source folder. +function love.filesystem.setSource(path) end + +--- +---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. +--- +---@param enable boolean # Whether love.filesystem should follow symbolic links. +function love.filesystem.setSymlinksEnabled(enable) end + +--- +---Unmounts a zip file or folder previously mounted for reading with love.filesystem.mount. +--- +---@param archive string # The folder or zip file in the game's save directory which is currently mounted. +---@return boolean success # True if the archive was successfully unmounted, false otherwise. +function love.filesystem.unmount(archive) end + +--- +---Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents. +--- +---@param name string # The name (and path) of the file. +---@param data string # The string data to write to the file. +---@param size number # How many bytes to write. +---@return boolean success # If the operation was successful. +---@return string message # Error message if operation was unsuccessful. +function love.filesystem.write(name, data, size) end diff --git a/meta/3rd/love2d/library/love.font.lua b/meta/3rd/love2d/library/love.font.lua new file mode 100644 index 00000000..1c33106b --- /dev/null +++ b/meta/3rd/love2d/library/love.font.lua @@ -0,0 +1,44 @@ +---@class love.font +love.font = {} + +--- +---Creates a new BMFont Rasterizer. +--- +---@param imageData ImageData # The image data containing the drawable pictures of font glyphs. +---@param glyphs string # The sequence of glyphs in the ImageData. +---@param dpiscale number # DPI scale. +---@return Rasterizer rasterizer # The rasterizer. +function love.font.newBMFontRasterizer(imageData, glyphs, dpiscale) end + +--- +---Creates a new GlyphData. +--- +---@param rasterizer Rasterizer # The Rasterizer containing the font. +---@param glyph number # The character code of the glyph. +function love.font.newGlyphData(rasterizer, glyph) end + +--- +---Creates a new Image Rasterizer. +--- +---@param imageData ImageData # Font image data. +---@param glyphs string # String containing font glyphs. +---@param extraSpacing number # Font extra spacing. +---@param dpiscale number # Font DPI scale. +---@return Rasterizer rasterizer # The rasterizer. +function love.font.newImageRasterizer(imageData, glyphs, extraSpacing, dpiscale) end + +--- +---Creates a new Rasterizer. +--- +---@param filename string # The font file. +---@return Rasterizer rasterizer # The rasterizer. +function love.font.newRasterizer(filename) end + +--- +---Creates a new TrueType Rasterizer. +--- +---@param size number # The font size. +---@param hinting HintingMode # True Type hinting mode. +---@param dpiscale number # The font DPI scale. +---@return Rasterizer rasterizer # The rasterizer. +function love.font.newTrueTypeRasterizer(size, hinting, dpiscale) end diff --git a/meta/3rd/love2d/library/love.graphics.lua b/meta/3rd/love2d/library/love.graphics.lua new file mode 100644 index 00000000..b0bd6fc9 --- /dev/null +++ b/meta/3rd/love2d/library/love.graphics.lua @@ -0,0 +1,965 @@ +---@class love.graphics +love.graphics = {} + +--- +---Applies the given Transform object to the current coordinate transformation. +--- +---This effectively multiplies the existing coordinate transformation's matrix with the Transform object's internal matrix to produce the new coordinate transformation. +--- +---@param transform Transform # The Transform object to apply to the current graphics coordinate transform. +function love.graphics.applyTransform(transform) end + +--- +---Draws a filled or unfilled arc at position (x, y). The arc is drawn from angle1 to angle2 in radians. The segments parameter determines how many segments are used to draw the arc. The more segments, the smoother the edge. +--- +---@param drawmode DrawMode # How to draw the arc. +---@param x number # The position of the center along x-axis. +---@param y number # The position of the center along y-axis. +---@param radius number # Radius of the arc. +---@param angle1 number # The angle at which the arc begins. +---@param angle2 number # The angle at which the arc terminates. +---@param segments number # The number of segments used for drawing the arc. +function love.graphics.arc(drawmode, x, y, radius, angle1, angle2, segments) end + +--- +---Creates a screenshot once the current frame is done (after love.draw has finished). +--- +---Since this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what's drawn to the screen in that frame. +--- +---@param filename string # The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats. +function love.graphics.captureScreenshot(filename) end + +--- +---Draws a circle. +--- +---@param mode DrawMode # How to draw the circle. +---@param x number # The position of the center along x-axis. +---@param y number # The position of the center along y-axis. +---@param radius number # The radius of the circle. +function love.graphics.circle(mode, x, y, radius) end + +--- +---Clears the screen or active Canvas to the specified color. +--- +---This function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function. +--- +---Note that the scissor area bounds the cleared region. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---In versions prior to background color instead. +--- +function love.graphics.clear() end + +--- +---Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases. +--- +---If the active Canvas has just been changed and the 'replace' BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.discard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices. +--- +---On some desktop systems this function may do nothing. +--- +---@param discardcolor boolean # Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active.) +---@param discardstencil boolean # Whether to discard the contents of the stencil buffer of the screen / active Canvas. +function love.graphics.discard(discardcolor, discardstencil) end + +--- +---Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, Text object, or Video) on the screen with optional rotation, scaling and shearing. +--- +---Objects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system. +--- +---It's possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline. +--- +---Note that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation. +--- +---The right and bottom edges of the object are shifted at an angle defined by the shearing factors. +--- +---When using the default shader anything drawn with this function will be tinted according to the currently selected color. Set it to pure white to preserve the object's original colors. +--- +---@param drawable Drawable # A drawable object. +---@param x number # The position to draw the object (x-axis). +---@param y number # The position to draw the object (y-axis). +---@param r number # Orientation (radians). +---@param sx number # Scale factor (x-axis). +---@param sy number # Scale factor (y-axis). +---@param ox number # Origin offset (x-axis). +---@param oy number # Origin offset (y-axis). +---@param kx number # Shearing factor (x-axis). +---@param ky number # Shearing factor (y-axis). +function love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky) end + +--- +---Draws many instances of a Mesh with a single draw call, using hardware geometry instancing. +--- +---Each instance can have unique properties (positions, colors, etc.) but will not by default unless a custom per-instance vertex attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other. +--- +---Instancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check. +--- +---@param mesh Mesh # The mesh to render. +---@param instancecount number # The number of instances to render. +---@param x number # The position to draw the instances (x-axis). +---@param y number # The position to draw the instances (y-axis). +---@param r number # Orientation (radians). +---@param sx number # Scale factor (x-axis). +---@param sy number # Scale factor (y-axis). +---@param ox number # Origin offset (x-axis). +---@param oy number # Origin offset (y-axis). +---@param kx number # Shearing factor (x-axis). +---@param ky number # Shearing factor (y-axis). +function love.graphics.drawInstanced(mesh, instancecount, x, y, r, sx, sy, ox, oy, kx, ky) end + +--- +---Draws a layer of an Array Texture. +--- +---@param texture Texture # The Array Texture to draw. +---@param layerindex number # The index of the layer to use when drawing. +---@param x number # The position to draw the texture (x-axis). +---@param y number # The position to draw the texture (y-axis). +---@param r number # Orientation (radians). +---@param sx number # Scale factor (x-axis). +---@param sy number # Scale factor (y-axis). +---@param ox number # Origin offset (x-axis). +---@param oy number # Origin offset (y-axis). +---@param kx number # Shearing factor (x-axis). +---@param ky number # Shearing factor (y-axis). +function love.graphics.drawLayer(texture, layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end + +--- +---Draws an ellipse. +--- +---@param mode DrawMode # How to draw the ellipse. +---@param x number # The position of the center along x-axis. +---@param y number # The position of the center along y-axis. +---@param radiusx number # The radius of the ellipse along the x-axis (half the ellipse's width). +---@param radiusy number # The radius of the ellipse along the y-axis (half the ellipse's height). +function love.graphics.ellipse(mode, x, y, radiusx, radiusy) end + +--- +---Immediately renders any pending automatically batched draws. +--- +---LÖVE will call this function internally as needed when most state is changed, so it is not necessary to manually call it. +--- +---The current batch will be automatically flushed by color), as well as Shader:send and methods on Textures which change their state. Using a different Image in consecutive love.graphics.draw calls will also flush the current batch. +--- +---SpriteBatches, ParticleSystems, Meshes, and Text objects do their own batching and do not affect automatic batching of other draws, aside from flushing the current batch when they're drawn. +--- +function love.graphics.flushBatch() end + +--- +---Gets the current background color. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). +function love.graphics.getBackgroundColor() end + +--- +---Gets the blending mode. +--- +---@return BlendMode mode # The current blend mode. +---@return BlendAlphaMode alphamode # The current blend alpha mode – it determines how the alpha of drawn objects affects blending. +function love.graphics.getBlendMode() end + +--- +---Gets the current target Canvas. +--- +---@return Canvas canvas # The Canvas set by setCanvas. Returns nil if drawing to the real screen. +function love.graphics.getCanvas() end + +--- +---Gets the available Canvas formats, and whether each is supported. +--- +---@return table formats # A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats. +function love.graphics.getCanvasFormats() end + +--- +---Gets the current color. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). +function love.graphics.getColor() end + +--- +---Gets the active color components used when drawing. Normally all 4 components are active unless love.graphics.setColorMask has been used. +--- +---The color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love.graphics.clear and Canvas:clear as well. +--- +---@return boolean r # Whether the red color component is active when rendering. +---@return boolean g # Whether the green color component is active when rendering. +---@return boolean b # Whether the blue color component is active when rendering. +---@return boolean a # Whether the alpha color component is active when rendering. +function love.graphics.getColorMask() end + +--- +---Gets the DPI scale factor of the window. +--- +---The DPI scale factor represents relative pixel density. 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.graphics.getDPIScale() would return 2 in that case. +--- +---The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. +--- +---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. +--- +---@return number scale # The pixel scale factor associated with the window. +function love.graphics.getDPIScale() end + +--- +---Returns the default scaling filters used with Images, Canvases, and Fonts. +--- +---@return FilterMode min # Filter mode used when scaling the image down. +---@return FilterMode mag # Filter mode used when scaling the image up. +---@return number anisotropy # Maximum amount of Anisotropic Filtering used. +function love.graphics.getDefaultFilter() end + +--- +---Gets the current depth test mode and whether writing to the depth buffer is enabled. +--- +---This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images. +--- +---@return CompareMode comparemode # Depth comparison mode used for depth testing. +---@return boolean write # Whether to write update / write values to the depth buffer when rendering. +function love.graphics.getDepthMode() end + +--- +---Gets the width and height in pixels of the window. +--- +---@return number width # The width of the window. +---@return number height # The height of the window. +function love.graphics.getDimensions() end + +--- +---Gets the current Font object. +--- +---@return Font font # The current Font. Automatically creates and sets the default font, if none is set yet. +function love.graphics.getFont() end + +--- +---Gets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing. +--- +---This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices. +--- +---@return VertexWinding winding # The winding mode being used. The default winding is counterclockwise ('ccw'). +function love.graphics.getFrontFaceWinding() end + +--- +---Gets the height in pixels of the window. +--- +---@return number height # The height of the window. +function love.graphics.getHeight() end + +--- +---Gets the raw and compressed pixel formats usable for Images, and whether each is supported. +--- +---@return table formats # A table containing PixelFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats. +function love.graphics.getImageFormats() end + +--- +---Gets the line join style. +--- +---@return LineJoin join # The LineJoin style. +function love.graphics.getLineJoin() end + +--- +---Gets the line style. +--- +---@return LineStyle style # The current line style. +function love.graphics.getLineStyle() end + +--- +---Gets the current line width. +--- +---@return number width # The current line width. +function love.graphics.getLineWidth() end + +--- +---Gets whether back-facing triangles in a Mesh are culled. +--- +---Mesh face culling is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer. +--- +---@return CullMode mode # The Mesh face culling mode in use (whether to render everything, cull back-facing triangles, or cull front-facing triangles). +function love.graphics.getMeshCullMode() end + +--- +---Gets the width and height in pixels of the window. +--- +---love.graphics.getDimensions gets the dimensions of the window in units scaled by the screen's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing to the screen and using the graphics coordinate system (calculating the center of the screen, for example), and getPixelDimensions only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). +--- +---@return number pixelwidth # The width of the window in pixels. +---@return number pixelheight # The height of the window in pixels. +function love.graphics.getPixelDimenions() end + +--- +---Gets the height in pixels of the window. +--- +---The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getHeight for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelHeight only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). +--- +---@return number pixelheight # The height of the window in pixels. +function love.graphics.getPixelHeight() end + +--- +---Gets the width in pixels of the window. +--- +---The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). +--- +---@return number pixelwidth # The width of the window in pixels. +function love.graphics.getPixelWidth() end + +--- +---Gets the point size. +--- +---@return number size # The current point size. +function love.graphics.getPointSize() end + +--- +---Gets information about the system's video card and drivers. +--- +---@return string name # The name of the renderer, e.g. 'OpenGL' or 'OpenGL ES'. +---@return string version # The version of the renderer with some extra driver-dependent version info, e.g. '2.1 INTEL-8.10.44'. +---@return string vendor # The name of the graphics card vendor, e.g. 'Intel Inc'. +---@return string device # The name of the graphics card, e.g. 'Intel HD Graphics 3000 OpenGL Engine'. +function love.graphics.getRendererInfo() end + +--- +---Gets the current scissor box. +--- +---@return number x # The x-component of the top-left point of the box. +---@return number y # The y-component of the top-left point of the box. +---@return number width # The width of the box. +---@return number height # The height of the box. +function love.graphics.getScissor() end + +--- +---Gets the current Shader. Returns nil if none is set. +--- +---@return Shader shader # The currently active Shader, or nil if none is set. +function love.graphics.getShader() end + +--- +---Gets the current depth of the transform / state stack (the number of pushes without corresponding pops). +--- +---@return number depth # The current depth of the transform and state love.graphics stack. +function love.graphics.getStackDepth() end + +--- +---Gets performance-related rendering statistics. +--- +---@return table stats # A table with the following fields: +function love.graphics.getStats() end + +--- +---Gets the current stencil test configuration. +--- +---When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil. +--- +---Each Canvas has its own per-pixel stencil values. +--- +---@return CompareMode comparemode # The type of comparison that is made for each pixel. Will be 'always' if stencil testing is disabled. +---@return number comparevalue # The value used when comparing with the stencil value of each pixel. +function love.graphics.getStencilTest() end + +--- +---Gets the optional graphics features and whether they're supported on the system. +--- +---Some older or low-end systems don't always support all graphics features. +--- +---@return table features # A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported. +function love.graphics.getSupported() end + +--- +---Gets the system-dependent maximum values for love.graphics features. +--- +---@return table limits # A table containing GraphicsLimit keys, and number values. +function love.graphics.getSystemLimits() end + +--- +---Gets the available texture types, and whether each is supported. +--- +---@return table texturetypes # A table containing TextureTypes as keys, and a boolean indicating whether the type is supported as values. Not all systems support all types. +function love.graphics.getTextureTypes() end + +--- +---Gets the width in pixels of the window. +--- +---@return number width # The width of the window. +function love.graphics.getWidth() end + +--- +---Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like love.graphics.setScissor. +--- +---The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. +--- +---The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). +--- +---@param x number # The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. +---@param y number # The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. +---@param width number # The width of the rectangle to intersect with the existing scissor rectangle. +---@param height number # The height of the rectangle to intersect with the existing scissor rectangle. +function love.graphics.intersectScissor(x, y, width, height) end + +--- +---Converts the given 2D position from screen-space into global coordinates. +--- +---This effectively applies the reverse of the current graphics transformations to the given position. A similar Transform:inverseTransformPoint method exists for Transform objects. +--- +---@param screenX number # The x component of the screen-space position. +---@param screenY number # The y component of the screen-space position. +---@return number globalX # The x component of the position in global coordinates. +---@return number globalY # The y component of the position in global coordinates. +function love.graphics.inverseTransformPoint(screenX, screenY) end + +--- +---Gets whether the graphics module is able to be used. If it is not active, love.graphics function and method calls will not work correctly and may cause the program to crash. +---The graphics module is inactive if a window is not open, or if the app is in the background on iOS. Typically the app's execution will be automatically paused by the system, in the latter case. +--- +---@return boolean active # Whether the graphics module is active and able to be used. +function love.graphics.isActive() end + +--- +---Gets whether gamma-correct rendering is supported and enabled. It can be enabled by setting t.gammacorrect = true in love.conf. +--- +---Not all devices support gamma-correct rendering, in which case it will be automatically disabled and this function will return false. It is supported on desktop systems which have graphics cards that are capable of using OpenGL 3 / DirectX 10, and iOS devices that can use OpenGL ES 3. +--- +---@return boolean gammacorrect # True if gamma-correct rendering is supported and was enabled in love.conf, false otherwise. +function love.graphics.isGammaCorrect() end + +--- +---Gets whether wireframe mode is used when drawing. +--- +---@return boolean wireframe # True if wireframe lines are used when drawing, false if it's not. +function love.graphics.isWireframe() end + +--- +---Draws lines between points. +--- +---@param x1 number # The position of first point on the x-axis. +---@param y1 number # The position of first point on the y-axis. +---@param x2 number # The position of second point on the x-axis. +---@param y2 number # The position of second point on the y-axis. +---@param ... number # You can continue passing point positions to draw a polyline. +function love.graphics.line(x1, y1, x2, y2, ...) end + +--- +---Creates a new array Image. +--- +---An array image / array texture is a single object which contains multiple 'layers' or 'slices' of 2D sub-images. It can be thought of similarly to a texture atlas or sprite sheet, but it doesn't suffer from the same tile / quad bleeding artifacts that texture atlases do – although every sub-image must have the same dimensions. +--- +---A specific layer of an array image can be drawn with love.graphics.drawLayer / SpriteBatch:addLayer, or with the Quad variant of love.graphics.draw and Quad:setLayer, or via a custom Shader. +--- +---To use an array image in a Shader, it must be declared as a ArrayImage or sampler2DArray type (instead of Image or sampler2D). The Texel(ArrayImage image, vec3 texturecoord) shader function must be used to get pixel colors from a slice of the array image. The vec3 argument contains the texture coordinate in the first two components, and the 0-based slice index in the third component. +--- +---@param slices table # A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each sub-image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the slice index of that sub-table. +---@param settings table # Optional table of settings to configure the array image, containing the following fields: +---@return Image image # An Array Image object. +function love.graphics.newArrayImage(slices, settings) end + +--- +---Creates a new Canvas object for offscreen rendering. +--- +---@return Canvas canvas # A new Canvas with dimensions equal to the window's size in pixels. +function love.graphics.newCanvas() end + +--- +---Creates a new cubemap Image. +--- +---Cubemap images have 6 faces (sides) which represent a cube. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send). +--- +---To use a cubemap image in a Shader, it must be declared as a CubeImage or samplerCube type (instead of Image or sampler2D). The Texel(CubeImage image, vec3 direction) shader function must be used to get pixel colors from the cubemap. The vec3 argument is a normalized direction from the center of the cube, rather than explicit texture coordinates. +--- +---Each face in a cubemap image must have square dimensions. +--- +---For variants of this function which accept a single image containing multiple cubemap faces, they must be laid out in one of the following forms in the image: +--- +--- +y +--- +---+z +x -z +--- +--- -y +--- +--- -x +--- +---or: +--- +--- +y +--- +----x +z +x -z +--- +--- -y +--- +---or: +--- +---+x +--- +----x +--- +---+y +--- +----y +--- +---+z +--- +----z +--- +---or: +--- +---+x -x +y -y +z -z +--- +---@param filename string # The filepath to a cubemap image file (or a File, FileData, or ImageData). +---@param settings table # Optional table of settings to configure the cubemap image, containing the following fields: +---@return Image image # An cubemap Image object. +function love.graphics.newCubeImage(filename, settings) end + +--- +---Creates a new Font from a TrueType Font or BMFont file. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object. +--- +---All variants which accept a filename can also accept a Data object instead. +--- +---@param filename string # The filepath to the BMFont or TrueType font file. +---@return Font font # A Font object which can be used to draw text on screen. +function love.graphics.newFont(filename) end + +--- +---Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image. +--- +---@param filename string # The filepath to the image file. +---@return Image image # An Image object which can be drawn on screen. +function love.graphics.newImage(filename) end + +--- +---Creates a new specifically formatted image. +--- +---In versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string. +--- +---@param filename string # The filepath to the image file. +---@param glyphs string # A string of the characters in the image in order from left to right. +---@return Font font # A Font object which can be used to draw text on screen. +function love.graphics.newImageFont(filename, glyphs) end + +--- +---Creates a new Mesh. +--- +---Use Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it's drawn. +--- +---In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param vertices table # The table filled with vertex information tables for each vertex as follows: +---@param mode MeshDrawMode # How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. +---@param usage SpriteBatchUsage # The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. +---@return Mesh mesh # The new mesh. +function love.graphics.newMesh(vertices, mode, usage) end + +--- +---Creates a new ParticleSystem. +--- +---@param image Image # The image to use. +---@param buffer number # The max number of particles at the same time. +---@return ParticleSystem system # A new ParticleSystem. +function love.graphics.newParticleSystem(image, buffer) end + +--- +---Creates a new Quad. +--- +---The purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation. +--- +---@param x number # The top-left position in the Image along the x-axis. +---@param y number # The top-left position in the Image along the y-axis. +---@param width number # The width of the Quad in the Image. (Must be greater than 0.) +---@param height number # The height of the Quad in the Image. (Must be greater than 0.) +---@param sw number # The reference width, the width of the Image. (Must be greater than 0.) +---@param sh number # The reference height, the height of the Image. (Must be greater than 0.) +---@return Quad quad # The new Quad. +function love.graphics.newQuad(x, y, width, height, sw, sh) end + +--- +---Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both. +--- +---Shaders are small programs which are run on the graphics card when drawing. Vertex shaders are run once for each vertex (for example, an image has 4 vertices - one at each corner. A Mesh might have many more.) Pixel shaders are run once for each pixel on the screen which the drawn object touches. Pixel shader code is executed after all the object's vertices have been processed by the vertex shader. +--- +---@param code string # The pixel shader or vertex shader code, or a filename pointing to a file with the code. +---@return Shader shader # A Shader object for use in drawing operations. +function love.graphics.newShader(code) end + +--- +---Creates a new SpriteBatch object. +--- +---@param image Image # The Image to use for the sprites. +---@param maxsprites number # The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch. +---@return SpriteBatch spriteBatch # The new SpriteBatch. +function love.graphics.newSpriteBatch(image, maxsprites) end + +--- +---Creates a new drawable Text object. +--- +---@param font Font # The font to use for the text. +---@param textstring string # The initial string of text that the new Text object will contain. May be nil. +---@return Text text # The new drawable Text object. +function love.graphics.newText(font, textstring) end + +--- +---Creates a new drawable Video. Currently only Ogg Theora video files are supported. +--- +---@param filename string # The file path to the Ogg Theora video file. +---@return Video video # A new Video. +function love.graphics.newVideo(filename) end + +--- +---Creates a new volume (3D) Image. +--- +---Volume images are 3D textures with width, height, and depth. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send). +--- +---To use a volume image in a Shader, it must be declared as a VolumeImage or sampler3D type (instead of Image or sampler2D). The Texel(VolumeImage image, vec3 texcoords) shader function must be used to get pixel colors from the volume image. The vec3 argument is a normalized texture coordinate with the z component representing the depth to sample at (ranging from 1). +--- +---Volume images are typically used as lookup tables in shaders for color grading, for example, because sampling using a texture coordinate that is partway in between two pixels can interpolate across all 3 dimensions in the volume image, resulting in a smooth gradient even when a small-sized volume image is used as the lookup table. +--- +---Array images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them. +--- +---@param layers table # A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap. +---@param settings table # Optional table of settings to configure the volume image, containing the following fields: +---@return Image image # A volume Image object. +function love.graphics.newVolumeImage(layers, settings) end + +--- +---Resets the current coordinate transformation. +--- +---This function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults. +--- +function love.graphics.origin() end + +--- +---Draws one or more points. +--- +---@param x number # The position of the first point on the x-axis. +---@param y number # The position of the first point on the y-axis. +---@param ... number # The x and y coordinates of additional points. +function love.graphics.points(x, y, ...) end + +--- +---Draw a polygon. +--- +---Following the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon's vertices. +--- +---@param mode DrawMode # How to draw the polygon. +---@param ... number # The vertices of the polygon. +function love.graphics.polygon(mode, ...) end + +--- +---Pops the current coordinate transformation from the transformation stack. +--- +---This function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push. +--- +function love.graphics.pop() end + +--- +---Displays the results of drawing operations on the screen. +--- +---This function is used when writing your own love.run function. It presents all the results of your drawing operations on the screen. See the example in love.run for a typical use of this function. +--- +function love.graphics.present() end + +--- +---Draws text on screen. If no Font is set, one will be created and set (once) if needed. +--- +---As of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don't script with this in mind, the text won't be in the right position, or possibly even on screen. +--- +---love.graphics.print and love.graphics.printf both support UTF-8 encoding. You'll also need a proper Font for special characters. +--- +---In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param text string # The text to draw. +---@param x number # The position to draw the object (x-axis). +---@param y number # The position to draw the object (y-axis). +---@param r number # Orientation (radians). +---@param sx number # Scale factor (x-axis). +---@param sy number # Scale factor (y-axis). +---@param ox number # Origin offset (x-axis). +---@param oy number # Origin offset (y-axis). +---@param kx number # Shearing factor (x-axis). +---@param ky number # Shearing factor (y-axis). +function love.graphics.print(text, x, y, r, sx, sy, ox, oy, kx, ky) end + +--- +---Draws formatted text, with word wrap and alignment. +--- +---See additional notes in love.graphics.print. +--- +---The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. +--- +---In version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case. +--- +---In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param text string # A text string. +---@param x number # The position on the x-axis. +---@param y number # The position on the y-axis. +---@param limit number # Wrap the line after this many horizontal pixels. +---@param align AlignMode # The alignment. +---@param r number # Orientation (radians). +---@param sx number # Scale factor (x-axis). +---@param sy number # Scale factor (y-axis). +---@param ox number # Origin offset (x-axis). +---@param oy number # Origin offset (y-axis). +---@param kx number # Shearing factor (x-axis). +---@param ky number # Shearing factor (y-axis). +function love.graphics.printf(text, x, y, limit, align, r, sx, sy, ox, oy, kx, ky) end + +--- +---Copies and pushes the current coordinate transformation to the transformation stack. +--- +---This function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push. +--- +function love.graphics.push() end + +--- +---Draws a rectangle. +--- +---@param mode DrawMode # How to draw the rectangle. +---@param x number # The position of top-left corner along the x-axis. +---@param y number # The position of top-left corner along the y-axis. +---@param width number # Width of the rectangle. +---@param height number # Height of the rectangle. +function love.graphics.rectangle(mode, x, y, width, height) end + +--- +---Replaces the current coordinate transformation with the given Transform object. +--- +---@param transform Transform # The Transform object to replace the current graphics coordinate transform with. +function love.graphics.replaceTransform(transform) end + +--- +---Resets the current graphics settings. +--- +---Calling reset makes the current drawing color white, the current background color black, disables any active color component masks, disables wireframe mode and resets the current graphics transformation to the origin. It also sets both the point and line drawing modes to smooth and their sizes to 1.0. +--- +function love.graphics.reset() end + +--- +---Rotates the coordinate system in two dimensions. +--- +---Calling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw() exits. +--- +---@param angle number # The amount to rotate the coordinate system in radians. +function love.graphics.rotate(angle) end + +--- +---Scales the coordinate system in two dimensions. +--- +---By default the coordinate system in LÖVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation. +--- +---After scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation. +--- +---Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. +--- +---Scaling lasts until love.draw() exits. +--- +---@param sx number # The scaling in the direction of the x-axis. +---@param sy number # The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx. +function love.graphics.scale(sx, sy) end + +--- +---Sets the background color. +--- +---@param red number # The red component (0-1). +---@param green number # The green component (0-1). +---@param blue number # The blue component (0-1). +---@param alpha number # The alpha component (0-1). +function love.graphics.setBackgroundColor(red, green, blue, alpha) end + +--- +---Sets the blending mode. +--- +---@param mode BlendMode # The blend mode to use. +function love.graphics.setBlendMode(mode) end + +--- +---Captures drawing operations to a Canvas. +--- +---@param canvas Canvas # The new target. +---@param mipmap number # The mipmap level to render to, for Canvases with mipmaps. +function love.graphics.setCanvas(canvas, mipmap) end + +--- +---Sets the color used for drawing. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param red number # The amount of red. +---@param green number # The amount of green. +---@param blue number # The amount of blue. +---@param alpha number # The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image. +function love.graphics.setColor(red, green, blue, alpha) end + +--- +---Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if '''red''' is set to '''false''', no further changes will be made to the red component of any pixels. +--- +---@param red boolean # Render red component. +---@param green boolean # Render green component. +---@param blue boolean # Render blue component. +---@param alpha boolean # Render alpha component. +function love.graphics.setColorMask(red, green, blue, alpha) end + +--- +---Sets the default scaling filters used with Images, Canvases, and Fonts. +--- +---@param min FilterMode # Filter mode used when scaling the image down. +---@param mag FilterMode # Filter mode used when scaling the image up. +---@param anisotropy number # Maximum amount of Anisotropic Filtering used. +function love.graphics.setDefaultFilter(min, mag, anisotropy) end + +--- +---Configures depth testing and writing to the depth buffer. +--- +---This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images. +--- +---@param comparemode CompareMode # Depth comparison mode used for depth testing. +---@param write boolean # Whether to write update / write values to the depth buffer when rendering. +function love.graphics.setDepthMode(comparemode, write) end + +--- +---Set an already-loaded Font as the current font or create and load a new one from the file and size. +--- +---It's recommended that Font objects are created with love.graphics.newFont in the loading stage and then passed to this function in the drawing stage. +--- +---@param font Font # The Font object to use. +function love.graphics.setFont(font) end + +--- +---Sets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing. +--- +---This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices. +--- +---@param winding VertexWinding # The winding mode to use. The default winding is counterclockwise ('ccw'). +function love.graphics.setFrontFaceWinding(winding) end + +--- +---Sets the line join style. See LineJoin for the possible options. +--- +---@param join LineJoin # The LineJoin to use. +function love.graphics.setLineJoin(join) end + +--- +---Sets the line style. +--- +---@param style LineStyle # The LineStyle to use. Line styles include smooth and rough. +function love.graphics.setLineStyle(style) end + +--- +---Sets the line width. +--- +---@param width number # The width of the line. +function love.graphics.setLineWidth(width) end + +--- +---Sets whether back-facing triangles in a Mesh are culled. +--- +---This is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer. +--- +---By default, both front- and back-facing triangles in Meshes are rendered. +--- +---@param mode CullMode # The Mesh face culling mode to use (whether to render everything, cull back-facing triangles, or cull front-facing triangles). +function love.graphics.setMeshCullMode(mode) end + +--- +---Creates and sets a new Font. +--- +---@param size number # The size of the font. +---@return Font font # The new font. +function love.graphics.setNewFont(size) end + +--- +---Sets the point size. +--- +---@param size number # The new point size. +function love.graphics.setPointSize(size) end + +--- +---Sets or disables scissor. +--- +---The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. +--- +---The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). +--- +---@param x number # x coordinate of upper left corner. +---@param y number # y coordinate of upper left corner. +---@param width number # width of clipping rectangle. +---@param height number # height of clipping rectangle. +function love.graphics.setScissor(x, y, width, height) end + +--- +---Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next ''love.graphics.setShader'' will be drawn using the Shader object specified. +--- +---@param shader Shader # The new shader. +function love.graphics.setShader(shader) end + +--- +---Configures or disables stencil testing. +--- +---When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil. +--- +---@param comparemode CompareMode # The type of comparison to make for each pixel. +---@param comparevalue number # The value to use when comparing with the stencil value of each pixel. Must be between 0 and 255. +function love.graphics.setStencilTest(comparemode, comparevalue) end + +--- +---Sets whether wireframe lines will be used when drawing. +--- +---@param enable boolean # True to enable wireframe mode when drawing, false to disable it. +function love.graphics.setWireframe(enable) end + +--- +---Shears the coordinate system. +--- +---@param kx number # The shear factor on the x-axis. +---@param ky number # The shear factor on the y-axis. +function love.graphics.shear(kx, ky) end + +--- +---Draws geometry as a stencil. +--- +---The geometry drawn by the supplied function sets invisible stencil values of pixels, instead of setting pixel colors. The stencil buffer (which contains those stencil values) can act like a mask / stencil - love.graphics.setStencilTest can be used afterward to determine how further rendering is affected by the stencil values in each pixel. +--- +---Stencil values are integers within the range of 255. +--- +---@param stencilfunction function # Function which draws geometry. The stencil values of pixels, rather than the color of each pixel, will be affected by the geometry. +---@param action StencilAction # How to modify any stencil values of pixels that are touched by what's drawn in the stencil function. +---@param value number # The new stencil value to use for pixels if the 'replace' stencil action is used. Has no effect with other stencil actions. Must be between 0 and 255. +---@param keepvalues boolean # True to preserve old stencil values of pixels, false to re-set every pixel's stencil value to 0 before executing the stencil function. love.graphics.clear will also re-set all stencil values. +function love.graphics.stencil(stencilfunction, action, value, keepvalues) end + +--- +---Converts the given 2D position from global coordinates into screen-space. +--- +---This effectively applies the current graphics transformations to the given position. A similar Transform:transformPoint method exists for Transform objects. +--- +---@param globalX number # The x component of the position in global coordinates. +---@param globalY number # The y component of the position in global coordinates. +---@return number screenX # The x component of the position with graphics transformations applied. +---@return number screenY # The y component of the position with graphics transformations applied. +function love.graphics.transformPoint(globalX, globalY) end + +--- +---Translates the coordinate system in two dimensions. +--- +---When this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy. +--- +---Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. +--- +---This change lasts until love.draw() exits or else a love.graphics.pop reverts to a previous love.graphics.push. +--- +---Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating. +--- +---@param dx number # The translation relative to the x-axis. +---@param dy number # The translation relative to the y-axis. +function love.graphics.translate(dx, dy) end + +--- +---Validates shader code. Check if specified shader code does not contain any errors. +--- +---@param gles boolean # Validate code as GLSL ES shader. +---@param code string # The pixel shader or vertex shader code, or a filename pointing to a file with the code. +---@return boolean status # true if specified shader code doesn't contain any errors. false otherwise. +---@return string message # Reason why shader code validation failed (or nil if validation succeded). +function love.graphics.validateShader(gles, code) end diff --git a/meta/3rd/love2d/library/love.image.lua b/meta/3rd/love2d/library/love.image.lua new file mode 100644 index 00000000..8101e071 --- /dev/null +++ b/meta/3rd/love2d/library/love.image.lua @@ -0,0 +1,24 @@ +---@class love.image +love.image = {} + +--- +---Determines whether a file can be loaded as CompressedImageData. +--- +---@param filename string # The filename of the potentially compressed image file. +---@return boolean compressed # Whether the file can be loaded as CompressedImageData or not. +function love.image.isCompressed(filename) end + +--- +---Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page. +--- +---@param filename string # The filename of the compressed image file. +---@return CompressedImageData compressedImageData # The new CompressedImageData object. +function love.image.newCompressedData(filename) end + +--- +---Creates a new ImageData object. +--- +---@param width number # The width of the ImageData. +---@param height number # The height of the ImageData. +---@return ImageData imageData # The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero. +function love.image.newImageData(width, height) end diff --git a/meta/3rd/love2d/library/love.joystick.lua b/meta/3rd/love2d/library/love.joystick.lua new file mode 100644 index 00000000..ec29c3c8 --- /dev/null +++ b/meta/3rd/love2d/library/love.joystick.lua @@ -0,0 +1,55 @@ +---@class love.joystick +love.joystick = {} + +--- +---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. +--- +---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. +--- +---@param guid string # The GUID value to get the mapping string for. +---@return string mappingstring # A string containing the Joystick's gamepad mappings, or nil if the GUID is not recognized as a gamepad. +function love.joystick.getGamepadMappingString(guid) end + +--- +---Gets the number of connected joysticks. +--- +---@return number joystickcount # The number of connected joysticks. +function love.joystick.getJoystickCount() end + +--- +---Gets a list of connected Joysticks. +--- +---@return table joysticks # The list of currently connected Joysticks. +function love.joystick.getJoysticks() end + +--- +---Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings. +--- +---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. +--- +---@param filename string # The filename to load the mappings string from. +function love.joystick.loadGamepadMappings(filename) end + +--- +---Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified. +--- +---The mappings are stored as a string for use with love.joystick.loadGamepadMappings. +--- +---@param filename string # The filename to save the mappings string to. +---@return string mappings # The mappings string that was written to the file. +function love.joystick.saveGamepadMappings(filename) end + +--- +---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. +--- +---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. +--- +---The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout. +--- +---@param guid string # The OS-dependent GUID for the type of Joystick the binding will affect. +---@param button GamepadButton # The virtual gamepad button to bind. +---@param inputtype JoystickInputType # The type of input to bind the virtual gamepad button to. +---@param inputindex number # The index of the axis, button, or hat to bind the virtual gamepad button to. +---@param hatdir JoystickHat # The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise. +---@return boolean success # Whether the virtual gamepad button was successfully bound. +function love.joystick.setGamepadMapping(guid, button, inputtype, inputindex, hatdir) end diff --git a/meta/3rd/love2d/library/love.keyboard.lua b/meta/3rd/love2d/library/love.keyboard.lua new file mode 100644 index 00000000..a1d06596 --- /dev/null +++ b/meta/3rd/love2d/library/love.keyboard.lua @@ -0,0 +1,73 @@ +---@class love.keyboard +love.keyboard = {} + +--- +---Gets the key corresponding to the given hardware scancode. +--- +---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. +--- +---Scancodes are useful for creating default controls that have the same physical locations on on all systems. +--- +---@param scancode Scancode # The scancode to get the key from. +---@return KeyConstant key # The key corresponding to the given scancode, or 'unknown' if the scancode doesn't map to a KeyConstant on the current system. +function love.keyboard.getKeyFromScancode(scancode) end + +--- +---Gets the hardware scancode corresponding to the given key. +--- +---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. +--- +---Scancodes are useful for creating default controls that have the same physical locations on on all systems. +--- +---@param key KeyConstant # The key to get the scancode from. +---@return Scancode scancode # The scancode corresponding to the given key, or 'unknown' if the given key has no known physical representation on the current system. +function love.keyboard.getScancodeFromKey(key) end + +--- +---Gets whether key repeat is enabled. +--- +---@return boolean enabled # Whether key repeat is enabled. +function love.keyboard.hasKeyRepeat() end + +--- +---Gets whether screen keyboard is supported. +--- +---@return boolean supported # Whether screen keyboard is supported. +function love.keyboard.hasScreenKeyboard() end + +--- +---Gets whether text input events are enabled. +--- +---@return boolean enabled # Whether text input events are enabled. +function love.keyboard.hasTextInput() end + +--- +---Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased. +--- +---@param key KeyConstant # The key to check. +---@return boolean down # True if the key is down, false if not. +function love.keyboard.isDown(key) end + +--- +---Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased. +--- +---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. +--- +---@param scancode Scancode # A Scancode to check. +---@param ... Scancode # Additional Scancodes to check. +---@return boolean down # True if any supplied Scancode is down, false if not. +function love.keyboard.isScancodeDown(scancode, ...) end + +--- +---Enables or disables key repeat for love.keypressed. It is disabled by default. +--- +---@param enable boolean # Whether repeat keypress events should be enabled when a key is held down. +function love.keyboard.setKeyRepeat(enable) end + +--- +---Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android. +--- +---On touch devices, this shows the system's native on-screen keyboard when it's enabled. +--- +---@param enable boolean # Whether text input events should be enabled. +function love.keyboard.setTextInput(enable) end diff --git a/meta/3rd/love2d/library/love.lua b/meta/3rd/love2d/library/love.lua new file mode 100644 index 00000000..eb1324e5 --- /dev/null +++ b/meta/3rd/love2d/library/love.lua @@ -0,0 +1,27 @@ +---@class love +love = {} + +--- +---Gets the current running version of LÖVE. +--- +---@return number major # The major version of LÖVE, i.e. 0 for version 0.9.1. +---@return number minor # The minor version of LÖVE, i.e. 9 for version 0.9.1. +---@return number revision # The revision version of LÖVE, i.e. 1 for version 0.9.1. +---@return string codename # The codename of the current version, i.e. 'Baby Inspector' for version 0.9.1. +function love.getVersion() end + +--- +---Gets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise. +--- +---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. +--- +---@return boolean enabled # Whether deprecation output is enabled. +function love.hasDeprecationOutput() end + +--- +---Sets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise. +--- +---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. +--- +---@param enable boolean # Whether to enable or disable deprecation output. +function love.setDeprecationOutput(enable) end diff --git a/meta/3rd/love2d/library/love.math.lua b/meta/3rd/love2d/library/love.math.lua new file mode 100644 index 00000000..d6ffac28 --- /dev/null +++ b/meta/3rd/love2d/library/love.math.lua @@ -0,0 +1,169 @@ +---@class love.math +love.math = {} + +--- +---Converts a color from 0..255 to 0..1 range. +--- +---@param rb number # Red color component in 0..255 range. +---@param gb number # Green color component in 0..255 range. +---@param bb number # Blue color component in 0..255 range. +---@param ab number # Alpha color component in 0..255 range. +---@return number r # Red color component in 0..1 range. +---@return number g # Green color component in 0..1 range. +---@return number b # Blue color component in 0..1 range. +---@return number a # Alpha color component in 0..1 range or nil if alpha is not specified. +function love.math.colorFromBytes(rb, gb, bb, ab) end + +--- +---Converts a color from 0..1 to 0..255 range. +--- +---@param r number # Red color component. +---@param g number # Green color component. +---@param b number # Blue color component. +---@param a number # Alpha color component. +---@return number rb # Red color component in 0..255 range. +---@return number gb # Green color component in 0..255 range. +---@return number bb # Blue color component in 0..255 range. +---@return number ab # Alpha color component in 0..255 range or nil if alpha is not specified. +function love.math.colorToBytes(r, g, b, a) end + +--- +---Compresses a string or data using a specific compression algorithm. +--- +---@param rawstring string # The raw (un-compressed) string to compress. +---@param format CompressedDataFormat # The format to use when compressing the string. +---@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. +---@return CompressedData compressedData # A new Data object containing the compressed version of the string. +function love.math.compress(rawstring, format, level) end + +--- +---Decompresses a CompressedData or previously compressed string or Data object. +--- +---@param compressedData CompressedData # The compressed data to decompress. +---@return string rawstring # A string containing the raw decompressed data. +function love.math.decompress(compressedData) end + +--- +---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. +--- +---Read more about gamma-correct rendering here, here, and here. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param r number # The red channel of the sRGB color to convert. +---@param g number # The green channel of the sRGB color to convert. +---@param b number # The blue channel of the sRGB color to convert. +---@return number lr # The red channel of the converted color in linear RGB space. +---@return number lg # The green channel of the converted color in linear RGB space. +---@return number lb # The blue channel of the converted color in linear RGB space. +function love.math.gammaToLinear(r, g, b) end + +--- +---Gets the seed of the random number generator. +--- +---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. +--- +---@return number low # Integer number representing the lower 32 bits of the random number generator's 64 bit seed value. +---@return number high # Integer number representing the higher 32 bits of the random number generator's 64 bit seed value. +function love.math.getRandomSeed() end + +--- +---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. +--- +---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. +--- +---@return string state # The current state of the random number generator, represented as a string. +function love.math.getRandomState() end + +--- +---Checks whether a polygon is convex. +--- +---PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons. +--- +---@param vertices table # The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. +---@return boolean convex # Whether the given polygon is convex. +function love.math.isConvex(vertices) end + +--- +---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. +--- +---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. +--- +---Read more about gamma-correct rendering here, here, and here. +--- +---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. +--- +---@param lr number # The red channel of the linear RGB color to convert. +---@param lg number # The green channel of the linear RGB color to convert. +---@param lb number # The blue channel of the linear RGB color to convert. +---@return number cr # The red channel of the converted color in gamma sRGB space. +---@return number cg # The green channel of the converted color in gamma sRGB space. +---@return number cb # The blue channel of the converted color in gamma sRGB space. +function love.math.linearToGamma(lr, lg, lb) end + +--- +---Creates a new BezierCurve object. +--- +---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. +--- +---@param vertices table # The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. +---@return BezierCurve curve # A Bézier curve object. +function love.math.newBezierCurve(vertices) end + +--- +---Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions. +--- +---@return RandomGenerator rng # The new Random Number Generator object. +function love.math.newRandomGenerator() end + +--- +---Creates a new Transform object. +--- +---@return Transform transform # The new Transform object. +function love.math.newTransform() end + +--- +---Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments. +--- +---Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation. +--- +---There are many webpages which discuss Perlin and Simplex noise in detail. +--- +---@param x number # The number used to generate the noise value. +---@return number value # The noise value in the range of 1. +function love.math.noise(x) end + +--- +---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. +--- +---@return number number # The pseudo-random number. +function love.math.random() end + +--- +---Get a normally distributed pseudo random number. +--- +---@param stddev number # Standard deviation of the distribution. +---@param mean number # The mean of the distribution. +---@return number number # Normally distributed random number with variance (stddev)² and the specified mean. +function love.math.randomNormal(stddev, mean) end + +--- +---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. +--- +---@param seed number # The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1. +function love.math.setRandomSeed(seed) end + +--- +---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. +--- +---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. +--- +---@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. +function love.math.setRandomState(state) end + +--- +---Decomposes a simple convex or concave polygon into triangles. +--- +---@param polygon table # Polygon to triangulate. Must not intersect itself. +---@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}, ...}. +function love.math.triangulate(polygon) end diff --git a/meta/3rd/love2d/library/love.mouse.lua b/meta/3rd/love2d/library/love.mouse.lua new file mode 100644 index 00000000..6a0dc64e --- /dev/null +++ b/meta/3rd/love2d/library/love.mouse.lua @@ -0,0 +1,140 @@ +---@class love.mouse +love.mouse = {} + +--- +---Gets the current Cursor. +--- +---@return Cursor cursor # The current cursor, or nil if no cursor is set. +function love.mouse.getCursor() end + +--- +---Returns the current position of the mouse. +--- +---@return number x # The position of the mouse along the x-axis. +---@return number y # The position of the mouse along the y-axis. +function love.mouse.getPosition() end + +--- +---Gets whether relative mode is enabled for the mouse. +--- +---If relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen. +--- +---The reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated. +--- +---@return boolean enabled # True if relative mode is enabled, false if it's disabled. +function love.mouse.getRelativeMode() end + +--- +---Gets a Cursor object representing a system-native hardware cursor. +--- +---Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates. +--- +---@param ctype CursorType # The type of system cursor to get. +---@return Cursor cursor # The Cursor object representing the system cursor type. +function love.mouse.getSystemCursor(ctype) end + +--- +---Returns the current x-position of the mouse. +--- +---@return number x # The position of the mouse along the x-axis. +function love.mouse.getX() end + +--- +---Returns the current y-position of the mouse. +--- +---@return number y # The position of the mouse along the y-axis. +function love.mouse.getY() end + +--- +---Gets whether cursor functionality is supported. +--- +---If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors. +--- +---@return boolean supported # Whether the system has cursor functionality. +function love.mouse.isCursorSupported() end + +--- +---Checks whether a certain mouse button is down. +--- +---This function does not detect mouse wheel scrolling; you must use the love.wheelmoved (or love.mousepressed in version 0.9.2 and older) callback for that. +--- +---@param button number # The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependant. +---@param ... number # Additional button numbers to check. +---@return boolean down # True if any specified button is down. +function love.mouse.isDown(button, ...) end + +--- +---Checks if the mouse is grabbed. +--- +---@return boolean grabbed # True if the cursor is grabbed, false if it is not. +function love.mouse.isGrabbed() end + +--- +---Checks if the cursor is visible. +--- +---@return boolean visible # True if the cursor to visible, false if the cursor is hidden. +function love.mouse.isVisible() end + +--- +---Creates a new hardware Cursor object from an image file or ImageData. +--- +---Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates. +--- +---The hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is. For example, the normal arrow pointer normally has its hot spot at the top left of the image, but a crosshair cursor might have it in the middle. +--- +---@param imageData ImageData # The ImageData to use for the new Cursor. +---@param hotx number # The x-coordinate in the ImageData of the cursor's hot spot. +---@param hoty number # The y-coordinate in the ImageData of the cursor's hot spot. +---@return Cursor cursor # The new Cursor object. +function love.mouse.newCursor(imageData, hotx, hoty) end + +--- +---Sets the current mouse cursor. +--- +---@param cursor Cursor # The Cursor object to use as the current mouse cursor. +function love.mouse.setCursor(cursor) end + +--- +---Grabs the mouse and confines it to the window. +--- +---@param grab boolean # True to confine the mouse, false to let it leave the window. +function love.mouse.setGrabbed(grab) end + +--- +---Sets the current position of the mouse. Non-integer values are floored. +--- +---@param x number # The new position of the mouse along the x-axis. +---@param y number # The new position of the mouse along the y-axis. +function love.mouse.setPosition(x, y) end + +--- +---Sets whether relative mode is enabled for the mouse. +--- +---When relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen. +--- +---The reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated. +--- +---@param enable boolean # True to enable relative mode, false to disable it. +function love.mouse.setRelativeMode(enable) end + +--- +---Sets the current visibility of the cursor. +--- +---@param visible boolean # True to set the cursor to visible, false to hide the cursor. +function love.mouse.setVisible(visible) end + +--- +---Sets the current X position of the mouse. +--- +---Non-integer values are floored. +--- +---@param x number # The new position of the mouse along the x-axis. +function love.mouse.setX(x) end + +--- +---Sets the current Y position of the mouse. +--- +---Non-integer values are floored. +--- +---@param y number # The new position of the mouse along the y-axis. +function love.mouse.setY(y) end diff --git a/meta/3rd/love2d/library/love.physics.lua b/meta/3rd/love2d/library/love.physics.lua new file mode 100644 index 00000000..91428e61 --- /dev/null +++ b/meta/3rd/love2d/library/love.physics.lua @@ -0,0 +1,280 @@ +---@class love.physics +love.physics = {} + +--- +---Returns the two closest points between two fixtures and their distance. +--- +---@param fixture1 Fixture # The first fixture. +---@param fixture2 Fixture # The second fixture. +---@return number distance # The distance of the two points. +---@return number x1 # The x-coordinate of the first point. +---@return number y1 # The y-coordinate of the first point. +---@return number x2 # The x-coordinate of the second point. +---@return number y2 # The y-coordinate of the second point. +function love.physics.getDistance(fixture1, fixture2) end + +--- +---Returns the meter scale factor. +--- +---All coordinates in the physics module are divided by this number, creating a convenient way to draw the objects directly to the screen without the need for graphics transformations. +--- +---It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. +--- +---@return number scale # The scale factor as an integer. +function love.physics.getMeter() end + +--- +---Creates a new body. +--- +---There are three types of bodies. +--- +---* Static bodies do not move, have a infinite mass, and can be used for level boundaries. +--- +---* Dynamic bodies are the main actors in the simulation, they collide with everything. +--- +---* Kinematic bodies do not react to forces and only collide with dynamic bodies. +--- +---The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData. +--- +---@param world World # The world to create the body in. +---@param x number # The x position of the body. +---@param y number # The y position of the body. +---@param type BodyType # The type of the body. +---@return Body body # A new body. +function love.physics.newBody(world, x, y, type) end + +--- +---Creates a new ChainShape. +--- +---@param loop boolean # If the chain should loop back to the first point. +---@param x1 number # The x position of the first point. +---@param y1 number # The y position of the first point. +---@param x2 number # The x position of the second point. +---@param y2 number # The y position of the second point. +---@param ... number # Additional point positions. +---@return ChainShape shape # The new shape. +function love.physics.newChainShape(loop, x1, y1, x2, y2, ...) end + +--- +---Creates a new CircleShape. +--- +---@param radius number # The radius of the circle. +---@return CircleShape shape # The new shape. +function love.physics.newCircleShape(radius) end + +--- +---Creates a DistanceJoint between two bodies. +--- +---This joint constrains the distance between two points on two bodies to be constant. These two points are specified in world coordinates and the two bodies are assumed to be in place when this joint is created. The first anchor point is connected to the first body and the second to the second body, and the points define the length of the distance joint. +--- +---@param body1 Body # The first body to attach to the joint. +---@param body2 Body # The second body to attach to the joint. +---@param x1 number # The x position of the first anchor point (world space). +---@param y1 number # The y position of the first anchor point (world space). +---@param x2 number # The x position of the second anchor point (world space). +---@param y2 number # The y position of the second anchor point (world space). +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return DistanceJoint joint # The new distance joint. +function love.physics.newDistanceJoint(body1, body2, x1, y1, x2, y2, collideConnected) end + +--- +---Creates a new EdgeShape. +--- +---@param x1 number # The x position of the first point. +---@param y1 number # The y position of the first point. +---@param x2 number # The x position of the second point. +---@param y2 number # The y position of the second point. +---@return EdgeShape shape # The new shape. +function love.physics.newEdgeShape(x1, y1, x2, y2) end + +--- +---Creates and attaches a Fixture to a body. +--- +---Note that the Shape object is copied rather than kept as a reference when the Fixture is created. To get the Shape object that the Fixture owns, use Fixture:getShape. +--- +---@param body Body # The body which gets the fixture attached. +---@param shape Shape # The shape to be copied to the fixture. +---@param density number # The density of the fixture. +---@return Fixture fixture # The new fixture. +function love.physics.newFixture(body, shape, density) end + +--- +---Create a friction joint between two bodies. A FrictionJoint applies friction to a body. +--- +---@param body1 Body # The first body to attach to the joint. +---@param body2 Body # The second body to attach to the joint. +---@param x number # The x position of the anchor point. +---@param y number # The y position of the anchor point. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return FrictionJoint joint # The new FrictionJoint. +function love.physics.newFrictionJoint(body1, body2, x, y, collideConnected) end + +--- +---Create a GearJoint connecting two Joints. +--- +---The gear joint connects two joints that must be either prismatic or revolute joints. Using this joint requires that the joints it uses connect their respective bodies to the ground and have the ground as the first body. When destroying the bodies and joints you must make sure you destroy the gear joint before the other joints. +--- +---The gear joint has a ratio the determines how the angular or distance values of the connected joints relate to each other. The formula coordinate1 + ratio * coordinate2 always has a constant value that is set when the gear joint is created. +--- +---@param joint1 Joint # The first joint to connect with a gear joint. +---@param joint2 Joint # The second joint to connect with a gear joint. +---@param ratio number # The gear ratio. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return GearJoint joint # The new gear joint. +function love.physics.newGearJoint(joint1, joint2, ratio, collideConnected) end + +--- +---Creates a joint between two bodies which controls the relative motion between them. +--- +---Position and rotation offsets can be specified once the MotorJoint has been created, as well as the maximum motor force and torque that will be be applied to reach the target offsets. +--- +---@param body1 Body # The first body to attach to the joint. +---@param body2 Body # The second body to attach to the joint. +---@param correctionFactor number # The joint's initial position correction factor, in the range of 1. +---@return MotorJoint joint # The new MotorJoint. +function love.physics.newMotorJoint(body1, body2, correctionFactor) end + +--- +---Create a joint between a body and the mouse. +--- +---This joint actually connects the body to a fixed point in the world. To make it follow the mouse, the fixed point must be updated every timestep (example below). +--- +---The advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine. +--- +---@param body Body # The body to attach to the mouse. +---@param x number # The x position of the connecting point. +---@param y number # The y position of the connecting point. +---@return MouseJoint joint # The new mouse joint. +function love.physics.newMouseJoint(body, x, y) end + +--- +---Creates a new PolygonShape. +--- +---This shape can have 8 vertices at most, and must form a convex shape. +--- +---@param x1 number # The x position of the first point. +---@param y1 number # The y position of the first point. +---@param x2 number # The x position of the second point. +---@param y2 number # The y position of the second point. +---@param x3 number # The x position of the third point. +---@param y3 number # The y position of the third point. +---@param ... number # You can continue passing more point positions to create the PolygonShape. +---@return PolygonShape shape # A new PolygonShape. +function love.physics.newPolygonShape(x1, y1, x2, y2, x3, y3, ...) end + +--- +---Creates a PrismaticJoint between two bodies. +--- +---A prismatic joint constrains two bodies to move relatively to each other on a specified axis. It does not allow for relative rotation. Its definition and operation are similar to a revolute joint, but with translation and force substituted for angle and torque. +--- +---@param body1 Body # The first body to connect with a prismatic joint. +---@param body2 Body # The second body to connect with a prismatic joint. +---@param x number # The x coordinate of the anchor point. +---@param y number # The y coordinate of the anchor point. +---@param ax number # The x coordinate of the axis vector. +---@param ay number # The y coordinate of the axis vector. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return PrismaticJoint joint # The new prismatic joint. +function love.physics.newPrismaticJoint(body1, body2, x, y, ax, ay, collideConnected) end + +--- +---Creates a PulleyJoint to join two bodies to each other and the ground. +--- +---The pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant length1 + ratio * length2, which is set when the pulley joint is created. +--- +---Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths be used to constrain the maximum lengths each side can attain. +--- +---@param body1 Body # The first body to connect with a pulley joint. +---@param body2 Body # The second body to connect with a pulley joint. +---@param gx1 number # The x coordinate of the first body's ground anchor. +---@param gy1 number # The y coordinate of the first body's ground anchor. +---@param gx2 number # The x coordinate of the second body's ground anchor. +---@param gy2 number # The y coordinate of the second body's ground anchor. +---@param x1 number # The x coordinate of the pulley joint anchor in the first body. +---@param y1 number # The y coordinate of the pulley joint anchor in the first body. +---@param x2 number # The x coordinate of the pulley joint anchor in the second body. +---@param y2 number # The y coordinate of the pulley joint anchor in the second body. +---@param ratio number # The joint ratio. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return PulleyJoint joint # The new pulley joint. +function love.physics.newPulleyJoint(body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio, collideConnected) end + +--- +---Shorthand for creating rectangular PolygonShapes. +--- +---By default, the local origin is located at the '''center''' of the rectangle as opposed to the top left for graphics. +--- +---@param width number # The width of the rectangle. +---@param height number # The height of the rectangle. +---@return PolygonShape shape # A new PolygonShape. +function love.physics.newRectangleShape(width, height) end + +--- +---Creates a pivot joint between two bodies. +--- +---This joint connects two bodies to a point around which they can pivot. +--- +---@param body1 Body # The first body. +---@param body2 Body # The second body. +---@param x number # The x position of the connecting point. +---@param y number # The y position of the connecting point. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return RevoluteJoint joint # The new revolute joint. +function love.physics.newRevoluteJoint(body1, body2, x, y, collideConnected) end + +--- +---Creates a joint between two bodies. Its only function is enforcing a max distance between these bodies. +--- +---@param body1 Body # The first body to attach to the joint. +---@param body2 Body # The second body to attach to the joint. +---@param x1 number # The x position of the first anchor point. +---@param y1 number # The y position of the first anchor point. +---@param x2 number # The x position of the second anchor point. +---@param y2 number # The y position of the second anchor point. +---@param maxLength number # The maximum distance for the bodies. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return RopeJoint joint # The new RopeJoint. +function love.physics.newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength, collideConnected) end + +--- +---Creates a constraint joint between two bodies. A WeldJoint essentially glues two bodies together. The constraint is a bit soft, however, due to Box2D's iterative solver. +--- +---@param body1 Body # The first body to attach to the joint. +---@param body2 Body # The second body to attach to the joint. +---@param x number # The x position of the anchor point (world space). +---@param y number # The y position of the anchor point (world space). +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return WeldJoint joint # The new WeldJoint. +function love.physics.newWeldJoint(body1, body2, x, y, collideConnected) end + +--- +---Creates a wheel joint. +--- +---@param body1 Body # The first body. +---@param body2 Body # The second body. +---@param x number # The x position of the anchor point. +---@param y number # The y position of the anchor point. +---@param ax number # The x position of the axis unit vector. +---@param ay number # The y position of the axis unit vector. +---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@return WheelJoint joint # The new WheelJoint. +function love.physics.newWheelJoint(body1, body2, x, y, ax, ay, collideConnected) end + +--- +---Creates a new World. +--- +---@param xg number # The x component of gravity. +---@param yg number # The y component of gravity. +---@param sleep boolean # Whether the bodies in this world are allowed to sleep. +---@return World world # A brave new World. +function love.physics.newWorld(xg, yg, sleep) end + +--- +---Sets the pixels to meter scale factor. +--- +---All coordinates in the physics module are divided by this number and converted to meters, and it creates a convenient way to draw the objects directly to the screen without the need for graphics transformations. +--- +---It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30. +--- +---@param scale number # The scale factor as an integer. +function love.physics.setMeter(scale) end diff --git a/meta/3rd/love2d/library/love.sound.lua b/meta/3rd/love2d/library/love.sound.lua new file mode 100644 index 00000000..e44eabfa --- /dev/null +++ b/meta/3rd/love2d/library/love.sound.lua @@ -0,0 +1,19 @@ +---@class love.sound +love.sound = {} + +--- +---Attempts to find a decoder for the encoded sound data in the specified file. +--- +---@param file File # The file with encoded sound data. +---@param buffer number # The size of each decoded chunk, in bytes. +---@return Decoder decoder # A new Decoder object. +function love.sound.newDecoder(file, buffer) end + +--- +---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. +--- +---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. +--- +---@param filename string # The file name of the file to load. +---@return SoundData soundData # A new SoundData object. +function love.sound.newSoundData(filename) end diff --git a/meta/3rd/love2d/library/love.system.lua b/meta/3rd/love2d/library/love.system.lua new file mode 100644 index 00000000..dfb79734 --- /dev/null +++ b/meta/3rd/love2d/library/love.system.lua @@ -0,0 +1,55 @@ +---@class love.system +love.system = {} + +--- +---Gets text from the clipboard. +--- +---@return string text # The text currently held in the system's clipboard. +function love.system.getClipboardText() end + +--- +---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.) +--- +---@return string osString # The current operating system. 'OS X', 'Windows', 'Linux', 'Android' or 'iOS'. +function love.system.getOS() end + +--- +---Gets information about the system's power supply. +--- +---@return PowerState state # The basic state of the power supply. +---@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. +---@return number seconds # Seconds of battery life left. nil if the value can't be determined or there's no battery. +function love.system.getPowerInfo() end + +--- +---Gets the amount of logical processor in the system. +--- +---@return number processorCount # Amount of logical processors. +function love.system.getProcessorCount() end + +--- +---Gets whether another application on the system is playing music in the background. +--- +---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. +--- +---@return boolean backgroundmusic # True if the user is playing music in the background via another app, false otherwise. +function love.system.hasBackgroundMusic() end + +--- +---Opens a URL with the user's web or file browser. +--- +---@param url string # The URL to open. Must be formatted as a proper URL. +---@return boolean success # Whether the URL was opened successfully. +function love.system.openURL(url) end + +--- +---Puts text in the clipboard. +--- +---@param text string # The new text to hold in the system's clipboard. +function love.system.setClipboardText(text) end + +--- +---Causes the device to vibrate, if possible. Currently this will only work on Android and iOS devices that have a built-in vibration motor. +--- +---@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. +function love.system.vibrate(seconds) end diff --git a/meta/3rd/love2d/library/love.thread.lua b/meta/3rd/love2d/library/love.thread.lua new file mode 100644 index 00000000..e97aaa70 --- /dev/null +++ b/meta/3rd/love2d/library/love.thread.lua @@ -0,0 +1,24 @@ +---@class love.thread +love.thread = {} + +--- +---Creates or retrieves a named thread channel. +--- +---@param name string # The name of the channel you want to create or retrieve. +---@return Channel channel # The Channel object associated with the name. +function love.thread.getChannel(name) end + +--- +---Create a new unnamed thread channel. +--- +---One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel. +--- +---@return Channel channel # The new Channel object. +function love.thread.newChannel() end + +--- +---Creates a new Thread from a filename, string or FileData object containing Lua code. +--- +---@param filename string # The name of the Lua file to use as the source. +---@return Thread thread # A new Thread that has yet to be started. +function love.thread.newThread(filename) end diff --git a/meta/3rd/love2d/library/love.timer.lua b/meta/3rd/love2d/library/love.timer.lua new file mode 100644 index 00000000..16667fbe --- /dev/null +++ b/meta/3rd/love2d/library/love.timer.lua @@ -0,0 +1,42 @@ +---@class love.timer +love.timer = {} + +--- +---Returns the average delta time (seconds per frame) over the last second. +--- +---@return number delta # The average delta time over the last second. +function love.timer.getAverageDelta() end + +--- +---Returns the time between the last two frames. +--- +---@return number dt # The time passed (in seconds). +function love.timer.getDelta() end + +--- +---Returns the current frames per second. +--- +---@return number fps # The current FPS. +function love.timer.getFPS() end + +--- +---Returns the value of a timer with an unspecified starting time. +--- +---This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown. +--- +---@return number time # The time in seconds. Given as a decimal, accurate to the microsecond. +function love.timer.getTime() end + +--- +---Pauses the current thread for the specified amount of time. +--- +---@param s number # Seconds to sleep for. +function love.timer.sleep(s) end + +--- +---Measures the time between two frames. +--- +---Calling this changes the return value of love.timer.getDelta. +--- +---@return number dt # The time passed (in seconds). +function love.timer.step() end diff --git a/meta/3rd/love2d/library/love.touch.lua b/meta/3rd/love2d/library/love.touch.lua new file mode 100644 index 00000000..1b9251fd --- /dev/null +++ b/meta/3rd/love2d/library/love.touch.lua @@ -0,0 +1,23 @@ +---@class love.touch +love.touch = {} + +--- +---Gets the current position of the specified touch-press, in pixels. +--- +---@param id light userdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. +---@return number x # The position along the x-axis of the touch-press inside the window, in pixels. +---@return number y # The position along the y-axis of the touch-press inside the window, in pixels. +function love.touch.getPosition(id) end + +--- +---Gets the current pressure of the specified touch-press. +--- +---@param id light userdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. +---@return number pressure # The pressure of the touch-press. Most touch screens aren't pressure sensitive, in which case the pressure will be 1. +function love.touch.getPressure(id) end + +--- +---Gets a list of all active touch-presses. +--- +---@return table touches # A list of active touch-press id values, which can be used with love.touch.getPosition. +function love.touch.getTouches() end diff --git a/meta/3rd/love2d/library/love.video.lua b/meta/3rd/love2d/library/love.video.lua new file mode 100644 index 00000000..a9209661 --- /dev/null +++ b/meta/3rd/love2d/library/love.video.lua @@ -0,0 +1,9 @@ +---@class love.video +love.video = {} + +--- +---Creates a new VideoStream. Currently only Ogg Theora video files are supported. VideoStreams can't draw videos, see love.graphics.newVideo for that. +--- +---@param filename string # The file path to the Ogg Theora video file. +---@return VideoStream videostream # A new VideoStream. +function love.video.newVideoStream(filename) end diff --git a/meta/3rd/love2d/library/love.window.lua b/meta/3rd/love2d/library/love.window.lua new file mode 100644 index 00000000..9730de69 --- /dev/null +++ b/meta/3rd/love2d/library/love.window.lua @@ -0,0 +1,285 @@ +---@class love.window +love.window = {} + +--- +---Closes the window. It can be reopened with love.window.setMode. +--- +function love.window.close() end + +--- +---Converts a number from pixels to density-independent units. +--- +---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. +--- +---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. +--- +---Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. +--- +---@param pixelvalue number # A number in pixels to convert to density-independent units. +---@return number value # The converted number, in density-independent units. +function love.window.fromPixels(pixelvalue) end + +--- +---Gets the DPI scale factor associated with the window. +--- +---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. +--- +---The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. +--- +---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. +--- +---@return number scale # The pixel scale factor associated with the window. +function love.window.getDPIScale() end + +--- +---Gets the width and height of the desktop. +--- +---@param displayindex number # The index of the display, if multiple monitors are available. +---@return string width # The width of the desktop. +---@return string height # The height of the desktop. +function love.window.getDesktopDimensions(displayindex) end + +--- +---Gets the number of connected monitors. +--- +---@return number count # The number of currently connected displays. +function love.window.getDisplayCount() end + +--- +---Gets the name of a display. +--- +---@param displayindex number # The index of the display to get the name of. +---@return string name # The name of the specified display. +function love.window.getDisplayName(displayindex) end + +--- +---Gets current device display orientation. +--- +---@param displayindex number # Display index to get its display orientation, or nil for default display index. +---@return DisplayOrientation orientation # Current device display orientation. +function love.window.getDisplayOrientation(displayindex) end + +--- +---Gets whether the window is fullscreen. +--- +---@return boolean fullscreen # True if the window is fullscreen, false otherwise. +---@return FullscreenType fstype # The type of fullscreen mode used. +function love.window.getFullscreen() end + +--- +---Gets a list of supported fullscreen modes. +--- +---@param displayindex number # The index of the display, if multiple monitors are available. +---@return table modes # A table of width/height pairs. (Note that this may not be in order.) +function love.window.getFullscreenModes(displayindex) end + +--- +---Gets the window icon. +--- +---@return ImageData imagedata # The window icon imagedata, or nil if no icon has been set with love.window.setIcon. +function love.window.getIcon() end + +--- +---Gets the display mode and properties of the window. +--- +---@return number width # Window width. +---@return number height # Window height. +---@return table flags # Table with the window properties: +function love.window.getMode() end + +--- +---Gets the position of the window on the screen. +--- +---The window position is in the coordinate space of the display it is currently in. +--- +---@return number x # The x-coordinate of the window's position. +---@return number y # The y-coordinate of the window's position. +---@return number displayindex # The index of the display that the window is in. +function love.window.getPosition() end + +--- +---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. +--- +---@return number x # Starting position of safe area (x-axis). +---@return number y # Starting position of safe area (y-axis). +---@return number w # Width of safe area. +---@return number h # Height of safe area. +function love.window.getSafeArea() end + +--- +---Gets the window title. +--- +---@return string title # The current window title. +function love.window.getTitle() end + +--- +---Gets current vertical synchronization (vsync). +--- +---@return number vsync # Current vsync status. 1 if enabled, 0 if disabled, and -1 for adaptive vsync. +function love.window.getVSync() end + +--- +---Checks if the game window has keyboard focus. +--- +---@return boolean focus # True if the window has the focus or false if not. +function love.window.hasFocus() end + +--- +---Checks if the game window has mouse focus. +--- +---@return boolean focus # True if the window has mouse focus or false if not. +function love.window.hasMouseFocus() end + +--- +---Gets whether the display is allowed to sleep while the program is running. +--- +---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. +--- +---@return boolean enabled # True if system display sleep is enabled / allowed, false otherwise. +function love.window.isDisplaySleepEnabled() end + +--- +---Gets whether the Window is currently maximized. +--- +---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. +--- +---@return boolean maximized # True if the window is currently maximized in windowed mode, false otherwise. +function love.window.isMaximized() end + +--- +---Gets whether the Window is currently minimized. +--- +---@return boolean minimized # True if the window is currently minimized, false otherwise. +function love.window.isMinimized() end + +--- +---Checks if the window is open. +--- +---@return boolean open # True if the window is open, false otherwise. +function love.window.isOpen() end + +--- +---Checks if the game window is visible. +--- +---The window is considered visible if it's not minimized and the program isn't hidden. +--- +---@return boolean visible # True if the window is visible or false if not. +function love.window.isVisible() end + +--- +---Makes the window as large as possible. +--- +---This function has no effect if the window isn't resizable, since it essentially programmatically presses the window's 'maximize' button. +--- +function love.window.maximize() end + +--- +---Minimizes the window to the system's task bar / dock. +--- +function love.window.minimize() end + +--- +---Causes the window to request the attention of the user if it is not in the foreground. +--- +---In Windows the taskbar icon will flash, and in OS X the dock icon will bounce. +--- +---@param continuous boolean # Whether to continuously request attention until the window becomes active, or to do it only once. +function love.window.requestAttention(continuous) end + +--- +---Restores the size and position of the window if it was minimized or maximized. +--- +function love.window.restore() end + +--- +---Sets whether the display is allowed to sleep while the program is running. +--- +---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. +--- +---@param enable boolean # True to enable system display sleep, false to disable it. +function love.window.setDisplaySleepEnabled(enable) end + +--- +---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. +--- +---@param fullscreen boolean # Whether to enter or exit fullscreen mode. +---@return boolean success # True if an attempt to enter fullscreen was successful, false otherwise. +function love.window.setFullscreen(fullscreen) end + +--- +---Sets the window icon until the game is quit. Not all operating systems support very large icon images. +--- +---@param imagedata ImageData # The window icon image. +---@return boolean success # Whether the icon has been set successfully. +function love.window.setIcon(imagedata) end + +--- +---Sets the display mode and properties of the window. +--- +---If width or height is 0, setMode will use the width and height of the desktop. +--- +---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. +--- +---@param width number # Display width. +---@param height number # Display height. +---@param flags table # The flags table with the options: +---@return boolean success # True if successful, false otherwise. +function love.window.setMode(width, height, flags) end + +--- +---Sets the position of the window on the screen. +--- +---The window position is in the coordinate space of the specified display. +--- +---@param x number # The x-coordinate of the window's position. +---@param y number # The y-coordinate of the window's position. +---@param displayindex number # The index of the display that the new window position is relative to. +function love.window.setPosition(x, y, displayindex) end + +--- +---Sets the window title. +--- +---@param title string # The new window title. +function love.window.setTitle(title) end + +--- +---Sets vertical synchronization mode. +--- +---@param vsync number # VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync. +function love.window.setVSync(vsync) end + +--- +---Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons. +--- +---@param title string # The title of the message box. +---@param message string # The text inside the message box. +---@param type MessageBoxType # The type of the message box. +---@param attachtowindow boolean # Whether the message box should be attached to the love window or free-floating. +---@return boolean success # Whether the message box was successfully displayed. +function love.window.showMessageBox(title, message, type, attachtowindow) end + +--- +---Converts a number from density-independent units to pixels. +--- +---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. +--- +---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. +--- +---Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. +--- +---@param value number # A number in density-independent units to convert to pixels. +---@return number pixelvalue # The converted number, in pixels. +function love.window.toPixels(value) end + +--- +---Sets the display mode and properties of the window, without modifying unspecified properties. +--- +---If width or height is 0, updateMode will use the width and height of the desktop. +--- +---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. +--- +---@param width number # Window width. +---@param height number # Window height. +---@param settings table # 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. +---@return boolean success # True if successful, false otherwise. +function love.window.updateMode(width, height, settings) end |