dotfiles from arch
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name" : "LÖVE",
|
||||
"words" : ["love%.%w+"],
|
||||
"settings" : {
|
||||
"Lua.runtime.version" : "LuaJIT",
|
||||
"Lua.runtime.special" : {
|
||||
"love.filesystem.load" : "loadfile"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
---@meta
|
||||
|
||||
-- version: 11.5
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love)
|
||||
---
|
||||
---@class love
|
||||
love = {}
|
||||
|
||||
---
|
||||
---Gets the current running version of LÖVE.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.getVersion)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.hasDeprecationOutput)
|
||||
---
|
||||
---@return boolean enabled # Whether deprecation output is enabled.
|
||||
function love.hasDeprecationOutput() end
|
||||
|
||||
---
|
||||
---Gets whether the given version is compatible with the current running version of LÖVE.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.isVersionCompatible)
|
||||
---
|
||||
---@overload fun(major: number, minor: number, revision: number):boolean
|
||||
---@param version string # The version to check (for example '11.3' or '0.10.2').
|
||||
---@return boolean compatible # Whether the given version is compatible with the current running version of LÖVE.
|
||||
function love.isVersionCompatible(version) 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.setDeprecationOutput)
|
||||
---
|
||||
---@param enable boolean # Whether to enable or disable deprecation output.
|
||||
function love.setDeprecationOutput(enable) end
|
||||
|
||||
---
|
||||
---The superclass of all data.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love)
|
||||
---
|
||||
---@class love.Data: love.Object
|
||||
local Data = {}
|
||||
|
||||
---
|
||||
---Creates a new copy of the Data object.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Data:clone)
|
||||
---
|
||||
---@return love.Data clone # The new copy.
|
||||
function Data:clone() end
|
||||
|
||||
---
|
||||
---Gets an FFI pointer to the Data.
|
||||
---
|
||||
---This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Data:getFFIPointer)
|
||||
---
|
||||
---@return ffi.cdata* pointer # A raw void* pointer to the Data, or nil if FFI is unavailable.
|
||||
function Data:getFFIPointer() end
|
||||
|
||||
---
|
||||
---Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Data:getPointer)
|
||||
---
|
||||
---@return lightuserdata pointer # A raw pointer to the Data.
|
||||
function Data:getPointer() end
|
||||
|
||||
---
|
||||
---Gets the Data's size in bytes.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Data:getSize)
|
||||
---
|
||||
---@return number size # The size of the Data in bytes.
|
||||
function Data:getSize() end
|
||||
|
||||
---
|
||||
---Gets the full Data as a string.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Data:getString)
|
||||
---
|
||||
---@return string data # The raw data.
|
||||
function Data:getString() end
|
||||
|
||||
---
|
||||
---The superclass of all LÖVE types.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love)
|
||||
---
|
||||
---@class love.Object
|
||||
local Object = {}
|
||||
|
||||
---
|
||||
---Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
|
||||
---
|
||||
---This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Object:release)
|
||||
---
|
||||
---@return boolean success # True if the object was released by this call, false if it had been previously released.
|
||||
function Object:release() end
|
||||
|
||||
---
|
||||
---Gets the type of the object as a string.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Object:type)
|
||||
---
|
||||
---@return string type # The type as a string.
|
||||
function Object:type() end
|
||||
|
||||
---
|
||||
---Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Object:typeOf)
|
||||
---
|
||||
---@param name string # The name of the type to check for.
|
||||
---@return boolean b # True if the object is of the specified type, false otherwise.
|
||||
function Object:typeOf(name) end
|
||||
|
||||
---
|
||||
---If a file called conf.lua is present in your game folder (or .love file), it is run before the LÖVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LÖVE 'boot' script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff.
|
||||
---
|
||||
---@alias love.conf fun(t: table)
|
||||
|
||||
---
|
||||
---Callback function triggered when a directory is dragged and dropped onto the window.
|
||||
---
|
||||
---@alias love.directorydropped fun(path: string)
|
||||
|
||||
---
|
||||
---Called when the device display orientation changed, for example, user rotated their phone 180 degrees.
|
||||
---
|
||||
---@alias love.displayrotated fun(index: number, orientation: love.DisplayOrientation)
|
||||
|
||||
---
|
||||
---Callback function used to draw on the screen every frame.
|
||||
---
|
||||
---@alias love.draw fun()
|
||||
|
||||
---
|
||||
---The error handler, used to display error messages.
|
||||
---
|
||||
---@alias love.errorhandler fun(msg: string):function
|
||||
|
||||
---
|
||||
---Callback function triggered when a file is dragged and dropped onto the window.
|
||||
---
|
||||
---@alias love.filedropped fun(file: love.DroppedFile)
|
||||
|
||||
---
|
||||
---Callback function triggered when window receives or loses focus.
|
||||
---
|
||||
---@alias love.focus fun(focus: boolean)
|
||||
|
||||
---
|
||||
---Called when a Joystick's virtual gamepad axis is moved.
|
||||
---
|
||||
---@alias love.gamepadaxis fun(joystick: love.Joystick, axis: love.GamepadAxis, value: number)
|
||||
|
||||
---
|
||||
---Called when a Joystick's virtual gamepad button is pressed.
|
||||
---
|
||||
---@alias love.gamepadpressed fun(joystick: love.Joystick, button: love.GamepadButton)
|
||||
|
||||
---
|
||||
---Called when a Joystick's virtual gamepad button is released.
|
||||
---
|
||||
---@alias love.gamepadreleased fun(joystick: love.Joystick, button: love.GamepadButton)
|
||||
|
||||
---
|
||||
---Called when a Joystick is connected.
|
||||
---
|
||||
---@alias love.joystickadded fun(joystick: love.Joystick)
|
||||
|
||||
---
|
||||
---Called when a joystick axis moves.
|
||||
---
|
||||
---@alias love.joystickaxis fun(joystick: love.Joystick, axis: number, value: number)
|
||||
|
||||
---
|
||||
---Called when a joystick hat direction changes.
|
||||
---
|
||||
---@alias love.joystickhat fun(joystick: love.Joystick, hat: number, direction: love.JoystickHat)
|
||||
|
||||
---
|
||||
---Called when a joystick button is pressed.
|
||||
---
|
||||
---@alias love.joystickpressed fun(joystick: love.Joystick, button: number)
|
||||
|
||||
---
|
||||
---Called when a joystick button is released.
|
||||
---
|
||||
---@alias love.joystickreleased fun(joystick: love.Joystick, button: number)
|
||||
|
||||
---
|
||||
---Called when a Joystick is disconnected.
|
||||
---
|
||||
---@alias love.joystickremoved fun(joystick: love.Joystick)
|
||||
|
||||
---
|
||||
---Callback function triggered when a key is pressed.
|
||||
---
|
||||
---@alias love.keypressed fun(key: love.KeyConstant, scancode: love.Scancode, isrepeat: boolean)|fun(key: love.KeyConstant, isrepeat: boolean)
|
||||
|
||||
---
|
||||
---Callback function triggered when a keyboard key is released.
|
||||
---
|
||||
---@alias love.keyreleased fun(key: love.KeyConstant, scancode: love.Scancode)
|
||||
|
||||
---
|
||||
---This function is called exactly once at the beginning of the game.
|
||||
---
|
||||
---@alias love.load fun(arg: table, unfilteredArg: table)
|
||||
|
||||
---
|
||||
---Callback function triggered when the system is running out of memory on mobile devices.
|
||||
---
|
||||
---Mobile operating systems may forcefully kill the game if it uses too much memory, so any non-critical resource should be removed if possible (by setting all variables referencing the resources to '''nil'''), when this event is triggered. Sounds and images in particular tend to use the most memory.
|
||||
---
|
||||
---@alias love.lowmemory fun()
|
||||
|
||||
---
|
||||
---Callback function triggered when window receives or loses mouse focus.
|
||||
---
|
||||
---@alias love.mousefocus fun(focus: boolean)
|
||||
|
||||
---
|
||||
---Callback function triggered when the mouse is moved.
|
||||
---
|
||||
---@alias love.mousemoved fun(x: number, y: number, dx: number, dy: number, istouch: boolean)
|
||||
|
||||
---
|
||||
---Callback function triggered when a mouse button is pressed.
|
||||
---
|
||||
---@alias love.mousepressed fun(x: number, y: number, button: number, istouch: boolean, presses: number)
|
||||
|
||||
---
|
||||
---Callback function triggered when a mouse button is released.
|
||||
---
|
||||
---@alias love.mousereleased fun(x: number, y: number, button: number, istouch: boolean, presses: number)
|
||||
|
||||
---
|
||||
---Callback function triggered when the game is closed.
|
||||
---
|
||||
---@alias love.quit fun():boolean
|
||||
|
||||
---
|
||||
---Called when the window is resized, for example if the user resizes the window, or if love.window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.
|
||||
---
|
||||
---@alias love.resize fun(w: number, h: number)
|
||||
|
||||
---
|
||||
---The main function, containing the main loop. A sensible default is used when left out.
|
||||
---
|
||||
---@alias love.run fun():function
|
||||
|
||||
---
|
||||
---Called when the candidate text for an IME (Input Method Editor) has changed.
|
||||
---
|
||||
---The candidate text is not the final text that the user will eventually choose. Use love.textinput for that.
|
||||
---
|
||||
---@alias love.textedited fun(text: string, start: number, length: number)
|
||||
|
||||
---
|
||||
---Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text '@' will be generated.
|
||||
---
|
||||
---@alias love.textinput fun(text: string)
|
||||
|
||||
---
|
||||
---Callback function triggered when a Thread encounters an error.
|
||||
---
|
||||
---@alias love.threaderror fun(thread: love.Thread, errorstr: string)
|
||||
|
||||
---
|
||||
---Callback function triggered when a touch press moves inside the touch screen.
|
||||
---
|
||||
---@alias love.touchmoved fun(id: lightuserdata, x: number, y: number, dx: number, dy: number, pressure: number)
|
||||
|
||||
---
|
||||
---Callback function triggered when the touch screen is touched.
|
||||
---
|
||||
---@alias love.touchpressed fun(id: lightuserdata, x: number, y: number, dx: number, dy: number, pressure: number)
|
||||
|
||||
---
|
||||
---Callback function triggered when the touch screen stops being touched.
|
||||
---
|
||||
---@alias love.touchreleased fun(id: lightuserdata, x: number, y: number, dx: number, dy: number, pressure: number)
|
||||
|
||||
---
|
||||
---Callback function used to update the state of the game every frame.
|
||||
---
|
||||
---@alias love.update fun(dt: number)
|
||||
|
||||
---
|
||||
---Callback function triggered when window is minimized/hidden or unminimized by the user.
|
||||
---
|
||||
---@alias love.visible fun(visible: boolean)
|
||||
|
||||
---
|
||||
---Callback function triggered when the mouse wheel is moved.
|
||||
---
|
||||
---@alias love.wheelmoved fun(x: number, y: number)
|
||||
|
||||
return love
|
||||
@@ -0,0 +1,980 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to create noise with the user's speakers.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio)
|
||||
---
|
||||
---@class love.audio
|
||||
love.audio = {}
|
||||
|
||||
---
|
||||
---Gets a list of the names of the currently enabled effects.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getActiveEffects)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getActiveSourceCount)
|
||||
---
|
||||
---@return number count # The current number of simultaneously playing sources.
|
||||
function love.audio.getActiveSourceCount() end
|
||||
|
||||
---
|
||||
---Returns the distance attenuation model.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getDistanceModel)
|
||||
---
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getDopplerScale)
|
||||
---
|
||||
---@return number scale # The current doppler scale factor.
|
||||
function love.audio.getDopplerScale() end
|
||||
|
||||
---
|
||||
---Gets the settings associated with an effect.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getEffect)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getMaxSceneEffects)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getMaxSourceEffects)
|
||||
---
|
||||
---@return number maximum # The maximum number of active Effects per Source.
|
||||
function love.audio.getMaxSourceEffects() end
|
||||
|
||||
---
|
||||
---Returns the orientation of the listener.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getOrientation)
|
||||
---
|
||||
---@return number fx # Forward vector of the listener orientation.
|
||||
---@return number fy # Forward vector of the listener orientation.
|
||||
---@return number fz # Forward vector of the listener orientation.
|
||||
---@return number ux # Up vector of the listener orientation.
|
||||
---@return number uy # Up vector of the listener orientation.
|
||||
---@return number 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getPosition)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getRecordingDevices)
|
||||
---
|
||||
---@return table devices # The list of connected recording devices.
|
||||
function love.audio.getRecordingDevices() end
|
||||
|
||||
---
|
||||
---Returns the velocity of the listener.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getVelocity)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.getVolume)
|
||||
---
|
||||
---@return number volume # The current master volume
|
||||
function love.audio.getVolume() end
|
||||
|
||||
---
|
||||
---Gets whether audio effects are supported in the system.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.isEffectsSupported)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.newQueueableSource)
|
||||
---
|
||||
---@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 love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.newSource)
|
||||
---
|
||||
---@overload fun(file: love.File, type: love.SourceType):love.Source
|
||||
---@overload fun(decoder: love.Decoder, type: love.SourceType):love.Source
|
||||
---@overload fun(data: love.FileData, type: love.SourceType):love.Source
|
||||
---@overload fun(data: love.SoundData):love.Source
|
||||
---@param filename string # The filepath to the audio file.
|
||||
---@param type love.SourceType # Streaming or static source.
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.pause)
|
||||
---
|
||||
---@overload fun(source: love.Source, ...)
|
||||
---@overload fun(sources: table)
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.play)
|
||||
---
|
||||
---@overload fun(sources: table)
|
||||
---@overload fun(source1: love.Source, source2: love.Source, ...)
|
||||
---@param source love.Source # The Source to play.
|
||||
function love.audio.play(source) end
|
||||
|
||||
---
|
||||
---Sets the distance attenuation model.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setDistanceModel)
|
||||
---
|
||||
---@param model love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setDopplerScale)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setEffect)
|
||||
---
|
||||
---@overload fun(name: string, enabled?: boolean):boolean
|
||||
---@param name string # The name of the effect.
|
||||
---@param settings {type: love.EffectType, volume: number} # 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setMixWithSystem)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setOrientation)
|
||||
---
|
||||
---@param fx number # Forward vector of the listener orientation.
|
||||
---@param fy number # Forward vector of the listener orientation.
|
||||
---@param fz number # Forward vector of the listener orientation.
|
||||
---@param ux number # Up vector of the listener orientation.
|
||||
---@param uy number # Up vector of the listener orientation.
|
||||
---@param 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setPosition)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setVelocity)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.setVolume)
|
||||
---
|
||||
---@param volume number # 1.0 is max and 0.0 is off.
|
||||
function love.audio.setVolume(volume) end
|
||||
|
||||
---
|
||||
---Stops currently played sources.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio.stop)
|
||||
---
|
||||
---@overload fun(source: love.Source)
|
||||
---@overload fun(source1: love.Source, source2: love.Source, ...)
|
||||
---@overload fun(sources: table)
|
||||
function love.audio.stop() end
|
||||
|
||||
---
|
||||
---Represents an audio input device capable of recording sounds.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio)
|
||||
---
|
||||
---@class love.RecordingDevice: love.Object
|
||||
local RecordingDevice = {}
|
||||
|
||||
---
|
||||
---Gets the number of bits per sample in the data currently being recorded.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:getBitDepth)
|
||||
---
|
||||
---@return number bits # The number of bits per sample in the data that's currently being recorded.
|
||||
function RecordingDevice:getBitDepth() end
|
||||
|
||||
---
|
||||
---Gets the number of channels currently being recorded (mono or stereo).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:getChannelCount)
|
||||
---
|
||||
---@return number channels # The number of channels being recorded (1 for mono, 2 for stereo).
|
||||
function RecordingDevice:getChannelCount() end
|
||||
|
||||
---
|
||||
---Gets all recorded audio SoundData stored in the device's internal ring buffer.
|
||||
---
|
||||
---The internal ring buffer is cleared when this function is called, so calling it again will only get audio recorded after the previous call. If the device's internal ring buffer completely fills up before getData is called, the oldest data that doesn't fit into the buffer will be lost.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:getData)
|
||||
---
|
||||
---@return love.SoundData data # The recorded audio data, or nil if the device isn't recording.
|
||||
function RecordingDevice:getData() end
|
||||
|
||||
---
|
||||
---Gets the name of the recording device.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:getName)
|
||||
---
|
||||
---@return string name # The name of the device.
|
||||
function RecordingDevice:getName() end
|
||||
|
||||
---
|
||||
---Gets the number of currently recorded samples.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:getSampleCount)
|
||||
---
|
||||
---@return number samples # The number of samples that have been recorded so far.
|
||||
function RecordingDevice:getSampleCount() end
|
||||
|
||||
---
|
||||
---Gets the number of samples per second currently being recorded.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:getSampleRate)
|
||||
---
|
||||
---@return number rate # The number of samples being recorded per second (sample rate).
|
||||
function RecordingDevice:getSampleRate() end
|
||||
|
||||
---
|
||||
---Gets whether the device is currently recording.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:isRecording)
|
||||
---
|
||||
---@return boolean recording # True if the recording, false otherwise.
|
||||
function RecordingDevice:isRecording() end
|
||||
|
||||
---
|
||||
---Begins recording audio using this device.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:start)
|
||||
---
|
||||
---@param samplecount number # The maximum number of samples to store in an internal ring buffer when recording. RecordingDevice:getData clears the internal buffer when called.
|
||||
---@param samplerate? number # The number of samples per second to store when recording.
|
||||
---@param bitdepth? number # The number of bits per sample.
|
||||
---@param channels? number # Whether to record in mono or stereo. Most microphones don't support more than 1 channel.
|
||||
---@return boolean success # True if the device successfully began recording using the specified parameters, false if not.
|
||||
function RecordingDevice:start(samplecount, samplerate, bitdepth, channels) end
|
||||
|
||||
---
|
||||
---Stops recording audio from this device. Any sound data currently in the device's buffer will be returned.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RecordingDevice:stop)
|
||||
---
|
||||
---@return love.SoundData data # The sound data currently in the device's buffer, or nil if the device wasn't recording.
|
||||
function RecordingDevice:stop() end
|
||||
|
||||
---
|
||||
---A Source represents audio you can play back.
|
||||
---
|
||||
---You can do interesting things with Sources, like set the volume, pitch, and its position relative to the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.
|
||||
---
|
||||
---The Source controls (play/pause/stop) act according to the following state table.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.audio)
|
||||
---
|
||||
---@class love.Source: love.Object
|
||||
local Source = {}
|
||||
|
||||
---
|
||||
---Creates an identical copy of the Source in the stopped state.
|
||||
---
|
||||
---Static Sources will use significantly less memory and take much less time to be created if Source:clone is used to create them instead of love.audio.newSource, so this method should be preferred when making multiple Sources which play the same sound.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:clone)
|
||||
---
|
||||
---@return love.Source source # The new identical copy of this Source.
|
||||
function Source:clone() end
|
||||
|
||||
---
|
||||
---Gets a list of the Source's active effect names.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getActiveEffects)
|
||||
---
|
||||
---@return table effects # A list of the source's active effect names.
|
||||
function Source:getActiveEffects() end
|
||||
|
||||
---
|
||||
---Gets the amount of air absorption applied to the Source.
|
||||
---
|
||||
---By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getAirAbsorption)
|
||||
---
|
||||
---@return number amount # The amount of air absorption applied to the Source.
|
||||
function Source:getAirAbsorption() end
|
||||
|
||||
---
|
||||
---Gets the reference and maximum attenuation distances of the Source. The values, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance from the listener.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getAttenuationDistances)
|
||||
---
|
||||
---@return number ref # The current reference attenuation distance. If the current DistanceModel is clamped, this is the minimum distance before the Source is no longer attenuated.
|
||||
---@return number max # The current maximum attenuation distance.
|
||||
function Source:getAttenuationDistances() end
|
||||
|
||||
---
|
||||
---Gets the number of channels in the Source. Only 1-channel (mono) Sources can use directional and positional effects.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getChannelCount)
|
||||
---
|
||||
---@return number channels # 1 for mono, 2 for stereo.
|
||||
function Source:getChannelCount() end
|
||||
|
||||
---
|
||||
---Gets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getCone)
|
||||
---
|
||||
---@return number innerAngle # The inner angle from the Source's direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle.
|
||||
---@return number outerAngle # The outer angle from the Source's direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles.
|
||||
---@return number outerVolume # The Source's volume when the listener is outside both the inner and outer cone angles.
|
||||
function Source:getCone() end
|
||||
|
||||
---
|
||||
---Gets the direction of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getDirection)
|
||||
---
|
||||
---@return number x # The X part of the direction vector.
|
||||
---@return number y # The Y part of the direction vector.
|
||||
---@return number z # The Z part of the direction vector.
|
||||
function Source:getDirection() end
|
||||
|
||||
---
|
||||
---Gets the duration of the Source. For streaming Sources it may not always be sample-accurate, and may return -1 if the duration cannot be determined at all.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getDuration)
|
||||
---
|
||||
---@param unit? love.TimeUnit # The time unit for the return value.
|
||||
---@return number duration # The duration of the Source, or -1 if it cannot be determined.
|
||||
function Source:getDuration(unit) end
|
||||
|
||||
---
|
||||
---Gets the filter settings associated to a specific effect.
|
||||
---
|
||||
---This function returns nil if the effect was applied with no filter settings associated to it.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getEffect)
|
||||
---
|
||||
---@param name string # The name of the effect.
|
||||
---@param filtersettings table # An optional empty table that will be filled with the filter settings.
|
||||
---@return {volume: number, highgain: number, lowgain: number} filtersettings # The settings for the filter associated to this effect, or nil if the effect is not present in this Source or has no filter associated. The table has the following fields:
|
||||
function Source:getEffect(name, filtersettings) end
|
||||
|
||||
---
|
||||
---Gets the filter settings currently applied to the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getFilter)
|
||||
---
|
||||
---@return {type: love.FilterType, volume: number, highgain: number, lowgain: number} settings # The filter settings to use for this Source, or nil if the Source has no active filter. The table has the following fields:
|
||||
function Source:getFilter() end
|
||||
|
||||
---
|
||||
---Gets the number of free buffer slots in a queueable Source. If the queueable Source is playing, this value will increase up to the amount the Source was created with. If the queueable Source is stopped, it will process all of its internal buffers first, in which case this function will always return the amount it was created with.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getFreeBufferCount)
|
||||
---
|
||||
---@return number buffers # How many more SoundData objects can be queued up.
|
||||
function Source:getFreeBufferCount() end
|
||||
|
||||
---
|
||||
---Gets the current pitch of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getPitch)
|
||||
---
|
||||
---@return number pitch # The pitch, where 1.0 is normal.
|
||||
function Source:getPitch() end
|
||||
|
||||
---
|
||||
---Gets the position of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getPosition)
|
||||
---
|
||||
---@return number x # The X position of the Source.
|
||||
---@return number y # The Y position of the Source.
|
||||
---@return number z # The Z position of the Source.
|
||||
function Source:getPosition() end
|
||||
|
||||
---
|
||||
---Returns the rolloff factor of the source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getRolloff)
|
||||
---
|
||||
---@return number rolloff # The rolloff factor.
|
||||
function Source:getRolloff() end
|
||||
|
||||
---
|
||||
---Gets the type of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getType)
|
||||
---
|
||||
---@return love.SourceType sourcetype # The type of the source.
|
||||
function Source:getType() end
|
||||
|
||||
---
|
||||
---Gets the velocity of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getVelocity)
|
||||
---
|
||||
---@return number x # The X part of the velocity vector.
|
||||
---@return number y # The Y part of the velocity vector.
|
||||
---@return number z # The Z part of the velocity vector.
|
||||
function Source:getVelocity() end
|
||||
|
||||
---
|
||||
---Gets the current volume of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getVolume)
|
||||
---
|
||||
---@return number volume # The volume of the Source, where 1.0 is normal volume.
|
||||
function Source:getVolume() end
|
||||
|
||||
---
|
||||
---Returns the volume limits of the source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:getVolumeLimits)
|
||||
---
|
||||
---@return number min # The minimum volume.
|
||||
---@return number max # The maximum volume.
|
||||
function Source:getVolumeLimits() end
|
||||
|
||||
---
|
||||
---Returns whether the Source will loop.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:isLooping)
|
||||
---
|
||||
---@return boolean loop # True if the Source will loop, false otherwise.
|
||||
function Source:isLooping() end
|
||||
|
||||
---
|
||||
---Returns whether the Source is playing.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:isPlaying)
|
||||
---
|
||||
---@return boolean playing # True if the Source is playing, false otherwise.
|
||||
function Source:isPlaying() end
|
||||
|
||||
---
|
||||
---Gets whether the Source's position, velocity, direction, and cone angles are relative to the listener.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:isRelative)
|
||||
---
|
||||
---@return boolean relative # True if the position, velocity, direction and cone angles are relative to the listener, false if they're absolute.
|
||||
function Source:isRelative() end
|
||||
|
||||
---
|
||||
---Pauses the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:pause)
|
||||
---
|
||||
function Source:pause() end
|
||||
|
||||
---
|
||||
---Starts playing the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:play)
|
||||
---
|
||||
---@return boolean success # Whether the Source was able to successfully start playing.
|
||||
function Source:play() end
|
||||
|
||||
---
|
||||
---Queues SoundData for playback in a queueable Source.
|
||||
---
|
||||
---This method requires the Source to be created via love.audio.newQueueableSource.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:queue)
|
||||
---
|
||||
---@param sounddata love.SoundData # The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.
|
||||
---@return boolean success # True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.
|
||||
function Source:queue(sounddata) end
|
||||
|
||||
---
|
||||
---Sets the currently playing position of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:seek)
|
||||
---
|
||||
---@param offset number # The position to seek to.
|
||||
---@param unit? love.TimeUnit # The unit of the position value.
|
||||
function Source:seek(offset, unit) end
|
||||
|
||||
---
|
||||
---Sets the amount of air absorption applied to the Source.
|
||||
---
|
||||
---By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.
|
||||
---
|
||||
---Air absorption can simulate sound transmission through foggy air, dry air, smoky atmosphere, etc. It can be used to simulate different atmospheric conditions within different locations in an area.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setAirAbsorption)
|
||||
---
|
||||
---@param amount number # The amount of air absorption applied to the Source. Must be between 0 and 10.
|
||||
function Source:setAirAbsorption(amount) end
|
||||
|
||||
---
|
||||
---Sets the reference and maximum attenuation distances of the Source. The parameters, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance.
|
||||
---
|
||||
---Distance attenuation is only applicable to Sources based on mono (rather than stereo) audio.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setAttenuationDistances)
|
||||
---
|
||||
---@param ref number # The new reference attenuation distance. If the current DistanceModel is clamped, this is the minimum attenuation distance.
|
||||
---@param max number # The new maximum attenuation distance.
|
||||
function Source:setAttenuationDistances(ref, max) end
|
||||
|
||||
---
|
||||
---Sets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setCone)
|
||||
---
|
||||
---@param innerAngle number # The inner angle from the Source's direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle.
|
||||
---@param outerAngle number # The outer angle from the Source's direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles.
|
||||
---@param outerVolume? number # The Source's volume when the listener is outside both the inner and outer cone angles.
|
||||
function Source:setCone(innerAngle, outerAngle, outerVolume) end
|
||||
|
||||
---
|
||||
---Sets the direction vector of the Source. A zero vector makes the source non-directional.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setDirection)
|
||||
---
|
||||
---@param x number # The X part of the direction vector.
|
||||
---@param y number # The Y part of the direction vector.
|
||||
---@param z number # The Z part of the direction vector.
|
||||
function Source:setDirection(x, y, z) end
|
||||
|
||||
---
|
||||
---Applies an audio effect to the Source.
|
||||
---
|
||||
---The effect must have been previously defined using love.audio.setEffect.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setEffect)
|
||||
---
|
||||
---@overload fun(self: love.Source, name: string, filtersettings: table):boolean
|
||||
---@param name string # The name of the effect previously set up with love.audio.setEffect.
|
||||
---@param enable? boolean # If false and the given effect name was previously enabled on this Source, disables the effect.
|
||||
---@return boolean success # Whether the effect was successfully applied to this Source.
|
||||
function Source:setEffect(name, enable) end
|
||||
|
||||
---
|
||||
---Sets a low-pass, high-pass, or band-pass filter to apply when playing the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setFilter)
|
||||
---
|
||||
---@overload fun(self: love.Source)
|
||||
---@param settings {type: love.FilterType, volume: number, highgain: number, lowgain: number} # The filter settings to use for this Source, with the following fields:
|
||||
---@return boolean success # Whether the filter was successfully applied to the Source.
|
||||
function Source:setFilter(settings) end
|
||||
|
||||
---
|
||||
---Sets whether the Source should loop.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setLooping)
|
||||
---
|
||||
---@param loop boolean # True if the source should loop, false otherwise.
|
||||
function Source:setLooping(loop) end
|
||||
|
||||
---
|
||||
---Sets the pitch of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setPitch)
|
||||
---
|
||||
---@param pitch number # Calculated with regard to 1 being the base pitch. Each reduction by 50 percent equals a pitch shift of -12 semitones (one octave reduction). Each doubling equals a pitch shift of 12 semitones (one octave increase). Zero is not a legal value.
|
||||
function Source:setPitch(pitch) end
|
||||
|
||||
---
|
||||
---Sets the position of the Source. Please note that this only works for mono (i.e. non-stereo) sound files!
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setPosition)
|
||||
---
|
||||
---@param x number # The X position of the Source.
|
||||
---@param y number # The Y position of the Source.
|
||||
---@param z number # The Z position of the Source.
|
||||
function Source:setPosition(x, y, z) end
|
||||
|
||||
---
|
||||
---Sets whether the Source's position, velocity, direction, and cone angles are relative to the listener, or absolute.
|
||||
---
|
||||
---By default, all sources are absolute and therefore relative to the origin of love's coordinate system 0, 0. Only absolute sources are affected by the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setRelative)
|
||||
---
|
||||
---@param enable? boolean # True to make the position, velocity, direction and cone angles relative to the listener, false to make them absolute.
|
||||
function Source:setRelative(enable) end
|
||||
|
||||
---
|
||||
---Sets the rolloff factor which affects the strength of the used distance attenuation.
|
||||
---
|
||||
---Extended information and detailed formulas can be found in the chapter '3.4. Attenuation By Distance' of OpenAL 1.1 specification.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setRolloff)
|
||||
---
|
||||
---@param rolloff number # The new rolloff factor.
|
||||
function Source:setRolloff(rolloff) end
|
||||
|
||||
---
|
||||
---Sets the velocity of the Source.
|
||||
---
|
||||
---This does '''not''' change the position of the Source, but lets the application know how it has to calculate the doppler effect.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setVelocity)
|
||||
---
|
||||
---@param x number # The X part of the velocity vector.
|
||||
---@param y number # The Y part of the velocity vector.
|
||||
---@param z number # The Z part of the velocity vector.
|
||||
function Source:setVelocity(x, y, z) end
|
||||
|
||||
---
|
||||
---Sets the current volume of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setVolume)
|
||||
---
|
||||
---@param volume number # The volume for a Source, where 1.0 is normal volume. Volume cannot be raised above 1.0.
|
||||
function Source:setVolume(volume) end
|
||||
|
||||
---
|
||||
---Sets the volume limits of the source. The limits have to be numbers from 0 to 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:setVolumeLimits)
|
||||
---
|
||||
---@param min number # The minimum volume.
|
||||
---@param max number # The maximum volume.
|
||||
function Source:setVolumeLimits(min, max) end
|
||||
|
||||
---
|
||||
---Stops a Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:stop)
|
||||
---
|
||||
function Source:stop() end
|
||||
|
||||
---
|
||||
---Gets the currently playing position of the Source.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Source:tell)
|
||||
---
|
||||
---@param unit? love.TimeUnit # The type of unit for the return value.
|
||||
---@return number position # The currently playing position of the Source.
|
||||
function Source:tell(unit) end
|
||||
|
||||
---
|
||||
---The different distance models.
|
||||
---
|
||||
---Extended information can be found in the chapter "3.4. Attenuation By Distance" of the OpenAL 1.1 specification.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/DistanceModel)
|
||||
---
|
||||
---@alias love.DistanceModel
|
||||
---
|
||||
---Sources do not get attenuated.
|
||||
---
|
||||
---| "none"
|
||||
---
|
||||
---Inverse distance attenuation.
|
||||
---
|
||||
---| "inverse"
|
||||
---
|
||||
---Inverse distance attenuation. Gain is clamped. In version 0.9.2 and older this is named '''inverse clamped'''.
|
||||
---
|
||||
---| "inverseclamped"
|
||||
---
|
||||
---Linear attenuation.
|
||||
---
|
||||
---| "linear"
|
||||
---
|
||||
---Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named '''linear clamped'''.
|
||||
---
|
||||
---| "linearclamped"
|
||||
---
|
||||
---Exponential attenuation.
|
||||
---
|
||||
---| "exponent"
|
||||
---
|
||||
---Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named '''exponent clamped'''.
|
||||
---
|
||||
---| "exponentclamped"
|
||||
|
||||
---
|
||||
---The different types of effects supported by love.audio.setEffect.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/EffectType)
|
||||
---
|
||||
---@alias love.EffectType
|
||||
---
|
||||
---Plays multiple copies of the sound with slight pitch and time variation. Used to make sounds sound "fuller" or "thicker".
|
||||
---
|
||||
---| "chorus"
|
||||
---
|
||||
---Decreases the dynamic range of the sound, making the loud and quiet parts closer in volume, producing a more uniform amplitude throughout time.
|
||||
---
|
||||
---| "compressor"
|
||||
---
|
||||
---Alters the sound by amplifying it until it clips, shearing off parts of the signal, leading to a compressed and distorted sound.
|
||||
---
|
||||
---| "distortion"
|
||||
---
|
||||
---Decaying feedback based effect, on the order of seconds. Also known as delay; causes the sound to repeat at regular intervals at a decreasing volume.
|
||||
---
|
||||
---| "echo"
|
||||
---
|
||||
---Adjust the frequency components of the sound using a 4-band (low-shelf, two band-pass and a high-shelf) equalizer.
|
||||
---
|
||||
---| "equalizer"
|
||||
---
|
||||
---Plays two copies of the sound; while varying the phase, or equivalently delaying one of them, by amounts on the order of milliseconds, resulting in phasing sounds.
|
||||
---
|
||||
---| "flanger"
|
||||
---
|
||||
---Decaying feedback based effect, on the order of milliseconds. Used to simulate the reflection off of the surroundings.
|
||||
---
|
||||
---| "reverb"
|
||||
---
|
||||
---An implementation of amplitude modulation; multiplies the source signal with a simple waveform, to produce either volume changes, or inharmonic overtones.
|
||||
---
|
||||
---| "ringmodulator"
|
||||
|
||||
---
|
||||
---The different types of waveforms that can be used with the '''ringmodulator''' EffectType.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/EffectWaveform)
|
||||
---
|
||||
---@alias love.EffectWaveform
|
||||
---
|
||||
---A sawtooth wave, also known as a ramp wave. Named for its linear rise, and (near-)instantaneous fall along time.
|
||||
---
|
||||
---| "sawtooth"
|
||||
---
|
||||
---A sine wave. Follows a trigonometric sine function.
|
||||
---
|
||||
---| "sine"
|
||||
---
|
||||
---A square wave. Switches between high and low states (near-)instantaneously.
|
||||
---
|
||||
---| "square"
|
||||
---
|
||||
---A triangle wave. Follows a linear rise and fall that repeats periodically.
|
||||
---
|
||||
---| "triangle"
|
||||
|
||||
---
|
||||
---Types of filters for Sources.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FilterType)
|
||||
---
|
||||
---@alias love.FilterType
|
||||
---
|
||||
---Low-pass filter. High frequency sounds are attenuated.
|
||||
---
|
||||
---| "lowpass"
|
||||
---
|
||||
---High-pass filter. Low frequency sounds are attenuated.
|
||||
---
|
||||
---| "highpass"
|
||||
---
|
||||
---Band-pass filter. Both high and low frequency sounds are attenuated based on the given parameters.
|
||||
---
|
||||
---| "bandpass"
|
||||
|
||||
---
|
||||
---Types of audio sources.
|
||||
---
|
||||
---A good rule of thumb is to use stream for music files and static for all short sound effects. Basically, you want to avoid loading large files into memory at once.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SourceType)
|
||||
---
|
||||
---@alias love.SourceType
|
||||
---
|
||||
---The whole audio is decoded.
|
||||
---
|
||||
---| "static"
|
||||
---
|
||||
---The audio is decoded in chunks when needed.
|
||||
---
|
||||
---| "stream"
|
||||
---
|
||||
---The audio must be manually queued by the user.
|
||||
---
|
||||
---| "queue"
|
||||
|
||||
---
|
||||
---Units that represent time.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/TimeUnit)
|
||||
---
|
||||
---@alias love.TimeUnit
|
||||
---
|
||||
---Regular seconds.
|
||||
---
|
||||
---| "seconds"
|
||||
---
|
||||
---Audio samples.
|
||||
---
|
||||
---| "samples"
|
||||
@@ -0,0 +1,264 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides functionality for creating and transforming data.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data)
|
||||
---
|
||||
---@class love.data
|
||||
love.data = {}
|
||||
|
||||
---
|
||||
---Compresses a string or data using a specific compression algorithm.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.compress)
|
||||
---
|
||||
---@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, data: love.Data, level?: number):love.CompressedData|string
|
||||
---@param container love.ContainerType # What type to return the compressed data as.
|
||||
---@param format love.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 love.CompressedData|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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.decode)
|
||||
---
|
||||
---@overload fun(container: love.ContainerType, format: love.EncodeFormat, sourceData: love.Data):love.ByteData|string
|
||||
---@param container love.ContainerType # What type to return the decoded data as.
|
||||
---@param format love.EncodeFormat # The format of the input data.
|
||||
---@param sourceString string # The raw (encoded) data to decode.
|
||||
---@return love.ByteData|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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.decompress)
|
||||
---
|
||||
---@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, compressedString: string):love.Data|string
|
||||
---@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, data: love.Data):love.Data|string
|
||||
---@param container love.ContainerType # What type to return the decompressed data as.
|
||||
---@param compressedData love.CompressedData # The compressed data to decompress.
|
||||
---@return love.Data|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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.encode)
|
||||
---
|
||||
---@overload fun(container: love.ContainerType, format: love.EncodeFormat, sourceData: love.Data, linelength?: number):love.ByteData|string
|
||||
---@param container love.ContainerType # What type to return the encoded data as.
|
||||
---@param format love.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 love.ByteData|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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.getPackedSize)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.hash)
|
||||
---
|
||||
---@overload fun(hashFunction: love.HashFunction, data: love.Data):string
|
||||
---@param hashFunction love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.newByteData)
|
||||
---
|
||||
---@overload fun(Data: love.Data, offset?: number, size?: number):love.ByteData
|
||||
---@overload fun(size: number):love.ByteData
|
||||
---@param datastring string # The byte string to copy.
|
||||
---@return love.ByteData bytedata # The new Data object.
|
||||
function love.data.newByteData(datastring) end
|
||||
|
||||
---
|
||||
---Creates a new Data referencing a subsection of an existing Data object.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.newDataView)
|
||||
---
|
||||
---@param data love.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 love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.pack)
|
||||
---
|
||||
---@param container love.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|boolean|string # The first value (number, boolean, or string) to serialize.
|
||||
---@vararg number|boolean|string # Additional values to serialize.
|
||||
---@return love.Data|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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data.unpack)
|
||||
---
|
||||
---@overload fun(format: string, data: love.Data, pos?: number):number|boolean|string, number|boolean|string, number
|
||||
---@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|boolean|string v1 # The first value (number, boolean, or string) that was unpacked.
|
||||
---@return number index # The index of the first unread byte in the data string.
|
||||
function love.data.unpack(format, datastring, pos) end
|
||||
|
||||
---
|
||||
---Data object containing arbitrary bytes in an contiguous memory.
|
||||
---
|
||||
---There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but Data:getPointer can be used with LuaJIT's FFI to access and write to the contents directly.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data)
|
||||
---
|
||||
---@class love.ByteData: love.Object, love.Data
|
||||
local ByteData = {}
|
||||
|
||||
---
|
||||
---Represents byte data compressed using a specific algorithm.
|
||||
---
|
||||
---love.data.decompress can be used to de-compress the data (or love.math.decompress in 0.10.2 or earlier).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.data)
|
||||
---
|
||||
---@class love.CompressedData: love.Data, love.Object
|
||||
local CompressedData = {}
|
||||
|
||||
---
|
||||
---Gets the compression format of the CompressedData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedData:getFormat)
|
||||
---
|
||||
---@return love.CompressedDataFormat format # The format of the CompressedData.
|
||||
function CompressedData:getFormat() end
|
||||
|
||||
---
|
||||
---Compressed data formats.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedDataFormat)
|
||||
---
|
||||
---@alias love.CompressedDataFormat
|
||||
---
|
||||
---The LZ4 compression format. Compresses and decompresses very quickly, but the compression ratio is not the best. LZ4-HC is used when compression level 9 is specified. Some benchmarks are available here.
|
||||
---
|
||||
---| "lz4"
|
||||
---
|
||||
---The zlib format is DEFLATE-compressed data with a small bit of header data. Compresses relatively slowly and decompresses moderately quickly, and has a decent compression ratio.
|
||||
---
|
||||
---| "zlib"
|
||||
---
|
||||
---The gzip format is DEFLATE-compressed data with a slightly larger header than zlib. Since it uses DEFLATE it has the same compression characteristics as the zlib format.
|
||||
---
|
||||
---| "gzip"
|
||||
---
|
||||
---Raw DEFLATE-compressed data (no header).
|
||||
---
|
||||
---| "deflate"
|
||||
|
||||
---
|
||||
---Return type of various data-returning functions.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ContainerType)
|
||||
---
|
||||
---@alias love.ContainerType
|
||||
---
|
||||
---Return type is ByteData.
|
||||
---
|
||||
---| "data"
|
||||
---
|
||||
---Return type is string.
|
||||
---
|
||||
---| "string"
|
||||
|
||||
---
|
||||
---Encoding format used to encode or decode data.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/EncodeFormat)
|
||||
---
|
||||
---@alias love.EncodeFormat
|
||||
---
|
||||
---Encode/decode data as base64 binary-to-text encoding.
|
||||
---
|
||||
---| "base64"
|
||||
---
|
||||
---Encode/decode data as hexadecimal string.
|
||||
---
|
||||
---| "hex"
|
||||
|
||||
---
|
||||
---Hash algorithm of love.data.hash.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/HashFunction)
|
||||
---
|
||||
---@alias love.HashFunction
|
||||
---
|
||||
---MD5 hash algorithm (16 bytes).
|
||||
---
|
||||
---| "md5"
|
||||
---
|
||||
---SHA1 hash algorithm (20 bytes).
|
||||
---
|
||||
---| "sha1"
|
||||
---
|
||||
---SHA2 hash algorithm with message digest size of 224 bits (28 bytes).
|
||||
---
|
||||
---| "sha224"
|
||||
---
|
||||
---SHA2 hash algorithm with message digest size of 256 bits (32 bytes).
|
||||
---
|
||||
---| "sha256"
|
||||
---
|
||||
---SHA2 hash algorithm with message digest size of 384 bits (48 bytes).
|
||||
---
|
||||
---| "sha384"
|
||||
---
|
||||
---SHA2 hash algorithm with message digest size of 512 bits (64 bytes).
|
||||
---
|
||||
---| "sha512"
|
||||
@@ -0,0 +1,244 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Manages events, like keypresses.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event)
|
||||
---
|
||||
---@class love.event
|
||||
love.event = {}
|
||||
|
||||
---
|
||||
---Clears the event queue.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event.clear)
|
||||
---
|
||||
function love.event.clear() end
|
||||
|
||||
---
|
||||
---Returns an iterator for messages in the event queue.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event.poll)
|
||||
---
|
||||
---@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).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event.pump)
|
||||
---
|
||||
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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event.push)
|
||||
---
|
||||
---@param n love.Event # The name of the event.
|
||||
---@param a? any # First event argument.
|
||||
---@param b? any # Second event argument.
|
||||
---@param c? any # Third event argument.
|
||||
---@param d? any # Fourth event argument.
|
||||
---@param e? any # Fifth event argument.
|
||||
---@param f? any # Sixth event argument.
|
||||
---@vararg any # 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event.quit)
|
||||
---
|
||||
---@overload fun(restart: string|'restart')
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.event.wait)
|
||||
---
|
||||
---@return love.Event n # The name of event.
|
||||
---@return any a # First event argument.
|
||||
---@return any b # Second event argument.
|
||||
---@return any c # Third event argument.
|
||||
---@return any d # Fourth event argument.
|
||||
---@return any e # Fifth event argument.
|
||||
---@return any f # Sixth event argument.
|
||||
function love.event.wait() end
|
||||
|
||||
---
|
||||
---Arguments to love.event.push() and the like.
|
||||
---
|
||||
---Since 0.8.0, event names are no longer abbreviated.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Event)
|
||||
---
|
||||
---@alias love.Event
|
||||
---
|
||||
---Window focus gained or lost
|
||||
---
|
||||
---| "focus"
|
||||
---
|
||||
---Joystick pressed
|
||||
---
|
||||
---| "joystickpressed"
|
||||
---
|
||||
---Joystick released
|
||||
---
|
||||
---| "joystickreleased"
|
||||
---
|
||||
---Key pressed
|
||||
---
|
||||
---| "keypressed"
|
||||
---
|
||||
---Key released
|
||||
---
|
||||
---| "keyreleased"
|
||||
---
|
||||
---Mouse pressed
|
||||
---
|
||||
---| "mousepressed"
|
||||
---
|
||||
---Mouse released
|
||||
---
|
||||
---| "mousereleased"
|
||||
---
|
||||
---Quit
|
||||
---
|
||||
---| "quit"
|
||||
---
|
||||
---Window size changed by the user
|
||||
---
|
||||
---| "resize"
|
||||
---
|
||||
---Window is minimized or un-minimized by the user
|
||||
---
|
||||
---| "visible"
|
||||
---
|
||||
---Window mouse focus gained or lost
|
||||
---
|
||||
---| "mousefocus"
|
||||
---
|
||||
---A Lua error has occurred in a thread
|
||||
---
|
||||
---| "threaderror"
|
||||
---
|
||||
---Joystick connected
|
||||
---
|
||||
---| "joystickadded"
|
||||
---
|
||||
---Joystick disconnected
|
||||
---
|
||||
---| "joystickremoved"
|
||||
---
|
||||
---Joystick axis motion
|
||||
---
|
||||
---| "joystickaxis"
|
||||
---
|
||||
---Joystick hat pressed
|
||||
---
|
||||
---| "joystickhat"
|
||||
---
|
||||
---Joystick's virtual gamepad button pressed
|
||||
---
|
||||
---| "gamepadpressed"
|
||||
---
|
||||
---Joystick's virtual gamepad button released
|
||||
---
|
||||
---| "gamepadreleased"
|
||||
---
|
||||
---Joystick's virtual gamepad axis moved
|
||||
---
|
||||
---| "gamepadaxis"
|
||||
---
|
||||
---User entered text
|
||||
---
|
||||
---| "textinput"
|
||||
---
|
||||
---Mouse position changed
|
||||
---
|
||||
---| "mousemoved"
|
||||
---
|
||||
---Running out of memory on mobile devices system
|
||||
---
|
||||
---| "lowmemory"
|
||||
---
|
||||
---Candidate text for an IME changed
|
||||
---
|
||||
---| "textedited"
|
||||
---
|
||||
---Mouse wheel moved
|
||||
---
|
||||
---| "wheelmoved"
|
||||
---
|
||||
---Touch screen touched
|
||||
---
|
||||
---| "touchpressed"
|
||||
---
|
||||
---Touch screen stop touching
|
||||
---
|
||||
---| "touchreleased"
|
||||
---
|
||||
---Touch press moved inside touch screen
|
||||
---
|
||||
---| "touchmoved"
|
||||
---
|
||||
---Directory is dragged and dropped onto the window
|
||||
---
|
||||
---| "directorydropped"
|
||||
---
|
||||
---File is dragged and dropped onto the window.
|
||||
---
|
||||
---| "filedropped"
|
||||
---
|
||||
---Joystick pressed
|
||||
---
|
||||
---| "jp"
|
||||
---
|
||||
---Joystick released
|
||||
---
|
||||
---| "jr"
|
||||
---
|
||||
---Key pressed
|
||||
---
|
||||
---| "kp"
|
||||
---
|
||||
---Key released
|
||||
---
|
||||
---| "kr"
|
||||
---
|
||||
---Mouse pressed
|
||||
---
|
||||
---| "mp"
|
||||
---
|
||||
---Mouse released
|
||||
---
|
||||
---| "mr"
|
||||
---
|
||||
---Quit
|
||||
---
|
||||
---| "q"
|
||||
---
|
||||
---Window focus gained or lost
|
||||
---
|
||||
---| "f"
|
||||
@@ -0,0 +1,653 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to the user's filesystem.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem)
|
||||
---
|
||||
---@class love.filesystem
|
||||
love.filesystem = {}
|
||||
|
||||
---
|
||||
---Append data to an existing file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.append)
|
||||
---
|
||||
---@overload fun(name: string, data: love.Data, size?: number):boolean, string
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.areSymlinksEnabled)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.createDirectory)
|
||||
---
|
||||
---@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)
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getAppdataDirectory)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getCRequirePath)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getDirectoryItems)
|
||||
---
|
||||
---@overload fun(dir: string, callback: function):table
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getIdentity)
|
||||
---
|
||||
---@return string name # The identity that is used as write directory.
|
||||
function love.filesystem.getIdentity() end
|
||||
|
||||
---
|
||||
---Gets information about the specified file or directory.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getInfo)
|
||||
---
|
||||
---@overload fun(path: string, info: table):table
|
||||
---@overload fun(path: string, filtertype: love.FileType, info: table):table
|
||||
---@param path string # The file or directory path to check.
|
||||
---@param filtertype? love.FileType # If supplied, this parameter causes getInfo to only return the info table if the item at the given path matches the specified file type.
|
||||
---@return {type: love.FileType, size: number, modtime: number} info # A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields:
|
||||
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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getRealDirectory)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getRequirePath)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getSaveDirectory)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getSource)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getSourceBaseDirectory)
|
||||
---
|
||||
---@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
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getUserDirectory)
|
||||
---
|
||||
---@return string path # The path of the user's directory
|
||||
function love.filesystem.getUserDirectory() end
|
||||
|
||||
---
|
||||
---Gets the current working directory.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.getWorkingDirectory)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.init)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.isFused)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.lines)
|
||||
---
|
||||
---@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).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.load)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.mount)
|
||||
---
|
||||
---@overload fun(filedata: love.FileData, mountpoint: string, appendToPath?: boolean):boolean
|
||||
---@overload fun(data: love.Data, archivename: string, mountpoint: string, appendToPath?: boolean):boolean
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.newFile)
|
||||
---
|
||||
---@overload fun(filename: string, mode: love.FileMode):love.File, string
|
||||
---@param filename string # The filename of the file.
|
||||
---@return love.File file # The new File object.
|
||||
function love.filesystem.newFile(filename) end
|
||||
|
||||
---
|
||||
---Creates a new FileData object from a file on disk, or from a string in memory.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.newFileData)
|
||||
---
|
||||
---@overload fun(originaldata: love.Data, name: string):love.FileData
|
||||
---@overload fun(filepath: string):love.FileData, string
|
||||
---@param contents string # The contents of the file in memory represented as a string.
|
||||
---@param name string # The name of the file. The extension may be parsed and used by LÖVE when passing the FileData object into love.audio.newSource.
|
||||
---@return love.FileData data # The new FileData.
|
||||
function love.filesystem.newFileData(contents, name) end
|
||||
|
||||
---
|
||||
---Read the contents of a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.read)
|
||||
---
|
||||
---@overload fun(container: love.ContainerType, name: string, size?: number):love.FileData|string, number, nil, string
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.remove)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.setCRequirePath)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.setIdentity)
|
||||
---
|
||||
---@overload fun(name: string)
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.setRequirePath)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.setSource)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.setSymlinksEnabled)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.unmount)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem.write)
|
||||
---
|
||||
---@overload fun(name: string, data: love.Data, size?: number):boolean, string
|
||||
---@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
|
||||
|
||||
---
|
||||
---Represents a file dropped onto the window.
|
||||
---
|
||||
---Note that the DroppedFile type can only be obtained from love.filedropped callback, and can't be constructed manually by the user.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem)
|
||||
---
|
||||
---@class love.DroppedFile: love.File, love.Object
|
||||
local DroppedFile = {}
|
||||
|
||||
---
|
||||
---Represents a file on the filesystem. A function that takes a file path can also take a File.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem)
|
||||
---
|
||||
---@class love.File: love.Object
|
||||
local File = {}
|
||||
|
||||
---
|
||||
---Closes a File.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:close)
|
||||
---
|
||||
---@return boolean success # Whether closing was successful.
|
||||
function File:close() end
|
||||
|
||||
---
|
||||
---Flushes any buffered written data in the file to the disk.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:flush)
|
||||
---
|
||||
---@return boolean success # Whether the file successfully flushed any buffered data to the disk.
|
||||
---@return string err # The error string, if an error occurred and the file could not be flushed.
|
||||
function File:flush() end
|
||||
|
||||
---
|
||||
---Gets the buffer mode of a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:getBuffer)
|
||||
---
|
||||
---@return love.BufferMode mode # The current buffer mode of the file.
|
||||
---@return number size # The maximum size in bytes of the file's buffer.
|
||||
function File:getBuffer() end
|
||||
|
||||
---
|
||||
---Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:getFilename)
|
||||
---
|
||||
---@return string filename # The filename of the File.
|
||||
function File:getFilename() end
|
||||
|
||||
---
|
||||
---Gets the FileMode the file has been opened with.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:getMode)
|
||||
---
|
||||
---@return love.FileMode mode # The mode this file has been opened with.
|
||||
function File:getMode() end
|
||||
|
||||
---
|
||||
---Returns the file size.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:getSize)
|
||||
---
|
||||
---@return number size # The file size in bytes.
|
||||
function File:getSize() end
|
||||
|
||||
---
|
||||
---Gets whether end-of-file has been reached.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:isEOF)
|
||||
---
|
||||
---@return boolean eof # Whether EOF has been reached.
|
||||
function File:isEOF() end
|
||||
|
||||
---
|
||||
---Gets whether the file is open.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:isOpen)
|
||||
---
|
||||
---@return boolean open # True if the file is currently open, false otherwise.
|
||||
function File:isOpen() end
|
||||
|
||||
---
|
||||
---Iterate over all the lines in a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:lines)
|
||||
---
|
||||
---@return function iterator # The iterator (can be used in for loops).
|
||||
function File:lines() end
|
||||
|
||||
---
|
||||
---Open the file for write, read or append.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:open)
|
||||
---
|
||||
---@param mode love.FileMode # The mode to open the file in.
|
||||
---@return boolean ok # True on success, false otherwise.
|
||||
---@return string err # The error string if an error occurred.
|
||||
function File:open(mode) end
|
||||
|
||||
---
|
||||
---Read a number of bytes from a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:read)
|
||||
---
|
||||
---@overload fun(self: love.File, container: love.ContainerType, bytes?: number):love.FileData|string, number
|
||||
---@param bytes? number # The number of bytes to read.
|
||||
---@return string contents # The contents of the read bytes.
|
||||
---@return number size # How many bytes have been read.
|
||||
function File:read(bytes) end
|
||||
|
||||
---
|
||||
---Seek to a position in a file
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:seek)
|
||||
---
|
||||
---@param pos number # The position to seek to
|
||||
---@return boolean success # Whether the operation was successful
|
||||
function File:seek(pos) end
|
||||
|
||||
---
|
||||
---Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode.
|
||||
---
|
||||
---File:flush will force any buffered data to be written to the disk.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:setBuffer)
|
||||
---
|
||||
---@param mode love.BufferMode # The buffer mode to use.
|
||||
---@param size? number # The maximum size in bytes of the file's buffer.
|
||||
---@return boolean success # Whether the buffer mode was successfully set.
|
||||
---@return string errorstr # The error string, if the buffer mode could not be set and an error occurred.
|
||||
function File:setBuffer(mode, size) end
|
||||
|
||||
---
|
||||
---Returns the position in the file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:tell)
|
||||
---
|
||||
---@return number pos # The current position.
|
||||
function File:tell() end
|
||||
|
||||
---
|
||||
---Write data to a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/File:write)
|
||||
---
|
||||
---@overload fun(self: love.File, data: love.Data, size?: number):boolean, string
|
||||
---@param data string # The string data to write.
|
||||
---@param size? number # How many bytes to write.
|
||||
---@return boolean success # Whether the operation was successful.
|
||||
---@return string err # The error string if an error occurred.
|
||||
function File:write(data, size) end
|
||||
|
||||
---
|
||||
---Data representing the contents of a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.filesystem)
|
||||
---
|
||||
---@class love.FileData: love.Data, love.Object
|
||||
local FileData = {}
|
||||
|
||||
---
|
||||
---Gets the extension of the FileData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FileData:getExtension)
|
||||
---
|
||||
---@return string ext # The extension of the file the FileData represents.
|
||||
function FileData:getExtension() end
|
||||
|
||||
---
|
||||
---Gets the filename of the FileData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FileData:getFilename)
|
||||
---
|
||||
---@return string name # The name of the file the FileData represents.
|
||||
function FileData:getFilename() end
|
||||
|
||||
---
|
||||
---Buffer modes for File objects.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BufferMode)
|
||||
---
|
||||
---@alias love.BufferMode
|
||||
---
|
||||
---No buffering. The result of write and append operations appears immediately.
|
||||
---
|
||||
---| "none"
|
||||
---
|
||||
---Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.
|
||||
---
|
||||
---| "line"
|
||||
---
|
||||
---Full buffering. Write and append operations are always buffered until the buffer size limit is reached.
|
||||
---
|
||||
---| "full"
|
||||
|
||||
---
|
||||
---How to decode a given FileData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FileDecoder)
|
||||
---
|
||||
---@alias love.FileDecoder
|
||||
---
|
||||
---The data is unencoded.
|
||||
---
|
||||
---| "file"
|
||||
---
|
||||
---The data is base64-encoded.
|
||||
---
|
||||
---| "base64"
|
||||
|
||||
---
|
||||
---The different modes you can open a File in.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FileMode)
|
||||
---
|
||||
---@alias love.FileMode
|
||||
---
|
||||
---Open a file for read.
|
||||
---
|
||||
---| "r"
|
||||
---
|
||||
---Open a file for write.
|
||||
---
|
||||
---| "w"
|
||||
---
|
||||
---Open a file for append.
|
||||
---
|
||||
---| "a"
|
||||
---
|
||||
---Do not open a file (represents a closed file.)
|
||||
---
|
||||
---| "c"
|
||||
|
||||
---
|
||||
---The type of a file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FileType)
|
||||
---
|
||||
---@alias love.FileType
|
||||
---
|
||||
---Regular file.
|
||||
---
|
||||
---| "file"
|
||||
---
|
||||
---Directory.
|
||||
---
|
||||
---| "directory"
|
||||
---
|
||||
---Symbolic link.
|
||||
---
|
||||
---| "symlink"
|
||||
---
|
||||
---Something completely different like a device.
|
||||
---
|
||||
---| "other"
|
||||
@@ -0,0 +1,281 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Allows you to work with fonts.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font)
|
||||
---
|
||||
---@class love.font
|
||||
love.font = {}
|
||||
|
||||
---
|
||||
---Creates a new BMFont Rasterizer.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font.newBMFontRasterizer)
|
||||
---
|
||||
---@overload fun(fileName: string, glyphs: string, dpiscale?: number):love.Rasterizer
|
||||
---@param imageData love.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 love.Rasterizer rasterizer # The rasterizer.
|
||||
function love.font.newBMFontRasterizer(imageData, glyphs, dpiscale) end
|
||||
|
||||
---
|
||||
---Creates a new GlyphData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font.newGlyphData)
|
||||
---
|
||||
---@param rasterizer love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font.newImageRasterizer)
|
||||
---
|
||||
---@param imageData love.ImageData # Font image data.
|
||||
---@param glyphs string # String containing font glyphs.
|
||||
---@param extraSpacing? number # Font extra spacing.
|
||||
---@param dpiscale? number # Font DPI scale.
|
||||
---@return love.Rasterizer rasterizer # The rasterizer.
|
||||
function love.font.newImageRasterizer(imageData, glyphs, extraSpacing, dpiscale) end
|
||||
|
||||
---
|
||||
---Creates a new Rasterizer.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font.newRasterizer)
|
||||
---
|
||||
---@overload fun(data: love.FileData):love.Rasterizer
|
||||
---@overload fun(size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer
|
||||
---@overload fun(fileName: string, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer
|
||||
---@overload fun(fileData: love.FileData, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer
|
||||
---@overload fun(imageData: love.ImageData, glyphs: string, dpiscale?: number):love.Rasterizer
|
||||
---@overload fun(fileName: string, glyphs: string, dpiscale?: number):love.Rasterizer
|
||||
---@param filename string # The font file.
|
||||
---@return love.Rasterizer rasterizer # The rasterizer.
|
||||
function love.font.newRasterizer(filename) end
|
||||
|
||||
---
|
||||
---Creates a new TrueType Rasterizer.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font.newTrueTypeRasterizer)
|
||||
---
|
||||
---@overload fun(fileName: string, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer
|
||||
---@overload fun(fileData: love.FileData, size?: number, hinting?: love.HintingMode, dpiscale?: number):love.Rasterizer
|
||||
---@param size? number # The font size.
|
||||
---@param hinting? love.HintingMode # True Type hinting mode.
|
||||
---@param dpiscale? number # The font DPI scale.
|
||||
---@return love.Rasterizer rasterizer # The rasterizer.
|
||||
function love.font.newTrueTypeRasterizer(size, hinting, dpiscale) end
|
||||
|
||||
---
|
||||
---A GlyphData represents a drawable symbol of a font Rasterizer.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font)
|
||||
---
|
||||
---@class love.GlyphData: love.Data, love.Object
|
||||
local GlyphData = {}
|
||||
|
||||
---
|
||||
---Gets glyph advance.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getAdvance)
|
||||
---
|
||||
---@return number advance # Glyph advance.
|
||||
function GlyphData:getAdvance() end
|
||||
|
||||
---
|
||||
---Gets glyph bearing.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getBearing)
|
||||
---
|
||||
---@return number bx # Glyph bearing X.
|
||||
---@return number by # Glyph bearing Y.
|
||||
function GlyphData:getBearing() end
|
||||
|
||||
---
|
||||
---Gets glyph bounding box.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getBoundingBox)
|
||||
---
|
||||
---@return number x # Glyph position x.
|
||||
---@return number y # Glyph position y.
|
||||
---@return number width # Glyph width.
|
||||
---@return number height # Glyph height.
|
||||
function GlyphData:getBoundingBox() end
|
||||
|
||||
---
|
||||
---Gets glyph dimensions.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getDimensions)
|
||||
---
|
||||
---@return number width # Glyph width.
|
||||
---@return number height # Glyph height.
|
||||
function GlyphData:getDimensions() end
|
||||
|
||||
---
|
||||
---Gets glyph pixel format.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getFormat)
|
||||
---
|
||||
---@return love.PixelFormat format # Glyph pixel format.
|
||||
function GlyphData:getFormat() end
|
||||
|
||||
---
|
||||
---Gets glyph number.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getGlyph)
|
||||
---
|
||||
---@return number glyph # Glyph number.
|
||||
function GlyphData:getGlyph() end
|
||||
|
||||
---
|
||||
---Gets glyph string.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getGlyphString)
|
||||
---
|
||||
---@return string glyph # Glyph string.
|
||||
function GlyphData:getGlyphString() end
|
||||
|
||||
---
|
||||
---Gets glyph height.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getHeight)
|
||||
---
|
||||
---@return number height # Glyph height.
|
||||
function GlyphData:getHeight() end
|
||||
|
||||
---
|
||||
---Gets glyph width.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GlyphData:getWidth)
|
||||
---
|
||||
---@return number width # Glyph width.
|
||||
function GlyphData:getWidth() end
|
||||
|
||||
---
|
||||
---A Rasterizer handles font rendering, containing the font data (image or TrueType font) and drawable glyphs.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.font)
|
||||
---
|
||||
---@class love.Rasterizer: love.Object
|
||||
local Rasterizer = {}
|
||||
|
||||
---
|
||||
---Gets font advance.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getAdvance)
|
||||
---
|
||||
---@return number advance # Font advance.
|
||||
function Rasterizer:getAdvance() end
|
||||
|
||||
---
|
||||
---Gets ascent height.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getAscent)
|
||||
---
|
||||
---@return number height # Ascent height.
|
||||
function Rasterizer:getAscent() end
|
||||
|
||||
---
|
||||
---Gets descent height.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getDescent)
|
||||
---
|
||||
---@return number height # Descent height.
|
||||
function Rasterizer:getDescent() end
|
||||
|
||||
---
|
||||
---Gets number of glyphs in font.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getGlyphCount)
|
||||
---
|
||||
---@return number count # Glyphs count.
|
||||
function Rasterizer:getGlyphCount() end
|
||||
|
||||
---
|
||||
---Gets glyph data of a specified glyph.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getGlyphData)
|
||||
---
|
||||
---@overload fun(self: love.Rasterizer, glyphNumber: number):love.GlyphData
|
||||
---@param glyph string # Glyph
|
||||
---@return love.GlyphData glyphData # Glyph data
|
||||
function Rasterizer:getGlyphData(glyph) end
|
||||
|
||||
---
|
||||
---Gets font height.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getHeight)
|
||||
---
|
||||
---@return number height # Font height
|
||||
function Rasterizer:getHeight() end
|
||||
|
||||
---
|
||||
---Gets line height of a font.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:getLineHeight)
|
||||
---
|
||||
---@return number height # Line height of a font.
|
||||
function Rasterizer:getLineHeight() end
|
||||
|
||||
---
|
||||
---Checks if font contains specified glyphs.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Rasterizer:hasGlyphs)
|
||||
---
|
||||
---@param glyph1 string|number # Glyph
|
||||
---@param glyph2 string|number # Glyph
|
||||
---@vararg string|number # Additional glyphs
|
||||
---@return boolean hasGlyphs # Whatever font contains specified glyphs.
|
||||
function Rasterizer:hasGlyphs(glyph1, glyph2, ...) end
|
||||
|
||||
---
|
||||
---True Type hinting mode.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/HintingMode)
|
||||
---
|
||||
---@alias love.HintingMode
|
||||
---
|
||||
---Default hinting. Should be preferred for typical antialiased fonts.
|
||||
---
|
||||
---| "normal"
|
||||
---
|
||||
---Results in fuzzier text but can sometimes preserve the original glyph shapes of the text better than normal hinting.
|
||||
---
|
||||
---| "light"
|
||||
---
|
||||
---Results in aliased / unsmoothed text with either full opacity or completely transparent pixels. Should be used when antialiasing is not desired for the font.
|
||||
---
|
||||
---| "mono"
|
||||
---
|
||||
---Disables hinting for the font. Results in fuzzier text.
|
||||
---
|
||||
---| "none"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,695 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to decode encoded image data.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.image)
|
||||
---
|
||||
---@class love.image
|
||||
love.image = {}
|
||||
|
||||
---
|
||||
---Determines whether a file can be loaded as CompressedImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.image.isCompressed)
|
||||
---
|
||||
---@overload fun(fileData: love.FileData):boolean
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.image.newCompressedData)
|
||||
---
|
||||
---@overload fun(fileData: love.FileData):love.CompressedImageData
|
||||
---@param filename string # The filename of the compressed image file.
|
||||
---@return love.CompressedImageData compressedImageData # The new CompressedImageData object.
|
||||
function love.image.newCompressedData(filename) end
|
||||
|
||||
---
|
||||
---Creates a new ImageData object.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.image.newImageData)
|
||||
---
|
||||
---@overload fun(width: number, height: number, format?: love.PixelFormat, data?: string):love.ImageData
|
||||
---@overload fun(width: number, height: number, data: string):love.ImageData
|
||||
---@overload fun(filename: string):love.ImageData
|
||||
---@overload fun(filedata: love.FileData):love.ImageData
|
||||
---@param width number # The width of the ImageData.
|
||||
---@param height number # The height of the ImageData.
|
||||
---@return love.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
|
||||
|
||||
---
|
||||
---Represents compressed image data designed to stay compressed in RAM.
|
||||
---
|
||||
---CompressedImageData encompasses standard compressed texture formats such as DXT1, DXT5, and BC5 / 3Dc.
|
||||
---
|
||||
---You can't draw CompressedImageData directly to the screen. See Image for that.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.image)
|
||||
---
|
||||
---@class love.CompressedImageData: love.Data, love.Object
|
||||
local CompressedImageData = {}
|
||||
|
||||
---
|
||||
---Gets the width and height of the CompressedImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getDimensions)
|
||||
---
|
||||
---@overload fun(self: love.CompressedImageData, level: number):number, number
|
||||
---@return number width # The width of the CompressedImageData.
|
||||
---@return number height # The height of the CompressedImageData.
|
||||
function CompressedImageData:getDimensions() end
|
||||
|
||||
---
|
||||
---Gets the format of the CompressedImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getFormat)
|
||||
---
|
||||
---@return love.CompressedImageFormat format # The format of the CompressedImageData.
|
||||
function CompressedImageData:getFormat() end
|
||||
|
||||
---
|
||||
---Gets the height of the CompressedImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getHeight)
|
||||
---
|
||||
---@overload fun(self: love.CompressedImageData, level: number):number
|
||||
---@return number height # The height of the CompressedImageData.
|
||||
function CompressedImageData:getHeight() end
|
||||
|
||||
---
|
||||
---Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getMipmapCount)
|
||||
---
|
||||
---@return number mipmaps # The number of mipmap levels stored in the CompressedImageData.
|
||||
function CompressedImageData:getMipmapCount() end
|
||||
|
||||
---
|
||||
---Gets the width of the CompressedImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedImageData:getWidth)
|
||||
---
|
||||
---@overload fun(self: love.CompressedImageData, level: number):number
|
||||
---@return number width # The width of the CompressedImageData.
|
||||
function CompressedImageData:getWidth() end
|
||||
|
||||
---
|
||||
---Raw (decoded) image data.
|
||||
---
|
||||
---You can't draw ImageData directly to screen. See Image for that.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.image)
|
||||
---
|
||||
---@class love.ImageData: love.Data, love.Object
|
||||
local ImageData = {}
|
||||
|
||||
---
|
||||
---Encodes the ImageData and optionally writes it to the save directory.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:encode)
|
||||
---
|
||||
---@overload fun(self: love.ImageData, outFile: string)
|
||||
---@overload fun(self: love.ImageData, outFile: string, format: love.ImageFormat)
|
||||
---@param format love.ImageFormat # The format to encode the image as.
|
||||
---@param filename? string # The filename to write the file to. If nil, no file will be written but the FileData will still be returned.
|
||||
---@return love.FileData filedata # The encoded image as a new FileData object.
|
||||
function ImageData:encode(format, filename) end
|
||||
|
||||
---
|
||||
---Gets the width and height of the ImageData in pixels.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:getDimensions)
|
||||
---
|
||||
---@return number width # The width of the ImageData in pixels.
|
||||
---@return number height # The height of the ImageData in pixels.
|
||||
function ImageData:getDimensions() end
|
||||
|
||||
---
|
||||
---Gets the height of the ImageData in pixels.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:getHeight)
|
||||
---
|
||||
---@return number height # The height of the ImageData in pixels.
|
||||
function ImageData:getHeight() end
|
||||
|
||||
---
|
||||
---Gets the color of a pixel at a specific position in the image.
|
||||
---
|
||||
---Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored.
|
||||
---
|
||||
---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:getPixel)
|
||||
---
|
||||
---@param x number # The position of the pixel on the x-axis.
|
||||
---@param y number # The position of the pixel on the y-axis.
|
||||
---@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 ImageData:getPixel(x, y) end
|
||||
|
||||
---
|
||||
---Gets the width of the ImageData in pixels.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:getWidth)
|
||||
---
|
||||
---@return number width # The width of the ImageData in pixels.
|
||||
function ImageData:getWidth() end
|
||||
|
||||
---
|
||||
---Transform an image by applying a function to every pixel.
|
||||
---
|
||||
---This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData.
|
||||
---
|
||||
---The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel.
|
||||
---
|
||||
---function pixelFunction(x, y, r, g, b, a)
|
||||
---
|
||||
--- -- template for defining your own pixel mapping function
|
||||
---
|
||||
--- -- perform computations giving the new values for r, g, b and a
|
||||
---
|
||||
--- -- ...
|
||||
---
|
||||
--- return r, g, b, a
|
||||
---
|
||||
---end
|
||||
---
|
||||
---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:mapPixel)
|
||||
---
|
||||
---@param pixelFunction function # Function to apply to every pixel.
|
||||
---@param x? number # The x-axis of the top-left corner of the area within the ImageData to apply the function to.
|
||||
---@param y? number # The y-axis of the top-left corner of the area within the ImageData to apply the function to.
|
||||
---@param width? number # The width of the area within the ImageData to apply the function to.
|
||||
---@param height? number # The height of the area within the ImageData to apply the function to.
|
||||
function ImageData:mapPixel(pixelFunction, x, y, width, height) end
|
||||
|
||||
---
|
||||
---Paste into ImageData from another source ImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:paste)
|
||||
---
|
||||
---@param source love.ImageData # Source ImageData from which to copy.
|
||||
---@param dx number # Destination top-left position on x-axis.
|
||||
---@param dy number # Destination top-left position on y-axis.
|
||||
---@param sx number # Source top-left position on x-axis.
|
||||
---@param sy number # Source top-left position on y-axis.
|
||||
---@param sw number # Source width.
|
||||
---@param sh number # Source height.
|
||||
function ImageData:paste(source, dx, dy, sx, sy, sw, sh) end
|
||||
|
||||
---
|
||||
---Sets the color of a pixel at a specific position in the image.
|
||||
---
|
||||
---Valid x and y values start at 0 and go up to image width and height minus 1.
|
||||
---
|
||||
---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:setPixel)
|
||||
---
|
||||
---@overload fun(self: love.ImageData, x: number, y: number, color: table)
|
||||
---@param x number # The position of the pixel on the x-axis.
|
||||
---@param y number # The position of the pixel on the y-axis.
|
||||
---@param r number # The red component (0-1).
|
||||
---@param g number # The green component (0-1).
|
||||
---@param b number # The blue component (0-1).
|
||||
---@param a number # The alpha component (0-1).
|
||||
function ImageData:setPixel(x, y, r, g, b, a) end
|
||||
|
||||
---
|
||||
---Gets the pixel format of the ImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageData:getFormat)
|
||||
---
|
||||
---@return love.PixelFormat format # The pixel format the ImageData was created with.
|
||||
function ImageData:getFormat() end
|
||||
|
||||
---
|
||||
---Compressed image data formats. Here and here are a couple overviews of many of the formats.
|
||||
---
|
||||
---Unlike traditional PNG or jpeg, these formats stay compressed in RAM and in the graphics card's VRAM. This is good for saving memory space as well as improving performance, since the graphics card will be able to keep more of the image's pixels in its fast-access cache when drawing it.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CompressedImageFormat)
|
||||
---
|
||||
---@alias love.CompressedImageFormat
|
||||
---
|
||||
---The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
|
||||
---
|
||||
---| "DXT1"
|
||||
---
|
||||
---The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
|
||||
---
|
||||
---| "DXT3"
|
||||
---
|
||||
---The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
|
||||
---
|
||||
---| "DXT5"
|
||||
---
|
||||
---The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
|
||||
---
|
||||
---| "BC4"
|
||||
---
|
||||
---The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
|
||||
---
|
||||
---| "BC4s"
|
||||
---
|
||||
---The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
|
||||
---
|
||||
---| "BC5"
|
||||
---
|
||||
---The signed variant of the BC5 format.
|
||||
---
|
||||
---| "BC5s"
|
||||
---
|
||||
---The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
|
||||
---
|
||||
---| "BC6h"
|
||||
---
|
||||
---The signed variant of the BC6H format. Stores RGB data in the range of +65504.
|
||||
---
|
||||
---| "BC6hs"
|
||||
---
|
||||
---The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
|
||||
---
|
||||
---| "BC7"
|
||||
---
|
||||
---The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
|
||||
---
|
||||
---| "ETC1"
|
||||
---
|
||||
---The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
|
||||
---
|
||||
---| "ETC2rgb"
|
||||
---
|
||||
---The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
|
||||
---
|
||||
---| "ETC2rgba"
|
||||
---
|
||||
---The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
|
||||
---
|
||||
---| "ETC2rgba1"
|
||||
---
|
||||
---The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
|
||||
---
|
||||
---| "EACr"
|
||||
---
|
||||
---The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
|
||||
---
|
||||
---| "EACrs"
|
||||
---
|
||||
---The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
|
||||
---
|
||||
---| "EACrg"
|
||||
---
|
||||
---The signed two-channel variant of the EAC format.
|
||||
---
|
||||
---| "EACrgs"
|
||||
---
|
||||
---The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
|
||||
---
|
||||
---| "PVR1rgb2"
|
||||
---
|
||||
---The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
|
||||
---
|
||||
---| "PVR1rgb4"
|
||||
---
|
||||
---The 2 bit per pixel RGBA variant of the PVRTC1 format.
|
||||
---
|
||||
---| "PVR1rgba2"
|
||||
---
|
||||
---The 4 bit per pixel RGBA variant of the PVRTC1 format.
|
||||
---
|
||||
---| "PVR1rgba4"
|
||||
---
|
||||
---The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
|
||||
---
|
||||
---| "ASTC4x4"
|
||||
---
|
||||
---The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
|
||||
---
|
||||
---| "ASTC5x4"
|
||||
---
|
||||
---The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
|
||||
---
|
||||
---| "ASTC5x5"
|
||||
---
|
||||
---The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
|
||||
---
|
||||
---| "ASTC6x5"
|
||||
---
|
||||
---The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
|
||||
---
|
||||
---| "ASTC6x6"
|
||||
---
|
||||
---The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
|
||||
---
|
||||
---| "ASTC8x5"
|
||||
---
|
||||
---The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
|
||||
---
|
||||
---| "ASTC8x6"
|
||||
---
|
||||
---The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
|
||||
---
|
||||
---| "ASTC8x8"
|
||||
---
|
||||
---The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x5"
|
||||
---
|
||||
---The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x6"
|
||||
---
|
||||
---The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x8"
|
||||
---
|
||||
---The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x10"
|
||||
---
|
||||
---The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
|
||||
---
|
||||
---| "ASTC12x10"
|
||||
---
|
||||
---The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
|
||||
---
|
||||
---| "ASTC12x12"
|
||||
|
||||
---
|
||||
---Encoded image formats.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/ImageFormat)
|
||||
---
|
||||
---@alias love.ImageFormat
|
||||
---
|
||||
---Targa image format.
|
||||
---
|
||||
---| "tga"
|
||||
---
|
||||
---PNG image format.
|
||||
---
|
||||
---| "png"
|
||||
---
|
||||
---JPG image format.
|
||||
---
|
||||
---| "jpg"
|
||||
---
|
||||
---BMP image format.
|
||||
---
|
||||
---| "bmp"
|
||||
|
||||
---
|
||||
---Pixel formats for Textures, ImageData, and CompressedImageData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/PixelFormat)
|
||||
---
|
||||
---@alias love.PixelFormat
|
||||
---
|
||||
---Indicates unknown pixel format, used internally.
|
||||
---
|
||||
---| "unknown"
|
||||
---
|
||||
---Alias for rgba8, or srgba8 if gamma-correct rendering is enabled.
|
||||
---
|
||||
---| "normal"
|
||||
---
|
||||
---A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
|
||||
---
|
||||
---| "hdr"
|
||||
---
|
||||
---Single-channel (red component) format (8 bpp).
|
||||
---
|
||||
---| "r8"
|
||||
---
|
||||
---Two channels (red and green components) with 8 bits per channel (16 bpp).
|
||||
---
|
||||
---| "rg8"
|
||||
---
|
||||
---8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).
|
||||
---
|
||||
---| "rgba8"
|
||||
---
|
||||
---gamma-correct version of rgba8.
|
||||
---
|
||||
---| "srgba8"
|
||||
---
|
||||
---Single-channel (red component) format (16 bpp).
|
||||
---
|
||||
---| "r16"
|
||||
---
|
||||
---Two channels (red and green components) with 16 bits per channel (32 bpp).
|
||||
---
|
||||
---| "rg16"
|
||||
---
|
||||
---16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders).
|
||||
---
|
||||
---| "rgba16"
|
||||
---
|
||||
---Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].
|
||||
---
|
||||
---| "r16f"
|
||||
---
|
||||
---Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].
|
||||
---
|
||||
---| "rg16f"
|
||||
---
|
||||
---Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].
|
||||
---
|
||||
---| "rgba16f"
|
||||
---
|
||||
---Floating point single-channel format (32 bpp).
|
||||
---
|
||||
---| "r32f"
|
||||
---
|
||||
---Floating point two-channel format with 32 bits per channel (64 bpp).
|
||||
---
|
||||
---| "rg32f"
|
||||
---
|
||||
---Floating point RGBA with 32 bits per channel (128 bpp).
|
||||
---
|
||||
---| "rgba32f"
|
||||
---
|
||||
---Same as rg8, but accessed as (L, L, L, A)
|
||||
---
|
||||
---| "la8"
|
||||
---
|
||||
---4 bits per channel (16 bpp) RGBA.
|
||||
---
|
||||
---| "rgba4"
|
||||
---
|
||||
---RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).
|
||||
---
|
||||
---| "rgb5a1"
|
||||
---
|
||||
---RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
|
||||
---
|
||||
---| "rgb565"
|
||||
---
|
||||
---RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).
|
||||
---
|
||||
---| "rgb10a2"
|
||||
---
|
||||
---Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].
|
||||
---
|
||||
---| "rg11b10f"
|
||||
---
|
||||
---No depth buffer and 8-bit stencil buffer.
|
||||
---
|
||||
---| "stencil8"
|
||||
---
|
||||
---16-bit depth buffer and no stencil buffer.
|
||||
---
|
||||
---| "depth16"
|
||||
---
|
||||
---24-bit depth buffer and no stencil buffer.
|
||||
---
|
||||
---| "depth24"
|
||||
---
|
||||
---32-bit float depth buffer and no stencil buffer.
|
||||
---
|
||||
---| "depth32f"
|
||||
---
|
||||
---24-bit depth buffer and 8-bit stencil buffer.
|
||||
---
|
||||
---| "depth24stencil8"
|
||||
---
|
||||
---32-bit float depth buffer and 8-bit stencil buffer.
|
||||
---
|
||||
---| "depth32fstencil8"
|
||||
---
|
||||
---The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems.
|
||||
---
|
||||
---| "DXT1"
|
||||
---
|
||||
---The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
|
||||
---
|
||||
---| "DXT3"
|
||||
---
|
||||
---The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.
|
||||
---
|
||||
---| "DXT5"
|
||||
---
|
||||
---The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
|
||||
---
|
||||
---| "BC4"
|
||||
---
|
||||
---The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
|
||||
---
|
||||
---| "BC4s"
|
||||
---
|
||||
---The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
|
||||
---
|
||||
---| "BC5"
|
||||
---
|
||||
---The signed variant of the BC5 format.
|
||||
---
|
||||
---| "BC5s"
|
||||
---
|
||||
---The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems.
|
||||
---
|
||||
---| "BC6h"
|
||||
---
|
||||
---The signed variant of the BC6H format. Stores RGB data in the range of +65504.
|
||||
---
|
||||
---| "BC6hs"
|
||||
---
|
||||
---The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
|
||||
---
|
||||
---| "BC7"
|
||||
---
|
||||
---The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
|
||||
---
|
||||
---| "ETC1"
|
||||
---
|
||||
---The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
|
||||
---
|
||||
---| "ETC2rgb"
|
||||
---
|
||||
---The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
|
||||
---
|
||||
---| "ETC2rgba"
|
||||
---
|
||||
---The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
|
||||
---
|
||||
---| "ETC2rgba1"
|
||||
---
|
||||
---The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
|
||||
---
|
||||
---| "EACr"
|
||||
---
|
||||
---The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders.
|
||||
---
|
||||
---| "EACrs"
|
||||
---
|
||||
---The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
|
||||
---
|
||||
---| "EACrg"
|
||||
---
|
||||
---The signed two-channel variant of the EAC format.
|
||||
---
|
||||
---| "EACrgs"
|
||||
---
|
||||
---The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
|
||||
---
|
||||
---| "PVR1rgb2"
|
||||
---
|
||||
---The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
|
||||
---
|
||||
---| "PVR1rgb4"
|
||||
---
|
||||
---The 2 bit per pixel RGBA variant of the PVRTC1 format.
|
||||
---
|
||||
---| "PVR1rgba2"
|
||||
---
|
||||
---The 4 bit per pixel RGBA variant of the PVRTC1 format.
|
||||
---
|
||||
---| "PVR1rgba4"
|
||||
---
|
||||
---The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
|
||||
---
|
||||
---| "ASTC4x4"
|
||||
---
|
||||
---The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
|
||||
---
|
||||
---| "ASTC5x4"
|
||||
---
|
||||
---The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
|
||||
---
|
||||
---| "ASTC5x5"
|
||||
---
|
||||
---The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
|
||||
---
|
||||
---| "ASTC6x5"
|
||||
---
|
||||
---The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
|
||||
---
|
||||
---| "ASTC6x6"
|
||||
---
|
||||
---The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
|
||||
---
|
||||
---| "ASTC8x5"
|
||||
---
|
||||
---The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
|
||||
---
|
||||
---| "ASTC8x6"
|
||||
---
|
||||
---The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
|
||||
---
|
||||
---| "ASTC8x8"
|
||||
---
|
||||
---The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x5"
|
||||
---
|
||||
---The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x6"
|
||||
---
|
||||
---The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x8"
|
||||
---
|
||||
---The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
|
||||
---
|
||||
---| "ASTC10x10"
|
||||
---
|
||||
---The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
|
||||
---
|
||||
---| "ASTC12x10"
|
||||
---
|
||||
---The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.
|
||||
---
|
||||
---| "ASTC12x12"
|
||||
@@ -0,0 +1,464 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to the user's joystick.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick.getGamepadMappingString)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick.getJoystickCount)
|
||||
---
|
||||
---@return number joystickcount # The number of connected joysticks.
|
||||
function love.joystick.getJoystickCount() end
|
||||
|
||||
---
|
||||
---Gets a list of connected Joysticks.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick.getJoysticks)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick.loadGamepadMappings)
|
||||
---
|
||||
---@overload fun(mappings: string)
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick.saveGamepadMappings)
|
||||
---
|
||||
---@overload fun():string
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick.setGamepadMapping)
|
||||
---
|
||||
---@overload fun(guid: string, axis: love.GamepadAxis, inputtype: love.JoystickInputType, inputindex: number, hatdir?: love.JoystickHat):boolean
|
||||
---@param guid string # The OS-dependent GUID for the type of Joystick the binding will affect.
|
||||
---@param button love.GamepadButton # The virtual gamepad button to bind.
|
||||
---@param inputtype love.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? love.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
|
||||
|
||||
---
|
||||
---Represents a physical joystick.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.joystick)
|
||||
---
|
||||
---@class love.Joystick: love.Object
|
||||
local Joystick = {}
|
||||
|
||||
---
|
||||
---Gets the direction of each axis.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getAxes)
|
||||
---
|
||||
---@return number axisDir1 # Direction of axis1.
|
||||
---@return number axisDir2 # Direction of axis2.
|
||||
---@return number axisDirN # Direction of axisN.
|
||||
function Joystick:getAxes() end
|
||||
|
||||
---
|
||||
---Gets the direction of an axis.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getAxis)
|
||||
---
|
||||
---@param axis number # The index of the axis to be checked.
|
||||
---@return number direction # Current value of the axis.
|
||||
function Joystick:getAxis(axis) end
|
||||
|
||||
---
|
||||
---Gets the number of axes on the joystick.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getAxisCount)
|
||||
---
|
||||
---@return number axes # The number of axes available.
|
||||
function Joystick:getAxisCount() end
|
||||
|
||||
---
|
||||
---Gets the number of buttons on the joystick.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getButtonCount)
|
||||
---
|
||||
---@return number buttons # The number of buttons available.
|
||||
function Joystick:getButtonCount() end
|
||||
|
||||
---
|
||||
---Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems.
|
||||
---
|
||||
---Can be used to show different icons, etc. for different gamepads.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getDeviceInfo)
|
||||
---
|
||||
---@return number vendorID # The USB vendor ID of the joystick.
|
||||
---@return number productID # The USB product ID of the joystick.
|
||||
---@return number productVersion # The product version of the joystick.
|
||||
function Joystick:getDeviceInfo() end
|
||||
|
||||
---
|
||||
---Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getGUID)
|
||||
---
|
||||
---@return string guid # The Joystick type's OS-dependent unique identifier.
|
||||
function Joystick:getGUID() end
|
||||
|
||||
---
|
||||
---Gets the direction of a virtual gamepad axis. If the Joystick isn't recognized as a gamepad or isn't connected, this function will always return 0.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getGamepadAxis)
|
||||
---
|
||||
---@param axis love.GamepadAxis # The virtual axis to be checked.
|
||||
---@return number direction # Current value of the axis.
|
||||
function Joystick:getGamepadAxis(axis) end
|
||||
|
||||
---
|
||||
---Gets the button, axis or hat that a virtual gamepad input is bound to.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getGamepadMapping)
|
||||
---
|
||||
---@overload fun(self: love.Joystick, button: love.GamepadButton):love.JoystickInputType, number, love.JoystickHat
|
||||
---@param axis love.GamepadAxis # The virtual gamepad axis to get the binding for.
|
||||
---@return love.JoystickInputType inputtype # The type of input the virtual gamepad axis is bound to.
|
||||
---@return number inputindex # The index of the Joystick's button, axis or hat that the virtual gamepad axis is bound to.
|
||||
---@return love.JoystickHat hatdirection # The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise.
|
||||
function Joystick:getGamepadMapping(axis) end
|
||||
|
||||
---
|
||||
---Gets the full gamepad mapping string of this Joystick, or nil if it's not 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getGamepadMappingString)
|
||||
---
|
||||
---@return string mappingstring # A string containing the Joystick's gamepad mappings, or nil if the Joystick is not recognized as a gamepad.
|
||||
function Joystick:getGamepadMappingString() end
|
||||
|
||||
---
|
||||
---Gets the direction of the Joystick's hat.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getHat)
|
||||
---
|
||||
---@param hat number # The index of the hat to be checked.
|
||||
---@return love.JoystickHat direction # The direction the hat is pushed.
|
||||
function Joystick:getHat(hat) end
|
||||
|
||||
---
|
||||
---Gets the number of hats on the joystick.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getHatCount)
|
||||
---
|
||||
---@return number hats # How many hats the joystick has.
|
||||
function Joystick:getHatCount() end
|
||||
|
||||
---
|
||||
---Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it '''will''' change when the game is re-launched.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getID)
|
||||
---
|
||||
---@return number id # The Joystick's unique identifier. Remains the same as long as the game is running.
|
||||
---@return number instanceid # Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected.
|
||||
function Joystick:getID() end
|
||||
|
||||
---
|
||||
---Gets the name of the joystick.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getName)
|
||||
---
|
||||
---@return string name # The name of the joystick.
|
||||
function Joystick:getName() end
|
||||
|
||||
---
|
||||
---Gets the current vibration motor strengths on a Joystick with rumble support.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:getVibration)
|
||||
---
|
||||
---@return number left # Current strength of the left vibration motor on the Joystick.
|
||||
---@return number right # Current strength of the right vibration motor on the Joystick.
|
||||
function Joystick:getVibration() end
|
||||
|
||||
---
|
||||
---Gets whether the Joystick is connected.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:isConnected)
|
||||
---
|
||||
---@return boolean connected # True if the Joystick is currently connected, false otherwise.
|
||||
function Joystick:isConnected() end
|
||||
|
||||
---
|
||||
---Checks if a button on the Joystick is pressed.
|
||||
---
|
||||
---LÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:isDown)
|
||||
---
|
||||
---@param buttonN number # The index of a button to check.
|
||||
---@return boolean anyDown # True if any supplied button is down, false if not.
|
||||
function Joystick:isDown(buttonN) end
|
||||
|
||||
---
|
||||
---Gets whether the Joystick is recognized as a gamepad. If this is the case, the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis, Joystick:isGamepadDown, love.gamepadpressed, and related functions.
|
||||
---
|
||||
---LÖVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with love.joystick.setGamepadMapping.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:isGamepad)
|
||||
---
|
||||
---@return boolean isgamepad # True if the Joystick is recognized as a gamepad, false otherwise.
|
||||
function Joystick:isGamepad() end
|
||||
|
||||
---
|
||||
---Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:isGamepadDown)
|
||||
---
|
||||
---@param buttonN love.GamepadButton # The gamepad button to check.
|
||||
---@return boolean anyDown # True if any supplied button is down, false if not.
|
||||
function Joystick:isGamepadDown(buttonN) end
|
||||
|
||||
---
|
||||
---Gets whether the Joystick supports vibration.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:isVibrationSupported)
|
||||
---
|
||||
---@return boolean supported # True if rumble / force feedback vibration is supported on this Joystick, false if not.
|
||||
function Joystick:isVibrationSupported() end
|
||||
|
||||
---
|
||||
---Sets the vibration motor speeds on a Joystick with rumble support. Most common gamepads have this functionality, although not all drivers give proper support. Use Joystick:isVibrationSupported to check.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Joystick:setVibration)
|
||||
---
|
||||
---@overload fun(self: love.Joystick):boolean
|
||||
---@overload fun(self: love.Joystick, left: number, right: number, duration?: number):boolean
|
||||
---@param left number # Strength of the left vibration motor on the Joystick. Must be in the range of 1.
|
||||
---@param right number # Strength of the right vibration motor on the Joystick. Must be in the range of 1.
|
||||
---@return boolean success # True if the vibration was successfully applied, false if not.
|
||||
function Joystick:setVibration(left, right) end
|
||||
|
||||
---
|
||||
---Virtual gamepad axes.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GamepadAxis)
|
||||
---
|
||||
---@alias love.GamepadAxis
|
||||
---
|
||||
---The x-axis of the left thumbstick.
|
||||
---
|
||||
---| "leftx"
|
||||
---
|
||||
---The y-axis of the left thumbstick.
|
||||
---
|
||||
---| "lefty"
|
||||
---
|
||||
---The x-axis of the right thumbstick.
|
||||
---
|
||||
---| "rightx"
|
||||
---
|
||||
---The y-axis of the right thumbstick.
|
||||
---
|
||||
---| "righty"
|
||||
---
|
||||
---Left analog trigger.
|
||||
---
|
||||
---| "triggerleft"
|
||||
---
|
||||
---Right analog trigger.
|
||||
---
|
||||
---| "triggerright"
|
||||
|
||||
---
|
||||
---Virtual gamepad buttons.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/GamepadButton)
|
||||
---
|
||||
---@alias love.GamepadButton
|
||||
---
|
||||
---Bottom face button (A).
|
||||
---
|
||||
---| "a"
|
||||
---
|
||||
---Right face button (B).
|
||||
---
|
||||
---| "b"
|
||||
---
|
||||
---Left face button (X).
|
||||
---
|
||||
---| "x"
|
||||
---
|
||||
---Top face button (Y).
|
||||
---
|
||||
---| "y"
|
||||
---
|
||||
---Back button.
|
||||
---
|
||||
---| "back"
|
||||
---
|
||||
---Guide button.
|
||||
---
|
||||
---| "guide"
|
||||
---
|
||||
---Start button.
|
||||
---
|
||||
---| "start"
|
||||
---
|
||||
---Left stick click button.
|
||||
---
|
||||
---| "leftstick"
|
||||
---
|
||||
---Right stick click button.
|
||||
---
|
||||
---| "rightstick"
|
||||
---
|
||||
---Left bumper.
|
||||
---
|
||||
---| "leftshoulder"
|
||||
---
|
||||
---Right bumper.
|
||||
---
|
||||
---| "rightshoulder"
|
||||
---
|
||||
---D-pad up.
|
||||
---
|
||||
---| "dpup"
|
||||
---
|
||||
---D-pad down.
|
||||
---
|
||||
---| "dpdown"
|
||||
---
|
||||
---D-pad left.
|
||||
---
|
||||
---| "dpleft"
|
||||
---
|
||||
---D-pad right.
|
||||
---
|
||||
---| "dpright"
|
||||
|
||||
---
|
||||
---Joystick hat positions.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/JoystickHat)
|
||||
---
|
||||
---@alias love.JoystickHat
|
||||
---
|
||||
---Centered
|
||||
---
|
||||
---| "c"
|
||||
---
|
||||
---Down
|
||||
---
|
||||
---| "d"
|
||||
---
|
||||
---Left
|
||||
---
|
||||
---| "l"
|
||||
---
|
||||
---Left+Down
|
||||
---
|
||||
---| "ld"
|
||||
---
|
||||
---Left+Up
|
||||
---
|
||||
---| "lu"
|
||||
---
|
||||
---Right
|
||||
---
|
||||
---| "r"
|
||||
---
|
||||
---Right+Down
|
||||
---
|
||||
---| "rd"
|
||||
---
|
||||
---Right+Up
|
||||
---
|
||||
---| "ru"
|
||||
---
|
||||
---Up
|
||||
---
|
||||
---| "u"
|
||||
|
||||
---
|
||||
---Types of Joystick inputs.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/JoystickInputType)
|
||||
---
|
||||
---@alias love.JoystickInputType
|
||||
---
|
||||
---Analog axis.
|
||||
---
|
||||
---| "axis"
|
||||
---
|
||||
---Button.
|
||||
---
|
||||
---| "button"
|
||||
---
|
||||
---8-direction hat value.
|
||||
---
|
||||
---| "hat"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,704 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides system-independent mathematical functions.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math)
|
||||
---
|
||||
---@class love.math
|
||||
love.math = {}
|
||||
|
||||
---
|
||||
---Converts a color from 0..255 to 0..1 range.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.colorFromBytes)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.colorToBytes)
|
||||
---
|
||||
---@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
|
||||
|
||||
---
|
||||
---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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.gammaToLinear)
|
||||
---
|
||||
---@overload fun(color: table):number, number, number
|
||||
---@overload fun(c: number):number
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.getRandomSeed)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.getRandomState)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.isConvex)
|
||||
---
|
||||
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):boolean
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.linearToGamma)
|
||||
---
|
||||
---@overload fun(color: table):number, number, number
|
||||
---@overload fun(lc: number):number
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.newBezierCurve)
|
||||
---
|
||||
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):love.BezierCurve
|
||||
---@param vertices table # The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.newRandomGenerator)
|
||||
---
|
||||
---@overload fun(seed: number):love.RandomGenerator
|
||||
---@overload fun(low: number, high: number):love.RandomGenerator
|
||||
---@return love.RandomGenerator rng # The new Random Number Generator object.
|
||||
function love.math.newRandomGenerator() end
|
||||
|
||||
---
|
||||
---Creates a new Transform object.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.newTransform)
|
||||
---
|
||||
---@overload fun(x: number, y: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number):love.Transform
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.noise)
|
||||
---
|
||||
---@overload fun(x: number, y: number):number
|
||||
---@overload fun(x: number, y: number, z: number):number
|
||||
---@overload fun(x: number, y: number, z: number, w: number):number
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.random)
|
||||
---
|
||||
---@overload fun(max: number):number
|
||||
---@overload fun(min: number, max: number):number
|
||||
---@return number number # The pseudo-random number.
|
||||
function love.math.random() end
|
||||
|
||||
---
|
||||
---Get a normally distributed pseudo random number.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.randomNormal)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.setRandomSeed)
|
||||
---
|
||||
---@overload fun(low: number, high: number)
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.setRandomState)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math.triangulate)
|
||||
---
|
||||
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):table
|
||||
---@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
|
||||
|
||||
---
|
||||
---A Bézier curve object that can evaluate and render Bézier curves of arbitrary degree.
|
||||
---
|
||||
---For more information on Bézier curves check this great article on Wikipedia.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math)
|
||||
---
|
||||
---@class love.BezierCurve: love.Object
|
||||
local BezierCurve = {}
|
||||
|
||||
---
|
||||
---Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive).
|
||||
---
|
||||
---This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:evaluate)
|
||||
---
|
||||
---@param t number # Where to evaluate the curve.
|
||||
---@return number x # x coordinate of the curve at parameter t.
|
||||
---@return number y # y coordinate of the curve at parameter t.
|
||||
function BezierCurve:evaluate(t) end
|
||||
|
||||
---
|
||||
---Get coordinates of the i-th control point. Indices start with 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:getControlPoint)
|
||||
---
|
||||
---@param i number # Index of the control point.
|
||||
---@return number x # Position of the control point along the x axis.
|
||||
---@return number y # Position of the control point along the y axis.
|
||||
function BezierCurve:getControlPoint(i) end
|
||||
|
||||
---
|
||||
---Get the number of control points in the Bézier curve.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:getControlPointCount)
|
||||
---
|
||||
---@return number count # The number of control points.
|
||||
function BezierCurve:getControlPointCount() end
|
||||
|
||||
---
|
||||
---Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:getDegree)
|
||||
---
|
||||
---@return number degree # Degree of the Bézier curve.
|
||||
function BezierCurve:getDegree() end
|
||||
|
||||
---
|
||||
---Get the derivative of the Bézier curve.
|
||||
---
|
||||
---This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:getDerivative)
|
||||
---
|
||||
---@return love.BezierCurve derivative # The derivative curve.
|
||||
function BezierCurve:getDerivative() end
|
||||
|
||||
---
|
||||
---Gets a BezierCurve that corresponds to the specified segment of this BezierCurve.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:getSegment)
|
||||
---
|
||||
---@param startpoint number # The starting point along the curve. Must be between 0 and 1.
|
||||
---@param endpoint number # The end of the segment. Must be between 0 and 1.
|
||||
---@return love.BezierCurve curve # A BezierCurve that corresponds to the specified segment.
|
||||
function BezierCurve:getSegment(startpoint, endpoint) end
|
||||
|
||||
---
|
||||
---Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:insertControlPoint)
|
||||
---
|
||||
---@param x number # Position of the control point along the x axis.
|
||||
---@param y number # Position of the control point along the y axis.
|
||||
---@param i? number # Index of the control point.
|
||||
function BezierCurve:insertControlPoint(x, y, i) end
|
||||
|
||||
---
|
||||
---Removes the specified control point.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:removeControlPoint)
|
||||
---
|
||||
---@param index number # The index of the control point to remove.
|
||||
function BezierCurve:removeControlPoint(index) end
|
||||
|
||||
---
|
||||
---Get a list of coordinates to be used with love.graphics.line.
|
||||
---
|
||||
---This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.
|
||||
---
|
||||
---If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:render)
|
||||
---
|
||||
---@param depth? number # Number of recursive subdivision steps.
|
||||
---@return table coordinates # List of x,y-coordinate pairs of points on the curve.
|
||||
function BezierCurve:render(depth) end
|
||||
|
||||
---
|
||||
---Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line.
|
||||
---
|
||||
---This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.
|
||||
---
|
||||
---If you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:renderSegment)
|
||||
---
|
||||
---@param startpoint number # The starting point along the curve. Must be between 0 and 1.
|
||||
---@param endpoint number # The end of the segment to render. Must be between 0 and 1.
|
||||
---@param depth? number # Number of recursive subdivision steps.
|
||||
---@return table coordinates # List of x,y-coordinate pairs of points on the specified part of the curve.
|
||||
function BezierCurve:renderSegment(startpoint, endpoint, depth) end
|
||||
|
||||
---
|
||||
---Rotate the Bézier curve by an angle.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:rotate)
|
||||
---
|
||||
---@param angle number # Rotation angle in radians.
|
||||
---@param ox? number # X coordinate of the rotation center.
|
||||
---@param oy? number # Y coordinate of the rotation center.
|
||||
function BezierCurve:rotate(angle, ox, oy) end
|
||||
|
||||
---
|
||||
---Scale the Bézier curve by a factor.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:scale)
|
||||
---
|
||||
---@param s number # Scale factor.
|
||||
---@param ox? number # X coordinate of the scaling center.
|
||||
---@param oy? number # Y coordinate of the scaling center.
|
||||
function BezierCurve:scale(s, ox, oy) end
|
||||
|
||||
---
|
||||
---Set coordinates of the i-th control point. Indices start with 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:setControlPoint)
|
||||
---
|
||||
---@param i number # Index of the control point.
|
||||
---@param x number # Position of the control point along the x axis.
|
||||
---@param y number # Position of the control point along the y axis.
|
||||
function BezierCurve:setControlPoint(i, x, y) end
|
||||
|
||||
---
|
||||
---Move the Bézier curve by an offset.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/BezierCurve:translate)
|
||||
---
|
||||
---@param dx number # Offset along the x axis.
|
||||
---@param dy number # Offset along the y axis.
|
||||
function BezierCurve:translate(dx, dy) end
|
||||
|
||||
---
|
||||
---A random number generation object which has its own random state.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math)
|
||||
---
|
||||
---@class love.RandomGenerator: love.Object
|
||||
local RandomGenerator = {}
|
||||
|
||||
---
|
||||
---Gets the seed of the random number generator object.
|
||||
---
|
||||
---The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RandomGenerator:getSeed)
|
||||
---
|
||||
---@return number low # Integer number representing the lower 32 bits of the RandomGenerator's 64 bit seed value.
|
||||
---@return number high # Integer number representing the higher 32 bits of the RandomGenerator's 64 bit seed value.
|
||||
function RandomGenerator:getSeed() end
|
||||
|
||||
---
|
||||
---Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE.
|
||||
---
|
||||
---This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RandomGenerator:getState)
|
||||
---
|
||||
---@return string state # The current state of the RandomGenerator object, represented as a string.
|
||||
function RandomGenerator:getState() end
|
||||
|
||||
---
|
||||
---Generates a pseudo-random number in a platform independent manner.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RandomGenerator:random)
|
||||
---
|
||||
---@overload fun(self: love.RandomGenerator, max: number):number
|
||||
---@overload fun(self: love.RandomGenerator, min: number, max: number):number
|
||||
---@return number number # The pseudo-random number.
|
||||
function RandomGenerator:random() end
|
||||
|
||||
---
|
||||
---Get a normally distributed pseudo random number.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RandomGenerator:randomNormal)
|
||||
---
|
||||
---@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 RandomGenerator:randomNormal(stddev, mean) end
|
||||
|
||||
---
|
||||
---Sets the seed of the random number generator using the specified integer number.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RandomGenerator:setSeed)
|
||||
---
|
||||
---@overload fun(self: love.RandomGenerator, low: number, high: number)
|
||||
---@param seed number # The integer number with which you want to seed the randomization. Must be within the range of 2^53.
|
||||
function RandomGenerator:setSeed(seed) end
|
||||
|
||||
---
|
||||
---Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE.
|
||||
---
|
||||
---This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/RandomGenerator:setState)
|
||||
---
|
||||
---@param state string # The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState.
|
||||
function RandomGenerator:setState(state) end
|
||||
|
||||
---
|
||||
---Object containing a coordinate system transformation.
|
||||
---
|
||||
---The love.graphics module has several functions and function variants which accept Transform objects.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.math)
|
||||
---
|
||||
---@class love.Transform: love.Object
|
||||
local Transform = {}
|
||||
|
||||
---
|
||||
---Applies the given other Transform object to this one.
|
||||
---
|
||||
---This effectively multiplies this Transform's internal transformation matrix with the other Transform's (i.e. self * other), and stores the result in this object.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:apply)
|
||||
---
|
||||
---@param other love.Transform # The other Transform object to apply to this Transform.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:apply(other) end
|
||||
|
||||
---
|
||||
---Creates a new copy of this Transform.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:clone)
|
||||
---
|
||||
---@return love.Transform clone # The copy of this Transform.
|
||||
function Transform:clone() end
|
||||
|
||||
---
|
||||
---Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:getMatrix)
|
||||
---
|
||||
---@return number e1_1 # The first column of the first row of the matrix.
|
||||
---@return number e1_2 # The second column of the first row of the matrix.
|
||||
---@return number e1_3 # The third column of the first row of the matrix.
|
||||
---@return number e1_4 # The fourth column of the first row of the matrix.
|
||||
---@return number e2_1 # The first column of the second row of the matrix.
|
||||
---@return number e2_2 # The second column of the second row of the matrix.
|
||||
---@return number e2_3 # The third column of the second row of the matrix.
|
||||
---@return number e2_4 # The fourth column of the second row of the matrix.
|
||||
---@return number e3_1 # The first column of the third row of the matrix.
|
||||
---@return number e3_2 # The second column of the third row of the matrix.
|
||||
---@return number e3_3 # The third column of the third row of the matrix.
|
||||
---@return number e3_4 # The fourth column of the third row of the matrix.
|
||||
---@return number e4_1 # The first column of the fourth row of the matrix.
|
||||
---@return number e4_2 # The second column of the fourth row of the matrix.
|
||||
---@return number e4_3 # The third column of the fourth row of the matrix.
|
||||
---@return number e4_4 # The fourth column of the fourth row of the matrix.
|
||||
function Transform:getMatrix() end
|
||||
|
||||
---
|
||||
---Creates a new Transform containing the inverse of this Transform.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:inverse)
|
||||
---
|
||||
---@return love.Transform inverse # A new Transform object representing the inverse of this Transform's matrix.
|
||||
function Transform:inverse() end
|
||||
|
||||
---
|
||||
---Applies the reverse of the Transform object's transformation to the given 2D position.
|
||||
---
|
||||
---This effectively converts the given position from the local coordinate space of the Transform into global coordinates.
|
||||
---
|
||||
---One use of this method can be to convert a screen-space mouse position into global world coordinates, if the given Transform has transformations applied that are used for a camera system in-game.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:inverseTransformPoint)
|
||||
---
|
||||
---@param localX number # The x component of the position with the transform applied.
|
||||
---@param localY number # The y component of the position with the transform applied.
|
||||
---@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 Transform:inverseTransformPoint(localX, localY) end
|
||||
|
||||
---
|
||||
---Checks whether the Transform is an affine transformation.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:isAffine2DTransform)
|
||||
---
|
||||
---@return boolean affine # true if the transform object is an affine transformation, false otherwise.
|
||||
function Transform:isAffine2DTransform() end
|
||||
|
||||
---
|
||||
---Resets the Transform to an identity state. All previously applied transformations are erased.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:reset)
|
||||
---
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:reset() end
|
||||
|
||||
---
|
||||
---Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:rotate)
|
||||
---
|
||||
---@param angle number # The relative angle in radians to rotate this Transform by.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:rotate(angle) end
|
||||
|
||||
---
|
||||
---Scales the Transform's coordinate system. This method does not reset any previously applied transformations.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:scale)
|
||||
---
|
||||
---@param sx number # The relative scale factor along the x-axis.
|
||||
---@param sy? number # The relative scale factor along the y-axis.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:scale(sx, sy) end
|
||||
|
||||
---
|
||||
---Directly sets the Transform's internal 4x4 transformation matrix.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:setMatrix)
|
||||
---
|
||||
---@overload fun(self: love.Transform, layout: love.MatrixLayout, e1_1: number, e1_2: number, e1_3: number, e1_4: number, e2_1: number, e2_2: number, e2_3: number, e2_4: number, e3_1: number, e3_2: number, e3_3: number, e3_4: number, e4_1: number, e4_2: number, e4_3: number, e4_4: number):love.Transform
|
||||
---@overload fun(self: love.Transform, layout: love.MatrixLayout, matrix: table):love.Transform
|
||||
---@overload fun(self: love.Transform, layout: love.MatrixLayout, matrix: table):love.Transform
|
||||
---@param e1_1 number # The first column of the first row of the matrix.
|
||||
---@param e1_2 number # The second column of the first row of the matrix.
|
||||
---@param e1_3 number # The third column of the first row of the matrix.
|
||||
---@param e1_4 number # The fourth column of the first row of the matrix.
|
||||
---@param e2_1 number # The first column of the second row of the matrix.
|
||||
---@param e2_2 number # The second column of the second row of the matrix.
|
||||
---@param e2_3 number # The third column of the second row of the matrix.
|
||||
---@param e2_4 number # The fourth column of the second row of the matrix.
|
||||
---@param e3_1 number # The first column of the third row of the matrix.
|
||||
---@param e3_2 number # The second column of the third row of the matrix.
|
||||
---@param e3_3 number # The third column of the third row of the matrix.
|
||||
---@param e3_4 number # The fourth column of the third row of the matrix.
|
||||
---@param e4_1 number # The first column of the fourth row of the matrix.
|
||||
---@param e4_2 number # The second column of the fourth row of the matrix.
|
||||
---@param e4_3 number # The third column of the fourth row of the matrix.
|
||||
---@param e4_4 number # The fourth column of the fourth row of the matrix.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:setMatrix(
|
||||
e1_1,
|
||||
e1_2,
|
||||
e1_3,
|
||||
e1_4,
|
||||
e2_1,
|
||||
e2_2,
|
||||
e2_3,
|
||||
e2_4,
|
||||
e3_1,
|
||||
e3_2,
|
||||
e3_3,
|
||||
e3_4,
|
||||
e4_1,
|
||||
e4_2,
|
||||
e4_3,
|
||||
e4_4
|
||||
)
|
||||
end
|
||||
|
||||
---
|
||||
---Resets the Transform to the specified transformation parameters.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:setTransformation)
|
||||
---
|
||||
---@param x number # The position of the Transform on the x-axis.
|
||||
---@param y number # The position of the Transform on the y-axis.
|
||||
---@param angle? number # The orientation of the Transform in radians.
|
||||
---@param sx? number # Scale factor on the x-axis.
|
||||
---@param sy? number # Scale factor on the y-axis.
|
||||
---@param ox? number # Origin offset on the x-axis.
|
||||
---@param oy? number # Origin offset on the y-axis.
|
||||
---@param kx? number # Shearing / skew factor on the x-axis.
|
||||
---@param ky? number # Shearing / skew factor on the y-axis.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky) end
|
||||
|
||||
---
|
||||
---Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:shear)
|
||||
---
|
||||
---@param kx number # The shear factor along the x-axis.
|
||||
---@param ky number # The shear factor along the y-axis.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:shear(kx, ky) end
|
||||
|
||||
---
|
||||
---Applies the Transform object's transformation to the given 2D position.
|
||||
---
|
||||
---This effectively converts the given position from global coordinates into the local coordinate space of the Transform.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:transformPoint)
|
||||
---
|
||||
---@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 localX # The x component of the position with the transform applied.
|
||||
---@return number localY # The y component of the position with the transform applied.
|
||||
function Transform:transformPoint(globalX, globalY) end
|
||||
|
||||
---
|
||||
---Applies a translation to the Transform's coordinate system. This method does not reset any previously applied transformations.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Transform:translate)
|
||||
---
|
||||
---@param dx number # The relative translation along the x-axis.
|
||||
---@param dy number # The relative translation along the y-axis.
|
||||
---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods.
|
||||
function Transform:translate(dx, dy) end
|
||||
|
||||
---
|
||||
---The layout of matrix elements (row-major or column-major).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/MatrixLayout)
|
||||
---
|
||||
---@alias love.MatrixLayout
|
||||
---
|
||||
---The matrix is row-major:
|
||||
---
|
||||
---| "row"
|
||||
---
|
||||
---The matrix is column-major:
|
||||
---
|
||||
---| "column"
|
||||
@@ -0,0 +1,283 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to the user's mouse.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse)
|
||||
---
|
||||
---@class love.mouse
|
||||
love.mouse = {}
|
||||
|
||||
---
|
||||
---Gets the current Cursor.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.getCursor)
|
||||
---
|
||||
---@return love.Cursor cursor # The current cursor, or nil if no cursor is set.
|
||||
function love.mouse.getCursor() end
|
||||
|
||||
---
|
||||
---Returns the current position of the mouse.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.getPosition)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.getRelativeMode)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.getSystemCursor)
|
||||
---
|
||||
---@param ctype love.CursorType # The type of system cursor to get.
|
||||
---@return love.Cursor cursor # The Cursor object representing the system cursor type.
|
||||
function love.mouse.getSystemCursor(ctype) end
|
||||
|
||||
---
|
||||
---Returns the current x-position of the mouse.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.getX)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.getY)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.isCursorSupported)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.isDown)
|
||||
---
|
||||
---@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.
|
||||
---@vararg 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.isGrabbed)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.isVisible)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.newCursor)
|
||||
---
|
||||
---@overload fun(filename: string, hotx?: number, hoty?: number):love.Cursor
|
||||
---@overload fun(fileData: love.FileData, hotx?: number, hoty?: number):love.Cursor
|
||||
---@param imageData love.ImageData # The ImageData to use for the new Cursor.
|
||||
---@param hotx? number # The x-coordinate in the ImageData of the cursor's hot spot.
|
||||
---@param hoty? number # The y-coordinate in the ImageData of the cursor's hot spot.
|
||||
---@return love.Cursor cursor # The new Cursor object.
|
||||
function love.mouse.newCursor(imageData, hotx, hoty) end
|
||||
|
||||
---
|
||||
---Sets the current mouse cursor.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setCursor)
|
||||
---
|
||||
---@overload fun()
|
||||
---@param cursor love.Cursor # The Cursor object to use as the current mouse cursor.
|
||||
function love.mouse.setCursor(cursor) end
|
||||
|
||||
---
|
||||
---Grabs the mouse and confines it to the window.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setGrabbed)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setPosition)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setRelativeMode)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setVisible)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setX)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse.setY)
|
||||
---
|
||||
---@param y number # The new position of the mouse along the y-axis.
|
||||
function love.mouse.setY(y) end
|
||||
|
||||
---
|
||||
---Represents a hardware cursor.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.mouse)
|
||||
---
|
||||
---@class love.Cursor: love.Object
|
||||
local Cursor = {}
|
||||
|
||||
---
|
||||
---Gets the type of the Cursor.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Cursor:getType)
|
||||
---
|
||||
---@return love.CursorType ctype # The type of the Cursor.
|
||||
function Cursor:getType() end
|
||||
|
||||
---
|
||||
---Types of hardware cursors.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/CursorType)
|
||||
---
|
||||
---@alias love.CursorType
|
||||
---
|
||||
---The cursor is using a custom image.
|
||||
---
|
||||
---| "image"
|
||||
---
|
||||
---An arrow pointer.
|
||||
---
|
||||
---| "arrow"
|
||||
---
|
||||
---An I-beam, normally used when mousing over editable or selectable text.
|
||||
---
|
||||
---| "ibeam"
|
||||
---
|
||||
---Wait graphic.
|
||||
---
|
||||
---| "wait"
|
||||
---
|
||||
---Small wait cursor with an arrow pointer.
|
||||
---
|
||||
---| "waitarrow"
|
||||
---
|
||||
---Crosshair symbol.
|
||||
---
|
||||
---| "crosshair"
|
||||
---
|
||||
---Double arrow pointing to the top-left and bottom-right.
|
||||
---
|
||||
---| "sizenwse"
|
||||
---
|
||||
---Double arrow pointing to the top-right and bottom-left.
|
||||
---
|
||||
---| "sizenesw"
|
||||
---
|
||||
---Double arrow pointing left and right.
|
||||
---
|
||||
---| "sizewe"
|
||||
---
|
||||
---Double arrow pointing up and down.
|
||||
---
|
||||
---| "sizens"
|
||||
---
|
||||
---Four-pointed arrow pointing up, down, left, and right.
|
||||
---
|
||||
---| "sizeall"
|
||||
---
|
||||
---Slashed circle or crossbones.
|
||||
---
|
||||
---| "no"
|
||||
---
|
||||
---Hand symbol.
|
||||
---
|
||||
---| "hand"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,189 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---This module is responsible for decoding sound files. It can't play the sounds, see love.audio for that.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.sound)
|
||||
---
|
||||
---@class love.sound
|
||||
love.sound = {}
|
||||
|
||||
---
|
||||
---Attempts to find a decoder for the encoded sound data in the specified file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.sound.newDecoder)
|
||||
---
|
||||
---@overload fun(filename: string, buffer?: number):love.Decoder
|
||||
---@param file love.File # The file with encoded sound data.
|
||||
---@param buffer? number # The size of each decoded chunk, in bytes.
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.sound.newSoundData)
|
||||
---
|
||||
---@overload fun(file: love.File):love.SoundData
|
||||
---@overload fun(decoder: love.Decoder):love.SoundData
|
||||
---@overload fun(samples: number, rate?: number, bits?: number, channels?: number):love.SoundData
|
||||
---@param filename string # The file name of the file to load.
|
||||
---@return love.SoundData soundData # A new SoundData object.
|
||||
function love.sound.newSoundData(filename) end
|
||||
|
||||
---
|
||||
---An object which can gradually decode a sound file.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.sound)
|
||||
---
|
||||
---@class love.Decoder: love.Object
|
||||
local Decoder = {}
|
||||
|
||||
---
|
||||
---Creates a new copy of current decoder.
|
||||
---
|
||||
---The new decoder will start decoding from the beginning of the audio stream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:clone)
|
||||
---
|
||||
---@return love.Decoder decoder # New copy of the decoder.
|
||||
function Decoder:clone() end
|
||||
|
||||
---
|
||||
---Decodes the audio and returns a SoundData object containing the decoded audio data.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:decode)
|
||||
---
|
||||
---@return love.SoundData soundData # Decoded audio data.
|
||||
function Decoder:decode() end
|
||||
|
||||
---
|
||||
---Returns the number of bits per sample.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:getBitDepth)
|
||||
---
|
||||
---@return number bitDepth # Either 8, or 16.
|
||||
function Decoder:getBitDepth() end
|
||||
|
||||
---
|
||||
---Returns the number of channels in the stream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:getChannelCount)
|
||||
---
|
||||
---@return number channels # 1 for mono, 2 for stereo.
|
||||
function Decoder:getChannelCount() end
|
||||
|
||||
---
|
||||
---Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:getDuration)
|
||||
---
|
||||
---@return number duration # The duration of the sound file in seconds, or -1 if it cannot be determined.
|
||||
function Decoder:getDuration() end
|
||||
|
||||
---
|
||||
---Returns the sample rate of the Decoder.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:getSampleRate)
|
||||
---
|
||||
---@return number rate # Number of samples per second.
|
||||
function Decoder:getSampleRate() end
|
||||
|
||||
---
|
||||
---Sets the currently playing position of the Decoder.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Decoder:seek)
|
||||
---
|
||||
---@param offset number # The position to seek to, in seconds.
|
||||
function Decoder:seek(offset) end
|
||||
|
||||
---
|
||||
---Contains raw audio samples.
|
||||
---
|
||||
---You can not play SoundData back directly. You must wrap a Source object around it.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.sound)
|
||||
---
|
||||
---@class love.SoundData: love.Data, love.Object
|
||||
local SoundData = {}
|
||||
|
||||
---
|
||||
---Returns the number of bits per sample.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:getBitDepth)
|
||||
---
|
||||
---@return number bitdepth # Either 8, or 16.
|
||||
function SoundData:getBitDepth() end
|
||||
|
||||
---
|
||||
---Returns the number of channels in the SoundData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:getChannelCount)
|
||||
---
|
||||
---@return number channels # 1 for mono, 2 for stereo.
|
||||
function SoundData:getChannelCount() end
|
||||
|
||||
---
|
||||
---Gets the duration of the sound data.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:getDuration)
|
||||
---
|
||||
---@return number duration # The duration of the sound data in seconds.
|
||||
function SoundData:getDuration() end
|
||||
|
||||
---
|
||||
---Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:getSample)
|
||||
---
|
||||
---@overload fun(self: love.SoundData, i: number, channel: number):number
|
||||
---@param i number # An integer value specifying the position of the sample (starting at 0).
|
||||
---@return number sample # The normalized samplepoint (range -1.0 to 1.0).
|
||||
function SoundData:getSample(i) end
|
||||
|
||||
---
|
||||
---Returns the number of samples per channel of the SoundData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:getSampleCount)
|
||||
---
|
||||
---@return number count # Total number of samples.
|
||||
function SoundData:getSampleCount() end
|
||||
|
||||
---
|
||||
---Returns the sample rate of the SoundData.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:getSampleRate)
|
||||
---
|
||||
---@return number rate # Number of samples per second.
|
||||
function SoundData:getSampleRate() end
|
||||
|
||||
---
|
||||
---Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/SoundData:setSample)
|
||||
---
|
||||
---@overload fun(self: love.SoundData, i: number, channel: number, sample: number)
|
||||
---@param i number # An integer value specifying the position of the sample (starting at 0).
|
||||
---@param sample number # The normalized samplepoint (range -1.0 to 1.0).
|
||||
function SoundData:setSample(i, sample) end
|
||||
@@ -0,0 +1,115 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides access to information about the user's system.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system)
|
||||
---
|
||||
---@class love.system
|
||||
love.system = {}
|
||||
|
||||
---
|
||||
---Gets text from the clipboard.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.getClipboardText)
|
||||
---
|
||||
---@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.)
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.getOS)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.getPowerInfo)
|
||||
---
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.getProcessorCount)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.hasBackgroundMusic)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.openURL)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.setClipboardText)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.system.vibrate)
|
||||
---
|
||||
---@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
|
||||
|
||||
---
|
||||
---The basic state of the system's power supply.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/PowerState)
|
||||
---
|
||||
---@alias love.PowerState
|
||||
---
|
||||
---Cannot determine power status.
|
||||
---
|
||||
---| "unknown"
|
||||
---
|
||||
---Not plugged in, running on a battery.
|
||||
---
|
||||
---| "battery"
|
||||
---
|
||||
---Plugged in, no battery available.
|
||||
---
|
||||
---| "nobattery"
|
||||
---
|
||||
---Plugged in, charging battery.
|
||||
---
|
||||
---| "charging"
|
||||
---
|
||||
---Plugged in, battery is fully charged.
|
||||
---
|
||||
---| "charged"
|
||||
@@ -0,0 +1,210 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Allows you to work with threads.
|
||||
---
|
||||
---Threads are separate Lua environments, running in parallel to the main code. As their code runs separately, they can be used to compute complex operations without adversely affecting the frame rate of the main thread. However, as they are separate environments, they cannot access the variables and functions of the main thread, and communication between threads is limited.
|
||||
---
|
||||
---All LOVE objects (userdata) are shared among threads so you'll only have to send their references across threads. You may run into concurrency issues if you manipulate an object on multiple threads at the same time.
|
||||
---
|
||||
---When a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.thread)
|
||||
---
|
||||
---@class love.thread
|
||||
love.thread = {}
|
||||
|
||||
---
|
||||
---Creates or retrieves a named thread channel.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.thread.getChannel)
|
||||
---
|
||||
---@param name string # The name of the channel you want to create or retrieve.
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.thread.newChannel)
|
||||
---
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.thread.newThread)
|
||||
---
|
||||
---@overload fun(fileData: love.FileData):love.Thread
|
||||
---@overload fun(codestring: string):love.Thread
|
||||
---@param filename string # The name of the Lua file to use as the source.
|
||||
---@return love.Thread thread # A new Thread that has yet to be started.
|
||||
function love.thread.newThread(filename) end
|
||||
|
||||
---
|
||||
---An object which can be used to send and receive data between different threads.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.thread)
|
||||
---
|
||||
---@class love.Channel: love.Object
|
||||
local Channel = {}
|
||||
|
||||
---
|
||||
---Clears all the messages in the Channel queue.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:clear)
|
||||
---
|
||||
function Channel:clear() end
|
||||
|
||||
---
|
||||
---Retrieves the value of a Channel message and removes it from the message queue.
|
||||
---
|
||||
---It waits until a message is in the queue then returns the message value.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:demand)
|
||||
---
|
||||
---@overload fun(self: love.Channel, timeout: number):any
|
||||
---@return any value # The contents of the message.
|
||||
function Channel:demand() end
|
||||
|
||||
---
|
||||
---Retrieves the number of messages in the thread Channel queue.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:getCount)
|
||||
---
|
||||
---@return number count # The number of messages in the queue.
|
||||
function Channel:getCount() end
|
||||
|
||||
---
|
||||
---Gets whether a pushed value has been popped or otherwise removed from the Channel.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:hasRead)
|
||||
---
|
||||
---@param id number # An id value previously returned by Channel:push.
|
||||
---@return boolean hasread # Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear.
|
||||
function Channel:hasRead(id) end
|
||||
|
||||
---
|
||||
---Retrieves the value of a Channel message, but leaves it in the queue.
|
||||
---
|
||||
---It returns nil if there's no message in the queue.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:peek)
|
||||
---
|
||||
---@return any value # The contents of the message.
|
||||
function Channel:peek() end
|
||||
|
||||
---
|
||||
---Executes the specified function atomically with respect to this Channel.
|
||||
---
|
||||
---Calling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel's methods at the same time, the different calls on each Thread might end up interleaved (e.g. one or more of the second thread's calls may happen in between the first thread's calls.)
|
||||
---
|
||||
---This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:performAtomic)
|
||||
---
|
||||
---@param func function # The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called.
|
||||
---@param arg1 any # Additional arguments that the given function will receive when it is called.
|
||||
---@vararg any # Additional arguments that the given function will receive when it is called.
|
||||
---@return any ret1 # The first return value of the given function (if any.)
|
||||
function Channel:performAtomic(func, arg1, ...) end
|
||||
|
||||
---
|
||||
---Retrieves the value of a Channel message and removes it from the message queue.
|
||||
---
|
||||
---It returns nil if there are no messages in the queue.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:pop)
|
||||
---
|
||||
---@return any value # The contents of the message.
|
||||
function Channel:pop() end
|
||||
|
||||
---
|
||||
---Send a message to the thread Channel.
|
||||
---
|
||||
---See Variant for the list of supported types.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:push)
|
||||
---
|
||||
---@param value any # The contents of the message.
|
||||
---@return number id # Identifier which can be supplied to Channel:hasRead
|
||||
function Channel:push(value) end
|
||||
|
||||
---
|
||||
---Send a message to the thread Channel and wait for a thread to accept it.
|
||||
---
|
||||
---See Variant for the list of supported types.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Channel:supply)
|
||||
---
|
||||
---@overload fun(self: love.Channel, value: any, timeout: number):boolean
|
||||
---@param value any # The contents of the message.
|
||||
---@return boolean success # Whether the message was successfully supplied (always true).
|
||||
function Channel:supply(value) end
|
||||
|
||||
---
|
||||
---A Thread is a chunk of code that can run in parallel with other threads. Data can be sent between different threads with Channel objects.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.thread)
|
||||
---
|
||||
---@class love.Thread: love.Object
|
||||
local Thread = {}
|
||||
|
||||
---
|
||||
---Retrieves the error string from the thread if it produced an error.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Thread:getError)
|
||||
---
|
||||
---@return string err # The error message, or nil if the Thread has not caused an error.
|
||||
function Thread:getError() end
|
||||
|
||||
---
|
||||
---Returns whether the thread is currently running.
|
||||
---
|
||||
---Threads which are not running can be (re)started with Thread:start.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Thread:isRunning)
|
||||
---
|
||||
---@return boolean value # True if the thread is running, false otherwise.
|
||||
function Thread:isRunning() end
|
||||
|
||||
---
|
||||
---Starts the thread.
|
||||
---
|
||||
---Beginning with version 0.9.0, threads can be restarted after they have completed their execution.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Thread:start)
|
||||
---
|
||||
---@overload fun(self: love.Thread, ...)
|
||||
function Thread:start() end
|
||||
|
||||
---
|
||||
---Wait for a thread to finish.
|
||||
---
|
||||
---This call will block until the thread finishes.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/Thread:wait)
|
||||
---
|
||||
function Thread:wait() end
|
||||
@@ -0,0 +1,68 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to the user's clock.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer)
|
||||
---
|
||||
---@class love.timer
|
||||
love.timer = {}
|
||||
|
||||
---
|
||||
---Returns the average delta time (seconds per frame) over the last second.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer.getAverageDelta)
|
||||
---
|
||||
---@return number delta # The average delta time over the last second.
|
||||
function love.timer.getAverageDelta() end
|
||||
|
||||
---
|
||||
---Returns the time between the last two frames.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer.getDelta)
|
||||
---
|
||||
---@return number dt # The time passed (in seconds).
|
||||
function love.timer.getDelta() end
|
||||
|
||||
---
|
||||
---Returns the current frames per second.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer.getFPS)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer.getTime)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer.sleep)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.timer.step)
|
||||
---
|
||||
---@return number dt # The time passed (in seconds).
|
||||
function love.timer.step() end
|
||||
@@ -0,0 +1,40 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface to touch-screen presses.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.touch)
|
||||
---
|
||||
---@class love.touch
|
||||
love.touch = {}
|
||||
|
||||
---
|
||||
---Gets the current position of the specified touch-press, in pixels.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.touch.getPosition)
|
||||
---
|
||||
---@param id lightuserdata # 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.touch.getPressure)
|
||||
---
|
||||
---@param id lightuserdata # 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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.touch.getTouches)
|
||||
---
|
||||
---@return table touches # A list of active touch-press id values, which can be used with love.touch.getPosition.
|
||||
function love.touch.getTouches() end
|
||||
@@ -0,0 +1,92 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---This module is responsible for decoding, controlling, and streaming video files.
|
||||
---
|
||||
---It can't draw the videos, see love.graphics.newVideo and Video objects for that.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.video)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.video.newVideoStream)
|
||||
---
|
||||
---@overload fun(file: love.File):love.VideoStream
|
||||
---@param filename string # The file path to the Ogg Theora video file.
|
||||
---@return love.VideoStream videostream # A new VideoStream.
|
||||
function love.video.newVideoStream(filename) end
|
||||
|
||||
---
|
||||
---An object which decodes, streams, and controls Videos.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.video)
|
||||
---
|
||||
---@class love.VideoStream: love.Object
|
||||
local VideoStream = {}
|
||||
|
||||
---
|
||||
---Gets the filename of the VideoStream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:getFilename)
|
||||
---
|
||||
---@return string filename # The filename of the VideoStream
|
||||
function VideoStream:getFilename() end
|
||||
|
||||
---
|
||||
---Gets whether the VideoStream is playing.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:isPlaying)
|
||||
---
|
||||
---@return boolean playing # Whether the VideoStream is playing.
|
||||
function VideoStream:isPlaying() end
|
||||
|
||||
---
|
||||
---Pauses the VideoStream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:pause)
|
||||
---
|
||||
function VideoStream:pause() end
|
||||
|
||||
---
|
||||
---Plays the VideoStream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:play)
|
||||
---
|
||||
function VideoStream:play() end
|
||||
|
||||
---
|
||||
---Rewinds the VideoStream. Synonym to VideoStream:seek(0).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:rewind)
|
||||
---
|
||||
function VideoStream:rewind() end
|
||||
|
||||
---
|
||||
---Sets the current playback position of the VideoStream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:seek)
|
||||
---
|
||||
---@param offset number # The time in seconds since the beginning of the VideoStream.
|
||||
function VideoStream:seek(offset) end
|
||||
|
||||
---
|
||||
---Gets the current playback position of the VideoStream.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/VideoStream:tell)
|
||||
---
|
||||
---@return number seconds # The number of seconds sionce the beginning of the VideoStream.
|
||||
function VideoStream:tell() end
|
||||
@@ -0,0 +1,473 @@
|
||||
---@meta
|
||||
|
||||
---
|
||||
---Provides an interface for modifying and retrieving information about the program's window.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window)
|
||||
---
|
||||
---@class love.window
|
||||
love.window = {}
|
||||
|
||||
---
|
||||
---Closes the window. It can be reopened with love.window.setMode.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.close)
|
||||
---
|
||||
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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.fromPixels)
|
||||
---
|
||||
---@overload fun(px: number, py: number):number, number
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getDPIScale)
|
||||
---
|
||||
---@return number scale # The pixel scale factor associated with the window.
|
||||
function love.window.getDPIScale() end
|
||||
|
||||
---
|
||||
---Gets the width and height of the desktop.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getDesktopDimensions)
|
||||
---
|
||||
---@param displayindex? number # The index of the display, if multiple monitors are available.
|
||||
---@return number width # The width of the desktop.
|
||||
---@return number height # The height of the desktop.
|
||||
function love.window.getDesktopDimensions(displayindex) end
|
||||
|
||||
---
|
||||
---Gets the number of connected monitors.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayCount)
|
||||
---
|
||||
---@return number count # The number of currently connected displays.
|
||||
function love.window.getDisplayCount() end
|
||||
|
||||
---
|
||||
---Gets the name of a display.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayName)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getDisplayOrientation)
|
||||
---
|
||||
---@param displayindex? number # Display index to get its display orientation, or nil for default display index.
|
||||
---@return love.DisplayOrientation orientation # Current device display orientation.
|
||||
function love.window.getDisplayOrientation(displayindex) end
|
||||
|
||||
---
|
||||
---Gets whether the window is fullscreen.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreen)
|
||||
---
|
||||
---@return boolean fullscreen # True if the window is fullscreen, false otherwise.
|
||||
---@return love.FullscreenType fstype # The type of fullscreen mode used.
|
||||
function love.window.getFullscreen() end
|
||||
|
||||
---
|
||||
---Gets a list of supported fullscreen modes.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreenModes)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getIcon)
|
||||
---
|
||||
---@return love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getMode)
|
||||
---
|
||||
---@return number width # Window width.
|
||||
---@return number height # Window height.
|
||||
---@return {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, refreshrate: number, x: number, y: number, srgb: boolean} flags # Table with the window properties:
|
||||
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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getPosition)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getSafeArea)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getTitle)
|
||||
---
|
||||
---@return string title # The current window title.
|
||||
function love.window.getTitle() end
|
||||
|
||||
---
|
||||
---Gets current vertical synchronization (vsync).
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.getVSync)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.hasFocus)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.hasMouseFocus)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.isDisplaySleepEnabled)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.isMaximized)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.isMinimized)
|
||||
---
|
||||
---@return boolean minimized # True if the window is currently minimized, false otherwise.
|
||||
function love.window.isMinimized() end
|
||||
|
||||
---
|
||||
---Checks if the window is open.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.isOpen)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.isVisible)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.maximize)
|
||||
---
|
||||
function love.window.maximize() end
|
||||
|
||||
---
|
||||
---Minimizes the window to the system's task bar / dock.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.minimize)
|
||||
---
|
||||
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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.requestAttention)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.restore)
|
||||
---
|
||||
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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setDisplaySleepEnabled)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setFullscreen)
|
||||
---
|
||||
---@overload fun(fullscreen: boolean, fstype: love.FullscreenType):boolean
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setIcon)
|
||||
---
|
||||
---@param imagedata love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setMode)
|
||||
---
|
||||
---@param width number # Display width.
|
||||
---@param height number # Display height.
|
||||
---@param flags? {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, stencil: boolean, depth: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number, usedpiscale: boolean, srgb: boolean} # The flags table with the options:
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setPosition)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setTitle)
|
||||
---
|
||||
---@param title string # The new window title.
|
||||
function love.window.setTitle(title) end
|
||||
|
||||
---
|
||||
---Sets vertical synchronization mode.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.setVSync)
|
||||
---
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.showMessageBox)
|
||||
---
|
||||
---@overload fun(title: string, message: string, buttonlist: table, type?: love.MessageBoxType, attachtowindow?: boolean):number
|
||||
---@param title string # The title of the message box.
|
||||
---@param message string # The text inside the message box.
|
||||
---@param type? love.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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.toPixels)
|
||||
---
|
||||
---@overload fun(x: number, y: number):number, number
|
||||
---@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.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/love.window.updateMode)
|
||||
---
|
||||
---@param width number # Window width.
|
||||
---@param height number # Window height.
|
||||
---@param settings {fullscreen: boolean, fullscreentype: love.FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number} # The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode.
|
||||
---@return boolean success # True if successful, false otherwise.
|
||||
function love.window.updateMode(width, height, settings) end
|
||||
|
||||
---
|
||||
---Types of device display orientation.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/DisplayOrientation)
|
||||
---
|
||||
---@alias love.DisplayOrientation
|
||||
---
|
||||
---Orientation cannot be determined.
|
||||
---
|
||||
---| "unknown"
|
||||
---
|
||||
---Landscape orientation.
|
||||
---
|
||||
---| "landscape"
|
||||
---
|
||||
---Landscape orientation (flipped).
|
||||
---
|
||||
---| "landscapeflipped"
|
||||
---
|
||||
---Portrait orientation.
|
||||
---
|
||||
---| "portrait"
|
||||
---
|
||||
---Portrait orientation (flipped).
|
||||
---
|
||||
---| "portraitflipped"
|
||||
|
||||
---
|
||||
---Types of fullscreen modes.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/FullscreenType)
|
||||
---
|
||||
---@alias love.FullscreenType
|
||||
---
|
||||
---Sometimes known as borderless fullscreen windowed mode. A borderless screen-sized window is created which sits on top of all desktop UI elements. The window is automatically resized to match the dimensions of the desktop, and its size cannot be changed.
|
||||
---
|
||||
---| "desktop"
|
||||
---
|
||||
---Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor.
|
||||
---
|
||||
---| "exclusive"
|
||||
---
|
||||
---Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor.
|
||||
---
|
||||
---| "normal"
|
||||
|
||||
---
|
||||
---Types of message box dialogs. Different types may have slightly different looks.
|
||||
---
|
||||
---
|
||||
---[Open in Browser](https://love2d.org/wiki/MessageBoxType)
|
||||
---
|
||||
---@alias love.MessageBoxType
|
||||
---
|
||||
---Informational dialog.
|
||||
---
|
||||
---| "info"
|
||||
---
|
||||
---Warning dialog.
|
||||
---
|
||||
---| "warning"
|
||||
---
|
||||
---Error dialog.
|
||||
---
|
||||
---| "error"
|
||||
Reference in New Issue
Block a user