diff --git a/modules/audio/Audio.lua b/modules/audio/Audio.lua index 7d267c89..a7505cab 100644 --- a/modules/audio/Audio.lua +++ b/modules/audio/Audio.lua @@ -1,24 +1,18 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { name = 'audio', description = 'Provides an interface to create noise with the user\'s speakers.', + types = { + require(path .. 'types.RecordingDevice'), + require(path .. 'types.Source'), + }, functions = { { name = 'getActiveEffects', description = 'Gets a list of the names of the currently enabled effects.', variants = { - { - returns = { - { - type = 'table', - name = 'effects', - description = 'The list of the names of the currently enabled effects.' - } - } - } - } + }, }, { name = 'getActiveSourceCount', @@ -29,11 +23,11 @@ return { { type = 'number', name = 'count', - description = 'The current number of simultaneously playing sources.' - } - } - } - } + description = 'The current number of simultaneously playing sources.', + }, + }, + }, + }, }, { name = 'getDistanceModel', @@ -44,11 +38,11 @@ return { { type = 'DistanceModel', name = 'model', - description = 'The current distance model. The default is \'inverseclamped\'.' - } - } - } - } + description = 'The current distance model. The default is \'inverseclamped\'.', + }, + }, + }, + }, }, { name = 'getDopplerScale', @@ -59,11 +53,11 @@ return { { type = 'number', name = 'scale', - description = 'The current doppler scale factor.' - } - } - } - } + description = 'The current doppler scale factor.', + }, + }, + }, + }, }, { name = 'getEffect', @@ -74,48 +68,49 @@ return { { type = 'string', name = 'name', - description = 'The name of the effect.' - } + description = 'The name of the effect.', + }, }, returns = { { type = 'table', name = 'settings', - description = 'The settings associated with the effect.' - } - } - } - } + description = 'The settings associated with the effect.', + }, + }, + }, + }, }, { name = 'getMaxSceneEffects', - description = 'Gets the maximum number of active Effects, supported by the system.', + description = 'Gets the maximum number of active effects supported by the system.', variants = { { returns = { { type = 'number', name = 'maximum', - description = 'The maximum number of active Effects.' - } - } - } - } + description = 'The maximum number of active effects.', + }, + }, + }, + }, }, { name = 'getMaxSourceEffects', description = 'Gets the maximum number of active Effects in a single Source object, that the system can support.', variants = { { + description = 'This function return 0 for system that doesn\'t support audio effects.', returns = { { type = 'number', name = 'maximum', - description = 'The maximum number of active Effects per Source.' - } - } - } - } + description = 'The maximum number of active Effects per Source.', + }, + }, + }, + }, }, { name = 'getOrientation', @@ -125,92 +120,72 @@ return { returns = { { type = 'number', - name = 'fx', - description = 'The X component of the forward vector of the listener orientation.' + name = 'fx, fy, fz', + description = 'Forward vector of the listener orientation.', }, { type = 'number', - name = 'fy', - description = 'The Y component of the forward vector of the listener orientation.' + name = 'ux, uy, uz', + description = 'Up vector of the listener orientation.', }, - { - type = 'number', - name = 'fz', - description = 'The Z component of the forward vector of the listener orientation.' - }, - { - type = 'number', - name = 'ux', - description = 'The X component of the up vector of the listener orientation.' - }, - { - type = 'number', - name = 'uy', - description = 'The Y component of the up vector of the listener orientation.' - }, - { - type = 'number', - name = 'uz', - description = 'The Z component of the up vector of the listener orientation.' - } - } - } - } + }, + }, + }, }, { name = 'getPosition', - description = 'Returns the position of the listener.', + description = 'Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.', variants = { { returns = { { type = 'number', name = 'x', - description = 'The X position of the listener.' + description = 'The X position of the listener.', }, { type = 'number', name = 'y', - description = 'The Y position of the listener.' + description = 'The Y position of the listener.', }, { type = 'number', name = 'z', - description = 'The Z position of the listener.' - } - } - } - } + description = 'The Z position of the listener.', + }, + }, + }, + }, }, { name = 'getRecordingDevices', - description = 'Gets a list of RecordingDevices on the system. The first device in the list is the user\'s default recording device.\n\nIf no device is available, it will return an empty list.\nRecording is not supported on iOS', + description = 'Gets a list of RecordingDevices on the system.\n\nThe 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.\n\nAudio recording is currently not supported on iOS and Android.', variants = { { returns = { { type = 'table', name = 'devices', - description = 'The list of RecordingDevices' - } - } - } - } + description = 'The list of connected recording devices.', + }, + }, + }, + }, }, { name = 'getSourceCount', - description = 'Returns the number of sources which are currently playing or paused.', + description = 'Gets the current number of simultaneously playing sources.', variants = { { returns = { { type = 'number', name = 'numSources', - description = 'The number of sources which are currently playing or paused.' - } - } - } - } + description = 'The current number of simultaneously playing sources.', + }, + }, + }, + }, }, { name = 'getVelocity', @@ -221,21 +196,21 @@ return { { type = 'number', name = 'x', - description = 'The X velocity of the listener.' + description = 'The X velocity of the listener.', }, { type = 'number', name = 'y', - description = 'The Y velocity of the listener.' + description = 'The Y velocity of the listener.', }, { type = 'number', name = 'z', - description = 'The Z velocity of the listener.' - } - } - } - } + description = 'The Z velocity of the listener.', + }, + }, + }, + }, }, { name = 'getVolume', @@ -246,179 +221,213 @@ return { { type = 'number', name = 'volume', - description = 'The current master volume.' - } - } - } - } + description = 'The current master volume', + }, + }, + }, + }, }, { name = 'isEffectsSupported', - description = 'Gets whether Effects are supported in the system.', + description = 'Gets whether audio effects are supported in the system.', variants = { { + description = 'Older Linux distributions that ship with older OpenAL library may not support audio effects. Furthermore, iOS doesn\'t\n\nsupport audio effects at all.', returns = { { type = 'boolean', name = 'supported', - description = 'True if Effects are supported, false otherwise.' - } - } - } - } + description = 'True if effects are supported, false otherwise.', + }, + }, + }, + }, + }, + { + name = 'newQueueableSource', + description = 'Creates a new Source usable for real-time generated sound playback with Source:queue.', + variants = { + { + description = 'The sample rate, bit depth, and channel count of any SoundData used with Source:queue must match the parameters given to this constructor.', + arguments = { + { + type = 'number', + name = 'samplerate', + description = 'Number of samples per second when playing.', + }, + { + type = 'number', + name = 'bitdepth', + description = 'Bits per sample (8 or 16).', + }, + { + type = 'number', + name = 'channels', + description = '1 for mono or 2 for stereo.', + }, + { + type = 'number', + name = 'buffercount', + description = '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.', + default = '0', + }, + }, + returns = { + { + type = 'Source', + name = 'source', + description = 'The new Source usable with Source:queue.', + }, + }, + }, + }, }, { name = 'newSource', - description = 'Creates a new Source from a filepath, File, Decoder or SoundData. Sources created from SoundData are always static.', + description = 'Creates a new Source from a filepath, File, Decoder or SoundData.\n\nSources created from SoundData are always static.', variants = { { arguments = { { type = 'string', name = 'filename', - description = 'The filepath to the audio file.' + description = 'The filepath to the audio file.', }, { type = 'SourceType', name = 'type', - description = 'Streaming or static source.' - } + description = 'Streaming or static source.', + }, }, returns = { { type = 'Source', name = 'source', - description = 'A new Source that can play the specified audio.' - } - } + description = 'A new Source that can play the specified audio.', + }, + }, }, { arguments = { { type = 'File', name = 'file', - description = 'A File pointing to an audio file.' + description = 'A File pointing to an audio file.', }, { type = 'SourceType', name = 'type', - description = 'Streaming or static source.' - } + description = 'Streaming or static source.', + }, }, returns = { { type = 'Source', name = 'source', - description = 'A new Source that can play the specified audio.' - } - } + description = 'A new Source that can play the specified audio.', + }, + }, }, { arguments = { { type = 'Decoder', name = 'decoder', - description = 'The Decoder to create a Source from.' - } + description = 'The Decoder to create a Source from.', + }, + { + type = 'SourceType', + name = 'type', + description = 'Streaming or static source.', + }, }, returns = { { type = 'Source', name = 'source', - description = 'A new Source that can play the specified audio.' - } - } + description = 'A new Source that can play the specified audio.', + }, + }, }, { arguments = { { type = 'FileData', - name = 'fileData', - description = 'The FileData to create a Source from.' - } + name = 'data', + description = 'The FileData to create a Source from.', + }, + { + type = 'SourceType', + name = 'type', + description = 'Streaming or static source.', + }, }, returns = { { type = 'Source', name = 'source', - description = 'A new Source that can play the specified audio.' - } - } + description = 'A new Source that can play the specified audio.', + }, + }, }, { arguments = { { type = 'SoundData', - name = 'soundData', - description = 'The SoundData to create a Source from.' - } + name = 'data', + description = 'The SoundData to create a Source from.', + }, }, returns = { { type = 'Source', name = 'source', - description = 'A new Source that can play the specified audio. The SourceType of the returned audio is "static".' - } - } - } - } + description = 'A new Source that can play the specified audio. The SourceType of the returned audio is \'static\'.', + }, + }, + }, + }, }, { - name = 'newQueueableSource', - description = 'Creates a new Source usable for real-time generated sound playback with Source:queue.', + name = 'pause', + description = 'Pauses specific or all currently played Sources.', variants = { { - arguments = { + description = 'Pauses all currently active Sources and returns them.', + returns = { { - type = 'number', - name = 'samplerate', - description = 'Number of samples per second when playing.' + type = 'table', + name = 'Sources', + description = 'A table containing a list of Sources that were paused by this call.', }, + }, + }, + { + description = 'Pauses the given Sources.', + arguments = { { - type = 'number', - name = 'bitdepth', - description = 'Bits per sample (8 or 16).' + type = 'Source', + name = 'source', + description = 'The first Source to pause.', }, { - type = 'number', - name = 'channels', - description = '1 for mono, 2 for stereo.' + type = 'Source', + name = '...', + description = 'Additional Sources to pause.', }, - { - type = 'number', - name = 'buffercount', - default = '0', - description = '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.' - } }, - returns = { - { - type = 'Source', - name = 'source', - description = 'The new Source usable with Source:queue.' - } - } - } - } - }, - { - name = 'pause', - description = 'Pauses currently played Sources.', - variants = { - { - description = 'This function will pause all currently active Sources.' }, { - description = 'This function will only pause the specified Source.', + description = 'Pauses the given Sources.', arguments = { { - type = 'Source', - name = 'source', - description = 'The source on which to pause the playback.' - } - } - } - } + type = 'table', + name = 'sources', + description = 'A table containing a list of Sources to pause.', + }, + }, + }, + }, }, { name = 'play', @@ -429,11 +438,41 @@ return { { type = 'Source', name = 'source', - description = 'The Source to play.' - } - } - } - } + description = 'The Source to play.', + }, + }, + }, + { + description = 'Starts playing multiple Sources simultaneously.', + arguments = { + { + type = 'table', + name = 'sources', + description = 'Table containing a list of Sources to play.', + }, + }, + }, + { + description = 'Starts playing multiple Sources simultaneously.', + arguments = { + { + type = 'Source', + name = 'source1', + description = 'The first Source to play.', + }, + { + type = 'Source', + name = 'source2', + description = 'The second Source to play.', + }, + { + type = 'Source', + name = '...', + description = 'Additional Sources to play.', + }, + }, + }, + }, }, { name = 'setDistanceModel', @@ -444,11 +483,11 @@ return { { type = 'DistanceModel', name = 'model', - description = 'The new distance model.' - } - } - } - } + description = 'The new distance model.', + }, + }, + }, + }, }, { name = 'setDopplerScale', @@ -459,22 +498,22 @@ return { { type = 'number', name = 'scale', - description = 'The new doppler scale factor. The scale must be greater than 0.' + description = 'The new doppler scale factor. The scale must be greater than 0.', }, - } - } - } + }, + }, + }, }, { name = 'setEffect', - description = 'Defines an effect that can be applied to a Source.', + description = 'Defines an effect that can be applied to a Source.\n\nNot all system supports audio effects. Use love.audio.isEffectsSupported to check.', variants = { { arguments = { { type = 'string', name = 'name', - description = 'The name of the effect.' + description = 'The name of the effect.', }, { type = 'table', @@ -484,52 +523,52 @@ return { { type = 'EffectType', name = 'type', - description = 'The type of effect to use.' + description = 'The type of effect to use.', }, { type = 'number', name = 'volume', - description = 'The volume of the effect.' + description = 'The volume of the effect.', }, { type = 'number', name = '...', - description = 'Effect-specific settings.' - } - } - } + description = 'Effect-specific settings. See EffectType for available effects and their corresponding settings.', + }, + }, + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the effect was successfully created.' - } - } + description = 'Whether the effect was successfully created.', + }, + }, }, { arguments = { { type = 'string', name = 'name', - description = 'The name of the effect.' + description = 'The name of the effect.', }, { type = 'boolean', name = 'enabled', + description = 'If false and the given effect name was previously set, disables the effect.', default = 'true', - description = 'If false and the given effect name was previously set, disables the effect.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the Effect was successfully disabled.' - } - } - } - } + description = 'Whether the effect was successfully disabled.', + }, + }, + }, + }, }, { name = 'setMixWithSystem', @@ -540,18 +579,18 @@ return { { type = 'boolean', name = 'mix', - description = 'True to enable mixing, false to disable it.' - } + description = 'True to enable mixing, false to disable it.', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the change succeeded, false otherwise.' - } - } - } - } + description = 'True if the change succeeded, false otherwise.', + }, + }, + }, + }, }, { name = 'setOrientation', @@ -561,37 +600,17 @@ return { arguments = { { type = 'number', - name = 'fx', - description = 'The X component of the forward vector of the listener orientation.' - }, - { - type = 'number', - name = 'fy', - description = 'The Y component of the forward vector of the listener orientation.' - }, - { - type = 'number', - name = 'fz', - description = 'The Z component of the forward vector of the listener orientation.' + name = 'fx, fy, fz', + description = 'Forward vector of the listener orientation.', }, { type = 'number', - name = 'ux', - description = 'The X component of the up vector of the listener orientation.' + name = 'ux, uy, uz', + description = 'Up vector of the listener orientation.', }, - { - type = 'number', - name = 'uy', - description = 'The Y component of the up vector of the listener orientation.' - }, - { - type = 'number', - name = 'uz', - description = 'The Z component of the up vector of the listener orientation.' - } - } - } - } + }, + }, + }, }, { name = 'setPosition', @@ -602,21 +621,21 @@ return { { type = 'number', name = 'x', - description = 'The X position of the listener.' + description = 'The x position of the listener.', }, { type = 'number', name = 'y', - description = 'The Y position of the listener.' + description = 'The y position of the listener.', }, { type = 'number', name = 'z', - description = 'The Z position of the listener.' - } - } - } - } + description = 'The z position of the listener.', + }, + }, + }, + }, }, { name = 'setVelocity', @@ -627,22 +646,21 @@ return { { type = 'number', name = 'x', - description = 'The X velocity of the listener.' + description = 'The X velocity of the listener.', }, { type = 'number', name = 'y', - description = 'The Y velocity of the listener.' + description = 'The Y velocity of the listener.', }, { type = 'number', name = 'z', - default = '0', - description = 'The Z velocity of the listener.' - } - } - } - } + description = 'The Z velocity of the listener.', + }, + }, + }, + }, }, { name = 'setVolume', @@ -653,18 +671,18 @@ return { { type = 'number', name = 'volume', - description = '1.0f is max and 0.0f is off.' - } - } - } - } + description = '1.0 is max and 0.0 is off.', + }, + }, + }, + }, }, { name = 'stop', description = 'Stops currently played sources.', variants = { { - description = 'This function will stop all currently active sources.' + description = 'This function will stop all currently active sources.', }, { description = 'This function will only stop the specified source.', @@ -672,16 +690,42 @@ return { { type = 'Source', name = 'source', - description = 'The source on which to stop the playback.' - } - } - } - } - } - }, - types = { - require(path .. 'types.Source'), - require(path .. 'types.RecordingDevice') + description = 'The source on which to stop the playback.', + }, + }, + }, + { + description = 'Simultaneously stops all given Sources.', + arguments = { + { + type = 'Source', + name = 'source1', + description = 'The first Source to stop.', + }, + { + type = 'Source', + name = 'source2', + description = 'The second Source to stop.', + }, + { + type = 'Source', + name = '...', + description = 'Additional Sources to stop.', + }, + }, + }, + { + description = 'Simultaneously stops all given Sources.', + arguments = { + { + type = 'table', + name = 'sources', + description = 'A table containing a list of Sources to stop.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.DistanceModel'), @@ -689,6 +733,6 @@ return { require(path .. 'enums.EffectWaveform'), require(path .. 'enums.FilterType'), require(path .. 'enums.SourceType'), - require(path .. 'enums.TimeUnit') - } -}; + require(path .. 'enums.TimeUnit'), + }, +} \ No newline at end of file diff --git a/modules/audio/enums/DistanceModel.lua b/modules/audio/enums/DistanceModel.lua index 381a3c05..b11e2295 100644 --- a/modules/audio/enums/DistanceModel.lua +++ b/modules/audio/enums/DistanceModel.lua @@ -4,31 +4,31 @@ return { constants = { { name = 'none', - description = 'Sources do not get attenuated.' + description = 'Sources do not get attenuated.', }, { name = 'inverse', - description = 'Inverse distance attenuation.' + description = 'Inverse distance attenuation.', }, { name = 'inverseclamped', - description = 'Inverse distance attenuation. Gain is clamped. In version 0.9.2 and older this is named inverse clamped.' + description = 'Inverse distance attenuation. Gain is clamped. In version 0.9.2 and older this is named \'\'\'inverse clamped\'\'\'.', }, { name = 'linear', - description = 'Linear attenuation.' + description = 'Linear attenuation.', }, { name = 'linearclamped', - description = 'Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named linear clamped.' + description = 'Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named \'\'\'linear clamped\'\'\'.', }, { name = 'exponent', - description = 'Exponential attenuation.' + description = 'Exponential attenuation.', }, { name = 'exponentclamped', - description = 'Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named exponent clamped.' - } - } -} + description = 'Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named \'\'\'exponent clamped\'\'\'.', + }, + }, +} \ No newline at end of file diff --git a/modules/audio/enums/EffectType.lua b/modules/audio/enums/EffectType.lua index 06f8231e..92eb56f4 100644 --- a/modules/audio/enums/EffectType.lua +++ b/modules/audio/enums/EffectType.lua @@ -4,35 +4,35 @@ return { constants = { { name = 'chorus', - description = 'Plays multiple copies of the sound with slight pitch and time variation. Used to make sounds sound "fuller" or "thicker".' + description = 'Plays multiple copies of the sound with slight pitch and time variation. Used to make sounds sound "fuller" or "thicker".', }, { name = 'compressor', - description = 'Decreases the dynamic range of the sound, making the loud and quiet parts closer in volume, producing a more uniform amplitude throughout time.' + description = 'Decreases the dynamic range of the sound, making the loud and quiet parts closer in volume, producing a more uniform amplitude throughout time.', }, { name = 'distortion', - description = 'Alters the sound by amplifying it until it clips, shearing off parts of the signal, leading to a compressed and distorted sound.' + description = 'Alters the sound by amplifying it until it clips, shearing off parts of the signal, leading to a compressed and distorted sound.', }, { name = 'echo', - description = '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.' + description = '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.', }, { name = 'equalizer', - description = 'Adjust the frequency components of the sound using a 4-band (low-shelf, two band-pass and a high-shelf) equalizer.' + description = 'Adjust the frequency components of the sound using a 4-band (low-shelf, two band-pass and a high-shelf) equalizer.', }, { name = 'flanger', - description = '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.' + description = '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.', }, { name = 'reverb', - description = 'Decaying feedback based effect, on the order of milliseconds. Used to simulate the reflection off of the surroundings.' + description = 'Decaying feedback based effect, on the order of milliseconds. Used to simulate the reflection off of the surroundings.', }, { name = 'ringmodulator', - description = 'An implementation of amplitude modulation; multiplies the source signal with a simple waveform, to produce either volume changes, or inharmonic overtones.' - } - } -} + description = 'An implementation of amplitude modulation; multiplies the source signal with a simple waveform, to produce either volume changes, or inharmonic overtones.', + }, + }, +} \ No newline at end of file diff --git a/modules/audio/enums/EffectWaveform.lua b/modules/audio/enums/EffectWaveform.lua index 0c922e3d..3e0a11c4 100644 --- a/modules/audio/enums/EffectWaveform.lua +++ b/modules/audio/enums/EffectWaveform.lua @@ -1,22 +1,22 @@ return { - name = 'EffectWaveform', - description = 'The different types of waveforms that can be used with the ringmodulator EffectType.', - constants = { - { - name = 'sawtooth', - description = 'A sawtooth wave, also known as a ramp wave. Named for its linear rise, and (near-)instantaneous fall along time.' + name = 'EffectWaveform', + description = 'The different types of waveforms that can be used with the \'\'\'ringmodulator\'\'\' EffectType.', + constants = { + { + name = 'sawtooth', + description = 'A sawtooth wave, also known as a ramp wave. Named for its linear rise, and (near-)instantaneous fall along time.', + }, + { + name = 'sine', + description = 'A sine wave. Follows a trigonometric sine function.', + }, + { + name = 'square', + description = 'A square wave. Switches between high and low states (near-)instantaneously.', + }, + { + name = 'triangle', + description = 'A triangle wave. Follows a linear rise and fall that repeats periodically.', + }, }, - { - name = 'sine', - description = 'A sine wave. Follows a trigonometric sine function.' - }, - { - name = 'square', - description = 'A square wave. Switches between high and low states (near-)instantaneously.' - }, - { - name = 'triangle', - description = 'A triangle wave. Follows a linear rise and fall that repeats periodically.' - } - } } \ No newline at end of file diff --git a/modules/audio/enums/FilterType.lua b/modules/audio/enums/FilterType.lua index 805b645d..b75bf841 100644 --- a/modules/audio/enums/FilterType.lua +++ b/modules/audio/enums/FilterType.lua @@ -1,18 +1,18 @@ return { - name = 'FilterType', - description = 'The different types of filters for Sources', - constants = { - { - name = 'lowpass', - description = 'Low-pass filter. High frequency sounds are attenuated.' - }, - { - name = 'highpass', - description = 'High-pass filter. Low frequency sounds are attenuated.' - }, - { - name = 'bandpass', - description = 'Band-pass filter. Both high and low frequency sounds are attenuated based on the given parameters.' - } - } -} + name = 'FilterType', + description = 'Types of filters for Sources.', + constants = { + { + name = 'lowpass', + description = 'Low-pass filter. High frequency sounds are attenuated.', + }, + { + name = 'highpass', + description = 'High-pass filter. Low frequency sounds are attenuated.', + }, + { + name = 'bandpass', + description = 'Band-pass filter. Both high and low frequency sounds are attenuated based on the given parameters.', + }, + }, +} \ No newline at end of file diff --git a/modules/audio/enums/SourceType.lua b/modules/audio/enums/SourceType.lua index d628ae04..62bee042 100644 --- a/modules/audio/enums/SourceType.lua +++ b/modules/audio/enums/SourceType.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'static', - description = 'The whole audio is decoded.' + description = 'The whole audio is decoded.', }, { name = 'stream', - description = 'The audio is decoded in chunks when needed.' + description = 'The audio is decoded in chunks when needed.', }, { name = 'queue', - description = 'The audio must be manually queued by the user with Source:queue.' - } - } -} + description = 'The audio must be manually queued by the user.', + }, + }, +} \ No newline at end of file diff --git a/modules/audio/enums/TimeUnit.lua b/modules/audio/enums/TimeUnit.lua index 292e6a9c..0429e1d8 100644 --- a/modules/audio/enums/TimeUnit.lua +++ b/modules/audio/enums/TimeUnit.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'seconds', - description = 'Regular seconds.' + description = 'Regular seconds.', }, { name = 'samples', - description = 'Audio samples.' - } - } -} + description = 'Audio samples.', + }, + }, +} \ No newline at end of file diff --git a/modules/audio/types/RecordingDevice.lua b/modules/audio/types/RecordingDevice.lua index 86c9c90e..783259c3 100644 --- a/modules/audio/types/RecordingDevice.lua +++ b/modules/audio/types/RecordingDevice.lua @@ -1,7 +1,10 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'RecordingDevice', description = 'Represents an audio input device capable of recording sounds.', - constructors = { + supertypes = { + 'Object', }, functions = { { @@ -12,12 +15,12 @@ return { returns = { { type = 'number', - name = 'bitdepth', - description = 'The number of bits per sample in the data that\'s currently being recorded. (8 or 16).' - } - } - } - } + name = 'bits', + description = 'The number of bits per sample in the data that\'s currently being recorded.', + }, + }, + }, + }, }, { name = 'getChannelCount', @@ -28,26 +31,26 @@ return { { type = 'number', name = 'channels', - description = 'The number of channels being recorded (1 for mono, 2 for stereo).' - } - } - } - } + description = 'The number of channels being recorded (1 for mono, 2 for stereo).', + }, + }, + }, + }, }, { name = 'getData', - description = 'Gets all recorded audio SoundData stored in the device\'s internal ring buffer.', + description = 'Gets all recorded audio SoundData stored in the device\'s internal ring buffer.\n\nThe 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.', variants = { { returns = { { type = 'SoundData', name = 'data', - description = 'The recorded audio data, or nil if the device isn\'t recording.' - } - } - } - } + description = 'The recorded audio data, or nil if the device isn\'t recording.', + }, + }, + }, + }, }, { name = 'getName', @@ -58,11 +61,11 @@ return { { type = 'string', name = 'name', - description = 'The name for this device.' - } - } - } - } + description = 'The name of the device.', + }, + }, + }, + }, }, { name = 'getSampleCount', @@ -73,11 +76,11 @@ return { { type = 'number', name = 'samples', - description = 'The number of samples that have been recorded so far.' - } - } - } - } + description = 'The number of samples that have been recorded so far.', + }, + }, + }, + }, }, { name = 'getSampleRate', @@ -88,11 +91,11 @@ return { { type = 'number', name = 'rate', - description = 'The number of samples being recorded per second (sample rate).' - } - } - } - } + description = 'The number of samples being recorded per second (sample rate).', + }, + }, + }, + }, }, { name = 'isRecording', @@ -103,70 +106,67 @@ return { { type = 'boolean', name = 'recording', - description = 'True if the device is recording, false otherwise.' - } - } - } - } + description = 'True if the recording, false otherwise.', + }, + }, + }, + }, }, { name = 'start', description = 'Begins recording audio using this device.', variants = { { + description = 'A ring buffer is used internally to store recorded data before RecordingDevice:getData or RecordingDevice:stop are called – the former clears the buffer. If the buffer completely fills up before getData or stop are called, the oldest data that doesn\'t fit into the buffer will be lost.', arguments = { { type = 'number', name = 'samplecount', - description = 'The maximum number of samples to store in an internal ring buffer when recording. RecordingDevice:getData clears the internal buffer when called.' + description = 'The maximum number of samples to store in an internal ring buffer when recording. RecordingDevice:getData clears the internal buffer when called.', }, { type = 'number', name = 'samplerate', + description = 'The number of samples per second to store when recording.', default = '8000', - description = 'The number of samples per second to store when recording.' }, { type = 'number', name = 'bitdepth', + description = 'The number of bits per sample.', default = '16', - description = 'The number of bits per sample.' }, { type = 'number', name = 'channels', + description = 'Whether to record in mono or stereo. Most microphones don\'t support more than 1 channel.', default = '1', - description = 'Whether to record in mono or stereo. Most microphones don\'t support more than 1 channel.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the device successfully began recording using the specified parameters, false if not.' - } - } - } - } + description = 'True if the device successfully began recording using the specified parameters, false if not.', + }, + }, + }, + }, }, { name = 'stop', - description = 'Stops recording audio from this device.', + description = 'Stops recording audio from this device. Any sound data currently in the device\'s buffer will be returned.', variants = { { returns = { { type = 'SoundData', name = 'data', - description = 'The sound data currently in the device\'s buffer, or nil if the device wasn\'t recording.' - } - } - } - } - } + description = 'The sound data currently in the device\'s buffer, or nil if the device wasn\'t recording.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/audio/types/Source.lua b/modules/audio/types/Source.lua index c32a1ae5..f8bef0d9 100644 --- a/modules/audio/types/Source.lua +++ b/modules/audio/types/Source.lua @@ -1,44 +1,62 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Source', - description = '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.', - constructors = { - 'newSource' + description = 'A Source represents audio you can play back.\n\nYou 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.\n\nThe Source controls (play/pause/stop) act according to the following state table.', + supertypes = { + 'Object', }, functions = { { name = 'clone', - description = 'Creates an identical copy of the Source in the stopped state.\n\nStatic 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.\n\nCloned Sources inherit all the set-able state of the original Source, but they are initialized stopped.', + description = 'Creates an identical copy of the Source in the stopped state.\n\nStatic 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.', variants = { { + description = 'Cloned Sources inherit all the set-able state of the original Source, but they are initialized stopped.', returns = { { type = 'Source', name = 'source', - description = 'The new identical copy of this Source.' - } - } - } - } + description = 'The new identical copy of this Source.', + }, + }, + }, + }, + }, + { + name = 'getActiveEffects', + description = 'Gets a list of the Source\'s active effect names.', + variants = { + { + returns = { + { + type = 'table', + name = 'effects', + description = 'A list of the source\'s active effect names.', + }, + }, + }, + }, }, { name = 'getAttenuationDistances', - description = 'Returns the reference and maximum distance of the source.', + description = '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.', variants = { { returns = { { type = 'number', name = 'ref', - description = 'The reference distance.' + description = 'The current reference attenuation distance. If the current DistanceModel is clamped, this is the minimum distance before the Source is no longer attenuated.', }, { type = 'number', name = 'max', - description = 'The maximum distance.' - } - } - } - } + description = 'The current maximum attenuation distance.', + }, + }, + }, + }, }, { name = 'getChannelCount', @@ -49,11 +67,11 @@ return { { type = 'number', name = 'channels', - description = '1 for mono, 2 for stereo.' - } - } - } - } + description = '1 for mono, 2 for stereo.', + }, + }, + }, + }, }, { name = 'getCone', @@ -64,26 +82,21 @@ return { { type = 'number', name = 'innerAngle', - description = '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.' + description = '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.', }, { type = 'number', name = 'outerAngle', - description = '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.' + description = '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.', }, { type = 'number', name = 'outerVolume', - description = 'The Source\'s volume when the listener is outside both the inner and outer cone angles.' + description = 'The Source\'s volume when the listener is outside both the inner and outer cone angles.', }, - { - type = 'number', - name = 'outerHighGain', - description = 'The gain for the high tones when the listener is outside both the inner and outer cone angles. Not supported in iOS.' - } - } - } - } + }, + }, + }, }, { name = 'getDirection', @@ -94,21 +107,21 @@ return { { type = 'number', name = 'x', - description = 'The X part of the direction vector.' + description = 'The X part of the direction vector.', }, { type = 'number', name = 'y', - description = 'The Y part of the direction vector.' + description = 'The Y part of the direction vector.', }, { type = 'number', name = 'z', - description = 'The Z part of the direction vector.' - } - } - } - } + description = 'The Z part of the direction vector.', + }, + }, + }, + }, }, { name = 'getDuration', @@ -119,144 +132,116 @@ return { { type = 'TimeUnit', name = 'unit', - default = '"seconds"', - description = 'The time unit for the return value.' - } + description = 'The time unit for the return value.', + default = '\'seconds\'', + }, }, returns = { { type = 'number', name = 'duration', - description = 'The duration of the Source, or -1 if it cannot be determined.' - } - } - } - } + description = 'The duration of the Source, or -1 if it cannot be determined.', + }, + }, + }, + }, }, { name = 'getEffect', - description = 'Gets the filter settings associated to a specific Effect.\n\nThis function returns nil if the Effect was applied with no filter settings associated to it.', + description = 'Gets the filter settings associated to a specific effect.\n\nThis function returns nil if the effect was applied with no filter settings associated to it.', variants = { { arguments = { { type = 'string', name = 'name', - description = 'The name of the effect.' + description = 'The name of the effect.', }, { type = 'table', name = 'filtersettings', + description = 'An optional empty table that will be filled with the filter settings.', default = '{}', - description = 'An optional empty table that will be filled with the filter settings.' - } + }, }, returns = { { type = 'table', name = 'filtersettings', - description = ' 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:', + description = '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:', table = { - { - type = 'FilterType', - name = 'type', - description = 'The type of filter in use.' - }, { type = 'number', name = 'volume', - description = 'The overall volume of the audio. Must be between 0 and 1.' + description = 'The overall volume of the audio.', }, { type = 'number', name = 'highgain', - description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters.' + description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters.', }, { type = 'number', name = 'lowgain', - description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters.' - } - } - } - } - } - } - }, - { - name = 'getActiveEffects', - description = 'Returns a list of all the active effects currently applied to the Source', - variants = { - { - returns = { - { - type = 'table', - name = 'effects', - description = 'The list with all the names for the currently applied effects' - } - } - } - } + description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters.', + }, + }, + }, + }, + }, + }, }, { name = 'getFilter', description = 'Gets the filter settings currently applied to the Source.', variants = { { - arguments = { - { - type = 'table', - name = 'settings', - default = '{}', - description = 'An optional empty table that will be filled with the filter settings.' - } - }, returns = { { type = 'table', name = 'settings', - description = 'The settings for the active filter on this Source, or nil if the Source has no active filter. The table has the following fields:', + description = 'The filter settings to use for this Source, or nil if the Source has no active filter. The table has the following fields:', table = { { type = 'FilterType', name = 'type', - description = 'The type of filter in use.' + description = 'The type of filter to use.', }, { type = 'number', name = 'volume', - description = 'The overall volume of the audio. Must be between 0 and 1.' + description = 'The overall volume of the audio.', }, { type = 'number', name = 'highgain', - description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters.' + description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters.', }, { type = 'number', name = 'lowgain', - description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters.' - } - } - } - } - } - } + description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters.', + }, + }, + }, + }, + }, + }, }, { name = 'getFreeBufferCount', - description = 'Gets the number of free buffer slots of a queueable Source.', + description = '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.', variants = { { returns = { { type = 'number', name = 'buffers', - description = 'How many more SoundData objects can be queued up.' - } - } - } - } + description = 'How many more SoundData objects can be queued up.', + }, + }, + }, + }, }, { name = 'getPitch', @@ -267,11 +252,11 @@ return { { type = 'number', name = 'pitch', - description = 'The pitch, where 1.0 is normal.' - } - } - } - } + description = 'The pitch, where 1.0 is normal.', + }, + }, + }, + }, }, { name = 'getPosition', @@ -282,21 +267,21 @@ return { { type = 'number', name = 'x', - description = 'The X position of the Source.' + description = 'The X position of the Source.', }, { type = 'number', name = 'y', - description = 'The Y position of the Source.' + description = 'The Y position of the Source.', }, { type = 'number', name = 'z', - description = 'The Z position of the Source.' - } - } - } - } + description = 'The Z position of the Source.', + }, + }, + }, + }, }, { name = 'getRolloff', @@ -307,26 +292,26 @@ return { { type = 'number', name = 'rolloff', - description = 'The rolloff factor.' - } - } - } - } + description = 'The rolloff factor.', + }, + }, + }, + }, }, { name = 'getType', - description = 'Gets the type (static or stream) of the Source.', + description = 'Gets the type of the Source.', variants = { { returns = { { type = 'SourceType', name = 'sourcetype', - description = 'The type of the source.' - } - } - } - } + description = 'The type of the source.', + }, + }, + }, + }, }, { name = 'getVelocity', @@ -337,21 +322,21 @@ return { { type = 'number', name = 'x', - description = 'The X part of the velocity vector.' + description = 'The X part of the velocity vector.', }, { type = 'number', name = 'y', - description = 'The Y part of the velocity vector.' + description = 'The Y part of the velocity vector.', }, { type = 'number', name = 'z', - description = 'The Z part of the velocity vector.' - } - } - } - } + description = 'The Z part of the velocity vector.', + }, + }, + }, + }, }, { name = 'getVolume', @@ -362,11 +347,11 @@ return { { type = 'number', name = 'volume', - description = 'The volume of the Source, where 1.0 is normal volume.' - } - } - } - } + description = 'The volume of the Source, where 1.0 is normal volume.', + }, + }, + }, + }, }, { name = 'getVolumeLimits', @@ -377,16 +362,16 @@ return { { type = 'number', name = 'min', - description = 'The minimum volume.' + description = 'The minimum volume.', }, { type = 'number', name = 'max', - description = 'The maximum volume.' - } - } - } - } + description = 'The maximum volume.', + }, + }, + }, + }, }, { name = 'isLooping', @@ -397,11 +382,11 @@ return { { type = 'boolean', name = 'loop', - description = 'True if the Source will loop, false otherwise.' - } - } - } - } + description = 'True if the Source will loop, false otherwise.', + }, + }, + }, + }, }, { name = 'isPlaying', @@ -412,33 +397,34 @@ return { { type = 'boolean', name = 'playing', - description = 'True if the Source is playing, false otherwise.' - } - } - } - } + description = 'True if the Source is playing, false otherwise.', + }, + }, + }, + }, }, { name = 'isRelative', - description = 'Gets whether the Source\'s position and direction are relative to the listener.', + description = 'Gets whether the Source\'s position, velocity, direction, and cone angles are relative to the listener.', variants = { { returns = { { type = 'boolean', name = 'relative', - description = 'True if the position, velocity, direction and cone angles are relative to the listener, false if they\'re absolute.' - } - } - } - } + description = 'True if the position, velocity, direction and cone angles are relative to the listener, false if they\'re absolute.', + }, + }, + }, + }, }, { name = 'pause', description = 'Pauses the Source.', variants = { - {} - } + { + }, + }, }, { name = 'play', @@ -449,11 +435,11 @@ return { { type = 'boolean', name = 'success', - description = 'True if the Source started playing successfully, false otherwise.' - } - } - } - } + description = 'Whether the Source was able to successfully start playing.', + }, + }, + }, + }, }, { name = 'queue', @@ -464,59 +450,59 @@ return { { type = 'SoundData', name = 'sounddata', - description = 'The data to queue. The SoundData\'s sample rate, bit depth, and channel count must match the Source\'s.' - } + description = 'The data to queue. The SoundData\'s sample rate, bit depth, and channel count must match the Source\'s.', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.' - } - } - } - } + description = 'True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.', + }, + }, + }, + }, }, { name = 'seek', - description = 'Sets the playing position of the Source.', + description = 'Sets the currently playing position of the Source.', variants = { { arguments = { { type = 'number', - name = 'position', - description = 'The position to seek to.' + name = 'offset', + description = 'The position to seek to.', }, { type = 'TimeUnit', name = 'unit', - default = '"seconds"', - description = 'The unit of the position value.' - } - } - } - } + description = 'The unit of the position value.', + default = '\'seconds\'', + }, + }, + }, + }, }, { name = 'setAttenuationDistances', - description = 'Sets the reference and maximum distance of the source.', + description = '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.\n\nDistance attenuation is only applicable to Sources based on mono (rather than stereo) audio.', variants = { { arguments = { { type = 'number', name = 'ref', - description = 'The new reference distance.' + description = 'The new reference attenuation distance. If the current DistanceModel is clamped, this is the minimum attenuation distance.', }, { type = 'number', name = 'max', - description = 'The new maximum distance.' - } - } - } - } + description = 'The new maximum attenuation distance.', + }, + }, + }, + }, }, { name = 'setCone', @@ -527,28 +513,22 @@ return { { type = 'number', name = 'innerAngle', - description = '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.' + description = '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.', }, { type = 'number', name = 'outerAngle', - description = '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.' + description = '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.', }, { type = 'number', name = 'outerVolume', + description = 'The Source\'s volume when the listener is outside both the inner and outer cone angles.', default = '0', - description = 'The Source\'s volume when the listener is outside both the inner and outer cone angles.' }, - { - type = 'number', - name = 'outerHighGain', - default = '1', - description = 'The gain for the high tones when the listener is outside both the inner and outer cone angles.' - } - } - } - } + }, + }, + }, }, { name = 'setDirection', @@ -559,93 +539,94 @@ return { { type = 'number', name = 'x', - description = 'The X part of the direction vector.' + description = 'The X part of the direction vector.', }, { type = 'number', name = 'y', - description = 'The Y part of the direction vector.' + description = 'The Y part of the direction vector.', }, { type = 'number', name = 'z', - default = '0', - description = 'The Z part of the direction vector.' - } - } - } - } + description = 'The Z part of the direction vector.', + }, + }, + }, + }, }, { name = 'setEffect', description = 'Applies an audio effect to the Source.\n\nThe effect must have been previously defined using love.audio.setEffect.', variants = { { + description = 'Applies the given previously defined effect to this Source.', arguments = { { type = 'string', name = 'name', - description = 'The name of the effect previously set up with love.audio.setEffect.' + description = 'The name of the effect previously set up with love.audio.setEffect.', }, { type = 'boolean', name = 'enable', + description = 'If false and the given effect name was previously enabled on this Source, disables the effect.', default = 'true', - description = 'If false and the given effect name was previously enabled on this Source, disables the effect.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the effect and filter were successfully applied to this Source.' - } - } + description = 'Whether the effect was successfully applied to this Source.', + }, + }, }, { + description = 'Applies the given previously defined effect to this Source, and applies a filter to the Source which affects the sound fed into the effect.\n\nAudio effect functionality is not supported on iOS.', arguments = { { type = 'string', name = 'name', - description = 'The name of the effect previously set up with love.audio.setEffect.' + description = 'The name of the effect previously set up with love.audio.setEffect.', }, { type = 'table', name = 'filtersettings', - description = 'The filter settings to apply prior to, with the following fields:', + description = 'The filter settings to apply prior to the effect, with the following fields:', table = { { type = 'FilterType', name = 'type', - description = 'The type of filter to use.' + description = 'The type of filter to use.', }, { type = 'number', name = 'volume', - description = 'The overall volume of the audio. Must be between 0 and 1.' + description = 'The overall volume of the audio. Must be between 0 and 1.', }, { type = 'number', name = 'highgain', - description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters. Must be between 0 and 1.' + description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters. Must be between 0 and 1.', }, { type = 'number', name = 'lowgain', - description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters. Must be between 0 and 1.' - } - } - } + description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters. Must be between 0 and 1.', + }, + }, + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the effect and filter were successfully applied to this Source.' - } - } - } - } + description = 'Whether the effect and filter were successfully applied to this Source.', + }, + }, + }, + }, }, { name = 'setFilter', @@ -661,35 +642,38 @@ return { { type = 'FilterType', name = 'type', - description = 'The type of filter to use.' + description = 'The type of filter to use.', }, { type = 'number', name = 'volume', - description = 'The overall volume of the audio. Must be between 0 and 1.' + description = 'The overall volume of the audio. Must be between 0 and 1.', }, { type = 'number', name = 'highgain', - description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters. Must be between 0 and 1.' + description = 'Volume of high-frequency audio. Only applies to low-pass and band-pass filters. Must be between 0 and 1.', }, { type = 'number', name = 'lowgain', - description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters. Must be between 0 and 1.' - } - } - } + description = 'Volume of low-frequency audio. Only applies to high-pass and band-pass filters. Must be between 0 and 1.', + }, + }, + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the filter was successfully applied to the Source.' - } - } - } - } + description = 'Whether the filter was successfully applied to the Source.', + }, + }, + }, + { + description = 'Disables filtering on this Source.\n\n', + }, + }, }, { name = 'setLooping', @@ -700,11 +684,11 @@ return { { type = 'boolean', name = 'loop', - description = 'True if the source should loop, false otherwise.' - } - } - } - } + description = 'True if the source should loop, false otherwise.', + }, + }, + }, + }, }, { name = 'setPitch', @@ -715,108 +699,107 @@ return { { type = 'number', name = 'pitch', - description = '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.' - } - } - } - } + description = '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.', + }, + }, + }, + }, }, { name = 'setPosition', - description = 'Sets the position of the Source.', + description = 'Sets the position of the Source. Please note that this only works for mono (i.e. non-stereo) sound files!', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The X position of the Source.' + description = 'The X position of the Source.', }, { type = 'number', name = 'y', - description = 'The Y position of the Source.' + description = 'The Y position of the Source.', }, { type = 'number', name = 'z', - default = '0', - description = 'The Z position of the Source.' - } - } - } - } + description = 'The Z position of the Source.', + }, + }, + }, + }, }, { name = 'setRelative', - description = 'Sets whether the Source\'s position and direction are relative to the listener. Relative Sources move with the listener so they aren\'t affected by it\'s position', + description = 'Sets whether the parent::Source\'s position, velocity, direction, and cone angles are relative to the listener, or absolute.\n\nBy 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. ', variants = { { arguments = { { type = 'boolean', name = 'enable', - description = 'True to make the position, velocity, direction and cone angles relative to the listener, false to make them absolute.' - } - } - } - } + description = 'True to make the position, velocity, direction and cone angles relative to the listener, false to make them absolute.', + default = '\'false\'', + }, + }, + }, + }, }, { name = 'setRolloff', - description = 'Sets the rolloff factor which affects the strength of the used distance attenuation.\n\nExtended information and detailed formulas can be found in the chapter "3.4. Attenuation By Distance" of OpenAL 1.1 specification.', + description = 'Sets the rolloff factor which affects the strength of the used distance attenuation.\n\nExtended information and detailed formulas can be found in the chapter \'3.4. Attenuation By Distance\' of OpenAL 1.1 specification.', variants = { { arguments = { { type = 'number', name = 'rolloff', - description = 'The new rolloff factor.' - } - } - } - } + description = 'The new rolloff factor.', + }, + }, + }, + }, }, { name = 'setVelocity', - description = 'Sets the velocity of the Source.\n\nThis does not change the position of the Source, but is used to calculate the doppler effect.', + description = 'Sets the velocity of the Source.\n\nThis does \'\'\'not\'\'\' change the position of the Source, but lets the application know how it has to calculate the doppler effect.', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The X part of the velocity vector.' + description = 'The X part of the velocity vector.', }, { type = 'number', name = 'y', - description = 'The Y part of the velocity vector.' + description = 'The Y part of the velocity vector.', }, { type = 'number', name = 'z', - default = '0', - description = 'The Z part of the velocity vector.' - } - } - } - } + description = 'The Z part of the velocity vector.', + }, + }, + }, + }, }, { name = 'setVolume', - description = 'Sets the volume of the Source.', + description = 'Sets the current volume of the Source.', variants = { { arguments = { { type = 'number', name = 'volume', - description = 'The volume of the Source, where 1.0 is normal volume.' - } - } - } - } + description = 'The volume for a Source, where 1.0 is normal volume. Volume cannot be raised above 1.0.', + }, + }, + }, + }, }, { name = 'setVolumeLimits', @@ -827,23 +810,24 @@ return { { type = 'number', name = 'min', - description = 'The minimum volume.' + description = 'The minimum volume.', }, { type = 'number', name = 'max', - description = 'The maximum volume.' - } - } - } - } + description = 'The maximum volume.', + }, + }, + }, + }, }, { name = 'stop', description = 'Stops a Source.', variants = { - {} - } + { + }, + }, }, { name = 'tell', @@ -854,23 +838,19 @@ return { { type = 'TimeUnit', name = 'unit', - default = '"seconds"', - description = 'The type of unit for the return value.' - } + description = 'The type of unit for the return value.', + default = '\'seconds\'', + }, }, returns = { { type = 'number', name = 'position', - description = 'The currently playing position of the Source.' - } - } - } - } - } + description = 'The currently playing position of the Source.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/data/Data.lua b/modules/data/Data.lua index ee7a317d..12144c36 100644 --- a/modules/data/Data.lua +++ b/modules/data/Data.lua @@ -1,9 +1,10 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { name = 'data', description = 'Provides functionality for creating and transforming data.', + types = { + }, functions = { { name = 'compress', @@ -14,66 +15,66 @@ return { { type = 'ContainerType', name = 'container', - description = 'What type to return the compressed data as.' + description = 'What type to return the compressed data as.', }, { type = 'CompressedDataFormat', name = 'format', - description = 'The format to use when compressing the string.' + description = 'The format to use when compressing the string.', }, { type = 'string', name = 'rawstring', - description = 'The raw (un-compressed) string to compress.' + description = 'The raw (un-compressed) string to compress.', }, { type = 'number', name = 'level', + description = '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.', default = '-1', - description = '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.' - } + }, }, returns = { { - type = 'CompressedData or string', + type = 'value', name = 'compressedData', - description = 'CompressedData/string which contains the compressed version of data.' - } - } + description = 'CompressedData/string which contains the compressed version of rawstring.', + }, + }, }, { arguments = { { type = 'ContainerType', name = 'container', - description = 'What type to return the compressed data as.' + description = 'What type to return the compressed data as.', }, { type = 'CompressedDataFormat', name = 'format', - description = 'The format to use when compressing the data.' + description = 'The format to use when compressing the data.', }, { type = 'Data', name = 'data', - description = 'A Data object containing the raw (un-compressed) data to compress.' + description = 'A Data object containing the raw (un-compressed) data to compress.', }, { type = 'number', name = 'level', + description = '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.', default = '-1', - description = '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.' - } + }, }, returns = { { - type = 'CompressedData or string', + type = 'value', name = 'compressedData', - description = 'CompressedData/string which contains the compressed version of data.' - } - } - } - } + description = 'CompressedData/string which contains the compressed version of data.', + }, + }, + }, + }, }, { name = 'decode', @@ -83,55 +84,55 @@ return { arguments = { { type = 'ContainerType', - name = 'containerType', - description = 'What type to return the decoded data as.' + name = 'container', + description = 'What type to return the decoded data as.', }, { type = 'EncodeFormat', name = 'format', - description = 'The format of the input data.' + description = 'The format of the input data.', }, { type = 'string', name = 'sourceString', - description = 'The raw (encoded) data to decode.' - } + description = 'The raw (encoded) data to decode.', + }, }, returns = { { - type = 'Variant', + type = 'value', name = 'decoded', - description = 'ByteData/string which contains the decoded version of source.' - } - } + description = 'ByteData/string which contains the decoded version of source.', + }, + }, }, { arguments = { { type = 'ContainerType', - name = 'containerType', - description = 'What type to return the decoded data as.' + name = 'container', + description = 'What type to return the decoded data as.', }, { type = 'EncodeFormat', name = 'format', - description = 'The format of the input data.' + description = 'The format of the input data.', }, { type = 'Data', name = 'sourceData', - description = 'The raw (encoded) data to decode.' - } + description = 'The raw (encoded) data to decode.', + }, }, returns = { { - type = 'Variant', + type = 'value', name = 'decoded', - description = 'ByteData/string which contains the decoded version of source.' - } - } - } - } + description = 'ByteData/string which contains the decoded version of source.', + }, + }, + }, + }, }, { name = 'decompress', @@ -142,75 +143,75 @@ return { { type = 'ContainerType', name = 'container', - description = 'What type to return the decompressed data as.' + description = 'What type to return the decompressed data as.', }, { type = 'CompressedData', name = 'compressedData', - description = 'The compressed data to decompress.' - } + description = 'The compressed data to decompress.', + }, }, returns = { { - type = 'string', - name = 'rawstring', - description = 'A string containing the raw decompressed data.' - } - } + type = 'value', + name = 'decompressedData', + description = 'Data/string containing the raw decompressed data.', + }, + }, }, { arguments = { { type = 'ContainerType', name = 'container', - description = 'What type to return the decompressed data as.' + description = 'What type to return the decompressed data as.', }, { type = 'CompressedDataFormat', name = 'format', - description = 'The format that was used to compress the given string.' + description = 'The format that was used to compress the given string.', }, { type = 'string', - name = 'compressedstring', - description = 'A string containing data previously compressed with love.data.compress.' - } + name = 'compressedString', + description = 'A string containing data previously compressed with love.data.compress.', + }, }, returns = { { - type = 'string', - name = 'rawstring', - description = 'A string containing the raw decompressed data.' - } - } + type = 'value', + name = 'decompressedData', + description = 'Data/string containing the raw decompressed data.', + }, + }, }, { arguments = { { type = 'ContainerType', name = 'container', - description = 'What type to return the decompressed data as.' + description = 'What type to return the decompressed data as.', }, { type = 'CompressedDataFormat', name = 'format', - description = 'The format that was used to compress the given data.' + description = 'The format that was used to compress the given data.', }, { type = 'Data', name = 'data', - description = 'A Data object containing data previously compressed with love.data.compress.' - } + description = 'A Data object containing data previously compressed with love.data.compress.', + }, }, returns = { { - type = 'string', - name = 'rawstring', - description = 'A string containing the raw decompressed data.' - } - } - } - } + type = 'value', + name = 'decompressedData', + description = 'Data/string containing the raw decompressed data.', + }, + }, + }, + }, }, { name = 'encode', @@ -220,67 +221,90 @@ return { arguments = { { type = 'ContainerType', - name = 'containerType', - description = 'What type to return the encoded data as.' + name = 'container', + description = 'What type to return the encoded data as.', }, { type = 'EncodeFormat', name = 'format', - description = 'The format of the output data.' + description = 'The format of the output data.', }, { type = 'string', name = 'sourceString', - description = 'The raw data to encode.' + description = 'The raw data to encode.', }, { type = 'number', - name = 'lineLength', + name = 'linelength', + description = 'The maximum line length of the output. Only supported for base64, ignored if 0.', default = '0', - description = 'The maximum line length of the output. Only supported for base64, ignored if 0.' - } + }, }, returns = { { - type = 'Variant', + type = 'value', name = 'encoded', - description = 'ByteData/string which contains the encoded version of source.' - } - } + description = 'ByteData/string which contains the encoded version of source.', + }, + }, }, { arguments = { { type = 'ContainerType', - name = 'containerType', - description = 'What type to return the encoded data as.' + name = 'container', + description = 'What type to return the encoded data as.', }, { type = 'EncodeFormat', name = 'format', - description = 'The format of the output data.' + description = 'The format of the output data.', }, { type = 'Data', name = 'sourceData', - description = 'The raw data to encode.' + description = 'The raw data to encode.', }, { type = 'number', - name = 'lineLength', + name = 'linelength', + description = 'The maximum line length of the output. Only supported for base64, ignored if 0.', default = '0', - description = 'The maximum line length of the output. Only supported for base64, ignored if 0.' - } + }, }, returns = { { - type = 'Variant', + type = 'value', name = 'encoded', - description = 'ByteData/string which contains the encoded version of source.' - } - } - } - } + description = 'ByteData/string which contains the encoded version of source.', + }, + }, + }, + }, + }, + { + name = 'getPackedSize', + description = 'Gets the size in bytes that a given format used with love.data.pack will use.\n\nThis function behaves the same as Lua 5.3\'s string.packsize.', + variants = { + { + description = 'The format string cannot have the variable-length options \'s\' or \'z\'.', + arguments = { + { + type = 'string', + name = 'format', + description = 'A string determining how the values are packed. Follows the rules of Lua 5.3\'s string.pack format strings.', + }, + }, + returns = { + { + type = 'number', + name = 'size', + description = 'The size in bytes that the packed data will use.', + }, + }, + }, + }, }, { name = 'hash', @@ -291,49 +315,271 @@ return { { type = 'HashFunction', name = 'hashFunction', - description = 'Hash algorithm to use.' + description = 'Hash algorithm to use.', }, { type = 'string', name = 'string', - description = 'String to hash.' - } + description = 'String to hash.', + }, }, returns = { { type = 'string', name = 'rawdigest', - description = 'Raw message digest string.' - } - } + description = 'Raw message digest string.', + }, + }, }, { + description = 'To return the hex string representation of the hash, use love.data.encode\n\nhexDigestString = love.data.encode(\'string\', \'hex\', love.data.hash(algo, data))', arguments = { { type = 'HashFunction', name = 'hashFunction', - description = 'Hash algorithm to use.' + description = 'Hash algorithm to use.', }, { type = 'Data', name = 'data', - description = 'Data to hash.' - } + description = 'Data to hash.', + }, }, returns = { { type = 'string', name = 'rawdigest', - description = 'Raw message digest string.' - } - } - } - } - } + description = 'Raw message digest string.', + }, + }, + }, + }, + }, + { + name = 'newByteData', + description = 'Creates a new Data object containing arbitrary bytes.\n\nData:getPointer along with LuaJIT\'s FFI can be used to manipulate the contents of the ByteData object after it has been created.', + variants = { + { + description = 'Creates a new ByteData by copying the contents of the specified string.', + arguments = { + { + type = 'string', + name = 'datastring', + description = 'The byte string to copy.', + }, + }, + returns = { + { + type = 'ByteData', + name = 'bytedata', + description = 'The new Data object.', + }, + }, + }, + { + description = 'Creates a new ByteData by copying from an existing Data object.', + arguments = { + { + type = 'Data', + name = 'Data', + description = 'The existing Data object to copy.', + }, + { + type = 'number', + name = 'offset', + description = 'The offset of the subsection to copy, in bytes.', + default = '0', + }, + { + type = 'number', + name = 'size', + description = 'The size in bytes of the new Data object.', + default = 'data:getSize()', + }, + }, + returns = { + { + type = 'ByteData', + name = 'bytedata', + description = 'The new Data object.', + }, + }, + }, + { + description = 'Creates a new empty ByteData with the specific size.', + arguments = { + { + type = 'number', + name = 'size', + description = 'The size in bytes of the new Data object.', + }, + }, + returns = { + { + type = 'ByteData', + name = 'bytedata', + description = 'The new Data object.', + }, + }, + }, + }, + }, + { + name = 'newDataView', + description = 'Creates a new Data referencing a subsection of an existing Data object.', + variants = { + { + description = 'Data:getString and Data:getPointer will return the original Data object\'s contents, with the view\'s offset and size applied.', + arguments = { + { + type = 'Data', + name = 'data', + description = 'The Data object to reference.', + }, + { + type = 'number', + name = 'offset', + description = 'The offset of the subsection to reference, in bytes.', + }, + { + type = 'number', + name = 'size', + description = 'The size in bytes of the subsection to reference.', + }, + }, + returns = { + { + type = 'Data', + name = 'view', + description = 'The new Data view.', + }, + }, + }, + }, + }, + { + name = 'pack', + description = 'Packs (serializes) simple Lua values.\n\nThis function behaves the same as Lua 5.3\'s string.pack.', + variants = { + { + description = 'Packing integers with values greater than 2^52 is not supported, as Lua 5.1 cannot represent those values in its number type. ', + arguments = { + { + type = 'ContainerType', + name = 'container', + description = 'What type to return the encoded data as.', + }, + { + type = 'string', + name = 'format', + description = 'A string determining how the values are packed. Follows the rules of Lua 5.3\'s string.pack format strings.', + }, + { + type = 'value', + name = 'v1', + description = 'The first value (number, boolean, or string) to serialize.', + }, + { + type = 'value', + name = '...', + description = 'Additional values to serialize.', + }, + }, + returns = { + { + type = 'value', + name = 'data', + description = 'Data/string which contains the serialized data.', + }, + }, + }, + }, + }, + { + name = 'unpack', + description = 'Unpacks (deserializes) a byte-string or Data into simple Lua values.\n\nThis function behaves the same as Lua 5.3\'s string.unpack.', + variants = { + { + arguments = { + { + type = 'string', + name = 'format', + description = 'A string determining how the values were packed. Follows the rules of Lua 5.3\'s string.pack format strings.', + }, + { + type = 'string', + name = 'datastring', + description = 'A string containing the packed (serialized) data.', + }, + { + type = 'number', + name = 'pos', + description = 'Where to start reading in the string. Negative values can be used to read relative from the end of the string.', + default = '1', + }, + }, + returns = { + { + type = 'value', + name = 'v1', + description = 'The first value (number, boolean, or string) that was unpacked.', + }, + { + type = 'value', + name = '...', + description = 'Additional unpacked values.', + }, + { + type = 'number', + name = 'index', + description = 'The index of the first unread byte in the data string.', + }, + }, + }, + { + description = 'Unpacking integers with values greater than 2^52 is not supported, as Lua 5.1 cannot represent those values in its number type. ', + arguments = { + { + type = 'string', + name = 'format', + description = 'A string determining how the values were packed. Follows the rules of Lua 5.3\'s string.pack format strings.', + }, + { + type = 'Data', + name = 'data', + description = 'A Data object containing the packed (serialized) data.', + }, + { + type = 'number', + name = 'pos', + description = '1-based index indicating where to start reading in the Data. Negative values can be used to read relative from the end of the Data object.', + default = '1', + }, + }, + returns = { + { + type = 'value', + name = 'v1', + description = 'The first value (number, boolean, or string) that was unpacked.', + }, + { + type = 'value', + name = '...', + description = 'Additional unpacked values.', + }, + { + type = 'number', + name = 'index', + description = 'The 1-based index of the first unread byte in the Data.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.ContainerType'), require(path .. 'enums.EncodeFormat'), - require(path .. 'enums.HashFunction') - } -} + require(path .. 'enums.HashFunction'), + }, +} \ No newline at end of file diff --git a/modules/data/enums/ContainerType.lua b/modules/data/enums/ContainerType.lua index 2a17491f..f0e7aee7 100644 --- a/modules/data/enums/ContainerType.lua +++ b/modules/data/enums/ContainerType.lua @@ -1,14 +1,14 @@ return { name = 'ContainerType', - description = 'Return type of various encoding and decoding functions.', + description = 'Return type of various data-returning functions.', constants = { { name = 'data', - description = 'Return type is Data.' + description = 'Return type is ByteData.', }, { name = 'string', - description = 'Return type is string.' - } - } -} + description = 'Return type is string.', + }, + }, +} \ No newline at end of file diff --git a/modules/data/enums/EncodeFormat.lua b/modules/data/enums/EncodeFormat.lua index 2ec32477..a2f8d232 100644 --- a/modules/data/enums/EncodeFormat.lua +++ b/modules/data/enums/EncodeFormat.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'base64', - description = 'Encode/decode data as base64 binary-to-text encoding.' + description = 'Encode/decode data as base64 binary-to-text encoding.', }, { name = 'hex', - description = 'Encode/decode data as hexadecimal string.' - } - } -} + description = 'Encode/decode data as hexadecimal string.', + }, + }, +} \ No newline at end of file diff --git a/modules/data/enums/HashFunction.lua b/modules/data/enums/HashFunction.lua index 3e686f07..0527beda 100644 --- a/modules/data/enums/HashFunction.lua +++ b/modules/data/enums/HashFunction.lua @@ -4,27 +4,27 @@ return { constants = { { name = 'md5', - description = 'MD5 hash algorithm (16 bytes).' + description = 'MD5 hash algorithm (16 bytes).', }, { name = 'sha1', - description = 'SHA1 hash algorithm (20 bytes).' + description = 'SHA1 hash algorithm (20 bytes).', }, { name = 'sha224', - description = 'SHA2 hash algorithm with message digest size of 224 bits (28 bytes).' + description = 'SHA2 hash algorithm with message digest size of 224 bits (28 bytes).', }, { name = 'sha256', - description = 'SHA2 hash algorithm with message digest size of 256 bits (32 bytes).' + description = 'SHA2 hash algorithm with message digest size of 256 bits (32 bytes).', }, { name = 'sha384', - description = 'SHA2 hash algorithm with message digest size of 384 bits (48 bytes).' + description = 'SHA2 hash algorithm with message digest size of 384 bits (48 bytes).', }, { name = 'sha512', - description = 'SHA2 hash algorithm with message digest size of 512 bits (64 bytes).' - } - } -} + description = 'SHA2 hash algorithm with message digest size of 512 bits (64 bytes).', + }, + }, +} \ No newline at end of file diff --git a/modules/event/Event.lua b/modules/event/Event.lua index 86703b47..46e2571f 100644 --- a/modules/event/Event.lua +++ b/modules/event/Event.lua @@ -1,16 +1,18 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { name = 'event', description = 'Manages events, like keypresses.', + types = { + }, functions = { { name = 'clear', description = 'Clears the event queue.', variants = { - {} - } + { + }, + }, }, { name = 'poll', @@ -21,121 +23,155 @@ return { { type = 'function', name = 'i', - description = 'Iterator function usable in a for loop.' - } - } - } - } + description = 'Iterator function usable in a for loop.', + }, + }, + }, + }, }, { name = 'pump', - description = '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). love.event.pump can only be called from the main thread, but afterwards, the rest of love.event can be used from any other thread.', + description = 'Pump events into the event queue.\n\nThis is a low-level function, and is usually not called by the user, but by love.run.\n\nNote that this does need to be called for any OS to think you\'re still running,\n\nand if you want to handle OS-generated events at all (think callbacks).', variants = { - {} - } + { + }, + }, }, { name = 'push', - description = 'Adds an event to the event queue.', + description = 'Adds an event to the event queue.\n\nFrom 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.', variants = { { arguments = { { type = 'Event', - name = 'e', - description = 'The name of the event.' + name = 'n', + description = 'The name of the event.', }, { type = 'Variant', name = 'a', + description = 'First event argument.', default = 'nil', - description = 'First event argument.' }, { type = 'Variant', name = 'b', + description = 'Second event argument.', default = 'nil', - description = 'Second event argument.' }, { type = 'Variant', name = 'c', + description = 'Third event argument.', default = 'nil', - description = 'Third event argument.' }, { type = 'Variant', name = 'd', + description = 'Fourth event argument.', + default = 'nil', + }, + { + type = 'Variant', + name = 'e', + description = 'Fifth event argument.', + default = 'nil', + }, + { + type = 'Variant', + name = 'f', + description = 'Sixth event argument.', + default = 'nil', + }, + { + type = 'Variant', + name = '...', + description = 'Further event arguments may follow.', default = 'nil', - description = 'Fourth event argument.' - } - } - } - } + }, + }, + }, + }, }, { name = 'quit', description = 'Adds the quit event to the queue.\n\nThe 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.', variants = { - {}, { arguments = { { type = 'number', name = 'exitstatus', + description = 'The program exit status to use when closing the application.', default = '0', - description = 'The program exit status to use when closing the application.' - } - } + }, + }, }, { + description = 'Restarts the game without relaunching the executable. This cleanly shuts down the main Lua state instance and creates a brand new one.', arguments = { { type = 'string', - name = '"restart"', - description = 'Restarts the game without relaunching the executable. This cleanly shuts down the main Lua state instance and creates a brand new one.' - } - } - } - } + name = '\'restart\'', + description = 'Tells the default love.run to exit and restart the game without relaunching the executable.', + }, + }, + }, + }, }, { name = 'wait', - description = 'Like love.event.poll but blocks until there is an event in the queue.', + description = 'Like love.event.poll(), but blocks until there is an event in the queue.', variants = { { returns = { { type = 'Event', - name = 'e', - description = 'The type of event.' + name = 'n', + description = 'The name of event.', }, { type = 'Variant', name = 'a', - description = 'First event argument.' + description = 'First event argument.', }, { type = 'Variant', name = 'b', - description = 'Second event argument.' + description = 'Second event argument.', }, { type = 'Variant', name = 'c', - description = 'Third event argument.' + description = 'Third event argument.', }, { type = 'Variant', name = 'd', - description = 'Fourth event argument.' - } - } - } - } - } + description = 'Fourth event argument.', + }, + { + type = 'Variant', + name = 'e', + description = 'Fifth event argument.', + }, + { + type = 'Variant', + name = 'f', + description = 'Sixth event argument.', + }, + { + type = 'Variant', + name = '...', + description = 'Further event arguments may follow.', + }, + }, + }, + }, + }, }, enums = { - require(path .. 'enums.Event') - } -} + require(path .. 'enums.Event'), + }, +} \ No newline at end of file diff --git a/modules/event/enums/Event.lua b/modules/event/enums/Event.lua index ea4ab44b..111d182c 100644 --- a/modules/event/enums/Event.lua +++ b/modules/event/enums/Event.lua @@ -1,62 +1,154 @@ return { name = 'Event', - description = 'Arguments to love.event.push() and the like.', + description = 'Arguments to love.event.push() and the like.\n\nSince 0.8.0, event names are no longer abbreviated.', constants = { { name = 'focus', - description = 'Window focus gained or lost' - }, - { - name = 'joystickaxis', - description = 'Joystick axis motion' - }, - { - name = 'joystickhat', - description = 'Joystick hat pressed' + description = 'Window focus gained or lost', }, { name = 'joystickpressed', - description = 'Joystick pressed' + description = 'Joystick pressed', }, { name = 'joystickreleased', - description = 'Joystick released' + description = 'Joystick released', }, { name = 'keypressed', - description = 'Key pressed' + description = 'Key pressed', }, { name = 'keyreleased', - description = 'Key released' - }, - { - name = 'mousefocus', - description = 'Window mouse focus gained or lost' + description = 'Key released', }, { name = 'mousepressed', - description = 'Mouse pressed' + description = 'Mouse pressed', }, { name = 'mousereleased', - description = 'Mouse released' + description = 'Mouse released', + }, + { + name = 'quit', + description = 'Quit', }, { name = 'resize', - description = 'Window size changed by the user' + description = 'Window size changed by the user', + }, + { + name = 'visible', + description = 'Window is minimized or un-minimized by the user', + }, + { + name = 'mousefocus', + description = 'Window mouse focus gained or lost', }, { name = 'threaderror', - description = 'A Lua error has occurred in a thread.' + description = 'A Lua error has occurred in a thread', }, { - name = 'quit', - description = 'Quit' + name = 'joystickadded', + description = 'Joystick connected', }, { - name = 'visible', - description = 'Window is minimized or un-minimized by the user' + name = 'joystickremoved', + description = 'Joystick disconnected', + }, + { + name = 'joystickaxis', + description = 'Joystick axis motion', + }, + { + name = 'joystickhat', + description = 'Joystick hat pressed', + }, + { + name = 'gamepadpressed', + description = 'Joystick\'s virtual gamepad button pressed', + }, + { + name = 'gamepadreleased', + description = 'Joystick\'s virtual gamepad button released', + }, + { + name = 'gamepadaxis', + description = 'Joystick\'s virtual gamepad axis moved', + }, + { + name = 'textinput', + description = 'User entered text', + }, + { + name = 'mousemoved', + description = 'Mouse position changed', + }, + { + name = 'lowmemory', + description = 'Running out of memory on mobile devices system', + }, + { + name = 'textedited', + description = 'Candidate text for an IME changed', + }, + { + name = 'wheelmoved', + description = 'Mouse wheel moved', + }, + { + name = 'touchpressed', + description = 'Touch screen touched', + }, + { + name = 'touchreleased', + description = 'Touch screen stop touching', + }, + { + name = 'touchmoved', + description = 'Touch press moved inside touch screen', + }, + { + name = 'directorydropped', + description = 'Directory is dragged and dropped onto the window', + }, + { + name = 'filedropped', + description = 'File is dragged and dropped onto the window.', + }, + { + name = 'jp', + description = 'Joystick pressed', + }, + { + name = 'jr', + description = 'Joystick released', + }, + { + name = 'kp', + description = 'Key pressed', + }, + { + name = 'kr', + description = 'Key released', + }, + { + name = 'mp', + description = 'Mouse pressed', + }, + { + name = 'mr', + description = 'Mouse released', + }, + { + name = 'q', + description = 'Quit', + }, + { + name = 'f', + description = 'Window focus gained or lost', }, - } -} + }, +} \ No newline at end of file diff --git a/modules/filesystem/Filesystem.lua b/modules/filesystem/Filesystem.lua index af7babae..710664c7 100644 --- a/modules/filesystem/Filesystem.lua +++ b/modules/filesystem/Filesystem.lua @@ -1,4 +1,3 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { @@ -6,7 +5,7 @@ return { description = 'Provides an interface to the user\'s filesystem.', types = { require(path .. 'types.File'), - require(path .. 'types.FileData') + require(path .. 'types.FileData'), }, functions = { { @@ -18,34 +17,66 @@ return { { type = 'string', name = 'name', - description = 'The name (and path) of the file.' + description = 'The name (and path) of the file.', }, { type = 'string', name = 'data', - description = 'The data that should be written to the file' + description = 'The string data to append to the file.', }, { type = 'number', name = 'size', + description = 'How many bytes to write.', default = 'all', - description = 'How many bytes to write.' - } + }, + }, + returns = { + { + type = 'boolean', + name = 'success', + description = 'True if the operation was successful, or nil if there was an error.', + }, + { + type = 'string', + name = 'errormsg', + description = 'The error message on failure.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'name', + description = 'The name (and path) of the file.', + }, + { + type = 'Data', + name = 'data', + description = 'The Data object to append to the file.', + }, + { + type = 'number', + name = 'size', + description = 'How many bytes to write.', + default = 'all', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the operation was successful, or nil if there was an error.' + description = 'True if the operation was successful, or nil if there was an error.', }, { type = 'string', name = 'errormsg', - description = 'The error message on failure.' - } - } - } - } + description = 'The error message on failure.', + }, + }, + }, + }, }, { name = 'areSymlinksEnabled', @@ -56,33 +87,33 @@ return { { type = 'boolean', name = 'enable', - description = 'Whether love.filesystem follows symbolic links.' - } - } - } - } + description = 'Whether love.filesystem follows symbolic links.', + }, + }, + }, + }, }, { name = 'createDirectory', - description = 'Creates a directory.', + description = 'Recursively creates a directory.\n\nWhen called with \'a/b\' it creates both \'a\' and \'a/b\', if they don\'t exist already.', variants = { { arguments = { { type = 'string', name = 'name', - description = 'The directory to create.' - } + description = 'The directory to create.', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the directory was created, false if not.' - } - } - } - } + description = 'True if the directory was created, false if not.', + }, + }, + }, + }, }, { name = 'getAppdataDirectory', @@ -93,26 +124,27 @@ return { { type = 'string', name = 'path', - description = 'The path of the application data directory.' - } - } - } - } + description = 'The path of the application data directory', + }, + }, + }, + }, }, { name = 'getCRequirePath', - description = 'Gets the filesystem paths that will be searched for c libraries when require is called.\n\nThe 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.\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', + description = 'Gets the filesystem paths that will be searched for c libraries when require is called.\n\nThe 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.\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', variants = { { + description = 'The default paths string is \'??\', which makes require(\'cool\') try to load cool.dll, or cool.so depending on the platform.', returns = { { type = 'string', name = 'paths', - description = 'The paths that the require function will check for c libraries in love\'s filesystem.' - } - } - } - } + description = 'The paths that the \'\'require\'\' function will check for c libraries in love\'s filesystem.', + }, + }, + }, + }, }, { name = 'getDirectoryItems', @@ -123,33 +155,54 @@ return { { type = 'string', name = 'dir', - description = 'The directory.' - } + description = 'The directory.', + }, + }, + returns = { + { + type = 'table', + name = 'files', + description = 'A sequence with the names of all files and subdirectories as strings.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'dir', + description = 'The directory.', + }, + { + type = 'function', + name = 'callback', + description = 'A function which is called for each file and folder in the directory. The filename is passed to the function as an argument.', + }, }, returns = { { type = 'table', - name = 'items', - description = 'A sequence with the names of all files and subdirectories as strings.' - } - } - } - } + name = 'files', + description = 'A sequence with the names of all files and subdirectories as strings.', + }, + }, + }, + }, }, { name = 'getIdentity', - description = '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 location.', + description = 'Gets the write directory name for your game. \n\nNote that this only returns the name of the folder to store your files in, not the full path.', variants = { { - arguments = { + returns = { { type = 'string', name = 'name', - description = 'The identity that is used as write directory.' - } - } - } - } + description = 'The identity that is used as write directory.', + }, + }, + }, + }, }, { name = 'getInfo', @@ -160,8 +213,14 @@ return { { type = 'string', name = 'path', - description = 'The file or directory path to check.' - } + description = 'The file or directory path to check.', + }, + { + type = 'FileType', + name = 'filtertype', + description = 'If supplied, this parameter causes getInfo to only return the info table if the item at the given path matches the specified file type.', + default = 'nil', + }, }, returns = { { @@ -172,21 +231,21 @@ return { { type = 'FileType', name = 'type', - description = 'The type of the object at the path (file, directory, symlink, etc.).' + description = 'The type of the object at the path (file, directory, symlink, etc.)', }, { type = 'number', name = 'size', - description = 'The size in bytes of the file, or nil if it can\'t be determined.' + description = 'The size in bytes of the file, or nil if it can\'t be determined.', }, { type = 'number', name = 'modtime', - description = 'The file\'s last modification time in seconds since the unix epoch, or nil if it can\'t be determined.' - } - } - } - } + description = 'The file\'s last modification time in seconds since the unix epoch, or nil if it can\'t be determined.', + }, + }, + }, + }, }, { description = 'This variant accepts an existing table to fill in, instead of creating a new one.', @@ -194,92 +253,138 @@ return { { type = 'string', name = 'path', - description = 'The file or directory path to check.' + description = 'The file or directory path to check.', }, { type = 'table', name = 'info', - description = 'A table which will be filled in with info about the specified path.' - } + description = 'A table which will be filled in with info about the specified path.', + }, }, returns = { { type = 'table', name = 'info', - description = 'A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields:', + description = 'The table given as an argument, or nil if nothing exists at the path. The table will be filled in with the following fields:', + table = { + { + type = 'FileType', + name = 'type', + description = 'The type of the object at the path (file, directory, symlink, etc.)', + }, + { + type = 'number', + name = 'size', + description = 'The size in bytes of the file, or nil if it can\'t be determined.', + }, + { + type = 'number', + name = 'modtime', + description = 'The file\'s last modification time in seconds since the unix epoch, or nil if it can\'t be determined.', + }, + }, + }, + }, + }, + { + description = 'This variant only returns info if the item at the given path is the same file type as specified in the filtertype argument, and accepts an existing table to fill in, instead of creating a new one.', + arguments = { + { + type = 'string', + name = 'path', + description = 'The file or directory path to check.', + }, + { + type = 'FileType', + name = 'filtertype', + description = 'Causes getInfo to only return the info table if the item at the given path matches the specified file type.', + }, + { + type = 'table', + name = 'info', + description = 'A table which will be filled in with info about the specified path.', + }, + }, + returns = { + { + type = 'table', + name = 'info', + description = 'The table given as an argument, or nil if nothing exists at the path. The table will be filled in with the following fields:', table = { { type = 'FileType', name = 'type', - description = 'The type of the object at the path (file, directory, symlink, etc.).' + description = 'The type of the object at the path (file, directory, symlink, etc.)', }, { type = 'number', name = 'size', - description = 'The size in bytes of the file, or nil if it can\'t be determined.' + description = 'The size in bytes of the file, or nil if it can\'t be determined.', }, { type = 'number', name = 'modtime', - description = 'The file\'s last modification time in seconds since the unix epoch, or nil if it can\'t be determined.' - } - } - } - } - } - } + description = 'The file\'s last modification time in seconds since the unix epoch, or nil if it can\'t be determined.', + }, + }, + }, + }, + }, + }, }, { name = 'getRealDirectory', description = 'Gets the platform-specific absolute path of the directory containing a filepath.\n\nThis can be used to determine whether a file is inside the save directory or the game\'s source .love.', variants = { { + description = 'This function returns the directory containing the given \'\'file path\'\', rather than file. For example, if the file screenshot1.png exists in a directory called screenshots in the game\'s save directory, love.filesystem.getRealDirectory(\'screenshots/screenshot1.png\') will return the same value as love.filesystem.getSaveDirectory.', arguments = { { type = 'string', name = 'filepath', - description = 'The filepath to get the directory of.' - } + description = 'The filepath to get the directory of.', + }, }, returns = { { type = 'string', name = 'realdir', - description = 'The platform-specific full path of the directory containing the filepath.' - } - } - } - } + description = 'The platform-specific full path of the directory containing the filepath.', + }, + }, + }, + }, }, { name = 'getRequirePath', - description = 'Gets the filesystem paths that will be searched when require is called.\n\nThe 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.)\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', + description = 'Gets the filesystem paths that will be searched when require is called.\n\nThe 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.)\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', variants = { { + description = 'The default paths string is \'?.lua;?/init.lua\', which makes require(\'cool\') try to load cool.lua and then try cool/init.lua if cool.lua doesn\'t exist.', returns = { { type = 'string', name = 'paths', - description = 'The paths that the require function will check in love\'s filesystem.' - } - } - } - } + description = 'The paths that the \'\'require\'\' function will check in love\'s filesystem.', + }, + }, + }, + }, }, { name = 'getSaveDirectory', - description = '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.', + description = 'Gets the full path to the designated save directory.\n\nThis can be useful if you want to use the standard io library (or something else) to\n\nread or write in the save directory.', variants = { { returns = { { type = 'string', - name = 'path', - description = 'The absolute path to the save directory.' - } - } - } - } + name = 'dir', + description = 'The absolute path to the save directory.', + }, + }, + }, + }, }, { name = 'getSource', @@ -290,41 +395,41 @@ return { { type = 'string', name = 'path', - description = 'The full platform-dependent path of the .love file or directory.' + description = 'The full platform-dependent path of the .love file or directory.', }, - } - } - } + }, + }, + }, }, { name = 'getSourceBaseDirectory', - description = '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.\n\nIf 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 readable by love.filesystem.', + description = '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.\n\nIf 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.', variants = { { returns = { { type = 'string', name = 'path', - description = 'The full platform-dependent path of the directory containing the .love file.' + description = 'The full platform-dependent path of the directory containing the .love file.', }, - } - } - } + }, + }, + }, }, { name = 'getUserDirectory', - description = 'Returns the path of the user\'s directory.', + description = 'Returns the path of the user\'s directory', variants = { { returns = { { type = 'string', name = 'path', - description = 'The path of the user\'s directory.' - } - } - } - } + description = 'The path of the user\'s directory', + }, + }, + }, + }, }, { name = 'getWorkingDirectory', @@ -334,12 +439,12 @@ return { returns = { { type = 'string', - name = 'path', - description = 'The current working directory.' - } - } - } - } + name = 'cwd', + description = 'The current working directory.', + }, + }, + }, + }, }, { name = 'init', @@ -350,26 +455,26 @@ return { { type = 'string', name = 'appname', - description = 'The name of the application binary, typically love.' - } - } - } - } + description = 'The name of the application binary, typically love.', + }, + }, + }, + }, }, { name = 'isFused', - description = 'Gets whether the game is in fused mode or not.\n\nIf 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.\n\nA 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.', + description = 'Gets whether the game is in fused mode or not.\n\nIf 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.\n\nA 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.', variants = { { returns = { { type = 'boolean', name = 'fused', - description = 'True if the game is in fused mode, false otherwise.' - } - } - } - } + description = 'True if the game is in fused mode, false otherwise.', + }, + }, + }, + }, }, { name = 'lines', @@ -380,18 +485,18 @@ return { { type = 'string', name = 'name', - description = 'The name (and path) of the file.' - } + description = 'The name (and path) of the file', + }, }, returns = { { type = 'function', name = 'iterator', - description = 'A function that iterates over all the lines in the file.' - } - } - } - } + description = 'A function that iterates over all the lines in the file', + }, + }, + }, + }, }, { name = 'load', @@ -402,111 +507,167 @@ return { { type = 'string', name = 'name', - description = 'The name (and path) of the file.' + description = 'The name (and path) of the file.', }, - { - type = 'string', - name = 'errormsg', - default = 'nil', - description = 'The error message if file could not be opened.' - } }, returns = { { type = 'function', name = 'chunk', - description = 'The loaded chunk.' - } - } - } - } + description = 'The loaded chunk.', + }, + { + type = 'string', + name = 'errormsg', + description = 'The error message if file could not be opened.', + }, + }, + }, + }, }, { name = 'mount', - description = 'Mounts a zip file or folder in the game\'s save directory for reading.', + description = 'Mounts a zip file or folder in the game\'s save directory for reading.\n\nIt is also possible to mount love.filesystem.getSourceBaseDirectory if the game is in fused mode.', variants = { { arguments = { { type = 'string', name = 'archive', - description = 'The folder or zip file in the game\'s save directory to mount.' + description = 'The folder or zip file in the game\'s save directory to mount.', }, { type = 'string', name = 'mountpoint', - description = 'The new path the archive will be mounted to.' - } + description = 'The new path the archive will be mounted to.', + }, + { + type = 'boolean', + name = 'appendToPath', + description = '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.', + default = 'false', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the archive was successfully mounted, false otherwise.' - } - } + description = 'True if the archive was successfully mounted, false otherwise.', + }, + }, }, { + description = 'Mounts the contents of the given FileData in memory. The FileData\'s data must contain a zipped directory structure.', arguments = { { - type = 'string', - name = 'archive', - description = 'The folder or zip file in the game\'s save directory to mount.' + type = 'FileData', + name = 'filedata', + description = 'The FileData object in memory to mount.', }, { type = 'string', name = 'mountpoint', - description = 'The new path the archive will be mounted to.' + description = 'The new path the archive will be mounted to.', + }, + { + type = 'boolean', + name = 'appendToPath', + description = '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.', + default = 'false', + }, + }, + returns = { + { + type = 'boolean', + name = 'success', + description = 'True if the archive was successfully mounted, false otherwise.', + }, + }, + }, + { + description = 'Mounts the contents of the given Data object in memory. The data must contain a zipped directory structure.', + arguments = { + { + type = 'Data', + name = 'data', + description = 'The Data object in memory to mount.', + }, + { + type = 'string', + name = 'archivename', + description = 'The name to associate the mounted data with, for use with love.filesystem.unmount. Must be unique compared to other mounted data.', }, { type = 'string', + name = 'mountpoint', + description = 'The new path the archive will be mounted to.', + }, + { + type = 'boolean', name = 'appendToPath', + description = '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.', default = 'false', - description = '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.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the archive was successfully mounted, false otherwise.' - } - } - } - } + description = 'True if the archive was successfully mounted, false otherwise.', + }, + }, + }, + }, }, { name = 'newFile', - description = 'Creates a new File object. It needs to be opened before it can be accessed.', + description = 'Creates a new File object. \n\nIt needs to be opened before it can be accessed.', variants = { { + description = 'Please note that this function will not return any error message (e.g. if you use an invalid filename) because it just creates the File Object. You can still check if the file is valid by using File:open which returns a boolean and an error message if something goes wrong while opening the file.', + arguments = { + { + type = 'string', + name = 'filename', + description = 'The filename of the file.', + }, + }, + returns = { + { + type = 'File', + name = 'file', + description = 'The new File object.', + }, + }, + }, + { + description = 'Creates a File object and opens it for reading, writing, or appending.', arguments = { { type = 'string', name = 'filename', - description = 'The filename of the file to read.' + description = 'The filename of the file.', }, { type = 'FileMode', name = 'mode', - default = '"c"', - description = 'The mode to open the file in.' - } + description = 'The mode to open the file in.', + }, }, returns = { { type = 'File', name = 'file', - description = 'The new File object, or nil if an error occurred.' + description = 'The new File object, or nil if an error occurred.', }, { type = 'string', name = 'errorstr', - description = 'The error string if an error occurred.' - } - } - } - } + description = 'The error string if an error occurred.', + }, + }, + }, + }, }, { name = 'newFileData', @@ -517,21 +678,21 @@ return { { type = 'string', name = 'contents', - description = 'The contents of the file.' + description = 'The contents of the file.', }, { type = 'string', name = 'name', - description = 'The name of the file.' - } + description = 'The name of the file.', + }, }, returns = { { type = 'FileData', name = 'data', - description = 'Your new FileData.' - } - } + description = 'Your new FileData.', + }, + }, }, { description = 'Creates a new FileData from a file on the storage device.', @@ -539,23 +700,23 @@ return { { type = 'string', name = 'filepath', - description = 'Path to the file.' - } + description = 'Path to the file.', + }, }, returns = { { type = 'FileData', name = 'data', - description = 'The new FileData, or nil if an error occurred.' + description = 'The new FileData, or nil if an error occurred.', }, { type = 'string', name = 'err', - description = 'The error string, if an error occurred.' - } - } - } - } + description = 'The error string, if an error occurred.', + }, + }, + }, + }, }, { name = 'read', @@ -566,102 +727,161 @@ return { { type = 'string', name = 'name', - description = 'The name (and path) of the file.' + description = 'The name (and path) of the file.', }, { type = 'number', - name = 'bytes', + name = 'size', + description = 'How many bytes to read.', default = 'all', - description = 'How many bytes to read.' - } + }, }, returns = { { type = 'string', name = 'contents', - description = 'The file contents.' + description = 'The file contents.', + }, + { + type = 'number', + name = 'size', + description = 'How many bytes have been read.', + }, + { + type = 'nil', + name = 'contents', + description = 'returns nil as content.', + }, + { + type = 'string', + name = 'error', + description = 'returns an error message.', + }, + }, + }, + { + description = 'Reads the contents of a file into either a string or a FileData object.', + arguments = { + { + type = 'ContainerType', + name = 'container', + description = 'What type to return the file\'s contents as.', + }, + { + type = 'string', + name = 'name', + description = 'The name (and path) of the file', + }, + { + type = 'number', + name = 'size', + description = 'How many bytes to read', + default = 'all', + }, + }, + returns = { + { + type = 'value', + name = 'contents', + description = 'FileData or string containing the file contents.', }, { type = 'number', name = 'size', - description = 'How many bytes have been read.' - } - } - } - } + description = 'How many bytes have been read.', + }, + { + type = 'nil', + name = 'contents', + description = 'returns nil as content.', + }, + { + type = 'string', + name = 'error', + description = 'returns an error message.', + }, + }, + }, + }, }, { name = 'remove', - description = 'Removes a file or directory.', + description = 'Removes a file or empty directory.', variants = { { + description = 'The directory must be empty before removal or else it will fail. Simply remove all files and folders in the directory beforehand.\n\nIf the file exists in the .love but not in the save directory, it returns false as well.\n\nAn opened File prevents removal of the underlying file. Simply close the File to remove it.', arguments = { { type = 'string', name = 'name', - description = 'The file or directory to remove.' - } + description = 'The file or directory to remove.', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the file/directory was removed, false otherwise.' - } - } - } - } + description = 'True if the file/directory was removed, false otherwise.', + }, + }, + }, + }, }, { name = 'setCRequirePath', - description = 'Sets the filesystem paths that will be searched for c libraries when require is called.\n\nThe 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.\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', + description = 'Sets the filesystem paths that will be searched for c libraries when require is called.\n\nThe 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.\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', variants = { { + description = 'The default paths string is \'??\', which makes require(\'cool\') try to load cool.dll, or cool.so depending on the platform.', arguments = { { type = 'string', name = 'paths', - description = 'The paths that the require function will check in love\'s filesystem.' - } - } - } - } + description = 'The paths that the \'\'require\'\' function will check in love\'s filesystem.', + }, + }, + }, + }, }, { name = 'setIdentity', - description = '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.', + description = 'Sets the write directory for your game. \n\nNote that you can only set the name of the folder to store your files in, not the location.', variants = { { arguments = { { type = 'string', name = 'name', - description = 'The new identity that will be used as write directory.' + description = 'The new identity that will be used as write directory.', }, + }, + }, + { + arguments = { { - type = 'boolean', - name = 'appendToPath', - default = 'false', - description = 'Whether the identity directory will be searched when reading a filepath before or after the game\'s source directory and any currently mounted archives.' - } - } - } - } + type = 'string', + name = 'name', + description = 'The new identity that will be used as write directory.', + }, + }, + }, + }, }, { name = 'setRequirePath', - description = 'Sets the filesystem paths that will be searched when require is called.\n\nThe 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.)\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', + description = 'Sets the filesystem paths that will be searched when require is called.\n\nThe 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.)\n\nThe paths are relative to the game\'s source and save directories, as well as any paths mounted with love.filesystem.mount.', variants = { { + description = 'The default paths string is \'?.lua;?/init.lua\', which makes require(\'cool\') try to load cool.lua and then try cool/init.lua if cool.lua doesn\'t exist.', arguments = { { type = 'string', name = 'paths', - description = 'The paths that the require function will check in love\'s filesystem.' - } - } - } - } + description = 'The paths that the \'\'require\'\' function will check in love\'s filesystem.', + }, + }, + }, + }, }, { name = 'setSource', @@ -672,11 +892,11 @@ return { { type = 'string', name = 'path', - description = 'Absolute path to the game\'s source folder.' + description = 'Absolute path to the game\'s source folder.', }, - } - } - } + }, + }, + }, }, { name = 'setSymlinksEnabled', @@ -687,11 +907,11 @@ return { { type = 'boolean', name = 'enable', - description = 'Whether love.filesystem should follow symbolic links.' + description = 'Whether love.filesystem should follow symbolic links.', }, - } - } - } + }, + }, + }, }, { name = 'unmount', @@ -702,94 +922,95 @@ return { { type = 'string', name = 'archive', - description = 'The folder or zip file in the game\'s save directory which is currently mounted.' + description = 'The folder or zip file in the game\'s save directory which is currently mounted.', }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the archive was successfully unmounted, false otherwise.' - } - } - } - } + description = 'True if the archive was successfully unmounted, false otherwise.', + }, + }, + }, + }, }, { name = 'write', - description = 'Write data to a file.\n\nIf you are getting the error message "Could not set write directory", try setting the save directory. This is done either with love.filesystem.setIdentity or by setting the identity field in love.conf.', + description = 'Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents.', variants = { { arguments = { { type = 'string', name = 'name', - description = 'The name (and path) of the file.' + description = 'The name (and path) of the file.', }, { type = 'string', name = 'data', - description = 'The string data to write to the file.' + description = 'The string data to write to the file.', }, { type = 'number', name = 'size', + description = 'How many bytes to write.', default = 'all', - description = 'How many bytes to write.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'If the operation was successful.' + description = 'If the operation was successful.', }, { type = 'string', name = 'message', - description = 'Error message if operation was unsuccessful.' - } - } + description = 'Error message if operation was unsuccessful.', + }, + }, }, { + description = 'If you are getting the error message \'Could not set write directory\', try setting the save directory. This is done either with love.filesystem.setIdentity or by setting the identity field in love.conf.\n\n\'\'\'Writing to multiple lines\'\'\': In Windows, some text editors (e.g. Notepad) only treat CRLF (\'\\r\\n\') as a new line.', arguments = { { type = 'string', name = 'name', - description = 'The name (and path) of the file.' + description = 'The name (and path) of the file.', }, { type = 'Data', name = 'data', - description = 'The Data object to write to the file.' + description = 'The Data object to write to the file.', }, { type = 'number', name = 'size', + description = 'How many bytes to write.', default = 'all', - description = 'How many bytes to write.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'If the operation was successful.' + description = 'If the operation was successful.', }, { type = 'string', name = 'message', - description = 'Error message if operation was unsuccessful.' - } - } - } - } - } + description = 'Error message if operation was unsuccessful.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.BufferMode'), require(path .. 'enums.FileDecoder'), require(path .. 'enums.FileMode'), - require(path .. 'enums.FileType') - } -} + require(path .. 'enums.FileType'), + }, +} \ No newline at end of file diff --git a/modules/filesystem/enums/BufferMode.lua b/modules/filesystem/enums/BufferMode.lua index ffdf89ea..0066d07e 100644 --- a/modules/filesystem/enums/BufferMode.lua +++ b/modules/filesystem/enums/BufferMode.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'none', - description = 'No buffering. The result of write and append operations appears immediately.' + description = 'No buffering. The result of write and append operations appears immediately.', }, { name = 'line', - description = 'Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.' + description = 'Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached.', }, { name = 'full', - description = 'Full buffering. Write and append operations are always buffered until the buffer size limit is reached.' - } - } -} + description = 'Full buffering. Write and append operations are always buffered until the buffer size limit is reached.', + }, + }, +} \ No newline at end of file diff --git a/modules/filesystem/enums/FileDecoder.lua b/modules/filesystem/enums/FileDecoder.lua index 0046b0a6..61f4336d 100644 --- a/modules/filesystem/enums/FileDecoder.lua +++ b/modules/filesystem/enums/FileDecoder.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'file', - description = 'The data is unencoded.' + description = 'The data is unencoded.', }, { name = 'base64', - description = 'The data is base64-encoded.' - } - } -} + description = 'The data is base64-encoded.', + }, + }, +} \ No newline at end of file diff --git a/modules/filesystem/enums/FileMode.lua b/modules/filesystem/enums/FileMode.lua index 0370ab3b..a59f08da 100644 --- a/modules/filesystem/enums/FileMode.lua +++ b/modules/filesystem/enums/FileMode.lua @@ -1,22 +1,22 @@ return { name = 'FileMode', - description = 'The different modes you can open a file in.', + description = 'The different modes you can open a File in.', constants = { { name = 'r', - description = 'Open a file for read.' + description = 'Open a file for read.', }, { name = 'w', - description = 'Open a file for write.' + description = 'Open a file for write.', }, { name = 'a', - description = 'Open a file for append.' + description = 'Open a file for append.', }, { name = 'c', - description = 'Do not open a file (represents a closed file.)' - } - } -} + description = 'Do not open a file (represents a closed file.)', + }, + }, +} \ No newline at end of file diff --git a/modules/filesystem/enums/FileType.lua b/modules/filesystem/enums/FileType.lua index 073032a4..8cd03e04 100644 --- a/modules/filesystem/enums/FileType.lua +++ b/modules/filesystem/enums/FileType.lua @@ -4,19 +4,19 @@ return { constants = { { name = 'file', - description = 'Regular file.' + description = 'Regular file.', }, { name = 'directory', - description = 'Directory' + description = 'Directory.', }, { name = 'symlink', - description = 'Symbolic link.' + description = 'Symbolic link.', }, { name = 'other', - description = 'Something completely different like a device.' - } - } -} + description = 'Something completely different like a device.', + }, + }, +} \ No newline at end of file diff --git a/modules/filesystem/types/File.lua b/modules/filesystem/types/File.lua index 4f52fc56..db3ab6a8 100644 --- a/modules/filesystem/types/File.lua +++ b/modules/filesystem/types/File.lua @@ -1,24 +1,26 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'File', - description = 'Represents a file on the filesystem.', - constructors = { - 'newFile' + description = 'Represents a file on the filesystem. A function that takes a file path can also take a File.', + supertypes = { + 'Object', }, functions = { { name = 'close', - description = 'Closes a file.', + description = 'Closes a File.', variants = { { returns = { { type = 'boolean', name = 'success', - description = 'Whether closing was successful.' - } - } - } - } + description = 'Whether closing was successful.', + }, + }, + }, + }, }, { name = 'flush', @@ -29,16 +31,16 @@ return { { type = 'boolean', name = 'success', - description = 'Whether the file successfully flushed any buffered data to the disk.' + description = 'Whether the file successfully flushed any buffered data to the disk.', }, { type = 'string', name = 'err', - description = 'The error string, if an error occurred and the file could not be flushed.' - } - } - } - } + description = 'The error string, if an error occurred and the file could not be flushed.', + }, + }, + }, + }, }, { name = 'getBuffer', @@ -49,16 +51,16 @@ return { { type = 'BufferMode', name = 'mode', - description = 'The current buffer mode of the file.' + description = 'The current buffer mode of the file.', }, { type = 'number', name = 'size', - description = 'The maximum size in bytes of the file\'s buffer.' - } - } - } - } + description = 'The maximum size in bytes of the file\'s buffer.', + }, + }, + }, + }, }, { name = 'getFilename', @@ -69,11 +71,11 @@ return { { type = 'string', name = 'filename', - description = 'The filename of the File.' - } - } - } - } + description = 'The filename of the File.', + }, + }, + }, + }, }, { name = 'getMode', @@ -84,11 +86,11 @@ return { { type = 'FileMode', name = 'mode', - description = 'The mode this file has been opened with.' - } - } - } - } + description = 'The mode this file has been opened with.', + }, + }, + }, + }, }, { name = 'getSize', @@ -99,11 +101,11 @@ return { { type = 'number', name = 'size', - description = 'The file size' - } - } - } - } + description = 'The file size in bytes.', + }, + }, + }, + }, }, { name = 'isEOF', @@ -114,11 +116,11 @@ return { { type = 'boolean', name = 'eof', - description = 'Whether EOF has been reached.' - } - } - } - } + description = 'Whether EOF has been reached.', + }, + }, + }, + }, }, { name = 'isOpen', @@ -129,48 +131,54 @@ return { { type = 'boolean', name = 'open', - description = 'True if the file is currently open, false otherwise.' - } - } - } - } + description = 'True if the file is currently open, false otherwise.', + }, + }, + }, + }, }, { name = 'lines', - description = 'Iterate over all the lines in a file', + description = 'Iterate over all the lines in a file.', variants = { { returns = { { type = 'function', name = 'iterator', - description = 'The iterator (can be used in for loops)' - } - } - } - } + description = 'The iterator (can be used in for loops).', + }, + }, + }, + }, }, { name = 'open', - description = 'Open the file for write, read or append.\n\nIf you are getting the error message "Could not set write directory", try setting the save directory. This is done either with love.filesystem.setIdentity or by setting the identity field in love.conf.', + description = 'Open the file for write, read or append.', variants = { { + description = 'If you are getting the error message \'Could not set write directory\', try setting the save directory. This is done either with love.filesystem.setIdentity or by setting the identity field in love.conf (only available with love 0.7 or higher).', arguments = { { type = 'FileMode', name = 'mode', - description = 'The mode to open the file in.' - } + description = 'The mode to open the file in.', + }, }, returns = { { type = 'boolean', - name = 'success', - description = 'True on success, false otherwise.' - } - } - } - } + name = 'ok', + description = 'True on success, false otherwise.', + }, + { + type = 'string', + name = 'err', + description = 'The error string if an error occurred.', + }, + }, + }, + }, }, { name = 'read', @@ -181,79 +189,107 @@ return { { type = 'number', name = 'bytes', + description = 'The number of bytes to read.', default = 'all', - description = 'The number of bytes to read' - } + }, }, returns = { { type = 'string', name = 'contents', - description = 'The contents of the read bytes.' + description = 'The contents of the read bytes.', + }, + { + type = 'number', + name = 'size', + description = 'How many bytes have been read.', + }, + }, + }, + { + description = 'Reads the contents of a file into either a string or a FileData object.', + arguments = { + { + type = 'ContainerType', + name = 'container', + description = 'What type to return the file\'s contents as.', + }, + { + type = 'number', + name = 'bytes', + description = 'The number of bytes to read.', + default = 'all', + }, + }, + returns = { + { + type = 'value', + name = 'contents', + description = 'FileData or string containing the read bytes.', }, { type = 'number', name = 'size', - description = 'How many bytes have been read.' - } - } - } - } + description = 'How many bytes have been read.', + }, + }, + }, + }, }, { name = 'seek', - description = 'Seek to a position in a file.', + description = 'Seek to a position in a file', variants = { { arguments = { { type = 'number', - name = 'position', - description = 'The position to seek to.' - } + name = 'pos', + description = 'The position to seek to', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the operation was successful.' - } - } - } - } + description = 'Whether the operation was successful', + }, + }, + }, + }, }, { name = 'setBuffer', - description = '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.', + description = '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.\n\nFile:flush will force any buffered data to be written to the disk.', variants = { { arguments = { { type = 'BufferMode', name = 'mode', - description = 'The buffer mode to use.' + description = 'The buffer mode to use.', }, { type = 'number', name = 'size', + description = 'The maximum size in bytes of the file\'s buffer.', default = '0', - description = 'The maximum size in bytes of the file\'s buffer.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the buffer mode was successfully set.' + description = 'Whether the buffer mode was successfully set.', }, { type = 'string', name = 'errorstr', - description = 'The error string, if the buffer mode could not be set and an error occurred.' - } - } - } - } + description = 'The error string, if the buffer mode could not be set and an error occurred.', + }, + }, + }, + }, }, { name = 'tell', @@ -264,11 +300,11 @@ return { { type = 'number', name = 'pos', - description = 'The current position.' - } - } - } - } + description = 'The current position.', + }, + }, + }, + }, }, { name = 'write', @@ -279,28 +315,57 @@ return { { type = 'string', name = 'data', - description = 'The data to write.' + description = 'The string data to write.', + }, + { + type = 'number', + name = 'size', + description = 'How many bytes to write.', + default = 'all', + }, + }, + returns = { + { + type = 'boolean', + name = 'success', + description = 'Whether the operation was successful.', + }, + { + type = 'string', + name = 'err', + description = 'The error string if an error occurred.', + }, + }, + }, + { + description = '\'\'\'Writing to multiple lines\'\'\': In Windows, some text editors (e.g. Notepad before Windows 10 1809) only treat CRLF (\'\\r\\n\') as a new line.\n\n--example\n\nf = love.filesystem.newFile(\'note.txt\')\n\nf:open(\'w\')\n\nfor i = 1, 10 do\n\n f:write(\'This is line \'..i..\'!\\r\\n\')\n\nend\n\nf:close()', + arguments = { + { + type = 'Data', + name = 'data', + description = 'The Data object to write.', }, { type = 'number', name = 'size', + description = 'How many bytes to write.', default = 'all', - description = 'How many bytes to write.' - } + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the operation was successful.' - } - } - } - } - } + description = 'Whether the operation was successful.', + }, + { + type = 'string', + name = 'errorstr', + description = 'The error string if an error occurred.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/filesystem/types/FileData.lua b/modules/filesystem/types/FileData.lua index 081e7fa3..27bb9473 100644 --- a/modules/filesystem/types/FileData.lua +++ b/modules/filesystem/types/FileData.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'FileData', description = 'Data representing the contents of a file.', - constructors = { - 'newFileData' + supertypes = { + 'Data', + 'Object', }, functions = { { @@ -14,11 +17,11 @@ return { { type = 'string', name = 'ext', - description = 'The extension of the file the FileData represents.' - } - } - } - } + description = 'The extension of the file the FileData represents.', + }, + }, + }, + }, }, { name = 'getFilename', @@ -29,16 +32,11 @@ return { { type = 'string', name = 'name', - description = 'The name of the file the FileData represents.' - } - } - } - } - } + description = 'The name of the file the FileData represents.', + }, + }, + }, + }, + }, }, - parenttype = 'Data', - supertypes = { - 'Data', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/Graphics.lua b/modules/graphics/Graphics.lua index 2358d748..a3dc05ff 100644 --- a/modules/graphics/Graphics.lua +++ b/modules/graphics/Graphics.lua @@ -1,4 +1,3 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { @@ -7,123 +6,124 @@ return { types = { require(path .. 'types.Canvas'), require(path .. 'types.Font'), - require(path .. 'types.Mesh'), require(path .. 'types.Image'), + require(path .. 'types.Mesh'), require(path .. 'types.ParticleSystem'), require(path .. 'types.Quad'), require(path .. 'types.Shader'), require(path .. 'types.SpriteBatch'), require(path .. 'types.Text'), require(path .. 'types.Texture'), - require(path .. 'types.Video') + require(path .. 'types.Video'), }, functions = { + { + name = 'applyTransform', + description = 'Applies the given Transform object to the current coordinate transformation.\n\nThis effectively multiplies the existing coordinate transformation\'s matrix with the Transform object\'s internal matrix to produce the new coordinate transformation.', + variants = { + { + arguments = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object to apply to the current graphics coordinate transform.', + }, + }, + }, + }, + }, { name = 'arc', description = 'Draws a filled or unfilled arc at position (x, y). The arc is drawn from angle1 to angle2 in radians. The segments parameter determines how many segments are used to draw the arc. The more segments, the smoother the edge.', variants = { { - description = 'Draws an arc using the "pie" ArcType.', + description = 'Draws an arc using the \'pie\' ArcType.', arguments = { { type = 'DrawMode', name = 'drawmode', - description = 'How to draw the arc.' + description = 'How to draw the arc.', }, { type = 'number', name = 'x', - description = 'The position of the center along x-axis.' + description = 'The position of the center along x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the center along y-axis.' + description = 'The position of the center along y-axis.', }, { type = 'number', name = 'radius', - description = 'Radius of the arc.' + description = 'Radius of the arc.', }, { type = 'number', name = 'angle1', - description = 'The angle at which the arc begins.' + description = 'The angle at which the arc begins.', }, { type = 'number', name = 'angle2', - description = 'The angle at which the arc terminates.' + description = 'The angle at which the arc terminates.', }, { type = 'number', name = 'segments', + description = 'The number of segments used for drawing the arc.', default = '10', - description = 'The number of segments used for drawing the arc.' - } - } + }, + }, }, { + description = '', arguments = { { type = 'DrawMode', name = 'drawmode', - description = 'How to draw the arc.' + description = 'How to draw the arc.', }, { type = 'ArcType', name = 'arctype', - description = 'The type of arc to draw.' + description = 'The type of arc to draw.', }, { type = 'number', name = 'x', - description = 'The position of the center along x-axis.' + description = 'The position of the center along x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the center along y-axis.' + description = 'The position of the center along y-axis.', }, { type = 'number', name = 'radius', - description = 'Radius of the arc.' + description = 'Radius of the arc.', }, { type = 'number', name = 'angle1', - description = 'The angle at which the arc begins.' + description = 'The angle at which the arc begins.', }, { type = 'number', name = 'angle2', - description = 'The angle at which the arc terminates.' + description = 'The angle at which the arc terminates.', }, { type = 'number', name = 'segments', + description = 'The number of segments used for drawing the arc.', default = '10', - description = 'The number of segments used for drawing the arc.' - } - } - } - } - }, - { - name = 'applyTransform', - description = 'Applies the given Transform object to the current coordinate transformation.\n\nThis effectively multiplies the existing coordinate transformation\'s matrix with the Transform object\'s internal matrix to produce the new coordinate transformation.', - variants = { - { - arguments = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object to apply to the current graphics coordinate transform.' - } - } - } - } + }, + }, + }, + }, }, { name = 'captureScreenshot', @@ -135,9 +135,9 @@ return { { type = 'string', name = 'filename', - description = 'The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats.' - } - } + description = 'The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats.', + }, + }, }, { description = 'Capture a screenshot and call a callback with the generated ImageData at the end of the current frame.', @@ -145,9 +145,9 @@ return { { type = 'function', name = 'callback', - description = 'Function which gets called once the screenshot has been captured. An ImageData is passed into the function as its only argument.' - } - } + description = 'Function which gets called once the screenshot has been captured. An ImageData is passed into the function as its only argument.', + }, + }, }, { description = 'Capture a screenshot and push the generated ImageData to a Channel at the end of the current frame.', @@ -155,11 +155,11 @@ return { { type = 'Channel', name = 'channel', - description = 'The Channel to push the generated ImageData to.' - } - } - } - } + description = 'The Channel to push the generated ImageData to.', + }, + }, + }, + }, }, { name = 'circle', @@ -170,62 +170,62 @@ return { { type = 'DrawMode', name = 'mode', - description = 'How to draw the circle.' + description = 'How to draw the circle.', }, { type = 'number', name = 'x', - description = 'The position of the center along x-axis.' + description = 'The position of the center along x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the center along y-axis.' + description = 'The position of the center along y-axis.', }, { type = 'number', name = 'radius', - description = 'The radius of the circle.' - } - } + description = 'The radius of the circle.', + }, + }, }, { arguments = { { type = 'DrawMode', name = 'mode', - description = 'How to draw the circle.' + description = 'How to draw the circle.', }, { type = 'number', name = 'x', - description = 'The position of the center along x-axis.' + description = 'The position of the center along x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the center along y-axis.' + description = 'The position of the center along y-axis.', }, { type = 'number', name = 'radius', - description = 'The radius of the circle.' + description = 'The radius of the circle.', }, { type = 'number', name = 'segments', - description = 'The number of segments used for drawing the circle. Note: The default variable for the segments parameter varies between different versions of LÖVE.' - } - } - } - } + description = 'The number of segments used for drawing the circle. Note: The default variable for the segments parameter varies between different versions of LÖVE.', + }, + }, + }, + }, }, { name = 'clear', - description = 'Clears the screen to the background color in LÖVE 0.9.2 and earlier, or to the specified color in 0.10.0 and newer.\n\nThis function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function.\n\nNote that the scissor area bounds the cleared region.', + description = 'Clears the screen or active Canvas to the specified color.\n\nThis function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function.\n\nNote that the scissor area bounds the cleared region.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.\n\nIn versions prior to background color instead.', variants = { { - description = 'Clears the screen to the background color in 0.9.2 and earlier, or to transparent black (0, 0, 0, 0) in LÖVE 0.10.0 and newer.' + description = 'Clears the screen to the background color in 0.9.2 and earlier, or to transparent black (0, 0, 0, 0) in LÖVE 0.10.0 and newer.', }, { description = 'Clears the screen or active Canvas to the specified color.', @@ -233,309 +233,384 @@ return { { type = 'number', name = 'r', - description = 'The red channel of the color to clear the screen to.' + description = 'The red channel of the color to clear the screen to.', }, { type = 'number', name = 'g', - description = 'The green channel of the color to clear the screen to.' + description = 'The green channel of the color to clear the screen to.', }, { type = 'number', name = 'b', - description = 'The blue channel of the color to clear the screen to.' + description = 'The blue channel of the color to clear the screen to.', }, { type = 'number', name = 'a', + description = 'The alpha channel of the color to clear the screen to.', default = '1', - description = 'The alpha channel of the color to clear the screen to.' }, - } + { + type = 'boolean', + name = 'clearstencil', + description = 'Whether to clear the active stencil buffer, if present. It can also be an integer between 0 and 255 to clear the stencil buffer to a specific value.', + default = 'true', + }, + { + type = 'boolean', + name = 'cleardepth', + description = 'Whether to clear the active depth buffer, if present. It can also be a number between 0 and 1 to clear the depth buffer to a specific value.', + default = 'true', + }, + }, }, { - description = 'Clears multiple active Canvases to different colors, if multiple Canvases are active at once via love.graphics.setCanvas.', + description = 'Clears multiple active Canvases to different colors, if multiple Canvases are active at once via love.graphics.setCanvas.\n\nA color must be specified for each active Canvas, when this function variant is used.', arguments = { { type = 'table', name = 'color', - description = 'A table in the form of {r, g, b, a} containing the color to clear the first active Canvas to.' + description = 'A table in the form of {r, g, b, a} containing the color to clear the first active Canvas to.', }, { type = 'table', name = '...', - description = 'Additional tables for each active Canvas.' - } - } - } - } + description = 'Additional tables for each active Canvas.', + }, + { + type = 'boolean', + name = 'clearstencil', + description = 'Whether to clear the active stencil buffer, if present. It can also be an integer between 0 and 255 to clear the stencil buffer to a specific value.', + default = 'true', + }, + { + type = 'boolean', + name = 'cleardepth', + description = 'Whether to clear the active depth buffer, if present. It can also be a number between 0 and 1 to clear the depth buffer to a specific value.', + default = 'true', + }, + }, + }, + { + description = 'Clears the stencil or depth buffers without having to clear the color canvas as well.', + arguments = { + { + type = 'boolean', + name = 'clearcolor', + description = 'Whether to clear the active color canvas to transparent black (0, 0, 0, 0). Typically this should be set to false with this variant of the function.', + }, + { + type = 'boolean', + name = 'clearstencil', + description = 'Whether to clear the active stencil buffer, if present. It can also be an integer between 0 and 255 to clear the stencil buffer to a specific value.', + }, + { + type = 'boolean', + name = 'cleardepth', + description = 'Whether to clear the active depth buffer, if present. It can also be a number between 0 and 1 to clear the depth buffer to a specific value.', + }, + }, + }, + }, }, { name = 'discard', - description = 'Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases.\n\nIf the active Canvas has just been changed and the "replace" BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.discard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices.\n\nOn some desktop systems this function may do nothing.', + description = 'Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases.\n\nIf the active Canvas has just been changed and the \'replace\' BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.discard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices.\n\nOn some desktop systems this function may do nothing.', variants = { { arguments = { { type = 'boolean', name = 'discardcolor', + description = 'Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active.)', default = 'true', - description = 'Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active).' }, { type = 'boolean', name = 'discardstencil', + description = 'Whether to discard the contents of the stencil buffer of the screen / active Canvas.', default = 'true', - description = 'Whether to discard the contents of the stencil buffer of the screen / active Canvas.' - } - } + }, + }, }, { arguments = { { type = 'table', name = 'discardcolors', - description = 'An array containing boolean values indicating whether to discard the texture of each active Canvas, when multiple simultaneous Canvases are active.' + description = 'An array containing boolean values indicating whether to discard the texture of each active Canvas, when multiple simultaneous Canvases are active.', }, { type = 'boolean', name = 'discardstencil', + description = 'Whether to discard the contents of the stencil buffer of the screen / active Canvas.', default = 'true', - description = 'Whether to discard the contents of the stencil buffer of the screen / active Canvas.' - } - } - } - } + }, + }, + }, + }, }, { name = 'draw', - description = 'Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, Text object, or Video) on the screen with optional rotation, scaling and shearing.\n\nObjects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system.\n\nIt\'s possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline.\n\nNote that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation.\n\nThe right and bottom edges of the object are shifted at an angle defined by the shearing factors.', + description = 'Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, Text object, or Video) on the screen with optional rotation, scaling and shearing.\n\nObjects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system.\n\nIt\'s possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline. \n\nNote that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation.\n\nThe right and bottom edges of the object are shifted at an angle defined by the shearing factors.\n\nWhen using the default shader anything drawn with this function will be tinted according to the currently selected color. Set it to pure white to preserve the object\'s original colors.', variants = { { arguments = { { type = 'Drawable', name = 'drawable', - description = 'A drawable object.' + description = 'A drawable object.', }, { type = 'number', name = 'x', + description = 'The position to draw the object (x-axis).', default = '0', - description = 'The position to draw the object (x-axis).' }, { type = 'number', name = 'y', + description = 'The position to draw the object (y-axis).', default = '0', - description = 'The position to draw the object (y-axis).' }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis). Can be negative.' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis). Can be negative.' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis). (A value of 20 would effectively move your drawable object 20 pixels to the left.)' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis). (A value of 20 would effectively move your drawable object 20 pixels up.)' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shearing factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shearing factor (y-axis).' - } - } + }, + }, }, { arguments = { { type = 'Texture', name = 'texture', - description = 'A Texture (Image or Canvas) to texture the Quad with.' + description = 'A Texture (Image or Canvas) to texture the Quad with.', }, { type = 'Quad', name = 'quad', - description = 'The Quad to draw on screen.' + description = 'The Quad to draw on screen.', }, { type = 'number', name = 'x', - default = '0', - description = 'The position to draw the object (x-axis).' + description = 'The position to draw the object (x-axis).', }, { type = 'number', name = 'y', - default = '0', - description = 'The position to draw the object (y-axis).' + description = 'The position to draw the object (y-axis).', }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis). Can be negative.' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis). Can be negative.' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis)' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shearing factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shearing factor (y-axis).' - } - } - } - } + }, + }, + }, + { + arguments = { + { + type = 'Drawable', + name = 'drawable', + description = 'A drawable object.', + }, + { + type = 'Transform', + name = 'transform', + description = 'Transformation object.', + }, + }, + }, + { + arguments = { + { + type = 'Texture', + name = 'texture', + description = 'A Texture (Image or Canvas) to texture the Quad with.', + }, + { + type = 'Quad', + name = 'quad', + description = 'The Quad to draw on screen.', + }, + { + type = 'Transform', + name = 'transform', + description = 'Transformation object.', + }, + }, + }, + }, }, { name = 'drawInstanced', - description = 'Draws many instances of a Mesh with a single draw call, using hardware geometry instancing.\n\nEach instance can have unique properties (positions, colors, etc.) but will not by default unless a custom Shader along with either per-instance attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other.\n\nInstancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check.', + description = 'Draws many instances of a Mesh with a single draw call, using hardware geometry instancing.\n\nEach instance can have unique properties (positions, colors, etc.) but will not by default unless a custom per-instance vertex attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other.\n\nInstancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check.', variants = { { arguments = { { type = 'Mesh', name = 'mesh', - description = 'The mesh to render.' + description = 'The mesh to render.', }, { type = 'number', name = 'instancecount', - description = 'The number of instances to render.' + description = 'The number of instances to render.', }, { type = 'number', name = 'x', + description = 'The position to draw the instances (x-axis).', default = '0', - description = 'The position to draw the instances (x-axis).' }, { type = 'number', name = 'y', + description = 'The position to draw the instances (y-axis).', default = '0', - description = 'The position to draw the instances (y-axis).' }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shearing factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shearing factor (y-axis).' - } - } + }, + }, }, { arguments = { { type = 'Mesh', name = 'mesh', - description = 'The mesh to render.' + description = 'The mesh to render.', }, { type = 'number', name = 'instancecount', - description = 'The number of instances to render.' + description = 'The number of instances to render.', }, { type = 'Transform', name = 'transform', - description = 'A transform object.' - } - } - } - } + description = 'A transform object.', + }, + }, + }, + }, }, { name = 'drawLayer', @@ -547,142 +622,142 @@ return { { type = 'Texture', name = 'texture', - description = 'The Array Texture to draw.' + description = 'The Array Texture to draw.', }, { type = 'number', name = 'layerindex', - description = 'The index of the layer to use when drawing.' + description = 'The index of the layer to use when drawing.', }, { type = 'number', name = 'x', + description = 'The position to draw the texture (x-axis).', default = '0', - description = 'The position to draw the texture (x-axis).' }, { type = 'number', name = 'y', + description = 'The position to draw the texture (y-axis).', default = '0', - description = 'The position to draw the texture (y-axis).' }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shearing factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shearing factor (y-axis).' - } - } + }, + }, }, { - description = 'Draws a layer of an Array Texture using the specified Quad.', + description = 'Draws a layer of an Array Texture using the specified Quad.\n\nThe specified layer index overrides any layer index set on the Quad via Quad:setLayer.', arguments = { { type = 'Texture', name = 'texture', - description = 'The Array Texture to draw.' + description = 'The Array Texture to draw.', }, { type = 'number', name = 'layerindex', - description = 'The index of the layer to use when drawing.' + description = 'The index of the layer to use when drawing.', }, { type = 'Quad', name = 'quad', - description = 'The subsection of the texture\'s layer to use when drawing.' + description = 'The subsection of the texture\'s layer to use when drawing.', }, { type = 'number', name = 'x', + description = 'The position to draw the texture (x-axis).', default = '0', - description = 'The position to draw the texture (x-axis).' }, { type = 'number', name = 'y', + description = 'The position to draw the texture (y-axis).', default = '0', - description = 'The position to draw the texture (y-axis).' }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shearing factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shearing factor (y-axis).' - } - } + }, + }, }, { description = 'Draws a layer of an Array Texture using the specified Transform.', @@ -690,46 +765,46 @@ return { { type = 'Texture', name = 'texture', - description = 'The Array Texture to draw.' + description = 'The Array Texture to draw.', }, { type = 'number', name = 'layerindex', - description = 'The index of the layer to use when drawing.' + description = 'The index of the layer to use when drawing.', }, { type = 'Transform', name = 'transform', - description = 'A transform object.' - } - } + description = 'A transform object.', + }, + }, }, { - description = 'Draws a layer of an Array Texture using the specified Quad and Transform.', + description = 'Draws a layer of an Array Texture using the specified Quad and Transform.\n\nIn order to use an Array Texture or other non-2D texture types as the main texture in a custom void effect() variant must be used in the pixel shader, and MainTex must be declared as an ArrayImage or sampler2DArray like so: uniform ArrayImage MainTex;.', arguments = { { type = 'Texture', name = 'texture', - description = 'The Array Texture to draw.' + description = 'The Array Texture to draw.', }, { type = 'number', name = 'layerindex', - description = 'The index of the layer to use when drawing.' + description = 'The index of the layer to use when drawing.', }, { type = 'Quad', name = 'quad', - description = 'The subsection of the texture\'s layer to use when drawing.' + description = 'The subsection of the texture\'s layer to use when drawing.', }, { type = 'Transform', name = 'transform', - description = 'A transform object.' - } - } - } - } + description = 'A transform object.', + }, + }, + }, + }, }, { name = 'ellipse', @@ -740,102 +815,103 @@ return { { type = 'DrawMode', name = 'mode', - description = 'How to draw the ellipse.' + description = 'How to draw the ellipse.', }, { type = 'number', name = 'x', - description = 'The position of the center along x-axis.' + description = 'The position of the center along x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the center along y-axis.' + description = 'The position of the center along y-axis.', }, { type = 'number', name = 'radiusx', - description = 'The radius of the ellipse along the x-axis (half the ellipse\'s width).' + description = 'The radius of the ellipse along the x-axis (half the ellipse\'s width).', }, { type = 'number', name = 'radiusy', - description = 'The radius of the ellipse along the y-axis (half the ellipse\'s height).' - } - } + description = 'The radius of the ellipse along the y-axis (half the ellipse\'s height).', + }, + }, }, { arguments = { { type = 'DrawMode', name = 'mode', - description = 'How to draw the ellipse.' + description = 'How to draw the ellipse.', }, { type = 'number', name = 'x', - description = 'The position of the center along x-axis.' + description = 'The position of the center along x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the center along y-axis.' + description = 'The position of the center along y-axis.', }, { type = 'number', name = 'radiusx', - description = 'The radius of the ellipse along the x-axis (half the ellipse\'s width).' + description = 'The radius of the ellipse along the x-axis (half the ellipse\'s width).', }, { type = 'number', name = 'radiusy', - description = 'The radius of the ellipse along the y-axis (half the ellipse\'s height).' + description = 'The radius of the ellipse along the y-axis (half the ellipse\'s height).', }, { type = 'number', name = 'segments', - description = 'The number of segments used for drawing the ellipse.' - } - } - } - } + description = 'The number of segments used for drawing the ellipse.', + }, + }, + }, + }, }, { name = 'flushBatch', - description = 'Immediately renders any pending automatically batched draws.\n\nLÖVE will call this function internally as needed when most state is changed, so it is not necessary to manually call it.\n\nThe current batch will be automatically flushed by love.graphics state changes (except for the transform stack and the current color), as well as Shader:send and methods on Textures which change their state. Using a different Image in consecutive love.graphics.draw calls will also flush the current batch.\n\nSpriteBatches, ParticleSystems, Meshes, and Text objects do their own batching and do not affect automatic batching of other draws.', + description = 'Immediately renders any pending automatically batched draws.\n\nLÖVE will call this function internally as needed when most state is changed, so it is not necessary to manually call it.\n\nThe current batch will be automatically flushed by color), as well as Shader:send and methods on Textures which change their state. Using a different Image in consecutive love.graphics.draw calls will also flush the current batch.\n\nSpriteBatches, ParticleSystems, Meshes, and Text objects do their own batching and do not affect automatic batching of other draws, aside from flushing the current batch when they\'re drawn.', variants = { - {} - } + { + }, + }, }, { name = 'getBackgroundColor', - description = 'Gets the current background color.', + description = 'Gets the current background color.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { returns = { { type = 'number', name = 'r', - description = 'The red component (0-1).' + description = 'The red component (0-1).', }, { type = 'number', name = 'g', - description = 'The green component (0-1).' + description = 'The green component (0-1).', }, { type = 'number', name = 'b', - description = 'The blue component (0-1).' + description = 'The blue component (0-1).', }, { type = 'number', name = 'a', - description = 'The alpha component (0-1).' - } - } - } - } + description = 'The alpha component (0-1).', + }, + }, + }, + }, }, { name = 'getBlendMode', @@ -846,16 +922,16 @@ return { { type = 'BlendMode', name = 'mode', - description = 'The current blend mode.' + description = 'The current blend mode.', }, { type = 'BlendAlphaMode', name = 'alphamode', - description = 'The current blend alpha mode – it determines how the alpha of drawn objects affects blending.' - } - } - } - } + description = 'The current blend alpha mode – it determines how the alpha of drawn objects affects blending.', + }, + }, + }, + }, }, { name = 'getCanvas', @@ -866,72 +942,72 @@ return { { type = 'Canvas', name = 'canvas', - description = 'The Canvas set by setCanvas. Returns nil if drawing to the real screen.' - } - } - } - } + description = 'The Canvas set by setCanvas. Returns nil if drawing to the real screen.', + }, + }, + }, + }, }, { name = 'getCanvasFormats', description = 'Gets the available Canvas formats, and whether each is supported.', variants = { { - arguments = { - { - type = 'boolean', - name = 'readable', - description = 'If true, the returned formats will only be indicated as supported if love.graphics.newCanvas will work with the readable flag set to true for that format, and vice versa if the parameter is false.' - } - }, returns = { { type = 'table', name = 'formats', - description = 'A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values (taking into account the readable parameter). Not all systems support all formats.' - } - } + description = 'A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.', + }, + }, }, { + arguments = { + { + type = 'boolean', + name = 'readable', + description = 'If true, the returned formats will only be indicated as supported if readable flag set to true for that format, and vice versa if the parameter is false.', + }, + }, returns = { { type = 'table', name = 'formats', - description = 'A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.' - } - } - } - } + description = 'A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values (taking into account the readable parameter). Not all systems support all formats.', + }, + }, + }, + }, }, { name = 'getColor', - description = 'Gets the current color.', + description = 'Gets the current color.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { returns = { { type = 'number', name = 'r', - description = 'The red component (0-1).' + description = 'The red component (0-1).', }, { type = 'number', name = 'g', - description = 'The red component (0-1).' + description = 'The green component (0-1).', }, { type = 'number', name = 'b', - description = 'The blue component (0-1).' + description = 'The blue component (0-1).', }, { type = 'number', name = 'a', - description = 'The alpha component (0-1).' - } - } - } - } + description = 'The alpha component (0-1).', + }, + }, + }, + }, }, { name = 'getColorMask', @@ -942,26 +1018,42 @@ return { { type = 'boolean', name = 'r', - description = 'Whether the red color component is active when rendering.' + description = 'Whether the red color component is active when rendering.', }, { type = 'boolean', name = 'g', - description = 'Whether the green color component is active when rendering.' + description = 'Whether the green color component is active when rendering.', }, { type = 'boolean', name = 'b', - description = 'Whether the blue color component is active when rendering.' + description = 'Whether the blue color component is active when rendering.', }, { type = 'boolean', name = 'a', - description = 'Whether the alpha color component is active when rendering.' - } - } - } - } + description = 'Whether the alpha color component is active when rendering.', + }, + }, + }, + }, + }, + { + name = 'getDPIScale', + description = 'Gets the DPI scale factor of the window.\n\nThe DPI scale factor represents relative pixel density. The pixel density inside the window might be greater (or smaller) than the \'size\' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.graphics.getDPIScale() would return 2 in that case.\n\nThe love.window.fromPixels and love.window.toPixels functions can also be used to convert between units.\n\nThe 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.', + variants = { + { + description = 'The units of love.graphics.getWidth, love.graphics.getHeight, love.mouse.getPosition, mouse events, love.touch.getPosition, and touch events are always in DPI-scaled units rather than pixels. In LÖVE 0.10 and older they were in pixels.', + returns = { + { + type = 'number', + name = 'scale', + description = 'The pixel scale factor associated with the window.', + }, + }, + }, + }, }, { name = 'getDefaultFilter', @@ -972,21 +1064,21 @@ return { { type = 'FilterMode', name = 'min', - description = 'Filter mode used when scaling the image down.' + description = 'Filter mode used when scaling the image down.', }, { type = 'FilterMode', name = 'mag', - description = 'Filter mode used when scaling the image up.' + description = 'Filter mode used when scaling the image up.', }, { type = 'number', name = 'anisotropy', - description = 'Maximum amount of Anisotropic Filtering used.' - } - } - } - } + description = 'Maximum amount of Anisotropic Filtering used.', + }, + }, + }, + }, }, { name = 'getDepthMode', @@ -997,36 +1089,36 @@ return { { type = 'CompareMode', name = 'comparemode', - description = 'Depth comparison mode used for depth testing.' + description = 'Depth comparison mode used for depth testing.', }, { type = 'boolean', name = 'write', - description = 'Whether to write update / write values to the depth buffer when rendering.' + description = 'Whether to write update / write values to the depth buffer when rendering.', }, - } - } - } + }, + }, + }, }, { name = 'getDimensions', - description = 'Gets the width and height of the window.', + description = 'Gets the width and height in pixels of the window.', variants = { { returns = { { type = 'number', name = 'width', - description = 'The width of the window.' + description = 'The width of the window.', }, { type = 'number', name = 'height', - description = 'The height of the window.' - } - } - } - } + description = 'The height of the window.', + }, + }, + }, + }, }, { name = 'getFont', @@ -1037,11 +1129,11 @@ return { { type = 'Font', name = 'font', - description = 'The current Font, or nil if none is set.' - } - } - } - } + description = 'The current Font. Automatically creates and sets the default font, if none is set yet.', + }, + }, + }, + }, }, { name = 'getFrontFaceWinding', @@ -1052,26 +1144,26 @@ return { { type = 'VertexWinding', name = 'winding', - description = 'The winding mode to use. The default winding is counterclockwise ("ccw").' - } - } - } - } + description = 'The winding mode being used. The default winding is counterclockwise (\'ccw\').', + }, + }, + }, + }, }, { name = 'getHeight', - description = 'Gets the height of the window.', + description = 'Gets the height in pixels of the window.', variants = { { returns = { { type = 'number', name = 'height', - description = 'The height of the window.' - } - } - } - } + description = 'The height of the window.', + }, + }, + }, + }, }, { name = 'getImageFormats', @@ -1082,11 +1174,11 @@ return { { type = 'table', name = 'formats', - description = 'A table containing PixelFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.' - } - } - } - } + description = 'A table containing PixelFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.', + }, + }, + }, + }, }, { name = 'getLineJoin', @@ -1097,11 +1189,11 @@ return { { type = 'LineJoin', name = 'join', - description = 'The LineJoin style.' - } - } - } - } + description = 'The LineJoin style.', + }, + }, + }, + }, }, { name = 'getLineStyle', @@ -1112,143 +1204,254 @@ return { { type = 'LineStyle', name = 'style', - description = 'The current line style.' - } - } - } - } + description = 'The current line style.', + }, + }, + }, + }, }, { name = 'getLineWidth', description = 'Gets the current line width.', variants = { { + description = 'This function does not work in 0.8.0, but has been fixed in version 0.9.0. Use the following snippet to circumvent this in 0.8.0;\n\nlove.graphics._getLineWidth = love.graphics.getLineWidth\n\nlove.graphics._setLineWidth = love.graphics.setLineWidth\n\nfunction love.graphics.getLineWidth() return love.graphics.varlinewidth or 1 end\n\nfunction love.graphics.setLineWidth(w) love.graphics.varlinewidth = w; return love.graphics._setLineWidth(w) end', returns = { { type = 'number', name = 'width', - description = 'The current line width.' - } - } - } - } - }, - { - name = 'getMeshCullMode', - description = 'Gets whether back-facing triangles in a Mesh are culled.\n\nMesh face culling is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer.', - variants = { - { - returns = { - { - type = 'CullMode', - name = 'mode', - description = 'The Mesh face culling mode in use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).' - } - } - } - } + description = 'The current line width.', + }, + }, + }, + }, }, { - name = 'getShader', - description = 'Returns the current Shader. Returns nil if none is set.', + name = 'getMeshCullMode', + description = 'Gets whether back-facing triangles in a Mesh are culled.\n\nMesh face culling is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer.', variants = { { returns = { { - type = 'Shader', - name = 'shader', - description = 'The current Shader.' - } - } - } - } + type = 'CullMode', + name = 'mode', + description = 'The Mesh face culling mode in use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).', + }, + }, + }, + }, }, { - name = 'getStackDepth', - description = 'Gets the current depth of the transform / state stack (the number of pushes without corresponding pops).', + name = 'getPixelHeight', + description = 'Gets the height in pixels of the window.\n\nThe graphics coordinate system and DPI scale factor, rather than raw pixels. Use getHeight for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelHeight only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).', variants = { { returns = { { type = 'number', - name = 'depth', - description = 'The current depth of the transform and state love.graphics stack.' - } - } - } - } + name = 'pixelheight', + description = 'The height of the window in pixels.', + }, + }, + }, + }, }, { - name = 'getStats', - description = 'Gets performance-related rendering statistics.', + name = 'getPixelWidth', + description = 'Gets the width in pixels of the window.\n\nThe graphics coordinate system and DPI scale factor, rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).', variants = { { returns = { { - type = 'table', - name = 'stats', - description = 'A table with the following fields:', - table = { - { + type = 'number', + name = 'pixelwidth', + description = 'The width of the window in pixels.', + }, + }, + }, + }, + }, + { + name = 'getPointSize', + description = 'Gets the point size.', + variants = { + { + returns = { + { + type = 'number', + name = 'size', + description = 'The current point size.', + }, + }, + }, + }, + }, + { + name = 'getRendererInfo', + description = 'Gets information about the system\'s video card and drivers.', + variants = { + { + returns = { + { + type = 'string', + name = 'name', + description = 'The name of the renderer, e.g. \'OpenGL\' or \'OpenGL ES\'.', + }, + { + type = 'string', + name = 'version', + description = 'The version of the renderer with some extra driver-dependent version info, e.g. \'2.1 INTEL-8.10.44\'.', + }, + { + type = 'string', + name = 'vendor', + description = 'The name of the graphics card vendor, e.g. \'Intel Inc\'. ', + }, + { + type = 'string', + name = 'device', + description = 'The name of the graphics card, e.g. \'Intel HD Graphics 3000 OpenGL Engine\'.', + }, + }, + }, + }, + }, + { + name = 'getScissor', + description = 'Gets the current scissor box.', + variants = { + { + returns = { + { + type = 'number', + name = 'x', + description = 'The x-component of the top-left point of the box.', + }, + { + type = 'number', + name = 'y', + description = 'The y-component of the top-left point of the box.', + }, + { + type = 'number', + name = 'width', + description = 'The width of the box.', + }, + { + type = 'number', + name = 'height', + description = 'The height of the box.', + }, + }, + }, + }, + }, + { + name = 'getShader', + description = 'Gets the current Shader. Returns nil if none is set.', + variants = { + { + returns = { + { + type = 'Shader', + name = 'shader', + description = 'The currently active Shader, or nil if none is set.', + }, + }, + }, + }, + }, + { + name = 'getStackDepth', + description = 'Gets the current depth of the transform / state stack (the number of pushes without corresponding pops).', + variants = { + { + returns = { + { + type = 'number', + name = 'depth', + description = 'The current depth of the transform and state love.graphics stack.', + }, + }, + }, + }, + }, + { + name = 'getStats', + description = 'Gets performance-related rendering statistics. ', + variants = { + { + returns = { + { + type = 'table', + name = 'stats', + description = 'A table with the following fields:', + table = { + { type = 'number', name = 'drawcalls', - description = 'The number of draw calls made so far during the current frame.' + description = 'The number of draw calls made so far during the current frame.', }, { type = 'number', name = 'canvasswitches', - description = 'The number of times the active Canvas has been switched so far during the current frame.' + description = 'The number of times the active Canvas has been switched so far during the current frame.', }, { type = 'number', name = 'texturememory', - description = 'The estimated total size in bytes of video memory used by all loaded Images, Canvases, and Fonts.' + description = 'The estimated total size in bytes of video memory used by all loaded Images, Canvases, and Fonts.', }, { type = 'number', name = 'images', - description = 'The number of Image objects currently loaded.' + description = 'The number of Image objects currently loaded.', }, { type = 'number', name = 'canvases', - description = 'The number of Canvas objects currently loaded.' + description = 'The number of Canvas objects currently loaded.', }, { type = 'number', name = 'fonts', - description = 'The number of Font objects currently loaded.' + description = 'The number of Font objects currently loaded.', }, { type = 'number', name = 'shaderswitches', - description = 'The number of times the active Shader has been changed so far during the current frame.' - } - } - } - } - } - } + description = 'The number of times the active Shader has been changed so far during the current frame.', + }, + { + type = 'number', + name = 'drawcallsbatched', + description = 'The number of draw calls that were saved by LÖVE\'s automatic batching, since the start of the frame.', + }, + }, + }, + }, + }, + }, }, { name = 'getStencilTest', - description = 'Gets whether stencil testing is enabled.\n\nWhen stencil testing is enabled, the geometry of everything that is drawn will be clipped / stencilled out based on whether it intersects with what has been previously drawn to the stencil buffer.\n\nEach Canvas has its own stencil buffer.', + description = 'Gets the current stencil test configuration.\n\nWhen stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil.\n\nEach Canvas has its own per-pixel stencil values.', variants = { { returns = { { - type = 'boolean', - name = 'enabled', - description = 'Whether stencil testing is enabled.' + type = 'CompareMode', + name = 'comparemode', + description = 'The type of comparison that is made for each pixel. Will be \'always\' if stencil testing is disabled.', }, { - type = 'boolean', - name = 'inverted', - description = 'Whether the stencil test is inverted or not.' - } - } - } - } + type = 'number', + name = 'comparevalue', + description = 'The value used when comparing with the stencil value of each pixel.', + }, + }, + }, + }, }, { name = 'getSupported', @@ -1259,11 +1462,11 @@ return { { type = 'table', name = 'features', - description = 'A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported.' - } - } - } - } + description = 'A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported.', + }, + }, + }, + }, }, { name = 'getSystemLimits', @@ -1274,86 +1477,11 @@ return { { type = 'table', name = 'limits', - description = 'A table containing GraphicsLimit keys, and number values.' - } - } - } - } - }, - { - name = 'getPointSize', - description = 'Gets the point size.', - variants = { - { - returns = { - { - type = 'number', - name = 'size', - description = 'The current point size.' - } - } - } - } - }, - { - name = 'getRendererInfo', - description = 'Gets information about the system\'s video card and drivers.', - variants = { - { - returns = { - { - type = 'string', - name = 'name', - description = 'The name of the renderer, e.g. "OpenGL" or "OpenGL ES".' - }, - { - type = 'string', - name = 'version', - description = 'The version of the renderer with some extra driver-dependent version info, e.g. "2.1 INTEL-8.10.44".' - }, - { - type = 'string', - name = 'vendor', - description = 'The name of the graphics card vendor, e.g. "Intel Inc".' + description = 'A table containing GraphicsLimit keys, and number values.', }, - { - type = 'string', - name = 'device', - description = 'The name of the graphics card, e.g. "Intel HD Graphics 3000 OpenGL Engine".' - } - } - } - } - }, - { - name = 'getScissor', - description = 'Gets the current scissor box.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x component of the top-left point of the box.' - }, - { - type = 'number', - name = 'y', - description = 'The y component of the top-left point of the box.' - }, - { - type = 'number', - name = 'width', - description = 'The width of the box.' - }, - { - type = 'number', - name = 'height', - description = 'The height of the box.' - } - } - } - } + }, + }, + }, }, { name = 'getTextureTypes', @@ -1364,60 +1492,56 @@ return { { type = 'table', name = 'texturetypes', - description = 'A table containing TextureTypes as keys, and a boolean indicating whether the type is supported as values. Not all systems support all types.' - } - } - } - } + description = 'A table containing TextureTypes as keys, and a boolean indicating whether the type is supported as values. Not all systems support all types.', + }, + }, + }, + }, }, { name = 'getWidth', - description = 'Gets the width of the window.', + description = 'Gets the width in pixels of the window.', variants = { { returns = { { type = 'number', name = 'width', - description = 'The width of the window.' - } - } - } - } + description = 'The width of the window.', + }, + }, + }, + }, }, { name = 'intersectScissor', - description = 'Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like love.graphics.setScissor.\n\nThe scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear.\n\nThe dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...).', + description = 'Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like love.graphics.setScissor.\n\nThe scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear.\n\nThe dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...).', variants = { { - description = 'Limits the drawing area to a specified rectangle.', arguments = { { type = 'number', name = 'x', - description = 'The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.' + description = 'The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.', }, { type = 'number', name = 'y', - description = 'The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.' + description = 'The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.', }, { type = 'number', name = 'width', - description = 'The width of the rectangle to intersect with the existing scissor rectangle.' + description = 'The width of the rectangle to intersect with the existing scissor rectangle.', }, { type = 'number', name = 'height', - description = 'The height of the rectangle to intersect with the existing scissor rectangle.' - } - } + description = 'The height of the rectangle to intersect with the existing scissor rectangle.', + }, + }, }, - { - description = 'Disables scissor.' - } - } + }, }, { name = 'inverseTransformPoint', @@ -1428,43 +1552,44 @@ return { { type = 'number', name = 'screenX', - description = 'The x component of the screen-space position.' + description = 'The x component of the screen-space position.', }, { type = 'number', name = 'screenY', - description = 'The y component of the screen-space position.' - } + description = 'The y component of the screen-space position.', + }, }, returns = { { type = 'number', name = 'globalX', - description = 'The x component of the position in global coordinates.' + description = 'The x component of the position in global coordinates.', }, { type = 'number', name = 'globalY', - description = 'The y component of the position in global coordinates.' - } - } - } - } + description = 'The y component of the position in global coordinates.', + }, + }, + }, + }, }, { name = 'isGammaCorrect', description = 'Gets whether gamma-correct rendering is supported and enabled. It can be enabled by setting t.gammacorrect = true in love.conf.\n\nNot all devices support gamma-correct rendering, in which case it will be automatically disabled and this function will return false. It is supported on desktop systems which have graphics cards that are capable of using OpenGL 3 / DirectX 10, and iOS devices that can use OpenGL ES 3.', variants = { { + description = 'When gamma-correct rendering is enabled, many functions and objects perform automatic color conversion between sRGB and linear RGB in order for blending and shader math to be mathematically correct (which they aren\'t if it\'s not enabled.)\n\n* The colors passed into converted from sRGB to linear RGB.\n\n* The colors set in text with per-character colors, points with per-point colors, standard custom Meshes which use the \'VertexColor\' attribute name will automatically be converted from sRGB to linear RGB when those objects are drawn.\n\n* creating the Image.\n\n* Everything drawn to the screen will be blended in linear RGB and then the result will be converted to sRGB for display.\n\n* Canvases which use the \'normal\' or \'srgb\' CanvasFormat will have their content blended in linear RGB and the result will be stored in the canvas in sRGB, when drawing to them. When the Canvas itself is drawn, its pixel colors will be converted from sRGB to linear RGB in the same manner as Images. Keeping the canvas pixel data stored as sRGB allows for better precision (less banding) for darker colors compared to \'rgba8\'.\n\nBecause most conversions are automatically handled, your own code doesn\'t need to worry about sRGB and linear RGB color conversions when gamma-correct rendering is enabled, except in a couple cases:\n\n* If a Mesh with custom vertex attributes is used and one of the attributes is meant to be used as a color in a Shader, and the attribute isn\'t named \'VertexColor\'.\n\n* If a Shader is used which has uniform / extern variables or other variables that are meant to be used as colors, and Shader:sendColor isn\'t used.\n\nIn both cases, love.math.gammaToLinear can be used to convert color values to linear RGB in Lua code, or the gammaCorrectColor (or unGammaCorrectColor if necessary) shader functions can be used inside shader code. Those shader functions \'\'only\'\' do conversions if gamma-correct rendering is actually enabled. The LOVE_GAMMA_CORRECT shader preprocessor define will be set if so.\n\nRead more about gamma-correct rendering here, here, and here.', returns = { { type = 'boolean', name = 'gammacorrect', - description = 'True if gamma-correct rendering is supported and was enabled in love.conf, false otherwise.' - } - } - } - } + description = 'True if gamma-correct rendering is supported and was enabled in love.conf, false otherwise.', + }, + }, + }, + }, }, { name = 'isWireframe', @@ -1475,11 +1600,11 @@ return { { type = 'boolean', name = 'wireframe', - description = 'True if wireframe lines are used when drawing, false if it\'s not.' - } - } - } - } + description = 'True if wireframe lines are used when drawing, false if it\'s not.', + }, + }, + }, + }, }, { name = 'line', @@ -1490,971 +1615,1903 @@ return { { type = 'number', name = 'x1', - description = 'The position of first point on the x-axis.' + description = 'The position of first point on the x-axis.', }, { type = 'number', name = 'y1', - description = 'The position of first point on the y-axis.' + description = 'The position of first point on the y-axis.', }, { type = 'number', name = 'x2', - description = 'The position of second point on the x-axis.' + description = 'The position of second point on the x-axis.', }, { type = 'number', name = 'y2', - description = 'The position of second point on the y-axis.' + description = 'The position of second point on the y-axis.', }, { type = 'number', name = '...', - description = 'You can continue passing point positions to draw a polyline.' - } - } + description = 'You can continue passing point positions to draw a polyline.', + }, + }, }, { arguments = { { type = 'table', name = 'points', - description = 'A table of point positions.' - } - } - } - } + description = 'A table of point positions, as described above.', + }, + }, + }, + }, }, { - name = 'newCanvas', - description = 'Creates a new Canvas object for offscreen rendering.\n\nAntialiased Canvases have slightly higher system requirements than normal Canvases. Additionally, the supported maximum number of MSAA samples varies depending on the system. Use love.graphics.getSystemLimit to check.\n\nIf the number of MSAA samples specified is greater than the maximum supported by the system, the Canvas will still be created but only using the maximum supported amount (this includes 0.)', + name = 'newArrayImage', + description = 'Creates a new array Image.\n\nAn array image / array texture is a single object which contains multiple \'layers\' or \'slices\' of 2D sub-images. It can be thought of similarly to a texture atlas or sprite sheet, but it doesn\'t suffer from the same tile / quad bleeding artifacts that texture atlases do – although every sub-image must have the same dimensions.\n\nA specific layer of an array image can be drawn with love.graphics.drawLayer / SpriteBatch:addLayer, or with the Quad variant of love.graphics.draw and Quad:setLayer, or via a custom Shader.\n\nTo use an array image in a Shader, it must be declared as a ArrayImage or sampler2DArray type (instead of Image or sampler2D). The Texel(ArrayImage image, vec3 texturecoord) shader function must be used to get pixel colors from a slice of the array image. The vec3 argument contains the texture coordinate in the first two components, and the 0-based slice index in the third component.', variants = { { + description = 'Creates an array Image given a different image file for each slice of the resulting array image object.\n\nIllustration of how an array image works: [http://codeflow.org/entries/2010/dec/09/minecraft-like-rendering-experiments-in-opengl-4/illustrations/textures.jpg]\n\nA DPI scale of 2 (double the normal pixel density) will result in the image taking up the same space on-screen as an image with half its pixel dimensions that has a DPI scale of 1. This allows for easily swapping out image assets that take the same space on-screen but have different pixel densities, which makes supporting high-dpi / retina resolution require less code logic.\n\nIn order to use an Array Texture or other non-2D texture types as the main texture in a custom void effect() variant must be used in the pixel shader, and MainTex must be declared as an ArrayImage or sampler2DArray like so: uniform ArrayImage MainTex;.', arguments = { { - type = 'number', - name = 'width', - default = 'window width', - description = 'The width of the Canvas.' - }, - { - type = 'number', - name = 'height', - default = 'window height', - description = 'The height of the Canvas.' + type = 'table', + name = 'slices', + description = 'A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each sub-image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the slice index of that sub-table.', }, { - type = 'CanvasFormat', - name = 'format', - default = '"normal"', - description = 'The desired texture mode of the Canvas.' + type = 'table', + name = 'settings', + description = 'Optional table of settings to configure the array image, containing the following fields:', + default = 'nil', + table = { + { + type = 'boolean', + name = 'mipmaps', + description = 'True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn\'t a compressed texture format.', + default = 'false', + }, + { + type = 'boolean', + name = 'linear', + description = 'True to treat the image\'s pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB.', + default = 'false', + }, + { + type = 'number', + name = 'dpiscale', + description = 'The DPI scale to use when drawing the array image and calling getWidth/getHeight.', + default = '1', + }, + }, }, - { - type = 'number', - name = 'msaa', - default = '0', - description = 'The desired number of antialiasing samples used when drawing to the Canvas.' - } }, returns = { { - type = 'Canvas', - name = 'canvas', - description = 'A new Canvas object.' - } - } - } - } - }, - { - name = 'newFont', - description = 'Creates a new Font from a TrueType Font or BMFont file. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object.\n\nAll variants which accept a filename can also accept a Data object instead.', + type = 'Image', + name = 'image', + description = 'An Array Image object.', + }, + }, + }, + }, + }, + { + name = 'newCanvas', + description = 'Creates a new Canvas object for offscreen rendering.', variants = { { - description = 'Create a new BMFont or TrueType font.', - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filepath to the BMFont or TrueType font file.' - } - }, returns = { { - type = 'Font', - name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } + type = 'Canvas', + name = 'canvas', + description = 'A new Canvas with dimensions equal to the window\'s size in pixels.', + }, + }, }, { - description = 'Create a new TrueType font.', arguments = { { - type = 'string', - name = 'filename', - description = 'The filepath to the TrueType font file.' + type = 'number', + name = 'width', + description = 'The desired width of the Canvas.', }, { type = 'number', - name = 'size', - description = 'The size of the font in pixels.' - } + name = 'height', + description = 'The desired height of the Canvas.', + }, }, returns = { { - type = 'Font', - name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } - }, - { - description = 'Create a new BMFont.', - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filepath to the BMFont file.' + type = 'Canvas', + name = 'canvas', + description = 'A new Canvas with specified width and height.', }, - { - type = 'string', - name = 'imagefilename', - description = 'The filepath to the BMFont\'s image file. If this argument is omitted, the path specified inside the BMFont file will be used.' - } }, - returns = { - { - type = 'Font', - name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } }, { - description = 'Create a new instance of the default font (Vera Sans) with a custom size.', + description = 'Creates a 2D or cubemap Canvas using the given settings.\n\nSome Canvas formats have higher system requirements than the default format. Use love.graphics.getCanvasFormats to check for support.', arguments = { { type = 'number', - name = 'size', - description = 'The size of the font in pixels.' - } - }, - returns = { + name = 'width', + description = 'The desired width of the Canvas.', + }, { - type = 'Font', - name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } - } - } - }, - { - name = 'newMesh', - description = 'Creates a new Mesh.\n\nUse Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it\'s drawn.', - variants = { - { - description = 'Creates a standard Mesh with the specified vertices.', - arguments = { + type = 'number', + name = 'height', + description = 'The desired height of the Canvas.', + }, { type = 'table', - name = 'vertices', - description = 'The table filled with vertex information tables for each vertex as follows:', + name = 'settings', + description = 'A table containing the given fields:', table = { { - type = 'number', - name = '[1]', - description = 'The position of the vertex on the x-axis.' + type = 'TextureType', + name = 'type', + description = 'The type of Canvas to create.', + default = '\'2d\'', }, { - type = 'number', - name = '[2]', - description = 'The position of the vertex on the y-axis.' + type = 'PixelFormat', + name = 'format', + description = 'The format of the Canvas.', + default = '\'normal\'', }, { - type = 'number', - name = '[3]', - default = '0', - description = 'The u texture coordinate of the vertex. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.)' + type = 'boolean', + name = 'readable', + description = 'Whether the Canvas is readable (drawable and accessible in a Shader). True by default for regular formats, false by default for depth/stencil formats.', }, { type = 'number', - name = '[4]', + name = 'msaa', + description = 'The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.', default = '0', - description = 'The v texture coordinate of the vertex. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.)' - }, - { - type = 'number', - name = '[5]', - default = '1', - description = 'The red component of the vertex color.' }, { type = 'number', - name = '[6]', - default = '1', - description = 'The green component of the vertex color.' + name = 'dpiscale', + description = 'The DPI scale factor of the Canvas, used when drawing to the Canvas as well as when drawing the Canvas to the screen.', + default = 'love.graphics.getDPIScale()', }, { - type = 'number', - name = '[7]', - default = '1', - description = 'The blue component of the vertex color.' + type = 'CanvasMipmapMode', + name = 'mipmaps', + description = 'Whether the Canvas has mipmaps, and whether to automatically regenerate them if so.', + default = '\'none\'', }, - { - type = 'number', - name = '[8]', - default = '1', - description = 'The alpha component of the vertex color.' - } - } - }, - { - type = 'MeshDrawMode', - name = 'mode', - default = '"fan"', - description = 'How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.' + }, }, - { - type = 'SpriteBatchUsage', - name = 'usage', - default = '"dynamic"', - description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.' - } }, returns = { { - type = 'Mesh', - name = 'mesh', - description = 'The new Mesh.' - } - } + type = 'Canvas', + name = 'canvas', + description = 'A new Canvas with specified width and height.', + }, + }, }, { - description = 'Creates a standard Mesh with the specified number of vertices.', + description = 'Creates a volume or array texture-type Canvas.', arguments = { { type = 'number', - name = 'vertexcount', - description = 'The total number of vertices the Mesh will use. Each vertex is initialized to {0,0, 0,0, 1,1,1,1}.' + name = 'width', + description = 'The desired width of the Canvas.', }, { - type = 'MeshDrawMode', - name = 'mode', - default = '"fan"', - description = 'How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.' + type = 'number', + name = 'height', + description = 'The desired height of the Canvas.', }, { - type = 'SpriteBatchUsage', - name = 'usage', - default = '"dynamic"', - description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.' - } - }, - returns = { - { - type = 'Mesh', - name = 'mesh', - description = 'The new Mesh.' - } - } - }, - { - description = 'Creates a Mesh with custom vertex attributes and the specified vertex data.', - arguments = { + type = 'number', + name = 'layers', + description = 'The number of array layers (if the Canvas is an Array Texture), or the volume depth (if the Canvas is a Volume Texture).', + }, { type = 'table', - name = 'vertexformat', - description = 'A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex.', + name = 'settings', + description = 'A table containing the given fields:', table = { { - type = 'table', - name = 'attribute', - description = 'A table containing the attribute\'s name, it\'s data type, and the number of components in the attribute, in the form of {name, datatype, components}.' + type = 'TextureType', + name = 'type', + description = 'The type of Canvas to create.', + default = '\'array\'', }, { - type = 'table', - name = '...', - description = 'Additional vertex attribute format tables.' - } - } - }, - { - type = 'table', - name = 'vertices', - description = 'The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}.', - table = { + type = 'PixelFormat', + name = 'format', + description = 'The format of the Canvas.', + default = '\'normal\'', + }, + { + type = 'boolean', + name = 'readable', + description = 'Whether the Canvas is readable (drawable and accessible in a Shader). True by default for regular formats, false by default for depth/stencil formats.', + }, { type = 'number', - name = 'attributecomponent', - description = 'The first component of the first vertex attribute in the vertex.' + name = 'msaa', + description = 'The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.', + default = '0', }, { type = 'number', - name = '...', - description = 'Additional components of all vertex attributes in the vertex.' - } - } + name = 'dpiscale', + description = 'The DPI scale factor of the Canvas, used when drawing to the Canvas as well as when drawing the Canvas to the screen.', + default = 'love.graphics.getDPIScale()', + }, + { + type = 'CanvasMipmapMode', + name = 'mipmaps', + description = 'Whether the Canvas has mipmaps, and whether to automatically regenerate them if so.', + default = '\'none\'', + }, + }, }, + }, + returns = { { - type = 'MeshDrawMode', - name = 'mode', - default = '"fan"', - description = 'How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.' + type = 'Canvas', + name = 'canvas', + description = 'A new Canvas with specified width and height.', + }, + }, + }, + { + description = 'Some Canvas formats have higher system requirements than the default format. Use love.graphics.getCanvasFormats to check for support.', + arguments = { + { + type = 'number', + name = 'width', + description = 'The desired width of the Canvas.', + default = 'window_width', }, { - type = 'SpriteBatchUsage', - name = 'usage', - default = '"dynamic"', - description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.' - } + type = 'number', + name = 'height', + description = 'The desired height of the Canvas.', + default = 'window_height', + }, + { + type = 'CanvasFormat', + name = 'format', + description = 'The desired texture format of the Canvas.', + default = '\'normal\'', + }, }, returns = { { - type = 'Mesh', - name = 'mesh', - description = 'The new Mesh.' - } - } + type = 'Canvas', + name = 'canvas', + description = 'A new Canvas with specified width and height.', + }, + }, }, { - description = 'Creates a Mesh with custom vertex attributes and the specified number of vertices.', + description = 'Some Canvas formats have higher system requirements than the default format. Use love.graphics.getCanvasFormats to check for support.\n\nThe supported maximum number of MSAA samples varies depending on the system. Use love.graphics.getSystemLimits to check.\n\nIf the number of MSAA samples specified is greater than the maximum supported by the system, the Canvas will still be created but only using the maximum supported amount (this includes 0.)', arguments = { { - type = 'table', - name = 'vertexformat', - description = 'A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex.', - table = { - { - type = 'table', - name = 'attribute', - description = 'A table containing the attribute\'s name, it\'s data type, and the number of components in the attribute, in the form of {name, datatype, components}.' - }, - { - type = 'table', - name = '...', - description = 'Additional vertex attribute format tables.' - } - } + type = 'number', + name = 'width', + description = 'The desired width of the Canvas.', + default = 'window_width', }, { type = 'number', - name = 'vertexcount', - description = 'The total number of vertices the Mesh will use.' + name = 'height', + description = 'The desired height of the Canvas.', + default = 'window_height', }, { - type = 'MeshDrawMode', - name = 'mode', - default = '"fan"', - description = 'How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.' + type = 'CanvasFormat', + name = 'format', + description = 'The desired texture format of the Canvas.', + default = '\'normal\'', }, { - type = 'SpriteBatchUsage', - name = 'usage', - default = '"dynamic"', - description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.' - } + type = 'number', + name = 'msaa', + description = 'The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.', + default = '0', + }, }, returns = { { - type = 'Mesh', - name = 'mesh', - description = 'The new Mesh.' - } - } - } - } + type = 'Canvas', + name = 'canvas', + description = 'A new Canvas with specified width and height.', + }, + }, + }, + }, }, { - name = 'newImage', - description = 'Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image.', + name = 'newCubeImage', + description = 'Creates a new cubemap Image.\n\nCubemap images have 6 faces (sides) which represent a cube. They can\'t be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send).\n\nTo use a cubemap image in a Shader, it must be declared as a CubeImage or samplerCube type (instead of Image or sampler2D). The Texel(CubeImage image, vec3 direction) shader function must be used to get pixel colors from the cubemap. The vec3 argument is a normalized direction from the center of the cube, rather than explicit texture coordinates.\n\nEach face in a cubemap image must have square dimensions.\n\nFor variants of this function which accept a single image containing multiple cubemap faces, they must be laid out in one of the following forms in the image:\n\n +y\n\n+z +x -z\n\n -y\n\n -x\n\nor:\n\n +y\n\n-x +z +x -z\n\n -y\n\nor:\n\n+x\n\n-x\n\n+y\n\n-y\n\n+z\n\n-z\n\nor:\n\n+x -x +y -y +z -z', variants = { { + description = 'Creates a cubemap Image given a single image file containing multiple cube faces.', arguments = { { type = 'string', name = 'filename', - description = 'The filepath to the image file.' - } - }, - returns = { - { - type = 'Image', - name = 'image', - description = 'An Image object which can be drawn on screen.' - } - } - }, - { - arguments = { + description = 'The filepath to a cubemap image file (or a File, FileData, or ImageData).', + }, { - type = 'ImageData', - name = 'imageData', - description = 'An ImageData object. The Image will use this ImageData to reload itself when love.window.setMode is called.' - } + type = 'table', + name = 'settings', + description = 'Optional table of settings to configure the cubemap image, containing the following fields:', + default = 'nil', + table = { + { + type = 'boolean', + name = 'mipmaps', + description = 'True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn\'t a compressed texture format.', + default = 'false', + }, + { + type = 'boolean', + name = 'linear', + description = 'True to treat the image\'s pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB.', + default = 'false', + }, + }, + }, }, returns = { { type = 'Image', name = 'image', - description = 'An Image object which can be drawn on screen.' - } - } - }, - { - arguments = { - { - type = 'CompressedImageData', - name = 'compressedImageData', - description = 'A CompressedImageData object. The Image will use this CompressedImageData to reload itself when love.window.setMode is called.' - } + description = 'An cubemap Image object.', + }, }, - returns = { - { - type = 'Image', - name = 'image', - description = 'An Image object which can be drawn on screen.' - } - } }, { + description = 'Creates a cubemap Image given a different image file for each cube face.', arguments = { { - type = 'string', - name = 'filename', - description = 'The filepath to the image file (or a FileData or ImageData or CompressedImageData object).' + type = 'table', + name = 'faces', + description = 'A table containing 6 filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each face image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the cube face index of that sub-table.', }, { type = 'table', - name = 'flags', - description = 'A table containing the following fields:', + name = 'settings', + description = 'Optional table of settings to configure the cubemap image, containing the following fields:', + default = 'nil', table = { { type = 'boolean', - name = 'linear', + name = 'mipmaps', + description = 'True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn\'t a compressed texture format.', default = 'false', - description = 'True if the image\'s pixels should be interpreted as being linear RGB rather than sRGB-encoded, if gamma-correct rendering is enabled. Has no effect otherwise.' }, { - type = 'boolean or table', - name = 'mipmaps', + type = 'boolean', + name = 'linear', + description = 'True to treat the image\'s pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB.', default = 'false', - description = 'If true, mipmaps for the image will be automatically generated (or taken from the images\'s file if possible, if the image originated from a CompressedImageData). If this value is a table, it should contain a list of other filenames of images of the same format that have progressively half-sized dimensions, all the way down to 1x1. Those images will be used as this Image\'s mipmap levels.' - } - } - } + }, + }, + }, }, returns = { { type = 'Image', name = 'image', - description = 'An Image object which can be drawn on screen.' - } - } - } - } + description = 'An cubemap Image object.', + }, + }, + }, + }, }, { - name = 'newImageFont', - description = 'Creates a new Font by loading a specifically formatted image.\n\nIn versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string.', - variants = { + name = 'newFont', + description = 'Creates a new Font from a TrueType Font or BMFont file. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object.\n\nAll variants which accept a filename can also accept a Data object instead.', + variants = { { + description = 'Create a new BMFont or TrueType font.\n\nIf the file is a TrueType font, it will be size 12. Use the variant below to create a TrueType font with a custom size.', arguments = { { type = 'string', name = 'filename', - description = 'The filepath to the image file.' + description = 'The filepath to the BMFont or TrueType font file.', }, - { - type = 'string', - name = 'glyphs', - description = 'A string of the characters in the image in order from left to right.' - } }, returns = { { type = 'Font', name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } + description = 'A Font object which can be used to draw text on screen.', + }, + }, }, { + description = 'Create a new TrueType font.', arguments = { { - type = 'ImageData', - name = 'imageData', - description = 'The ImageData object to create the font from.' + type = 'string', + name = 'filename', + description = 'The filepath to the TrueType font file.', }, { - type = 'string', - name = 'glyphs', - description = 'A string of the characters in the image in order from left to right.' - } + type = 'number', + name = 'size', + description = 'The size of the font in pixels.', + }, + { + type = 'HintingMode', + name = 'hinting', + description = 'True Type hinting mode.', + default = '\'normal\'', + }, }, returns = { { type = 'Font', name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } + description = 'A Font object which can be used to draw text on screen.', + }, + }, }, { + description = 'Create a new BMFont.', arguments = { { type = 'string', name = 'filename', - description = 'The filepath to the image file.' + description = 'The filepath to the BMFont file.', }, { type = 'string', - name = 'glyphs', - description = 'A string of the characters in the image in order from left to right.' + name = 'imagefilename', + description = 'The filepath to the BMFont\'s image file. If this argument is omitted, the path specified inside the BMFont file will be used.', }, - { - type = 'number', - name = 'extraspacing', - default = '0', - description = 'Additional spacing (positive or negative) to apply to each glyph in the Font.' - } }, returns = { { type = 'Font', name = 'font', - description = 'A Font object which can be used to draw text on screen.' - } - } - } - } - }, - { - name = 'newParticleSystem', - description = 'Creates a new ParticleSystem.', - variants = { + description = 'A Font object which can be used to draw text on screen.', + }, + }, + }, { + description = 'Create a new instance of the default font (Vera Sans) with a custom size.', arguments = { { - type = 'Texture', - name = 'texture', - description = 'The Image or Canvas to use.' + type = 'number', + name = 'size', + description = 'The size of the font in pixels.', + default = '12', }, { - type = 'number', - name = 'buffer', - default = '1000', - description = 'The max number of particles at the same time.' - } + type = 'HintingMode', + name = 'hinting', + description = 'True Type hinting mode.', + default = '\'normal\'', + }, }, returns = { { - type = 'ParticleSystem', - name = 'system', - description = 'A new ParticleSystem.' - } - } - } - } + type = 'Font', + name = 'font', + description = 'A Font object which can be used to draw text on screen.', + }, + }, + }, + }, }, { - name = 'newShader', - description = 'Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both.\n\nVertex shader code must contain at least one function, named position, which is the function that will produce transformed vertex positions of drawn objects in screen-space.\n\nPixel shader code must contain at least one function, named effect, which is the function that will produce the color which is blended onto the screen for each pixel a drawn object touches.', + name = 'newImage', + description = 'Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image.', variants = { { arguments = { { type = 'string', - name = 'code', - description = 'The pixel shader or vertex shader code, or a filename pointing to a file with the code.' - } + name = 'filename', + description = 'The filepath to the image file.', + }, }, returns = { { - type = 'Shader', - name = 'shader', - description = 'A Shader object for use in drawing operations.' - } - } + type = 'Image', + name = 'image', + description = 'An Image object which can be drawn on screen.', + }, + }, }, { arguments = { { - type = 'string', - name = 'pixelcode', - description = 'The pixel shader code, or a filename pointing to a file with the code.' + type = 'ImageData', + name = 'imageData', + description = 'An ImageData object. The Image will use this ImageData to reload itself when love.window.setMode is called.', }, - { - type = 'string', - name = 'vertexcode', - description = 'The vertex shader code, or a filename pointing to a file with the code.' - } }, returns = { { - type = 'Shader', - name = 'shader', - description = 'A Shader object for use in drawing operations.' - } - } - } - } - }, - { - name = 'newText', - description = 'Creates a new drawable Text object.', - variants = { + type = 'Image', + name = 'image', + description = 'An Image object which can be drawn on screen.', + }, + }, + }, { arguments = { { - type = 'Font', - name = 'font', - description = 'The font to use for the text.' + type = 'CompressedImageData', + name = 'compressedImageData', + description = 'A CompressedImageData object. The Image will use this CompressedImageData to reload itself when love.window.setMode is called.', }, - { - type = 'string', - name = 'textstring', - default = 'nil', - description = 'The initial string of text that the new Text object will contain. May be nil.' - } }, returns = { { - type = 'Text', - name = 'text', - description = 'The new drawable Text object.' - } - } - } - } - }, - { - name = 'newQuad', - description = 'Creates a new Quad.\n\nThe purpose of a Quad is to describe the result of the following transformation on any drawable object. The object is first scaled to dimensions sw * sh. The Quad then describes the rectangular area of dimensions width * height whose upper left corner is at position (x, y) inside the scaled object.', - variants = { + type = 'Image', + name = 'image', + description = 'An Image object which can be drawn on screen.', + }, + }, + }, { arguments = { { - type = 'number', - name = 'x', - description = 'The top-left position along the x-axis.' - }, - { - type = 'number', - name = 'y', - description = 'The top-left position along the y-axis.' - }, - { - type = 'number', - name = 'width', - description = 'The width of the Quad.' - }, - { - type = 'number', - name = 'height', - description = 'The height of the Quad.' + type = 'string', + name = 'filename', + description = 'The filepath to the image file (or a FileData or ImageData or CompressedImageData object).', }, { - type = 'number', - name = 'sw', - description = 'The reference width, the width of the Image.' + type = 'table', + name = 'flags', + description = 'A table containing the following fields:', + table = { + { + type = 'boolean', + name = 'linear', + description = 'True if the image\'s pixels should be interpreted as being linear RGB rather than sRGB-encoded, if gamma-correct rendering is enabled. Has no effect otherwise.', + default = 'false', + }, + { + type = 'boolean or table', + name = 'mipmaps', + description = 'If true, mipmaps for the image will be automatically generated (or taken from the images\'s file if possible, if the image originated from a CompressedImageData). If this value is a table, it should contain a list of other filenames of images of the same format that have progressively half-sized dimensions, all the way down to 1x1. Those images will be used as this Image\'s mipmap levels.', + default = 'false', + }, + }, }, - { - type = 'number', - name = 'sh', - description = 'The reference height, the height of the Image.' - } }, returns = { { - type = 'Quad', - name = 'quad', - description = 'The new Quad.' - } - } - } - } - }, - { - name = 'newSpriteBatch', - description = 'Creates a new SpriteBatch object.', - variants = { + type = 'Image', + name = 'image', + description = 'A new Image object which can be drawn on screen.', + }, + }, + }, { arguments = { { - type = 'Texture', - name = 'texture', - description = 'The Image or Canvas to use for the sprites.' + type = 'string', + name = 'filename', + description = 'The filepath to the image file (or a FileData or ImageData or CompressedImageData object.)', }, { - type = 'number', - name = 'maxsprites', - default = '1000', - description = 'The max number of sprites.' + type = 'TextureFormat', + name = 'format', + description = 'The format to interpret the image\'s data as.', }, - { - type = 'SpriteBatchUsage', - name = 'usage', - default = '"dynamic"', - description = 'The expected usage of the SpriteBatch. The specified usage mode affects the SpriteBatch\'s memory usage and performance.' - } }, returns = { { - type = 'SpriteBatch', - name = 'spriteBatch', - description = 'The new SpriteBatch.' - } - } - } - } + type = 'Image', + name = 'image', + description = 'An Image object which can be drawn on screen.', + }, + }, + }, + }, }, { - name = 'newVideo', - description = 'Creates a new drawable Video. Currently only Ogg Theora video files are supported.', + name = 'newImageFont', + description = 'Creates a new specifically formatted image.\n\nIn versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string.', variants = { { arguments = { { type = 'string', name = 'filename', - description = 'The file path to the Ogg Theora video file.' + description = 'The filepath to the image file.', }, { - type = 'boolean', - name = 'loadaudio', - default = 'nil', - description = 'Whether to try to load the video\'s audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio.' - } + type = 'string', + name = 'glyphs', + description = 'A string of the characters in the image in order from left to right.', + }, }, returns = { { - type = 'Video', - name = 'video', - description = 'A new Video.' - } - } + type = 'Font', + name = 'font', + description = 'A Font object which can be used to draw text on screen.', + }, + }, }, { arguments = { { - type = 'VideoStream', - name = 'videostream', - description = 'A video stream object.' + type = 'ImageData', + name = 'imageData', + description = 'The ImageData object to create the font from.', }, { - type = 'boolean', - name = 'loadaudio', - default = 'nil', - description = 'Whether to try to load the video\'s audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio.' - } + type = 'string', + name = 'glyphs', + description = 'A string of the characters in the image in order from left to right.', + }, }, returns = { { - type = 'Video', - name = 'video', - description = 'A new Video.' - } - } - } - } - }, - { - name = 'origin', - description = 'Resets the current coordinate transformation.\n\nThis function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults.', - variants = { - {} - } - }, - { - name = 'points', - description = 'Draws one or more points.', - variants = { + type = 'Font', + name = 'font', + description = 'A Font object which can be used to draw text on screen.', + }, + }, + }, { + description = 'Instead of using this function, consider using a BMFont generator such as bmfont, littera, or bmGlyph with love.graphics.newFont. Because slime said it was better.', arguments = { { - type = 'number', - name = 'x', - description = 'The position of the first point on the x-axis.' + type = 'string', + name = 'filename', + description = 'The filepath to the image file.', }, { - type = 'number', - name = 'y', - description = 'The position of the first point on the y-axis.' + type = 'string', + name = 'glyphs', + description = 'A string of the characters in the image in order from left to right.', }, { type = 'number', - name = '...', - description = 'The x and y coordinates of additional points.' - } - } + name = 'extraspacing', + description = 'Additional spacing (positive or negative) to apply to each glyph in the Font.', + }, + }, + returns = { + { + type = 'Font', + name = 'font', + description = 'A Font object which can be used to draw text on screen.', + }, + }, }, + }, + }, + { + name = 'newMesh', + description = 'Creates a new Mesh.\n\nUse Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it\'s drawn.\n\nIn versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.', + variants = { { + description = 'Creates a standard Mesh with the specified vertices.', arguments = { { type = 'table', - name = 'points', - description = 'A table containing multiple point positions, in the form of {x, y, ...}.', + name = 'vertices', + description = 'The table filled with vertex information tables for each vertex as follows:', table = { { type = 'number', - name = 'x', - description = 'The position of the first point on the x-axis.' + name = '1', + description = 'The position of the vertex on the x-axis.', }, { type = 'number', - name = 'y', - description = 'The position of the first point on the y-axis.' + name = '2', + description = 'The position of the vertex on the y-axis.', }, { type = 'number', - name = '...', - description = 'The x and y coordinates of additional points.' - } - } - } - } - }, - { - arguments = { - { - type = 'table', - name = 'points', - description = 'A table containing multiple individually colored points, in the form of {point, ...}. Each table contains the position and color of a point in the form of {x, y, r, g, b, a}. The color components are optional.', - table = { + name = '3', + description = 'The u texture coordinate of the vertex. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.)', + default = '0', + }, { - type = 'table', - name = 'point', - description = 'A table containing the position and color of the first point, in the form of {x, y, r, g, b, a}. The color components are optional.' + type = 'number', + name = '4', + description = 'The v texture coordinate of the vertex. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.)', + default = '0', + }, + { + type = 'number', + name = '5', + description = 'The red component of the vertex color.', + default = '1', + }, + { + type = 'number', + name = '6', + description = 'The green component of the vertex color.', + default = '1', + }, + { + type = 'number', + name = '7', + description = 'The blue component of the vertex color.', + default = '1', + }, + { + type = 'number', + name = '8', + description = 'The alpha component of the vertex color.', + default = '1', + }, + }, + }, + { + type = 'MeshDrawMode', + name = 'mode', + description = 'How the vertices are used when drawing. The default mode \'fan\' is sufficient for simple convex polygons.', + default = '\'fan\'', + }, + { + type = 'SpriteBatchUsage', + name = 'usage', + description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.', + default = '\'dynamic\'', + }, + }, + returns = { + { + type = 'Mesh', + name = 'mesh', + description = 'The new mesh.', + }, + }, + }, + { + description = 'Creates a standard Mesh with the specified number of vertices.\n\nMesh:setVertices or Mesh:setVertex and Mesh:setDrawRange can be used to specify vertex information once the Mesh is created.', + arguments = { + { + type = 'number', + name = 'vertexcount', + description = 'The total number of vertices the Mesh will use. Each vertex is initialized to {0,0, 0,0, 1,1,1,1}.', + }, + { + type = 'MeshDrawMode', + name = 'mode', + description = 'How the vertices are used when drawing. The default mode \'fan\' is sufficient for simple convex polygons.', + default = '\'fan\'', + }, + { + type = 'SpriteBatchUsage', + name = 'usage', + description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.', + default = '\'dynamic\'', + }, + }, + returns = { + { + type = 'Mesh', + name = 'mesh', + description = 'The new mesh.', + }, + }, + }, + { + description = 'Creates a Mesh with custom vertex attributes and the specified vertex data.\n\nThe values in each vertex table are in the same order as the vertex attributes in the specified vertex format. If no value is supplied for a specific vertex attribute component, it will be set to a default value of 0 if its data type is \'float\', or 1 if its data type is \'byte\'.\n\nIf the data type of an attribute is \'float\', components can be in the range 1 to 4, if the data type is \'byte\' it must be 4.\n\nIf a custom vertex attribute uses the name \'VertexPosition\', \'VertexTexCoord\', or \'VertexColor\', then the vertex data for that vertex attribute will be used for the standard vertex positions, texture coordinates, or vertex colors respectively, when drawing the Mesh. Otherwise a Vertex Shader is required in order to make use of the vertex attribute when the Mesh is drawn.\n\nA Mesh \'\'\'must\'\'\' have a \'VertexPosition\' attribute in order to be drawn, but it can be attached from a different Mesh via Mesh:attachAttribute.\n\nTo use a custom named vertex attribute in a Vertex Shader, it must be declared as an attribute variable of the same name. Variables can be sent from Vertex Shader code to Pixel Shader code by making a varying variable. For example:\n\n\'\'Vertex Shader code\'\'\n\nattribute vec2 CoolVertexAttribute;\n\nvarying vec2 CoolVariable;\n\nvec4 position(mat4 transform_projection, vec4 vertex_position)\n\n{\n\n CoolVariable = CoolVertexAttribute;\n\n return transform_projection * vertex_position;\n\n}\n\n\'\'Pixel Shader code\'\'\n\nvarying vec2 CoolVariable;\n\nvec4 effect(vec4 color, Image tex, vec2 texcoord, vec2 pixcoord)\n\n{\n\n vec4 texcolor = Texel(tex, texcoord + CoolVariable);\n\n return texcolor * color;\n\n}', + arguments = { + { + type = 'table', + name = 'vertexformat', + description = 'A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex.', + table = { + { + type = 'table', + name = 'attribute', + description = 'A table containing the attribute\'s name, it\'s data type, and the number of components in the attribute, in the form of {name, datatype, components}.', + }, + { + type = 'table', + name = '...', + description = 'Additional vertex attribute format tables.', + }, + }, + }, + { + type = 'table', + name = 'vertices', + description = 'The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}.', + table = { + { + type = 'number', + name = 'attributecomponent', + description = 'The first component of the first vertex attribute in the vertex.', + }, + { + type = 'number', + name = '...', + description = 'Additional components of all vertex attributes in the vertex.', + }, + }, + }, + { + type = 'MeshDrawMode', + name = 'mode', + description = 'How the vertices are used when drawing. The default mode \'fan\' is sufficient for simple convex polygons.', + default = '\'fan\'', + }, + { + type = 'SpriteBatchUsage', + name = 'usage', + description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.', + default = '\'dynamic\'', + }, + }, + returns = { + { + type = 'Mesh', + name = 'mesh', + description = 'The new mesh.', + }, + }, + }, + { + description = 'Creates a Mesh with custom vertex attributes and the specified number of vertices.\n\nEach vertex attribute component is initialized to 0 if its data type is \'float\', or 1 if its data type is \'byte\'. Vertex Shader is required in order to make use of the vertex attribute when the Mesh is drawn.\n\nA Mesh \'\'\'must\'\'\' have a \'VertexPosition\' attribute in order to be drawn, but it can be attached from a different Mesh via Mesh:attachAttribute.', + arguments = { + { + type = 'table', + name = 'vertexformat', + description = 'A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex.', + table = { + { + type = 'table', + name = 'attribute', + description = 'A table containing the attribute\'s name, it\'s data type, and the number of components in the attribute, in the form of {name, datatype, components}.', + }, + { + type = 'table', + name = '...', + description = 'Additional vertex attribute format tables.', + }, + }, + }, + { + type = 'number', + name = 'vertexcount', + description = 'The total number of vertices the Mesh will use.', + }, + { + type = 'MeshDrawMode', + name = 'mode', + description = 'How the vertices are used when drawing. The default mode \'fan\' is sufficient for simple convex polygons.', + default = '\'fan\'', + }, + { + type = 'SpriteBatchUsage', + name = 'usage', + description = 'The expected usage of the Mesh. The specified usage mode affects the Mesh\'s memory usage and performance.', + default = '\'dynamic\'', + }, + }, + returns = { + { + type = 'Mesh', + name = 'mesh', + description = 'The new mesh.', + }, + }, + }, + { + description = 'Mesh:setVertices or Mesh:setVertex and Mesh:setDrawRange can be used to specify vertex information once the Mesh is created.', + arguments = { + { + type = 'number', + name = 'vertexcount', + description = 'The total number of vertices the Mesh will use. Each vertex is initialized to {0,0, 0,0, 255,255,255,255}.', + }, + { + type = 'Texture', + name = 'texture', + description = 'The Image or Canvas to use when drawing the Mesh. May be nil to use no texture.', + default = 'nil', + }, + { + type = 'MeshDrawMode', + name = 'mode', + description = 'How the vertices are used when drawing. The default mode \'fan\' is sufficient for simple convex polygons.', + default = '\'fan\'', + }, + }, + returns = { + { + type = 'Mesh', + name = 'mesh', + description = 'The new mesh.', + }, + }, + }, + }, + }, + { + name = 'newParticleSystem', + description = 'Creates a new ParticleSystem.', + variants = { + { + arguments = { + { + type = 'Image', + name = 'image', + description = 'The image to use.', + }, + { + type = 'number', + name = 'buffer', + description = 'The max number of particles at the same time.', + default = '1000', + }, + }, + returns = { + { + type = 'ParticleSystem', + name = 'system', + description = 'A new ParticleSystem.', + }, + }, + }, + { + arguments = { + { + type = 'Texture', + name = 'texture', + description = 'The texture (Image or Canvas) to use.', + }, + { + type = 'number', + name = 'buffer', + description = 'The max number of particles at the same time.', + default = '1000', + }, + }, + returns = { + { + type = 'ParticleSystem', + name = 'system', + description = 'A new ParticleSystem.', + }, + }, + }, + }, + }, + { + name = 'newQuad', + description = 'Creates a new Quad.\n\nThe purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation.', + variants = { + { + arguments = { + { + type = 'number', + name = 'x', + description = 'The top-left position in the Image along the x-axis.', + }, + { + type = 'number', + name = 'y', + description = 'The top-left position in the Image along the y-axis.', + }, + { + type = 'number', + name = 'width', + description = 'The width of the Quad in the Image. (Must be greater than 0.)', + }, + { + type = 'number', + name = 'height', + description = 'The height of the Quad in the Image. (Must be greater than 0.)', + }, + { + type = 'number', + name = 'sw', + description = 'The reference width, the width of the Image. (Must be greater than 0.)', + }, + { + type = 'number', + name = 'sh', + description = 'The reference height, the height of the Image. (Must be greater than 0.)', + }, + }, + returns = { + { + type = 'Quad', + name = 'quad', + description = 'The new Quad.', + }, + }, + }, + }, + }, + { + name = 'newShader', + description = 'Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both.\n\nShaders are small programs which are run on the graphics card when drawing. Vertex shaders are run once for each vertex (for example, an image has 4 vertices - one at each corner. A Mesh might have many more.) Pixel shaders are run once for each pixel on the screen which the drawn object touches. Pixel shader code is executed after all the object\'s vertices have been processed by the vertex shader.', + variants = { + { + arguments = { + { + type = 'string', + name = 'code', + description = 'The pixel shader or vertex shader code, or a filename pointing to a file with the code.', + }, + }, + returns = { + { + type = 'Shader', + name = 'shader', + description = 'A Shader object for use in drawing operations.', + }, + }, + }, + { + description = 'Vertex shader code is run for every vertex drawn to the screen (for example, love.graphics.rectangle will produce 4 vertices) and is used to transform the vertex positions from their original coordinates into screen-space, as well as to send information such as per-vertex color and texture coordinate values to the pixel shader.\n\nPixel shader code is run for every pixel on the screen that a drawn object touches, and is used to produce the color that will be blended onto the screen at that pixel, often by reading from an image. Pixel shaders are sometimes called fragment shaders.\n\nThe varying keyword can be used to set a value in the vertex shader and have it interpolated in between vertices and passed down to the pixel shader.\n\nVertex and Pixel shader code can be combined into one file or string if you wrap the vertex-specific code in #ifdef VERTEX .. #endif and the pixel-specific code in #ifdef PIXEL .. #endif.\n\n== Built-in variables ==\n\nLÖVE provides several built-in variables for both pixel and vertex shaders. The full list can be found here: Shader Variables.', + arguments = { + { + type = 'mat4', + name = 'transform_projection', + description = 'The transformation matrix affected by love.graphics.translate and friends combined with the orthographic projection matrix.', + }, + { + type = 'vec4', + name = 'vertex_position', + description = 'The raw un-transformed position of the current vertex.', + }, + }, + returns = { + { + type = 'vec4', + name = 'output_pos', + description = 'The final transformed position of the current vertex.', + }, + }, + }, + }, + }, + { + name = 'newSpriteBatch', + description = 'Creates a new SpriteBatch object.', + variants = { + { + arguments = { + { + type = 'Image', + name = 'image', + description = 'The Image to use for the sprites.', + }, + { + type = 'number', + name = 'maxsprites', + description = 'The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch.', + default = '1000', + }, + }, + returns = { + { + type = 'SpriteBatch', + name = 'spriteBatch', + description = 'The new SpriteBatch.', + }, + }, + }, + { + arguments = { + { + type = 'Image', + name = 'image', + description = 'The Image to use for the sprites.', + }, + { + type = 'number', + name = 'maxsprites', + description = 'The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch.', + default = '1000', + }, + { + type = 'SpriteBatchUsage', + name = 'usage', + description = 'The expected usage of the SpriteBatch. The specified usage mode affects the SpriteBatch\'s memory usage and performance.', + default = '\'dynamic\'', + }, + }, + returns = { + { + type = 'SpriteBatch', + name = 'spriteBatch', + description = 'The new SpriteBatch.', + }, + }, + }, + { + arguments = { + { + type = 'Texture', + name = 'texture', + description = 'The Image or Canvas to use for the sprites.', + }, + { + type = 'number', + name = 'maxsprites', + description = 'The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch.', + default = '1000', + }, + { + type = 'SpriteBatchUsage', + name = 'usage', + description = 'The expected usage of the SpriteBatch. The specified usage mode affects the SpriteBatch\'s memory usage and performance.', + default = '\'dynamic\'', + }, + }, + returns = { + { + type = 'SpriteBatch', + name = 'spriteBatch', + description = 'The new SpriteBatch.', + }, + }, + }, + }, + }, + { + name = 'newText', + description = 'Creates a new drawable Text object.', + variants = { + { + arguments = { + { + type = 'Font', + name = 'font', + description = 'The font to use for the text.', + }, + { + type = 'string', + name = 'textstring', + description = 'The initial string of text that the new Text object will contain. May be nil.', + default = 'nil', + }, + }, + returns = { + { + type = 'Text', + name = 'text', + description = 'The new drawable Text object.', + }, + }, + }, + }, + }, + { + name = 'newVideo', + description = 'Creates a new drawable Video. Currently only Ogg Theora video files are supported.', + variants = { + { + arguments = { + { + type = 'string', + name = 'filename', + description = 'The file path to the Ogg Theora video file.', + }, + }, + returns = { + { + type = 'Video', + name = 'video', + description = 'A new Video.', + }, + }, + }, + { + arguments = { + { + type = 'VideoStream', + name = 'videostream', + description = 'A video stream object.', + }, + }, + returns = { + { + type = 'Video', + name = 'video', + description = 'A new Video.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'filename', + description = 'The file path to the Ogg Theora video file (or VideoStream).', + }, + { + type = 'table', + name = 'settings', + description = 'A table containing the following fields:', + table = { + { + type = 'boolean', + name = 'audio', + description = 'Whether to try to load the video\'s audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio.', + default = 'false', + }, + { + type = 'number', + name = 'dpiscale', + description = 'The DPI scale factor of the video.', + default = 'love.graphics.getDPIScale()', + }, + }, + }, + }, + returns = { + { + type = 'Video', + name = 'video', + description = 'A new Video.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'filename', + description = 'The file path to the Ogg Theora video file.', + }, + { + type = 'boolean', + name = 'loadaudio', + description = 'Whether to try to load the video\'s audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio.', + default = 'nil', + }, + }, + returns = { + { + type = 'Video', + name = 'video', + description = 'A new Video.', + }, + }, + }, + { + arguments = { + { + type = 'VideoStream', + name = 'videostream', + description = 'A video stream object.', + }, + { + type = 'boolean', + name = 'loadaudio', + description = 'Whether to try to load the video\'s audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio.', + default = 'nil', + }, + }, + returns = { + { + type = 'Video', + name = 'video', + description = 'A new Video.', + }, + }, + }, + }, + }, + { + name = 'newVolumeImage', + description = 'Creates a new volume (3D) Image.\n\nVolume images are 3D textures with width, height, and depth. They can\'t be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send).\n\nTo use a volume image in a Shader, it must be declared as a VolumeImage or sampler3D type (instead of Image or sampler2D). The Texel(VolumeImage image, vec3 texcoords) shader function must be used to get pixel colors from the volume image. The vec3 argument is a normalized texture coordinate with the z component representing the depth to sample at (ranging from 1).\n\nVolume images are typically used as lookup tables in shaders for color grading, for example, because sampling using a texture coordinate that is partway in between two pixels can interpolate across all 3 dimensions in the volume image, resulting in a smooth gradient even when a small-sized volume image is used as the lookup table.\n\nArray images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them.', + variants = { + { + description = 'Creates a volume Image given multiple image files with matching dimensions.\n\nVolume images are not supported on some older mobile devices. Use love.graphics.getTextureTypes to check at runtime.', + arguments = { + { + type = 'table', + name = 'layers', + description = 'A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap.', + }, + { + type = 'table', + name = 'settings', + description = 'Optional table of settings to configure the volume image, containing the following fields:', + default = 'nil', + table = { + { + type = 'boolean', + name = 'mipmaps', + description = 'True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn\'t a compressed texture format.', + default = 'false', + }, + { + type = 'boolean', + name = 'linear', + description = 'True to treat the image\'s pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB.', + default = 'false', + }, + }, + }, + }, + returns = { + { + type = 'Image', + name = 'image', + description = 'A volume Image object.', + }, + }, + }, + }, + }, + { + name = 'origin', + description = 'Resets the current coordinate transformation.\n\nThis function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults.', + variants = { + { + }, + }, + }, + { + name = 'points', + description = 'Draws one or more points.', + variants = { + { + arguments = { + { + type = 'number', + name = 'x', + description = 'The position of the first point on the x-axis.', + }, + { + type = 'number', + name = 'y', + description = 'The position of the first point on the y-axis.', + }, + { + type = 'number', + name = '...', + description = 'The x and y coordinates of additional points.', + }, + }, + }, + { + arguments = { + { + type = 'table', + name = 'points', + description = 'A table containing multiple point positions, in the form of {x, y, ...}.', + table = { + { + type = 'number', + name = 'x', + description = 'The position of the first point on the x-axis.', + }, + { + type = 'number', + name = 'y', + description = 'The position of the first point on the y-axis.', + }, + { + type = 'number', + name = '...', + description = 'The x and y coordinates of additional points.', + }, + }, + }, + }, + }, + { + description = 'Draws one or more individually colored points.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.\n\nThe pixel grid is actually offset to the center of each pixel. So to get clean pixels drawn use 0.5 + integer increments.\n\nPoints are not affected by size is always in pixels.', + arguments = { + { + type = 'table', + name = 'points', + description = 'A table containing multiple individually colored points, in the form of {point, ...}.', + table = { + { + type = 'table', + name = 'point', + description = 'A table containing the position and color of the first point, in the form of {x, y, r, g, b, a}. The color components are optional.', + }, + { + type = 'table', + name = '...', + description = 'Additional tables containing the position and color of more points, in the form of {x, y, r, g, b, a}. The color components are optional.', + }, + }, + }, + }, + }, + }, + }, + { + name = 'polygon', + description = 'Draw a polygon.\n\nFollowing the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon\'s vertices.', + variants = { + { + arguments = { + { + type = 'DrawMode', + name = 'mode', + description = 'How to draw the polygon.', + }, + { + type = 'number', + name = '...', + description = 'The vertices of the polygon.', + }, + }, + }, + { + arguments = { + { + type = 'DrawMode', + name = 'mode', + description = 'How to draw the polygon.', + }, + { + type = 'table', + name = 'vertices', + description = 'The vertices of the polygon as a table.', + }, + }, + }, + }, + }, + { + name = 'pop', + description = 'Pops the current coordinate transformation from the transformation stack.\n\nThis function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push.', + variants = { + { + }, + }, + }, + { + name = 'present', + description = 'Displays the results of drawing operations on the screen.\n\nThis function is used when writing your own love.run function. It presents all the results of your drawing operations on the screen. See the example in love.run for a typical use of this function.', + variants = { + { + description = '* If love.window.setMode has vsync equal to true, this function can\'t run more frequently than the refresh rate (e.g. 60 Hz), and will halt the program until ready if necessary.', + }, + }, + }, + { + name = 'print', + description = 'Draws text on screen. If no Font is set, one will be created and set (once) if needed.\n\nAs of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don\'t script with this in mind, the text won\'t be in the right position, or possibly even on screen.\n\nlove.graphics.print and love.graphics.printf both support UTF-8 encoding. You\'ll also need a proper Font for special characters.\n\nIn versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.', + variants = { + { + arguments = { + { + type = 'string', + name = 'text', + description = 'The text to draw.', + }, + { + type = 'number', + name = 'x', + description = 'The position to draw the object (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The position to draw the object (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'r', + description = 'Orientation (radians).', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor (x-axis).', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor (y-axis).', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing factor (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing factor (y-axis).', + default = '0', + }, + }, + }, + { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text.', + arguments = { + { + type = 'table', + name = 'coloredtext', + description = 'A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.', + table = { + { + type = 'table', + name = 'color1', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string1', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'table', + name = 'color2', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string2', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'tables and strings', + name = '...', + description = 'Additional colors and strings.', + }, + }, + }, + { + type = 'number', + name = 'x', + description = 'The position of the text on the x-axis.', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The position of the text on the y-axis.', + default = '0', + }, + { + type = 'number', + name = 'angle', + description = 'The orientation of the text in radians.', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor on the x-axis.', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor on the y-axis.', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset on the x-axis.', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset on the y-axis.', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing / skew factor on the x-axis.', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing / skew factor on the y-axis.', + default = '0', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'text', + description = 'The text to draw.', + }, + { + type = 'Transform', + name = 'transform', + description = 'Transformation object.', + }, + }, + }, + { + description = '', + arguments = { + { + type = 'table', + name = 'coloredtext', + description = 'A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.', + table = { + { + type = 'table', + name = 'color1', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string1', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'table', + name = 'color2', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string2', + description = 'A string of text which has a color specified by the previous color.', }, { - type = 'table', + type = 'tables and strings', name = '...', - description = 'Additional tables containing the position and color of more points, in the form of {x, y, r, g, b, a}. The color components are optional.' - } - } - } - } - } - } + description = 'Additional colors and strings.', + }, + }, + }, + { + type = 'Transform', + name = 'transform', + description = 'Transformation object.', + }, + }, + }, + }, }, { - name = 'polygon', - description = 'Draw a polygon.\n\nFollowing the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon\'s vertices.\n\nWhen in fill mode, the polygon must be convex and simple or rendering artifacts may occur.', + name = 'printf', + description = 'Draws formatted text, with word wrap and alignment.\n\nSee additional notes in love.graphics.print.\n\nThe word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change.\n\nIn version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case.\n\nIn versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the polygon.' + type = 'string', + name = 'text', + description = 'A text string.', }, { type = 'number', - name = '...', - description = 'The vertices of the polygon.' - } - } - }, - { - arguments = { + name = 'x', + description = 'The position on the x-axis.', + }, { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the polygon.' + type = 'number', + name = 'y', + description = 'The position on the y-axis.', }, { - type = 'table', - name = 'vertices', - description = 'The vertices of the polygon as a table.' - } - } - } - } - }, - { - name = 'pop', - description = 'Pops the current coordinate transformation from the transformation stack.\n\nThis function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push. For an example, see the description of love.graphics.push.', - variants = { - {} - } - }, - { - name = 'present', - description = 'Displays the results of drawing operations on the screen.\n\nThis function is used when writing your own love.run function. It presents all the results of your drawing operations on the screen. See the example in love.run for a typical use of this function.', - variants = { - {} - } - }, - { - name = 'print', - description = 'Draws text on screen. If no Font is set, one will be created and set (once) if needed.\n\nAs of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don\'t script with this in mind, the text won\'t be in the right position, or possibly even on screen.\n\nlove.graphics.print and love.graphics.printf both support UTF-8 encoding. You\'ll also need a proper Font for special characters.\n\nIn versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.', - variants = { + type = 'number', + name = 'limit', + description = 'Wrap the line after this many horizontal pixels.', + }, + { + type = 'AlignMode', + name = 'align', + description = 'The alignment.', + default = '\'left\'', + }, + { + type = 'number', + name = 'r', + description = 'Orientation (radians).', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor (x-axis).', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor (y-axis).', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing factor (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing factor (y-axis).', + default = '0', + }, + }, + }, { arguments = { { type = 'string', name = 'text', - description = 'The text to draw.' + description = 'A text string.', + }, + { + type = 'Font', + name = 'font', + description = 'The Font object to use.', }, { type = 'number', name = 'x', - default = '0', - description = 'The position to draw the object (x-axis).' + description = 'The position on the x-axis.', }, { type = 'number', name = 'y', - default = '0', - description = 'The position to draw the object (y-axis).' + description = 'The position on the y-axis.', + }, + { + type = 'number', + name = 'limit', + description = 'Wrap the line after this many horizontal pixels.', + }, + { + type = 'AlignMode', + name = 'align', + description = 'The alignment.', + default = '\'left\'', }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shear factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shear factor (y-axis).' - } - } + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'text', + description = 'A text string.', + }, + { + type = 'Transform', + name = 'transform', + description = 'Transformation object.', + }, + { + type = 'number', + name = 'limit', + description = 'Wrap the line after this many horizontal pixels.', + }, + { + type = 'AlignMode', + name = 'align', + description = 'The alignment.', + default = '\'left\'', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'text', + description = 'A text string.', + }, + { + type = 'Font', + name = 'font', + description = 'The Font object to use.', + }, + { + type = 'Transform', + name = 'transform', + description = 'Transformation object.', + }, + { + type = 'number', + name = 'limit', + description = 'Wrap the line after this many horizontal pixels.', + }, + { + type = 'AlignMode', + name = 'align', + description = 'The alignment.', + default = '\'left\'', + }, + }, }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text.', arguments = { { type = 'table', @@ -2464,165 +3521,201 @@ return { { type = 'table', name = 'color1', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string1', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'table', name = 'color2', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string2', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'tables and strings', name = '...', - description = 'Additional colors and strings.' - } - } + description = 'Additional colors and strings.', + }, + }, }, { type = 'number', name = 'x', - default = '0', - description = 'The position of the new text on the x-axis.' + description = 'The position of the text (x-axis).', }, { type = 'number', name = 'y', - default = '0', - description = 'The position of the new text on the y-axis.' + description = 'The position of the text (y-axis).', + }, + { + type = 'number', + name = 'limit', + description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.', + }, + { + type = 'AlignMode', + name = 'align', + description = 'The alignment of the text.', }, { type = 'number', name = 'angle', + description = 'Orientation (radians).', default = '0', - description = 'The orientation of the object in radians.' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor on the x-axis.' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor on the y-axis.' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset on the x-axis.' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset on the y-axis.' }, { type = 'number', name = 'kx', + description = 'Shearing / skew factor (x-axis).', default = '0', - description = 'Shearing / skew factor on the x-axis.' }, { type = 'number', name = 'ky', + description = 'Shearing / skew factor (y-axis).', default = '0', - description = 'Shearing / skew factor on the y-axis.' - } - } - } - } - }, - { - name = 'printf', - description = 'Draws formatted text, with word wrap and alignment.\n\nSee additional notes in love.graphics.print.\n\nIn version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case.', - variants = { + }, + }, + }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text.', arguments = { { - type = 'string', - name = 'text', - description = 'A text string.' + type = 'table', + name = 'coloredtext', + description = 'A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.', + table = { + { + type = 'table', + name = 'color1', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string1', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'table', + name = 'color2', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string2', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'tables and strings', + name = '...', + description = 'Additional colors and strings.', + }, + }, + }, + { + type = 'Font', + name = 'font', + description = 'The Font object to use.', }, { type = 'number', name = 'x', - description = 'The position on the x-axis.' + description = 'The position on the x-axis.', }, { type = 'number', name = 'y', - description = 'The position on the y-axis.' + description = 'The position on the y-axis.', }, { type = 'number', name = 'limit', - description = 'Wrap the line after this many horizontal pixels.' + description = 'Wrap the line after this many horizontal pixels.', }, { type = 'AlignMode', name = 'align', - default = '"left"', - description = 'The alignment.' + description = 'The alignment.', + default = '\'left\'', }, { type = 'number', - name = 'r', + name = 'angle', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shearing factor (x-axis).', default = '0', - description = 'Shear factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shearing factor (y-axis).', default = '0', - description = 'Shear factor (y-axis).' - } - } + }, + }, }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text.', arguments = { { type = 'table', @@ -2632,111 +3725,126 @@ return { { type = 'table', name = 'color1', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string1', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'table', name = 'color2', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string2', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'tables and strings', name = '...', - description = 'Additional colors and strings.' - } - } - }, - { - type = 'number', - name = 'x', - description = 'The position of the new text on the x-axis.' + description = 'Additional colors and strings.', + }, + }, }, { - type = 'number', - name = 'y', - description = 'The position of the new text on the y-axis.' + type = 'Transform', + name = 'transform', + description = 'Transformation object.', }, { type = 'number', - name = 'wraplimit', - description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.' + name = 'limit', + description = 'Wrap the line after this many horizontal pixels.', }, { type = 'AlignMode', name = 'align', - description = 'The alignment of the text.' - }, - { - type = 'number', - name = 'angle', - default = '0', - description = 'The orientation of the object in radians.' + description = 'The alignment.', + default = '\'left\'', }, + }, + }, + { + description = '', + arguments = { { - type = 'number', - name = 'sx', - default = '1', - description = 'Scale factor on the x-axis.' + type = 'table', + name = 'coloredtext', + description = 'A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.', + table = { + { + type = 'table', + name = 'color1', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string1', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'table', + name = 'color2', + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', + }, + { + type = 'string', + name = 'string2', + description = 'A string of text which has a color specified by the previous color.', + }, + { + type = 'tables and strings', + name = '...', + description = 'Additional colors and strings.', + }, + }, }, { - type = 'number', - name = 'sy', - default = 'sx', - description = 'Scale factor on the y-axis.' + type = 'Font', + name = 'font', + description = 'The Font object to use.', }, { - type = 'number', - name = 'ox', - default = '0', - description = 'Origin offset on the x-axis.' + type = 'Transform', + name = 'transform', + description = 'Transformation object.', }, { type = 'number', - name = 'oy', - default = '0', - description = 'Origin offset on the y-axis.' + name = 'limit', + description = 'Wrap the line after this many horizontal pixels.', }, { - type = 'number', - name = 'kx', - default = '0', - description = 'Shearing / skew factor on the x-axis.' + type = 'AlignMode', + name = 'align', + description = 'The alignment.', + default = '\'left\'', }, - { - type = 'number', - name = 'ky', - default = '0', - description = 'Shearing / skew factor on the y-axis.' - } - } - } - } + }, + }, + }, }, { name = 'push', description = 'Copies and pushes the current coordinate transformation to the transformation stack.\n\nThis function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push.', variants = { { + description = 'Pushes the current transformation to the transformation stack.', + }, + { + description = 'Pushes a specific type of state to the stack.', arguments = { { type = 'StackType', name = 'stack', - default = '"transform"', - description = 'The type of stack to push (e.g. just transformation state, or all love.graphics state).' + description = 'The type of stack to push (e.g. just transformation state, or all love.graphics state).', }, - } - } - } + }, + }, + }, }, { name = 'rectangle', @@ -2747,29 +3855,29 @@ return { { type = 'DrawMode', name = 'mode', - description = 'How to draw the rectangle.' + description = 'How to draw the rectangle.', }, { type = 'number', name = 'x', - description = 'The position of top-left corner along the x-axis.' + description = 'The position of top-left corner along the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of top-left corner along the y-axis.' + description = 'The position of top-left corner along the y-axis.', }, { type = 'number', name = 'width', - description = 'Width of the rectangle.' + description = 'Width of the rectangle.', }, { type = 'number', name = 'height', - description = 'Height of the rectangle.' - } - } + description = 'Height of the rectangle.', + }, + }, }, { description = 'Draws a rectangle with rounded corners.', @@ -2777,48 +3885,48 @@ return { { type = 'DrawMode', name = 'mode', - description = 'How to draw the rectangle.' + description = 'How to draw the rectangle.', }, { type = 'number', name = 'x', - description = 'The position of top-left corner along the x-axis.' + description = 'The position of top-left corner along the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of top-left corner along the y-axis.' + description = 'The position of top-left corner along the y-axis.', }, { type = 'number', name = 'width', - description = 'Width of the rectangle.' + description = 'Width of the rectangle.', }, { type = 'number', name = 'height', - description = 'Height of the rectangle.' + description = 'Height of the rectangle.', }, { type = 'number', name = 'rx', - description = 'The x-axis radius of each round corner. Cannot be greater than half the rectangle\'s width.' + description = 'The x-axis radius of each round corner. Cannot be greater than half the rectangle\'s width.', }, { type = 'number', name = 'ry', + description = 'The y-axis radius of each round corner. Cannot be greater than half the rectangle\'s height.', default = 'rx', - description = 'The y-axis radius of each round corner. Cannot be greater than half the rectangle\'s height.' }, { type = 'number', name = 'segments', + description = 'The number of segments used for drawing the round corners. A default amount will be chosen if no number is given.', default = 'nil', - description = 'The number of segments used for drawing the round corners. A default amount will be chosen if no number is given.' - } - } - } - } + }, + }, + }, + }, }, { name = 'replaceTransform', @@ -2829,54 +3937,55 @@ return { { type = 'Transform', name = 'transform', - description = 'The Transform object to replace the current graphics coordinate transform with.' - } - } - } - } + description = 'The Transform object to replace the current graphics coordinate transform with.', + }, + }, + }, + }, }, { name = 'reset', - description = 'Resets the current graphics settings.\n\nCalling reset makes the current drawing color white, the current background color black, resets any active Canvas or Shader, and removes any scissor settings. It sets the BlendMode to alpha. It also sets both the point and line drawing modes to smooth and their sizes to 1.0.', + description = 'Resets the current graphics settings.\n\nCalling reset makes the current drawing color white, the current background color black, disables any active color component masks, disables wireframe mode and resets the current graphics transformation to the origin. It also sets both the point and line drawing modes to smooth and their sizes to 1.0.', variants = { - {} - } + { + }, + }, }, { name = 'rotate', - description = 'Rotates the coordinate system in two dimensions.\n\nCalling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw exits.', + description = 'Rotates the coordinate system in two dimensions.\n\nCalling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw() exits.', variants = { { arguments = { { type = 'number', name = 'angle', - description = 'The amount to rotate the coordinate system in radians.' - } - } - } - } + description = 'The amount to rotate the coordinate system in radians.', + }, + }, + }, + }, }, { name = 'scale', - description = 'Scales the coordinate system in two dimensions.\n\nBy default the coordinate system in LÖVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation.\n\nAfter scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation.\n\nScale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.\n\nScaling lasts until love.draw exits.', + description = 'Scales the coordinate system in two dimensions.\n\nBy default the coordinate system in LÖVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation.\n\nAfter scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation.\n\nScale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.\n\nScaling lasts until love.draw() exits.', variants = { { arguments = { { type = 'number', name = 'sx', - description = 'The scaling in the direction of the x-axis.' + description = 'The scaling in the direction of the x-axis.', }, { type = 'number', name = 'sy', + description = 'The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx.', default = 'sx', - description = 'The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setBackgroundColor', @@ -2886,37 +3995,32 @@ return { arguments = { { type = 'number', - name = 'r', - description = 'The red component (0-1).' + name = 'red', + description = 'The red component (0-1).', }, { type = 'number', - name = 'g', - description = 'The green component (0-1).' + name = 'green', + description = 'The green component (0-1).', }, { type = 'number', - name = 'b', - description = 'The blue component (0-1).' + name = 'blue', + description = 'The blue component (0-1).', }, { type = 'number', - name = 'a', + name = 'alpha', + description = 'The alpha component (0-1).', default = '1', - description = 'The alpha component (0-1).' - } - } + }, + }, }, { - arguments = { - { - type = 'table', - name = 'rgba', - description = 'A numerical indexed table with the red, green and blue values as numbers. Alpha is 1 if it is not in the table' - } - } - } - } + }, + { + }, + }, }, { name = 'setBlendMode', @@ -2927,108 +4031,183 @@ return { { type = 'BlendMode', name = 'mode', - description = 'The blend mode to use.' - } - } + description = 'The blend mode to use.', + }, + }, }, { + description = 'The default \'alphamultiply\' alpha mode should normally be preferred except when drawing content with pre-multiplied alpha. If content is drawn to a Canvas using the \'alphamultiply\' mode, the Canvas texture will have pre-multiplied alpha afterwards, so the \'premultiplied\' alpha mode should generally be used when drawing a Canvas to the screen.', arguments = { { type = 'BlendMode', name = 'mode', - description = 'The blend mode to use.' + description = 'The blend mode to use.', }, { type = 'BlendAlphaMode', name = 'alphamode', - default = '"alphamultiply"', - description = 'What to do with the alpha of drawn objects when blending.' - } - } - } - } + description = 'What to do with the alpha of drawn objects when blending.', + default = '\'alphamultiply\'', + }, + }, + }, + }, }, { name = 'setCanvas', description = 'Captures drawing operations to a Canvas.', variants = { { - description = 'Sets the render target to a specified Canvas. All drawing operations until the next love.graphics.setCanvas call will be redirected to the Canvas and not shown on the screen.', + description = 'Sets the render target to a specified stencil or depth testing with an active Canvas, the stencil buffer or depth buffer must be explicitly enabled in setCanvas via the variants below.\n\nNote that no canvas should be active when \'\'love.graphics.present\'\' is called. \'\'love.graphics.present\'\' is called at the end of love.draw in the default love.run, hence if you activate a canvas using this function, you normally need to deactivate it at some point before \'\'love.draw\'\' finishes.', arguments = { { type = 'Canvas', name = 'canvas', - description = 'A render target.' - } - } + description = 'The new target.', + }, + { + type = 'number', + name = 'mipmap', + description = 'The mipmap level to render to, for Canvases with mipmaps.', + default = '1', + }, + }, }, { - description = 'Resets the render target to the screen, i.e. re-enables drawing to the screen.' + description = 'Resets the render target to the screen, i.e. re-enables drawing to the screen.', }, { - description = 'Sets the render target to multiple simultaneous Canvases. All drawing operations until the next love.graphics.setCanvas call will be redirected to the specified canvases and not shown on the screen.', + description = 'Sets the render target to multiple simultaneous 2D Canvases. All drawing operations until the next \'\'love.graphics.setCanvas\'\' call will be redirected to the specified canvases and not shown on the screen.\n\nNormally all drawing operations will draw only to the first canvas passed to the function, but that can be changed if a pixel shader is used with the void effect function instead of the regular vec4 effect.\n\nAll canvas arguments must have the same widths and heights and the same texture type. Not all computers which support Canvases will support multiple render targets. If love.graphics.isSupported(\'multicanvas\') returns true, at least 4 simultaneously active canvases are supported.', arguments = { { type = 'Canvas', name = 'canvas1', - description = 'The first render target.' + description = 'The first render target.', }, { type = 'Canvas', name = 'canvas2', - description = 'The second render target.' + description = 'The second render target.', }, { type = 'Canvas', name = '...', - description = 'More canvases.' - } - } - } - } + description = 'More canvases.', + }, + }, + }, + { + description = 'Sets the render target to the specified layer/slice and mipmap level of the given non-2D Canvas. All drawing operations until the next \'\'love.graphics.setCanvas\'\' call will be redirected to the Canvas and not shown on the screen.', + arguments = { + { + type = 'Canvas', + name = 'canvas', + description = 'The new render target.', + }, + { + type = 'number', + name = 'slice', + description = 'For cubemaps this is the cube face index to render to (between 1 and 6). For Array textures this is the array layer. For volume textures this is the depth slice. 2D canvases should use a value of 1.', + }, + { + type = 'number', + name = 'mipmap', + description = 'The mipmap level to render to, for Canvases with mipmaps.', + default = '1', + }, + }, + }, + { + description = 'Sets the active render target(s) and active stencil and depth buffers based on the specified setup information. All drawing operations until the next \'\'love.graphics.setCanvas\'\' call will be redirected to the specified Canvases and not shown on the screen.\n\nThe RenderTargetSetup parameters can either be a Canvas|[1]|The Canvas to use for this active render target.}}\n\n{{param|number|mipmap (1)|The mipmap level to render to, for Canvases with [[Texture:getMipmapCount|mipmaps.}}\n\n{{param|number|layer (1)|Only used for Volume and Array-type Canvases. For Array textures this is the array layer to render to. For volume textures this is the depth slice.}}\n\n{{param|number|face (1)|Only used for Cubemap-type Canvases. The cube face index to render to (between 1 and 6)}}', + arguments = { + { + type = 'table', + name = 'setup', + description = 'A table specifying the active Canvas(es), their mipmap levels and active layers if applicable, and whether to use a stencil and/or depth buffer.', + table = { + { + type = 'RenderTargetSetup', + name = '1', + description = 'The Canvas to render to.', + }, + { + type = 'RenderTargetSetup', + name = '2', + description = 'An additional Canvas to render to, if multiple simultaneous render targets are wanted.', + default = 'nil', + }, + { + type = 'RenderTargetSetup', + name = '...', + description = 'Additional Canvases to render to, if multiple simultaneous render targets are wanted.', + }, + { + type = 'boolean', + name = 'stencil', + description = 'Whether an internally managed stencil buffer should be used, if the depthstencil field isn\'t set.', + default = 'false', + }, + { + type = 'boolean', + name = 'depth', + description = 'Whether an internally managed depth buffer should be used, if the depthstencil field isn\'t set.', + default = 'false', + }, + { + type = 'RenderTargetSetup', + name = 'depthstencil', + description = 'An optional custom depth/stencil formatted Canvas to use for the depth and/or stencil buffer.', + default = 'nil', + }, + }, + }, + }, + }, + }, }, { name = 'setColor', - description = 'Sets the color used for drawing.', + description = 'Sets the color used for drawing.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { type = 'number', name = 'red', - description = 'The amount of red.' + description = 'The amount of red.', }, { type = 'number', name = 'green', - description = 'The amount of green.' + description = 'The amount of green.', }, { type = 'number', name = 'blue', - description = 'The amount of blue.' + description = 'The amount of blue.', }, { type = 'number', name = 'alpha', - description = 'The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image.' - } - } + description = 'The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image.', + default = '1', + }, + }, }, { arguments = { { type = 'table', name = 'rgba', - description = 'A numerical indexed table with the red, green, blue and alpha values as numbers. The alpha is optional and defaults to 1 if it is left out.' - } - } - } - } + description = 'A numerical indexed table with the red, green, blue and alpha values as numbers. The alpha is optional and defaults to 1 if it is left out.', + }, + }, + }, + }, }, { name = 'setColorMask', - description = 'Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if red is set to false, no further changes will be made to the red component of any pixels.\n\nEnables all color components when called without arguments.', + description = 'Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if \'\'\'red\'\'\' is set to \'\'\'false\'\'\', no further changes will be made to the red component of any pixels.', variants = { { description = 'Enables color masking for the specified color components.', @@ -3036,56 +4215,56 @@ return { { type = 'boolean', name = 'red', - description = 'Render red component.' + description = 'Render red component.', }, { type = 'boolean', name = 'green', - description = 'Render green component.' + description = 'Render green component.', }, { type = 'boolean', name = 'blue', - description = 'Render blue component.' + description = 'Render blue component.', }, { type = 'boolean', name = 'alpha', - description = 'Render alpha component.' - } - } + description = 'Render alpha component.', + }, + }, }, { - description = 'Disables color masking.' - } - } + description = 'Disables color masking.', + }, + }, }, { name = 'setDefaultFilter', - description = 'Sets the default scaling filters used with Images, Canvases, and Fonts.\n\nThis function does not apply retroactively to loaded images.', + description = 'Sets the default scaling filters used with Images, Canvases, and Fonts.', variants = { { + description = 'This function does not apply retroactively to loaded images.', arguments = { { type = 'FilterMode', name = 'min', - description = 'Filter mode used when scaling the image down.' + description = 'Filter mode used when scaling the image down.', }, { type = 'FilterMode', name = 'mag', - default = 'min', - description = 'Filter mode used when scaling the image up.' + description = 'Filter mode used when scaling the image up.', }, { type = 'number', name = 'anisotropy', + description = 'Maximum amount of Anisotropic Filtering used.', default = '1', - description = 'Maximum amount of Anisotropic Filtering used.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setDepthMode', @@ -3096,16 +4275,19 @@ return { { type = 'CompareMode', name = 'comparemode', - description = 'Depth comparison mode used for depth testing.' + description = 'Depth comparison mode used for depth testing.', }, { type = 'boolean', name = 'write', - description = 'Whether to write update / write values to the depth buffer when rendering.' + description = 'Whether to write update / write values to the depth buffer when rendering.', }, - } - } - } + }, + }, + { + description = 'Disables depth testing and depth writes.', + }, + }, }, { name = 'setFont', @@ -3116,11 +4298,11 @@ return { { type = 'Font', name = 'font', - description = 'The Font object to use.' - } - } - } - } + description = 'The Font object to use.', + }, + }, + }, + }, }, { name = 'setFrontFaceWinding', @@ -3131,26 +4313,26 @@ return { { type = 'VertexWinding', name = 'winding', - description = 'The winding mode to use. The default winding is counterclockwise ("ccw").' - } - } - } - } + description = 'The winding mode to use. The default winding is counterclockwise (\'ccw\').', + }, + }, + }, + }, }, { name = 'setLineJoin', - description = 'Sets the line join style.', + description = 'Sets the line join style. See LineJoin for the possible options.', variants = { { arguments = { { type = 'LineJoin', name = 'join', - description = 'The LineJoin to use.' - } - } - } - } + description = 'The LineJoin to use.', + }, + }, + }, + }, }, { name = 'setLineStyle', @@ -3161,11 +4343,11 @@ return { { type = 'LineStyle', name = 'style', - description = 'The LineStyle to use.' - } - } - } - } + description = 'The LineStyle to use. Line styles include smooth and rough.', + }, + }, + }, + }, }, { name = 'setLineWidth', @@ -3176,114 +4358,131 @@ return { { type = 'number', name = 'width', - description = 'The width of the line.' - } - } - } - } + description = 'The width of the line.', + }, + }, + }, + }, }, { name = 'setMeshCullMode', - description = 'Sets whether back-facing triangles in a Mesh are culled.\n\nThis is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer.', + description = 'Sets whether back-facing triangles in a Mesh are culled.\n\nThis is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer.\n\nBy default, both front- and back-facing triangles in Meshes are rendered.', variants = { { arguments = { { type = 'CullMode', name = 'mode', - description = 'The Mesh face culling mode to use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).' - } - } - } - } + description = 'The Mesh face culling mode to use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).', + }, + }, + }, + }, }, { name = 'setNewFont', - description = 'Creates and sets a new font.', + description = 'Creates and sets a new Font.', variants = { + { + arguments = { + { + type = 'number', + name = 'size', + description = 'The size of the font.', + default = '12', + }, + }, + returns = { + { + type = 'Font', + name = 'font', + description = 'The new font.', + }, + }, + }, { arguments = { { type = 'string', name = 'filename', - description = 'The path and name of the file with the font.' + description = 'The path and name of the file with the font.', }, { type = 'number', name = 'size', + description = 'The size of the font.', default = '12', - description = 'The size of the font.' - } + }, }, returns = { { type = 'Font', name = 'font', - description = 'The new font.' - } - } + description = 'The new font.', + }, + }, }, { arguments = { { type = 'File', name = 'file', - description = 'A File with the font.' + description = 'A File with the font.', }, { type = 'number', name = 'size', + description = 'The size of the font.', default = '12', - description = 'The size of the font.' - } + }, }, returns = { { type = 'Font', name = 'font', - description = 'The new font.' - } - } + description = 'The new font.', + }, + }, }, { arguments = { { type = 'Data', name = 'data', - description = 'A Data with the font.' + description = 'A Data with the font.', }, { type = 'number', name = 'size', + description = 'The size of the font.', default = '12', - description = 'The size of the font.' - } + }, }, returns = { { type = 'Font', name = 'font', - description = 'The new font.' - } - } - } - } - }, - { - name = 'setShader', - description = 'Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next love.graphics.setShader will be drawn using the Shader object specified.\n\nDisables the shaders when called without arguments.', - variants = { - {}, + description = 'The new font.', + }, + }, + }, { arguments = { { - type = 'Shader', - name = 'shader', - description = 'The new shader.' - } - } - } - } + type = 'Rasterizer', + name = 'rasterizer', + description = 'A rasterizer.', + }, + }, + returns = { + { + type = 'Font', + name = 'font', + description = 'The new font.', + }, + }, + }, + }, }, { name = 'setPointSize', @@ -3294,83 +4493,102 @@ return { { type = 'number', name = 'size', - description = 'The new point size.' - } - } - } - } + description = 'The new point size.', + }, + }, + }, + }, }, { name = 'setScissor', - description = 'Sets or disables scissor.\n\nThe scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear.', + description = 'Sets or disables scissor.\n\nThe scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. \n\nThe dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...).', variants = { { - description = 'Limits the drawing area to a specified rectangle.', + description = 'Limits the drawing area to a specified rectangle. ', arguments = { { type = 'number', name = 'x', - description = 'The X coordinate of upper left corner.' + description = 'x coordinate of upper left corner.', }, { type = 'number', name = 'y', - description = 'The Y coordinate of upper left corner.' + description = 'y coordinate of upper left corner.', }, { type = 'number', name = 'width', - description = 'The width of clipping rectangle.' + description = 'width of clipping rectangle.', }, { type = 'number', name = 'height', - description = 'The height of clipping rectangle.' - } - } + description = 'height of clipping rectangle.', + }, + }, }, { description = 'Disables scissor.', - } - } + }, + }, + }, + { + name = 'setShader', + description = 'Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next \'\'love.graphics.setShader\'\' will be drawn using the Shader object specified.', + variants = { + { + description = 'Sets the current shader to a specified Shader. All drawing operations until the next \'\'love.graphics.setShader\'\' will be drawn using the Shader object specified.', + arguments = { + { + type = 'Shader', + name = 'shader', + description = 'The new shader.', + }, + }, + }, + { + description = 'Disables shaders, allowing unfiltered drawing operations.', + }, + }, }, { name = 'setStencilTest', - description = 'Configures or disables stencil testing.\n\nWhen stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil.\n\nEach Canvas has its own per-pixel stencil values.', + description = 'Configures or disables stencil testing.\n\nWhen stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil.', variants = { { arguments = { { type = 'CompareMode', name = 'comparemode', - description = 'The type of comparison to make for each pixel.' + description = 'The type of comparison to make for each pixel.', }, { type = 'number', name = 'comparevalue', - description = 'The value to use when comparing with the stencil value of each pixel. Must be between 0 and 1.' - } - } + description = 'The value to use when comparing with the stencil value of each pixel. Must be between 0 and 255.', + }, + }, }, { - description = 'Disables stencil testing.' - } - } + description = 'Disables stencil testing.', + }, + }, }, { name = 'setWireframe', - description = 'Sets whether wireframe lines will be used when drawing.\n\nWireframe mode should only be used for debugging. The lines drawn with it enabled do not behave like regular love.graphics lines: their widths don\'t scale with the coordinate transformations or with love.graphics.setLineWidth, and they don\'t use the smooth LineStyle.', + description = 'Sets whether wireframe lines will be used when drawing.', variants = { { arguments = { { type = 'boolean', name = 'enable', - description = 'True to enable wireframe mode when drawing, false to disable it.' - } - } - } - } + description = 'True to enable wireframe mode when drawing, false to disable it.', + }, + }, + }, + }, }, { name = 'shear', @@ -3381,48 +4599,49 @@ return { { type = 'number', name = 'kx', - description = 'The shear factor on the x-axis.' + description = 'The shear factor on the x-axis.', }, { type = 'number', name = 'ky', - description = 'The shear factor on the y-axis.' - } - } - } - } + description = 'The shear factor on the y-axis.', + }, + }, + }, + }, }, { name = 'stencil', - description = 'Draws geometry as a stencil.\n\nThe geometry drawn by the supplied function sets invisible stencil values of pixels, instead of setting pixel colors. The stencil values of pixels can act like a mask / stencil - love.graphics.setStencilTest can be used afterward to determine how further rendering is affected by the stencil values in each pixel.\n\nEach Canvas has its own per-pixel stencil values. Stencil values are within the range of [0, 1].', + description = 'Draws geometry as a stencil.\n\nThe geometry drawn by the supplied function sets invisible stencil values of pixels, instead of setting pixel colors. The stencil buffer (which contains those stencil values) can act like a mask / stencil - love.graphics.setStencilTest can be used afterward to determine how further rendering is affected by the stencil values in each pixel.\n\nStencil values are integers within the range of 255.', variants = { { + description = 'It is possible to draw to the screen and to the stencil values of pixels at the same time, by using love.graphics.setColorMask inside the stencil function to enable drawing to all color components.', arguments = { { type = 'function', name = 'stencilfunction', - description = 'Function which draws geometry. The stencil values of pixels, rather than the color of each pixel, will be affected by the geometry.' + description = 'Function which draws geometry. The stencil values of pixels, rather than the color of each pixel, will be affected by the geometry.', }, { type = 'StencilAction', name = 'action', - default = '"replace"', - description = 'How to modify any stencil values of pixels that are touched by what\'s drawn in the stencil function.' + description = 'How to modify any stencil values of pixels that are touched by what\'s drawn in the stencil function.', + default = '\'replace\'', }, { type = 'number', name = 'value', + description = 'The new stencil value to use for pixels if the \'replace\' stencil action is used. Has no effect with other stencil actions. Must be between 0 and 255.', default = '1', - description = 'The new stencil value to use for pixels if the "replace" stencil action is used. Has no effect with other stencil actions. Must be between 0 and 1.' }, { type = 'boolean', name = 'keepvalues', + description = 'True to preserve old stencil values of pixels, false to re-set every pixel\'s stencil value to 0 before executing the stencil function. love.graphics.clear will also re-set all stencil values.', default = 'false', - description = 'True to preserve old stencil values of pixels, false to re-set every pixel\'s stencil value to 0 before executing the stencil function. love.graphics.clear will also re-set all stencil values.' - } - } - } + }, + }, + }, }, }, { @@ -3434,112 +4653,112 @@ return { { type = 'number', name = 'globalX', - description = 'The x component of the position in global coordinates.' + description = 'The x component of the position in global coordinates.', }, { type = 'number', name = 'globalY', - description = 'The y component of the position in global coordinates.' + description = 'The y component of the position in global coordinates.', }, }, returns = { { type = 'number', name = 'screenX', - description = 'The x component of the position with graphics transformations applied.' + description = 'The x component of the position with graphics transformations applied.', }, { type = 'number', - name = 'sreenY', - description = 'The y component of the position with graphics transformations applied.' + name = 'screenY', + description = 'The y component of the position with graphics transformations applied.', }, - } - } - } + }, + }, + }, }, { name = 'translate', - description = 'Translates the coordinate system in two dimensions.\n\nWhen this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy.\n\nScale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.\n\nThis change lasts until love.graphics.clear is called (which is called automatically before love.draw in the default love.run function), or a love.graphics.pop reverts to a previous coordinate system state.\n\nTranslating using whole numbers will prevent tearing/blurring of images and fonts draw after translating.', + description = 'Translates the coordinate system in two dimensions.\n\nWhen this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy. \n\nScale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.\n\nThis change lasts until love.draw() exits or else a love.graphics.pop reverts to a previous love.graphics.push.\n\nTranslating using whole numbers will prevent tearing/blurring of images and fonts draw after translating.', variants = { { arguments = { { type = 'number', name = 'dx', - description = 'The translation relative to the x-axis.' + description = 'The translation relative to the x-axis.', }, { type = 'number', name = 'dy', - description = 'The translation relative to the y-axis.' - } - } - } - } + description = 'The translation relative to the y-axis.', + }, + }, + }, + }, }, { name = 'validateShader', - description = 'Validates shader code. Check if specificed shader code does not contain any errors.', + description = 'Validates shader code. Check if specified shader code does not contain any errors.', variants = { { arguments = { { type = 'boolean', name = 'gles', - description = 'Validate code as GLSL ES shader.' + description = 'Validate code as GLSL ES shader.', }, { type = 'string', name = 'code', - description = 'The pixel shader or vertex shader code, or a filename pointing to a file with the code.' - } + description = 'The pixel shader or vertex shader code, or a filename pointing to a file with the code.', + }, }, returns = { { type = 'boolean', name = 'status', - description = 'true if specified shader code doesn\'t contain any errors. false otherwise.' + description = 'true if specified shader code doesn\'t contain any errors. false otherwise.', }, { type = 'string', name = 'message', - description = 'Reason why shader code validation failed (or nil if validation succeded).' - } - } + description = 'Reason why shader code validation failed (or nil if validation succeded).', + }, + }, }, { arguments = { { type = 'boolean', name = 'gles', - description = 'Validate code as GLSL ES shader.' + description = 'Validate code as GLSL ES shader.', }, { type = 'string', name = 'pixelcode', - description = 'The pixel shader code, or a filename pointing to a file with the code.' + description = 'The pixel shader code, or a filename pointing to a file with the code.', }, { type = 'string', name = 'vertexcode', - description = 'The vertex shader code, or a filename pointing to a file with the code.' - } + description = 'The vertex shader code, or a filename pointing to a file with the code.', + }, }, returns = { { type = 'boolean', name = 'status', - description = 'true if specified shader code doesn\'t contain any errors. false otherwise.' + description = 'true if specified shader code doesn\'t contain any errors. false otherwise.', }, { type = 'string', name = 'message', - description = 'Reason why shader code validation failed (or nil if validation succeded).' - } - } - } - } - } + description = 'Reason why shader code validation failed (or nil if validation succeded).', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.AlignMode'), @@ -3547,6 +4766,7 @@ return { require(path .. 'enums.AreaSpreadDistribution'), require(path .. 'enums.BlendAlphaMode'), require(path .. 'enums.BlendMode'), + require(path .. 'enums.CanvasMipmapMode'), require(path .. 'enums.CompareMode'), require(path .. 'enums.CullMode'), require(path .. 'enums.DrawMode'), @@ -3555,12 +4775,13 @@ return { require(path .. 'enums.GraphicsLimit'), require(path .. 'enums.LineJoin'), require(path .. 'enums.LineStyle'), + require(path .. 'enums.MatrixLayout'), require(path .. 'enums.MeshDrawMode'), require(path .. 'enums.ParticleInsertMode'), require(path .. 'enums.SpriteBatchUsage'), require(path .. 'enums.StackType'), require(path .. 'enums.StencilAction'), - require(path .. 'enums.VertexWinding'), - require(path .. 'enums.WrapMode') - } -} + require(path .. 'enums.TextureType'), + require(path .. 'enums.WrapMode'), + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/AlignMode.lua b/modules/graphics/enums/AlignMode.lua index df7ce78a..70df137b 100644 --- a/modules/graphics/enums/AlignMode.lua +++ b/modules/graphics/enums/AlignMode.lua @@ -4,19 +4,19 @@ return { constants = { { name = 'center', - description = 'Align text center.' + description = 'Align text center.', }, { name = 'left', - description = 'Align text left.' + description = 'Align text left.', }, { name = 'right', - description = 'Align text right.' + description = 'Align text right.', }, { name = 'justify', - description = 'Align text both left and right.' - } - } -} + description = 'Align text both left and right.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/ArcType.lua b/modules/graphics/enums/ArcType.lua index 5cb2212a..9ac5f720 100644 --- a/modules/graphics/enums/ArcType.lua +++ b/modules/graphics/enums/ArcType.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'pie', - description = 'The arc is drawn like a slice of pie, with the arc circle connected to the center at its end-points.' + description = 'The arc is drawn like a slice of pie, with the arc circle connected to the center at its end-points.', }, { name = 'open', - description = 'The arc circle\'s two end-points are unconnected when the arc is drawn as a line. Behaves like the "closed" arc type when the arc is drawn in filled mode.' + description = 'The arc circle\'s two end-points are unconnected when the arc is drawn as a line. Behaves like the "closed" arc type when the arc is drawn in filled mode.', }, { name = 'closed', - description = 'The arc circle\'s two end-points are connected to each other.' - } - } -} + description = 'The arc circle\'s two end-points are connected to each other.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/AreaSpreadDistribution.lua b/modules/graphics/enums/AreaSpreadDistribution.lua index 1d6f18de..634ae7c8 100644 --- a/modules/graphics/enums/AreaSpreadDistribution.lua +++ b/modules/graphics/enums/AreaSpreadDistribution.lua @@ -4,19 +4,27 @@ return { constants = { { name = 'uniform', - description = 'Uniform distribution.' + description = 'Uniform distribution.', }, { name = 'normal', - description = 'Normal (gaussian) distribution.' + description = 'Normal (gaussian) distribution.', }, { name = 'ellipse', - description = 'Uniform distribution in an ellipse.' + description = 'Uniform distribution in an ellipse.', + }, + { + name = 'borderellipse', + description = 'Distribution in an ellipse with particles spawning at the edges of the ellipse.', + }, + { + name = 'borderrectangle', + description = 'Distribution in a rectangle with particles spawning at the edges of the rectangle.', }, { name = 'none', - description = 'No distribution - area spread is disabled.' - } - } -} + description = 'No distribution - area spread is disabled.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/BlendAlphaMode.lua b/modules/graphics/enums/BlendAlphaMode.lua index cf68ba59..9ce2c7a3 100644 --- a/modules/graphics/enums/BlendAlphaMode.lua +++ b/modules/graphics/enums/BlendAlphaMode.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'alphamultiply', - description = 'The RGB values of what\'s drawn are multiplied by the alpha values of those colors during blending. This is the default alpha mode.' + description = 'The RGB values of what\'s drawn are multiplied by the alpha values of those colors during blending. This is the default alpha mode.', }, { name = 'premultiplied', - description = 'The RGB values of what\'s drawn are not multiplied by the alpha values of those colors during blending. For most blend modes to work correctly with this alpha mode, the colors of a drawn object need to have had their RGB values multiplied by their alpha values at some point previously ("premultiplied alpha").' - } - } -} + description = 'The RGB values of what\'s drawn are \'\'\'not\'\'\' multiplied by the alpha values of those colors during blending. For most blend modes to work correctly with this alpha mode, the colors of a drawn object need to have had their RGB values multiplied by their alpha values at some point previously ("premultiplied alpha").', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/BlendMode.lua b/modules/graphics/enums/BlendMode.lua index 65c5dec4..dd57175d 100644 --- a/modules/graphics/enums/BlendMode.lua +++ b/modules/graphics/enums/BlendMode.lua @@ -4,35 +4,51 @@ return { constants = { { name = 'alpha', - description = 'Alpha blending (normal). The alpha of what\'s drawn determines its opacity.' + description = 'Alpha blending (normal). The alpha of what\'s drawn determines its opacity.', }, { name = 'replace', - description = 'The colors of what\'s drawn completely replace what was on the screen, with no additional blending. The BlendAlphaMode specified in love.graphics.setBlendMode still affects what happens.' + description = 'The colors of what\'s drawn completely replace what was on the screen, with no additional blending. The BlendAlphaMode specified in love.graphics.setBlendMode still affects what happens.', }, { name = 'screen', - description = '"Screen" blending.' + description = '\'Screen\' blending.', }, { name = 'add', - description = 'The pixel colors of what\'s drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.' + description = 'The pixel colors of what\'s drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.', }, { name = 'subtract', - description = 'The pixel colors of what\'s drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.' + description = 'The pixel colors of what\'s drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.', }, { name = 'multiply', - description = 'The pixel colors of what\'s drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" BlendAlphaMode is used.' + description = 'The pixel colors of what\'s drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" BlendAlphaMode is used.', }, { name = 'lighten', - description = 'The pixel colors of what\'s drawn are compared to the existing pixel colors, and the larger of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.' + description = 'The pixel colors of what\'s drawn are compared to the existing pixel colors, and the larger of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.', }, { name = 'darken', - description = 'The pixel colors of what\'s drawn are compared to the existing pixel colors, and the smaller of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.' - } - } -} + description = 'The pixel colors of what\'s drawn are compared to the existing pixel colors, and the smaller of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.', + }, + { + name = 'additive', + description = 'Additive blend mode.', + }, + { + name = 'subtractive', + description = 'Subtractive blend mode.', + }, + { + name = 'multiplicative', + description = 'Multiply blend mode.', + }, + { + name = 'premultiplied', + description = 'Premultiplied alpha blend mode.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/CanvasMipmapMode.lua b/modules/graphics/enums/CanvasMipmapMode.lua new file mode 100644 index 00000000..65313d74 --- /dev/null +++ b/modules/graphics/enums/CanvasMipmapMode.lua @@ -0,0 +1,18 @@ +return { + name = 'CanvasMipmapMode', + description = '', + constants = { + { + name = 'none', + description = 'Do not enable mipmap.', + }, + { + name = 'auto', + description = 'Automatically generate mipmap.', + }, + { + name = 'manual', + description = 'Let user manually generate mipmap.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/CompareMode.lua b/modules/graphics/enums/CompareMode.lua index d63fe75f..3a020a99 100644 --- a/modules/graphics/enums/CompareMode.lua +++ b/modules/graphics/enums/CompareMode.lua @@ -1,30 +1,14 @@ return { name = 'CompareMode', - description = 'Different types of per-pixel stencil test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.', + description = 'Different types of per-pixel stencil test and depth test comparisons. The pixels of an object will be drawn if the comparison succeeds, for each pixel that the object touches.\n\n;equal:\n\n* stencil tests: the stencil value of the pixel must be equal to the supplied value.\n\n* depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.\n\n;notequal:\n\n* stencil tests: the stencil value of the pixel must \'\'\'not\'\'\' be equal to the supplied value.\n\n* depth tests: the depth value of the drawn object at that pixel must \'\'\'not\'\'\' be equal to the existing depth value of that pixel.\n\n;less:\n\n* stencil tests: the stencil value of the pixel must be less than the supplied value.\n\n* depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.\n\n;lequal:\n\n* stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.\n\n* depth tests: the depth value of the drawn object at that pixel must be less than or equal to the existing depth value of that pixel.\n\n;gequal:\n\n* stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.\n\n* depth tests: the depth value of the drawn object at that pixel must be greater than or equal to the existing depth value of that pixel.\n\n;greater:\n\n* stencil tests: the stencil value of the pixel must be greater than the supplied value.\n\n* depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.', constants = { { - name = 'equal', - description = 'The stencil value of the pixel must be equal to the supplied value.' + name = 'never', + description = 'Objects will never be drawn.', }, { - name = 'notequal', - description = 'The stencil value of the pixel must not be equal to the supplied value.' + name = 'always', + description = 'Objects will always be drawn. Effectively disables the depth or stencil test.', }, - { - name = 'less', - description = 'The stencil value of the pixel must be less than the supplied value.' - }, - { - name = 'lequal', - description = 'The stencil value of the pixel must be less than or equal to the supplied value.' - }, - { - name = 'gequal', - description = 'The stencil value of the pixel must be greater than or equal to the supplied value.' - }, - { - name = 'greater', - description = 'The stencil value of the pixel must be greater than the supplied value.' - } - } -} + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/CullMode.lua b/modules/graphics/enums/CullMode.lua index bbc22160..aba51af2 100644 --- a/modules/graphics/enums/CullMode.lua +++ b/modules/graphics/enums/CullMode.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'back', - description = 'Back-facing triangles in Meshes are culled (not rendered). The vertex order of a triangle determines whether it is back- or front-facing.' + description = 'Back-facing triangles in Meshes are culled (not rendered). The vertex order of a triangle determines whether it is back- or front-facing.', }, { name = 'front', - description = 'Front-facing triangles in Meshes are culled.' + description = 'Front-facing triangles in Meshes are culled.', }, { name = 'none', - description = 'Both back- and front-facing triangles in Meshes are rendered.' - } - } -} + description = 'Both back- and front-facing triangles in Meshes are rendered.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/DrawMode.lua b/modules/graphics/enums/DrawMode.lua index d7e3bf58..06ca6e3d 100644 --- a/modules/graphics/enums/DrawMode.lua +++ b/modules/graphics/enums/DrawMode.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'fill', - description = 'Draw filled shape.' + description = 'Draw filled shape.', }, { name = 'line', - description = 'Draw outlined shape.' - } - } -} + description = 'Draw outlined shape.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/FilterMode.lua b/modules/graphics/enums/FilterMode.lua index c5899944..04c2a945 100644 --- a/modules/graphics/enums/FilterMode.lua +++ b/modules/graphics/enums/FilterMode.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'linear', - description = 'Scale image with linear interpolation.' + description = 'Scale image with linear interpolation.', }, { name = 'nearest', - description = 'Scale image with nearest neighbor interpolation.' - } - } -} + description = 'Scale image with nearest neighbor interpolation.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/GraphicsFeature.lua b/modules/graphics/enums/GraphicsFeature.lua index 0936693c..cb1c980e 100644 --- a/modules/graphics/enums/GraphicsFeature.lua +++ b/modules/graphics/enums/GraphicsFeature.lua @@ -4,15 +4,79 @@ return { constants = { { name = 'clampzero', - description = 'Whether the "clampzero" WrapMode is supported.' + description = 'Whether the "clampzero" WrapMode is supported.', }, { name = 'lighten', - description = 'Whether the "lighten" and "darken" BlendModes are supported.' + description = 'Whether the "lighten" and "darken" BlendModes are supported.', }, { name = 'multicanvasformats', - description = 'Whether multiple Canvases with different formats can be used in the same love.graphics.setCanvas call.' - } - } -} + description = 'Whether multiple formats can be used in the same love.graphics.setCanvas call.', + }, + { + name = 'glsl3', + description = 'Whether GLSL 3 Shaders can be used.', + }, + { + name = 'instancing', + description = 'Whether mesh instancing is supported.', + }, + { + name = 'fullnpot', + description = 'Whether textures with non-power-of-two dimensions can use mipmapping and the \'repeat\' WrapMode.', + }, + { + name = 'pixelshaderhighp', + description = 'Whether pixel shaders can use "highp" 32 bit floating point numbers (as opposed to just 16 bit or lower precision).', + }, + { + name = 'shaderderivatives', + description = 'Whether shaders can use the dFdx, dFdy, and fwidth functions for computing derivatives.', + }, + { + name = 'canvas', + description = 'Support for Canvas.', + }, + { + name = 'npot', + description = 'Support for textures with non-power-of-two sizes. See PO2 Syndrome. ', + }, + { + name = 'subtractive', + description = 'Support for the subtractive blend mode.', + }, + { + name = 'shader', + description = 'Support for Shaders.', + }, + { + name = 'hdrcanvas', + description = 'Support for HDR Canvases. Use love.graphics.getCanvasFormats instead.', + }, + { + name = 'multicanvas', + description = 'Support for simultaneous rendering to at least 4 canvases at once, with love.graphics.setCanvas. Use love.graphics.getSystemLimits instead.', + }, + { + name = 'mipmap', + description = 'Support for Mipmaps.', + }, + { + name = 'dxt', + description = 'Support for DXT compressed images (see CompressedFormat.) Use love.graphics.getCompressedImageFormats instead.', + }, + { + name = 'bc5', + description = 'Support for BC4 and BC5 compressed images. Use love.graphics.getCompressedImageFormats instead.', + }, + { + name = 'srgb', + description = 'Support for gamma-correct rendering with the srgb window flag in Canvases and Images.', + }, + { + name = 'pixeleffect', + description = 'Support for PixelEffects.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/GraphicsLimit.lua b/modules/graphics/enums/GraphicsLimit.lua index ddd57529..55cde2fd 100644 --- a/modules/graphics/enums/GraphicsLimit.lua +++ b/modules/graphics/enums/GraphicsLimit.lua @@ -4,19 +4,39 @@ return { constants = { { name = 'pointsize', - description = 'The maximum size of points.' + description = 'The maximum size of points.', }, { name = 'texturesize', - description = 'The maximum width or height of Images and Canvases.' + description = 'The maximum width or height of Images and Canvases.', }, { name = 'multicanvas', - description = 'The maximum number of simultaneously active canvases (via love.graphics.setCanvas).' + description = 'The maximum number of simultaneously active canvases (via love.graphics.setCanvas.)', }, { name = 'canvasmsaa', - description = 'The maximum number of antialiasing samples for a Canvas.' - } - } -} + description = 'The maximum number of antialiasing samples for a Canvas.', + }, + { + name = 'texturelayers', + description = 'The maximum number of layers in an Array texture.', + }, + { + name = 'volumetexturesize', + description = 'The maximum width, height, or depth of a Volume texture.', + }, + { + name = 'cubetexturesize', + description = 'The maximum width or height of a Cubemap texture.', + }, + { + name = 'anisotropy', + description = 'The maximum amount of anisotropic filtering. Texture:setMipmapFilter internally clamps the given anisotropy value to the system\'s limit.', + }, + { + name = 'canvasfsaa', + description = 'The maximum number of antialiasing samples for a Canvas.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/LineJoin.lua b/modules/graphics/enums/LineJoin.lua index b798f4c3..6f1f417b 100644 --- a/modules/graphics/enums/LineJoin.lua +++ b/modules/graphics/enums/LineJoin.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'miter', - description = 'The ends of the line segments beveled in an angle so that they join seamlessly.' + description = 'The ends of the line segments beveled in an angle so that they join seamlessly.', }, { - name = 'bevel', - description = 'No cap applied to the ends of the line segments.' + name = 'none', + description = 'No cap applied to the ends of the line segments.', }, { - name = 'none', - description = 'Flattens the point where line segments join together.' - } - } -} + name = 'bevel', + description = 'Flattens the point where line segments join together.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/LineStyle.lua b/modules/graphics/enums/LineStyle.lua index c4839cbb..374858a4 100644 --- a/modules/graphics/enums/LineStyle.lua +++ b/modules/graphics/enums/LineStyle.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'rough', - description = 'Draw rough lines.' + description = 'Draw rough lines.', }, { name = 'smooth', - description = 'Draw smooth lines.' - } - } -} + description = 'Draw smooth lines.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/MatrixLayout.lua b/modules/graphics/enums/MatrixLayout.lua new file mode 100644 index 00000000..bce9f2a0 --- /dev/null +++ b/modules/graphics/enums/MatrixLayout.lua @@ -0,0 +1,14 @@ +return { + name = 'MatrixLayout', + description = 'The layout of matrix elements (row-major or column-major).', + constants = { + { + name = 'row', + description = 'The matrix is row-major:', + }, + { + name = 'column', + description = 'The matrix is column-major:', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/MeshDrawMode.lua b/modules/graphics/enums/MeshDrawMode.lua index 611b3250..42713ac1 100644 --- a/modules/graphics/enums/MeshDrawMode.lua +++ b/modules/graphics/enums/MeshDrawMode.lua @@ -4,19 +4,19 @@ return { constants = { { name = 'fan', - description = 'The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons.' + description = 'The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons.', }, { name = 'strip', - description = 'The vertices create a series of connected triangles using vertices 1, 2, 3, then 3, 2, 4 (note the order), then 3, 4, 5 and so on.' + description = 'The vertices create a series of connected triangles using vertices 1, 2, 3, then 3, 2, 4 (note the order), then 3, 4, 5, and so on.', }, { name = 'triangles', - description = 'The vertices create unconnected triangles.' + description = 'The vertices create unconnected triangles.', }, { name = 'points', - description = 'The vertices are drawn as unconnected points (see love.graphics.setPointSize.)' - } - } -} + description = 'The vertices are drawn as unconnected points (see love.graphics.setPointSize.)', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/ParticleInsertMode.lua b/modules/graphics/enums/ParticleInsertMode.lua index 7f73e8ab..f531033f 100644 --- a/modules/graphics/enums/ParticleInsertMode.lua +++ b/modules/graphics/enums/ParticleInsertMode.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'top', - description = 'Particles are inserted at the top of the ParticleSystem\'s list of particles.' + description = 'Particles are inserted at the top of the ParticleSystem\'s list of particles.', }, { name = 'bottom', - description = 'Particles are inserted at the bottom of the ParticleSystem\'s list of particles.' + description = 'Particles are inserted at the bottom of the ParticleSystem\'s list of particles.', }, { name = 'random', - description = 'Particles are inserted at random positions in the ParticleSystem\'s list of particles.' - } - } -} + description = 'Particles are inserted at random positions in the ParticleSystem\'s list of particles.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/SpriteBatchUsage.lua b/modules/graphics/enums/SpriteBatchUsage.lua index a2cbc62b..82a3ab66 100644 --- a/modules/graphics/enums/SpriteBatchUsage.lua +++ b/modules/graphics/enums/SpriteBatchUsage.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'dynamic', - description = 'The object\'s data will change occasionally during its lifetime.' + description = 'The object\'s data will change occasionally during its lifetime. ', }, { name = 'static', - description = 'The object will not be modified after initial sprites or vertices are added.' + description = 'The object will not be modified after initial sprites or vertices are added.', }, { name = 'stream', - description = 'The object data will always change between draws.' - } - } -} + description = 'The object data will always change between draws.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/StackType.lua b/modules/graphics/enums/StackType.lua index a692dd21..246adcf2 100644 --- a/modules/graphics/enums/StackType.lua +++ b/modules/graphics/enums/StackType.lua @@ -4,11 +4,11 @@ return { constants = { { name = 'transform', - description = 'The transformation stack (love.graphics.translate, love.graphics.rotate, etc.)' + description = 'The transformation stack (love.graphics.translate, love.graphics.rotate, etc.)', }, { name = 'all', - description = 'All love.graphics state, including transform state.' - } - } -} + description = 'All love.graphics state, including transform state.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/StencilAction.lua b/modules/graphics/enums/StencilAction.lua index 967115e1..15e67450 100644 --- a/modules/graphics/enums/StencilAction.lua +++ b/modules/graphics/enums/StencilAction.lua @@ -4,27 +4,27 @@ return { constants = { { name = 'replace', - description = 'The stencil value of a pixel will be replaced by the value specified in love.graphics.stencil, if any object touches the pixel.' + description = 'The stencil value of a pixel will be replaced by the value specified in love.graphics.stencil, if any object touches the pixel.', }, { name = 'increment', - description = 'The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If the stencil value reaches 1 it will stay at 1.' + description = 'The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If the stencil value reaches 255 it will stay at 255.', }, { name = 'decrement', - description = 'The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value reaches 0 it will stay at 0.' + description = 'The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value reaches 0 it will stay at 0.', }, { name = 'incrementwrap', - description = 'The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If a stencil value of 1 is incremented it will be set to 0.' + description = 'The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If a stencil value of 255 is incremented it will be set to 0.', }, { name = 'decrementwrap', - description = 'The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value of 0 is decremented it will be set to 1.' + description = 'The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value of 0 is decremented it will be set to 255.', }, { name = 'invert', - description = 'The stencil value of a pixel will be bitwise-inverted for each object that touches the pixel. If a stencil value of 0 is inverted it will become 1.' - } - } -} + description = 'The stencil value of a pixel will be bitwise-inverted for each object that touches the pixel. If a stencil value of 0 is inverted it will become 255.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/TextureType.lua b/modules/graphics/enums/TextureType.lua new file mode 100644 index 00000000..b35bcb08 --- /dev/null +++ b/modules/graphics/enums/TextureType.lua @@ -0,0 +1,22 @@ +return { + name = 'TextureType', + description = 'Types of textures (2D, cubemap, etc.)', + constants = { + { + name = '2d', + description = 'Regular 2D texture with width and height.', + }, + { + name = 'array', + description = 'Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues.', + }, + { + name = 'cube', + description = 'Cubemap texture with 6 faces. Requires a custom shader (and Shader:send) to use. Sampling from a cube texture in a shader takes a 3D direction vector instead of a texture coordinate.', + }, + { + name = 'volume', + description = '3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis.', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/enums/WrapMode.lua b/modules/graphics/enums/WrapMode.lua index 8619e9db..615f9770 100644 --- a/modules/graphics/enums/WrapMode.lua +++ b/modules/graphics/enums/WrapMode.lua @@ -1,22 +1,22 @@ return { name = 'WrapMode', - description = 'How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of [0, 1] are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of [0, 1].', + description = 'How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of 1 are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of 1.', constants = { { name = 'clamp', - description = 'How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of [0, 1] are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of [0, 1].' + description = 'Clamp the texture. Appears only once. The area outside the texture\'s normal range is colored based on the edge pixels of the texture.', }, { name = 'repeat', - description = 'Repeat the image. Fills the whole available extent.' + description = 'Repeat the texture. Fills the whole available extent.', }, { name = 'mirroredrepeat', - description = 'Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn\'t seamlessly tile.' + description = 'Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn\'t seamlessly tile.', }, { name = 'clampzero', - description = 'Clamp the texture. Fills the area outside the texture\'s normal range with transparent black (or opaque black for textures with no alpha channel.)' - } - } -} + description = 'Clamp the texture. Fills the area outside the texture\'s normal range with transparent black (or opaque black for textures with no alpha channel.)', + }, + }, +} \ No newline at end of file diff --git a/modules/graphics/types/Canvas.lua b/modules/graphics/types/Canvas.lua index 57757945..00d12e49 100644 --- a/modules/graphics/types/Canvas.lua +++ b/modules/graphics/types/Canvas.lua @@ -1,10 +1,22 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Canvas', - description = 'A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".\n\nBy drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.\n\nIn versions prior to 0.10.0, not all graphics cards that LÖVE supported could use Canvases. love.graphics.isSupported("canvas") could be used to check for support at runtime.', - constructors = { - 'newCanvas' + description = 'A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".\n\nBy drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.\n\nIn versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.', + supertypes = { + 'Texture', + 'Drawable', + 'Object', }, functions = { + { + name = 'generateMipmaps', + description = 'Generates mipmaps for the Canvas, based on the contents of the highest-resolution mipmap level.\n\nThe Canvas must be created with mipmaps set to a MipmapMode other than \'none\' for this function to work. It should only be called while the Canvas is not the active render target.\n\nIf the mipmap mode is set to \'auto\', this function is automatically called inside love.graphics.setCanvas when switching from this Canvas to another Canvas or to the main screen.', + variants = { + { + }, + }, + }, { name = 'getDimensions', description = 'Gets the width and height of the Canvas.', @@ -14,16 +26,16 @@ return { { type = 'number', name = 'width', - description = 'The width of the Canvas, in pixels.' + description = 'The width of the Canvas, in pixels.', }, { type = 'number', name = 'height', - description = 'The height of the Canvas, in pixels.' - } - } - } - } + description = 'The height of the Canvas, in pixels.', + }, + }, + }, + }, }, { name = 'getFilter', @@ -34,21 +46,35 @@ return { { type = 'FilterMode', name = 'min', - description = 'Filter mode used when minifying the canvas.' + description = 'Filter mode used when minifying the canvas.', + }, + { + type = 'FilterMode', + name = 'mag', + description = 'Filter mode used when magnifying the canvas.', + }, + }, + }, + { + returns = { + { + type = 'FilterMode', + name = 'min', + description = 'Filter mode used when minifying the canvas.', }, { type = 'FilterMode', name = 'mag', - description = 'Filter mode used when magnifying the canvas.' + description = 'Filter mode used when magnifying the canvas.', }, { type = 'number', name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.' - } - } - } - } + description = 'Maximum amount of anisotropic filtering used.', + }, + }, + }, + }, }, { name = 'getHeight', @@ -59,11 +85,11 @@ return { { type = 'number', name = 'height', - description = 'The height of the Canvas, in pixels.' - } - } - } - } + description = 'The height of the Canvas, in pixels.', + }, + }, + }, + }, }, { name = 'getMSAA', @@ -74,11 +100,26 @@ return { { type = 'number', name = 'samples', - description = 'The number of multisample antialiasing samples used by the canvas when drawing to it.' - } - } - } - } + description = 'The number of multisample antialiasing samples used by the canvas when drawing to it.', + }, + }, + }, + }, + }, + { + name = 'getMipmapMode', + description = 'Gets the MipmapMode this Canvas was created with.', + variants = { + { + returns = { + { + type = 'MipmapMode', + name = 'mode', + description = 'The mipmap mode this Canvas was created with.', + }, + }, + }, + }, }, { name = 'getWidth', @@ -89,11 +130,11 @@ return { { type = 'number', name = 'width', - description = 'The width of the Canvas, in pixels.' - } - } - } - } + description = 'The width of the Canvas, in pixels.', + }, + }, + }, + }, }, { name = 'getWrap', @@ -103,17 +144,17 @@ return { returns = { { type = 'WrapMode', - name = 'horizontal', - description = 'Horizontal wrapping mode of the Canvas.' + name = 'horiz', + description = 'Horizontal wrapping mode of the Canvas.', }, { type = 'WrapMode', - name = 'vertical', - description = 'Vertical wrapping mode of the Canvas.' - } - } - } - } + name = 'vert', + description = 'Vertical wrapping mode of the Canvas.', + }, + }, + }, + }, }, { name = 'newImageData', @@ -124,111 +165,128 @@ return { { type = 'ImageData', name = 'data', - description = 'The image data stored in the Canvas.' - } - } + description = 'The new ImageData made from the Canvas\' contents.', + }, + }, }, { arguments = { + { + type = 'number', + name = 'slice', + description = 'The cubemap face index, array index, or depth layer for cubemap, array, or volume type Canvases, respectively. This argument is ignored for regular 2D canvases.', + }, + { + type = 'number', + name = 'mipmap', + description = 'The mipmap index to use, for Canvases with mipmaps.', + default = '1', + }, { type = 'number', name = 'x', - description = 'The x-axis of the top-left corner of the area within the Canvas to capture.' + description = 'The x-axis of the top-left corner (in pixels) of the area within the Canvas to capture.', }, { type = 'number', name = 'y', - description = 'The y-axis of the top-left corner of the area within the Canvas to capture.' + description = 'The y-axis of the top-left corner (in pixels) of the area within the Canvas to capture.', }, { type = 'number', name = 'width', - description = 'The width of the area within the Canvas to capture.' + description = 'The width in pixels of the area within the Canvas to capture.', }, { type = 'number', name = 'height', - description = 'The height of the area within the Canvas to capture.' + description = 'The height in pixels of the area within the Canvas to capture.', }, }, returns = { { type = 'ImageData', name = 'data', - description = 'The new ImageData made from the Canvas\' contents.' - } - } + description = 'The new ImageData made from the Canvas\' contents.', + }, + }, }, - } + }, }, { name = 'renderTo', - description = 'Render to the Canvas using a function.', + description = 'Render to the Canvas using a function.\n\nThis is a shortcut to love.graphics.setCanvas:\n\ncanvas:renderTo( func )\n\nis the same as\n\nlove.graphics.setCanvas( canvas )\n\nfunc()\n\nlove.graphics.setCanvas()', variants = { { arguments = { { type = 'function', name = 'func', - description = 'A function performing drawing operations.' - } - } - } - } + description = 'A function performing drawing operations.', + }, + }, + }, + }, }, { name = 'setFilter', - description = 'Sets the filter of the Canvas.', + description = 'Sets the filter mode of the Canvas.', variants = { { arguments = { { type = 'FilterMode', name = 'min', - description = 'How to scale a canvas down.' + description = 'Filter mode to use when minifying the canvas.', }, { type = 'FilterMode', name = 'mag', - default = 'min', - description = 'How to scale a canvas up.' + description = 'Filter mode to use when magnifying the canvas.', + }, + }, + }, + { + arguments = { + { + type = 'FilterMode', + name = 'min', + description = 'Filter mode to use when minifying the canvas.', + }, + { + type = 'FilterMode', + name = 'mag', + description = 'Filter mode to use when magnifying the canvas.', }, { type = 'number', name = 'anisotropy', + description = 'Maximum amount of anisotropic filtering to use.', default = '1', - description = 'Maximum amount of anisotropic filtering used.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setWrap', - description = 'Sets the wrapping properties of a Canvas.\n\nThis function sets the way the edges of a Canvas are treated if it is scaled or rotated. If the WrapMode is set to "clamp", the edge will not be interpolated. If set to "repeat", the edge will be interpolated with the pixels on the opposing side of the framebuffer.', + description = 'Sets the wrapping properties of a Canvas.\n\nThis function sets the way the edges of a Canvas are treated if it is scaled or rotated. If the WrapMode is set to \'clamp\', the edge will not be interpolated. If set to \'repeat\', the edge will be interpolated with the pixels on the opposing side of the framebuffer.', variants = { { arguments = { { type = 'WrapMode', - name = 'horizontal', - description = 'Horizontal wrapping mode of the Canvas.' + name = 'horiz', + description = 'Horizontal wrapping mode of the Canvas.', }, { type = 'WrapMode', - name = 'vertical', - default = 'horizontal', - description = 'Vertical wrapping mode of the Canvas.' - } - } - } - } - } + name = 'vert', + description = 'Vertical wrapping mode of the Canvas.', + }, + }, + }, + }, + }, }, - parenttype = 'Texture', - supertypes = { - 'Object', - 'Drawable', - 'Texture' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Font.lua b/modules/graphics/types/Font.lua index e7d3a404..52c86447 100644 --- a/modules/graphics/types/Font.lua +++ b/modules/graphics/types/Font.lua @@ -1,56 +1,71 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Font', - description = 'Defines the shape of characters than can be drawn onto the screen.', - constructors = { - 'newFont', - 'newImageFont', - 'setNewFont' + description = 'Defines the shape of characters that can be drawn onto the screen.', + supertypes = { + 'Object', }, functions = { { name = 'getAscent', - description = 'Gets the ascent of the Font. The ascent spans the distance between the baseline and the top of the glyph that reaches farthest from the baseline.', + description = 'Gets the ascent of the Font.\n\nThe ascent spans the distance between the baseline and the top of the glyph that reaches farthest from the baseline.', variants = { { returns = { { type = 'number', name = 'ascent', - description = 'The ascent of the Font in pixels.' - } - } - } - } + description = 'The ascent of the Font in pixels.', + }, + }, + }, + }, }, { name = 'getBaseline', - description = 'Gets the baseline of the Font. Most scripts share the notion of a baseline: an imaginary horizontal line on which characters rest. In some scripts, parts of glyphs lie below the baseline.', + description = 'Gets the baseline of the Font.\n\nMost scripts share the notion of a baseline: an imaginary horizontal line on which characters rest. In some scripts, parts of glyphs lie below the baseline.', variants = { { returns = { { type = 'number', name = 'baseline', - description = 'The baseline of the Font in pixels.' - } - } - } - } + description = 'The baseline of the Font in pixels.', + }, + }, + }, + }, + }, + { + name = 'getDPIScale', + description = 'Gets the DPI scale factor of the Font.\n\nThe DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the font\'s glyphs have twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a font with a DPI scale factor of 1.\n\nThe font size of TrueType fonts is scaled internally by the font\'s specified DPI scale factor. By default, LÖVE uses the screen\'s DPI scale factor when creating TrueType fonts.', + variants = { + { + returns = { + { + type = 'number', + name = 'dpiscale', + description = 'The DPI scale factor of the Font.', + }, + }, + }, + }, }, { name = 'getDescent', - description = 'Gets the descent of the Font. The descent spans the distance between the baseline and the lowest descending glyph in a typeface.', + description = 'Gets the descent of the Font.\n\nThe descent spans the distance between the baseline and the lowest descending glyph in a typeface.', variants = { { returns = { { type = 'number', name = 'descent', - description = 'The descent of the Font in pixels.' - } - } - } - } + description = 'The descent of the Font in pixels.', + }, + }, + }, + }, }, { name = 'getFilter', @@ -61,73 +76,73 @@ return { { type = 'FilterMode', name = 'min', - description = 'Filter mode used when minifying the font.' + description = 'Filter mode used when minifying the font.', }, { type = 'FilterMode', name = 'mag', - description = 'Filter mode used when magnifying the font.' + description = 'Filter mode used when magnifying the font.', }, { type = 'number', name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.' - } - } - } - } + description = 'Maximum amount of anisotropic filtering used.', + }, + }, + }, + }, }, { name = 'getHeight', - description = 'Gets the height of the Font. The height of the font is the size including any spacing; the height which it will need.', + description = 'Gets the height of the Font.\n\nThe height of the font is the size including any spacing; the height which it will need.', variants = { { returns = { { type = 'number', name = 'height', - description = 'The height of the Font in pixels.' - } - } - } - } + description = 'The height of the Font in pixels.', + }, + }, + }, + }, }, { name = 'getLineHeight', - description = 'Gets the line height. This will be the value previously set by Font:setLineHeight, or 1.0 by default.', + description = 'Gets the line height. \n\nThis will be the value previously set by Font:setLineHeight, or 1.0 by default.', variants = { { returns = { { type = 'number', name = 'height', - description = 'The current line height.' - } - } - } - } + description = 'The current line height.', + }, + }, + }, + }, }, { name = 'getWidth', - description = 'Determines the horizontal size a line of text needs. Does not support line-breaks.', + description = 'Determines the maximum width (accounting for newlines) taken by the given string.', variants = { { arguments = { { type = 'string', - name = 'line', - description = 'A line of text.' - } + name = 'text', + description = 'A string.', + }, }, returns = { { type = 'number', name = 'width', - description = 'The width of the line.' - } - } - } - } + description = 'The width of the text.', + }, + }, + }, + }, }, { name = 'getWrap', @@ -138,86 +153,113 @@ return { { type = 'string', name = 'text', - description = 'The text that will be wrapped.' + description = 'The text that will be wrapped.', }, { type = 'number', name = 'wraplimit', - description = 'The maximum width in pixels of each line that text is allowed before wrapping.' - } + description = 'The maximum width in pixels of each line that \'\'text\'\' is allowed before wrapping.', + }, }, returns = { { type = 'number', name = 'width', - description = 'The maximum width of the wrapped text.' + description = 'The maximum width of the wrapped text.', }, { type = 'table', name = 'wrappedtext', - description = 'A sequence containing each line of text that was wrapped.' - } - } - } - } + description = 'A sequence containing each line of text that was wrapped.', + }, + }, + }, + }, }, { name = 'hasGlyphs', - description = 'Gets whether the font can render a particular character.', + description = 'Gets whether the Font can render a character or string.', variants = { { arguments = { { type = 'string', - name = 'character', - description = 'A unicode character.' - } + name = 'text', + description = 'A UTF-8 encoded unicode string.', + }, }, returns = { { type = 'boolean', name = 'hasglyph', - description = 'Whether the font can render the glyph represented by the character.' - } - } + description = 'Whether the font can render all the UTF-8 characters in the string.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'character1', + description = 'A unicode character.', + }, + { + type = 'string', + name = 'character2', + description = 'Another unicode character.', + }, + }, + returns = { + { + type = 'boolean', + name = 'hasglyph', + description = 'Whether the font can render all the glyphs represented by the characters.', + }, + }, }, { arguments = { { type = 'number', - name = 'codepoint', - description = 'A unicode codepoint number.' - } + name = 'codepoint1', + description = 'A unicode codepoint number.', + }, + { + type = 'number', + name = 'codepoint2', + description = 'Another unicode codepoint number.', + }, }, returns = { { type = 'boolean', name = 'hasglyph', - description = 'Whether the font can render the glyph represented by the codepoint number.' - } - } - } - } + description = 'Whether the font can render all the glyphs represented by the codepoint numbers.', + }, + }, + }, + }, }, { name = 'setFallbacks', - description = 'Sets the fallback fonts. When the Font doesn\'t contain a glyph, it will substitute the glyph from the next subsequent fallback Fonts. This is akin to setting a "font stack" in Cascading Style Sheets (CSS).', + description = 'Sets the fallback fonts. When the Font doesn\'t contain a glyph, it will substitute the glyph from the next subsequent fallback Fonts. This is akin to setting a \'font stack\' in Cascading Style Sheets (CSS).', variants = { { + description = 'If this is called it should be before love.graphics.print, Font:getWrap, and other Font methods which use glyph positioning information are called.\n\nEvery fallback Font must be created from the same file type as the primary Font. For example, a Font created from a .ttf file can only use fallback Fonts that were created from .ttf files.', arguments = { { type = 'Font', name = 'fallbackfont1', - description = 'The first fallback Font to use.' + description = 'The first fallback Font to use.', }, { type = 'Font', name = '...', - description = 'Additional fallback Fonts.' - } - } - } - } + description = 'Additional fallback Fonts.', + }, + }, + }, + }, }, { name = 'setFilter', @@ -228,42 +270,37 @@ return { { type = 'FilterMode', name = 'min', - description = 'How to scale a font down.' + description = 'How to scale a font down.', }, { type = 'FilterMode', name = 'mag', - default = 'min', - description = 'How to scale a font up.' + description = 'How to scale a font up.', }, { type = 'number', name = 'anisotropy', + description = 'Maximum amount of anisotropic filtering used.', default = '1', - description = 'Maximum amount of anisotropic filtering used.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setLineHeight', - description = 'Sets the line height. When rendering the font in lines the actual height will be determined by the line height multiplied by the height of the font. The default is 1.0.', + description = 'Sets the line height. \n\nWhen rendering the font in lines the actual height will be \n\ndetermined by the line height multiplied by the height of the font. \n\nThe default is 1.0.', variants = { { arguments = { { type = 'number', name = 'height', - description = 'The new line height.' - } - } - } - } - } + description = 'The new line height.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Image.lua b/modules/graphics/types/Image.lua index 248aa33c..8f0956ea 100644 --- a/modules/graphics/types/Image.lua +++ b/modules/graphics/types/Image.lua @@ -1,8 +1,12 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Image', description = 'Drawable image type.', - constructors = { - 'newImage' + supertypes = { + 'Texture', + 'Drawable', + 'Object', }, functions = { { @@ -14,16 +18,16 @@ return { { type = 'number', name = 'width', - description = 'The width of the Image, in pixels.' + description = 'The width of the Image, in pixels.', }, { type = 'number', name = 'height', - description = 'The height of the Image, in pixels.' - } - } - } - } + description = 'The height of the Image, in pixels.', + }, + }, + }, + }, }, { name = 'getFilter', @@ -34,16 +38,35 @@ return { { type = 'FilterMode', name = 'min', - description = 'Filter mode used when minifying the image.' + description = 'Filter mode used when minifying the image.', }, { type = 'FilterMode', name = 'mag', - description = 'Filter mode used when magnifying the image.' - } - } - } - } + description = 'Filter mode used when magnifying the image.', + }, + }, + }, + { + returns = { + { + type = 'FilterMode', + name = 'min', + description = 'Filter mode used when minifying the image.', + }, + { + type = 'FilterMode', + name = 'mag', + description = 'Filter mode used when magnifying the image.', + }, + { + type = 'number', + name = 'anisotropy', + description = 'Maximum amount of anisotropic filtering used.', + }, + }, + }, + }, }, { name = 'getFlags', @@ -54,11 +77,11 @@ return { { type = 'table', name = 'flags', - description = 'A table with ImageFlag keys.' - } - } - } - } + description = 'A table with ImageFlag keys.', + }, + }, + }, + }, }, { name = 'getHeight', @@ -69,31 +92,11 @@ return { { type = 'number', name = 'height', - description = 'The height of the Image, in pixels.' - } - } - } - } - }, - { - name = 'getMipmapFilter', - description = 'Gets the mipmap filter mode for an Image.', - variants = { - { - returns = { - { - type = 'FilterMode', - name = 'mode', - description = 'The filter mode used in between mipmap levels. nil if mipmap filtering is not enabled.' + description = 'The height of the Image, in pixels.', }, - { - type = 'number', - name = 'sharpness', - description = 'Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.' - } - } - } - } + }, + }, + }, }, { name = 'getWidth', @@ -104,11 +107,11 @@ return { { type = 'number', name = 'width', - description = 'The width of the Image, in pixels.' - } - } - } - } + description = 'The width of the Image, in pixels.', + }, + }, + }, + }, }, { name = 'getWrap', @@ -118,43 +121,60 @@ return { returns = { { type = 'WrapMode', - name = 'horizontal', - description = 'Horizontal wrapping mode of the image.' + name = 'horiz', + description = 'Horizontal wrapping mode of the image.', }, { type = 'WrapMode', - name = 'vertical', - description = 'Vertical wrapping mode of the image.' - } - } - } - } + name = 'vert', + description = 'Vertical wrapping mode of the image.', + }, + }, + }, + }, }, { name = 'replacePixels', - description = 'Replaces the contents of an Image.', + description = 'Replace the contents of an Image.', variants = { { arguments = { { type = 'ImageData', name = 'data', - description = 'The new ImageData to replace the contents with.' + description = 'The new ImageData to replace the contents with.', }, { type = 'number', name = 'slice', - description = 'Which slice to replace, if applicable.' + description = 'Which cubemap face, array index, or volume layer to replace, if applicable.', }, { type = 'number', name = 'mipmap', + description = 'The mimap level to replace, if the Image has mipmaps.', + default = '1', + }, + { + type = 'number', + name = 'x', + description = 'The x-offset in pixels from the top-left of the image to replace. The given ImageData\'s width plus this value must not be greater than the pixel width of the Image\'s specified mipmap level.', default = '0', - description = 'The mimap level of the new ImageData. If 0 Image:replacePixels will generate new mimaps.' - } - } - } - } + }, + { + type = 'number', + name = 'y', + description = 'The y-offset in pixels from the top-left of the image to replace. The given ImageData\'s height plus this value must not be greater than the pixel height of the Image\'s specified mipmap level.', + default = '0', + }, + { + type = 'boolean', + name = 'reloadmipmaps', + description = 'Whether to generate new mipmaps after replacing the Image\'s pixels. True by default if the Image was created with automatically generated mipmaps, false by default otherwise.', + }, + }, + }, + }, }, { name = 'setFilter', @@ -165,68 +185,56 @@ return { { type = 'FilterMode', name = 'min', - description = 'How to scale an image down.' + description = 'How to scale an image down.', }, { type = 'FilterMode', name = 'mag', - default = 'min', - description = 'How to scale an image up.' - } - } - } - } - }, - { - name = 'setMipmapFilter', - description = 'Sets the mipmap filter mode for an Image.\n\nMipmapping is useful when drawing an image at a reduced scale. It can improve performance and reduce aliasing issues.\n\nIn 0.10.0 and newer, the Image must be created with the mipmaps flag enabled for the mipmap filter to have any effect.', - variants = { + description = 'How to scale an image up.', + }, + }, + }, { arguments = { { type = 'FilterMode', - name = 'filtermode', - description = 'The filter mode to use in between mipmap levels. "nearest" will often give better performance.' + name = 'min', + description = 'How to scale an image down.', + }, + { + type = 'FilterMode', + name = 'mag', + description = 'How to scale an image up.', }, { type = 'number', - name = 'sharpness', - default = '0', - description = 'A positive sharpness value makes the image use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.' - } - } + name = 'anisotropy', + description = 'Maximum amount of anisotropic filtering used.', + default = '1', + }, + }, }, - { - description = 'Disables mipmap filtering.', - } - } + }, }, { name = 'setWrap', - description = 'Sets the wrapping properties of an Image.\n\nThis function sets the way an Image is repeated when it is drawn with a Quad that is larger than the image\'s extent. An image may be clamped or set to repeat in both horizontal and vertical directions. Clamped images appear only once, but repeated ones repeat as many times as there is room in the Quad.\n\nIf you use a Quad that is larger than the image extent and do not use repeated tiling, there may be an unwanted visual effect of the image stretching all the way to fill the Quad. If this is the case, setting Image:getWrap("repeat", "repeat") for all the images to be repeated, and using Quad of appropriate size will result in the best visual appearance.', + description = 'Sets the wrapping properties of an Image.\n\nThis function sets the way an Image is repeated when it is drawn with a Quad that is larger than the image\'s extent. An image may be clamped or set to repeat in both horizontal and vertical directions. Clamped images appear only once, but repeated ones repeat as many times as there is room in the Quad.\n\nN.B. If you use a Quad that is larger than the image extent and do not use repeated tiling, there may be an unwanted visual effect of the image stretching all the way to fill the Quad. If this is the case, setting Image:setWrap(\'repeat\', \'repeat\') for all the images to be repeated, and using Quads of appropriate size will result in the best visual appearance.', variants = { { arguments = { { type = 'WrapMode', - name = 'horizontal', - description = 'Horizontal wrapping mode of the image.' + name = 'horiz', + description = 'Horizontal wrapping mode of the image.', }, { type = 'WrapMode', - name = 'vertical', - default = 'horizontal', - description = 'Vertical wrapping mode of the image.' - } - } - } - } - } + name = 'vert', + description = 'Vertical wrapping mode of the image.', + }, + }, + }, + }, + }, }, - parenttype = 'Texture', - supertypes = { - 'Object', - 'Drawable', - 'Texture' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Mesh.lua b/modules/graphics/types/Mesh.lua index 74f33449..56c5f158 100644 --- a/modules/graphics/types/Mesh.lua +++ b/modules/graphics/types/Mesh.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Mesh', description = 'A 2D polygon mesh used for drawing arbitrary textured shapes.', - constructors = { - 'newMesh' + supertypes = { + 'Drawable', + 'Object', }, functions = { { @@ -14,16 +17,90 @@ return { { type = 'string', name = 'name', - description = 'The name of the vertex attribute to attach.' + description = 'The name of the vertex attribute to attach.', + }, + { + type = 'Mesh', + name = 'mesh', + description = 'The Mesh to get the vertex attribute from.', + }, + }, + }, + { + description = 'If a Mesh wasn\'t created with a custom vertex format, it will have 3 vertex attributes named VertexPosition, VertexTexCoord, and VertexColor.\n\nCustom named attributes can be accessed in a vertex shader by declaring them as attribute vec4 MyCustomAttributeName; at the top-level of the vertex shader code. The name must match what was specified in the Mesh\'s vertex format and in the name argument of Mesh:attachAttribute.', + arguments = { + { + type = 'string', + name = 'name', + description = 'The name of the vertex attribute to attach.', + }, + { + type = 'Mesh', + name = 'mesh', + description = 'The Mesh to get the vertex attribute from.', + }, + { + type = 'VertexAttributeStep', + name = 'step', + description = 'Whether the attribute will be per-vertex or per-instance when the mesh is drawn.', + default = '\'pervertex\'', + }, + { + type = 'string', + name = 'attachname', + description = 'The name of the attribute to use in shader code. Defaults to the name of the attribute in the given mesh. Can be used to use a different name for this attribute when rendering.', + default = 'name', + }, + }, + }, + }, + }, + { + name = 'attachAttribute', + description = 'Attaches a vertex attribute from a different Mesh onto this Mesh, for use when drawing. This can be used to share vertex attribute data between several different Meshes.', + variants = { + { + arguments = { + { + type = 'string', + name = 'name', + description = 'The name of the vertex attribute to attach.', + }, + { + type = 'Mesh', + name = 'mesh', + description = 'The Mesh to get the vertex attribute from.', + }, + }, + }, + { + description = 'If a Mesh wasn\'t created with a custom vertex format, it will have 3 vertex attributes named VertexPosition, VertexTexCoord, and VertexColor.\n\nCustom named attributes can be accessed in a vertex shader by declaring them as attribute vec4 MyCustomAttributeName; at the top-level of the vertex shader code. The name must match what was specified in the Mesh\'s vertex format and in the name argument of Mesh:attachAttribute.', + arguments = { + { + type = 'string', + name = 'name', + description = 'The name of the vertex attribute to attach.', }, { type = 'Mesh', name = 'mesh', - description = 'The Mesh to get the vertex attribute from.' - } - } - } - } + description = 'The Mesh to get the vertex attribute from.', + }, + { + type = 'VertexAttributeStep', + name = 'step', + description = 'Whether the attribute will be per-vertex or per-instance when the mesh is drawn.', + default = '\'pervertex\'', + }, + { + type = 'string', + name = 'attachname', + description = 'The name of the attribute to use in shader code. Defaults to the name of the attribute in the given mesh. Can be used to use a different name for this attribute when rendering.', + default = 'name', + }, + }, + }, + }, }, { name = 'detachAttribute', @@ -34,18 +111,18 @@ return { { type = 'string', name = 'name', - description = 'The name of the attached vertex attribute to detach.' - } + description = 'The name of the attached vertex attribute to detach.', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the attribute was successfully detached.' - } - } - } - } + description = 'Whether the attribute was successfully detached.', + }, + }, + }, + }, }, { name = 'getDrawMode', @@ -56,31 +133,32 @@ return { { type = 'MeshDrawMode', name = 'mode', - description = 'The mode used when drawing the Mesh.' - } - } - } - } + description = 'The mode used when drawing the Mesh.', + }, + }, + }, + }, }, { name = 'getDrawRange', - description = 'Gets the range of vertices used when drawing the Mesh.\n\nIf the Mesh\'s draw range has not been set previously with Mesh:setDrawRange, this function will return nil.', + description = 'Gets the range of vertices used when drawing the Mesh.', variants = { { + description = 'If the Mesh\'s draw range has not been set previously with Mesh:setDrawRange, this function will return nil.', returns = { { type = 'number', name = 'min', - description = 'The index of the first vertex used when drawing, or the index of the first value in the vertex map used if one is set for this Mesh.' + description = 'The index of the first vertex used when drawing, or the index of the first value in the vertex map used if one is set for this Mesh.', }, { type = 'number', name = 'max', - description = 'The index of the last vertex used when drawing, or the index of the last value in the vertex map used if one is set for this Mesh.' - } - } - } - } + description = 'The index of the last vertex used when drawing, or the index of the last value in the vertex map used if one is set for this Mesh.', + }, + }, + }, + }, }, { name = 'getTexture', @@ -91,89 +169,91 @@ return { { type = 'Texture', name = 'texture', - description = 'The Image or Canvas to texture the Mesh with when drawing, or nil if none is set.' - } - } - } - } + description = 'The Image or Canvas to texture the Mesh with when drawing, or nil if none is set.', + }, + }, + }, + }, }, { name = 'getVertex', - description = 'Gets the properties of a vertex in the Mesh.', + description = 'Gets the properties of a vertex in the Mesh.\n\nIn versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { + description = 'The values are returned in the same order as the vertex attributes in the Mesh\'s vertex format. A standard Mesh that wasn\'t created with a custom vertex format will return two position numbers, two texture coordinate numbers, and four color components: x, y, u, v, r, g, b, a.', arguments = { { type = 'number', name = 'index', - description = 'The index of the the vertex you want to retrieve the information for.' - } + description = 'The one-based index of the vertex you want to retrieve the information for.', + }, }, returns = { { type = 'number', name = 'attributecomponent', - description = 'The first component of the first vertex attribute in the specified vertex.' + description = 'The first component of the first vertex attribute in the specified vertex.', }, { type = 'number', name = '...', - description = 'Additional components of all vertex attributes in the specified vertex.' - } - } + description = 'Additional components of all vertex attributes in the specified vertex.', + }, + }, }, { + description = 'Gets the vertex components of a Mesh that wasn\'t created with a custom vertex format.', arguments = { { type = 'number', name = 'index', - description = 'The index of the the vertex you want to retrieve the information for.' - } + description = 'The index of the vertex you want to retrieve the information for.', + }, }, returns = { { type = 'number', name = 'x', - description = 'The position of the vertex on the x-axis.' + description = 'The position of the vertex on the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the vertex on the y-axis.' + description = 'The position of the vertex on the y-axis.', }, { type = 'number', name = 'u', - description = 'The horizontal component of the texture coordinate.' + description = 'The horizontal component of the texture coordinate.', }, { type = 'number', name = 'v', - description = 'The vertical component of the texture coordinate.' + description = 'The vertical component of the texture coordinate.', }, { type = 'number', name = 'r', - description = 'The red component of the vertex\'s color.' + description = 'The red component of the vertex\'s color.', }, { type = 'number', name = 'g', - description = 'The green component of the vertex\'s color.' + description = 'The green component of the vertex\'s color.', }, { type = 'number', name = 'b', - description = 'The blue component of the vertex\'s color.' + description = 'The blue component of the vertex\'s color.', }, { type = 'number', name = 'a', - description = 'The alpha component of the vertex\'s color.' - } - } - } - } + description = 'The alpha component of the vertex\'s color.', + }, + }, + }, + }, }, { name = 'getVertexAttribute', @@ -184,54 +264,55 @@ return { { type = 'number', name = 'vertexindex', - description = 'The index of the the vertex to be modified.' + description = 'The index of the the vertex you want to retrieve the attribute for (one-based).', }, { type = 'number', name = 'attributeindex', - description = 'The index of the attribute within the vertex to be modified.' - } + description = 'The index of the attribute within the vertex to be retrieved (one-based).', + }, }, returns = { { type = 'number', name = 'value1', - description = 'The value of the first component of the attribute.' + description = 'The value of the first component of the attribute.', }, { type = 'number', name = 'value2', - description = 'The value of the second component of the attribute.' + description = 'The value of the second component of the attribute.', }, { type = 'number', name = '...', - description = 'Any additional vertex attribute components.' - } - } - } - } + description = 'Any additional vertex attribute components.', + }, + }, + }, + }, }, { name = 'getVertexCount', - description = 'Returns the total number of vertices in the Mesh.', + description = 'Gets the total number of vertices in the Mesh.', variants = { { returns = { { type = 'number', - name = 'num', - description = 'The total number of vertices in this Mesh.' - } - } - } - } + name = 'count', + description = 'The total number of vertices in the mesh.', + }, + }, + }, + }, }, { name = 'getVertexFormat', description = 'Gets the vertex format that the Mesh was created with.', variants = { { + description = 'If a Mesh wasn\'t created with a custom vertex format, it will have the following vertex format:\n\ndefaultformat = {\n\n {\'VertexPosition\', \'float\', 2}, -- The x,y position of each vertex.\n\n {\'VertexTexCoord\', \'float\', 2}, -- The u,v texture coordinates of each vertex.\n\n {\'VertexColor\', \'byte\', 4} -- The r,g,b,a color of each vertex.\n\n}', returns = { { type = 'table', @@ -247,12 +328,12 @@ return { type = 'table', name = '...', description = 'Additional vertex attributes in the Mesh.', - } - } - } - } - } - } + }, + }, + }, + }, + }, + }, }, { name = 'getVertexMap', @@ -263,53 +344,55 @@ return { { type = 'table', name = 'map', - description = 'A table containing a list of vertex indices used when drawing.' - } - } - } - } + description = 'A table containing the list of vertex indices used when drawing.', + }, + }, + }, + }, }, { name = 'isAttributeEnabled', description = 'Gets whether a specific vertex attribute in the Mesh is enabled. Vertex data from disabled attributes is not used when drawing the Mesh.', variants = { { + description = 'If a Mesh wasn\'t created with a custom vertex format, it will have 3 vertex attributes named VertexPosition, VertexTexCoord, and VertexColor. Otherwise the attribute name must either match one of the vertex attributes specified in the vertex format when creating the Mesh, \n\nor must match a vertex attribute from another Mesh attached to this Mesh via Mesh:attachAttribute.', arguments = { { type = 'string', name = 'name', - description = 'The name of the vertex attribute to enable or disable.' - } + description = 'The name of the vertex attribute to be checked.', + }, }, returns = { { type = 'boolean', name = 'enabled', - description = 'Whether the vertex attribute is used when drawing this Mesh.' - } - } - } - } + description = 'Whether the vertex attribute is used when drawing this Mesh.', + }, + }, + }, + }, }, { name = 'setAttributeEnabled', description = 'Enables or disables a specific vertex attribute in the Mesh. Vertex data from disabled attributes is not used when drawing the Mesh.', variants = { { + description = 'If a Mesh wasn\'t created with a custom vertex format, it will have 3 vertex attributes named VertexPosition, VertexTexCoord, and VertexColor. Otherwise the attribute name must either match one of the vertex attributes specified in the vertex format when creating the Mesh, \n\nor must match a vertex attribute from another Mesh attached to this Mesh via Mesh:attachAttribute.', arguments = { { type = 'string', name = 'name', - description = 'The name of the vertex attribute to enable or disable.' + description = 'The name of the vertex attribute to enable or disable.', }, { type = 'boolean', name = 'enable', - description = 'Whether the vertex attribute is used when drawing this Mesh.' - } - } - } - } + description = 'Whether the vertex attribute is used when drawing this Mesh.', + }, + }, + }, + }, }, { name = 'setDrawMode', @@ -320,80 +403,84 @@ return { { type = 'MeshDrawMode', name = 'mode', - description = 'The mode to use when drawing the Mesh.' - } - } - } - } + description = 'The mode to use when drawing the Mesh.', + }, + }, + }, + }, }, { name = 'setDrawRange', - description = 'Restricts the drawn vertices of the Mesh to a subset of the total.\n\nIf a vertex map is used with the Mesh, this method will set a subset of the values in the vertex map array to use, instead of a subset of the total vertices in the Mesh.\n\nFor example, if Mesh:setVertexMap(1, 2, 3, 1, 3, 4) and Mesh:setDrawRange(4, 6) are called, vertices 1, 3, and 4 will be drawn.', + description = 'Restricts the drawn vertices of the Mesh to a subset of the total.', variants = { { arguments = { { type = 'number', - name = 'min', - description = 'The index of the first vertex to use when drawing, or the index of the first value in the vertex map to use if one is set for this Mesh.' + name = 'start', + description = 'The index of the first vertex to use when drawing, or the index of the first value in the vertex map to use if one is set for this Mesh.', }, { type = 'number', - name = 'max', - description = 'The index of the last vertex to use when drawing, or the index of the last value in the vertex map to use if one is set for this Mesh.' - } - } + name = 'count', + description = 'The number of vertices to use when drawing, or number of values in the vertex map to use if one is set for this Mesh.', + }, + }, }, { - description = 'Allows all vertices in the Mesh to be drawn.' - } - } + description = 'Allows all vertices in the Mesh to be drawn.', + }, + }, }, { name = 'setTexture', - description = 'Sets the texture (Image or Canvas) used when drawing the Mesh.\n\nWhen called without an argument disables the texture. Untextured meshes have a white color by default.', + description = 'Sets the texture (Image or Canvas) used when drawing the Mesh.', variants = { - {}, { arguments = { { type = 'Texture', name = 'texture', - description = 'The Image or Canvas to texture the Mesh with when drawing.' - } - } - } - } + description = 'The Image or Canvas to texture the Mesh with when drawing.', + }, + }, + }, + { + description = 'Disables any texture from being used when drawing the Mesh. Untextured meshes have a white color by default.', + }, + }, }, { name = 'setVertex', - description = 'Sets the properties of a vertex in the Mesh.', + description = 'Sets the properties of a vertex in the Mesh.\n\nIn versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { + description = 'The arguments are in the same order as the vertex attributes in the Mesh\'s vertex format. A standard Mesh that wasn\'t created with a custom vertex format will use two position numbers, two texture coordinate numbers, and four color components per vertex: x, y, u, v, r, g, b, a.\n\nIf no value is supplied for a specific vertex attribute component, it will be set to a default value of 0 if its data type is \'float\', or 1 if its data type is \'byte\'.', arguments = { { type = 'number', name = 'index', - description = 'The index of the the vertex you want to modify.' + description = 'The index of the the vertex you want to modify (one-based).', }, { type = 'number', name = 'attributecomponent', - description = 'The first component of the first vertex attribute in the specified vertex.' + description = 'The first component of the first vertex attribute in the specified vertex.', }, { type = 'number', name = '...', - description = 'Additional components of all vertex attributes in the specified vertex.' - } - } + description = 'Additional components of all vertex attributes in the specified vertex.', + }, + }, }, { + description = 'The table indices are in the same order as the vertex attributes in the Mesh\'s vertex format. A standard Mesh that wasn\'t created with a custom vertex format will use two position numbers, two texture coordinate numbers, and four color components per vertex: x, y, u, v, r, g, b, a.\n\nIf no value is supplied for a specific vertex attribute component, it will be set to a default value of 0 if its data type is \'float\', or 1 if its data type is \'byte\'.', arguments = { { type = 'number', name = 'index', - description = 'The index of the the vertex you want to modify.' + description = 'The index of the the vertex you want to modify (one-based).', }, { type = 'table', @@ -403,16 +490,16 @@ return { { type = 'number', name = 'attributecomponent', - description = 'The first component of the first vertex attribute in the specified vertex.' + description = 'The first component of the first vertex attribute in the specified vertex.', }, { type = 'number', name = '...', - description = 'Additional components of all vertex attributes in the specified vertex.' - } - } - } - } + description = 'Additional components of all vertex attributes in the specified vertex.', + }, + }, + }, + }, }, { description = 'Sets the vertex components of a Mesh that wasn\'t created with a custom vertex format.', @@ -420,53 +507,53 @@ return { { type = 'number', name = 'index', - description = 'The index of the the vertex you want to modify.' + description = 'The index of the the vertex you want to modify (one-based).', }, { type = 'number', name = 'x', - description = 'The position of the vertex on the x-axis.' + description = 'The position of the vertex on the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the vertex on the y-axis.' + description = 'The position of the vertex on the y-axis.', }, { type = 'number', name = 'u', - description = 'The horizontal component of the texture coordinate.' + description = 'The horizontal component of the texture coordinate.', }, { type = 'number', name = 'v', - description = 'The vertical component of the texture coordinate.' + description = 'The vertical component of the texture coordinate.', }, { type = 'number', name = 'r', + description = 'The red component of the vertex\'s color.', default = '1', - description = 'The red component of the vertex\'s color.' }, { type = 'number', name = 'g', + description = 'The green component of the vertex\'s color.', default = '1', - description = 'The green component of the vertex\'s color.' }, { type = 'number', name = 'b', + description = 'The blue component of the vertex\'s color.', default = '1', - description = 'The blue component of the vertex\'s color.' }, { type = 'number', name = 'a', + description = 'The alpha component of the vertex\'s color.', default = '1', - description = 'The alpha component of the vertex\'s color.' - } - } + }, + }, }, { description = 'Sets the vertex components of a Mesh that wasn\'t created with a custom vertex format.', @@ -474,7 +561,7 @@ return { { type = 'number', name = 'index', - description = 'The index of the the vertex you want to modify.' + description = 'The index of the the vertex you want to modify (one-based).', }, { type = 'table', @@ -483,88 +570,89 @@ return { table = { { type = 'number', - name = '[1]', - description = 'The position of the vertex on the x-axis.' + name = '1', + description = 'The position of the vertex on the x-axis.', }, { type = 'number', - name = '[2]', - description = 'The position of the vertex on the y-axis.' + name = '2', + description = 'The position of the vertex on the y-axis.', }, { type = 'number', - name = '[3]', - description = 'The horizontal component of the texture coordinate.' + name = '3', + description = 'The u texture coordinate. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.)', }, { type = 'number', - name = '[4]', - description = 'The vertical component of the texture coordinate.' + name = '4', + description = 'The v texture coordinate. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.)', }, { type = 'number', - name = '[5]', + name = '5', + description = 'The red color component.', default = '1', - description = 'The red component of the vertex\'s color.' }, { type = 'number', - name = '[6]', + name = '6', + description = 'The green color component.', default = '1', - description = 'The green component of the vertex\'s color.' }, { type = 'number', - name = '[7]', + name = '7', + description = 'The blue color component.', default = '1', - description = 'The blue component of the vertex\'s color.' }, { type = 'number', - name = '[8]', + name = '8', + description = 'The alpha color component.', default = '1', - description = 'The alpha component of the vertex\'s color.' - } - } - } - } - } - } + }, + }, + }, + }, + }, + }, }, { name = 'setVertexAttribute', description = 'Sets the properties of a specific attribute within a vertex in the Mesh.\n\nMeshes without a custom vertex format specified in love.graphics.newMesh have position as their first attribute, texture coordinates as their second attribute, and color as their third attribute.', variants = { { + description = 'Attribute components which exist within the attribute but are not specified as arguments default to 0 for attributes with the float data type, and 255 for the byte data type.', arguments = { { type = 'number', name = 'vertexindex', - description = 'The index of the the vertex to be modified.' + description = 'The index of the the vertex to be modified (one-based).', }, { type = 'number', name = 'attributeindex', - description = 'The index of the attribute within the vertex to be modified.' + description = 'The index of the attribute within the vertex to be modified (one-based).', }, { type = 'number', name = 'value1', - description = 'The value of the first component of the attribute.' + description = 'The new value for the first component of the attribute.', }, { type = 'number', name = 'value2', - description = 'The value of the second component of the attribute.' + description = 'The new value for the second component of the attribute.', }, { type = 'number', name = '...', - description = 'Any additional vertex attribute components.' - } - } - } - } + description = 'Any additional vertex attribute components.', + }, + }, + }, + }, }, { name = 'setVertexMap', @@ -575,36 +663,51 @@ return { { type = 'table', name = 'map', - description = 'A table containing a list of vertex indices to use when drawing. Values must be in the range of [1, Mesh:getVertexCount()].' - } - } + description = 'A table containing a list of vertex indices to use when drawing. Values must be in the range of Mesh:getVertexCount().', + }, + }, }, { arguments = { { type = 'number', name = 'vi1', - description = 'The index of the first vertex to use when drawing. Must be in the range of [1, Mesh:getVertexCount()].' + description = 'The index of the first vertex to use when drawing. Must be in the range of Mesh:getVertexCount().', }, { type = 'number', name = 'vi2', - description = 'The index of the second vertex to use when drawing.' + description = 'The index of the second vertex to use when drawing.', }, { type = 'number', name = 'vi3', - description = 'The index of the third vertex to use when drawing.' - } - } - } - } + description = 'The index of the third vertex to use when drawing.', + }, + }, + }, + { + arguments = { + { + type = 'Data', + name = 'data', + description = 'Array of vertex indices to use when drawing. Values must be in the range of Mesh:getVertexCount()-1', + }, + { + type = 'IndexDataType', + name = 'datatype', + description = 'Datatype of the vertex indices array above.', + }, + }, + }, + }, }, { name = 'setVertices', - description = 'Replaces a range of vertices in the Mesh with new ones. The total number of vertices in a Mesh cannot be changed after it has been created.', + description = 'Replaces a range of vertices in the Mesh with new ones. The total number of vertices in a Mesh cannot be changed after it has been created. This is often more efficient than calling Mesh:setVertex in a loop.', variants = { { + description = 'The values in each vertex table are in the same order as the vertex attributes in the Mesh\'s vertex format. A standard Mesh that wasn\'t created with a custom vertex format will use two position numbers, two texture coordinate numbers, and four color components per vertex: x, y, u, v, r, g, b, a.\n\nIf no value is supplied for a specific vertex attribute component, it will be set to a default value of 0 if its data type is \'float\', or 255 if its data type is \'byte\'.', arguments = { { type = 'table', @@ -614,22 +717,38 @@ return { { type = 'number', name = 'attributecomponent', - description = 'The first component of the first vertex attribute in the vertex.' + description = 'The first component of the first vertex attribute in the vertex.', }, { type = 'number', name = '...', - description = 'Additional components of all vertex attributes in the vertex.' + description = 'Additional components of all vertex attributes in the vertex.', }, - { - type = 'number', - name = 'startvertex', - default = '1', - description = 'The index of the first vertex to replace.' - } - } - } - } + }, + }, + { + type = 'number', + name = 'startvertex', + description = 'The index of the first vertex to replace.', + default = '1', + }, + }, + }, + { + description = 'Sets the vertex components of the Mesh by copying directly from the memory of a Data object.\n\nIf LuaJIT\'s FFI is used to populate the Data object via Data:getPointer and ffi.cast, this variant can be drastically more efficient than other methods of setting Mesh vertex data.', + arguments = { + { + type = 'Data', + name = 'data', + description = 'A Data object to copy from. The contents of the Data must match the layout of this Mesh\'s vertex format.', + }, + { + type = 'number', + name = 'startvertex', + description = 'The index of the first vertex to replace.', + default = '1', + }, + }, }, { description = 'Sets the vertex components of a Mesh that wasn\'t created with a custom vertex format.', @@ -641,58 +760,53 @@ return { table = { { type = 'number', - name = '[1]', + name = '1', description = 'The position of the vertex on the x-axis.', }, { type = 'number', - name = '[2]', + name = '2', description = 'The position of the vertex on the y-axis.', }, { type = 'number', - name = '[3]', - description = 'The horizontal component of the texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode).', + name = '3', + description = 'The horizontal component of the texture coordinate. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode).', }, { type = 'number', - name = '[4]', - description = 'The vertical component of the texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode).', + name = '4', + description = 'The vertical component of the texture coordinate. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode).', }, { type = 'number', - name = '[5]', - default = '1', + name = '5', description = 'The red color component.', + default = '1', }, { type = 'number', - name = '[6]', - default = '1', + name = '6', description = 'The green color component.', + default = '1', }, { type = 'number', - name = '[7]', - default = '1', + name = '7', description = 'The blue color component.', + default = '1', }, { type = 'number', - name = '[8]', - default = '1', + name = '8', description = 'The alpha color component.', + default = '1', }, - } - } - } - } - } - } + }, + }, + }, + }, + }, + }, }, - parenttype = 'Drawable', - supertypes = { - 'Drawable', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/ParticleSystem.lua b/modules/graphics/types/ParticleSystem.lua index 8d271dc0..aec13da0 100644 --- a/modules/graphics/types/ParticleSystem.lua +++ b/modules/graphics/types/ParticleSystem.lua @@ -1,24 +1,28 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'ParticleSystem', - description = 'Used to create cool effects, like fire. The particle systems are created and drawn on the screen using functions in love.graphics. They also need to be updated in the update(dt) callback for you to see any changes in the particles emitted.', - constructors = { - 'newParticleSystem' + description = 'A ParticleSystem can be used to create particle effects like fire or smoke.\n\nThe particle system has to be created using update it in the update callback to see any changes in the particles emitted.\n\nThe particle system won\'t create any particles unless you call setParticleLifetime and setEmissionRate.', + supertypes = { + 'Drawable', + 'Object', }, functions = { { name = 'clone', - description = 'Creates an identical copy of the ParticleSystem in the stopped state.\n\nCloned ParticleSystem inherit all the set-able state of the original ParticleSystem, but they are initialized stopped.', + description = 'Creates an identical copy of the ParticleSystem in the stopped state.', variants = { { + description = 'Cloned ParticleSystem inherit all the set-able state of the original ParticleSystem, but they are initialized stopped.', returns = { { type = 'ParticleSystem', name = 'particlesystem', - description = 'The new identical copy of this ParticleSystem.' - } - } - } - } + description = 'The new identical copy of this ParticleSystem.', + }, + }, + }, + }, }, { name = 'emit', @@ -29,136 +33,161 @@ return { { type = 'number', name = 'numparticles', - description = 'The amount of particles to emit. The number of emitted particles will be truncated if the particle system\'s max buffer size is reached.' - } - } - } - } - }, - { - name = 'getCount', - description = 'Gets the amount of particles that are currently in the system.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The current number of live particles.' - } - } - } - } - }, - { - name = 'getAreaSpread', - description = 'Gets the area-based spawn parameters for the particles.', - variants = { - { - returns = { - { - type = 'AreaSpreadDistribution', - name = 'distribution', - description = 'The type of distribution for new particles.' + description = 'The amount of particles to emit. The number of emitted particles will be truncated if the particle system\'s max buffer size is reached.', }, - { - type = 'number', - name = 'dx', - description = 'The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.' - }, - { - type = 'number', - name = 'dy', - description = 'The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.' - } - } - } - } + }, + }, + }, }, { name = 'getBufferSize', - description = 'Gets the size of the buffer (the max allowed amount of particles in the system).', + description = 'Gets the maximum number of particles the ParticleSystem can have at once.', variants = { { returns = { { type = 'number', - name = 'buffer', - description = 'The buffer size.' - } - } - } - } + name = 'size', + description = 'The maximum number of particles.', + }, + }, + }, + }, }, { name = 'getColors', - description = 'Gets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle\'s lifetime. Color modulation needs to be activated for this function to have any effect.\n\nArguments are passed in groups of four, representing the components of the desired RGBA value. At least one color must be specified. A maximum of eight may be used.', + description = 'Gets the series of colors applied to the particle sprite.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { returns = { { type = 'number', name = 'r1', - description = 'First color, red component (0-1).' + description = 'First color, red component (0-1).', }, { type = 'number', name = 'g1', - description = 'First color, green component (0-1).' + description = 'First color, green component (0-1).', }, { type = 'number', name = 'b1', - description = 'First color, blue component (0-1).' + description = 'First color, blue component (0-1).', }, { type = 'number', name = 'a1', - description = 'First color, alpha component (0-1).' + description = 'First color, alpha component (0-1).', }, { type = 'number', name = 'r2', - description = 'Second color, red component (0-1).' + description = 'Second color, red component (0-1).', }, { type = 'number', name = 'g2', - description = 'Second color, green component (0-1).' + description = 'Second color, green component (0-1).', }, { type = 'number', name = 'b2', - description = 'Second color, blue component (0-1).' + description = 'Second color, blue component (0-1).', }, { type = 'number', name = 'a2', - description = 'Second color, alpha component (0-1).' + description = 'Second color, alpha component (0-1).', + }, + { + type = 'number', + name = 'r8', + description = 'Eighth color, red component (0-1).', + }, + { + type = 'number', + name = 'g8', + description = 'Eighth color, green component (0-1).', }, { type = 'number', - name = '...', - description = 'Etc.' - } - } - } - } + name = 'b8', + description = 'Eighth color, blue component (0-1).', + }, + { + type = 'number', + name = 'a8', + description = 'Eighth color, alpha component (0-1).', + }, + }, + }, + }, + }, + { + name = 'getCount', + description = 'Gets the number of particles that are currently in the system.', + variants = { + { + returns = { + { + type = 'number', + name = 'count', + description = 'The current number of live particles.', + }, + }, + }, + }, }, { name = 'getDirection', - description = 'Gets the direction the particles will be emitted in.', + description = 'Gets the direction of the particle emitter (in radians).', variants = { { returns = { { type = 'number', name = 'direction', - description = 'The direction of the particles (in radians).' - } - } - } - } + description = 'The direction of the emitter (radians).', + }, + }, + }, + }, + }, + { + name = 'getEmissionArea', + description = 'Gets the area-based spawn parameters for the particles.', + variants = { + { + returns = { + { + type = 'AreaSpreadDistribution', + name = 'distribution', + description = 'The type of distribution for new particles.', + }, + { + type = 'number', + name = 'dx', + description = 'The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.', + }, + { + type = 'number', + name = 'dy', + description = 'The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.', + }, + { + type = 'number', + name = 'angle', + description = 'The angle in radians of the emission area.', + }, + { + type = 'boolean', + name = 'directionRelativeToCenter', + description = 'True if newly spawned particles will be oriented relative to the center of the emission area, false otherwise.', + }, + }, + }, + }, }, { name = 'getEmissionRate', @@ -169,26 +198,41 @@ return { { type = 'number', name = 'rate', - description = 'The amount of particles per second.' - } - } - } - } + description = 'The amount of particles per second.', + }, + }, + }, + }, + }, + { + name = 'getEmitterLifetime', + description = 'Gets how long the particle system will emit particles (if -1 then it emits particles forever).', + variants = { + { + returns = { + { + type = 'number', + name = 'life', + description = 'The lifetime of the emitter (in seconds).', + }, + }, + }, + }, }, { name = 'getInsertMode', - description = 'Gets the mode to use when the ParticleSystem adds new particles.', + description = 'Gets the mode used when the ParticleSystem adds new particles.', variants = { { returns = { { type = 'ParticleInsertMode', name = 'mode', - description = 'The mode to use when the ParticleSystem adds new particles.' - } - } - } - } + description = 'The mode used when the ParticleSystem adds new particles.', + }, + }, + }, + }, }, { name = 'getLinearAcceleration', @@ -199,26 +243,26 @@ return { { type = 'number', name = 'xmin', - description = 'The minimum acceleration along the x axis.' + description = 'The minimum acceleration along the x axis.', }, { type = 'number', name = 'ymin', - description = 'The minimum acceleration along the y axis.' + description = 'The minimum acceleration along the y axis.', }, { type = 'number', name = 'xmax', - description = 'The maximum acceleration along the x axis.' + description = 'The maximum acceleration along the x axis.', }, { type = 'number', name = 'ymax', - description = 'The maximum acceleration along the y axis.' - } - } - } - } + description = 'The maximum acceleration along the y axis.', + }, + }, + }, + }, }, { name = 'getLinearDamping', @@ -229,72 +273,76 @@ return { { type = 'number', name = 'min', - description = 'The minimum amount of linear damping applied to particles.' + description = 'The minimum amount of linear damping applied to particles.', }, { type = 'number', name = 'max', - description = 'The maximum amount of linear damping applied to particles.' + description = 'The maximum amount of linear damping applied to particles.', }, - } - } - } + }, + }, + }, }, { - name = 'getEmitterLifetime', - description = 'Gets how long the particle system should emit particles (if -1 then it emits particles forever).', + name = 'getOffset', + description = 'Gets the particle image\'s draw offset.', variants = { { returns = { { type = 'number', - name = 'life', - description = 'The lifetime of the emitter (in seconds).' - } - } - } - } + name = 'ox', + description = 'The x coordinate of the particle image\'s draw offset.', + }, + { + type = 'number', + name = 'oy', + description = 'The y coordinate of the particle image\'s draw offset.', + }, + }, + }, + }, }, { - name = 'getOffset', - description = 'Get the offget position which the particle sprite is rotated around. If this function is not used, the particles rotate around their center.', + name = 'getParticleLifetime', + description = 'Gets the lifetime of the particles.', variants = { { returns = { { type = 'number', - name = 'x', - description = 'The x coordinate of the rotation offget.' + name = 'min', + description = 'The minimum life of the particles (in seconds).', }, { type = 'number', - name = 'y', - description = 'The y coordinate of the rotation offget.' - } - } - } - } + name = 'max', + description = 'The maximum life of the particles (in seconds).', + }, + }, + }, + }, }, { - name = 'getParticleLifetime', - description = 'Gets the life of the particles.', + name = 'getPosition', + description = 'Gets the position of the emitter.', variants = { { returns = { { type = 'number', - name = 'min', - description = 'The minimum life of the particles (seconds).' + name = 'x', + description = 'Position along x-axis.', }, { type = 'number', - name = 'max', - default = 'min', - description = 'The maximum life of the particles (seconds).' - } - } - } - } + name = 'y', + description = 'Position along y-axis.', + }, + }, + }, + }, }, { name = 'getQuads', @@ -305,113 +353,91 @@ return { { type = 'table', name = 'quads', - description = 'A table containing the Quads used.' - } - } - } - } + description = 'A table containing the Quads used.', + }, + }, + }, + }, }, { - name = 'getPosition', - description = 'Gets the position of the emitter.', + name = 'getRadialAcceleration', + description = 'Gets the radial acceleration (away from the emitter).', variants = { { returns = { { type = 'number', - name = 'x', - description = 'Position along x-axis.' + name = 'min', + description = 'The minimum acceleration.', }, { type = 'number', - name = 'y', - description = 'Position along y-axis.' - } - } - } - } + name = 'max', + description = 'The maximum acceleration.', + }, + }, + }, + }, }, { - name = 'getRadialAcceleration', - description = 'Get the radial acceleration (away from the emitter).', + name = 'getRotation', + description = 'Gets the rotation of the image upon particle creation (in radians).', variants = { { returns = { { type = 'number', name = 'min', - description = 'The minimum acceleration.' + description = 'The minimum initial angle (radians).', }, { type = 'number', name = 'max', - default = 'min', - description = 'The maximum acceleration.' - } - } - } - } + description = 'The maximum initial angle (radians).', + }, + }, + }, + }, }, { - name = 'getRotation', - description = 'Gets the rotation of the image upon particle creation (in radians).', + name = 'getSizeVariation', + description = 'Gets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end).', variants = { { returns = { { type = 'number', - name = 'min', - description = 'The minimum initial angle (radians).' + name = 'variation', + description = 'The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', }, - { - type = 'number', - name = 'max', - default = 'min', - description = 'The maximum initial angle (radians).' - } - } - } - } + }, + }, + }, }, { name = 'getSizes', - description = 'Gets a series of sizes by which to scale a particle sprite. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle\'s lifetime.\n\nAt least one size must be specified. A maximum of eight may be used.', + description = 'Gets the series of sizes by which the sprite is scaled. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle\'s lifetime.', variants = { { returns = { { type = 'number', name = 'size1', - description = 'The first size.' + description = 'The first size.', }, { type = 'number', name = 'size2', - description = 'The second size.' + description = 'The second size.', }, { type = 'number', - name = '...', - description = 'Etc.' - } - } - } - } - }, - { - name = 'getSizeVariation', - description = 'Gets the degree of variation (0 meaning no variation and 1 meaning full variation between start and end).', - variants = { - { - returns = { - { - type = 'number', - name = 'variation', - description = 'The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).' - } - } - } - } + name = 'size8', + description = 'The eighth size.', + }, + }, + }, + }, }, { name = 'getSpeed', @@ -422,17 +448,16 @@ return { { type = 'number', name = 'min', - description = 'The minimum linear speed of the particles.' + description = 'The minimum linear speed of the particles.', }, { type = 'number', name = 'max', - default = 'min', - description = 'The maximum linear speed of the particles.' - } - } - } - } + description = 'The maximum linear speed of the particles.', + }, + }, + }, + }, }, { name = 'getSpin', @@ -443,62 +468,51 @@ return { { type = 'number', name = 'min', - description = 'The minimum spin (radians per second).' + description = 'The minimum spin (radians per second).', }, { type = 'number', name = 'max', - default = 'min', - description = 'The maximum spin (radians per second).' - } - } - } - } + description = 'The maximum spin (radians per second).', + }, + { + type = 'number', + name = 'variation', + description = 'The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).', + }, + }, + }, + }, }, { name = 'getSpinVariation', - description = 'Gets the degree of variation (0 meaning no variation and 1 meaning full variation between start and end).', + description = 'Gets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end).', variants = { { returns = { { type = 'number', name = 'variation', - description = 'The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).' - } - } - } - } + description = 'The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', + }, + }, + }, + }, }, { name = 'getSpread', - description = 'Gets the amount of spread for the system.', + description = 'Gets the amount of directional spread of the particle emitter (in radians).', variants = { { returns = { { type = 'number', name = 'spread', - description = 'The amount of spread (radians).' - } - } - } - } - }, - { - name = 'getTexture', - description = 'Gets the Image or Canvas which is to be emitted.', - variants = { - { - returns = { - { - type = 'Texture', - name = 'texture', - description = 'An Image or Canvas to use for the particle.' - } - } - } - } + description = 'The spread of the emitter (radians).', + }, + }, + }, + }, }, { name = 'getTangentialAcceleration', @@ -509,17 +523,31 @@ return { { type = 'number', name = 'min', - description = 'The minimum acceleration.' + description = 'The minimum acceleration.', }, { type = 'number', name = 'max', - default = 'min', - description = 'The maximum acceleration.' - } - } - } - } + description = 'The maximum acceleration.', + }, + }, + }, + }, + }, + { + name = 'getTexture', + description = 'Gets the texture (Image or Canvas) used for the particles.', + variants = { + { + returns = { + { + type = 'Texture', + name = 'texture', + description = 'The Image or Canvas used for the particles.', + }, + }, + }, + }, }, { name = 'hasRelativeRotation', @@ -529,12 +557,12 @@ return { returns = { { type = 'boolean', - name = 'enabled', - description = 'True if relative particle rotation is enabled, false if it\'s disabled.' - } - } - } - } + name = 'enable', + description = 'True if relative particle rotation is enabled, false if it\'s disabled.', + }, + }, + }, + }, }, { name = 'isActive', @@ -545,11 +573,11 @@ return { { type = 'boolean', name = 'active', - description = 'True if system is active, false otherwise.' - } - } - } - } + description = 'True if system is active, false otherwise.', + }, + }, + }, + }, }, { name = 'isPaused', @@ -560,11 +588,11 @@ return { { type = 'boolean', name = 'paused', - description = 'True if system is paused, false otherwise.' - } - } - } - } + description = 'True if system is paused, false otherwise.', + }, + }, + }, + }, }, { name = 'isStopped', @@ -575,11 +603,11 @@ return { { type = 'boolean', name = 'stopped', - description = 'True if system is stopped, false otherwise.' - } - } - } - } + description = 'True if system is stopped, false otherwise.', + }, + }, + }, + }, }, { name = 'moveTo', @@ -590,55 +618,32 @@ return { { type = 'number', name = 'x', - description = 'Position along x-axis.' + description = 'Position along x-axis.', }, { type = 'number', name = 'y', - description = 'Position along y-axis.' - } - } - } - } + description = 'Position along y-axis.', + }, + }, + }, + }, }, { name = 'pause', description = 'Pauses the particle emitter.', variants = { - {} - } + { + }, + }, }, { name = 'reset', description = 'Resets the particle emitter, removing any existing particles and resetting the lifetime counter.', - variants = { - {} - } - }, - { - name = 'setAreaSpread', - description = 'Sets area-based spawn parameters for the particles. Newly created particles will spawn in an area around the emitter based on the parameters to this function.', variants = { { - arguments = { - { - type = 'AreaSpreadDistribution', - name = 'distribution', - description = 'The type of distribution for new particles.' - }, - { - type = 'number', - name = 'dx', - description = 'The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.' - }, - { - type = 'number', - name = 'dy', - description = 'The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.' - } - } - } - } + }, + }, }, { name = 'setBufferSize', @@ -648,67 +653,82 @@ return { arguments = { { type = 'number', - name = 'buffer', - description = 'The buffer size.' - } - } - } - } + name = 'size', + description = 'The buffer size.', + }, + }, + }, + }, }, { name = 'setColors', - description = 'Sets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle\'s lifetime. Color modulation needs to be activated for this function to have any effect.\n\nArguments are passed in groups of four, representing the components of the desired RGBA value. At least one color must be specified. A maximum of eight may be used.', + description = 'Sets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle\'s lifetime.\n\nArguments can be passed in groups of four, representing the components of the desired RGBA value, or as tables of RGBA component values, with a default alpha value of 1 if only three values are given. At least one color must be specified. A maximum of eight may be used.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { type = 'number', name = 'r1', - description = 'First color, red component (0-1).' + description = 'First color, red component (0-1).', }, { type = 'number', name = 'g1', - description = 'First color, green component (0-1).' + description = 'First color, green component (0-1).', }, { type = 'number', name = 'b1', - description = 'First color, blue component (0-1).' + description = 'First color, blue component (0-1).', }, { type = 'number', name = 'a1', - description = 'First color, alpha component (0-1).' + description = 'First color, alpha component (0-1).', }, { type = 'number', name = 'r2', - description = 'Second color, red component (0-1).' + description = 'Second color, red component (0-1).', }, { type = 'number', name = 'g2', - description = 'Second color, green component (0-1).' + description = 'Second color, green component (0-1).', }, { type = 'number', name = 'b2', - description = 'Second color, blue component (0-1).' + description = 'Second color, blue component (0-1).', }, { type = 'number', name = 'a2', - description = 'Second color, alpha component (0-1).' + description = 'Second color, alpha component (0-1).', + }, + { + type = 'number', + name = 'r8', + description = 'Eighth color, red component (0-1).', }, { type = 'number', - name = '...', - description = 'Etc.' - } - } - } - } + name = 'g8', + description = 'Eighth color, green component (0-1).', + }, + { + type = 'number', + name = 'b8', + description = 'Eighth color, blue component (0-1).', + }, + { + type = 'number', + name = 'a8', + description = 'Eighth color, alpha component (0-1).', + }, + }, + }, + }, }, { name = 'setDirection', @@ -719,11 +739,48 @@ return { { type = 'number', name = 'direction', - description = 'The direction of the particles (in radians).' - } - } - } - } + description = 'The direction of the particles (in radians).', + }, + }, + }, + }, + }, + { + name = 'setEmissionArea', + description = 'Sets area-based spawn parameters for the particles. Newly created particles will spawn in an area around the emitter based on the parameters to this function.', + variants = { + { + arguments = { + { + type = 'AreaSpreadDistribution', + name = 'distribution', + description = 'The type of distribution for new particles.', + }, + { + type = 'number', + name = 'dx', + description = 'The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.', + }, + { + type = 'number', + name = 'dy', + description = 'The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.', + }, + { + type = 'number', + name = 'angle', + description = 'The angle in radians of the emission area.', + default = '0', + }, + { + type = 'boolean', + name = 'directionRelativeToCenter', + description = 'True if newly spawned particles will be oriented relative to the center of the emission area, false otherwise.', + default = 'false', + }, + }, + }, + }, }, { name = 'setEmissionRate', @@ -734,11 +791,11 @@ return { { type = 'number', name = 'rate', - description = 'The amount of particles per second.' - } - } - } - } + description = 'The amount of particles per second.', + }, + }, + }, + }, }, { name = 'setEmitterLifetime', @@ -749,11 +806,11 @@ return { { type = 'number', name = 'life', - description = 'The lifetime of the emitter (in seconds).' - } - } - } - } + description = 'The lifetime of the emitter (in seconds).', + }, + }, + }, + }, }, { name = 'setInsertMode', @@ -764,11 +821,11 @@ return { { type = 'ParticleInsertMode', name = 'mode', - description = 'The mode to use when the ParticleSystem adds new particles.' - } - } - } - } + description = 'The mode to use when the ParticleSystem adds new particles.', + }, + }, + }, + }, }, { name = 'setLinearAcceleration', @@ -779,29 +836,28 @@ return { { type = 'number', name = 'xmin', - description = 'The minimum acceleration along the x axis.' + description = 'The minimum acceleration along the x axis.', }, { type = 'number', name = 'ymin', - default = '0', - description = 'The minimum acceleration along the y axis.' + description = 'The minimum acceleration along the y axis.', }, { type = 'number', name = 'xmax', + description = 'The maximum acceleration along the x axis.', default = 'xmin', - description = 'The maximum acceleration along the x axis.' }, { type = 'number', name = 'ymax', + description = 'The maximum acceleration along the y axis.', default = 'ymin', - description = 'The maximum acceleration along the y axis.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setLinearDamping', @@ -812,57 +868,58 @@ return { { type = 'number', name = 'min', - description = 'The minimum amount of linear damping applied to particles.' + description = 'The minimum amount of linear damping applied to particles.', }, { type = 'number', name = 'max', - description = 'The maximum amount of linear damping applied to particles.' + description = 'The maximum amount of linear damping applied to particles.', + default = 'min', }, - } - } - } + }, + }, + }, }, { name = 'setOffset', - description = 'Set the offset position which the particle sprite is rotated around. If this function is not used, the particles rotate around their center.', + description = 'Set the offset position which the particle sprite is rotated around.\n\nIf this function is not used, the particles rotate around their center.', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The x coordinate of the rotation offset.' + description = 'The x coordinate of the rotation offset.', }, { type = 'number', name = 'y', - description = 'The y coordinate of the rotation offset.' - } - } - } - } + description = 'The y coordinate of the rotation offset.', + }, + }, + }, + }, }, { name = 'setParticleLifetime', - description = 'Sets the life of the particles.', + description = 'Sets the lifetime of the particles.', variants = { { arguments = { { type = 'number', name = 'min', - description = 'The minimum life of the particles (seconds).' + description = 'The minimum life of the particles (in seconds).', }, { type = 'number', name = 'max', + description = 'The maximum life of the particles (in seconds).', default = 'min', - description = 'The maximum life of the particles (seconds).' - } - } - } - } + }, + }, + }, + }, }, { name = 'setPosition', @@ -873,16 +930,16 @@ return { { type = 'number', name = 'x', - description = 'Position along x-axis.' + description = 'Position along x-axis.', }, { type = 'number', name = 'y', - description = 'Position along y-axis.' - } - } - } - } + description = 'Position along y-axis.', + }, + }, + }, + }, }, { name = 'setQuads', @@ -893,25 +950,25 @@ return { { type = 'Quad', name = 'quad1', - description = 'The first Quad to use.' + description = 'The first Quad to use.', }, { type = 'Quad', name = 'quad2', - description = 'The second Quad to use.' + description = 'The second Quad to use.', }, - } + }, }, { arguments = { { type = 'table', name = 'quads', - description = 'A table containing the Quads to use.' - } - } - } - } + description = 'A table containing the Quads to use.', + }, + }, + }, + }, }, { name = 'setRadialAcceleration', @@ -922,17 +979,17 @@ return { { type = 'number', name = 'min', - description = 'The minimum acceleration.' + description = 'The minimum acceleration.', }, { type = 'number', name = 'max', + description = 'The maximum acceleration.', default = 'min', - description = 'The maximum acceleration.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setRelativeRotation', @@ -943,11 +1000,11 @@ return { { type = 'boolean', name = 'enable', - description = 'True to enable relative particle rotation, false to disable it.' - } - } - } - } + description = 'True to enable relative particle rotation, false to disable it.', + }, + }, + }, + }, }, { name = 'setRotation', @@ -958,17 +1015,32 @@ return { { type = 'number', name = 'min', - description = 'The minimum initial angle (radians).' + description = 'The minimum initial angle (radians).', }, { type = 'number', name = 'max', + description = 'The maximum initial angle (radians).', default = 'min', - description = 'The maximum initial angle (radians).' - } - } - } - } + }, + }, + }, + }, + }, + { + name = 'setSizeVariation', + description = 'Sets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end).', + variants = { + { + arguments = { + { + type = 'number', + name = 'variation', + description = 'The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', + }, + }, + }, + }, }, { name = 'setSizes', @@ -979,36 +1051,21 @@ return { { type = 'number', name = 'size1', - description = 'The first size.' + description = 'The first size.', }, { type = 'number', name = 'size2', - description = 'The second size.' + description = 'The second size.', }, { type = 'number', - name = '...', - description = 'Etc.' - } - } - } - } - }, - { - name = 'setSizeVariation', - description = 'Sets the degree of variation (0 meaning no variation and 1 meaning full variation between start and end).', - variants = { - { - arguments = { - { - type = 'number', - name = 'variation', - description = 'The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).' - } - } - } - } + name = 'size8', + description = 'The eighth size.', + }, + }, + }, + }, }, { name = 'setSpeed', @@ -1019,17 +1076,17 @@ return { { type = 'number', name = 'min', - description = 'The minimum linear speed of the particles.' + description = 'The minimum linear speed of the particles.', }, { type = 'number', name = 'max', + description = 'The maximum linear speed of the particles.', default = 'min', - description = 'The maximum linear speed of the particles.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setSpin', @@ -1040,32 +1097,32 @@ return { { type = 'number', name = 'min', - description = 'The minimum spin (radians per second).' + description = 'The minimum spin (radians per second).', }, { type = 'number', name = 'max', + description = 'The maximum spin (radians per second).', default = 'min', - description = 'The maximum spin (radians per second).' - } - } - } - } + }, + }, + }, + }, }, { name = 'setSpinVariation', - description = 'Sets the degree of variation (0 meaning no variation and 1 meaning full variation between start and end).', + description = 'Sets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end).', variants = { { arguments = { { type = 'number', name = 'variation', - description = 'The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).' - } - } - } - } + description = 'The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', + }, + }, + }, + }, }, { name = 'setSpread', @@ -1076,26 +1133,11 @@ return { { type = 'number', name = 'spread', - description = 'The amount of spread (radians).' - } - } - } - } - }, - { - name = 'setTexture', - description = 'Sets the Image or Canvas which is to be emitted.', - variants = { - { - arguments = { - { - type = 'Texture', - name = 'texture', - description = 'An Image or Canvas to use for the particle.' - } - } - } - } + description = 'The amount of spread (radians).', + }, + }, + }, + }, }, { name = 'setTangentialAcceleration', @@ -1106,31 +1148,48 @@ return { { type = 'number', name = 'min', - description = 'The minimum acceleration.' + description = 'The minimum acceleration.', }, { type = 'number', name = 'max', + description = 'The maximum acceleration.', default = 'min', - description = 'The maximum acceleration.' - } - } - } - } + }, + }, + }, + }, + }, + { + name = 'setTexture', + description = 'Sets the texture (Image or Canvas) to be used for the particles.', + variants = { + { + arguments = { + { + type = 'Texture', + name = 'texture', + description = 'An Image or Canvas to use for the particles.', + }, + }, + }, + }, }, { name = 'start', description = 'Starts the particle emitter.', variants = { - {} - } + { + }, + }, }, { name = 'stop', description = 'Stops the particle emitter, resetting the lifetime counter.', variants = { - {} - } + { + }, + }, }, { name = 'update', @@ -1141,16 +1200,11 @@ return { { type = 'number', name = 'dt', - description = 'The time (seconds) since last frame.' - } - } - } - } - } + description = 'The time (seconds) since last frame.', + }, + }, + }, + }, + }, }, - parenttype = 'Drawable', - supertypes = { - 'Drawable', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Quad.lua b/modules/graphics/types/Quad.lua index 139597e6..5019cc21 100644 --- a/modules/graphics/types/Quad.lua +++ b/modules/graphics/types/Quad.lua @@ -1,8 +1,10 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Quad', description = 'A quadrilateral (a polygon with four sides and four corners) with texture coordinate information.\n\nQuads can be used to select part of a texture to draw. In this way, one large texture atlas can be loaded, and then split up into sub-images.', - constructors = { - 'newQuad' + supertypes = { + 'Object', }, functions = { { @@ -14,16 +16,16 @@ return { { type = 'number', name = 'sw', - description = 'The Texture width used by the Quad.' + description = 'The Texture width used by the Quad.', }, { type = 'number', name = 'sh', - description = 'The Texture height used by the Quad.' - } - } - } - } + description = 'The Texture height used by the Quad.', + }, + }, + }, + }, }, { name = 'getViewport', @@ -34,26 +36,26 @@ return { { type = 'number', name = 'x', - description = 'The top-left corner along the x-axis.' + description = 'The top-left corner along the x-axis.', }, { type = 'number', name = 'y', - description = 'The top-left corner along the y-axis.' + description = 'The top-left corner along the y-axis.', }, { type = 'number', name = 'w', - description = 'The width of the viewport.' + description = 'The width of the viewport.', }, { type = 'number', name = 'h', - description = 'The height of the viewport.' - } - } - } - } + description = 'The height of the viewport.', + }, + }, + }, + }, }, { name = 'setViewport', @@ -64,30 +66,36 @@ return { { type = 'number', name = 'x', - description = 'The top-left corner along the x-axis.' + description = 'The top-left corner along the x-axis.', }, { type = 'number', name = 'y', - description = 'The top-right corner along the y-axis.' + description = 'The top-left corner along the y-axis.', }, { type = 'number', name = 'w', - description = 'The width of the viewport.' + description = 'The width of the viewport.', }, { type = 'number', name = 'h', - description = 'The height of the viewport.' - } - } - } - } - } + description = 'The height of the viewport.', + }, + { + type = 'number', + name = 'sw', + description = 'The reference width, the width of the Image. (Must be greater than 0.)', + }, + { + type = 'number', + name = 'sh', + description = 'The reference height, the height of the Image. (Must be greater than 0.)', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Shader.lua b/modules/graphics/types/Shader.lua index 0defd88b..779c7379 100644 --- a/modules/graphics/types/Shader.lua +++ b/modules/graphics/types/Shader.lua @@ -1,8 +1,10 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Shader', - description = 'A Shader is used for advanced hardware-accelerated pixel or vertex manipulation. These effects are written in a language based on GLSL (OpenGL Shading Language) with a few things simplified for easier coding.\n\nPotential uses for shaders include HDR/bloom, motion blur, grayscale/invert/sepia/any kind of color effect, reflection/refraction, distortions, bump mapping, and much more! Here is a collection of basic shaders and good starting point to learn: https://github.com/vrld/shine', - constructors = { - 'newShader' + description = 'A Shader is used for advanced hardware-accelerated pixel or vertex manipulation. These effects are written in a language based on GLSL (OpenGL Shading Language) with a few things simplified for easier coding.\n\nPotential uses for shaders include HDR/bloom, motion blur, grayscale/invert/sepia/any kind of color effect, reflection/refraction, distortions, bump mapping, and much more! Here is a collection of basic shaders and good starting point to learn: https://github.com/vrld/moonshine', + supertypes = { + 'Object', }, functions = { { @@ -14,11 +16,11 @@ return { { type = 'string', name = 'warnings', - description = 'Warning messages (if any).' - } - } - } - } + description = 'Warning and error messages (if any).', + }, + }, + }, + }, }, { name = 'hasUniform', @@ -29,143 +31,223 @@ return { { type = 'string', name = 'name', - description = 'The name of the uniform variable.' - } + description = 'The name of the uniform variable.', + }, }, returns = { { type = 'boolean', name = 'hasuniform', - description = 'Whether the uniform exists in the shader and affects its final output.' - } - } - } - } + description = 'Whether the uniform exists in the shader and affects its final output.', + }, + }, + }, + }, }, { name = 'send', - description = 'Sends one or more values to a special (uniform) variable inside the shader. Uniform variables have to be marked using the uniform or extern keyword.', + description = 'Sends one or more values to a special (\'\'uniform\'\') variable inside the shader. Uniform variables have to be marked using the \'\'uniform\'\' or \'\'extern\'\' keyword, e.g.\n\nuniform float time; // \'float\' is the typical number type used in GLSL shaders.\n\nuniform float varsvec2 light_pos;\n\nuniform vec4 colors[4;\n\nThe corresponding send calls would be\n\nshader:send(\'time\', t)\n\nshader:send(\'vars\',a,b)\n\nshader:send(\'light_pos\', {light_x, light_y})\n\nshader:send(\'colors\', {r1, g1, b1, a1}, {r2, g2, b2, a2}, {r3, g3, b3, a3}, {r4, g4, b4, a4})\n\nUniform / extern variables are read-only in the shader code and remain constant until modified by a Shader:send call. Uniform variables can be accessed in both the Vertex and Pixel components of a shader, as long as the variable is declared in each.', variants = { { + description = 'Because all numbers in Lua are floating point, in versions prior to 0.10.2 you must use the function Shader:sendInt to send values to uniform int variables in the shader\'s code.', arguments = { { type = 'string', name = 'name', - description = 'Name of the number to send to the shader.' + description = 'Name of the number to send to the shader.', }, { type = 'number', name = 'number', - description = 'Number to send to store in the uniform variable.' + description = 'Number to send to store in the uniform variable.', }, { type = 'number', name = '...', - description = 'Additional numbers to send if the uniform variable is an array.' - } - } + description = 'Additional numbers to send if the uniform variable is an array.', + }, + }, }, { arguments = { { type = 'string', name = 'name', - description = 'Name of the vector to send to the shader.' + description = 'Name of the vector to send to the shader.', }, { type = 'table', name = 'vector', - description = 'Numbers to send to the uniform variable as a vector. The number of elements in the table determines the type of the vector (e.g. two numbers -> vec2). At least two and at most four numbers can be used.' + description = 'Numbers to send to the uniform variable as a vector. The number of elements in the table determines the type of the vector (e.g. two numbers -> vec2). At least two and at most four numbers can be used.', }, { type = 'table', name = '...', - description = 'Additional vectors to send if the uniform variable is an array. All vectors need to be of the same size (e.g. only vec3\'s).' - } - } + description = 'Additional vectors to send if the uniform variable is an array. All vectors need to be of the same size (e.g. only vec3\'s).', + }, + }, }, { arguments = { { type = 'string', name = 'name', - description = 'Name of the matrix to send to the shader.' + description = 'Name of the matrix to send to the shader.', }, { type = 'table', name = 'matrix', - description = '2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: {{a,b,c,d}, {e,f,g,h}, ... }.' + description = '2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: {{a,b,c,d}, {e,f,g,h}, ... } or (since version 0.10.2) {a,b,c,d, e,f,g,h, ...}. The order in 0.10.2 is column-major; starting in 11.0 it\'s row-major instead.', }, { type = 'table', name = '...', - description = 'Additional matrices of the same type as matrix to store in a uniform array.' - } - } + description = 'Additional matrices of the same type as \'\'matrix\'\' to store in a uniform array.', + }, + }, }, { arguments = { { type = 'string', name = 'name', - description = 'Name of the Texture to send to the shader.' + description = 'Name of the Texture to send to the shader.', }, { type = 'Texture', name = 'texture', - description = 'Texture (Image or Canvas) to send to the uniform variable.' - } - } + description = 'Texture (Image or Canvas) to send to the uniform variable.', + }, + }, }, { arguments = { { type = 'string', name = 'name', - description = 'Name of the boolean to send to the shader.' + description = 'Name of the boolean to send to the shader.', }, { type = 'boolean', name = 'boolean', - description = 'Boolean to send to store in the uniform variable.' + description = 'Boolean to send to store in the uniform variable.', }, { type = 'boolean', name = '...', - description = 'Additional booleans to send if the uniform variable is an array.' - } - } + description = 'Additional booleans to send if the uniform variable is an array.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'name', + description = 'Name of the matrix to send to the shader.', + }, + { + type = 'MatrixLayout', + name = 'matrixlayout', + description = 'The layout (row- or column-major) of the matrix.', + }, + { + type = 'table', + name = 'matrix', + description = '2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: {{a,b,c,d}, {e,f,g,h}, ... } or {a,b,c,d, e,f,g,h, ...}.', + }, + { + type = 'table', + name = '...', + description = 'Additional matrices of the same type as \'\'matrix\'\' to store in a uniform array.', + }, + }, }, - } + { + description = 'Sends uniform values to the Shader sourced from the contents of a Data object. This directly copies the bytes of the data.', + arguments = { + { + type = 'string', + name = 'name', + description = 'Name of the uniform to send to the shader.', + }, + { + type = 'Data', + name = 'data', + description = 'Data object containing the values to send.', + }, + { + type = 'number', + name = 'offset', + description = 'Offset in bytes from the start of the Data object.', + default = '0', + }, + { + type = 'number', + name = 'size', + description = 'Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied.', + default = 'all', + }, + }, + }, + { + description = 'Sends uniform matrices to the Shader sourced from the contents of a Data object. This directly copies the bytes of the data.', + arguments = { + { + type = 'string', + name = 'name', + description = 'Name of the uniform matrix to send to the shader.', + }, + { + type = 'Data', + name = 'data', + description = 'Data object containing the values to send.', + }, + { + type = 'MatrixLayout', + name = 'matrixlayout', + description = 'The layout (row- or column-major) of the matrix in memory.', + }, + { + type = 'number', + name = 'offset', + description = 'Offset in bytes from the start of the Data object.', + default = '0', + }, + { + type = 'number', + name = 'size', + description = 'Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied.', + default = 'all', + }, + }, + }, + }, }, { name = 'sendColor', - description = 'Sends one or more colors to a special (extern / uniform) vec3 or vec4 variable inside the shader. The color components must be in the range of [0, 1], unlike Shader:send. The colors are gamma-corrected if global gamma-correction is enabled.', + description = 'Sends one or more colors to a special (\'\'extern\'\' / \'\'uniform\'\') vec3 or vec4 variable inside the shader. The color components must be in the range of 1. The colors are gamma-corrected if global gamma-correction is enabled.\n\nExtern variables must be marked using the \'\'extern\'\' keyword, e.g.\n\nextern vec4 Color;\n\nThe corresponding sendColor call would be\n\nshader:sendColor(\'Color\', {r, g, b, a})\n\nExtern variables can be accessed in both the Vertex and Pixel stages of a shader, as long as the variable is declared in each.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { type = 'string', name = 'name', - description = 'The name of the color extern variable to send to in the shader.' + description = 'The name of the color extern variable to send to in the shader.', }, { type = 'table', name = 'color', - description = 'A table with red, green, blue, and optional alpha color components in the range of [0, 1] to send to the extern as a vector.' + description = 'A table with red, green, blue, and optional alpha color components in the range of 1 to send to the extern as a vector.', }, { type = 'table', name = '...', - description = 'Additional colors to send in case the extern is an array. All colors need to be of the same size (e.g. only vec3\'s).' - } - } - } - } - } + description = 'Additional colors to send in case the extern is an array. All colors need to be of the same size (e.g. only vec3\'s).', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/SpriteBatch.lua b/modules/graphics/types/SpriteBatch.lua index c3923881..6f9f6423 100644 --- a/modules/graphics/types/SpriteBatch.lua +++ b/modules/graphics/types/SpriteBatch.lua @@ -1,180 +1,389 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'SpriteBatch', - description = 'Using a single image, draw any number of identical copies of the image using a single call to love.graphics.draw. This can be used, for example, to draw repeating copies of a single background image.\n\nA SpriteBatch can be even more useful when the underlying image is a Texture Atlas (a single image file containing many independent images); by adding Quad to the batch, different sub-images from within the atlas can be drawn.', - constructors = { - 'newSpriteBatch' + description = 'Using a single image, draw any number of identical copies of the image using a single call to love.graphics.draw(). This can be used, for example, to draw repeating copies of a single background image with high performance.\n\nA SpriteBatch can be even more useful when the underlying image is a texture atlas (a single image file containing many independent images); by adding Quads to the batch, different sub-images from within the atlas can be drawn.', + supertypes = { + 'Drawable', + 'Object', }, functions = { { name = 'add', - description = 'Add a sprite to the batch.', + description = 'Adds a sprite to the batch. Sprites are drawn in the order they are added.', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The position to draw the object (x-axis).' + description = 'The position to draw the object (x-axis).', }, { type = 'number', name = 'y', - description = 'The position to draw the object (y-axis).' + description = 'The position to draw the object (y-axis).', }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shear factor (x-axis).', default = '0', - description = 'Shear factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shear factor (y-axis).', default = '0', - description = 'Shear factor (y-axis).' - } + }, }, returns = { { type = 'number', name = 'id', - description = 'An identifier for the added sprite.' - } - } + description = 'An identifier for the added sprite.', + }, + }, }, { + description = 'Adds a Quad to the batch.', arguments = { { type = 'Quad', name = 'quad', - description = 'The Quad to add.' + description = 'The Quad to add.', }, { type = 'number', name = 'x', - description = 'The position to draw the object (x-axis).' + description = 'The position to draw the object (x-axis).', }, { type = 'number', name = 'y', - description = 'The position to draw the object (y-axis).' + description = 'The position to draw the object (y-axis).', }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shear factor (x-axis).', default = '0', - description = 'Shear factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shear factor (y-axis).', default = '0', - description = 'Shear factor (y-axis).' - } + }, }, returns = { { type = 'number', name = 'id', - description = 'An identifier for the added sprite.' - } - } - } - } + description = 'An identifier for the added sprite.', + }, + }, + }, + }, + }, + { + name = 'addLayer', + description = 'Adds a sprite to a batch created with an Array Texture.', + variants = { + { + description = 'Adds a layer of the SpriteBatch\'s Array Texture.', + arguments = { + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for this sprite.', + }, + { + type = 'number', + name = 'x', + description = 'The position to draw the sprite (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The position to draw the sprite (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'r', + description = 'Orientation (radians).', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor (x-axis).', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor (y-axis).', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing factor (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing factor (y-axis).', + default = '0', + }, + }, + returns = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer.', + }, + }, + }, + { + description = 'Adds a layer of the SpriteBatch\'s Array Texture using the specified Quad.\n\nThe specified layer index overrides any layer index set on the Quad via Quad:setLayer.', + arguments = { + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for this sprite.', + }, + { + type = 'Quad', + name = 'quad', + description = 'The subsection of the texture\'s layer to use when drawing the sprite.', + }, + { + type = 'number', + name = 'x', + description = 'The position to draw the sprite (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The position to draw the sprite (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'r', + description = 'Orientation (radians).', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor (x-axis).', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor (y-axis).', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing factor (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing factor (y-axis).', + default = '0', + }, + }, + returns = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer.', + }, + }, + }, + { + description = 'Adds a layer of the SpriteBatch\'s Array Texture using the specified Transform.', + arguments = { + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for this sprite.', + }, + { + type = 'Transform', + name = 'transform', + description = 'A transform object.', + }, + }, + returns = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer.', + }, + }, + }, + { + description = 'Adds a layer of the SpriteBatch\'s Array Texture using the specified Quad and Transform.\n\nIn order to use an Array Texture or other non-2D texture types as the main texture in a custom void effect() variant must be used in the pixel shader, and MainTex must be declared as an ArrayImage or sampler2DArray like so: uniform ArrayImage MainTex;.', + arguments = { + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for this sprite.', + }, + { + type = 'Quad', + name = 'quad', + description = 'The subsection of the texture\'s layer to use when drawing the sprite.', + }, + { + type = 'Transform', + name = 'transform', + description = 'A transform object.', + }, + }, + returns = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer.', + }, + }, + }, + }, }, { name = 'attachAttribute', - description = 'Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. This can be combined with a Shader to augment a SpriteBatch with per-vertex or additional per-sprite information instead of just having per-sprite colors.\n\nEach sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can used to determine the first vertex of a specific sprite with the formula "1 + 4 * ( id - 1 )".', + description = 'Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. This can be combined with a Shader to augment a SpriteBatch with per-vertex or additional per-sprite information instead of just having per-sprite colors.\n\nEach sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can used to determine the first vertex of a specific sprite with the formula 1 + 4 * ( id - 1 ).', variants = { { + description = 'If a created with a custom vertex format, it will have 3 vertex attributes named VertexPosition, VertexTexCoord, and VertexColor. If vertex attributes with those names are attached to the SpriteBatch, it will override the SpriteBatch\'s sprite positions, texture coordinates, and sprite colors, respectively.\n\nCustom named attributes can be accessed in a vertex shader by declaring them as attribute vec4 MyCustomAttributeName; at the top-level of the vertex shader code. The name must match what was specified in the Mesh\'s vertex format and in the name argument of SpriteBatch:attachAttribute.\n\nA Mesh must have at least 4 * SpriteBatch:getBufferSize vertices in order to be attachable to a SpriteBatch.', arguments = { { type = 'string', name = 'name', - description = 'The name of the vertex attribute to attach.' + description = 'The name of the vertex attribute to attach.', }, { type = 'Mesh', name = 'mesh', - description = 'The Mesh to get the vertex attribute from.' - } - } - } - } + description = 'The Mesh to get the vertex attribute from.', + }, + }, + }, + }, }, { name = 'clear', description = 'Removes all sprites from the buffer.', variants = { - {} - } + { + }, + }, }, { name = 'flush', - description = 'Immediately sends all new and modified sprite data in the batch to the graphics card.', + description = 'Immediately sends all new and modified sprite data in the batch to the graphics card.\n\nNormally it isn\'t necessary to call this method as love.graphics.draw(spritebatch, ...) will do it automatically if needed, but explicitly using SpriteBatch:flush gives more control over when the work happens.\n\nIf this method is used, it generally shouldn\'t be called more than once (at most) between love.graphics.draw(spritebatch, ...) calls.', variants = { - {} - } + { + }, + }, }, { name = 'getBufferSize', @@ -185,238 +394,239 @@ return { { type = 'number', name = 'size', - description = 'The maximum number of sprites the batch can hold.' - } - } - } - } + description = 'The maximum number of sprites the batch can hold.', + }, + }, + }, + }, }, { name = 'getColor', - description = 'Gets the color that will be used for the next add and set operations.\n\nIf no color has been set with SpriteBatch:setColor or the current SpriteBatch color has been cleared, this method will return nil.', + description = 'Gets the color that will be used for the next add and set operations.\n\nIf no color has been set with SpriteBatch:setColor or the current SpriteBatch color has been cleared, this method will return nil.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { returns = { { type = 'number', name = 'r', - description = 'The red component (0-1).' + description = 'The red component (0-1).', }, { type = 'number', name = 'g', - description = 'The green component (0-1).' + description = 'The green component (0-1).', }, { type = 'number', name = 'b', - description = 'The blue component (0-1).' + description = 'The blue component (0-1).', }, { type = 'number', name = 'a', - description = 'The alpha component (0-1).' + description = 'The alpha component (0-1).', }, - } - } - } + }, + }, + }, }, { name = 'getCount', - description = 'Gets the amount of sprites currently in the SpriteBatch.', + description = 'Gets the number of sprites currently in the SpriteBatch.', variants = { { returns = { { type = 'number', name = 'count', - description = 'The amount of sprites currently in the batch.' - } - } - } - } + description = 'The number of sprites currently in the batch.', + }, + }, + }, + }, }, { name = 'getTexture', - description = 'Returns the Image or Canvas used by the SpriteBatch.', + description = 'Gets the texture (Image or Canvas) used by the SpriteBatch.', variants = { { returns = { { type = 'Texture', name = 'texture', - description = 'The Image or Canvas for the sprites.' - } - } - } - } + description = 'The Image or Canvas used by the SpriteBatch.', + }, + }, + }, + }, }, { name = 'set', - description = 'Changes a sprite in the batch. This requires the identifier returned by add and addq.', + description = 'Changes a sprite in the batch. This requires the sprite index returned by SpriteBatch:add or SpriteBatch:addLayer.', variants = { { arguments = { { type = 'number', - name = 'id', - description = 'The identifier of the sprite that will be changed.' + name = 'spriteindex', + description = 'The index of the sprite that will be changed.', }, { type = 'number', name = 'x', - description = 'The position to draw the object (x-axis).' + description = 'The position to draw the object (x-axis).', }, { type = 'number', name = 'y', - description = 'The position to draw the object (y-axis).' + description = 'The position to draw the object (y-axis).', }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shear factor (x-axis).', default = '0', - description = 'Shear factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shear factor (y-axis).', default = '0', - description = 'Shear factor (y-axis).' - } - } + }, + }, }, { + description = 'Changes a sprite with a Quad in the batch. This requires the index returned by SpriteBatch:add or SpriteBatch:addLayer.\n\nSpriteBatches do not support removing individual sprites. One can do a pseudo removal (instead of clearing and re-adding everything) by:\n\nSpriteBatch:set(id, 0, 0, 0, 0, 0)\n\nThis makes all the sprite\'s vertices equal (because the x and y scales are 0), which prevents the GPU from fully processing the sprite when drawing the SpriteBatch.', arguments = { { type = 'number', - name = 'id', - description = 'The identifier of the sprite that will be changed.' + name = 'spriteindex', + description = 'The index of the sprite that will be changed.', }, { type = 'Quad', name = 'quad', - description = 'The quad used on the image of the batch.' + description = 'The Quad used on the image of the batch.', }, { type = 'number', name = 'x', - description = 'The position to draw the object (x-axis).' + description = 'The position to draw the object (x-axis).', }, { type = 'number', name = 'y', - description = 'The position to draw the object (y-axis).' + description = 'The position to draw the object (y-axis).', }, { type = 'number', name = 'r', + description = 'Orientation (radians).', default = '0', - description = 'Orientation (radians).' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor (x-axis).' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor (y-axis).' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset (x-axis).' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset (y-axis).' }, { type = 'number', name = 'kx', + description = 'Shear factor (x-axis).', default = '0', - description = 'Shear factor (x-axis).' }, { type = 'number', name = 'ky', + description = 'Shear factor (y-axis).', default = '0', - description = 'Shear factor (y-axis).' - } - } - } - } + }, + }, + }, + }, }, { name = 'setColor', - description = 'Sets the color that will be used for the next add and set operations. Calling the function without arguments will clear the color.\n\nIn version [[0.9.2]] and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.', + description = 'Sets the color that will be used for the next add and set operations. Calling the function without arguments will disable all per-sprite colors for the SpriteBatch.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.\n\nIn version 0.9.2 and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color.', variants = { { arguments = { { type = 'number', name = 'r', - description = 'The amount of red.' + description = 'The amount of red.', }, { type = 'number', name = 'g', - description = 'The amount of green.' + description = 'The amount of green.', }, { type = 'number', name = 'b', - description = 'The amount of blue.' + description = 'The amount of blue.', }, { type = 'number', name = 'a', + description = 'The amount of alpha.', default = '1', - description = 'The amount of alpha.' - } - } + }, + }, }, { - description = 'Disables all per-sprite colors for this SpriteBatch.' - } - } + description = 'Disables all per-sprite colors for this SpriteBatch.', + }, + }, }, { name = 'setDrawRange', @@ -427,39 +637,228 @@ return { { type = 'number', name = 'start', - description = 'The index of the first sprite to draw. Index 1 corresponds to the first sprite added with SpriteBatch:add.' + description = 'The index of the first sprite to draw. Index 1 corresponds to the first sprite added with SpriteBatch:add.', }, { type = 'number', name = 'count', - description = 'The number of sprites to draw.' - } - } + description = 'The number of sprites to draw.', + }, + }, + }, + { + description = 'Allows all sprites in the SpriteBatch to be drawn.', + }, + }, + }, + { + name = 'setLayer', + description = 'Changes a sprite previously added with add or addLayer, in a batch created with an Array Texture.', + variants = { + { + description = 'Changes the sprite in the SpriteBatch.', + arguments = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the existing sprite to replace.', + }, + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer in the Array Texture to use for this sprite.', + }, + { + type = 'number', + name = 'x', + description = 'The position to draw the sprite (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The position to draw the sprite (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'r', + description = 'Orientation (radians).', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor (x-axis).', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor (y-axis).', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing factor (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing factor (y-axis).', + default = '0', + }, + }, + }, + { + description = 'Adds a layer of the SpriteBatch\'s Array Texture using the specified Quad.\n\nThe specified layer index overrides any layer index set on the Quad via Quad:setLayer.', + arguments = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the existing sprite to replace.', + }, + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for this sprite.', + }, + { + type = 'Quad', + name = 'quad', + description = 'The subsection of the texture\'s layer to use when drawing the sprite.', + }, + { + type = 'number', + name = 'x', + description = 'The position to draw the sprite (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The position to draw the sprite (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'r', + description = 'Orientation (radians).', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor (x-axis).', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor (y-axis).', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset (y-axis).', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing factor (x-axis).', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing factor (y-axis).', + default = '0', + }, + }, + }, + { + description = 'Adds a layer of the SpriteBatch\'s Array Texture using the specified Transform.', + arguments = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the existing sprite to replace.', + }, + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for the sprite.', + }, + { + type = 'Transform', + name = 'transform', + description = 'A transform object.', + }, + }, }, { - description = 'Allows all sprites in the SpriteBatch to be drawn.' - } - } + description = 'Adds a layer of the SpriteBatch\'s Array Texture using the specified Quad and Transform.\n\nThe specified layer index overrides any layer index set on the Quad via Quad:setLayer.', + arguments = { + { + type = 'number', + name = 'spriteindex', + description = 'The index of the existing sprite to replace.', + }, + { + type = 'number', + name = 'layerindex', + description = 'The index of the layer to use for the sprite.', + }, + { + type = 'Quad', + name = 'quad', + description = 'The subsection of the texture\'s layer to use when drawing the sprite.', + }, + { + type = 'Transform', + name = 'transform', + description = 'A transform object.', + }, + }, + }, + }, }, { name = 'setTexture', - description = 'Replaces the Image or Canvas used for the sprites.', + description = 'Sets the texture (Image or Canvas) used for the sprites in the batch, when drawing.', variants = { { arguments = { { type = 'Texture', name = 'texture', - description = 'The new Image or Canvas to use for the sprites.' - } - } - } - } - } + description = 'The new Image or Canvas to use for the sprites in the batch.', + }, + }, + }, + }, + }, }, - parenttype = 'Drawable', - supertypes = { - 'Drawable', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Text.lua b/modules/graphics/types/Text.lua index 4027b62f..3b717684 100644 --- a/modules/graphics/types/Text.lua +++ b/modules/graphics/types/Text.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Text', description = 'Drawable text.', - constructors = { - 'newText' + supertypes = { + 'Drawable', + 'Object', }, functions = { { @@ -14,365 +17,368 @@ return { { type = 'string', name = 'textstring', - description = 'The text to add to the object.' + description = 'The text to add to the object.', }, { type = 'number', name = 'x', + description = 'The position of the new text on the x-axis.', default = '0', - description = 'The position of the new text on the x-axis.' }, { type = 'number', name = 'y', + description = 'The position of the new text on the y-axis.', default = '0', - description = 'The position of the new text on the y-axis.' }, { type = 'number', name = 'angle', + description = 'The orientation of the new text in radians.', default = '0', - description = 'The orientation of the new text in radians.' }, { type = 'number', name = 'sx', + description = 'Scale factor on the x-axis.', default = '1', - description = 'Scale factor on the x-axis.' }, { type = 'number', name = 'sy', + description = 'Scale factor on the y-axis.', default = 'sx', - description = 'Scale factor on the y-axis.' }, { type = 'number', name = 'ox', + description = 'Origin offset on the x-axis.', default = '0', - description = 'Origin offset on the x-axis.' }, { type = 'number', name = 'oy', + description = 'Origin offset on the y-axis.', default = '0', - description = 'Origin offset on the y-axis.' }, { type = 'number', name = 'kx', + description = 'Shearing / skew factor on the x-axis.', default = '0', - description = 'Shearing / skew factor on the x-axis.' }, { type = 'number', name = 'ky', + description = 'Shearing / skew factor on the y-axis.', default = '0', - description = 'Shearing / skew factor on the y-axis.' - } + }, }, returns = { { type = 'number', name = 'index', - description = 'An index number that can be used with Text:getWidth or Text:getHeight.' - } - } + description = 'An index number that can be used with Text:getWidth or Text:getHeight.', + }, + }, }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.', arguments = { { type = 'table', name = 'coloredtext', - description = 'A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.', + description = 'A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.', table = { { type = 'table', name = 'color1', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string1', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'table', name = 'color2', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string2', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'tables and strings', name = '...', - description = 'Additional colors and strings.' - } - } + description = 'Additional colors and strings.', + }, + }, }, { type = 'number', name = 'x', + description = 'The position of the new text on the x-axis.', default = '0', - description = 'The position of the new text on the x-axis.' }, { type = 'number', name = 'y', + description = 'The position of the new text on the y-axis.', default = '0', - description = 'The position of the new text on the y-axis.' }, { type = 'number', name = 'angle', + description = 'The orientation of the new text in radians.', default = '0', - description = 'The orientation of the new text in radians.' }, { type = 'number', name = 'sx', + description = 'Scale factor on the x-axis.', default = '1', - description = 'Scale factor on the x-axis.' }, { type = 'number', name = 'sy', + description = 'Scale factor on the y-axis.', default = 'sx', - description = 'Scale factor on the y-axis.' }, { type = 'number', name = 'ox', + description = 'Origin offset on the x-axis.', default = '0', - description = 'Origin offset on the x-axis.' }, { type = 'number', name = 'oy', + description = 'Origin offset on the y-axis.', default = '0', - description = 'Origin offset on the y-axis.' }, { type = 'number', name = 'kx', + description = 'Shearing / skew factor on the x-axis.', default = '0', - description = 'Shearing / skew factor on the x-axis.' }, { type = 'number', name = 'ky', + description = 'Shearing / skew factor on the y-axis.', default = '0', - description = 'Shearing / skew factor on the y-axis.' - } + }, }, returns = { { type = 'number', name = 'index', - description = 'An index number that can be used with Text:getWidth or Text:getHeight.' - } - } - } - } + description = 'An index number that can be used with Text:getWidth or Text:getHeight.', + }, + }, + }, + }, }, { name = 'addf', - description = 'Adds additional formatted / colored text to the Text object at the specified position.', + description = 'Adds additional formatted / colored text to the Text object at the specified position.\n\nThe word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change.', variants = { { arguments = { { type = 'string', name = 'textstring', - description = 'The text to add to the object.' + description = 'The text to add to the object.', }, { type = 'number', name = 'wraplimit', - description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.' + description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.', }, { type = 'AlignMode', name = 'align', - description = 'The alignment of the text.' + description = 'The alignment of the text.', }, { type = 'number', name = 'x', - description = 'The position of the new text on the x-axis.' + description = 'The position of the new text (x-axis).', }, { type = 'number', name = 'y', - description = 'The position of the new text on the y-axis.' + description = 'The position of the new text (y-axis).', }, { type = 'number', name = 'angle', + description = 'Orientation (radians).', default = '0', - description = 'The orientation of the object in radians.' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor on the x-axis.' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor on the y-axis.' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset on the x-axis.' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset on the y-axis.' }, { type = 'number', name = 'kx', + description = 'Shearing / skew factor (x-axis).', default = '0', - description = 'Shearing / skew factor on the x-axis.' }, { type = 'number', name = 'ky', + description = 'Shearing / skew factor (y-axis).', default = '0', - description = 'Shearing / skew factor on the y-axis.' - } + }, }, returns = { { type = 'number', name = 'index', - description = 'An index number that can be used with Text:getWidth or Text:getHeight.' - } - } + description = 'An index number that can be used with Text:getWidth or Text:getHeight.', + }, + }, }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.', arguments = { { type = 'table', name = 'coloredtext', - description = 'A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.', + description = 'A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.', table = { { type = 'table', name = 'color1', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string1', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'table', name = 'color2', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string2', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'tables and strings', name = '...', - description = 'Additional colors and strings.' - } - } + description = 'Additional colors and strings.', + }, + }, }, - { + { type = 'number', name = 'wraplimit', - description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.' + description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.', }, { type = 'AlignMode', name = 'align', - description = 'The alignment of the text.' + description = 'The alignment of the text.', }, { type = 'number', name = 'x', - description = 'The position of the new text on the x-axis.' + description = 'The position of the new text (x-axis).', }, { type = 'number', name = 'y', - description = 'The position of the new text on the y-axis.' + description = 'The position of the new text (y-axis).', }, { type = 'number', name = 'angle', + description = 'Orientation (radians).', default = '0', - description = 'The orientation of the object in radians.' }, { type = 'number', name = 'sx', + description = 'Scale factor (x-axis).', default = '1', - description = 'Scale factor on the x-axis.' }, { type = 'number', name = 'sy', + description = 'Scale factor (y-axis).', default = 'sx', - description = 'Scale factor on the y-axis.' }, { type = 'number', name = 'ox', + description = 'Origin offset (x-axis).', default = '0', - description = 'Origin offset on the x-axis.' }, { type = 'number', name = 'oy', + description = 'Origin offset (y-axis).', default = '0', - description = 'Origin offset on the y-axis.' }, { type = 'number', name = 'kx', + description = 'Shearing / skew factor (x-axis).', default = '0', - description = 'Shearing / skew factor on the x-axis.' }, { type = 'number', name = 'ky', + description = 'Shearing / skew factor (y-axis).', default = '0', - description = 'Shearing / skew factor on the y-axis.' - } + }, }, returns = { { type = 'number', name = 'index', - description = 'An index number that can be used with Text:getWidth or Text:getHeight.' - } - } - } - } + description = 'An index number that can be used with Text:getWidth or Text:getHeight.', + }, + }, + }, + }, }, { name = 'clear', description = 'Clears the contents of the Text object.', variants = { - {} - } + { + }, + }, }, { name = 'getDimensions', @@ -383,14 +389,14 @@ return { { type = 'number', name = 'width', - description = 'The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.' + description = 'The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.', }, { type = 'number', name = 'height', - description = 'The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.' - } - } + description = 'The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.', + }, + }, }, { description = 'Gets the width and height of a specific sub-string that was previously added to the Text object.', @@ -398,23 +404,23 @@ return { { type = 'number', name = 'index', - description = 'An index number returned by Text:add or Text:addf.' - } + description = 'An index number returned by Text:add or Text:addf.', + }, }, returns = { { type = 'number', name = 'width', - description = 'The width of the sub-string (before scaling and other transformations).' + description = 'The width of the sub-string (before scaling and other transformations).', }, { type = 'number', name = 'height', - description = 'The height of the sub-string (before scaling and other transformations).' - } - } - } - } + description = 'The height of the sub-string (before scaling and other transformations).', + }, + }, + }, + }, }, { name = 'getFont', @@ -425,11 +431,11 @@ return { { type = 'Font', name = 'font', - description = 'The font used with this Text object.' - } - } - } - } + description = 'The font used with this Text object.', + }, + }, + }, + }, }, { name = 'getHeight', @@ -439,10 +445,10 @@ return { returns = { { type = 'number', - name = 'height', - description = 'The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.' - } - } + name = ' height ', + description = 'The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.', + }, + }, }, { description = 'Gets the height of a specific sub-string that was previously added to the Text object.', @@ -450,18 +456,18 @@ return { { type = 'number', name = 'index', - description = 'An index number returned by Text:add or Text:addf.' - } + description = 'An index number returned by Text:add or Text:addf.', + }, }, returns = { { type = 'number', name = 'height', - description = 'The height of the sub-string (before scaling and other transformations).' - } - } - } - } + description = 'The height of the sub-string (before scaling and other transformations).', + }, + }, + }, + }, }, { name = 'getWidth', @@ -472,9 +478,9 @@ return { { type = 'number', name = 'width', - description = 'The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.' - } - } + description = 'The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.', + }, + }, }, { description = 'Gets the width of a specific sub-string that was previously added to the Text object.', @@ -482,18 +488,18 @@ return { { type = 'number', name = 'index', - description = 'An index number returned by Text:add or Text:addf.' - } + description = 'An index number returned by Text:add or Text:addf.', + }, }, returns = { { type = 'number', name = 'width', - description = 'The width of the sub-string (before scaling and other transformations).' - } - } - } - } + description = 'The width of the sub-string (before scaling and other transformations).', + }, + }, + }, + }, }, { name = 'set', @@ -504,47 +510,63 @@ return { { type = 'string', name = 'textstring', - description = 'The new string of text to use.' - } - } + description = 'The new string of text to use.', + }, + }, }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.', arguments = { { type = 'table', name = 'coloredtext', - description = 'A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.', + description = 'A table containing colors and strings to use as the new text, in the form of {color1, string1, color2, string2, ...}.', table = { { type = 'table', name = 'color1', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string1', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'table', name = 'color2', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string2', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'tables and strings', name = '...', - description = 'Additional colors and strings.' - } - } - } - } - } - } + description = 'Additional colors and strings.', + }, + }, + }, + }, + }, + }, + }, + { + name = 'setFont', + description = 'Replaces the Font used with the text.', + variants = { + { + arguments = { + { + type = 'Font', + name = 'font', + description = 'The new font to use with this Text object.', + }, + }, + }, + }, }, { name = 'setf', @@ -555,90 +577,68 @@ return { { type = 'string', name = 'textstring', - description = 'The new string of text to use.' + description = 'The new string of text to use.', }, { type = 'number', name = 'wraplimit', - description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.' + description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.', }, { type = 'AlignMode', name = 'align', - description = 'The alignment of the text.' - } - } + description = 'The alignment of the text.', + }, + }, }, { + description = 'The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.', arguments = { { type = 'table', name = 'coloredtext', - description = 'A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.', + description = 'A table containing colors and strings to use as the new text, in the form of {color1, string1, color2, string2, ...}.', table = { { type = 'table', name = 'color1', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string1', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'table', name = 'color2', - description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.' + description = 'A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.', }, { type = 'string', name = 'string2', - description = 'A string of text which has a color specified by the previous color.' + description = 'A string of text which has a color specified by the previous color.', }, { type = 'tables and strings', name = '...', - description = 'Additional colors and strings.' - } - } + description = 'Additional colors and strings.', + }, + }, }, { type = 'number', name = 'wraplimit', - description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.' + description = 'The maximum width in pixels of the text before it gets automatically wrapped to a new line.', }, { type = 'AlignMode', name = 'align', - description = 'The alignment of the text.' - } - } + description = 'The alignment of the text.', + }, + }, }, - { - description = 'Clears the contents of the Text object.' - } - } + }, }, - { - name = 'setFont', - description = 'Replaces the Font used with the text.', - variants = { - { - arguments = { - { - type = 'Font', - name = 'font', - description = 'The new font to use with this Text object.' - } - } - } - } - } }, - parenttype = 'Drawable', - supertypes = { - 'Drawable', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Texture.lua b/modules/graphics/types/Texture.lua index 778548f1..25b62b10 100644 --- a/modules/graphics/types/Texture.lua +++ b/modules/graphics/types/Texture.lua @@ -1,8 +1,28 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Texture', description = 'Superclass for drawable objects which represent a texture. All Textures can be drawn with Quads. This is an abstract type that can\'t be created directly.', - constructors = {}, + supertypes = { + 'Drawable', + 'Object', + }, functions = { + { + name = 'getDPIScale', + description = 'Gets the DPI scale factor of the Texture.\n\nThe DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the texture has twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a texture with a DPI scale factor of 1.\n\nFor example, a texture with pixel dimensions of 100x100 with a DPI scale factor of 2 will be drawn as if it was 50x50. This is useful with high-dpi / retina displays to easily allow swapping out higher or lower pixel density Images and Canvases without needing any extra manual scaling logic.', + variants = { + { + returns = { + { + type = 'number', + name = 'dpiscale', + description = 'The DPI scale factor of the Texture.', + }, + }, + }, + }, + }, { name = 'getDepth', description = 'Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures.', @@ -12,26 +32,26 @@ return { { type = 'number', name = 'depth', - description = 'The depth of the volume Texture.' - } - } - } - } + description = 'The depth of the volume Texture.', + }, + }, + }, + }, }, { name = 'getFormat', - description = 'Gets the PixelFormat of the Texture.', + description = 'Gets the pixel format of the Texture.', variants = { { returns = { { type = 'PixelFormat', name = 'format', - description = 'The pixel format the Texture was created with.' - } - } - } - } + description = 'The pixel format the Texture was created with.', + }, + }, + }, + }, }, { name = 'getLayerCount', @@ -42,11 +62,11 @@ return { { type = 'number', name = 'layers', - description = 'The number of layers in the Array Texture.' - } - } - } - } + description = 'The number of layers in the Array Texture.', + }, + }, + }, + }, }, { name = 'getMipmapCount', @@ -57,11 +77,61 @@ return { { type = 'number', name = 'mipmaps', - description = 'The number of mipmaps in the Texture.' - } - } - } - } + description = 'The number of mipmaps in the Texture.', + }, + }, + }, + }, + }, + { + name = 'getMipmapFilter', + description = 'Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.', + variants = { + { + returns = { + { + type = 'FilterMode', + name = 'mode', + description = 'The filter mode used in between mipmap levels. nil if mipmap filtering is not enabled.', + }, + { + type = 'number', + name = 'sharpness', + description = 'Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.', + }, + }, + }, + }, + }, + { + name = 'getPixelHeight', + description = 'Gets the height in pixels of the Texture.\n\nDPI scale factor, rather than pixels. Use getHeight for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelHeight only when dealing specifically with pixels, for example when using Canvas:newImageData.', + variants = { + { + returns = { + { + type = 'number', + name = 'pixelheight', + description = 'The height of the Texture, in pixels.', + }, + }, + }, + }, + }, + { + name = 'getPixelWidth', + description = 'Gets the width in pixels of the Texture.\n\nDPI scale factor, rather than pixels. Use getWidth for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelWidth only when dealing specifically with pixels, for example when using Canvas:newImageData.', + variants = { + { + returns = { + { + type = 'number', + name = 'pixelwidth', + description = 'The width of the Texture, in pixels.', + }, + }, + }, + }, }, { name = 'getTextureType', @@ -72,11 +142,11 @@ return { { type = 'TextureType', name = 'texturetype', - description = 'The type of the Texture.' - } - } - } - } + description = 'The type of the Texture.', + }, + }, + }, + }, }, { name = 'isReadable', @@ -87,20 +157,36 @@ return { { type = 'boolean', name = 'readable', - description = 'Whether the Texture is readable.' - } - } - } - } - } - }, - parenttype = 'Drawable', - supertypes = { - 'Drawable', - 'Object' + description = 'Whether the Texture is readable.', + }, + }, + }, + }, + }, + { + name = 'setMipmapFilter', + description = 'Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images.\n\nMipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues.\n\nIn created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it\'s best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers.\n\nDue to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren\'t loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps.', + variants = { + { + description = 'On mobile devices (Android and iOS), the sharpness parameter is not supported and will do nothing. You can use a custom compressed and its CompressedData has mipmap data included, it will use that.', + arguments = { + { + type = 'FilterMode', + name = 'filtermode', + description = 'The filter mode to use in between mipmap levels. \'nearest\' will often give better performance.', + }, + { + type = 'number', + name = 'sharpness', + description = 'A positive sharpness value makes the texture use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.', + default = '0', + }, + }, + }, + { + description = 'Disables mipmap filtering.', + }, + }, + }, }, - subtypes = { - 'Canvas', - 'Image' - } -} +} \ No newline at end of file diff --git a/modules/graphics/types/Video.lua b/modules/graphics/types/Video.lua index 56f44d13..45891807 100644 --- a/modules/graphics/types/Video.lua +++ b/modules/graphics/types/Video.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Video', description = 'A drawable video.', - constructors = { - 'newVideo' + supertypes = { + 'Drawable', + 'Object', }, functions = { { @@ -14,16 +17,16 @@ return { { type = 'number', name = 'width', - description = 'The width of the Video.' + description = 'The width of the Video.', }, { type = 'number', name = 'height', - description = 'The height of the video.' - } - } - } - } + description = 'The height of the Video.', + }, + }, + }, + }, }, { name = 'getFilter', @@ -34,22 +37,21 @@ return { { type = 'FilterMode', name = 'min', - description = 'The filter mode used when scaling the Video down.' + description = 'The filter mode used when scaling the Video down.', }, { type = 'FilterMode', name = 'mag', - description = 'The filter mode used when scaling the Video up.' + description = 'The filter mode used when scaling the Video up.', }, { type = 'number', name = 'anisotropy', - default = '1', - description = 'Maximum amount of anisotropic filtering used.' - } - } - } - } + description = 'Maximum amount of anisotropic filtering used.', + }, + }, + }, + }, }, { name = 'getHeight', @@ -60,11 +62,11 @@ return { { type = 'number', name = 'height', - description = 'The height of the Video.' - } - } - } - } + description = 'The height of the Video.', + }, + }, + }, + }, }, { name = 'getSource', @@ -75,11 +77,11 @@ return { { type = 'Source', name = 'source', - description = 'The audio Source used for audio playback, or nil if the video has no audio.' - } - } - } - } + description = 'The audio Source used for audio playback, or nil if the video has no audio.', + }, + }, + }, + }, }, { name = 'getStream', @@ -90,11 +92,11 @@ return { { type = 'VideoStream', name = 'stream', - description = 'The VideoStream used for decoding and controlling the video.' - } - } - } - } + description = 'The VideoStream used for decoding and controlling the video.', + }, + }, + }, + }, }, { name = 'getWidth', @@ -105,11 +107,11 @@ return { { type = 'number', name = 'width', - description = 'The width of the Video.' - } - } - } - } + description = 'The width of the Video.', + }, + }, + }, + }, }, { name = 'isPlaying', @@ -120,32 +122,35 @@ return { { type = 'boolean', name = 'playing', - description = 'Whether the video is playing.' - } - } - } - } + description = 'Whether the video is playing.', + }, + }, + }, + }, }, { name = 'pause', description = 'Pauses the Video.', variants = { - {} - } + { + }, + }, }, { name = 'play', description = 'Starts playing the Video. In order for the video to appear onscreen it must be drawn with love.graphics.draw.', variants = { - {} - } + { + }, + }, }, { name = 'rewind', description = 'Rewinds the Video to the beginning.', variants = { - {} - } + { + }, + }, }, { name = 'seek', @@ -156,11 +161,11 @@ return { { type = 'number', name = 'offset', - description = 'The time in seconds since the beginning of the Video.' - } - } - } - } + description = 'The time in seconds since the beginning of the Video.', + }, + }, + }, + }, }, { name = 'setFilter', @@ -171,22 +176,22 @@ return { { type = 'FilterMode', name = 'min', - description = 'The filter mode used when scaling the Video down.' + description = 'The filter mode used when scaling the Video down.', }, { type = 'FilterMode', name = 'mag', - description = 'The filter mode used when scaling the Video up.' + description = 'The filter mode used when scaling the Video up.', }, { type = 'number', name = 'anisotropy', + description = 'Maximum amount of anisotropic filtering used.', default = '1', - description = 'Maximum amount of anisotropic filtering used.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setSource', @@ -197,32 +202,27 @@ return { { type = 'Source', name = 'source', + description = 'The audio Source used for audio playback, or nil to disable audio synchronization.', default = 'nil', - description = 'The audio Source used for audio playback, or nil to disable audio synchronization.' - } - } - } - } + }, + }, + }, + }, }, { name = 'tell', description = 'Gets the current playback position of the Video.', variants = { { - arguments = { + returns = { { type = 'number', name = 'seconds', - description = 'The time in seconds since the beginning of the Video.' - } - } - } - } - } + description = 'The time in seconds since the beginning of the Video.', + }, + }, + }, + }, + }, }, - parenttype = 'Drawable', - supertypes = { - 'Drawable', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/image/Image.lua b/modules/image/Image.lua index c32cef96..af435073 100644 --- a/modules/image/Image.lua +++ b/modules/image/Image.lua @@ -1,4 +1,3 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { @@ -18,34 +17,34 @@ return { { type = 'string', name = 'filename', - description = 'The filename of the potentially compressed image file.' - } + description = 'The filename of the potentially compressed image file.', + }, }, returns = { { type = 'boolean', name = 'compressed', - description = 'Whether the file can be loaded as CompressedImageData or not.' - } - } + description = 'Whether the file can be loaded as CompressedImageData or not.', + }, + }, }, { arguments = { { type = 'FileData', name = 'fileData', - description = 'A FileData potentially containing a compressed image.' - } + description = 'A FileData potentially containing a compressed image.', + }, }, returns = { { type = 'boolean', name = 'compressed', - description = 'Whether the FileData can be loaded as CompressedImageData or not.' - } - } - } - } + description = 'Whether the FileData can be loaded as CompressedImageData or not.', + }, + }, + }, + }, }, { name = 'newCompressedData', @@ -56,123 +55,156 @@ return { { type = 'string', name = 'filename', - description = 'The filename of the compressed image file.' - } + description = 'The filename of the compressed image file.', + }, }, returns = { { type = 'CompressedImageData', name = 'compressedImageData', - description = 'The new CompressedImageData object.' - } - } + description = 'The new CompressedImageData object.', + }, + }, }, { arguments = { { type = 'FileData', name = 'fileData', - description = 'A FileData containing a compressed image.' - } + description = 'A FileData containing a compressed image.', + }, }, returns = { { type = 'CompressedImageData', name = 'compressedImageData', - description = 'The new CompressedImageData object.' - } - } - } - } + description = 'The new CompressedImageData object.', + }, + }, + }, + }, }, { name = 'newImageData', - description = 'Create a new ImageData object.', + description = 'Creates a new ImageData object.', variants = { { arguments = { { type = 'number', name = 'width', - description = 'The width of the ImageData.' + description = 'The width of the ImageData.', }, { type = 'number', name = 'height', - description = 'The height of the ImageData.' - } + description = 'The height of the ImageData.', + }, }, returns = { { type = 'ImageData', name = 'imageData', - description = 'The new blank ImageData object. Each pixel\'s color values, (including the alpha values!) will be set to zero.' - } - } + description = 'The new blank ImageData object. Each pixel\'s color values, (including the alpha values!) will be set to zero.', + }, + }, }, { arguments = { { type = 'number', name = 'width', - description = 'The width of the ImageData.' + description = 'The width of the ImageData.', }, { type = 'number', name = 'height', - description = 'The height of the ImageData.' + description = 'The height of the ImageData.', + }, + { + type = 'PixelFormat', + name = 'format', + description = 'The pixel format of the ImageData.', + default = '\'rgba8\'', }, { type = 'string', name = 'data', - description = 'The data to load into the ImageData (RGBA bytes, left to right and top to bottom).' - } + description = 'Optional raw byte data to load into the ImageData, in the format specified by \'\'format\'\'.', + default = 'nil', + }, }, returns = { { type = 'ImageData', name = 'imageData', - description = 'The new ImageData object.' - } - } + description = 'The new ImageData object.', + }, + }, + }, + { + arguments = { + { + type = 'number', + name = 'width', + description = 'The width of the ImageData.', + }, + { + type = 'number', + name = 'height', + description = 'The height of the ImageData.', + }, + { + type = 'string', + name = 'data', + description = 'The data to load into the ImageData (RGBA bytes, left to right and top to bottom).', + }, + }, + returns = { + { + type = 'ImageData', + name = 'imageData', + description = 'The new ImageData object.', + }, + }, }, { arguments = { { type = 'string', name = 'filename', - description = 'The filename of the image file.' - } + description = 'The filename of the image file.', + }, }, returns = { { type = 'ImageData', name = 'imageData', - description = 'The new ImageData object.' - } - } + description = 'The new ImageData object.', + }, + }, }, { arguments = { { type = 'FileData', name = 'filedata', - description = 'The encoded file data to decode into image data.' - } + description = 'The encoded file data to decode into image data.', + }, }, returns = { { type = 'ImageData', name = 'imageData', - description = 'The new ImageData object.' - } - } - } - } - } + description = 'The new ImageData object.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.CompressedImageFormat'), - require(path .. 'enums.ImageFormat') - } -} + require(path .. 'enums.ImageFormat'), + }, +} \ No newline at end of file diff --git a/modules/image/enums/CompressedImageFormat.lua b/modules/image/enums/CompressedImageFormat.lua index f012923a..f3d11fbd 100644 --- a/modules/image/enums/CompressedImageFormat.lua +++ b/modules/image/enums/CompressedImageFormat.lua @@ -4,7 +4,7 @@ return { constants = { { name = 'DXT1', - description = 'The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images. Suitable for fully opaque images on desktop systems.', + description = '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.', }, { name = 'DXT3', @@ -20,7 +20,7 @@ return { }, { name = 'BC4s', - description = 'The signed variant of the BC4 format. Same as above but the pixel values in the texture are in the range of [-1, 1] instead of [0, 1] in shaders.', + description = '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.', }, { name = 'BC5', @@ -32,11 +32,11 @@ return { }, { name = 'BC6h', - description = 'The BC6H format. Stores half-precision floating-point RGB data in the range of [0, 65504] at 8 bits per pixel. Suitable for HDR images on desktop systems.', + description = '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.', }, { name = 'BC6hs', - description = 'The signed variant of the BC6H format. Stores RGB data in the range of [-65504, +65504].', + description = 'The signed variant of the BC6H format. Stores RGB data in the range of +65504.', }, { name = 'BC7', @@ -44,107 +44,107 @@ return { }, { name = 'ETC1', - description = 'The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.' + description = 'The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.', }, { name = 'ETC2rgb', - description = 'The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.' + description = 'The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.', }, { name = 'ETC2rgba', - description = 'The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.' + description = 'The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.', }, { name = 'ETC2rgba1', - description = 'The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.' + description = 'The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.', }, { name = 'EACr', - description = 'The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.' + description = 'The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.', }, { name = 'EACrs', - description = 'The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of [-1, 1] instead of [0, 1] in shaders.' + description = '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.', }, { name = 'EACrg', - description = 'The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.' + description = 'The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.', }, { name = 'EACrgs', - description = 'The signed two-channel variant of the EAC format.' + description = 'The signed two-channel variant of the EAC format.', }, { name = 'PVR1rgb2', - description = '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.' + description = '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.', }, { name = 'PVR1rgb4', - description = 'The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.' + description = 'The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.', }, { name = 'PVR1rgba2', - description = 'The 2 bit per pixel RGBA variant of the PVRTC1 format.' + description = 'The 2 bit per pixel RGBA variant of the PVRTC1 format.', }, { name = 'PVR1rgba4', - description = 'The 4 bit per pixel RGBA variant of the PVRTC1 format.' + description = 'The 4 bit per pixel RGBA variant of the PVRTC1 format.', }, { name = 'ASTC4x4', - description = 'The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.' + description = 'The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.', }, { name = 'ASTC5x4', - description = 'The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.' + description = 'The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.', }, { name = 'ASTC5x5', - description = 'The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.' + description = 'The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.', }, { name = 'ASTC6x5', - description = 'The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.' + description = 'The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.', }, { name = 'ASTC6x6', - description = 'The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.' + description = 'The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.', }, { name = 'ASTC8x5', - description = 'The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.' + description = 'The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.', }, { name = 'ASTC8x6', - description = 'The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.' + description = 'The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.', }, { name = 'ASTC8x8', - description = 'The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.' + description = 'The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.', }, { name = 'ASTC10x5', - description = 'The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.' + description = 'The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.', }, { name = 'ASTC10x6', - description = 'The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.' + description = 'The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.', }, { name = 'ASTC10x8', - description = 'The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.' + description = 'The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.', }, { name = 'ASTC10x10', - description = 'The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.' + description = 'The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.', }, { name = 'ASTC12x10', - description = 'The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.' + description = 'The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.', }, { name = 'ASTC12x12', - description = 'The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.' - } - } -} + description = 'The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.', + }, + }, +} \ No newline at end of file diff --git a/modules/image/enums/ImageFormat.lua b/modules/image/enums/ImageFormat.lua index fb5295c6..85661ab1 100644 --- a/modules/image/enums/ImageFormat.lua +++ b/modules/image/enums/ImageFormat.lua @@ -4,11 +4,19 @@ return { constants = { { name = 'tga', - description = 'Targa image format.' + description = 'Targa image format.', }, { name = 'png', - description = 'PNG image format.' - } - } -} + description = 'PNG image format.', + }, + { + name = 'jpg', + description = 'JPG image format.', + }, + { + name = 'bmp', + description = 'BMP image format.', + }, + }, +} \ No newline at end of file diff --git a/modules/image/types/CompressedImageData.lua b/modules/image/types/CompressedImageData.lua index e6fe947b..9cbaace7 100644 --- a/modules/image/types/CompressedImageData.lua +++ b/modules/image/types/CompressedImageData.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'CompressedImageData', - description = 'Represents compressed image data designed to stay compressed in RAM.\n\nCompressedImageData encompasses standard compressed texture formats such as DXT1, DXT5, and BC5 / 3Dc.\n\nYou can\'t draw CompressedImageData directly to the screen. See Image for that.', - constructors = { - 'newCompressedData' + description = 'Represents compressed image data designed to stay compressed in RAM.\n\nCompressedImageData encompasses standard compressed texture formats such as DXT1, DXT5, and BC5 / 3Dc.\n\nYou can\'t draw CompressedImageData directly to the screen. See Image for that.', + supertypes = { + 'Data', + 'Object', }, functions = { { @@ -14,37 +17,37 @@ return { { type = 'number', name = 'width', - description = 'The width of the CompressedImageData.' + description = 'The width of the CompressedImageData.', }, { type = 'number', name = 'height', - description = 'The height of the CompressedImageData.' - } - } + description = 'The height of the CompressedImageData.', + }, + }, }, { arguments = { { type = 'number', name = 'level', - description = 'A mipmap level. Must be in the range of [1, CompressedImageData:getMipmapCount()].' - } + description = 'A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().', + }, }, returns = { { type = 'number', name = 'width', - description = 'The width of the CompressedImageData.' + description = 'The width of a specific mipmap level of the CompressedImageData.', }, { type = 'number', name = 'height', - description = 'The height of the CompressedImageData.' - } - } - } - } + description = 'The height of a specific mipmap level of the CompressedImageData.', + }, + }, + }, + }, }, { name = 'getFormat', @@ -55,11 +58,11 @@ return { { type = 'CompressedImageFormat', name = 'format', - description = 'The format of the CompressedImageData.' - } - } - } - } + description = 'The format of the CompressedImageData.', + }, + }, + }, + }, }, { name = 'getHeight', @@ -70,42 +73,43 @@ return { { type = 'number', name = 'height', - description = 'The height of the CompressedImageData.' - } - } + description = 'The height of the CompressedImageData.', + }, + }, }, { arguments = { { type = 'number', name = 'level', - description = 'A mipmap level. Must be in the range of [1, CompressedImageData:getMipmapCount()].' - } + description = 'A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().', + }, }, returns = { { type = 'number', name = 'height', - description = 'The height of the CompressedImageData.' - } - } - } - } + description = 'The height of a specific mipmap level of the CompressedImageData.', + }, + }, + }, + }, }, { name = 'getMipmapCount', description = 'Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count.', variants = { { + description = 'Mipmap filtering cannot be activated for an Image:setMipmapFilter will error. Most tools which can create compressed textures are able to automatically generate mipmaps for them in the same file.', returns = { { type = 'number', name = 'mipmaps', - description = 'The number of mipmap levels stored in the CompressedImageData.' - } - } - } - } + description = 'The number of mipmap levels stored in the CompressedImageData.', + }, + }, + }, + }, }, { name = 'getWidth', @@ -116,32 +120,27 @@ return { { type = 'number', name = 'width', - description = 'The width of the CompressedImageData.' - } - } + description = 'The width of the CompressedImageData.', + }, + }, }, { arguments = { { type = 'number', name = 'level', - description = 'A mipmap level. Must be in the range of [1, CompressedImageData:getMipmapCount()].' - } + description = 'A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().', + }, }, returns = { { type = 'number', name = 'width', - description = 'The width of the CompressedImageData.' - } - } - } - } - } + description = 'The width of a specific mipmap level of the CompressedImageData.', + }, + }, + }, + }, + }, }, - parenttype = 'Data', - supertypes = { - 'Data', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/image/types/ImageData.lua b/modules/image/types/ImageData.lua index 6a02a448..9eac8151 100644 --- a/modules/image/types/ImageData.lua +++ b/modules/image/types/ImageData.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'ImageData', description = 'Raw (decoded) image data.\n\nYou can\'t draw ImageData directly to screen. See Image for that.', - constructors = { - 'newImageData' + supertypes = { + 'Data', + 'Object', }, functions = { { @@ -14,24 +17,47 @@ return { { type = 'ImageFormat', name = 'format', - description = 'The format to encode the image as.' + description = 'The format to encode the image as.', }, { type = 'string', name = 'filename', + description = 'The filename to write the file to. If nil, no file will be written but the FileData will still be returned.', default = 'nil', - description = 'The filename to write the file to. If nil, no file will be written but the FileData will still be returned.' - } + }, }, returns = { { type = 'FileData', name = 'filedata', - description = 'The encoded image as a new FileData object.' - } - } - } - } + description = 'The encoded image as a new FileData object.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'outFile', + description = 'Name of a file to write encoded data to. The format will be automatically deduced from the file extension.', + }, + }, + }, + { + arguments = { + { + type = 'string', + name = 'outFile', + description = 'Name of a file to write encoded data to.', + }, + { + type = 'ImageFormat', + name = 'format', + description = 'The format to encode the image in.', + }, + }, + }, + }, }, { name = 'getDimensions', @@ -42,16 +68,16 @@ return { { type = 'number', name = 'width', - description = 'The width of the ImageData in pixels.' + description = 'The width of the ImageData in pixels.', }, { type = 'number', name = 'height', - description = 'The height of the ImageData in pixels.' - } - } - } - } + description = 'The height of the ImageData in pixels.', + }, + }, + }, + }, }, { name = 'getHeight', @@ -62,53 +88,53 @@ return { { type = 'number', name = 'height', - description = 'The height of the ImageData in pixels.' - } - } - } - } + description = 'The height of the ImageData in pixels.', + }, + }, + }, + }, }, { name = 'getPixel', - description = 'Gets the color of a pixel at a specific position in the image.\n\nValid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored.', + description = 'Gets the color of a pixel at a specific position in the image.\n\nValid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The position of the pixel on the x-axis.' + description = 'The position of the pixel on the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the pixel on the y-axis.' - } + description = 'The position of the pixel on the y-axis.', + }, }, returns = { { type = 'number', name = 'r', - description = 'The red component (0-1).' + description = 'The red component (0-1).', }, { type = 'number', name = 'g', - description = 'The green component (0-1).' + description = 'The green component (0-1).', }, { type = 'number', name = 'b', - description = 'The blue component (0-1).' + description = 'The blue component (0-1).', }, { type = 'number', name = 'a', - description = 'The alpha component (0-1).' - } - } - } - } + description = 'The alpha component (0-1).', + }, + }, + }, + }, }, { name = 'getWidth', @@ -119,116 +145,136 @@ return { { type = 'number', name = 'width', - description = 'The width of the ImageData in pixels.' - } - } - } - } + description = 'The width of the ImageData in pixels.', + }, + }, + }, + }, }, { name = 'mapPixel', - description = 'Transform an image by applying a function to every pixel.\n\nThis function is a higher order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData.\n\nThe function parameter 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 parameter can return up to four number values, which become the new r, g, b and a values of the pixel. If the function returns fewer values, the remaining components are set to 0.', + description = 'Transform an image by applying a function to every pixel.\n\nThis function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData.\n\nThe 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.\n\nfunction pixelFunction(x, y, r, g, b, a)\n\n -- template for defining your own pixel mapping function\n\n -- perform computations giving the new values for r, g, b and a\n\n -- ...\n\n return r, g, b, a\n\nend\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { type = 'function', name = 'pixelFunction', - description = 'Function parameter to apply to every pixel.' - } - } - } - } + description = 'Function to apply to every pixel.', + }, + { + type = 'number', + name = 'x', + description = 'The x-axis of the top-left corner of the area within the ImageData to apply the function to.', + default = '0', + }, + { + type = 'number', + name = 'y', + description = 'The y-axis of the top-left corner of the area within the ImageData to apply the function to.', + default = '0', + }, + { + type = 'number', + name = 'width', + description = 'The width of the area within the ImageData to apply the function to.', + default = 'ImageData:getWidth()', + }, + { + type = 'number', + name = 'height', + description = 'The height of the area within the ImageData to apply the function to.', + default = 'ImageData:getHeight()', + }, + }, + }, + }, }, { name = 'paste', description = 'Paste into ImageData from another source ImageData.', variants = { { + description = 'Note that this function just replaces the contents in the destination rectangle; it does not do any alpha blending.', arguments = { { type = 'ImageData', name = 'source', - description = 'Source ImageData from which to copy.' + description = 'Source ImageData from which to copy.', }, { type = 'number', name = 'dx', - description = 'Destination top-left position on x-axis.' + description = 'Destination top-left position on x-axis.', }, { type = 'number', name = 'dy', - description = 'Destination top-left position on y-axis.' + description = 'Destination top-left position on y-axis.', }, { type = 'number', name = 'sx', - description = 'Source top-left position on x-axis.' + description = 'Source top-left position on x-axis.', }, { type = 'number', name = 'sy', - description = 'Source top-left position on y-axis.' + description = 'Source top-left position on y-axis.', }, { type = 'number', name = 'sw', - description = 'Source width.' + description = 'Source width.', }, { type = 'number', name = 'sh', - description = 'Source height.' - } - } - } - } + description = 'Source height.', + }, + }, + }, + }, }, { name = 'setPixel', - description = 'Sets the color of a pixel at a specific position in the image.\n\nValid x and y values start at 0 and go up to image width and height minus 1.', + description = 'Sets the color of a pixel at a specific position in the image.\n\nValid x and y values start at 0 and go up to image width and height minus 1.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The position of the pixel on the x-axis.' + description = 'The position of the pixel on the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the pixel on the y-axis.' + description = 'The position of the pixel on the y-axis.', }, { type = 'number', name = 'r', - description = 'The red component (0-1).' + description = 'The red component (0-1).', }, { type = 'number', name = 'g', - description = 'The green component (0-1).' + description = 'The green component (0-1).', }, { type = 'number', name = 'b', - description = 'The blue component (0-1).' + description = 'The blue component (0-1).', }, { type = 'number', name = 'a', - description = 'The alpha component (0-1).' - } - } - } - } - } + description = 'The alpha component (0-1).', + }, + }, + }, + }, + }, }, - parenttype = 'Data', - supertypes = { - 'Data', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/joystick/Joystick.lua b/modules/joystick/Joystick.lua index 8bef0ab8..4f0b7cae 100644 --- a/modules/joystick/Joystick.lua +++ b/modules/joystick/Joystick.lua @@ -1,11 +1,10 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { name = 'joystick', description = 'Provides an interface to the user\'s joystick.', types = { - require(path .. 'types.Joystick') + require(path .. 'types.Joystick'), }, functions = { { @@ -17,11 +16,11 @@ return { { type = 'number', name = 'joystickcount', - description = 'The number of connected joysticks.' - } - } - } - } + description = 'The number of connected joysticks.', + }, + }, + }, + }, }, { name = 'getJoysticks', @@ -32,150 +31,157 @@ return { { type = 'table', name = 'joysticks', - description = 'The list of currently connected Joysticks.' - } - } - } - } + description = 'The list of currently connected Joysticks.', + }, + }, + }, + }, }, { name = 'loadGamepadMappings', - description = 'Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings.', + description = 'Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings.\n\nIt 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.', variants = { { + description = 'Loads a gamepad mappings string from a file.', arguments = { { type = 'string', name = 'filename', - description = 'The filename to load the mappings string from.' + description = 'The filename to load the mappings string from.', }, - } + }, }, { + description = 'Loads a gamepad mappings string directly.', arguments = { { type = 'string', name = 'mappings', - description = 'The mappings string to load.' + description = 'The mappings string to load.', }, - } - } - } + }, + }, + }, }, { name = 'saveGamepadMappings', - description = 'Saves the virtual gamepad mappings of all Joysticks that are recognized as gamepads and have either been recently used or their gamepad bindings have been modified.', + description = 'Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified.\n\nThe mappings are stored as a string for use with love.joystick.loadGamepadMappings.', variants = { { + description = 'Saves the gamepad mappings of all relevant joysticks to a file.', arguments = { { type = 'string', name = 'filename', - description = 'The filename to save the mappings string to.' + description = 'The filename to save the mappings string to.', }, }, returns = { { type = 'string', name = 'mappings', - description = 'The mappings string that was written to the file.' - } - } + description = 'The mappings string that was written to the file.', + }, + }, }, { + description = 'Returns the mappings string without writing to a file.', returns = { { type = 'string', name = 'mappings', - description = 'The mappings string.' + description = 'The mappings string.', }, - } - } - } + }, + }, + }, }, { name = 'setGamepadMapping', - description = '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.\n\nLÖ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.\n\nThe virtual gamepad buttons and axes are designed around the Xbox 360 controller layout.', + description = '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.\n\nLÖ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.\n\nThe virtual gamepad buttons and axes are designed around the Xbox 360 controller layout.', variants = { { arguments = { { type = 'string', name = 'guid', - description = 'The OS-dependent GUID for the type of Joystick the binding will affect.' + description = 'The OS-dependent GUID for the type of Joystick the binding will affect.', }, { type = 'GamepadButton', name = 'button', - description = 'The virtual gamepad button to bind.' + description = 'The virtual gamepad button to bind.', }, { type = 'JoystickInputType', name = 'inputtype', - description = 'The type of input to bind the virtual gamepad button to.' + description = 'The type of input to bind the virtual gamepad button to.', }, { type = 'number', name = 'inputindex', - description = 'The index of the axis, button, or hat to bind the virtual gamepad button to.' + description = 'The index of the axis, button, or hat to bind the virtual gamepad button to.', }, { type = 'JoystickHat', - name = 'hatdirection', - description = 'The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise.' - } + name = 'hatdir', + description = 'The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise.', + default = 'nil', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the virtual gamepad button was successfully bound.' - } - } + description = 'Whether the virtual gamepad button was successfully bound.', + }, + }, }, { + description = 'The physical locations for the bound gamepad axes and buttons should correspond as closely as possible to the layout of a standard Xbox 360 controller.', arguments = { { type = 'string', name = 'guid', - description = 'The OS-dependent GUID for the type of Joystick the binding will affect.' + description = 'The OS-dependent GUID for the type of Joystick the binding will affect.', }, { type = 'GamepadAxis', name = 'axis', - description = 'The virtual gamepad axis to bind.' + description = 'The virtual gamepad axis to bind.', }, { type = 'JoystickInputType', name = 'inputtype', - description = 'The type of input to bind the virtual gamepad axis to.' + description = 'The type of input to bind the virtual gamepad axis to.', }, { type = 'number', name = 'inputindex', - description = 'The index of the axis, button, or hat to bind the virtual gamepad axis to.' + description = 'The index of the axis, button, or hat to bind the virtual gamepad axis to.', }, { type = 'JoystickHat', - name = 'hatdirection', - description = 'The direction of the hat, if the virtual gamepad axis will be bound to a hat. nil otherwise.' - } + name = 'hatdir', + description = 'The direction of the hat, if the virtual gamepad axis will be bound to a hat. nil otherwise.', + default = 'nil', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'Whether the virtual gamepad button was successfully bound.' - } - } - } - } - } + description = 'Whether the virtual gamepad axis was successfully bound.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.GamepadAxis'), require(path .. 'enums.GamepadButton'), require(path .. 'enums.JoystickHat'), - require(path .. 'enums.JoystickInputType') - } -} + require(path .. 'enums.JoystickInputType'), + }, +} \ No newline at end of file diff --git a/modules/joystick/enums/GamepadAxis.lua b/modules/joystick/enums/GamepadAxis.lua index acee209e..9591ba1a 100644 --- a/modules/joystick/enums/GamepadAxis.lua +++ b/modules/joystick/enums/GamepadAxis.lua @@ -4,27 +4,27 @@ return { constants = { { name = 'leftx', - description = 'The x-axis of the left thumbstick.' + description = 'The x-axis of the left thumbstick.', }, { name = 'lefty', - description = 'The y-axis of the left thumbstick.' + description = 'The y-axis of the left thumbstick.', }, { name = 'rightx', - description = 'The x-axis of the right thumbstick.' + description = 'The x-axis of the right thumbstick.', }, { name = 'righty', - description = 'The y-axis of the right thumbstick.' + description = 'The y-axis of the right thumbstick.', }, { name = 'triggerleft', - description = 'Left analog trigger.' + description = 'Left analog trigger.', }, { name = 'triggerright', - description = 'Right analog trigger.' - } - } -} + description = 'Right analog trigger.', + }, + }, +} \ No newline at end of file diff --git a/modules/joystick/enums/GamepadButton.lua b/modules/joystick/enums/GamepadButton.lua index 2d3dcbee..9c1c2805 100644 --- a/modules/joystick/enums/GamepadButton.lua +++ b/modules/joystick/enums/GamepadButton.lua @@ -4,63 +4,63 @@ return { constants = { { name = 'a', - description = 'Bottom face button (A).' + description = 'Bottom face button (A).', }, { name = 'b', - description = 'Right face button (B).' + description = 'Right face button (B).', }, { name = 'x', - description = 'Left face button (X).' + description = 'Left face button (X).', }, { name = 'y', - description = 'Top face button (Y).' + description = 'Top face button (Y).', }, { name = 'back', - description = 'Back button.' + description = 'Back button.', }, { name = 'guide', - description = 'Guide button.' + description = 'Guide button.', }, { name = 'start', - description = 'Start button.' + description = 'Start button.', }, { name = 'leftstick', - description = 'Left stick click button.' + description = 'Left stick click button.', }, { name = 'rightstick', - description = 'Right stick click button.' + description = 'Right stick click button.', }, { name = 'leftshoulder', - description = 'Left bumper.' + description = 'Left bumper.', }, { name = 'rightshoulder', - description = 'Right bumper.' + description = 'Right bumper.', }, { name = 'dpup', - description = 'D-pad up.' + description = 'D-pad up.', }, { name = 'dpdown', - description = 'D-pad down.' + description = 'D-pad down.', }, { name = 'dpleft', - description = 'D-pad left.' + description = 'D-pad left.', }, { name = 'dpright', - description = 'D-pad right.' - } - } -} + description = 'D-pad right.', + }, + }, +} \ No newline at end of file diff --git a/modules/joystick/enums/JoystickHat.lua b/modules/joystick/enums/JoystickHat.lua index ddc7421c..e1f3dfac 100644 --- a/modules/joystick/enums/JoystickHat.lua +++ b/modules/joystick/enums/JoystickHat.lua @@ -4,39 +4,39 @@ return { constants = { { name = 'c', - description = 'Centered' + description = 'Centered', }, { name = 'd', - description = 'Down' + description = 'Down', }, { name = 'l', - description = 'Left' + description = 'Left', }, { name = 'ld', - description = 'Left+Down' + description = 'Left+Down', }, { name = 'lu', - description = 'Left+Up' + description = 'Left+Up', }, { name = 'r', - description = 'Right' + description = 'Right', }, { name = 'rd', - description = 'Right+Down' + description = 'Right+Down', }, { name = 'ru', - description = 'Right+Up' + description = 'Right+Up', }, { name = 'u', - description = 'Up' - } - } -} + description = 'Up', + }, + }, +} \ No newline at end of file diff --git a/modules/joystick/enums/JoystickInputType.lua b/modules/joystick/enums/JoystickInputType.lua index 01c58ed7..6253088b 100644 --- a/modules/joystick/enums/JoystickInputType.lua +++ b/modules/joystick/enums/JoystickInputType.lua @@ -4,15 +4,15 @@ return { constants = { { name = 'axis', - description = 'Analog axis.' + description = 'Analog axis.', }, { name = 'button', - description = 'Button.' + description = 'Button.', }, { name = 'hat', - description = '8-direction hat value.' - } - } -} + description = '8-direction hat value.', + }, + }, +} \ No newline at end of file diff --git a/modules/joystick/types/Joystick.lua b/modules/joystick/types/Joystick.lua index 1da0152a..7d37d723 100644 --- a/modules/joystick/types/Joystick.lua +++ b/modules/joystick/types/Joystick.lua @@ -1,8 +1,10 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Joystick', description = 'Represents a physical joystick.', - constructors = { - 'getJoysticks' + supertypes = { + 'Object', }, functions = { { @@ -14,21 +16,21 @@ return { { type = 'number', name = 'axisDir1', - description = 'Direction of axis1.' + description = 'Direction of axis1.', }, { type = 'number', name = 'axisDir2', - description = 'Direction of axis2.' + description = 'Direction of axis2.', }, { type = 'number', name = 'axisDirN', - description = 'Direction of axisN.' - } - } - } - } + description = 'Direction of axisN.', + }, + }, + }, + }, }, { name = 'getAxis', @@ -39,18 +41,18 @@ return { { type = 'number', name = 'axis', - description = 'The index of the axis to be checked.' - } + description = 'The index of the axis to be checked.', + }, }, returns = { { type = 'number', name = 'direction', - description = 'Current value of the axis.' - } - } - } - } + description = 'Current value of the axis.', + }, + }, + }, + }, }, { name = 'getAxisCount', @@ -61,11 +63,11 @@ return { { type = 'number', name = 'axes', - description = 'The number of axes available.' - } - } - } - } + description = 'The number of axes available.', + }, + }, + }, + }, }, { name = 'getButtonCount', @@ -76,11 +78,11 @@ return { { type = 'number', name = 'buttons', - description = 'The number of buttons available.' - } - } - } - } + description = 'The number of buttons available.', + }, + }, + }, + }, }, { name = 'getGUID', @@ -91,11 +93,11 @@ return { { type = 'string', name = 'guid', - description = 'The Joystick type\'s OS-dependent unique identifier.' - } - } - } - } + description = 'The Joystick type\'s OS-dependent unique identifier.', + }, + }, + }, + }, }, { name = 'getGamepadAxis', @@ -106,76 +108,78 @@ return { { type = 'GamepadAxis', name = 'axis', - description = 'The virtual axis to be checked.' - } + description = 'The virtual axis to be checked.', + }, }, returns = { { type = 'number', name = 'direction', - description = 'Current value of the axis.' - } - } - } - } + description = 'Current value of the axis.', + }, + }, + }, + }, }, { name = 'getGamepadMapping', description = 'Gets the button, axis or hat that a virtual gamepad input is bound to.', variants = { { + description = 'Returns nil if the Joystick isn\'t recognized as a gamepad or the virtual gamepad axis is not bound to a Joystick input.', arguments = { { type = 'GamepadAxis', name = 'axis', - description = 'The virtual gamepad axis to get the binding for.' - } + description = 'The virtual gamepad axis to get the binding for.', + }, }, returns = { { type = 'JoystickInputType', name = 'inputtype', - description = 'The type of input the virtual gamepad axis is bound to.' + description = 'The type of input the virtual gamepad axis is bound to.', }, { type = 'number', name = 'inputindex', - description = 'The index of the Joystick\'s button, axis or hat that the virtual gamepad axis is bound to.' + description = 'The index of the Joystick\'s button, axis or hat that the virtual gamepad axis is bound to.', }, { type = 'JoystickHat', name = 'hatdirection', - description = 'The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise.' - } - } + description = 'The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise.', + }, + }, }, { + description = 'The physical locations for the virtual gamepad axes and buttons correspond as closely as possible to the layout of a standard Xbox 360 controller.', arguments = { { - type = 'GamepadAxis', + type = 'GamepadButton', name = 'button', - description = 'The virtual gamepad button to get the binding for.' - } + description = 'The virtual gamepad button to get the binding for.', + }, }, returns = { { type = 'JoystickInputType', name = 'inputtype', - description = 'The type of input the virtual gamepad button is bound to.' + description = 'The type of input the virtual gamepad button is bound to.', }, { type = 'number', name = 'inputindex', - description = 'The index of the Joystick\'s button, axis or hat that the virtual gamepad button is bound to.' + description = 'The index of the Joystick\'s button, axis or hat that the virtual gamepad button is bound to.', }, { type = 'JoystickHat', name = 'hatdirection', - description = 'The direction of the hat, if the virtual gamepad button is bound to a hat. nil otherwise.' - } - } - } - } + description = 'The direction of the hat, if the virtual gamepad button is bound to a hat. nil otherwise.', + }, + }, + }, + }, }, { name = 'getHat', @@ -186,18 +190,18 @@ return { { type = 'number', name = 'hat', - description = 'The index of the hat to be checked.' - } + description = 'The index of the hat to be checked.', + }, }, returns = { { type = 'JoystickHat', name = 'direction', - description = 'The direction the hat is pushed.' - } - } - } - } + description = 'The direction the hat is pushed.', + }, + }, + }, + }, }, { name = 'getHatCount', @@ -208,31 +212,31 @@ return { { type = 'number', name = 'hats', - description = 'How many hats the joystick has.' - } - } - } - } + description = 'How many hats the joystick has.', + }, + }, + }, + }, }, { name = 'getID', - description = '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.', + description = '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.', variants = { { returns = { { type = 'number', name = 'id', - description = 'The Joystick\'s unique identifier. Remains the same as long as the game is running.' + description = 'The Joystick\'s unique identifier. Remains the same as long as the game is running.', }, { type = 'number', name = 'instanceid', - description = 'Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected.' - } - } - } - } + description = 'Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected.', + }, + }, + }, + }, }, { name = 'getName', @@ -243,11 +247,11 @@ return { { type = 'string', name = 'name', - description = 'The name of the joystick.' - } - } - } - } + description = 'The name of the joystick.', + }, + }, + }, + }, }, { name = 'getVibration', @@ -258,16 +262,16 @@ return { { type = 'number', name = 'left', - description = 'Current strength of the left vibration motor on the Joystick.' + description = 'Current strength of the left vibration motor on the Joystick.', }, { type = 'number', name = 'right', - description = 'Current strength of the right vibration motor on the Joystick.' - } - } - } - } + description = 'Current strength of the right vibration motor on the Joystick.', + }, + }, + }, + }, }, { name = 'isConnected', @@ -278,11 +282,11 @@ return { { type = 'boolean', name = 'connected', - description = 'True if the Joystick is currently connected, false otherwise.' - } - } - } - } + description = 'True if the Joystick is currently connected, false otherwise.', + }, + }, + }, + }, }, { name = 'isDown', @@ -292,34 +296,35 @@ return { arguments = { { type = 'number', - name = '...', - description = 'The index of a button to check.' - } + name = 'buttonN', + description = 'The index of a button to check.', + }, }, returns = { { type = 'boolean', name = 'anyDown', - description = 'True if any supplied button is down, false if not.' - } - } - } - } + description = 'True if any supplied button is down, false if not.', + }, + }, + }, + }, }, { name = 'isGamepad', - description = '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 and related functions.\n\nLÖ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.', + description = '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.\n\nLÖ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.', variants = { { + description = 'If the Joystick is recognized as a gamepad, the physical locations for the virtual gamepad axes and buttons correspond as closely as possible to the layout of a standard Xbox 360 controller.', returns = { { type = 'boolean', name = 'isgamepad', - description = 'True if the Joystick is recognized as a gamepad, false otherwise.' - } - } - } - } + description = 'True if the Joystick is recognized as a gamepad, false otherwise.', + }, + }, + }, + }, }, { name = 'isGamepadDown', @@ -329,100 +334,100 @@ return { arguments = { { type = 'GamepadButton', - name = '...', - description = 'The gamepad button to check.' - } + name = 'buttonN', + description = 'The gamepad button to check.', + }, }, returns = { { type = 'boolean', name = 'anyDown', - description = 'True if any supplied button is down, false if not.' - } - } - } - } + description = 'True if any supplied button is down, false if not.', + }, + }, + }, + }, }, { name = 'isVibrationSupported', description = 'Gets whether the Joystick supports vibration.', variants = { { + description = 'The very first call to this function may take more time than expected because SDL\'s Haptic / Force Feedback subsystem needs to be initialized.', returns = { { type = 'boolean', name = 'supported', - description = 'True if rumble / force feedback vibration is supported on this Joystick, false if not.' - } - } - } - } + description = 'True if rumble / force feedback vibration is supported on this Joystick, false if not.', + }, + }, + }, + }, }, { name = 'setVibration', - description = 'Sets the vibration motor speeds on a Joystick with rumble support.', + description = '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.', variants = { { arguments = { { type = 'number', name = 'left', - description = 'Strength of the left vibration motor on the Joystick. Must be in the range of [0, 1].' + description = 'Strength of the left vibration motor on the Joystick. Must be in the range of 1.', }, { type = 'number', name = 'right', - description = 'Strength of the right vibration motor on the Joystick. Must be in the range of [0, 1].' + description = 'Strength of the right vibration motor on the Joystick. Must be in the range of 1.', }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the vibration was successfully applied, false if not.' - } - } + description = 'True if the vibration was successfully applied, false if not.', + }, + }, }, { + description = 'Disables vibration.', returns = { { type = 'boolean', name = 'success', - description = 'True if the vibration was successfully disabled, false if not.' - } - } + description = 'True if the vibration was successfully disabled, false if not.', + }, + }, }, { + description = 'If the Joystick only has a single vibration motor, it will still work but it will use the largest value of the left and right parameters.\n\nThe Xbox 360 controller on Mac OS X only has support for vibration if a modified version of the Tattiebogle driver is used.\n\nThe very first call to this function may take more time than expected because SDL\'s Haptic / Force Feedback subsystem needs to be initialized.', arguments = { { type = 'number', name = 'left', - description = 'Strength of the left vibration motor on the Joystick. Must be in the range of [0, 1].' + description = 'Strength of the left vibration motor on the Joystick. Must be in the range of 1.', }, { type = 'number', name = 'right', - description = 'Strength of the right vibration motor on the Joystick. Must be in the range of [0, 1].' + description = 'Strength of the right vibration motor on the Joystick. Must be in the range of 1.', }, { type = 'number', name = 'duration', - description = 'The duration of the vibration in seconds. A negative value means infinite duration.' - } + description = 'The duration of the vibration in seconds. A negative value means infinite duration.', + default = '-1', + }, }, returns = { { type = 'boolean', name = 'success', - description = 'True if the vibration was successfully applied, false if not.' - } - } - } - } - } + description = 'True if the vibration was successfully applied, false if not.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/keyboard/Keyboard.lua b/modules/keyboard/Keyboard.lua index 495b0ace..5e9ef640 100644 --- a/modules/keyboard/Keyboard.lua +++ b/modules/keyboard/Keyboard.lua @@ -1,53 +1,54 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { name = 'keyboard', description = 'Provides an interface to the user\'s keyboard.', + types = { + }, functions = { { name = 'getKeyFromScancode', - description = 'Gets the key corresponding to the given hardware scancode.\n\nUnlike key constants, Scancodes are keyboard layout-independent. For example the scancode "w" will be generated if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nScancodes are useful for creating default controls that have the same physical locations on on all systems.', + description = 'Gets the key corresponding to the given hardware scancode.\n\nUnlike key constants, Scancodes are keyboard layout-independent. For example the scancode \'w\' will be generated if the key in the same place as the \'w\' key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nScancodes are useful for creating default controls that have the same physical locations on on all systems.', variants = { { arguments = { { type = 'Scancode', name = 'scancode', - description = 'The scancode to get the key from.' - } + description = 'The scancode to get the key from.', + }, }, returns = { { type = 'KeyConstant', name = 'key', - description = 'The key corresponding to the given scancode, or "unknown" if the scancode doesn\'t map to a KeyConstant on the current system.' - } - } - } - } + description = 'The key corresponding to the given scancode, or \'unknown\' if the scancode doesn\'t map to a KeyConstant on the current system.', + }, + }, + }, + }, }, { name = 'getScancodeFromKey', - description = 'Gets the hardware scancode corresponding to the given key.\n\nUnlike key constants, Scancodes are keyboard layout-independent. For example the scancode "w" will be generated if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nScancodes are useful for creating default controls that have the same physical locations on on all systems.', + description = 'Gets the hardware scancode corresponding to the given key.\n\nUnlike key constants, Scancodes are keyboard layout-independent. For example the scancode \'w\' will be generated if the key in the same place as the \'w\' key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nScancodes are useful for creating default controls that have the same physical locations on on all systems.', variants = { { arguments = { { type = 'KeyConstant', name = 'key', - description = 'The key to get the scancode from.' - } + description = 'The key to get the scancode from.', + }, }, returns = { { type = 'Scancode', name = 'scancode', - description = 'The scancode corresponding to the given key, or "unknown" if the given key has no known physical representation on the current system.' - } - } - } - } + description = 'The scancode corresponding to the given key, or \'unknown\' if the given key has no known physical representation on the current system.', + }, + }, + }, + }, }, { name = 'hasKeyRepeat', @@ -58,11 +59,11 @@ return { { type = 'boolean', name = 'enabled', - description = 'Whether key repeat is enabled.' - } - } - } - } + description = 'Whether key repeat is enabled.', + }, + }, + }, + }, }, { name = 'hasTextInput', @@ -73,11 +74,11 @@ return { { type = 'boolean', name = 'enabled', - description = 'Whether text input events are enabled.' - } - } - } - } + description = 'Whether text input events are enabled.', + }, + }, + }, + }, }, { name = 'isDown', @@ -88,129 +89,131 @@ return { { type = 'KeyConstant', name = 'key', - description = 'The key to check.' - } + description = 'The key to check.', + }, }, returns = { { type = 'boolean', name = 'down', - description = 'True if the key is down, false if not.' - } - } + description = 'True if the key is down, false if not.', + }, + }, }, { arguments = { { type = 'KeyConstant', name = 'key', - description = 'A key to check.' + description = 'A key to check.', }, { type = 'KeyConstant', name = '...', - description = 'Additional keys to check.' - } + description = 'Additional keys to check.', + }, }, returns = { { type = 'boolean', name = 'anyDown', - description = 'True if any supplied key is down, false if not.' - } - } - } - } + description = 'True if any supplied key is down, false if not.', + }, + }, + }, + }, }, { name = 'isScancodeDown', - description = 'Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased.\n\nUnlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode "w" is used if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.', + description = 'Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased.\n\nUnlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode \'w\' is used if the key in the same place as the \'w\' key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.', variants = { { arguments = { { type = 'Scancode', name = 'scancode', - description = 'A Scancode to check.' + description = 'A Scancode to check.', }, { type = 'Scancode', name = '...', - description = 'Additional Scancodes to check.' - } + description = 'Additional Scancodes to check.', + }, }, returns = { { type = 'boolean', name = 'down', - description = 'True if any supplied Scancode is down, false if not.' - } - } - } - } + description = 'True if any supplied Scancode is down, false if not.', + }, + }, + }, + }, }, { name = 'setKeyRepeat', - description = 'Enables or disables key repeat. It is disabled by default.\n\nThe interval between repeats depends on the user\'s system settings.', + description = 'Enables or disables key repeat for love.keypressed. It is disabled by default.', variants = { { + description = 'The interval between repeats depends on the user\'s system settings. This function doesn\'t affect whether love.textinput is called multiple times while a key is held down.', arguments = { { type = 'boolean', name = 'enable', - description = 'Whether repeat keypress events should be enabled when a key is held down.' - } - } - } - } + description = 'Whether repeat keypress events should be enabled when a key is held down.', + }, + }, + }, + }, }, { name = 'setTextInput', - description = 'Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android.', + description = 'Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android.\n\nOn touch devices, this shows the system\'s native on-screen keyboard when it\'s enabled.', variants = { { arguments = { { type = 'boolean', name = 'enable', - description = 'Whether text input events should be enabled.' - } - } + description = 'Whether text input events should be enabled.', + }, + }, }, { + description = 'On iOS and Android this variant tells the OS that the specified rectangle is where text will show up in the game, which prevents the system on-screen keyboard from covering the text.', arguments = { { type = 'boolean', name = 'enable', - description = 'Whether text input events should be enabled.' + description = 'Whether text input events should be enabled.', }, { type = 'number', name = 'x', - description = 'On-screen keyboard x position.' + description = 'Text rectangle x position.', }, { type = 'number', name = 'y', - description = 'On-screen keyboard y position.' + description = 'Text rectangle y position.', }, { type = 'number', name = 'w', - description = 'On-screen keyboard width.' + description = 'Text rectangle width.', }, { type = 'number', name = 'h', - description = 'On-screen keyboard height.' - } - } - } - } - } + description = 'Text rectangle height.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.KeyConstant'), - require(path .. 'enums.Scancode') - } -} + require(path .. 'enums.Scancode'), + }, +} \ No newline at end of file diff --git a/modules/keyboard/enums/KeyConstant.lua b/modules/keyboard/enums/KeyConstant.lua index 83396ff3..f7766bf5 100644 --- a/modules/keyboard/enums/KeyConstant.lua +++ b/modules/keyboard/enums/KeyConstant.lua @@ -1,586 +1,6 @@ return { name = 'KeyConstant', - description = 'All the keys you can press. Note that some keys may not be available on your keyboard or system.', + description = 'All the keys you can press. Note that some keys may not be available on your keyboard or system.\n\n{| class="wikitable"\n\n! Key string\n\n! Description\n\n! Note(s)\n\n\n\n!style="text-align: center;" colspan=3|Character keys\n\n\n\n\n\n|The A key\n\n|\n\n\n\n\n\n|The B key\n\n|\n\n\n\n\n\n|The C key\n\n|\n\n\n\n\n\n|The D key\n\n|\n\n\n\n\n\n|The E key\n\n|\n\n\n\n\n\n|The F key\n\n|\n\n\n\n\n\n|The G key\n\n|\n\n\n\n\n\n|The H key\n\n|\n\n\n\n\n\n|The I key\n\n|\n\n\n\n\n\n|The J key\n\n|\n\n\n\n\n\n|The K key\n\n|\n\n\n\n\n\n|The L key\n\n|\n\n\n\n\n\n|The M key\n\n|\n\n\n\n\n\n|The N key\n\n|\n\n\n\n\n\n|The O key\n\n|\n\n\n\n\n\n|The P key\n\n|\n\n\n\n\n\n|The Q key\n\n|\n\n\n\n\n\n|The R key\n\n|\n\n\n\n\n\n|The S key\n\n|\n\n\n\n\n\n|The T key\n\n|\n\n\n\n\n\n|The U key\n\n|\n\n\n\n\n\n|The V key\n\n|\n\n\n\n\n\n|The W key\n\n|\n\n\n\n\n\n|The X key\n\n|\n\n\n\n\n\n|The Y key\n\n|\n\n\n\n\n\n|The Z key\n\n|\n\n\n\n\n\n|The zero key\n\n|\n\n\n\n\n\n|The one key\n\n|\n\n\n\n\n\n|The two key\n\n|\n\n\n\n\n\n|The three key\n\n|\n\n\n\n\n\n|The four key\n\n|\n\n\n\n\n\n|The five key\n\n|\n\n\n\n\n\n|The six key\n\n|\n\n\n\n\n\n|The seven key\n\n|\n\n\n\n\n\n|The eight key\n\n|\n\n\n\n\n\n|The nine key\n\n|\n\n\n\n|space \n\n|Space key\n\n|In version 0.9.2 and earlier this is represented by the actual space character \' \'.\n\n\n\n\n\n|Exclamation mark key \n\n|\n\n\n\n\n\n|Double quote key \n\n|\n\n\n\n\n\n|Hash key \n\n|\n\n\n\n\n\n|Dollar key \n\n|\n\n\n\n\n\n|Ampersand key \n\n|\n\n\n\n\n\n|Single quote key \n\n|\n\n\n\n\n\n|Left parenthesis key \n\n|\n\n\n\n\n\n|Right parenthesis key \n\n|\n\n\n\n\n\n|Asterisk key \n\n|\n\n\n\n\n\n|Plus key\n\n|\n\n\n\n\n\n|Comma key\n\n|\n\n\n\n\n\n|Hyphen-minus key\n\n|\n\n\n\n\n\n|Full stop key\n\n|\n\n\n\n\n\n|Slash key\n\n|\n\n\n\n\n\n|Colon key\n\n|\n\n\n\n\n\n|Semicolon key\n\n|\n\n\n\n\n\n|Less-than key\n\n|\n\n\n\n\n\n|Equal key\n\n|\n\n\n\n\n\n|Greater-than key\n\n|\n\n\n\n\n\n|Question mark key\n\n|\n\n\n\n\n\n|At sign key\n\n|\n\n\n\n\n\n|Left square bracket key\n\n|\n\n\n\n\n\n|Backslash key\n\n|\n\n\n\n\n\n|Right square bracket key\n\n|\n\n\n\n\n\n|Caret key\n\n|\n\n\n\n\n\n|Underscore key\n\n|\n\n\n\n\n\n|Grave accent key\n\n|Also known as the "Back tick" key\n\n\n\n!style="text-align: center;" colspan=3|Numpad keys\n\n\n\n\n\n|The numpad zero key\n\n|\n\n\n\n\n\n|The numpad one key\n\n|\n\n\n\n\n\n|The numpad two key\n\n|\n\n\n\n\n\n|The numpad three key\n\n|\n\n\n\n\n\n|The numpad four key\n\n|\n\n\n\n\n\n|The numpad five key\n\n|\n\n\n\n\n\n|The numpad six key\n\n|\n\n\n\n\n\n|The numpad seven key\n\n|\n\n\n\n\n\n|The numpad eight key\n\n|\n\n\n\n\n\n|The numpad nine key\n\n|\n\n\n\n\n\n|The numpad decimal point key\n\n|\n\n\n\n\n\n|The numpad comma key\n\n|\n\n\n\n\n\n|The numpad division key\n\n|\n\n\n\n\n\n|The numpad multiplication key\n\n|\n\n\n\n\n\n|The numpad substraction key\n\n|\n\n\n\n\n\n|The numpad addition key\n\n|\n\n\n\n\n\n|The numpad enter key \n\n|\n\n\n\n\n\n|The numpad equals key\n\n|\n\n\n\n!style="text-align: center;" colspan=3|Navigation keys\n\n\n\n\n\n|Up arrow key \n\n|\n\n\n\n\n\n|Down arrow key \n\n|\n\n\n\n\n\n|Right arrow key \n\n|\n\n\n\n\n\n|Left arrow key \n\n|\n\n\n\n\n\n|Home key\n\n|\n\n\n\n\n\n|End key\n\n|\n\n\n\n\n\n|Page up key\n\n|\n\n\n\n\n\n|Page down key\n\n|\n\n\n\n!style="text-align: center;" colspan=3|Editing keys\n\n\n\n\n\n|Insert key\n\n|\n\n\n\n\n\n|Backspace key \n\n|\n\n\n\n\n\n|Tab key \n\n|\n\n\n\n\n\n|Clear key \n\n|\n\n\n\n\n\n|Return key\n\n|Also known as the Enter key\n\n\n\n\n\n|Delete key\n\n|\n\n\n\n!style="text-align: center;" colspan=3|Function keys\n\n\n\n\n\n|The 1st function key\n\n|\n\n\n\n\n\n|The 2nd function key\n\n|\n\n\n\n\n\n|The 3rd function key\n\n|\n\n\n\n\n\n|The 4th function key\n\n|\n\n\n\n\n\n|The 5th function key\n\n|\n\n\n\n\n\n|The 6th function key\n\n|\n\n\n\n\n\n|The 7th function key\n\n|\n\n\n\n\n\n|The 8th function key\n\n|\n\n\n\n\n\n|The 9th function key\n\n|\n\n\n\n\n\n|The 10th function key\n\n|\n\n\n\n\n\n|The 11th function key\n\n|\n\n\n\n\n\n|The 12th function key\n\n|\n\n\n\n\n\n|The 13th function key\n\n|\n\n\n\n\n\n|The 14th function key\n\n|\n\n\n\n\n\n|The 15th function key\n\n|\n\n\n\n\n\n|The 16th function key\n\n|\n\n\n\n\n\n|The 17th function key\n\n|\n\n\n\n\n\n|The 18th function key\n\n|\n\n\n\n!style="text-align: center;" colspan=3|Modifier keys\n\n\n\n\n\n|Num-lock key\n\n|Clear on Mac keyboards.\n\n\n\n\n\n|Caps-lock key\n\n|Caps-on is a key press. Caps-off is a key release.\n\n\n\n\n\n|Scroll-lock key\n\n|\n\n\n\n\n\n|Right shift key \n\n|\n\n\n\n\n\n|Left shift key \n\n|\n\n\n\n\n\n|Right control key \n\n|\n\n\n\n\n\n|Left control key \n\n|\n\n\n\n\n\n|Right alt key \n\n|\n\n\n\n\n\n|Left alt key \n\n|\n\n\n\n\n\n|Right gui key\n\n|Command key in OS X, Windows key in Windows.\n\n\n\n\n\n|Left gui key\n\n|Command key in OS X, Windows key in Windows.\n\n\n\n\n\n|Mode key\n\n|\n\n\n\n!style="text-align: center;" colspan=3|Application keys\n\n\n\n\n\n|WWW key\n\n|\n\n\n\n\n\n|Mail key\n\n|\n\n\n\n\n\n|Calculator key\n\n|\n\n\n\n\n\n|Computer key\n\n|\n\n\n\n\n\n|Application search key\n\n|\n\n\n\n\n\n|Application home key\n\n|\n\n\n\n\n\n|Application back key\n\n|\n\n\n\n\n\n|Application forward key\n\n|\n\n\n\n\n\n|Application refresh key\n\n|\n\n\n\n\n\n|Application bookmarks key\n\n|\n\n\n\n!style="text-align: center;" colspan=3|Miscellaneous keys\n\n\n\n\n\n|Pause key \n\n|Sends a key release immediately on some platforms, even if held down. \n\n\n\n\n\n|Escape key \n\n|\n\n\n\n\n\n|Help key\n\n|\n\n\n\n\n\n|Printscreen key\n\n|Sends a key release immediately on Windows, even if held down.\n\n\n\n\n\n|System request key\n\n|\n\n\n\n\n\n|Menu key\n\n|\n\n\n\n\n\n|Application key\n\n|Windows contextual menu, compose key.\n\n\n\n\n\n|Power key\n\n|\n\n\n\n\n\n|Currency unit key\n\n|e.g. the Euro (&euro;) key.\n\n\n\n\n\n|Undo key\n\n|\n\n\n\nNote how love.keypressed gives direct key presses, whereas love.textinput gives the text that key combinations produce. \n\nLet\'s take the "#" symbol as an example (assuming a U.S. keyboard):\n\nfunction love.keypressed(key)\n\n print(key)\n\nend\n\n--> shift\n\n--> 3\n\nfunction love.textinput(text)\n\n print(text)\n\nend\n\n--> #\n\n* parent::love.keyboard\n\n* love.keypressed\n\n* love.keyreleased\n\n* love.keyboard.isDown\n\n* love.keyboard.getScancodeFromKey\n\n* love.keyboard.getKeyFromScancode\n\nCategory:Enums', constants = { - { - name = 'a', - description = 'The A key' - }, - { - name = 'b', - description = 'The B key' - }, - { - name = 'c', - description = 'The C key' - }, - { - name = 'd', - description = 'The D key' - }, - { - name = 'e', - description = 'The E key' - }, - { - name = 'f', - description = 'The F key' - }, - { - name = 'g', - description = 'The G key' - }, - { - name = 'h', - description = 'The H key' - }, - { - name = 'i', - description = 'The I key' - }, - { - name = 'j', - description = 'The J key' - }, - { - name = 'k', - description = 'The K key' - }, - { - name = 'l', - description = 'The L key' - }, - { - name = 'm', - description = 'The M key' - }, - { - name = 'n', - description = 'The N key' - }, - { - name = 'o', - description = 'The O key' - }, - { - name = 'p', - description = 'The P key' - }, - { - name = 'q', - description = 'The Q key' - }, - { - name = 'r', - description = 'The R key' - }, - { - name = 's', - description = 'The S key' - }, - { - name = 't', - description = 'The T key' - }, - { - name = 'u', - description = 'The U key' - }, - { - name = 'v', - description = 'The V key' - }, - { - name = 'w', - description = 'The W key' - }, - { - name = 'x', - description = 'The X key' - }, - { - name = 'y', - description = 'The Y key' - }, - { - name = 'z', - description = 'The Z key' - }, - { - name = '0', - description = 'The zero key' - }, - { - name = '1', - description = 'The one key' - }, - { - name = '2', - description = 'The two key' - }, - { - name = '3', - description = 'The three key' - }, - { - name = '4', - description = 'The four key' - }, - { - name = '5', - description = 'The five key' - }, - { - name = '6', - description = 'The six key' - }, - { - name = '7', - description = 'The seven key' - }, - { - name = '8', - description = 'The eight key' - }, - { - name = '9', - description = 'The nine key' - }, - { - name = 'space', - description = 'Space key', - notes = 'In version 0.9.2 and earlier this is represented by the actual space character' - }, - { - name = '!', - description = 'Exclamation mark key' - }, - { - name = '"', - description = 'Double quote key' - }, - { - name = '#', - description = 'Hash key' - }, - { - name = '$', - description = 'Dollar key' - }, - { - name = '&', - description = 'Ampersand key' - }, - { - name = '\'', - description = 'Single quote key' - }, - { - name = '(', - description = 'Left parenthesis key' - }, - { - name = ')', - description = 'Right parenthesis key' - }, - { - name = '*', - description = 'Asterisk key' - }, - { - name = '+', - description = 'Plus key' - }, - { - name = ',', - description = 'Comma key' - }, - { - name = '-', - description = 'Hyphen-minus key' - }, - { - name = '.', - description = 'Full stop key' - }, - { - name = '/', - description = 'Slash key' - }, - { - name = ':', - description = 'Colon key' - }, - { - name = ';', - description = 'Semicolon key' - }, - { - name = '<', - description = 'Less-than key' - }, - { - name = '=', - description = 'Equal key' - }, - { - name = '>', - description = 'Greater-than key' - }, - { - name = '?', - description = 'Question mark key' - }, - { - name = '@', - description = 'At sign key' - }, - { - name = '[', - description = 'Left square bracket key' - }, - { - name = '\\', - description = 'Backslash key' - }, - { - name = ']', - description = 'Right square bracket key' - }, - { - name = '^', - description = 'Caret key' - }, - { - name = '_', - description = 'Underscore key' - }, - { - name = '`', - description = 'Grave accent key', - notes = 'Also known as the "Back tick" key' - }, - { - name = 'kp0', - description = 'The numpad zero key' - }, - { - name = 'kp1', - description = 'The numpad one key' - }, - { - name = 'kp2', - description = 'The numpad two key' - }, - { - name = 'kp3', - description = 'The numpad three key' - }, - { - name = 'kp4', - description = 'The numpad four key' - }, - { - name = 'kp5', - description = 'The numpad five key' - }, - { - name = 'kp6', - description = 'The numpad six key' - }, - { - name = 'kp7', - description = 'The numpad seven key' - }, - { - name = 'kp8', - description = 'The numpad eight key' - }, - { - name = 'kp9', - description = 'The numpad nine key' - }, - { - name = 'kp.', - description = 'The numpad decimal point key' - }, - { - name = 'kp/', - description = 'The numpad division key' - }, - { - name = 'kp*', - description = 'The numpad multiplication key' - }, - { - name = 'kp-', - description = 'The numpad substraction key' - }, - { - name = 'kp+', - description = 'The numpad addition key' - }, - { - name = 'kpenter', - description = 'The numpad enter key' - }, - { - name = 'kp=', - description = 'The numpad equals key' - }, - { - name = 'up', - description = 'Up cursor key' - }, - { - name = 'down', - description = 'Down cursor key' - }, - { - name = 'right', - description = 'Right cursor key' - }, - { - name = 'left', - description = 'Left cursor key' - }, - { - name = 'home', - description = 'Home key' - }, - { - name = 'end', - description = 'End key' - }, - { - name = 'pageup', - description = 'Page up key' - }, - { - name = 'pagedown', - description = 'Page down key' - }, - { - name = 'insert', - description = 'Insert key' - }, - { - name = 'backspace', - description = 'Backspace key' - }, - { - name = 'tab', - description = 'Tab key' - }, - { - name = 'clear', - description = 'Clear key' - }, - { - name = 'return', - description = 'Return key', - notes = 'Also known as the Enter key' - }, - { - name = 'delete', - description = 'Delete key' - }, - { - name = 'f1', - description = 'The 1st function key' - }, - { - name = 'f2', - description = 'The 2nd function key' - }, - { - name = 'f3', - description = 'The 3rd function key' - }, - { - name = 'f4', - description = 'The 4th function key' - }, - { - name = 'f5', - description = 'The 5th function key' - }, - { - name = 'f6', - description = 'The 6th function key' - }, - { - name = 'f7', - description = 'The 7th function key' - }, - { - name = 'f8', - description = 'The 8th function key' - }, - { - name = 'f9', - description = 'The 9th function key' - }, - { - name = 'f10', - description = 'The 10th function key' - }, - { - name = 'f11', - description = 'The 11th function key' - }, - { - name = 'f12', - description = 'The 12th function key' - }, - { - name = 'f13', - description = 'The 13th function key' - }, - { - name = 'f14', - description = 'The 14th function key' - }, - { - name = 'f15', - description = 'The 15th function key' - }, - { - name = 'numlock', - description = 'Num-lock key' - }, - { - name = 'capslock', - description = 'Caps-lock key', - notes = 'Caps-on is a key press. Caps-off is a key release.' - }, - { - name = 'scrollock', - description = 'Scroll-lock key' - }, - { - name = 'rshift', - description = 'Right shift key' - }, - { - name = 'lshift', - description = 'Left shift key' - }, - { - name = 'rctrl', - description = 'Right control key' - }, - { - name = 'lctrl', - description = 'Left control key' - }, - { - name = 'ralt', - description = 'Right alt key' - }, - { - name = 'lalt', - description = 'Left alt key' - }, - { - name = 'rmeta', - description = 'Right meta key' - }, - { - name = 'lmeta', - description = 'Left meta key' - }, - { - name = 'lsuper', - description = 'Left super key' - }, - { - name = 'rsuper', - description = 'Right super key' - }, - { - name = 'mode', - description = 'Mode key' - }, - { - name = 'compose', - description = 'Compose key' - }, - { - name = 'pause', - description = 'Pause key' - }, - { - name = 'escape', - description = 'Escape key' - }, - { - name = 'help', - description = 'Help key' - }, - { - name = 'print', - description = 'Print key' - }, - { - name = 'sysreq', - description = 'System request key' - }, - { - name = 'break', - description = 'Break key' - }, - { - name = 'menu', - description = 'Menu key' - }, - { - name = 'power', - description = 'Power key' - }, - { - name = 'euro', - description = 'Euro (€) key' - }, - { - name = 'undo', - description = 'Undo key' - }, - { - name = 'www', - description = 'WWW key' - }, - { - name = 'mail', - description = 'Mail key' - }, - { - name = 'calculator', - description = 'Calculator key' - }, - { - name = 'appsearch', - description = 'Application search key' - }, - { - name = 'apphome', - description = 'Application home key' - }, - { - name = 'appback', - description = 'Application back key' - }, - { - name = 'appforward', - description = 'Application forward key' - }, - { - name = 'apprefresh', - description = 'Application refresh key' - }, - { - name = 'appbookmarks', - description = 'Application bookmarks key' - } - } -} + }, +} \ No newline at end of file diff --git a/modules/keyboard/enums/Scancode.lua b/modules/keyboard/enums/Scancode.lua index 6f5456d8..27fb965c 100644 --- a/modules/keyboard/enums/Scancode.lua +++ b/modules/keyboard/enums/Scancode.lua @@ -4,779 +4,779 @@ return { constants = { { name = 'a', - description = 'The \'A\' key on an American layout.' + description = 'The \'A\' key on an American layout.', }, { name = 'b', - description = 'The \'B\' key on an American layout.' + description = 'The \'B\' key on an American layout.', }, { name = 'c', - description = 'The \'C\' key on an American layout.' + description = 'The \'C\' key on an American layout.', }, { name = 'd', - description = 'The \'D\' key on an American layout.' + description = 'The \'D\' key on an American layout.', }, { name = 'e', - description = 'The \'E\' key on an American layout.' + description = 'The \'E\' key on an American layout.', }, { name = 'f', - description = 'The \'F\' key on an American layout.' + description = 'The \'F\' key on an American layout.', }, { name = 'g', - description = 'The \'G\' key on an American layout.' + description = 'The \'G\' key on an American layout.', }, { name = 'h', - description = 'The \'H\' key on an American layout.' + description = 'The \'H\' key on an American layout.', }, { name = 'i', - description = 'The \'I\' key on an American layout.' + description = 'The \'I\' key on an American layout.', }, { name = 'j', - description = 'The \'J\' key on an American layout.' + description = 'The \'J\' key on an American layout.', }, { name = 'k', - description = 'The \'K\' key on an American layout.' + description = 'The \'K\' key on an American layout.', }, { name = 'l', - description = 'The \'L\' key on an American layout.' + description = 'The \'L\' key on an American layout.', }, { name = 'm', - description = 'The \'M\' key on an American layout.' + description = 'The \'M\' key on an American layout.', }, { name = 'n', - description = 'The \'N\' key on an American layout.' + description = 'The \'N\' key on an American layout.', }, { name = 'o', - description = 'The \'O\' key on an American layout.' + description = 'The \'O\' key on an American layout.', }, { name = 'p', - description = 'The \'P\' key on an American layout.' + description = 'The \'P\' key on an American layout.', }, { name = 'q', - description = 'The \'Q\' key on an American layout.' + description = 'The \'Q\' key on an American layout.', }, { name = 'r', - description = 'The \'R\' key on an American layout.' + description = 'The \'R\' key on an American layout.', }, { name = 's', - description = 'The \'S\' key on an American layout.' + description = 'The \'S\' key on an American layout.', }, { name = 't', - description = 'The \'T\' key on an American layout.' + description = 'The \'T\' key on an American layout.', }, { name = 'u', - description = 'The \'U\' key on an American layout.' + description = 'The \'U\' key on an American layout.', }, { name = 'v', - description = 'The \'V\' key on an American layout.' + description = 'The \'V\' key on an American layout.', }, { name = 'w', - description = 'The \'W\' key on an American layout.' + description = 'The \'W\' key on an American layout.', }, { name = 'x', - description = 'The \'X\' key on an American layout.' + description = 'The \'X\' key on an American layout.', }, { name = 'y', - description = 'The \'Y\' key on an American layout.' + description = 'The \'Y\' key on an American layout.', }, { name = 'z', - description = 'The \'Z\' key on an American layout.' + description = 'The \'Z\' key on an American layout.', }, { name = '1', - description = 'The \'1\' key on an American layout.' + description = 'The \'1\' key on an American layout.', }, { name = '2', - description = 'The \'2\' key on an American layout.' + description = 'The \'2\' key on an American layout.', }, { name = '3', - description = 'The \'3\' key on an American layout.' + description = 'The \'3\' key on an American layout.', }, { name = '4', - description = 'The \'4\' key on an American layout.' + description = 'The \'4\' key on an American layout.', }, { name = '5', - description = 'The \'5\' key on an American layout.' + description = 'The \'5\' key on an American layout.', }, { name = '6', - description = 'The \'6\' key on an American layout.' + description = 'The \'6\' key on an American layout.', }, { name = '7', - description = 'The \'7\' key on an American layout.' + description = 'The \'7\' key on an American layout.', }, { name = '8', - description = 'The \'8\' key on an American layout.' + description = 'The \'8\' key on an American layout.', }, { name = '9', - description = 'The \'9\' key on an American layout.' + description = 'The \'9\' key on an American layout.', }, { name = '0', - description = 'The \'0\' key on an American layout.' + description = 'The \'0\' key on an American layout.', }, { name = 'return', - description = 'The \'return\' / \'enter\' key on an American layout.' + description = 'The \'return\' / \'enter\' key on an American layout.', }, { name = 'escape', - description = 'The \'escape\' key on an American layout.' + description = 'The \'escape\' key on an American layout.', }, { name = 'backspace', - description = 'The \'backspace\' key on an American layout.' + description = 'The \'backspace\' key on an American layout.', }, { name = 'tab', - description = 'The \'tab\' key on an American layout.' + description = 'The \'tab\' key on an American layout.', }, { name = 'space', - description = 'The spacebar on an American layout.' + description = 'The spacebar on an American layout.', }, { name = '-', - description = 'The minus key on an American layout.' + description = 'The minus key on an American layout.', }, { name = '=', - description = 'The equals key on an American layout.' + description = 'The equals key on an American layout.', }, { name = '[', - description = 'The left-bracket key on an American layout.' + description = 'The left-bracket key on an American layout.', }, { name = ']', - description = 'The right-bracket key on an American layout.' + description = 'The right-bracket key on an American layout.', }, { name = '\\', - description = 'The backslash key on an American layout.' + description = 'The backslash key on an American layout.', }, { name = 'nonus#', - description = 'The non-U.S. hash scancode.' + description = 'The non-U.S. hash scancode.', }, { name = ';', - description = 'The semicolon key on an American layout.' + description = 'The semicolon key on an American layout.', }, { name = '\'', - description = 'The apostrophe key on an American layout.' + description = 'The apostrophe key on an American layout.', }, { name = '`', - description = 'The back-tick / grave key on an American layout.' + description = 'The back-tick / grave key on an American layout.', }, { name = ',', - description = 'The comma key on an American layout.' + description = 'The comma key on an American layout.', }, { name = '.', - description = 'The period key on an American layout.' + description = 'The period key on an American layout.', }, { name = '/', - description = 'The forward-slash key on an American layout.' + description = 'The forward-slash key on an American layout.', }, { name = 'capslock', - description = 'The capslock key on an American layout.' + description = 'The capslock key on an American layout.', }, { name = 'f1', - description = 'The F1 key on an American layout.' + description = 'The F1 key on an American layout.', }, { name = 'f2', - description = 'The F2 key on an American layout.' + description = 'The F2 key on an American layout.', }, { name = 'f3', - description = 'The F3 key on an American layout.' + description = 'The F3 key on an American layout.', }, { name = 'f4', - description = 'The F4 key on an American layout.' + description = 'The F4 key on an American layout.', }, { name = 'f5', - description = 'The F5 key on an American layout.' + description = 'The F5 key on an American layout.', }, { name = 'f6', - description = 'The F6 key on an American layout.' + description = 'The F6 key on an American layout.', }, { name = 'f7', - description = 'The F7 key on an American layout.' + description = 'The F7 key on an American layout.', }, { name = 'f8', - description = 'The F8 key on an American layout.' + description = 'The F8 key on an American layout.', }, { name = 'f9', - description = 'The F9 key on an American layout.' + description = 'The F9 key on an American layout.', }, { name = 'f10', - description = 'The F10 key on an American layout.' + description = 'The F10 key on an American layout.', }, { name = 'f11', - description = 'The F11 key on an American layout.' + description = 'The F11 key on an American layout.', }, { name = 'f12', - description = 'The F12 key on an American layout.' + description = 'The F12 key on an American layout.', }, { name = 'f13', - description = 'The F13 key on an American layout.' + description = 'The F13 key on an American layout.', }, { name = 'f14', - description = 'The F14 key on an American layout.' + description = 'The F14 key on an American layout.', }, { name = 'f15', - description = 'The F15 key on an American layout.' + description = 'The F15 key on an American layout.', }, { name = 'f16', - description = 'The F16 key on an American layout.' + description = 'The F16 key on an American layout.', }, { name = 'f17', - description = 'The F17 key on an American layout.' + description = 'The F17 key on an American layout.', }, { name = 'f18', - description = 'The F18 key on an American layout.' + description = 'The F18 key on an American layout.', }, { name = 'f19', - description = 'The F19 key on an American layout.' + description = 'The F19 key on an American layout.', }, { name = 'f20', - description = 'The F20 key on an American layout.' + description = 'The F20 key on an American layout.', }, { name = 'f21', - description = 'The F21 key on an American layout.' + description = 'The F21 key on an American layout.', }, { name = 'f22', - description = 'The F22 key on an American layout.' + description = 'The F22 key on an American layout.', }, { name = 'f23', - description = 'The F23 key on an American layout.' + description = 'The F23 key on an American layout.', }, { name = 'f24', - description = 'The F24 key on an American layout.' + description = 'The F24 key on an American layout.', }, { name = 'lctrl', - description = 'The left control key on an American layout.' + description = 'The left control key on an American layout.', }, { name = 'lshift', - description = 'The left shift key on an American layout.' + description = 'The left shift key on an American layout.', }, { name = 'lalt', - description = 'The left alt / option key on an American layout.' + description = 'The left alt / option key on an American layout.', }, { name = 'lgui', - description = 'The left GUI (command / windows / super) key on an American layout.' + description = 'The left GUI (command / windows / super) key on an American layout.', }, { name = 'rctrl', - description = 'The right control key on an American layout.' + description = 'The right control key on an American layout.', }, { name = 'rshift', - description = 'The right shift key on an American layout.' + description = 'The right shift key on an American layout.', }, { name = 'ralt', - description = 'The right alt / option key on an American layout.' + description = 'The right alt / option key on an American layout.', }, { name = 'rgui', - description = 'The right GUI (command / windows / super) key on an American layout.' + description = 'The right GUI (command / windows / super) key on an American layout.', }, { name = 'printscreen', - description = 'The printscreen key on an American layout.' + description = 'The printscreen key on an American layout.', }, { name = 'scrolllock', - description = 'The scroll-lock key on an American layout.' + description = 'The scroll-lock key on an American layout.', }, { name = 'pause', - description = 'The pause key on an American layout.' + description = 'The pause key on an American layout.', }, { name = 'insert', - description = 'The insert key on an American layout.' + description = 'The insert key on an American layout.', }, { name = 'home', - description = 'The home key on an American layout.' + description = 'The home key on an American layout.', }, { name = 'numlock', - description = 'The numlock / clear key on an American layout.' + description = 'The numlock / clear key on an American layout.', }, { name = 'pageup', - description = 'The page-up key on an American layout.' + description = 'The page-up key on an American layout.', }, { name = 'delete', - description = 'The forward-delete key on an American layout.' + description = 'The forward-delete key on an American layout.', }, { name = 'end', - description = 'The end key on an American layout.' + description = 'The end key on an American layout.', }, { name = 'pagedown', - description = 'The page-down key on an American layout.' + description = 'The page-down key on an American layout.', }, { name = 'right', - description = 'The right-arrow key on an American layout.' + description = 'The right-arrow key on an American layout.', }, { name = 'left', - description = 'The left-arrow key on an American layout.' + description = 'The left-arrow key on an American layout.', }, { name = 'down', - description = 'The down-arrow key on an American layout.' + description = 'The down-arrow key on an American layout.', }, { name = 'up', - description = 'The up-arrow key on an American layout.' + description = 'The up-arrow key on an American layout.', }, { name = 'nonusbackslash', - description = 'The non-U.S. backslash scancode.' + description = 'The non-U.S. backslash scancode.', }, { name = 'application', - description = 'The application key on an American layout. Windows contextual menu, compose key.' + description = 'The application key on an American layout. Windows contextual menu, compose key.', }, { name = 'execute', - description = 'The \'execute\' key on an American layout.' + description = 'The \'execute\' key on an American layout.', }, { name = 'help', - description = 'The \'help\' key on an American layout.' + description = 'The \'help\' key on an American layout.', }, { name = 'menu', - description = 'The \'menu\' key on an American layout.' + description = 'The \'menu\' key on an American layout.', }, { name = 'select', - description = 'The \'select\' key on an American layout.' + description = 'The \'select\' key on an American layout.', }, { name = 'stop', - description = 'The \'stop\' key on an American layout.' + description = 'The \'stop\' key on an American layout.', }, { name = 'again', - description = 'The \'again\' key on an American layout.' + description = 'The \'again\' key on an American layout.', }, { name = 'undo', - description = 'The \'undo\' key on an American layout.' + description = 'The \'undo\' key on an American layout.', }, { name = 'cut', - description = 'The \'cut\' key on an American layout.' + description = 'The \'cut\' key on an American layout.', }, { name = 'copy', - description = 'The \'copy\' key on an American layout.' + description = 'The \'copy\' key on an American layout.', }, { name = 'paste', - description = 'The \'paste\' key on an American layout.' + description = 'The \'paste\' key on an American layout.', }, { name = 'find', - description = 'The \'find\' key on an American layout.' + description = 'The \'find\' key on an American layout.', }, { name = 'kp/', - description = 'The keypad forward-slash key on an American layout.' + description = 'The keypad forward-slash key on an American layout.', }, { name = 'kp*', - description = 'The keypad \'*\' key on an American layout.' + description = 'The keypad \'*\' key on an American layout.', }, { name = 'kp-', - description = 'The keypad minus key on an American layout.' + description = 'The keypad minus key on an American layout.', }, { name = 'kp+', - description = 'The keypad plus key on an American layout.' + description = 'The keypad plus key on an American layout.', }, { name = 'kp=', - description = 'The keypad equals key on an American layout.' + description = 'The keypad equals key on an American layout.', }, { name = 'kpenter', - description = 'The keypad enter key on an American layout.' + description = 'The keypad enter key on an American layout.', }, { name = 'kp1', - description = 'The keypad \'1\' key on an American layout.' + description = 'The keypad \'1\' key on an American layout.', }, { name = 'kp2', - description = 'The keypad \'2\' key on an American layout.' + description = 'The keypad \'2\' key on an American layout.', }, { name = 'kp3', - description = 'The keypad \'3\' key on an American layout.' + description = 'The keypad \'3\' key on an American layout.', }, { name = 'kp4', - description = 'The keypad \'4\' key on an American layout.' + description = 'The keypad \'4\' key on an American layout.', }, { name = 'kp5', - description = 'The keypad \'5\' key on an American layout.' + description = 'The keypad \'5\' key on an American layout.', }, { name = 'kp6', - description = 'The keypad \'6\' key on an American layout.' + description = 'The keypad \'6\' key on an American layout.', }, { name = 'kp7', - description = 'The keypad \'7\' key on an American layout.' + description = 'The keypad \'7\' key on an American layout.', }, { name = 'kp8', - description = 'The keypad \'8\' key on an American layout.' + description = 'The keypad \'8\' key on an American layout.', }, { name = 'kp9', - description = 'The keypad \'9\' key on an American layout.' + description = 'The keypad \'9\' key on an American layout.', }, { name = 'kp0', - description = 'The keypad \'0\' key on an American layout.' + description = 'The keypad \'0\' key on an American layout.', }, { name = 'kp.', - description = 'The keypad period key on an American layout.' + description = 'The keypad period key on an American layout.', }, { name = 'international1', - description = 'The 1st international key on an American layout. Used on Asian keyboards.' + description = 'The 1st international key on an American layout. Used on Asian keyboards.', }, { name = 'international2', - description = 'The 2nd international key on an American layout.' + description = 'The 2nd international key on an American layout.', }, { name = 'international3', - description = 'The 3rd international key on an American layout. Yen.' + description = 'The 3rd international key on an American layout. Yen.', }, { name = 'international4', - description = 'The 4th international key on an American layout.' + description = 'The 4th international key on an American layout.', }, { name = 'international5', - description = 'The 5th international key on an American layout.' + description = 'The 5th international key on an American layout.', }, { name = 'international6', - description = 'The 6th international key on an American layout.' + description = 'The 6th international key on an American layout.', }, { name = 'international7', - description = 'The 7th international key on an American layout.' + description = 'The 7th international key on an American layout.', }, { name = 'international8', - description = 'The 8th international key on an American layout.' + description = 'The 8th international key on an American layout.', }, { name = 'international9', - description = 'The 9th international key on an American layout.' + description = 'The 9th international key on an American layout.', }, { name = 'lang1', - description = 'Hangul/English toggle scancode.' + description = 'Hangul/English toggle scancode.', }, { name = 'lang2', - description = 'Hanja conversion scancode.' + description = 'Hanja conversion scancode.', }, { name = 'lang3', - description = 'Katakana scancode.' + description = 'Katakana scancode.', }, { name = 'lang4', - description = 'Hiragana scancode.' + description = 'Hiragana scancode.', }, { name = 'lang5', - description = 'Zenkaku/Hankaku scancode.' + description = 'Zenkaku/Hankaku scancode.', }, { name = 'mute', - description = 'The mute key on an American layout.' + description = 'The mute key on an American layout.', }, { name = 'volumeup', - description = 'The volume up key on an American layout.' + description = 'The volume up key on an American layout.', }, { name = 'volumedown', - description = 'The volume down key on an American layout.' + description = 'The volume down key on an American layout.', }, { name = 'audionext', - description = 'The audio next track key on an American layout.' + description = 'The audio next track key on an American layout.', }, { name = 'audioprev', - description = 'The audio previous track key on an American layout.' + description = 'The audio previous track key on an American layout.', }, { name = 'audiostop', - description = 'The audio stop key on an American layout.' + description = 'The audio stop key on an American layout.', }, { name = 'audioplay', - description = 'The audio play key on an American layout.' + description = 'The audio play key on an American layout.', }, { name = 'audiomute', - description = 'The audio mute key on an American layout.' + description = 'The audio mute key on an American layout.', }, { name = 'mediaselect', - description = 'The media select key on an American layout.' + description = 'The media select key on an American layout.', }, { name = 'www', - description = 'The \'WWW\' key on an American layout.' + description = 'The \'WWW\' key on an American layout.', }, { name = 'mail', - description = 'The Mail key on an American layout.' + description = 'The Mail key on an American layout.', }, { name = 'calculator', - description = 'The calculator key on an American layout.' + description = 'The calculator key on an American layout.', }, { name = 'computer', - description = 'The \'computer\' key on an American layout.' + description = 'The \'computer\' key on an American layout.', }, { name = 'acsearch', - description = 'The AC Search key on an American layout.' + description = 'The AC Search key on an American layout.', }, { name = 'achome', - description = 'The AC Home key on an American layout.' + description = 'The AC Home key on an American layout.', }, { name = 'acback', - description = 'The AC Back key on an American layout.' + description = 'The AC Back key on an American layout.', }, { name = 'acforward', - description = 'The AC Forward key on an American layout.' + description = 'The AC Forward key on an American layout.', }, { name = 'acstop', - description = 'Th AC Stop key on an American layout.' + description = 'Th AC Stop key on an American layout.', }, { name = 'acrefresh', - description = 'The AC Refresh key on an American layout.' + description = 'The AC Refresh key on an American layout.', }, { name = 'acbookmarks', - description = 'The AC Bookmarks key on an American layout.' + description = 'The AC Bookmarks key on an American layout.', }, { name = 'power', - description = 'The system power scancode.' + description = 'The system power scancode.', }, { name = 'brightnessdown', - description = 'The brightness-down scancode.' + description = 'The brightness-down scancode.', }, { name = 'brightnessup', - description = 'The brightness-up scancode.' + description = 'The brightness-up scancode.', }, { name = 'displayswitch', - description = 'The display switch scancode.' + description = 'The display switch scancode.', }, { name = 'kbdillumtoggle', - description = 'The keyboard illumination toggle scancode.' + description = 'The keyboard illumination toggle scancode.', }, { name = 'kbdillumdown', - description = 'The keyboard illumination down scancode.' + description = 'The keyboard illumination down scancode.', }, { name = 'kbdillumup', - description = 'The keyboard illumination up scancode.' + description = 'The keyboard illumination up scancode.', }, { name = 'eject', - description = 'The eject scancode.' + description = 'The eject scancode.', }, { name = 'sleep', - description = 'The system sleep scancode.' + description = 'The system sleep scancode.', }, { name = 'alterase', - description = 'The alt-erase key on an American layout.' + description = 'The alt-erase key on an American layout.', }, { name = 'sysreq', - description = 'The sysreq key on an American layout.' + description = 'The sysreq key on an American layout.', }, { name = 'cancel', - description = 'The \'cancel\' key on an American layout.' + description = 'The \'cancel\' key on an American layout.', }, { name = 'clear', - description = 'The \'clear\' key on an American layout.' + description = 'The \'clear\' key on an American layout.', }, { name = 'prior', - description = 'The \'prior\' key on an American layout.' + description = 'The \'prior\' key on an American layout.', }, { name = 'return2', - description = 'The \'return2\' key on an American layout.' + description = 'The \'return2\' key on an American layout.', }, { name = 'separator', - description = 'The \'separator\' key on an American layout.' + description = 'The \'separator\' key on an American layout.', }, { name = 'out', - description = 'The \'out\' key on an American layout.' + description = 'The \'out\' key on an American layout.', }, { name = 'oper', - description = 'The \'oper\' key on an American layout.' + description = 'The \'oper\' key on an American layout.', }, { name = 'clearagain', - description = 'The \'clearagain\' key on an American layout.' + description = 'The \'clearagain\' key on an American layout.', }, { name = 'crsel', - description = 'The \'crsel\' key on an American layout.' + description = 'The \'crsel\' key on an American layout.', }, { name = 'exsel', - description = 'The \'exsel\' key on an American layout.' + description = 'The \'exsel\' key on an American layout.', }, { name = 'kp00', - description = 'The keypad 00 key on an American layout.' + description = 'The keypad 00 key on an American layout.', }, { name = 'kp000', - description = 'The keypad 000 key on an American layout.' + description = 'The keypad 000 key on an American layout.', }, { name = 'thsousandsseparator', - description = 'The thousands-separator key on an American layout.' + description = 'The thousands-separator key on an American layout.', }, { name = 'decimalseparator', - description = 'The decimal separator key on an American layout.' + description = 'The decimal separator key on an American layout.', }, { name = 'currencyunit', - description = 'The currency unit key on an American layout.' + description = 'The currency unit key on an American layout.', }, { name = 'currencysubunit', - description = 'The currency sub-unit key on an American layout.' + description = 'The currency sub-unit key on an American layout.', }, { name = 'app1', - description = 'The \'app1\' scancode.' + description = 'The \'app1\' scancode.', }, { name = 'app2', - description = 'The \'app2\' scancode.' + description = 'The \'app2\' scancode.', }, { name = 'unknown', - description = 'An unknown key.' - } - } -} + description = 'An unknown key.', + }, + }, +} \ No newline at end of file diff --git a/modules/math/Math.lua b/modules/math/Math.lua index a24b4cd1..38791a77 100644 --- a/modules/math/Math.lua +++ b/modules/math/Math.lua @@ -1,4 +1,3 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { @@ -8,7 +7,7 @@ return { require(path .. 'types.BezierCurve'), require(path .. 'types.CompressedData'), require(path .. 'types.RandomGenerator'), - require(path .. 'types.Transform') + require(path .. 'types.Transform'), }, functions = { { @@ -20,58 +19,58 @@ return { { type = 'string', name = 'rawstring', - description = 'The raw (un-compressed) string to compress.' + description = 'The raw (un-compressed) string to compress.', }, { type = 'CompressedDataFormat', name = 'format', - default = '"lz4"', - description = 'The format to use when compressing the string.' + description = 'The format to use when compressing the string.', + default = '\'lz4\'', }, { type = 'number', name = 'level', + description = '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.', default = '-1', - description = '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.' - } + }, }, returns = { { type = 'CompressedData', name = 'compressedData', - description = 'A new Data object containing the compressed version of the string.' - } - } + description = 'A new Data object containing the compressed version of the string.', + }, + }, }, { arguments = { { type = 'Data', name = 'data', - description = 'A Data object containing the raw (un-compressed) data to compress.' + description = 'A Data object containing the raw (un-compressed) data to compress.', }, { type = 'CompressedDataFormat', name = 'format', - default = '"lz4"', - description = 'The format to use when compressing the data.' + description = 'The format to use when compressing the data.', + default = '\'lz4\'', }, { type = 'number', name = 'level', + description = '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.', default = '-1', - description = '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.' - } + }, }, returns = { { type = 'CompressedData', name = 'compressedData', - description = 'A new Data object containing the compressed version of the raw data.' - } - } - } - } + description = 'A new Data object containing the compressed version of the raw data.', + }, + }, + }, + }, }, { name = 'decompress', @@ -82,331 +81,329 @@ return { { type = 'CompressedData', name = 'compressedData', - description = 'The compressed data to decompress.' - } + description = 'The compressed data to decompress.', + }, }, returns = { { type = 'string', name = 'rawstring', - description = 'A string containing the raw decompressed data.' - } - } + description = 'A string containing the raw decompressed data.', + }, + }, }, { arguments = { { type = 'string', - name = 'compressedString', - description = 'A string containing data previously compressed with love.math.compress.' + name = 'compressedstring', + description = 'A string containing data previously compressed with love.math.compress.', }, { type = 'CompressedDataFormat', name = 'format', - description = 'The format that was used to compress the given string.' - } + description = 'The format that was used to compress the given string.', + }, }, returns = { { type = 'string', name = 'rawstring', - description = 'A string containing the raw decompressed data.' - } - } + description = 'A string containing the raw decompressed data.', + }, + }, }, { arguments = { { type = 'Data', name = 'data', - description = 'A Data object containing data previously compressed with love.math.compress.' + description = 'A Data object containing data previously compressed with love.math.compress.', }, { type = 'CompressedDataFormat', name = 'format', - description = 'The format that was used to compress the given data.' - } + description = 'The format that was used to compress the given data.', + }, }, returns = { { type = 'string', name = 'rawstring', - description = 'A string containing the raw decompressed data.' - } - } - } - } + description = 'A string containing the raw decompressed data.', + }, + }, + }, + }, }, { name = 'gammaToLinear', - description = '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.', + description = '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.\n\nRead more about gamma-correct rendering here, here, and here.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { + description = 'An alpha value can be passed into the function as a fourth argument, but it will be returned unchanged because alpha is always linear.', arguments = { { type = 'number', name = 'r', - description = 'The red channel of the sRGB color to convert.' + description = 'The red channel of the sRGB color to convert.', }, { type = 'number', name = 'g', - description = 'The green channel of the sRGB color to convert.' + description = 'The green channel of the sRGB color to convert.', }, { type = 'number', name = 'b', - description = 'The blue channel of the sRGB color to convert.' - } + description = 'The blue channel of the sRGB color to convert.', + }, }, returns = { { type = 'number', name = 'lr', - description = 'The red channel of the converted color in linear RGB space.' + description = 'The red channel of the converted color in linear RGB space.', }, { type = 'number', name = 'lg', - description = 'The green channel of the converted color in linear RGB space.' + description = 'The green channel of the converted color in linear RGB space.', }, { type = 'number', name = 'lb', - description = 'The blue channel of the converted color in linear RGB space.' - } - } + description = 'The blue channel of the converted color in linear RGB space.', + }, + }, }, { arguments = { { type = 'table', name = 'color', - description = 'An array with the red, green, and blue channels of the sRGB color to convert.' - } + description = 'An array with the red, green, and blue channels of the sRGB color to convert.', + }, }, returns = { { type = 'number', name = 'lr', - description = 'The red channel of the converted color in linear RGB space.' + description = 'The red channel of the converted color in linear RGB space.', }, { type = 'number', name = 'lg', - description = 'The green channel of the converted color in linear RGB space.' + description = 'The green channel of the converted color in linear RGB space.', }, { type = 'number', name = 'lb', - description = 'The blue channel of the converted color in linear RGB space.' - } - } + description = 'The blue channel of the converted color in linear RGB space.', + }, + }, }, { arguments = { { type = 'number', name = 'c', - description = 'The value of a color channel in sRGB space to convert.' - } + description = 'The value of a color channel in sRGB space to convert.', + }, }, returns = { { type = 'number', name = 'lc', - description = 'The value of the color channel in linear RGB space.' - } - } - } - } + description = 'The value of the color channel in linear RGB space.', + }, + }, + }, + }, }, { name = 'getRandomSeed', - description = 'Gets the seed of the random number generator.\n\nThe state 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.', + description = 'Gets the seed of the random number generator.\n\nThe 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.', variants = { { returns = { { type = 'number', name = 'low', - description = 'Integer number representing the lower 32 bits of the random number generator\'s 64 bit state value.' + description = 'Integer number representing the lower 32 bits of the random number generator\'s 64 bit seed value.', }, { type = 'number', name = 'high', - description = 'Integer number representing the higher 32 bits of the random number generator\'s 64 bit state value.' - } - } - } - } + description = 'Integer number representing the higher 32 bits of the random number generator\'s 64 bit seed value.', + }, + }, + }, + }, }, { name = 'getRandomState', - description = 'Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with RandomGenerator:setState.\n\nThis is different from RandomGenerator:getSeed in that getState gets the RandomGenerator\'s current state, whereas getSeed gets the previously set seed number.\n\nThe value of the state string does not depend on the current operating system.', + description = '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.\n\nThis 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.', variants = { { + description = 'The value of the state string does not depend on the current operating system.', returns = { { type = 'string', name = 'state', - description = 'The current state of the RandomGenerator object, represented as a string.' - } - } - } - } + description = 'The current state of the random number generator, represented as a string.', + }, + }, + }, + }, }, { name = 'isConvex', - description = 'Checks whether a polygon is convex.\n\nPolygonShapes in love.physics, some forms of Mesh, and polygons drawn with love.graphics.polygon must be simple convex polygons.', + description = 'Checks whether a polygon is convex.\n\nPolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons.', variants = { { arguments = { { type = 'table', name = 'vertices', - description = 'The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.' - } + description = 'The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.', + }, }, returns = { { type = 'boolean', name = 'convex', - description = 'Whether the given polygon is convex.' - } - } + description = 'Whether the given polygon is convex.', + }, + }, }, { arguments = { { type = 'number', name = 'x1', - description = 'The position of the first vertex of the polygon on the x-axis.' + description = 'The position of the first vertex of the polygon on the x-axis.', }, { type = 'number', name = 'y1', - description = 'The position of the first vertex of the polygon on the y-axis.' + description = 'The position of the first vertex of the polygon on the y-axis.', }, { type = 'number', name = 'x2', - description = 'The position of the second vertex of the polygon on the x-axis.' + description = 'The position of the second vertex of the polygon on the x-axis.', }, { type = 'number', name = 'y2', - description = 'The position of the second vertex of the polygon on the y-axis.' + description = 'The position of the second vertex of the polygon on the y-axis.', }, { type = 'number', name = 'x3', - description = 'The position of the third vertex of the polygon on the x-axis.' + description = 'The position of the third vertex of the polygon on the x-axis.', }, { type = 'number', name = 'y3', - description = 'The position of the third vertex of the polygon on the y-axis.' + description = 'The position of the third vertex of the polygon on the y-axis.', }, - { - type = 'number', - name = '...', - description = 'Additional vertices.' - } }, returns = { { type = 'boolean', name = 'convex', - description = 'Whether the given polygon is convex.' - } - } - } - } + description = 'Whether the given polygon is convex.', + }, + }, + }, + }, }, { name = 'linearToGamma', - description = '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.\n\nIn 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.', + description = '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.\n\nIn 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.\n\nRead more about gamma-correct rendering here, here, and here.\n\nIn versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.', variants = { { + description = 'An alpha value can be passed into the function as a fourth argument, but it will be returned unchanged because alpha is always linear.', arguments = { { type = 'number', name = 'lr', - description = 'The red channel of the linear RGB color to convert.' + description = 'The red channel of the linear RGB color to convert.', }, { type = 'number', name = 'lg', - description = 'The green channel of the linear RGB color to convert.' + description = 'The green channel of the linear RGB color to convert.', }, { type = 'number', name = 'lb', - description = 'The blue channel of the linear RGB color to convert.' - } + description = 'The blue channel of the linear RGB color to convert.', + }, }, returns = { { type = 'number', name = 'cr', - description = 'The red channel of the converted color in gamma sRGB space.' + description = 'The red channel of the converted color in gamma sRGB space.', }, { type = 'number', name = 'cg', - description = 'The green channel of the converted color in gamma sRGB space.' + description = 'The green channel of the converted color in gamma sRGB space.', }, { type = 'number', name = 'cb', - description = 'The blue channel of the converted color in gamma sRGB space.' - } - } + description = 'The blue channel of the converted color in gamma sRGB space.', + }, + }, }, { arguments = { { type = 'table', name = 'color', - description = 'An array with the red, green, and blue channels of the linear RGB color to convert.' - } + description = 'An array with the red, green, and blue channels of the linear RGB color to convert.', + }, }, returns = { { type = 'number', name = 'cr', - description = 'The red channel of the converted color in gamma sRGB space.' + description = 'The red channel of the converted color in gamma sRGB space.', }, { type = 'number', name = 'cg', - description = 'The green channel of the converted color in gamma sRGB space.' + description = 'The green channel of the converted color in gamma sRGB space.', }, { type = 'number', name = 'cb', - description = 'The blue channel of the converted color in gamma sRGB space.' - } - } + description = 'The blue channel of the converted color in gamma sRGB space.', + }, + }, }, { arguments = { { type = 'number', name = 'lc', - description = 'The value of a color channel in linear RGB space to convert.' - } + description = 'The value of a color channel in linear RGB space to convert.', + }, }, returns = { { type = 'number', name = 'c', - description = 'The value of the color channel in gamma sRGB space.' - } - } - } - } + description = 'The value of the color channel in gamma sRGB space.', + }, + }, + }, + }, }, { name = 'newBezierCurve', @@ -417,64 +414,59 @@ return { { type = 'table', name = 'vertices', - description = 'The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.' - } + description = 'The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.', + }, }, returns = { { type = 'BezierCurve', name = 'curve', - description = 'A Bézier curve object.' - } - } + description = 'A Bézier curve object.', + }, + }, }, { arguments = { { type = 'number', name = 'x1', - description = 'The position of the first vertex of the control polygon on the x-axis.' + description = 'The position of the first vertex of the control polygon on the x-axis.', }, { type = 'number', name = 'y1', - description = 'The position of the first vertex of the control polygon on the y-axis.' + description = 'The position of the first vertex of the control polygon on the y-axis.', }, { type = 'number', name = 'x2', - description = 'The position of the second vertex of the control polygon on the x-axis.' + description = 'The position of the second vertex of the control polygon on the x-axis.', }, { type = 'number', name = 'y2', - description = 'The position of the second vertex of the control polygon on the y-axis.' + description = 'The position of the second vertex of the control polygon on the y-axis.', }, { type = 'number', name = 'x3', - description = 'The position of the third vertex of the control polygon on the x-axis.' + description = 'The position of the third vertex of the control polygon on the x-axis.', }, { type = 'number', name = 'y3', - description = 'The position of the third vertex of the control polygon on the y-axis.' + description = 'The position of the third vertex of the control polygon on the y-axis.', }, - { - type = 'number', - name = '...', - description = 'Additional vertices.' - } }, returns = { { type = 'BezierCurve', name = 'curve', - description = 'A Bézier curve object.' - } - } - } - } + description = 'A Bézier curve object.', + }, + }, + }, + }, }, { name = 'newRandomGenerator', @@ -485,48 +477,50 @@ return { { type = 'RandomGenerator', name = 'rng', - description = 'The new Random Number Generator object.' - } - } + description = 'The new Random Number Generator object.', + }, + }, }, { + description = 'See RandomGenerator:setSeed.', arguments = { { type = 'number', name = 'seed', - description = 'The initial seed number to use for this object.' - } + description = 'The initial seed number to use for this object.', + }, }, returns = { { type = 'RandomGenerator', name = 'rng', - description = 'The new Random Number Generator object.' - } - } + description = 'The new Random Number Generator object.', + }, + }, }, { + description = 'See RandomGenerator:setSeed.', arguments = { { type = 'number', name = 'low', - description = 'The lower 32 bits of the state number to use for this instance of the object.' + description = 'The lower 32 bits of the seed number to use for this object.', }, { type = 'number', name = 'high', - description = 'The higher 32 bits of the state number to use for this instance of the object.' - } + description = 'The higher 32 bits of the seed number to use for this object.', + }, }, returns = { { type = 'RandomGenerator', name = 'rng', - description = 'The new Random Number Generator object.' - } - } - } - } + description = 'The new Random Number Generator object.', + }, + }, + }, + }, }, { name = 'newTransform', @@ -538,9 +532,9 @@ return { { type = 'Transform', name = 'transform', - description = 'The new Transform object.' - } - } + description = 'The new Transform object.', + }, + }, }, { description = 'Creates a Transform with the specified transformation applied on creation.', @@ -548,65 +542,65 @@ return { { type = 'number', name = 'x', - description = 'The position of the new Transform on the x-axis.' + description = 'The position of the new Transform on the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the new Transform on the y-axis.' + description = 'The position of the new Transform on the y-axis.', }, { type = 'number', name = 'angle', + description = 'The orientation of the new Transform in radians.', default = '0', - description = 'The orientation of the new Transform in radians.' }, { type = 'number', name = 'sx', + description = 'Scale factor on the x-axis.', default = '1', - description = 'Scale factor on the x-axis.' }, { type = 'number', name = 'sy', + description = 'Scale factor on the y-axis.', default = 'sx', - description = 'Scale factor on the y-axis.' }, { type = 'number', name = 'ox', + description = 'Origin offset on the x-axis.', default = '0', - description = 'Origin offset on the x-axis.' }, { type = 'number', name = 'oy', + description = 'Origin offset on the y-axis.', default = '0', - description = 'Origin offset on the y-axis.' }, { type = 'number', name = 'kx', + description = 'Shearing / skew factor on the x-axis.', default = '0', - description = 'Shearing / skew factor on the x-axis.' }, { type = 'number', name = 'ky', + description = 'Shearing / skew factor on the y-axis.', default = '0', - description = 'Shearing / skew factor on the y-axis.' - } + }, }, returns = { { type = 'Transform', name = 'transform', - description = 'The new Transform object.' - } - } - } - } + description = 'The new Transform object.', + }, + }, + }, + }, }, { name = 'noise', @@ -618,16 +612,16 @@ return { { type = 'number', name = 'x', - description = 'The number used to generate the noise value.' - } + description = 'The number used to generate the noise value.', + }, }, returns = { { type = 'number', name = 'value', - description = 'The noise value in the range of [0, 1].' - } - } + description = 'The noise value in the range of 1.', + }, + }, }, { description = 'Generates Simplex noise from 2 dimensions.', @@ -635,21 +629,21 @@ return { { type = 'number', name = 'x', - description = 'The first value of the 2-dimensional vector used to generate the noise value.' + description = 'The first value of the 2-dimensional vector used to generate the noise value.', }, { type = 'number', name = 'y', - description = 'The second value of the 2-dimensional vector used to generate the noise value.' - } + description = 'The second value of the 2-dimensional vector used to generate the noise value.', + }, }, returns = { { type = 'number', name = 'value', - description = 'The noise value in the range of [0, 1].' - } - } + description = 'The noise value in the range of 1.', + }, + }, }, { description = 'Generates Perlin noise (Simplex noise in version 0.9.2 and older) from 3 dimensions.', @@ -657,26 +651,26 @@ return { { type = 'number', name = 'x', - description = 'The first value of the 3-dimensional vector used to generate the noise value.' + description = 'The first value of the 3-dimensional vector used to generate the noise value.', }, { type = 'number', name = 'y', - description = 'The second value of the 3-dimensional vector used to generate the noise value.' + description = 'The second value of the 3-dimensional vector used to generate the noise value.', }, { type = 'number', name = 'z', - description = 'The third value of the 3-dimensional vector used to generate the noise value.' - } + description = 'The third value of the 3-dimensional vector used to generate the noise value.', + }, }, returns = { { type = 'number', name = 'value', - description = 'The noise value in the range of [0, 1].' - } - } + description = 'The noise value in the range of 1.', + }, + }, }, { description = 'Generates Perlin noise (Simplex noise in version 0.9.2 and older) from 4 dimensions.', @@ -684,88 +678,88 @@ return { { type = 'number', name = 'x', - description = 'The first value of the 4-dimensional vector used to generate the noise value.' + description = 'The first value of the 4-dimensional vector used to generate the noise value.', }, { type = 'number', name = 'y', - description = 'The second value of the 4-dimensional vector used to generate the noise value.' + description = 'The second value of the 4-dimensional vector used to generate the noise value.', }, { type = 'number', name = 'z', - description = 'The third value of the 4-dimensional vector used to generate the noise value.' + description = 'The third value of the 4-dimensional vector used to generate the noise value.', }, { type = 'number', name = 'w', - description = 'The fourth value of the 4-dimensional vector used to generate the noise value.' - } + description = 'The fourth value of the 4-dimensional vector used to generate the noise value.', + }, }, returns = { { type = 'number', name = 'value', - description = 'The noise value in the range of [0, 1].' - } - } - } - } + description = 'The noise value in the range of 1.', + }, + }, + }, + }, }, { name = 'random', - description = 'Generates a pseudo-random number in a platform independent manner.', + description = '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.', variants = { { - description = 'Get uniformly distributed pseudo-random real number within [0, 1].', + description = 'Get uniformly distributed pseudo-random real number within 1.', returns = { { type = 'number', name = 'number', - description = 'The pseudo-random number.' - } - } + description = 'The pseudo-random number.', + }, + }, }, { - description = 'Get a uniformly distributed pseudo-random integer within [1, max].', + description = 'Get a uniformly distributed pseudo-random integer within max.', arguments = { { type = 'number', name = 'max', - description = 'The maximum possible value it should return.' - } + description = 'The maximum possible value it should return.', + }, }, returns = { { type = 'number', name = 'number', - description = 'The pseudo-random integer number.' - } - } + description = 'The pseudo-random integer number.', + }, + }, }, { - description = 'Get uniformly distributed pseudo-random integer within [min, max].', + description = 'Get uniformly distributed pseudo-random integer within max.', arguments = { { type = 'number', name = 'min', - description = 'The minimum possible value it should return.' + description = 'The minimum possible value it should return.', }, { type = 'number', name = 'max', - description = 'The maximum possible value it should return.' - } + description = 'The maximum possible value it should return.', + }, }, returns = { { type = 'number', name = 'number', - description = 'The pseudo-random integer number.' - } - } - } - } + description = 'The pseudo-random integer number.', + }, + }, + }, + }, }, { name = 'randomNormal', @@ -776,141 +770,138 @@ return { { type = 'number', name = 'stddev', + description = 'Standard deviation of the distribution.', default = '1', - description = 'Standard deviation of the distribution.' }, { type = 'number', name = 'mean', + description = 'The mean of the distribution.', default = '0', - description = 'The mean of the distribution.' - } + }, }, returns = { { type = 'number', name = 'number', - description = 'Normally distributed random number with variance (stddev)² and the specified mean.' - } - } - } - } + description = 'Normally distributed random number with variance (stddev)² and the specified mean.', + }, + }, + }, + }, }, { name = 'setRandomSeed', - description = 'Sets the seed of the random number generator using the specified integer number.', + description = '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.', variants = { { + description = 'Due to Lua\'s use of double-precision floating point numbers, integer values above 2^53 cannot be accurately represented. Use the other variant of the function if you want to use a larger number.', arguments = { { type = 'number', name = 'seed', - description = 'The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53].' - } - } + description = 'The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1.', + }, + }, }, { + description = 'Combines two 32-bit integer numbers into a 64-bit integer value and sets the seed of the random number generator using the value.', arguments = { { type = 'number', name = 'low', - description = 'The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1].' + description = 'The lower 32 bits of the seed value. Must be within the range of 2^32 - 1.', }, { type = 'number', name = 'high', - description = 'The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1].' - } - } - } - } + description = 'The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.', + }, + }, + }, + }, }, { name = 'setRandomState', - description = 'Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with RandomGenerator:setState.\n\nThis is different from RandomGenerator:getSeed in that getState gets the RandomGenerator\'s current state, whereas getSeed gets the previously set seed number.\n\nThe value of the state string does not depend on the current operating system.', + description = '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.\n\nThis 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.', variants = { { + description = 'The effect of the state string does not depend on the current operating system.', arguments = { { type = 'string', name = 'state', - description = 'The current state of the RandomGenerator object, represented as a string.' - } - } - } - } + description = 'The new state of the random number generator, represented as a string. This should originate from a previous call to love.math.getRandomState.', + }, + }, + }, + }, }, { name = 'triangulate', - description = 'Triangulate a simple polygon.', + description = 'Decomposes a simple convex or concave polygon into triangles.', variants = { { arguments = { { type = 'table', name = 'polygon', - description = 'Polygon to triangulate. Must not intersect itself.' - } + description = 'Polygon to triangulate. Must not intersect itself.', + }, }, returns = { { type = 'table', name = 'triangles', - description = 'List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.' - } - } + description = 'List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.', + }, + }, }, { arguments = { { type = 'number', name = 'x1', - description = 'The position of the first vertex of the polygon on the x-axis.' + description = 'The position of the first vertex of the polygon on the x-axis.', }, { type = 'number', name = 'y1', - description = 'The position of the first vertex of the polygon on the y-axis.' + description = 'The position of the first vertex of the polygon on the y-axis.', }, { type = 'number', name = 'x2', - description = 'The position of the second vertex of the polygon on the x-axis.' + description = 'The position of the second vertex of the polygon on the x-axis.', }, { type = 'number', name = 'y2', - description = 'The position of the second vertex of the polygon on the y-axis.' + description = 'The position of the second vertex of the polygon on the y-axis.', }, { type = 'number', name = 'x3', - description = 'The position of the third vertex of the polygon on the x-axis.' + description = 'The position of the third vertex of the polygon on the x-axis.', }, { type = 'number', name = 'y3', - description = 'The position of the third vertex of the polygon on the y-axis.' + description = 'The position of the third vertex of the polygon on the y-axis.', }, - { - type = 'number', - name = '...', - description = 'Additional vertices.' - } }, returns = { { type = 'table', name = 'triangles', - description = 'List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.' - } - } - } - } - } + description = 'List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.', + }, + }, + }, + }, + }, }, enums = { require(path .. 'enums.CompressedDataFormat'), - require(path .. 'enums.MatrixLayout') - } -} + }, +} \ No newline at end of file diff --git a/modules/math/enums/CompressedDataFormat.lua b/modules/math/enums/CompressedDataFormat.lua index b399fa15..0b73d219 100644 --- a/modules/math/enums/CompressedDataFormat.lua +++ b/modules/math/enums/CompressedDataFormat.lua @@ -4,15 +4,19 @@ return { constants = { { name = 'lz4', - description = '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.' + description = '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.', }, { name = 'zlib', - description = '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.' + description = '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.', }, { name = 'gzip', - description = '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.' - } - } -} + description = '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.', + }, + { + name = 'deflate', + description = 'Raw DEFLATE-compressed data (no header).', + }, + }, +} \ No newline at end of file diff --git a/modules/math/types/BezierCurve.lua b/modules/math/types/BezierCurve.lua index 3a125036..893163cc 100644 --- a/modules/math/types/BezierCurve.lua +++ b/modules/math/types/BezierCurve.lua @@ -1,8 +1,10 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'BezierCurve', - description = 'A Bézier curve object that can evaluate and render Bézier curves of arbitrary degree.', - constructors = { - 'newBezierCurve' + description = 'A Bézier curve object that can evaluate and render Bézier curves of arbitrary degree.\n\nFor more information on Bézier curves check this great article on Wikipedia.', + supertypes = { + 'Object', }, functions = { { @@ -14,23 +16,23 @@ return { { type = 'number', name = 't', - description = 'Where to evaluate the curve.' - } + description = 'Where to evaluate the curve.', + }, }, returns = { { type = 'number', name = 'x', - description = 'x coordinate of the curve at parameter t.' + description = 'x coordinate of the curve at parameter t.', }, { type = 'number', name = 'y', - description = 'y coordinate of the curve at parameter t.' - } - } - } - } + description = 'y coordinate of the curve at parameter t.', + }, + }, + }, + }, }, { name = 'getControlPoint', @@ -41,23 +43,23 @@ return { { type = 'number', name = 'i', - description = 'Index of the control point.' - } + description = 'Index of the control point.', + }, }, returns = { { type = 'number', name = 'x', - description = 'Position of the control point along the x axis.' + description = 'Position of the control point along the x axis.', }, { type = 'number', name = 'y', - description = 'Position of the control point along the y axis.' - } - } - } - } + description = 'Position of the control point along the y axis.', + }, + }, + }, + }, }, { name = 'getControlPointCount', @@ -68,11 +70,11 @@ return { { type = 'number', name = 'count', - description = 'The number of control points.' - } - } - } - } + description = 'The number of control points.', + }, + }, + }, + }, }, { name = 'getDegree', @@ -83,11 +85,11 @@ return { { type = 'number', name = 'degree', - description = 'Degree of the Bézier curve.' - } - } - } - } + description = 'Degree of the Bézier curve.', + }, + }, + }, + }, }, { name = 'getDerivative', @@ -98,11 +100,11 @@ return { { type = 'BezierCurve', name = 'derivative', - description = 'The derivative curve.' - } - } - } - } + description = 'The derivative curve.', + }, + }, + }, + }, }, { name = 'getSegment', @@ -113,23 +115,23 @@ return { { type = 'number', name = 'startpoint', - description = 'The starting point along the curve. Must be between 0 and 1.' + description = 'The starting point along the curve. Must be between 0 and 1.', }, { type = 'number', name = 'endpoint', - description = 'The end of the segment. Must be between 0 and 1.' - } + description = 'The end of the segment. Must be between 0 and 1.', + }, }, returns = { { type = 'BezierCurve', name = 'curve', - description = 'A BezierCurve that corresponds to the specified segment.' - } - } - } - } + description = 'A BezierCurve that corresponds to the specified segment.', + }, + }, + }, + }, }, { name = 'insertControlPoint', @@ -140,22 +142,22 @@ return { { type = 'number', name = 'x', - description = 'Position of the control point along the x axis.' + description = 'Position of the control point along the x axis.', }, { type = 'number', name = 'y', - description = 'Position of the control point along the y axis.' + description = 'Position of the control point along the y axis.', }, { type = 'number', name = 'i', + description = 'Index of the control point.', default = '-1', - description = 'Index of the control point.' - } - } - } - } + }, + }, + }, + }, }, { name = 'removeControlPoint', @@ -166,11 +168,11 @@ return { { type = 'number', name = 'index', - description = 'The index of the control point to remove.' - } - } - } - } + description = 'The index of the control point to remove.', + }, + }, + }, + }, }, { name = 'render', @@ -181,19 +183,19 @@ return { { type = 'number', name = 'depth', + description = 'Number of recursive subdivision steps.', default = '5', - description = 'Number of recursive subdivision steps.' - } + }, }, returns = { { type = 'table', name = 'coordinates', - description = 'List of x,y-coordinate pairs of points on the curve.' - } - } - } - } + description = 'List of x,y-coordinate pairs of points on the curve.', + }, + }, + }, + }, }, { name = 'renderSegment', @@ -204,29 +206,29 @@ return { { type = 'number', name = 'startpoint', - description = 'The starting point along the curve. Must be between 0 and 1.' + description = 'The starting point along the curve. Must be between 0 and 1.', }, { type = 'number', name = 'endpoint', - description = 'The end of the segment to render. Must be between 0 and 1.' + description = 'The end of the segment to render. Must be between 0 and 1.', }, { type = 'number', name = 'depth', + description = 'Number of recursive subdivision steps.', default = '5', - description = 'Number of recursive subdivision steps.' - } + }, }, returns = { { type = 'table', name = 'coordinates', - description = 'List of x,y-coordinate pairs of points on the curve.' - } - } - } - } + description = 'List of x,y-coordinate pairs of points on the specified part of the curve.', + }, + }, + }, + }, }, { name = 'rotate', @@ -237,23 +239,23 @@ return { { type = 'number', name = 'angle', - description = 'Rotation angle in radians.' + description = 'Rotation angle in radians.', }, { type = 'number', name = 'ox', + description = 'X coordinate of the rotation center.', default = '0', - description = 'X coordinate of the rotation center.' }, { type = 'number', name = 'oy', + description = 'Y coordinate of the rotation center.', default = '0', - description = 'Y coordinate of the rotation center.' - } - } - } - } + }, + }, + }, + }, }, { name = 'scale', @@ -264,23 +266,23 @@ return { { type = 'number', name = 's', - description = 'Scale factor.' + description = 'Scale factor.', }, { type = 'number', name = 'ox', + description = 'X coordinate of the scaling center.', default = '0', - description = 'X coordinate of the scaling center.' }, { type = 'number', name = 'oy', + description = 'Y coordinate of the scaling center.', default = '0', - description = 'Y coordinate of the scaling center.' - } - } - } - } + }, + }, + }, + }, }, { name = 'setControlPoint', @@ -291,21 +293,21 @@ return { { type = 'number', name = 'i', - description = 'Index of the control point.' + description = 'Index of the control point.', }, { type = 'number', - name = 'ox', - description = 'Position of the control point along the x axis.' + name = 'x', + description = 'Position of the control point along the x axis.', }, { type = 'number', - name = 'oy', - description = 'Position of the control point along the y axis.' - } - } - } - } + name = 'y', + description = 'Position of the control point along the y axis.', + }, + }, + }, + }, }, { name = 'translate', @@ -316,20 +318,16 @@ return { { type = 'number', name = 'dx', - description = 'Offset along the x axis.' + description = 'Offset along the x axis.', }, { type = 'number', name = 'dy', - description = 'Offset along the y axis.' - } - } - } - } - } + description = 'Offset along the y axis.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/math/types/CompressedData.lua b/modules/math/types/CompressedData.lua index b7423f56..b7d90b03 100644 --- a/modules/math/types/CompressedData.lua +++ b/modules/math/types/CompressedData.lua @@ -1,8 +1,11 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'CompressedData', - description = 'Represents byte data compressed using a specific algorithm.\n\nlove.math.decompress can be used to de-compress the data.', - constructors = { - 'compress' + description = 'Represents byte data compressed using a specific algorithm.\n\nlove.data.decompress can be used to de-compress the data (or love.math.decompress in 0.10.2 or earlier).', + supertypes = { + 'Data', + 'Object', }, functions = { { @@ -14,16 +17,11 @@ return { { type = 'CompressedDataFormat', name = 'format', - description = 'The format of the CompressedData.' - } - } - } - } - } + description = 'The format of the CompressedData.', + }, + }, + }, + }, + }, }, - parenttype = 'Data', - supertypes = { - 'Data', - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/math/types/RandomGenerator.lua b/modules/math/types/RandomGenerator.lua index 38384d69..8cc03503 100644 --- a/modules/math/types/RandomGenerator.lua +++ b/modules/math/types/RandomGenerator.lua @@ -1,99 +1,102 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'RandomGenerator', description = 'A random number generation object which has its own random state.', - constructors = { - 'newRandomGenerator' + supertypes = { + 'Object', }, functions = { { name = 'getSeed', - description = 'Gets the state of the random number generator.\n\nThe state 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.', + description = 'Gets the seed of the random number generator object.\n\nThe 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.', variants = { { returns = { { type = 'number', name = 'low', - description = 'Integer number representing the lower 32 bits of the random number generator\'s 64 bit state value.' + description = 'Integer number representing the lower 32 bits of the RandomGenerator\'s 64 bit seed value.', }, { type = 'number', name = 'high', - description = 'Integer number representing the higher 32 bits of the random number generator\'s 64 bit state value.' - } - } - } - } + description = 'Integer number representing the higher 32 bits of the RandomGenerator\'s 64 bit seed value.', + }, + }, + }, + }, }, { name = 'getState', - description = 'Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with RandomGenerator:setState.\n\nThis is different from RandomGenerator:getSeed in that getState gets the RandomGenerator\'s current state, whereas getSeed gets the previously set seed number.\n\nThe value of the state string does not depend on the current operating system.', + description = '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.\n\nThis is different from RandomGenerator:getSeed in that getState gets the RandomGenerator\'s current state, whereas getSeed gets the previously set seed number.', variants = { { + description = 'The value of the state string does not depend on the current operating system.', returns = { { type = 'string', name = 'state', - description = 'The current state of the RandomGenerator object, represented as a string.' - } - } - } - } + description = 'The current state of the RandomGenerator object, represented as a string.', + }, + }, + }, + }, }, { name = 'random', description = 'Generates a pseudo-random number in a platform independent manner.', variants = { { - description = 'Get uniformly distributed pseudo-random number within [0, 1].', + description = 'Get uniformly distributed pseudo-random number within 1.', returns = { { type = 'number', name = 'number', - description = 'The pseudo random number.' - } - } + description = 'The pseudo-random number.', + }, + }, }, { - description = 'Get uniformly distributed pseudo-random integer number within [1, max].', + description = 'Get uniformly distributed pseudo-random integer number within max.', arguments = { { type = 'number', name = 'max', - description = 'The maximum possible value it should return.' - } + description = 'The maximum possible value it should return.', + }, }, returns = { { type = 'number', name = 'number', - description = 'The pseudo-random integer number.' - } - } + description = 'The pseudo-random integer number.', + }, + }, }, { - description = 'Get uniformly distributed pseudo-random integer number within [min, max].', + description = 'Get uniformly distributed pseudo-random integer number within max.', arguments = { { type = 'number', name = 'min', - description = 'The minimum possible value it should return.' + description = 'The minimum possible value it should return.', }, { type = 'number', name = 'max', - description = 'The maximum possible value it should return.' - } + description = 'The maximum possible value it should return.', + }, }, returns = { { type = 'number', name = 'number', - description = 'The pseudo-random integer number.' - } - } - } - } + description = 'The pseudo-random integer number.', + }, + }, + }, + }, }, { name = 'randomNormal', @@ -104,74 +107,72 @@ return { { type = 'number', name = 'stddev', + description = 'Standard deviation of the distribution.', default = '1', - description = 'Standard deviation of the distribution.' }, { type = 'number', name = 'mean', + description = 'The mean of the distribution.', default = '0', - description = 'The mean of the distribution.' - } + }, }, returns = { { type = 'number', name = 'number', - description = 'Normally distributed random number with variance (stddev)² and the specified mean.' - } - } - } - } + description = 'Normally distributed random number with variance (stddev)² and the specified mean.', + }, + }, + }, + }, }, { name = 'setSeed', description = 'Sets the seed of the random number generator using the specified integer number.', variants = { { + description = 'Due to Lua\'s use of double-precision floating point numbers, values above 2^53 cannot be accurately represented. Use the other variant of this function if your seed will have a larger value.', arguments = { { type = 'number', name = 'seed', - description = 'The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53].' - } - } + description = 'The integer number with which you want to seed the randomization. Must be within the range of 2^53.', + }, + }, }, { + description = 'Combines two 32-bit integer numbers into a 64-bit integer value and sets the seed of the random number generator using the value.', arguments = { { type = 'number', name = 'low', - description = 'The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1].' + description = 'The lower 32 bits of the seed value. Must be within the range of 2^32 - 1.', }, { type = 'number', name = 'high', - default = '0'; - description = 'The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1].' - } - } - } - } + description = 'The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.', + }, + }, + }, + }, }, { name = 'setState', - description = '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 RandomGenerator:getState.\n\nThis 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.\n\nThe effect of the state string does not depend on the current operating system.', + description = '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.\n\nThis 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.', variants = { { + description = 'The effect of the state string does not depend on the current operating system.', arguments = { { type = 'string', name = 'state', - description = 'The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState.' - } - } - } - } - } + description = 'The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file diff --git a/modules/math/types/Transform.lua b/modules/math/types/Transform.lua index 4f178727..1086d702 100644 --- a/modules/math/types/Transform.lua +++ b/modules/math/types/Transform.lua @@ -1,462 +1,475 @@ +local path = (...):match('(.-)[^%./]+$') + return { - name = 'Transform', - description = 'Object containing a coordinate system transformation.\n\nThe love.graphics module has several functions and function variants which accept Transform objects.', - constructors = { - 'newTransform' - }, - functions = { - { - name = 'apply', - description = 'Applies the given other Transform object to this one.', - variants = { - { - arguments = { - { - type = 'Transform', - name = 'other', - description = 'The other Transform object to apply to this Transform.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'clone', - description = 'Creates a new copy of this Transform.', - variants = { - { - returns = { - { - type = 'Transform', - name = 'clone', - description = 'The copy of this Transform.' - } - } - } - } - }, - { - name = 'getMatrix', - description = 'Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order.', - variants = { - { - returns = { - { - type = 'number', - name = 'e1_1', - description = 'The first column of the first row of the matrix.' - }, - { - type = 'number', - name = 'e1_2', - description = 'The second column of the first row of the matrix.' - }, - { - type = 'number', - name = '...', - description = 'Additional matrix elements.' - }, - { - type = 'number', - name = 'e4_4', - description = 'The fourth column of the fourth row of the matrix.' - } - } - } - } - }, - { - name = 'inverse', - description = 'Creates a new Transform containing the inverse of this Transform.', - variants = { - { - returns = { - { - type = 'Transform', - name = 'inverse', - description = 'A new Transform object representing the inverse of this Transform\'s matrix.' - } - } - } - } - }, - { - name = 'inverseTransformPoint', - description = 'Applies the reverse of the Transform object\'s transformation to the given 2D position.\n\nThis effectively converts the given position from the local coordinate space of the Transform into global coordinates.\n\nOne 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.', - variants = { - { - arguments = { - { - type = 'number', - name = 'localX', - description = 'The x component of the position with the transform applied.' - }, - { - type = 'number', - name = 'localY', - description = 'The y component of the position with the transform applied.' - } - }, - returns = { - { - type = 'number', - name = 'globalX', - description = 'The x component of the position in global coordinates.' - }, - { - type = 'number', - name = 'globalY', - description = 'The y component of the position in global coordinates.' - } - } - } - } - }, - { - name = 'reset', - description = 'Resets the Transform to an identity state. All previously applied transformations are erased.', - variants = { - { - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'rotate', - description = 'Applies a rotation to the Transform\'s coordinate system. This method does not reset any previously applied transformations.', - variants = { - { - arguments = { - { - type = 'number', - name = 'angle', - description = 'The relative angle in radians to rotate this Transform by.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'scale', - description = 'Scales the Transform\'s coordinate system. This method does not reset any previously applied transformations.', - variants = { - { - arguments = { - { - type = 'number', - name = 'sx', - description = 'The relative scale factor along the x-axis.' - }, - { - type = 'number', - name = 'sy', - description = 'The relative scale factor along the y-axis.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'setMatrix', - description = 'Directly sets the Transform\'s internal 4x4 transformation matrix.', - variants = { - { - arguments = { - { - type = 'number', - name = 'e1_1', - description = 'The first column of the first row of the matrix.' - }, - { - type = 'number', - name = 'e1_2', - description = 'The second column of the first row of the matrix.' - }, - { - type = 'number', - name = '...', - description = 'Additional matrix elements.' - }, - { - type = 'number', - name = 'e4_4', - description = 'The fourth column of the fourth row of the matrix.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - }, - { - arguments = { - { - type = 'MatrixLayout', - name = 'layout', - description = 'How to interpret the matrix element arguments (row-major or column-major).' - }, - { - type = 'number', - name = 'e1_1', - description = 'The first column of the first row of the matrix.' - }, - { - type = 'number', - name = 'e1_2', - description = 'The second column of the first row of the matrix.' - }, - { - type = 'number', - name = '...', - description = 'Additional matrix elements.' - }, - { - type = 'number', - name = 'e4_4', - description = 'The fourth column of the fourth row of the matrix.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - }, - { - arguments = { - { - type = 'MatrixLayout', - name = 'layout', - description = 'How to interpret the matrix element arguments (row-major or column-major).' - }, - { - type = 'table', - name = 'matrix', - description = 'A flat table containing the 16 matrix elements.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - }, - { - arguments = { - { - type = 'MatrixLayout', - name = 'layout', - description = 'How to interpret the matrix element arguments (row-major or column-major).' - }, - { - type = 'table', - name = 'matrix', - description = 'A table of 4 tables, with each sub-table containing 4 matrix elements.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'setTransformation', - description = 'Resets the Transform to the specified transformation parameters.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The position of the Transform on the x-axis.' - }, - { - type = 'number', - name = 'y', - description = 'The position of the Transform on the y-axis.' - }, - { - type = 'number', - name = 'angle', - default = '0', - description = 'The orientation of the Transform in radians.' - }, - { - type = 'number', - name = 'sx', - default = '1', - description = 'Scale factor on the x-axis.' - }, - { - type = 'number', - name = 'sy', - default = 'sx', - description = 'Scale factor on the y-axis.' - }, - { - type = 'number', - name = 'ox', - default = '0', - description = 'Origin offset on the x-axis.' - }, - { - type = 'number', - name = 'oy', - default = '0', - description = 'Origin offset on the y-axis.' - }, - { - type = 'number', - name = 'kx', - default = '0', - description = 'Shearing / skew factor on the x-axis.' - }, - { - type = 'number', - name = 'ky', - default = '0', - description = 'Shearing / skew factor on the y-axis.' - }, - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'shear', - description = 'Applies a shear factor (skew) to the Transform\'s coordinate system. This method does not reset any previously applied transformations.', - variants = { - { - arguments = { - { - type = 'number', - name = 'kx', - description = 'The shear factor along the x-axis.' - }, - { - type = 'number', - name = 'ky', - description = 'The shear factor along the y-axis.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - }, - { - name = 'transformPoint', - description = 'Applies the Transform object\'s transformation to the given 2D position.\n\nThis effectively converts the given position from global coordinates into the local coordinate space of the Transform.', - variants = { - { - arguments = { - { - type = 'number', - name = 'globalX', - description = 'The x component of the position in global coordinates.' - }, - { - type = 'number', - name = 'globalY', - description = 'The y component of the position in global coordinates.' - } - }, - returns = { - { - type = 'number', - name = 'localX', - description = 'The x component of the position with the transform applied.' - }, - { - type = 'number', - name = 'localY', - description = 'The y component of the position with the transform applied.' - } - } - } - } - }, - { - name = 'translate', - description = 'Applies a translation to the Transform\'s coordinate system. This method does not reset any previously applied transformations.', - variants = { - { - arguments = { - { - type = 'number', - name = 'dx', - description = 'The relative translation along the x-axis.' - }, - { - type = 'number', - name = 'dy', - description = 'The relative translation along the y-axis.' - } - }, - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The Transform object the method was called on. Allows easily chaining Transform methods.' - } - } - } - } - } - }, - parenttype = 'Object', + name = 'Transform', + description = 'Object containing a coordinate system transformation.\n\nThe love.graphics module has several functions and function variants which accept Transform objects.', supertypes = { - 'Object' - }, - notes = 'Transform objects have a custom * (multiplication) operator. result = tA * tB is equivalent to result = tA:clone():apply(tB). It maps to the matrix multiplication operation that Transform:apply performs.\n\nThe * operator creates a new Transform object, so it is not recommended to use it heavily in per-frame code.' + 'Object', + }, + functions = { + { + name = 'apply', + description = 'Applies the given other Transform object to this one.\n\nThis effectively multiplies this Transform\'s internal transformation matrix with the other Transform\'s (i.e. self * other), and stores the result in this object.', + variants = { + { + arguments = { + { + type = 'Transform', + name = 'other', + description = 'The other Transform object to apply to this Transform.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'clone', + description = 'Creates a new copy of this Transform.', + variants = { + { + returns = { + { + type = 'Transform', + name = 'clone', + description = 'The copy of this Transform.', + }, + }, + }, + }, + }, + { + name = 'getMatrix', + description = 'Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order.', + variants = { + { + returns = { + { + type = 'number', + name = 'e1_1', + description = 'The first column of the first row of the matrix.', + }, + { + type = 'number', + name = 'e1_2', + description = 'The second column of the first row of the matrix.', + }, + { + type = 'number', + name = '...', + description = 'Additional matrix elements.', + }, + { + type = 'number', + name = 'e4_4', + description = 'The fourth column of the fourth row of the matrix.', + }, + }, + }, + }, + }, + { + name = 'inverse', + description = 'Creates a new Transform containing the inverse of this Transform.', + variants = { + { + returns = { + { + type = 'Transform', + name = 'inverse', + description = 'A new Transform object representing the inverse of this Transform\'s matrix.', + }, + }, + }, + }, + }, + { + name = 'inverseTransformPoint', + description = 'Applies the reverse of the Transform object\'s transformation to the given 2D position.\n\nThis effectively converts the given position from the local coordinate space of the Transform into global coordinates.\n\nOne 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.', + variants = { + { + arguments = { + { + type = 'number', + name = 'localX', + description = 'The x component of the position with the transform applied.', + }, + { + type = 'number', + name = 'localY', + description = 'The y component of the position with the transform applied.', + }, + }, + returns = { + { + type = 'number', + name = 'globalX', + description = 'The x component of the position in global coordinates.', + }, + { + type = 'number', + name = 'globalY', + description = 'The y component of the position in global coordinates.', + }, + }, + }, + }, + }, + { + name = 'isAffine', + description = 'Checks whether the Transform is an affine transformation.', + variants = { + { + returns = { + { + type = 'boolean', + name = 'affine', + description = 'true if the transform object is an affine transformation, false otherwise.', + }, + }, + }, + }, + }, + { + name = 'reset', + description = 'Resets the Transform to an identity state. All previously applied transformations are erased.', + variants = { + { + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'rotate', + description = 'Applies a rotation to the Transform\'s coordinate system. This method does not reset any previously applied transformations.', + variants = { + { + arguments = { + { + type = 'number', + name = 'angle', + description = 'The relative angle in radians to rotate this Transform by.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'scale', + description = 'Scales the Transform\'s coordinate system. This method does not reset any previously applied transformations.', + variants = { + { + arguments = { + { + type = 'number', + name = 'sx', + description = 'The relative scale factor along the x-axis.', + }, + { + type = 'number', + name = 'sy', + description = 'The relative scale factor along the y-axis.', + default = 'sx', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'setMatrix', + description = 'Directly sets the Transform\'s internal 4x4 transformation matrix.', + variants = { + { + arguments = { + { + type = 'number', + name = 'e1_1', + description = 'The first column of the first row of the matrix.', + }, + { + type = 'number', + name = 'e1_2', + description = 'The second column of the first row of the matrix.', + }, + { + type = 'number', + name = '...', + description = 'Additional matrix elements.', + }, + { + type = 'number', + name = 'e4_4', + description = 'The fourth column of the fourth row of the matrix.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + { + arguments = { + { + type = 'MatrixLayout', + name = 'layout', + description = 'How to interpret the matrix element arguments (row-major or column-major).', + }, + { + type = 'number', + name = 'e1_1', + description = 'The first column of the first row of the matrix.', + }, + { + type = 'number', + name = 'e1_2', + description = 'The second column of the first row or the first column of the second row of the matrix, depending on the specified layout.', + }, + { + type = 'number', + name = '...', + description = 'Additional matrix elements.', + }, + { + type = 'number', + name = 'e4_4', + description = 'The fourth column of the fourth row of the matrix.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + { + arguments = { + { + type = 'MatrixLayout', + name = 'layout', + description = 'How to interpret the matrix element arguments (row-major or column-major).', + }, + { + type = 'table', + name = 'matrix', + description = 'A flat table containing the 16 matrix elements.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + { + arguments = { + { + type = 'MatrixLayout', + name = 'layout', + description = 'How to interpret the matrix element arguments (row-major or column-major).', + }, + { + type = 'table', + name = 'matrix', + description = 'A table of 4 tables, with each sub-table containing 4 matrix elements.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'setTransformation', + description = 'Resets the Transform to the specified transformation parameters.', + variants = { + { + arguments = { + { + type = 'number', + name = 'x', + description = 'The position of the Transform on the x-axis.', + }, + { + type = 'number', + name = 'y', + description = 'The position of the Transform on the y-axis.', + }, + { + type = 'number', + name = 'angle', + description = 'The orientation of the Transform in radians.', + default = '0', + }, + { + type = 'number', + name = 'sx', + description = 'Scale factor on the x-axis.', + default = '1', + }, + { + type = 'number', + name = 'sy', + description = 'Scale factor on the y-axis.', + default = 'sx', + }, + { + type = 'number', + name = 'ox', + description = 'Origin offset on the x-axis.', + default = '0', + }, + { + type = 'number', + name = 'oy', + description = 'Origin offset on the y-axis.', + default = '0', + }, + { + type = 'number', + name = 'kx', + description = 'Shearing / skew factor on the x-axis.', + default = '0', + }, + { + type = 'number', + name = 'ky', + description = 'Shearing / skew factor on the y-axis.', + default = '0', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'shear', + description = 'Applies a shear factor (skew) to the Transform\'s coordinate system. This method does not reset any previously applied transformations.', + variants = { + { + arguments = { + { + type = 'number', + name = 'kx', + description = 'The shear factor along the x-axis.', + }, + { + type = 'number', + name = 'ky', + description = 'The shear factor along the y-axis.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + { + name = 'transformPoint', + description = 'Applies the Transform object\'s transformation to the given 2D position.\n\nThis effectively converts the given position from global coordinates into the local coordinate space of the Transform.', + variants = { + { + arguments = { + { + type = 'number', + name = 'globalX', + description = 'The x component of the position in global coordinates.', + }, + { + type = 'number', + name = 'globalY', + description = 'The y component of the position in global coordinates.', + }, + }, + returns = { + { + type = 'number', + name = 'localX', + description = 'The x component of the position with the transform applied.', + }, + { + type = 'number', + name = 'localY', + description = 'The y component of the position with the transform applied.', + }, + }, + }, + }, + }, + { + name = 'translate', + description = 'Applies a translation to the Transform\'s coordinate system. This method does not reset any previously applied transformations.', + variants = { + { + arguments = { + { + type = 'number', + name = 'dx', + description = 'The relative translation along the x-axis.', + }, + { + type = 'number', + name = 'dy', + description = 'The relative translation along the y-axis.', + }, + }, + returns = { + { + type = 'Transform', + name = 'transform', + description = 'The Transform object the method was called on. Allows easily chaining Transform methods.', + }, + }, + }, + }, + }, + }, } \ No newline at end of file diff --git a/modules/mouse/Mouse.lua b/modules/mouse/Mouse.lua index 1674fe8d..0d2fb7c2 100644 --- a/modules/mouse/Mouse.lua +++ b/modules/mouse/Mouse.lua @@ -1,11 +1,10 @@ --- Match the parent directory local path = (...):match('(.-)[^%./]+$') return { name = 'mouse', description = 'Provides an interface to the user\'s mouse.', types = { - require(path .. 'types.Cursor') + require(path .. 'types.Cursor'), }, functions = { { @@ -17,11 +16,11 @@ return { { type = 'Cursor', name = 'cursor', - description = 'The current cursor, or nil if no cursor is set.' - } - } - } - } + description = 'The current cursor, or nil if no cursor is set.', + }, + }, + }, + }, }, { name = 'getPosition', @@ -32,16 +31,16 @@ return { { type = 'number', name = 'x', - description = 'The position of the mouse along the x-axis.' + description = 'The position of the mouse along the x-axis.', }, { type = 'number', name = 'y', - description = 'The position of the mouse along the y-axis.' - } - } - } - } + description = 'The position of the mouse along the y-axis.', + }, + }, + }, + }, }, { name = 'getRelativeMode', @@ -52,63 +51,64 @@ return { { type = 'boolean', name = 'enabled', - description = 'True if relative mode is enabled, false if it\'s disabled.' - } - } - } - } + description = 'True if relative mode is enabled, false if it\'s disabled.', + }, + }, + }, + }, }, { name = 'getSystemCursor', - description = 'Gets a Cursor object representing a system-native hardware cursor.\n\n 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.', + description = 'Gets a Cursor object representing a system-native hardware cursor.\n\nHardware 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.', variants = { { + description = 'The \'image\' CursorType is not a valid argument. Use love.mouse.newCursor to create a hardware cursor using a custom image.', arguments = { { type = 'CursorType', name = 'ctype', - description = 'The type of system cursor to get.' + description = 'The type of system cursor to get. ', }, }, returns = { { type = 'Cursor', name = 'cursor', - description = 'The Cursor object representing the system cursor type.' - } - } - } - } + description = 'The Cursor object representing the system cursor type.', + }, + }, + }, + }, }, { name = 'getX', - description = 'Returns the current x position of the mouse.', + description = 'Returns the current x-position of the mouse.', variants = { { returns = { { type = 'number', name = 'x', - description = 'The position of the mouse along the x-axis.' - } - } - } - } + description = 'The position of the mouse along the x-axis.', + }, + }, + }, + }, }, { name = 'getY', - description = 'Returns the current y position of the mouse.', + description = 'Returns the current y-position of the mouse.', variants = { { returns = { { type = 'number', name = 'y', - description = 'The position of the mouse along the y-axis.' - } - } - } - } + description = 'The position of the mouse along the y-axis.', + }, + }, + }, + }, }, { name = 'hasCursor', @@ -119,11 +119,11 @@ return { { type = 'boolean', name = 'hascursor', - description = 'Whether the system has cursor functionality.' - } - } - } - } + description = 'Whether the system has cursor functionality.', + }, + }, + }, + }, }, { name = 'isCursorSupported', @@ -134,39 +134,55 @@ return { { type = 'boolean', name = 'supported', - description = 'Whether the system has cursor functionality.' - } - } - } - } + description = 'Whether the system has cursor functionality.', + }, + }, + }, + }, }, { name = 'isDown', - description = 'Checks whether a certain mouse button is down. This function does not detect mousewheel scrolling; you must use the love.wheelmoved (or love.mousepressed in version 0.9.2 and older) callback for that.', - variants = { - { - arguments = { - { - type = 'number', - name = 'button', - description = 'The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button, etc.' - }, - { - type = 'number', - name = '...', - description = 'Additional button numbers to check.' - } - }, - returns = { - { - type = 'boolean', - name = 'down', - description = 'True if the specified button is down.' - } - } - } - } + description = 'Checks whether a certain mouse button is down.\n\nThis 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. ', + variants = { + { + arguments = { + { + type = 'number', + name = 'button', + description = '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.', + }, + { + type = 'number', + name = '...', + description = 'Additional button numbers to check.', + }, + }, + returns = { + { + type = 'boolean', + name = 'down', + description = 'True if any specified button is down.', + }, + }, + }, + { + arguments = { + { + type = 'MouseConstant', + name = 'buttonN', + description = 'A button to check.', + }, + }, + returns = { + { + type = 'boolean', + name = 'anyDown', + description = 'True if any specified button is down, false otherwise.', + }, + }, + }, }, + }, { name = 'isGrabbed', description = 'Checks if the mouse is grabbed.', @@ -176,11 +192,11 @@ return { { type = 'boolean', name = 'grabbed', - description = 'True if the cursor is grabbed, false if it is not.' - } - } - } - } + description = 'True if the cursor is grabbed, false if it is not.', + }, + }, + }, + }, }, { name = 'isVisible', @@ -191,11 +207,11 @@ return { { type = 'boolean', name = 'visible', - description = 'True if the cursor to visible, false if the cursor is hidden.' - } - } - } - } + description = 'True if the cursor to visible, false if the cursor is hidden.', + }, + }, + }, + }, }, { name = 'newCursor', @@ -206,102 +222,104 @@ return { { type = 'ImageData', name = 'imageData', - description = 'The ImageData to use for the the new Cursor.' + description = 'The ImageData to use for the new Cursor.', }, { type = 'number', name = 'hotx', + description = 'The x-coordinate in the ImageData of the cursor\'s hot spot.', default = '0', - description = 'The x-coordinate in the ImageData of the cursor\'s hot spot.' }, { type = 'number', name = 'hoty', + description = 'The y-coordinate in the ImageData of the cursor\'s hot spot.', default = '0', - description = 'The y-coordinate in the ImageData of the cursor\'s hot spot.' - } + }, }, returns = { { type = 'Cursor', name = 'cursor', - description = 'The new Cursor object.' - } - } + description = 'The new Cursor object.', + }, + }, }, { arguments = { { type = 'string', - name = 'filepath', - description = 'Path to the image to use for the new Cursor.' + name = 'filename', + description = 'Path to the image to use for the new Cursor.', }, { type = 'number', name = 'hotx', + description = 'The x-coordinate in the image of the cursor\'s hot spot.', default = '0', - description = 'The x-coordinate in the ImageData of the cursor\'s hot spot.' }, { type = 'number', name = 'hoty', + description = 'The y-coordinate in the image of the cursor\'s hot spot.', default = '0', - description = 'The y-coordinate in the ImageData of the cursor\'s hot spot.' - } + }, }, returns = { { type = 'Cursor', name = 'cursor', - description = 'The new Cursor object.' - } - } + description = 'The new Cursor object.', + }, + }, }, { arguments = { { type = 'FileData', name = 'fileData', - description = 'Data representing the image to use for the new Cursor.' + description = 'Data representing the image to use for the new Cursor.', }, { type = 'number', name = 'hotx', + description = 'The x-coordinate in the image of the cursor\'s hot spot.', default = '0', - description = 'The x-coordinate in the ImageData of the cursor\'s hot spot.' }, { type = 'number', name = 'hoty', + description = 'The y-coordinate in the image of the cursor\'s hot spot.', default = '0', - description = 'The y-coordinate in the ImageData of the cursor\'s hot spot.' - } + }, }, returns = { { type = 'Cursor', name = 'cursor', - description = 'The new Cursor object.' - } - } - } - } + description = 'The new Cursor object.', + }, + }, + }, + }, }, { name = 'setCursor', - description = 'Sets the current mouse cursor.\n\nResets the current mouse cursor to the default when called without arguments.', + description = 'Sets the current mouse cursor.', variants = { - {}, { arguments = { { type = 'Cursor', name = 'cursor', - description = 'The Cursor object to use as the current mouse cursor.' - } - } - } - } + description = 'The Cursor object to use as the current mouse cursor.', + }, + }, + }, + { + description = 'Resets the current mouse cursor to the default.', + }, + }, }, { name = 'setGrabbed', @@ -312,11 +330,11 @@ return { { type = 'boolean', name = 'grab', - description = 'True to confine the mouse, false to let it leave the window.' - } - } - } - } + description = 'True to confine the mouse, false to let it leave the window.', + }, + }, + }, + }, }, { name = 'setPosition', @@ -327,79 +345,79 @@ return { { type = 'number', name = 'x', - description = 'The new position of the mouse along the x-axis.' + description = 'The new position of the mouse along the x-axis.', }, { type = 'number', name = 'y', - description = 'The new position of the mouse along the y-axis.' - } - } - } - } + description = 'The new position of the mouse along the y-axis.', + }, + }, + }, + }, }, { name = 'setRelativeMode', - description = 'Sets whether relative mode is enabled for the mouse.\n\nWhen 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.\n\nThe reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated.', + description = 'Sets whether relative mode is enabled for the mouse.\n\nWhen 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.\n\nThe reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated.', variants = { { arguments = { { type = 'boolean', name = 'enable', - description = 'True to enable relative mode, false to disable it.' - } - } - } - } + description = 'True to enable relative mode, false to disable it.', + }, + }, + }, + }, }, { name = 'setVisible', - description = 'Sets the visibility of the cursor.', + description = 'Sets the current visibility of the cursor.', variants = { { arguments = { { type = 'boolean', name = 'visible', - description = 'True to set the cursor to visible, false to hide the cursor.' - } - } - } - } + description = 'True to set the cursor to visible, false to hide the cursor.', + }, + }, + }, + }, }, { name = 'setX', - description = 'Sets the current X position of the mouse. Non-integer values are floored.', + description = 'Sets the current X position of the mouse.\n\nNon-integer values are floored.', variants = { { arguments = { { type = 'number', name = 'x', - description = 'The new position of the mouse along the x-axis.' - } - } - } - } + description = 'The new position of the mouse along the x-axis.', + }, + }, + }, + }, }, { name = 'setY', - description = 'Sets the current Y position of the mouse. Non-integer values are floored.', + description = 'Sets the current Y position of the mouse.\n\nNon-integer values are floored.', variants = { { arguments = { { type = 'number', name = 'y', - description = 'The new position of the mouse along the y-axis.' - } - } - } - } - } + description = 'The new position of the mouse along the y-axis.', + }, + }, + }, + }, + }, }, enums = { - require(path .. 'enums.CursorType') - } -} + require(path .. 'enums.CursorType'), + }, +} \ No newline at end of file diff --git a/modules/mouse/enums/CursorType.lua b/modules/mouse/enums/CursorType.lua index af108a14..b5ede5d0 100644 --- a/modules/mouse/enums/CursorType.lua +++ b/modules/mouse/enums/CursorType.lua @@ -4,55 +4,55 @@ return { constants = { { name = 'image', - description = 'The cursor is using a custom image.' + description = 'The cursor is using a custom image.', }, { name = 'arrow', - description = 'An arrow pointer.' + description = 'An arrow pointer.', }, { name = 'ibeam', - description = 'An I-beam, normally used when mousing over editable or selectable text.' + description = 'An I-beam, normally used when mousing over editable or selectable text.', }, { name = 'wait', - description = 'Wait graphic.' + description = 'Wait graphic.', }, { name = 'waitarrow', - description = 'Small wait cursor with an arrow pointer.' + description = 'Small wait cursor with an arrow pointer.', }, { name = 'crosshair', - description = 'Crosshair symbol.' + description = 'Crosshair symbol.', }, { name = 'sizenwse', - description = 'Double arrow pointing to the top-left and bottom-right.' + description = 'Double arrow pointing to the top-left and bottom-right.', }, { name = 'sizenesw', - description = 'Double arrow pointing to the top-right and bottom-left.' + description = 'Double arrow pointing to the top-right and bottom-left.', }, { name = 'sizewe', - description = 'Double arrow pointing left and right.' + description = 'Double arrow pointing left and right.', }, { name = 'sizens', - description = 'Double arrow pointing up and down.' + description = 'Double arrow pointing up and down.', }, { name = 'sizeall', - description = 'Four-pointed arrow pointing up, down, left, and right.' + description = 'Four-pointed arrow pointing up, down, left, and right.', }, { name = 'no', - description = 'Slashed circle or crossbones.' + description = 'Slashed circle or crossbones.', }, { name = 'hand', - description = 'Hand symbol.' - } - } -} + description = 'Hand symbol.', + }, + }, +} \ No newline at end of file diff --git a/modules/mouse/types/Cursor.lua b/modules/mouse/types/Cursor.lua index 353ea230..ff43e678 100644 --- a/modules/mouse/types/Cursor.lua +++ b/modules/mouse/types/Cursor.lua @@ -1,9 +1,10 @@ +local path = (...):match('(.-)[^%./]+$') + return { name = 'Cursor', description = 'Represents a hardware cursor.', - constructors = { - 'getSystemCursor', - 'newCursor' + supertypes = { + 'Object', }, functions = { { @@ -14,16 +15,12 @@ return { returns = { { type = 'CursorType', - name = 'cursortype', - description = 'The type of the Cursor.' - } - } - } - } - } + name = 'ctype', + description = 'The type of the Cursor.', + }, + }, + }, + }, + }, }, - parenttype = 'Object', - supertypes = { - 'Object' - } -} +} \ No newline at end of file