From 1780e6e55b5f791d392b41721eb45753ff6b803d Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 15:33:16 +0800 Subject: [PATCH 01/57] remove redundant files --- .gitignore | 1 + .gitmodules | 3 + api/love.audio.lua | 487 -- api/love.event.lua | 124 - api/love.filesystem.lua | 337 -- api/love.graphics.lua | 2143 -------- api/love.image.lua | 364 -- api/love.joystick.lua | 229 - api/love.keyboard.lua | 744 --- api/love.lua | 96 - api/love.math.lua | 382 -- api/love.mouse.lua | 152 - api/love.physics.lua | 1677 ------ api/love.sound.lua | 88 - api/love.system.lua | 53 - api/love.thread.lua | 117 - api/love.timer.lua | 33 - api/love.touch.lua | 19 - api/love.video.lua | 18 - api/love.window.lua | 233 - love-api | 1 + love_api.lua | 1204 +--- modules | 1 + modules/audio/Audio.lua | 748 --- modules/audio/enums/DistanceModel.lua | 34 - modules/audio/enums/SourceType.lua | 18 - modules/audio/enums/TimeUnit.lua | 14 - modules/audio/types/Source.lua | 892 --- modules/event/Event.lua | 177 - modules/event/enums/Event.lua | 154 - modules/filesystem/Filesystem.lua | 1017 ---- modules/filesystem/enums/BufferMode.lua | 18 - modules/filesystem/enums/FileDecoder.lua | 14 - modules/filesystem/enums/FileMode.lua | 22 - modules/filesystem/types/File.lua | 374 -- modules/filesystem/types/FileData.lua | 45 - modules/graphics/Graphics.lua | 4854 ----------------- modules/graphics/enums/AlignMode.lua | 22 - modules/graphics/enums/ArcType.lua | 18 - .../graphics/enums/AreaSpreadDistribution.lua | 30 - modules/graphics/enums/BlendAlphaMode.lua | 14 - modules/graphics/enums/BlendMode.lua | 54 - modules/graphics/enums/CanvasFormat.lua | 74 - modules/graphics/enums/CompareMode.lua | 38 - modules/graphics/enums/DrawMode.lua | 14 - modules/graphics/enums/FilterMode.lua | 14 - modules/graphics/enums/GraphicsFeature.lua | 38 - modules/graphics/enums/GraphicsLimit.lua | 38 - modules/graphics/enums/LineJoin.lua | 18 - modules/graphics/enums/LineStyle.lua | 14 - modules/graphics/enums/MeshDrawMode.lua | 22 - modules/graphics/enums/ParticleInsertMode.lua | 18 - modules/graphics/enums/SpriteBatchUsage.lua | 18 - modules/graphics/enums/StackType.lua | 14 - modules/graphics/enums/StencilAction.lua | 30 - modules/graphics/enums/WrapMode.lua | 22 - modules/graphics/types/Canvas.lua | 127 - modules/graphics/types/Font.lua | 312 -- modules/graphics/types/Image.lua | 92 - modules/graphics/types/Mesh.lua | 815 --- modules/graphics/types/ParticleSystem.lua | 1213 ---- modules/graphics/types/Quad.lua | 104 - modules/graphics/types/Shader.lua | 257 - modules/graphics/types/SpriteBatch.lua | 867 --- modules/graphics/types/Text.lua | 647 --- modules/graphics/types/Texture.lua | 396 -- modules/graphics/types/Video.lua | 231 - modules/image/Image.lua | 211 - modules/image/enums/CompressedImageFormat.lua | 150 - modules/image/enums/ImageFormat.lua | 22 - modules/image/types/CompressedImageData.lua | 149 - modules/image/types/ImageData.lua | 283 - modules/joystick/Joystick.lua | 209 - modules/joystick/enums/GamepadAxis.lua | 30 - modules/joystick/enums/GamepadButton.lua | 66 - modules/joystick/enums/JoystickHat.lua | 42 - modules/joystick/enums/JoystickInputType.lua | 18 - modules/joystick/types/Joystick.lua | 474 -- modules/keyboard/Keyboard.lua | 219 - modules/keyboard/enums/KeyConstant.lua | 582 -- modules/keyboard/enums/Scancode.lua | 782 --- modules/math/Math.lua | 1014 ---- modules/math/enums/CompressedDataFormat.lua | 22 - modules/math/types/BezierCurve.lua | 336 -- modules/math/types/CompressedData.lua | 27 - modules/math/types/RandomGenerator.lua | 181 - modules/mouse/Mouse.lua | 407 -- modules/mouse/enums/CursorType.lua | 58 - modules/mouse/types/Cursor.lua | 31 - modules/physics/Physics.lua | 1445 ----- modules/physics/enums/BodyType.lua | 18 - modules/physics/enums/JointType.lua | 42 - modules/physics/enums/ShapeType.lua | 22 - modules/physics/types/Body.lua | 1199 ---- modules/physics/types/ChainShape.lua | 189 - modules/physics/types/CircleShape.lua | 85 - modules/physics/types/Contact.lua | 202 - modules/physics/types/DistanceJoint.lua | 105 - modules/physics/types/EdgeShape.lua | 125 - modules/physics/types/Fixture.lua | 530 -- modules/physics/types/FrictionJoint.lua | 75 - modules/physics/types/GearJoint.lua | 65 - modules/physics/types/Joint.lua | 193 - modules/physics/types/MotorJoint.lua | 85 - modules/physics/types/MouseJoint.lua | 145 - modules/physics/types/PolygonShape.lua | 46 - modules/physics/types/PrismaticJoint.lua | 307 -- modules/physics/types/PulleyJoint.lua | 175 - modules/physics/types/RevoluteJoint.lua | 295 - modules/physics/types/RopeJoint.lua | 45 - modules/physics/types/Shape.lua | 261 - modules/physics/types/WeldJoint.lua | 75 - modules/physics/types/WheelJoint.lua | 222 - modules/physics/types/World.lua | 432 -- modules/sound/Sound.lua | 152 - modules/sound/types/Decoder.lua | 89 - modules/sound/types/SoundData.lua | 174 - modules/system/System.lua | 154 - modules/system/enums/PowerState.lua | 26 - modules/thread/Thread.lua | 105 - modules/thread/types/Channel.lua | 223 - modules/thread/types/Thread.lua | 80 - modules/timer/Timer.lua | 102 - modules/touch/Touch.lua | 78 - modules/video/Video.lua | 51 - modules/video/types/VideoStream.lua | 14 - modules/window/Window.lua | 1029 ---- modules/window/enums/FullscreenType.lua | 18 - modules/window/enums/MessageBoxType.lua | 18 - 129 files changed, 7 insertions(+), 36460 deletions(-) create mode 100644 .gitignore create mode 100644 .gitmodules delete mode 100644 api/love.audio.lua delete mode 100644 api/love.event.lua delete mode 100644 api/love.filesystem.lua delete mode 100644 api/love.graphics.lua delete mode 100644 api/love.image.lua delete mode 100644 api/love.joystick.lua delete mode 100644 api/love.keyboard.lua delete mode 100644 api/love.lua delete mode 100644 api/love.math.lua delete mode 100644 api/love.mouse.lua delete mode 100644 api/love.physics.lua delete mode 100644 api/love.sound.lua delete mode 100644 api/love.system.lua delete mode 100644 api/love.thread.lua delete mode 100644 api/love.timer.lua delete mode 100644 api/love.touch.lua delete mode 100644 api/love.video.lua delete mode 100644 api/love.window.lua create mode 160000 love-api mode change 100644 => 120000 love_api.lua create mode 120000 modules delete mode 100644 modules/audio/Audio.lua delete mode 100644 modules/audio/enums/DistanceModel.lua delete mode 100644 modules/audio/enums/SourceType.lua delete mode 100644 modules/audio/enums/TimeUnit.lua delete mode 100644 modules/audio/types/Source.lua delete mode 100644 modules/event/Event.lua delete mode 100644 modules/event/enums/Event.lua delete mode 100644 modules/filesystem/Filesystem.lua delete mode 100644 modules/filesystem/enums/BufferMode.lua delete mode 100644 modules/filesystem/enums/FileDecoder.lua delete mode 100644 modules/filesystem/enums/FileMode.lua delete mode 100644 modules/filesystem/types/File.lua delete mode 100644 modules/filesystem/types/FileData.lua delete mode 100644 modules/graphics/Graphics.lua delete mode 100644 modules/graphics/enums/AlignMode.lua delete mode 100644 modules/graphics/enums/ArcType.lua delete mode 100644 modules/graphics/enums/AreaSpreadDistribution.lua delete mode 100644 modules/graphics/enums/BlendAlphaMode.lua delete mode 100644 modules/graphics/enums/BlendMode.lua delete mode 100644 modules/graphics/enums/CanvasFormat.lua delete mode 100644 modules/graphics/enums/CompareMode.lua delete mode 100644 modules/graphics/enums/DrawMode.lua delete mode 100644 modules/graphics/enums/FilterMode.lua delete mode 100644 modules/graphics/enums/GraphicsFeature.lua delete mode 100644 modules/graphics/enums/GraphicsLimit.lua delete mode 100644 modules/graphics/enums/LineJoin.lua delete mode 100644 modules/graphics/enums/LineStyle.lua delete mode 100644 modules/graphics/enums/MeshDrawMode.lua delete mode 100644 modules/graphics/enums/ParticleInsertMode.lua delete mode 100644 modules/graphics/enums/SpriteBatchUsage.lua delete mode 100644 modules/graphics/enums/StackType.lua delete mode 100644 modules/graphics/enums/StencilAction.lua delete mode 100644 modules/graphics/enums/WrapMode.lua delete mode 100644 modules/graphics/types/Canvas.lua delete mode 100644 modules/graphics/types/Font.lua delete mode 100644 modules/graphics/types/Image.lua delete mode 100644 modules/graphics/types/Mesh.lua delete mode 100644 modules/graphics/types/ParticleSystem.lua delete mode 100644 modules/graphics/types/Quad.lua delete mode 100644 modules/graphics/types/Shader.lua delete mode 100644 modules/graphics/types/SpriteBatch.lua delete mode 100644 modules/graphics/types/Text.lua delete mode 100644 modules/graphics/types/Texture.lua delete mode 100644 modules/graphics/types/Video.lua delete mode 100644 modules/image/Image.lua delete mode 100644 modules/image/enums/CompressedImageFormat.lua delete mode 100644 modules/image/enums/ImageFormat.lua delete mode 100644 modules/image/types/CompressedImageData.lua delete mode 100644 modules/image/types/ImageData.lua delete mode 100644 modules/joystick/Joystick.lua delete mode 100644 modules/joystick/enums/GamepadAxis.lua delete mode 100644 modules/joystick/enums/GamepadButton.lua delete mode 100644 modules/joystick/enums/JoystickHat.lua delete mode 100644 modules/joystick/enums/JoystickInputType.lua delete mode 100644 modules/joystick/types/Joystick.lua delete mode 100644 modules/keyboard/Keyboard.lua delete mode 100644 modules/keyboard/enums/KeyConstant.lua delete mode 100644 modules/keyboard/enums/Scancode.lua delete mode 100644 modules/math/Math.lua delete mode 100644 modules/math/enums/CompressedDataFormat.lua delete mode 100644 modules/math/types/BezierCurve.lua delete mode 100644 modules/math/types/CompressedData.lua delete mode 100644 modules/math/types/RandomGenerator.lua delete mode 100644 modules/mouse/Mouse.lua delete mode 100644 modules/mouse/enums/CursorType.lua delete mode 100644 modules/mouse/types/Cursor.lua delete mode 100644 modules/physics/Physics.lua delete mode 100644 modules/physics/enums/BodyType.lua delete mode 100644 modules/physics/enums/JointType.lua delete mode 100644 modules/physics/enums/ShapeType.lua delete mode 100644 modules/physics/types/Body.lua delete mode 100644 modules/physics/types/ChainShape.lua delete mode 100644 modules/physics/types/CircleShape.lua delete mode 100644 modules/physics/types/Contact.lua delete mode 100644 modules/physics/types/DistanceJoint.lua delete mode 100644 modules/physics/types/EdgeShape.lua delete mode 100644 modules/physics/types/Fixture.lua delete mode 100644 modules/physics/types/FrictionJoint.lua delete mode 100644 modules/physics/types/GearJoint.lua delete mode 100644 modules/physics/types/Joint.lua delete mode 100644 modules/physics/types/MotorJoint.lua delete mode 100644 modules/physics/types/MouseJoint.lua delete mode 100644 modules/physics/types/PolygonShape.lua delete mode 100644 modules/physics/types/PrismaticJoint.lua delete mode 100644 modules/physics/types/PulleyJoint.lua delete mode 100644 modules/physics/types/RevoluteJoint.lua delete mode 100644 modules/physics/types/RopeJoint.lua delete mode 100644 modules/physics/types/Shape.lua delete mode 100644 modules/physics/types/WeldJoint.lua delete mode 100644 modules/physics/types/WheelJoint.lua delete mode 100644 modules/physics/types/World.lua delete mode 100644 modules/sound/Sound.lua delete mode 100644 modules/sound/types/Decoder.lua delete mode 100644 modules/sound/types/SoundData.lua delete mode 100644 modules/system/System.lua delete mode 100644 modules/system/enums/PowerState.lua delete mode 100644 modules/thread/Thread.lua delete mode 100644 modules/thread/types/Channel.lua delete mode 100644 modules/thread/types/Thread.lua delete mode 100644 modules/timer/Timer.lua delete mode 100644 modules/touch/Touch.lua delete mode 100644 modules/video/Video.lua delete mode 100644 modules/video/types/VideoStream.lua delete mode 100644 modules/window/Window.lua delete mode 100644 modules/window/enums/FullscreenType.lua delete mode 100644 modules/window/enums/MessageBoxType.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8798c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +api/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1ff3caa --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "love-api"] + path = love-api + url = https://github.com/26f-studio/love-api diff --git a/api/love.audio.lua b/api/love.audio.lua deleted file mode 100644 index 76d68de..0000000 --- a/api/love.audio.lua +++ /dev/null @@ -1,487 +0,0 @@ ----@class love.audio ----Provides an interface to create noise with the user's speakers. -local m = {} - ---region RecordingDevice ----@class RecordingDevice ----Represents an audio input device capable of recording sounds. -local RecordingDevice = {} ----Gets the number of bits per sample in the data currently being recorded. ----@return number -function RecordingDevice:getBitDepth() end - ----Gets the number of bits per sample in the data currently being recorded. ----@return number -function RecordingDevice:getBitDepth() end - ----Gets the number of channels currently being recorded (mono or stereo). ----@return number -function RecordingDevice:getChannelCount() end - ----Gets all recorded audio SoundData stored in the device's internal ring buffer. ---- ----The internal ring buffer is cleared when this function is called, so calling it again will only get audio recorded after the previous call. If the device's internal ring buffer completely fills up before getData is called, the oldest data that doesn't fit into the buffer will be lost. ----@return SoundData -function RecordingDevice:getData() end - ----Gets the name of the recording device. ----@return string -function RecordingDevice:getName() end - ----Gets the number of currently recorded samples. ----@return number -function RecordingDevice:getSampleCount() end - ----Gets the number of samples per second currently being recorded. ----@return number -function RecordingDevice:getSampleRate() end - ----Gets whether the device is currently recording. ----@return boolean -function RecordingDevice:isRecording() end - ----Begins recording audio using this device. ----@param samplecount number @The maximum number of samples to store in an internal ring buffer when recording. RecordingDevice:getData clears the internal buffer when called. ----@param samplerate number @The number of samples per second to store when recording. ----@param bitdepth number @The number of bits per sample. ----@param channels number @Whether to record in mono or stereo. Most microphones don't support more than 1 channel. ----@return boolean -function RecordingDevice:start(samplecount, samplerate, bitdepth, channels) end - ----Stops recording audio from this device. Any sound data currently in the device's buffer will be returned. ----@return SoundData -function RecordingDevice:stop() end - ---endregion RecordingDevice ---region Source ----@class Source ----A Source represents audio you can play back. ---- ----You can do interesting things with Sources, like set the volume, pitch, and its position relative to the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources. ---- ----The Source controls (play/pause/stop) act according to the following state table. -local Source = {} ----Creates an identical copy of the Source in the stopped state. ---- ----Static Sources will use significantly less memory and take much less time to be created if Source:clone is used to create them instead of love.audio.newSource, so this method should be preferred when making multiple Sources which play the same sound. ----@return Source -function Source:clone() end - ----Gets a list of the Source's active effect names. ----@return table -function Source:getActiveEffects() end - ----Gets the amount of air absorption applied to the Source. ---- ----By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter. ----@return number -function Source:getAirAbsorption() end - ----Gets the reference and maximum attenuation distances of the Source. The values, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance from the listener. ----@return number, number -function Source:getAttenuationDistances() end - ----Gets the number of channels in the Source. Only 1-channel (mono) Sources can use directional and positional effects. ----@return number -function Source:getChannelCount() end - ----Gets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction. ----@return number, number, number -function Source:getCone() end - ----Gets the direction of the Source. ----@return number, number, number -function Source:getDirection() end - ----Gets the duration of the Source. For streaming Sources it may not always be sample-accurate, and may return -1 if the duration cannot be determined at all. ----@param unit TimeUnit @The time unit for the return value. ----@return number -function Source:getDuration(unit) end - ----Gets the filter settings associated to a specific effect. ---- ----This function returns nil if the effect was applied with no filter settings associated to it. ----@param name string @The name of the effect. ----@param filtersettings table @An optional empty table that will be filled with the filter settings. ----@return table -function Source:getEffect(name, filtersettings) end - ----Gets the filter settings currently applied to the Source. ----@return table -function Source:getFilter() end - ----Gets the number of free buffer slots in a queueable Source. If the queueable Source is playing, this value will increase up to the amount the Source was created with. If the queueable Source is stopped, it will process all of its internal buffers first, in which case this function will always return the amount it was created with. ----@return number -function Source:getFreeBufferCount() end - ----Gets the current pitch of the Source. ----@return number -function Source:getPitch() end - ----Gets the position of the Source. ----@return number, number, number -function Source:getPosition() end - ----Returns the rolloff factor of the source. ----@return number -function Source:getRolloff() end - ----Gets the type of the Source. ----@return SourceType -function Source:getType() end - ----Gets the velocity of the Source. ----@return number, number, number -function Source:getVelocity() end - ----Gets the current volume of the Source. ----@return number -function Source:getVolume() end - ----Returns the volume limits of the source. ----@return number, number -function Source:getVolumeLimits() end - ----Returns whether the Source will loop. ----@return boolean -function Source:isLooping() end - ----Returns whether the Source is playing. ----@return boolean -function Source:isPlaying() end - ----Gets whether the Source's position, velocity, direction, and cone angles are relative to the listener. ----@return boolean -function Source:isRelative() end - ----Pauses the Source. -function Source:pause() end - ----Starts playing the Source. ----@return boolean -function Source:play() end - ----Queues SoundData for playback in a queueable Source. ---- ----This method requires the Source to be created via love.audio.newQueueableSource. ----@param sounddata SoundData @The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's. ----@return boolean -function Source:queue(sounddata) end - ----Sets the currently playing position of the Source. ----@param offset number @The position to seek to. ----@param unit TimeUnit @The unit of the position value. -function Source:seek(offset, unit) end - ----Sets the amount of air absorption applied to the Source. ---- ----By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter. ---- ----Air absorption can simulate sound transmission through foggy air, dry air, smoky atmosphere, etc. It can be used to simulate different atmospheric conditions within different locations in an area. ----@param amount number @The amount of air absorption applied to the Source. Must be between 0 and 10. -function Source:setAirAbsorption(amount) end - ----Sets the reference and maximum attenuation distances of the Source. The parameters, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance. ---- ----Distance attenuation is only applicable to Sources based on mono (rather than stereo) audio. ----@param ref number @The new reference attenuation distance. If the current DistanceModel is clamped, this is the minimum attenuation distance. ----@param max number @The new maximum attenuation distance. -function Source:setAttenuationDistances(ref, max) end - ----Sets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction. ----@param innerAngle number @The inner angle from the Source's direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle. ----@param outerAngle number @The outer angle from the Source's direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles. ----@param outerVolume number @The Source's volume when the listener is outside both the inner and outer cone angles. -function Source:setCone(innerAngle, outerAngle, outerVolume) end - ----Sets the direction vector of the Source. A zero vector makes the source non-directional. ----@param x number @The X part of the direction vector. ----@param y number @The Y part of the direction vector. ----@param z number @The Z part of the direction vector. -function Source:setDirection(x, y, z) end - ----Applies an audio effect to the Source. ---- ----The effect must have been previously defined using love.audio.setEffect. ----@param name string @The name of the effect previously set up with love.audio.setEffect. ----@param enable boolean @If false and the given effect name was previously enabled on this Source, disables the effect. ----@return boolean ----@overload fun(name:string, filtersettings:table):boolean -function Source:setEffect(name, enable) end - ----Sets a low-pass, high-pass, or band-pass filter to apply when playing the Source. ----@param settings table @The filter settings to use for this Source, with the following fields: ----@return boolean -function Source:setFilter(settings) end - ----Sets whether the Source should loop. ----@param loop boolean @True if the source should loop, false otherwise. -function Source:setLooping(loop) end - ----Sets the pitch of the Source. ----@param pitch number @Calculated with regard to 1 being the base pitch. Each reduction by 50 percent equals a pitch shift of -12 semitones (one octave reduction). Each doubling equals a pitch shift of 12 semitones (one octave increase). Zero is not a legal value. -function Source:setPitch(pitch) end - ----Sets the position of the Source. Please note that this only works for mono (i.e. non-stereo) sound files! ----@param x number @The X position of the Source. ----@param y number @The Y position of the Source. ----@param z number @The Z position of the Source. -function Source:setPosition(x, y, z) end - ----Sets whether the Source's position, velocity, direction, and cone angles are relative to the listener, or absolute. ---- ----By default, all sources are absolute and therefore relative to the origin of love's coordinate system 0, 0. Only absolute sources are affected by the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources. ----@param enable boolean @True to make the position, velocity, direction and cone angles relative to the listener, false to make them absolute. -function Source:setRelative(enable) end - ----Sets the rolloff factor which affects the strength of the used distance attenuation. ---- ----Extended information and detailed formulas can be found in the chapter '3.4. Attenuation By Distance' of OpenAL 1.1 specification. ----@param rolloff number @The new rolloff factor. -function Source:setRolloff(rolloff) end - ----Sets the velocity of the Source. ---- ----This does '''not''' change the position of the Source, but lets the application know how it has to calculate the doppler effect. ----@param x number @The X part of the velocity vector. ----@param y number @The Y part of the velocity vector. ----@param z number @The Z part of the velocity vector. -function Source:setVelocity(x, y, z) end - ----Sets the current volume of the Source. ----@param volume number @The volume for a Source, where 1.0 is normal volume. Volume cannot be raised above 1.0. -function Source:setVolume(volume) end - ----Sets the volume limits of the source. The limits have to be numbers from 0 to 1. ----@param min number @The minimum volume. ----@param max number @The maximum volume. -function Source:setVolumeLimits(min, max) end - ----Stops a Source. -function Source:stop() end - ----Gets the currently playing position of the Source. ----@param unit TimeUnit @The type of unit for the return value. ----@return number -function Source:tell(unit) end - ---endregion Source ----The different distance models. ---- ----Extended information can be found in the chapter "3.4. Attenuation By Distance" of the OpenAL 1.1 specification. -DistanceModel = { - ---Sources do not get attenuated. - ['none'] = 1, - ---Inverse distance attenuation. - ['inverse'] = 2, - ---Inverse distance attenuation. Gain is clamped. In version 0.9.2 and older this is named '''inverse clamped'''. - ['inverseclamped'] = 3, - ---Linear attenuation. - ['linear'] = 4, - ---Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named '''linear clamped'''. - ['linearclamped'] = 5, - ---Exponential attenuation. - ['exponent'] = 6, - ---Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named '''exponent clamped'''. - ['exponentclamped'] = 7, -} ----The different types of effects supported by love.audio.setEffect. -EffectType = { - ---Plays multiple copies of the sound with slight pitch and time variation. Used to make sounds sound "fuller" or "thicker". - ['chorus'] = 1, - ---Decreases the dynamic range of the sound, making the loud and quiet parts closer in volume, producing a more uniform amplitude throughout time. - ['compressor'] = 2, - ---Alters the sound by amplifying it until it clips, shearing off parts of the signal, leading to a compressed and distorted sound. - ['distortion'] = 3, - ---Decaying feedback based effect, on the order of seconds. Also known as delay; causes the sound to repeat at regular intervals at a decreasing volume. - ['echo'] = 4, - ---Adjust the frequency components of the sound using a 4-band (low-shelf, two band-pass and a high-shelf) equalizer. - ['equalizer'] = 5, - ---Plays two copies of the sound; while varying the phase, or equivalently delaying one of them, by amounts on the order of milliseconds, resulting in phasing sounds. - ['flanger'] = 6, - ---Decaying feedback based effect, on the order of milliseconds. Used to simulate the reflection off of the surroundings. - ['reverb'] = 7, - ---An implementation of amplitude modulation; multiplies the source signal with a simple waveform, to produce either volume changes, or inharmonic overtones. - ['ringmodulator'] = 8, -} ----The different types of waveforms that can be used with the '''ringmodulator''' EffectType. -EffectWaveform = { - ---A sawtooth wave, also known as a ramp wave. Named for its linear rise, and (near-)instantaneous fall along time. - ['sawtooth'] = 1, - ---A sine wave. Follows a trigonometric sine function. - ['sine'] = 2, - ---A square wave. Switches between high and low states (near-)instantaneously. - ['square'] = 3, - ---A triangle wave. Follows a linear rise and fall that repeats periodically. - ['triangle'] = 4, -} ----Types of filters for Sources. -FilterType = { - ---Low-pass filter. High frequency sounds are attenuated. - ['lowpass'] = 1, - ---High-pass filter. Low frequency sounds are attenuated. - ['highpass'] = 2, - ---Band-pass filter. Both high and low frequency sounds are attenuated based on the given parameters. - ['bandpass'] = 3, -} ----Types of audio sources. ---- ----A good rule of thumb is to use stream for music files and static for all short sound effects. Basically, you want to avoid loading large files into memory at once. -SourceType = { - ---The whole audio is decoded. - ['static'] = 1, - ---The audio is decoded in chunks when needed. - ['stream'] = 2, - ---The audio must be manually queued by the user. - ['queue'] = 3, -} ----Units that represent time. -TimeUnit = { - ---Regular seconds. - ['seconds'] = 1, - ---Audio samples. - ['samples'] = 2, -} ----Gets a list of the names of the currently enabled effects. ----@return table -function m.getActiveEffects() end - ----Gets the current number of simultaneously playing sources. ----@return number -function m.getActiveSourceCount() end - ----Returns the distance attenuation model. ----@return DistanceModel -function m.getDistanceModel() end - ----Gets the current global scale factor for velocity-based doppler effects. ----@return number -function m.getDopplerScale() end - ----Gets the settings associated with an effect. ----@param name string @The name of the effect. ----@return table -function m.getEffect(name) end - ----Gets the maximum number of active effects supported by the system. ----@return number -function m.getMaxSceneEffects() end - ----Gets the maximum number of active Effects in a single Source object, that the system can support. ----@return number -function m.getMaxSourceEffects() end - ----Returns the orientation of the listener. ----@return number, number -function m.getOrientation() end - ----Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources. ----@return number, number, number -function m.getPosition() end - ----Gets a list of RecordingDevices on the system. ---- ----The first device in the list is the user's default recording device. The list may be empty if there are no microphones connected to the system. ---- ----Audio recording is currently not supported on iOS. ----@return table -function m.getRecordingDevices() end - ----Gets the current number of simultaneously playing sources. ----@return number -function m.getSourceCount() end - ----Returns the velocity of the listener. ----@return number, number, number -function m.getVelocity() end - ----Returns the master volume. ----@return number -function m.getVolume() end - ----Gets whether audio effects are supported in the system. ----@return boolean -function m.isEffectsSupported() end - ----Creates a new Source usable for real-time generated sound playback with Source:queue. ----@param samplerate number @Number of samples per second when playing. ----@param bitdepth number @Bits per sample (8 or 16). ----@param channels number @1 for mono or 2 for stereo. ----@param buffercount number @The number of buffers that can be queued up at any given time with Source:queue. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified. ----@return Source -function m.newQueueableSource(samplerate, bitdepth, channels, buffercount) end - ----Creates a new Source from a filepath, File, Decoder or SoundData. ---- ----Sources created from SoundData are always static. ----@param filename string @The filepath to the audio file. ----@param type SourceType @Streaming or static source. ----@return Source ----@overload fun(file:File, type:SourceType):Source ----@overload fun(decoder:Decoder, type:SourceType):Source ----@overload fun(data:FileData, type:SourceType):Source ----@overload fun(data:SoundData):Source -function m.newSource(filename, type) end - ----Pauses specific or all currently played Sources. ----@return table ----@overload fun(source:Source, ...:Source):void ----@overload fun(sources:table):void -function m.pause() end - ----Plays the specified Source. ----@param source Source @The Source to play. ----@overload fun(sources:table):void ----@overload fun(source1:Source, source2:Source, ...:Source):void -function m.play(source) end - ----Sets the distance attenuation model. ----@param model DistanceModel @The new distance model. -function m.setDistanceModel(model) end - ----Sets a global scale factor for velocity-based doppler effects. The default scale value is 1. ----@param scale number @The new doppler scale factor. The scale must be greater than 0. -function m.setDopplerScale(scale) end - ----Defines an effect that can be applied to a Source. ---- ----Not all system supports audio effects. Use love.audio.isEffectsSupported to check. ----@param name string @The name of the effect. ----@param settings table @The settings to use for this effect, with the following fields: ----@return boolean ----@overload fun(name:string, enabled:boolean):boolean -function m.setEffect(name, settings) end - ----Sets whether the system should mix the audio with the system's audio. ----@param mix boolean @True to enable mixing, false to disable it. ----@return boolean -function m.setMixWithSystem(mix) end - ----Sets the orientation of the listener. ----@param fx, fy, fz number @Forward vector of the listener orientation. ----@param ux, uy, uz number @Up vector of the listener orientation. -function m.setOrientation(fx, fy, fz, ux, uy, uz) end - ----Sets the position of the listener, which determines how sounds play. ----@param x number @The x position of the listener. ----@param y number @The y position of the listener. ----@param z number @The z position of the listener. -function m.setPosition(x, y, z) end - ----Sets the velocity of the listener. ----@param x number @The X velocity of the listener. ----@param y number @The Y velocity of the listener. ----@param z number @The Z velocity of the listener. -function m.setVelocity(x, y, z) end - ----Sets the master volume. ----@param volume number @1.0 is max and 0.0 is off. -function m.setVolume(volume) end - ----Stops currently played sources. ----@overload fun(source:Source):void ----@overload fun(source1:Source, source2:Source, ...:Source):void ----@overload fun(sources:table):void -function m.stop() end - -return m \ No newline at end of file diff --git a/api/love.event.lua b/api/love.event.lua deleted file mode 100644 index 072b5ba..0000000 --- a/api/love.event.lua +++ /dev/null @@ -1,124 +0,0 @@ ----@class love.event ----Manages events, like keypresses. -local m = {} - ----Arguments to love.event.push() and the like. ---- ----Since 0.8.0, event names are no longer abbreviated. -Event = { - ---Window focus gained or lost - ['focus'] = 1, - ---Joystick pressed - ['joystickpressed'] = 2, - ---Joystick released - ['joystickreleased'] = 3, - ---Key pressed - ['keypressed'] = 4, - ---Key released - ['keyreleased'] = 5, - ---Mouse pressed - ['mousepressed'] = 6, - ---Mouse released - ['mousereleased'] = 7, - ---Quit - ['quit'] = 8, - ---Window size changed by the user - ['resize'] = 9, - ---Window is minimized or un-minimized by the user - ['visible'] = 10, - ---Window mouse focus gained or lost - ['mousefocus'] = 11, - ---A Lua error has occurred in a thread - ['threaderror'] = 12, - ---Joystick connected - ['joystickadded'] = 13, - ---Joystick disconnected - ['joystickremoved'] = 14, - ---Joystick axis motion - ['joystickaxis'] = 15, - ---Joystick hat pressed - ['joystickhat'] = 16, - ---Joystick's virtual gamepad button pressed - ['gamepadpressed'] = 17, - ---Joystick's virtual gamepad button released - ['gamepadreleased'] = 18, - ---Joystick's virtual gamepad axis moved - ['gamepadaxis'] = 19, - ---User entered text - ['textinput'] = 20, - ---Mouse position changed - ['mousemoved'] = 21, - ---Running out of memory on mobile devices system - ['lowmemory'] = 22, - ---Candidate text for an IME changed - ['textedited'] = 23, - ---Mouse wheel moved - ['wheelmoved'] = 24, - ---Touch screen touched - ['touchpressed'] = 25, - ---Touch screen stop touching - ['touchreleased'] = 26, - ---Touch press moved inside touch screen - ['touchmoved'] = 27, - ---Directory is dragged and dropped onto the window - ['directorydropped'] = 28, - ---File is dragged and dropped onto the window. - ['filedropped'] = 29, - ---Joystick pressed - ['jp'] = 30, - ---Joystick released - ['jr'] = 31, - ---Key pressed - ['kp'] = 32, - ---Key released - ['kr'] = 33, - ---Mouse pressed - ['mp'] = 34, - ---Mouse released - ['mr'] = 35, - ---Quit - ['q'] = 36, - ---Window focus gained or lost - ['f'] = 37, -} ----Clears the event queue. -function m.clear() end - ----Returns an iterator for messages in the event queue. ----@return function -function m.poll() end - ----Pump events into the event queue. ---- ----This is a low-level function, and is usually not called by the user, but by love.run. ---- ----Note that this does need to be called for any OS to think you're still running, ---- ----and if you want to handle OS-generated events at all (think callbacks). -function m.pump() end - ----Adds an event to the event queue. ---- ----From 0.10.0 onwards, you may pass an arbitrary amount of arguments with this function, though the default callbacks don't ever use more than six. ----@param n Event @The name of the event. ----@param a Variant @First event argument. ----@param b Variant @Second event argument. ----@param c Variant @Third event argument. ----@param d Variant @Fourth event argument. ----@param e Variant @Fifth event argument. ----@param f Variant @Sixth event argument. ----@param ... Variant @Further event arguments may follow. -function m.push(n, a, b, c, d, e, f, ...) end - ----Adds the quit event to the queue. ---- ----The quit event is a signal for the event handler to close LÖVE. It's possible to abort the exit process with the love.quit callback. ----@param exitstatus number @The program exit status to use when closing the application. ----@overload fun('restart':string):void -function m.quit(exitstatus) end - ----Like love.event.poll(), but blocks until there is an event in the queue. ----@return Event, Variant, Variant, Variant, Variant, Variant, Variant, Variant -function m.wait() end - -return m \ No newline at end of file diff --git a/api/love.filesystem.lua b/api/love.filesystem.lua deleted file mode 100644 index 858762a..0000000 --- a/api/love.filesystem.lua +++ /dev/null @@ -1,337 +0,0 @@ ----@class love.filesystem ----Provides an interface to the user's filesystem. -local m = {} - ---region DroppedFile ----@class DroppedFile ----Represents a file dropped onto the window. ---- ----Note that the DroppedFile type can only be obtained from love.filedropped callback, and can't be constructed manually by the user. -local DroppedFile = {} ---endregion DroppedFile ---region File ----@class File ----Represents a file on the filesystem. A function that takes a file path can also take a File. -local File = {} ----Closes a File. ----@return boolean -function File:close() end - ----Flushes any buffered written data in the file to the disk. ----@return boolean, string -function File:flush() end - ----Gets the buffer mode of a file. ----@return BufferMode, number -function File:getBuffer() end - ----Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path. ----@return string -function File:getFilename() end - ----Gets the FileMode the file has been opened with. ----@return FileMode -function File:getMode() end - ----Returns the file size. ----@return number -function File:getSize() end - ----Gets whether end-of-file has been reached. ----@return boolean -function File:isEOF() end - ----Gets whether the file is open. ----@return boolean -function File:isOpen() end - ----Iterate over all the lines in a file. ----@return function -function File:lines() end - ----Open the file for write, read or append. ----@param mode FileMode @The mode to open the file in. ----@return boolean, string -function File:open(mode) end - ----Read a number of bytes from a file. ----@param bytes number @The number of bytes to read. ----@return string, number ----@overload fun(container:ContainerType, bytes:number):FileData or string, number -function File:read(bytes) end - ----Seek to a position in a file ----@param pos number @The position to seek to ----@return boolean -function File:seek(pos) end - ----Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode. ---- ----File:flush will force any buffered data to be written to the disk. ----@param mode BufferMode @The buffer mode to use. ----@param size number @The maximum size in bytes of the file's buffer. ----@return boolean, string -function File:setBuffer(mode, size) end - ----Returns the position in the file. ----@return number -function File:tell() end - ----Write data to a file. ----@param data string @The string data to write. ----@param size number @How many bytes to write. ----@return boolean, string ----@overload fun(data:Data, size:number):boolean, string -function File:write(data, size) end - ---endregion File ---region FileData ----@class FileData ----Data representing the contents of a file. -local FileData = {} ----Gets the extension of the FileData. ----@return string -function FileData:getExtension() end - ----Gets the filename of the FileData. ----@return string -function FileData:getFilename() end - ---endregion FileData ----Buffer modes for File objects. -BufferMode = { - ---No buffering. The result of write and append operations appears immediately. - ['none'] = 1, - ---Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached. - ['line'] = 2, - ---Full buffering. Write and append operations are always buffered until the buffer size limit is reached. - ['full'] = 3, -} ----How to decode a given FileData. -FileDecoder = { - ---The data is unencoded. - ['file'] = 1, - ---The data is base64-encoded. - ['base64'] = 2, -} ----The different modes you can open a File in. -FileMode = { - ---Open a file for read. - ['r'] = 1, - ---Open a file for write. - ['w'] = 2, - ---Open a file for append. - ['a'] = 3, - ---Do not open a file (represents a closed file.) - ['c'] = 4, -} ----The type of a file. -FileType = { - ---Regular file. - ['file'] = 1, - ---Directory. - ['directory'] = 2, - ---Symbolic link. - ['symlink'] = 3, - ---Something completely different like a device. - ['other'] = 4, -} ----Append data to an existing file. ----@param name string @The name (and path) of the file. ----@param data string @The string data to append to the file. ----@param size number @How many bytes to write. ----@return boolean, string ----@overload fun(name:string, data:Data, size:number):boolean, string -function m.append(name, data, size) end - ----Gets whether love.filesystem follows symbolic links. ----@return boolean -function m.areSymlinksEnabled() end - ----Recursively creates a directory. ---- ----When called with 'a/b' it creates both 'a' and 'a/b', if they don't exist already. ----@param name string @The directory to create. ----@return boolean -function m.createDirectory(name) end - ----Returns the application data directory (could be the same as getUserDirectory) ----@return string -function m.getAppdataDirectory() end - ----Gets the filesystem paths that will be searched for c libraries when require is called. ---- ----The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) Additionally, any occurrence of a double question mark ('??') will be replaced by the name passed to require and the default library extension for the platform. ---- ----The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. ----@return string -function m.getCRequirePath() end - ----Returns a table with the names of files and subdirectories in the specified path. The table is not sorted in any way; the order is undefined. ---- ----If the path passed to the function exists in the game and the save directory, it will list the files and directories from both places. ----@param dir string @The directory. ----@return table ----@overload fun(dir:string, callback:function):table -function m.getDirectoryItems(dir) end - ----Gets the write directory name for your game. ---- ----Note that this only returns the name of the folder to store your files in, not the full path. ----@return string -function m.getIdentity() end - ----Gets information about the specified file or directory. ----@param path string @The file or directory path to check. ----@param filtertype FileType @If supplied, this parameter causes getInfo to only return the info table if the item at the given path matches the specified file type. ----@return table ----@overload fun(path:string, info:table):table ----@overload fun(path:string, filtertype:FileType, info:table):table -function m.getInfo(path, filtertype) end - ----Gets the platform-specific absolute path of the directory containing a filepath. ---- ----This can be used to determine whether a file is inside the save directory or the game's source .love. ----@param filepath string @The filepath to get the directory of. ----@return string -function m.getRealDirectory(filepath) end - ----Gets the filesystem paths that will be searched when require is called. ---- ----The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) ---- ----The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. ----@return string -function m.getRequirePath() end - ----Gets the full path to the designated save directory. ---- ----This can be useful if you want to use the standard io library (or something else) to ---- ----read or write in the save directory. ----@return string -function m.getSaveDirectory() end - ----Returns the full path to the the .love file or directory. If the game is fused to the LÖVE executable, then the executable is returned. ----@return string -function m.getSource() end - ----Returns the full path to the directory containing the .love file. If the game is fused to the LÖVE executable, then the directory containing the executable is returned. ---- ----If love.filesystem.isFused is true, the path returned by this function can be passed to love.filesystem.mount, which will make the directory containing the main game (e.g. C:\Program Files\coolgame\) readable by love.filesystem. ----@return string -function m.getSourceBaseDirectory() end - ----Returns the path of the user's directory ----@return string -function m.getUserDirectory() end - ----Gets the current working directory. ----@return string -function m.getWorkingDirectory() end - ----Initializes love.filesystem, will be called internally, so should not be used explicitly. ----@param appname string @The name of the application binary, typically love. -function m.init(appname) end - ----Gets whether the game is in fused mode or not. ---- ----If a game is in fused mode, its save directory will be directly in the Appdata directory instead of Appdata/LOVE/. The game will also be able to load C Lua dynamic libraries which are located in the save directory. ---- ----A game is in fused mode if the source .love has been fused to the executable (see Game Distribution), or if '--fused' has been given as a command-line argument when starting the game. ----@return boolean -function m.isFused() end - ----Iterate over the lines in a file. ----@param name string @The name (and path) of the file ----@return function -function m.lines(name) end - ----Loads a Lua file (but does not run it). ----@param name string @The name (and path) of the file. ----@return function, string -function m.load(name) end - ----Mounts a zip file or folder in the game's save directory for reading. ---- ----It is also possible to mount love.filesystem.getSourceBaseDirectory if the game is in fused mode. ----@param archive string @The folder or zip file in the game's save directory to mount. ----@param mountpoint string @The new path the archive will be mounted to. ----@param appendToPath boolean @Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories. ----@return boolean ----@overload fun(filedata:FileData, mountpoint:string, appendToPath:boolean):boolean ----@overload fun(data:Data, archivename:string, mountpoint:string, appendToPath:boolean):boolean -function m.mount(archive, mountpoint, appendToPath) end - ----Creates a new File object. ---- ----It needs to be opened before it can be accessed. ----@param filename string @The filename of the file. ----@return File ----@overload fun(filename:string, mode:FileMode):File, string -function m.newFile(filename) end - ----Creates a new FileData object. ----@param contents string @The contents of the file. ----@param name string @The name of the file. ----@return FileData ----@overload fun(filepath:string):FileData, string -function m.newFileData(contents, name) end - ----Read the contents of a file. ----@param name string @The name (and path) of the file. ----@param size number @How many bytes to read. ----@return string, number, nil, string ----@overload fun(container:ContainerType, name:string, size:number):FileData or string, number, nil, string -function m.read(name, size) end - ----Removes a file or empty directory. ----@param name string @The file or directory to remove. ----@return boolean -function m.remove(name) end - ----Sets the filesystem paths that will be searched for c libraries when require is called. ---- ----The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) Additionally, any occurrence of a double question mark ('??') will be replaced by the name passed to require and the default library extension for the platform. ---- ----The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. ----@param paths string @The paths that the ''require'' function will check in love's filesystem. -function m.setCRequirePath(paths) end - ----Sets the write directory for your game. ---- ----Note that you can only set the name of the folder to store your files in, not the location. ----@param name string @The new identity that will be used as write directory. ----@overload fun(name:string):void -function m.setIdentity(name) end - ----Sets the filesystem paths that will be searched when require is called. ---- ----The paths string given to this function is a sequence of path templates separated by semicolons. The argument passed to ''require'' will be inserted in place of any question mark ('?') character in each template (after the dot characters in the argument passed to ''require'' are replaced by directory separators.) ---- ----The paths are relative to the game's source and save directories, as well as any paths mounted with love.filesystem.mount. ----@param paths string @The paths that the ''require'' function will check in love's filesystem. -function m.setRequirePath(paths) end - ----Sets the source of the game, where the code is present. This function can only be called once, and is normally automatically done by LÖVE. ----@param path string @Absolute path to the game's source folder. -function m.setSource(path) end - ----Sets whether love.filesystem follows symbolic links. It is enabled by default in version 0.10.0 and newer, and disabled by default in 0.9.2. ----@param enable boolean @Whether love.filesystem should follow symbolic links. -function m.setSymlinksEnabled(enable) end - ----Unmounts a zip file or folder previously mounted for reading with love.filesystem.mount. ----@param archive string @The folder or zip file in the game's save directory which is currently mounted. ----@return boolean -function m.unmount(archive) end - ----Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents. ----@param name string @The name (and path) of the file. ----@param data string @The string data to write to the file. ----@param size number @How many bytes to write. ----@return boolean, string ----@overload fun(name:string, data:Data, size:number):boolean, string -function m.write(name, data, size) end - -return m \ No newline at end of file diff --git a/api/love.graphics.lua b/api/love.graphics.lua deleted file mode 100644 index c417664..0000000 --- a/api/love.graphics.lua +++ /dev/null @@ -1,2143 +0,0 @@ ----@class love.graphics ----The primary responsibility for the love.graphics module is the drawing of lines, shapes, text, Images and other Drawable objects onto the screen. Its secondary responsibilities include loading external files (including Images and Fonts) into memory, creating specialized objects (such as ParticleSystems or Canvases) and managing screen geometry. ---- ----LÖVE's coordinate system is rooted in the upper-left corner of the screen, which is at location (0, 0). The x axis is horizontal: larger values are further to the right. The y axis is vertical: larger values are further towards the bottom. ---- ----In many cases, you draw images or shapes in terms of their upper-left corner. ---- ----Many of the functions are used to manipulate the graphics coordinate system, which is essentially the way coordinates are mapped to the display. You can change the position, scale, and even rotation in this way. -local m = {} - ---region Canvas ----@class Canvas ----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". ---- ----By 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. ---- ----In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime. -local Canvas = {} ----Generates mipmaps for the Canvas, based on the contents of the highest-resolution mipmap level. ---- ----The 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. ---- ----If 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. -function Canvas:generateMipmaps() end - ----Gets the number of multisample antialiasing (MSAA) samples used when drawing to the Canvas. ---- ----This may be different than the number used as an argument to love.graphics.newCanvas if the system running LÖVE doesn't support that number. ----@return number -function Canvas:getMSAA() end - ----Gets the MipmapMode this Canvas was created with. ----@return MipmapMode -function Canvas:getMipmapMode() end - ----Generates ImageData from the contents of the Canvas. ----@return ImageData ----@overload fun(slice:number, mipmap:number, x:number, y:number, width:number, height:number):ImageData -function Canvas:newImageData() end - ----Render to the Canvas using a function. ---- ----This is a shortcut to love.graphics.setCanvas: ---- ----canvas:renderTo( func ) ---- ----is the same as ---- ----love.graphics.setCanvas( canvas ) ---- ----func() ---- ----love.graphics.setCanvas() ----@param func function @A function performing drawing operations. -function Canvas:renderTo(func) end - ---endregion Canvas ---region Drawable ----@class Drawable ----Superclass for all things that can be drawn on screen. This is an abstract type that can't be created directly. -local Drawable = {} ---endregion Drawable ---region Font ----@class Font ----Defines the shape of characters that can be drawn onto the screen. -local Font = {} ----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. ----@return number -function Font:getAscent() end - ----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. ----@return number -function Font:getBaseline() end - ----Gets the DPI scale factor of the Font. ---- ----The 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. ---- ----The 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. ----@return number -function Font:getDPIScale() end - ----Gets the descent of the Font. ---- ----The descent spans the distance between the baseline and the lowest descending glyph in a typeface. ----@return number -function Font:getDescent() end - ----Gets the filter mode for a font. ----@return FilterMode, FilterMode, number -function Font:getFilter() end - ----Gets the height of the Font. ---- ----The height of the font is the size including any spacing; the height which it will need. ----@return number -function Font:getHeight() end - ----Gets the line height. ---- ----This will be the value previously set by Font:setLineHeight, or 1.0 by default. ----@return number -function Font:getLineHeight() end - ----Determines the maximum width (accounting for newlines) taken by the given string. ----@param text string @A string. ----@return number -function Font:getWidth(text) end - ----Gets formatting information for text, given a wrap limit. ---- ----This function accounts for newlines correctly (i.e. '\n'). ----@param text string @The text that will be wrapped. ----@param wraplimit number @The maximum width in pixels of each line that ''text'' is allowed before wrapping. ----@return number, table -function Font:getWrap(text, wraplimit) end - ----Gets whether the Font can render a character or string. ----@param text string @A UTF-8 encoded unicode string. ----@return boolean ----@overload fun(character1:string, character2:string):boolean ----@overload fun(codepoint1:number, codepoint2:number):boolean -function Font:hasGlyphs(text) end - ----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). ----@param fallbackfont1 Font @The first fallback Font to use. ----@param ... Font @Additional fallback Fonts. -function Font:setFallbacks(fallbackfont1, ...) end - ----Sets the filter mode for a font. ----@param min FilterMode @How to scale a font down. ----@param mag FilterMode @How to scale a font up. ----@param anisotropy number @Maximum amount of anisotropic filtering used. -function Font:setFilter(min, mag, anisotropy) end - ----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. ----@param height number @The new line height. -function Font:setLineHeight(height) end - ---endregion Font ---region Image ----@class Image ----Drawable image type. -local Image = {} ----Gets the flags used when the image was created. ----@return table -function Image:getFlags() end - ----Gets whether the Image was created from CompressedData. ---- ----Compressed images take up less space in VRAM, and drawing a compressed image will generally be more efficient than drawing one created from raw pixel data. ----@return boolean -function Image:isCompressed() end - ----Replace the contents of an Image. ----@param data ImageData @The new ImageData to replace the contents with. ----@param slice number @Which cubemap face, array index, or volume layer to replace, if applicable. ----@param mipmap number @The mimap level to replace, if the Image has mipmaps. ----@param x number @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. ----@param y number @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. ----@param reloadmipmaps boolean @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. -function Image:replacePixels(data, slice, mipmap, x, y, reloadmipmaps) end - ---endregion Image ---region Mesh ----@class Mesh ----A 2D polygon mesh used for drawing arbitrary textured shapes. -local Mesh = {} ----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. ----@param name string @The name of the vertex attribute to attach. ----@param mesh Mesh @The Mesh to get the vertex attribute from. ----@overload fun(name:string, mesh:Mesh, step:VertexAttributeStep, attachname:string):void -function Mesh:attachAttribute(name, mesh) end - ----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. ----@param name string @The name of the vertex attribute to attach. ----@param mesh Mesh @The Mesh to get the vertex attribute from. ----@overload fun(name:string, mesh:Mesh, step:VertexAttributeStep, attachname:string):void -function Mesh:attachAttribute(name, mesh) end - ----Removes a previously attached vertex attribute from this Mesh. ----@param name string @The name of the attached vertex attribute to detach. ----@return boolean -function Mesh:detachAttribute(name) end - ----Gets the mode used when drawing the Mesh. ----@return MeshDrawMode -function Mesh:getDrawMode() end - ----Gets the range of vertices used when drawing the Mesh. ----@return number, number -function Mesh:getDrawRange() end - ----Gets the texture (Image or Canvas) used when drawing the Mesh. ----@return Texture -function Mesh:getTexture() end - ----Gets the properties of a vertex in the Mesh. ---- ----In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. ----@param index number @The one-based index of the vertex you want to retrieve the information for. ----@return number, number ----@overload fun(index:number):number, number, number, number, number, number, number, number -function Mesh:getVertex(index) end - ----Gets the properties of a specific attribute within a vertex in the Mesh. ---- ----Meshes 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. ----@param vertexindex number @The index of the the vertex you want to retrieve the attribute for (one-based). ----@param attributeindex number @The index of the attribute within the vertex to be retrieved (one-based). ----@return number, number, number -function Mesh:getVertexAttribute(vertexindex, attributeindex) end - ----Gets the total number of vertices in the Mesh. ----@return number -function Mesh:getVertexCount() end - ----Gets the vertex format that the Mesh was created with. ----@return table -function Mesh:getVertexFormat() end - ----Gets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen. ---- ----If no vertex map has been set previously via Mesh:setVertexMap, then this function will return nil in LÖVE 0.10.0+, or an empty table in 0.9.2 and older. ----@return table -function Mesh:getVertexMap() end - ----Gets whether a specific vertex attribute in the Mesh is enabled. Vertex data from disabled attributes is not used when drawing the Mesh. ----@param name string @The name of the vertex attribute to be checked. ----@return boolean -function Mesh:isAttributeEnabled(name) end - ----Enables or disables a specific vertex attribute in the Mesh. Vertex data from disabled attributes is not used when drawing the Mesh. ----@param name string @The name of the vertex attribute to enable or disable. ----@param enable boolean @Whether the vertex attribute is used when drawing this Mesh. -function Mesh:setAttributeEnabled(name, enable) end - ----Sets the mode used when drawing the Mesh. ----@param mode MeshDrawMode @The mode to use when drawing the Mesh. -function Mesh:setDrawMode(mode) end - ----Restricts the drawn vertices of the Mesh to a subset of the total. ----@param start number @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. ----@param count number @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. -function Mesh:setDrawRange(start, count) end - ----Sets the texture (Image or Canvas) used when drawing the Mesh. ----@param texture Texture @The Image or Canvas to texture the Mesh with when drawing. -function Mesh:setTexture(texture) end - ----Sets the properties of a vertex in the Mesh. ---- ----In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. ----@param index number @The index of the the vertex you want to modify (one-based). ----@param attributecomponent number @The first component of the first vertex attribute in the specified vertex. ----@param ... number @Additional components of all vertex attributes in the specified vertex. ----@overload fun(index:number, vertex:table):void ----@overload fun(index:number, x:number, y:number, u:number, v:number, r:number, g:number, b:number, a:number):void ----@overload fun(index:number, vertex:table):void -function Mesh:setVertex(index, attributecomponent, ...) end - ----Sets the properties of a specific attribute within a vertex in the Mesh. ---- ----Meshes 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. ----@param vertexindex number @The index of the the vertex to be modified (one-based). ----@param attributeindex number @The index of the attribute within the vertex to be modified (one-based). ----@param value1 number @The new value for the first component of the attribute. ----@param value2 number @The new value for the second component of the attribute. ----@param ... number @Any additional vertex attribute components. -function Mesh:setVertexAttribute(vertexindex, attributeindex, value1, value2, ...) end - ----Sets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen. ---- ----The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters or duplicating vertices. It is especially useful when combined with different Mesh Draw Modes. ----@param map table @A table containing a list of vertex indices to use when drawing. Values must be in the range of Mesh:getVertexCount(). ----@overload fun(vi1:number, vi2:number, vi3:number):void ----@overload fun(data:Data, datatype:IndexDataType):void -function Mesh:setVertexMap(map) end - ----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. ----@param vertices table @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, ...}. ----@param startvertex number @The index of the first vertex to replace. ----@overload fun(data:Data, startvertex:number):void ----@overload fun(vertices:table):void -function Mesh:setVertices(vertices, startvertex) end - ---endregion Mesh ---region ParticleSystem ----@class ParticleSystem ----A ParticleSystem can be used to create particle effects like fire or smoke. ---- ----The particle system has to be created using update it in the update callback to see any changes in the particles emitted. ---- ----The particle system won't create any particles unless you call setParticleLifetime and setEmissionRate. -local ParticleSystem = {} ----Creates an identical copy of the ParticleSystem in the stopped state. ----@return ParticleSystem -function ParticleSystem:clone() end - ----Emits a burst of particles from the particle emitter. ----@param numparticles number @The amount of particles to emit. The number of emitted particles will be truncated if the particle system's max buffer size is reached. -function ParticleSystem:emit(numparticles) end - ----Gets the maximum number of particles the ParticleSystem can have at once. ----@return number -function ParticleSystem:getBufferSize() end - ----Gets the series of colors applied to the particle sprite. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@return number, number, number, number, number, number, number, number, number, number, number, number -function ParticleSystem:getColors() end - ----Gets the number of particles that are currently in the system. ----@return number -function ParticleSystem:getCount() end - ----Gets the direction of the particle emitter (in radians). ----@return number -function ParticleSystem:getDirection() end - ----Gets the area-based spawn parameters for the particles. ----@return AreaSpreadDistribution, number, number, number, boolean -function ParticleSystem:getEmissionArea() end - ----Gets the amount of particles emitted per second. ----@return number -function ParticleSystem:getEmissionRate() end - ----Gets how long the particle system will emit particles (if -1 then it emits particles forever). ----@return number -function ParticleSystem:getEmitterLifetime() end - ----Gets the mode used when the ParticleSystem adds new particles. ----@return ParticleInsertMode -function ParticleSystem:getInsertMode() end - ----Gets the linear acceleration (acceleration along the x and y axes) for particles. ---- ----Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax. ----@return number, number, number, number -function ParticleSystem:getLinearAcceleration() end - ----Gets the amount of linear damping (constant deceleration) for particles. ----@return number, number -function ParticleSystem:getLinearDamping() end - ----Gets the particle image's draw offset. ----@return number, number -function ParticleSystem:getOffset() end - ----Gets the lifetime of the particles. ----@return number, number -function ParticleSystem:getParticleLifetime() end - ----Gets the position of the emitter. ----@return number, number -function ParticleSystem:getPosition() end - ----Gets the series of Quads used for the particle sprites. ----@return table -function ParticleSystem:getQuads() end - ----Gets the radial acceleration (away from the emitter). ----@return number, number -function ParticleSystem:getRadialAcceleration() end - ----Gets the rotation of the image upon particle creation (in radians). ----@return number, number -function ParticleSystem:getRotation() end - ----Gets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end). ----@return number -function ParticleSystem:getSizeVariation() end - ----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. ----@return number, number, number -function ParticleSystem:getSizes() end - ----Gets the speed of the particles. ----@return number, number -function ParticleSystem:getSpeed() end - ----Gets the spin of the sprite. ----@return number, number, number -function ParticleSystem:getSpin() end - ----Gets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end). ----@return number -function ParticleSystem:getSpinVariation() end - ----Gets the amount of directional spread of the particle emitter (in radians). ----@return number -function ParticleSystem:getSpread() end - ----Gets the tangential acceleration (acceleration perpendicular to the particle's direction). ----@return number, number -function ParticleSystem:getTangentialAcceleration() end - ----Gets the texture (Image or Canvas) used for the particles. ----@return Texture -function ParticleSystem:getTexture() end - ----Gets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle. ----@return boolean -function ParticleSystem:hasRelativeRotation() end - ----Checks whether the particle system is actively emitting particles. ----@return boolean -function ParticleSystem:isActive() end - ----Checks whether the particle system is paused. ----@return boolean -function ParticleSystem:isPaused() end - ----Checks whether the particle system is stopped. ----@return boolean -function ParticleSystem:isStopped() end - ----Moves the position of the emitter. This results in smoother particle spawning behaviour than if ParticleSystem:setPosition is used every frame. ----@param x number @Position along x-axis. ----@param y number @Position along y-axis. -function ParticleSystem:moveTo(x, y) end - ----Pauses the particle emitter. -function ParticleSystem:pause() end - ----Resets the particle emitter, removing any existing particles and resetting the lifetime counter. -function ParticleSystem:reset() end - ----Sets the size of the buffer (the max allowed amount of particles in the system). ----@param size number @The buffer size. -function ParticleSystem:setBufferSize(size) end - ----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. ---- ----Arguments 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. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param r1 number @First color, red component (0-1). ----@param g1 number @First color, green component (0-1). ----@param b1 number @First color, blue component (0-1). ----@param a1 number @First color, alpha component (0-1). ----@param r2 number @Second color, red component (0-1). ----@param g2 number @Second color, green component (0-1). ----@param b2 number @Second color, blue component (0-1). ----@param a2 number @Second color, alpha component (0-1). ----@param r8 number @Eighth color, red component (0-1). ----@param g8 number @Eighth color, green component (0-1). ----@param b8 number @Eighth color, blue component (0-1). ----@param a8 number @Eighth color, alpha component (0-1). -function ParticleSystem:setColors(r1, g1, b1, a1, r2, g2, b2, a2, r8, g8, b8, a8) end - ----Sets the direction the particles will be emitted in. ----@param direction number @The direction of the particles (in radians). -function ParticleSystem:setDirection(direction) end - ----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. ----@param distribution AreaSpreadDistribution @The type of distribution for new particles. ----@param dx number @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. ----@param dy number @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. ----@param angle number @The angle in radians of the emission area. ----@param directionRelativeToCenter boolean @True if newly spawned particles will be oriented relative to the center of the emission area, false otherwise. -function ParticleSystem:setEmissionArea(distribution, dx, dy, angle, directionRelativeToCenter) end - ----Sets the amount of particles emitted per second. ----@param rate number @The amount of particles per second. -function ParticleSystem:setEmissionRate(rate) end - ----Sets how long the particle system should emit particles (if -1 then it emits particles forever). ----@param life number @The lifetime of the emitter (in seconds). -function ParticleSystem:setEmitterLifetime(life) end - ----Sets the mode to use when the ParticleSystem adds new particles. ----@param mode ParticleInsertMode @The mode to use when the ParticleSystem adds new particles. -function ParticleSystem:setInsertMode(mode) end - ----Sets the linear acceleration (acceleration along the x and y axes) for particles. ---- ----Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax. ----@param xmin number @The minimum acceleration along the x axis. ----@param ymin number @The minimum acceleration along the y axis. ----@param xmax number @The maximum acceleration along the x axis. ----@param ymax number @The maximum acceleration along the y axis. -function ParticleSystem:setLinearAcceleration(xmin, ymin, xmax, ymax) end - ----Sets the amount of linear damping (constant deceleration) for particles. ----@param min number @The minimum amount of linear damping applied to particles. ----@param max number @The maximum amount of linear damping applied to particles. -function ParticleSystem:setLinearDamping(min, max) end - ----Set the offset position which the particle sprite is rotated around. ---- ----If this function is not used, the particles rotate around their center. ----@param x number @The x coordinate of the rotation offset. ----@param y number @The y coordinate of the rotation offset. -function ParticleSystem:setOffset(x, y) end - ----Sets the lifetime of the particles. ----@param min number @The minimum life of the particles (in seconds). ----@param max number @The maximum life of the particles (in seconds). -function ParticleSystem:setParticleLifetime(min, max) end - ----Sets the position of the emitter. ----@param x number @Position along x-axis. ----@param y number @Position along y-axis. -function ParticleSystem:setPosition(x, y) end - ----Sets a series of Quads to use for the particle sprites. Particles will choose a Quad from the list based on the particle's current lifetime, allowing for the use of animated sprite sheets with ParticleSystems. ----@param quad1 Quad @The first Quad to use. ----@param quad2 Quad @The second Quad to use. ----@overload fun(quads:table):void -function ParticleSystem:setQuads(quad1, quad2) end - ----Set the radial acceleration (away from the emitter). ----@param min number @The minimum acceleration. ----@param max number @The maximum acceleration. -function ParticleSystem:setRadialAcceleration(min, max) end - ----Sets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle. ----@param enable boolean @True to enable relative particle rotation, false to disable it. -function ParticleSystem:setRelativeRotation(enable) end - ----Sets the rotation of the image upon particle creation (in radians). ----@param min number @The minimum initial angle (radians). ----@param max number @The maximum initial angle (radians). -function ParticleSystem:setRotation(min, max) end - ----Sets the amount of size variation (0 meaning no variation and 1 meaning full variation between start and end). ----@param variation number @The amount of variation (0 meaning no variation and 1 meaning full variation between start and end). -function ParticleSystem:setSizeVariation(variation) end - ----Sets 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. ---- ----At least one size must be specified. A maximum of eight may be used. ----@param size1 number @The first size. ----@param size2 number @The second size. ----@param size8 number @The eighth size. -function ParticleSystem:setSizes(size1, size2, size8) end - ----Sets the speed of the particles. ----@param min number @The minimum linear speed of the particles. ----@param max number @The maximum linear speed of the particles. -function ParticleSystem:setSpeed(min, max) end - ----Sets the spin of the sprite. ----@param min number @The minimum spin (radians per second). ----@param max number @The maximum spin (radians per second). -function ParticleSystem:setSpin(min, max) end - ----Sets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end). ----@param variation number @The amount of variation (0 meaning no variation and 1 meaning full variation between start and end). -function ParticleSystem:setSpinVariation(variation) end - ----Sets the amount of spread for the system. ----@param spread number @The amount of spread (radians). -function ParticleSystem:setSpread(spread) end - ----Sets the tangential acceleration (acceleration perpendicular to the particle's direction). ----@param min number @The minimum acceleration. ----@param max number @The maximum acceleration. -function ParticleSystem:setTangentialAcceleration(min, max) end - ----Sets the texture (Image or Canvas) to be used for the particles. ----@param texture Texture @An Image or Canvas to use for the particles. -function ParticleSystem:setTexture(texture) end - ----Starts the particle emitter. -function ParticleSystem:start() end - ----Stops the particle emitter, resetting the lifetime counter. -function ParticleSystem:stop() end - ----Updates the particle system; moving, creating and killing particles. ----@param dt number @The time (seconds) since last frame. -function ParticleSystem:update(dt) end - ---endregion ParticleSystem ---region Quad ----@class Quad ----A quadrilateral (a polygon with four sides and four corners) with texture coordinate information. ---- ----Quads 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. -local Quad = {} ----Gets reference texture dimensions initially specified in love.graphics.newQuad. ----@return number, number -function Quad:getTextureDimensions() end - ----Gets the current viewport of this Quad. ----@return number, number, number, number -function Quad:getViewport() end - ----Sets the texture coordinates according to a viewport. ----@param x number @The top-left corner along the x-axis. ----@param y number @The top-left corner along the y-axis. ----@param w number @The width of the viewport. ----@param h number @The height of the viewport. ----@param sw number @The reference width, the width of the Image. (Must be greater than 0.) ----@param sh number @The reference height, the height of the Image. (Must be greater than 0.) -function Quad:setViewport(x, y, w, h, sw, sh) end - ---endregion Quad ---region Shader ----@class Shader ----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. ---- ----Potential 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 -local Shader = {} ----Returns any warning and error messages from compiling the shader code. This can be used for debugging your shaders if there's anything the graphics hardware doesn't like. ----@return string -function Shader:getWarnings() end - ----Gets whether a uniform / extern variable exists in the Shader. ---- ----If a graphics driver's shader compiler determines that a uniform / extern variable doesn't affect the final output of the shader, it may optimize the variable out. This function will return false in that case. ----@param name string @The name of the uniform variable. ----@return boolean -function Shader:hasUniform(name) end - ----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. ---- ----uniform float time; // 'float' is the typical number type used in GLSL shaders. ---- ----uniform float varsvec2 light_pos; ---- ----uniform vec4 colors[4; ---- ----The corresponding send calls would be ---- ----shader:send('time', t) ---- ----shader:send('vars',a,b) ---- ----shader:send('light_pos', {light_x, light_y}) ---- ----shader:send('colors', {r1, g1, b1, a1}, {r2, g2, b2, a2}, {r3, g3, b3, a3}, {r4, g4, b4, a4}) ---- ----Uniform / 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. ----@param name string @Name of the number to send to the shader. ----@param number number @Number to send to store in the uniform variable. ----@param ... number @Additional numbers to send if the uniform variable is an array. ----@overload fun(name:string, vector:table, ...:table):void ----@overload fun(name:string, matrix:table, ...:table):void ----@overload fun(name:string, texture:Texture):void ----@overload fun(name:string, boolean:boolean, ...:boolean):void ----@overload fun(name:string, matrixlayout:MatrixLayout, matrix:table, ...:table):void ----@overload fun(name:string, data:Data, offset:number, size:number):void ----@overload fun(name:string, data:Data, matrixlayout:MatrixLayout, offset:number, size:number):void -function Shader:send(name, number, ...) end - ----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. ---- ----Extern variables must be marked using the ''extern'' keyword, e.g. ---- ----extern vec4 Color; ---- ----The corresponding sendColor call would be ---- ----shader:sendColor('Color', {r, g, b, a}) ---- ----Extern variables can be accessed in both the Vertex and Pixel stages of a shader, as long as the variable is declared in each. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param name string @The name of the color extern variable to send to in the shader. ----@param color table @A table with red, green, blue, and optional alpha color components in the range of 1 to send to the extern as a vector. ----@param ... table @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). -function Shader:sendColor(name, color, ...) end - ---endregion Shader ---region SpriteBatch ----@class SpriteBatch ----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. ---- ----A 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. -local SpriteBatch = {} ----Adds a sprite to the batch. Sprites are drawn in the order they are added. ----@param x number @The position to draw the object (x-axis). ----@param y number @The position to draw the object (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shear factor (x-axis). ----@param ky number @Shear factor (y-axis). ----@return number ----@overload fun(quad:Quad, x:number, y:number, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):number -function SpriteBatch:add(x, y, r, sx, sy, ox, oy, kx, ky) end - ----Adds a sprite to a batch created with an Array Texture. ----@param layerindex number @The index of the layer to use for this sprite. ----@param x number @The position to draw the sprite (x-axis). ----@param y number @The position to draw the sprite (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@return number ----@overload fun(layerindex:number, quad:Quad, x:number, y:number, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):number ----@overload fun(layerindex:number, transform:Transform):number ----@overload fun(layerindex:number, quad:Quad, transform:Transform):number -function SpriteBatch:addLayer(layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end - ----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. ---- ----Each 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 ). ----@param name string @The name of the vertex attribute to attach. ----@param mesh Mesh @The Mesh to get the vertex attribute from. -function SpriteBatch:attachAttribute(name, mesh) end - ----Removes all sprites from the buffer. -function SpriteBatch:clear() end - ----Immediately sends all new and modified sprite data in the batch to the graphics card. ---- ----Normally 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. ---- ----If this method is used, it generally shouldn't be called more than once (at most) between love.graphics.draw(spritebatch, ...) calls. -function SpriteBatch:flush() end - ----Gets the maximum number of sprites the SpriteBatch can hold. ----@return number -function SpriteBatch:getBufferSize() end - ----Gets the color that will be used for the next add and set operations. ---- ----If no color has been set with SpriteBatch:setColor or the current SpriteBatch color has been cleared, this method will return nil. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@return number, number, number, number -function SpriteBatch:getColor() end - ----Gets the number of sprites currently in the SpriteBatch. ----@return number -function SpriteBatch:getCount() end - ----Gets the texture (Image or Canvas) used by the SpriteBatch. ----@return Texture -function SpriteBatch:getTexture() end - ----Changes a sprite in the batch. This requires the sprite index returned by SpriteBatch:add or SpriteBatch:addLayer. ----@param spriteindex number @The index of the sprite that will be changed. ----@param x number @The position to draw the object (x-axis). ----@param y number @The position to draw the object (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shear factor (x-axis). ----@param ky number @Shear factor (y-axis). ----@overload fun(spriteindex:number, quad:Quad, x:number, y:number, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void -function SpriteBatch:set(spriteindex, x, y, r, sx, sy, ox, oy, kx, ky) end - ----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. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ---- ----In 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. ----@param r number @The amount of red. ----@param g number @The amount of green. ----@param b number @The amount of blue. ----@param a number @The amount of alpha. -function SpriteBatch:setColor(r, g, b, a) end - ----Restricts the drawn sprites in the SpriteBatch to a subset of the total. ----@param start number @The index of the first sprite to draw. Index 1 corresponds to the first sprite added with SpriteBatch:add. ----@param count number @The number of sprites to draw. -function SpriteBatch:setDrawRange(start, count) end - ----Changes a sprite previously added with add or addLayer, in a batch created with an Array Texture. ----@param spriteindex number @The index of the existing sprite to replace. ----@param layerindex number @The index of the layer in the Array Texture to use for this sprite. ----@param x number @The position to draw the sprite (x-axis). ----@param y number @The position to draw the sprite (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@overload fun(spriteindex:number, layerindex:number, quad:Quad, x:number, y:number, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(spriteindex:number, layerindex:number, transform:Transform):void ----@overload fun(spriteindex:number, layerindex:number, quad:Quad, transform:Transform):void -function SpriteBatch:setLayer(spriteindex, layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end - ----Sets the texture (Image or Canvas) used for the sprites in the batch, when drawing. ----@param texture Texture @The new Image or Canvas to use for the sprites in the batch. -function SpriteBatch:setTexture(texture) end - ---endregion SpriteBatch ---region Text ----@class Text ----Drawable text. -local Text = {} ----Adds additional colored text to the Text object at the specified position. ----@param textstring string @The text to add to the object. ----@param x number @The position of the new text on the x-axis. ----@param y number @The position of the new text on the y-axis. ----@param angle number @The orientation of the new text in radians. ----@param sx number @Scale factor on the x-axis. ----@param sy number @Scale factor on the y-axis. ----@param ox number @Origin offset on the x-axis. ----@param oy number @Origin offset on the y-axis. ----@param kx number @Shearing / skew factor on the x-axis. ----@param ky number @Shearing / skew factor on the y-axis. ----@return number ----@overload fun(coloredtext:table, x:number, y:number, angle:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):number -function Text:add(textstring, x, y, angle, sx, sy, ox, oy, kx, ky) end - ----Adds additional formatted / colored text to the Text object at the specified position. ---- ----The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. ----@param textstring string @The text to add to the object. ----@param wraplimit number @The maximum width in pixels of the text before it gets automatically wrapped to a new line. ----@param align AlignMode @The alignment of the text. ----@param x number @The position of the new text (x-axis). ----@param y number @The position of the new text (y-axis). ----@param angle number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing / skew factor (x-axis). ----@param ky number @Shearing / skew factor (y-axis). ----@return number ----@overload fun(coloredtext:table, wraplimit:number, align:AlignMode, x:number, y:number, angle:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):number -function Text:addf(textstring, wraplimit, align, x, y, angle, sx, sy, ox, oy, kx, ky) end - ----Clears the contents of the Text object. -function Text:clear() end - ----Gets the width and height of the text in pixels. ----@return number, number ----@overload fun(index:number):number, number -function Text:getDimensions() end - ----Gets the Font used with the Text object. ----@return Font -function Text:getFont() end - ----Gets the height of the text in pixels. ----@return number ----@overload fun(index:number):number -function Text:getHeight() end - ----Gets the width of the text in pixels. ----@return number ----@overload fun(index:number):number -function Text:getWidth() end - ----Replaces the contents of the Text object with a new unformatted string. ----@param textstring string @The new string of text to use. ----@overload fun(coloredtext:table):void -function Text:set(textstring) end - ----Replaces the Font used with the text. ----@param font Font @The new font to use with this Text object. -function Text:setFont(font) end - ----Replaces the contents of the Text object with a new formatted string. ----@param textstring string @The new string of text to use. ----@param wraplimit number @The maximum width in pixels of the text before it gets automatically wrapped to a new line. ----@param align AlignMode @The alignment of the text. ----@overload fun(coloredtext:table, wraplimit:number, align:AlignMode):void -function Text:setf(textstring, wraplimit, align) end - ---endregion Text ---region Texture ----@class Texture ----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. -local Texture = {} ----Gets the DPI scale factor of the Texture. ---- ----The 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. ---- ----For 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. ----@return number -function Texture:getDPIScale() end - ----Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures. ----@return number -function Texture:getDepth() end - ----Gets the comparison mode used when sampling from a depth texture in a shader. ---- ----Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D. ----@return CompareMode -function Texture:getDepthSampleMode() end - ----Gets the width and height of the Texture. ----@return number, number -function Texture:getDimensions() end - ----Gets the filter mode of the Texture. ----@return FilterMode, FilterMode, number -function Texture:getFilter() end - ----Gets the pixel format of the Texture. ----@return PixelFormat -function Texture:getFormat() end - ----Gets the height of the Texture. ----@return number -function Texture:getHeight() end - ----Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures. ----@return number -function Texture:getLayerCount() end - ----Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1. ----@return number -function Texture:getMipmapCount() end - ----Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. ----@return FilterMode, number -function Texture:getMipmapFilter() end - ----Gets the width and height in pixels of the Texture. ---- ----Texture:getDimensions gets the dimensions of the texture in units scaled by the texture's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions only when dealing specifically with pixels, for example when using Canvas:newImageData. ----@return number, number -function Texture:getPixelDimensions() end - ----Gets the height in pixels of the Texture. ---- ----DPI 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. ----@return number -function Texture:getPixelHeight() end - ----Gets the width in pixels of the Texture. ---- ----DPI 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. ----@return number -function Texture:getPixelWidth() end - ----Gets the type of the Texture. ----@return TextureType -function Texture:getTextureType() end - ----Gets the width of the Texture. ----@return number -function Texture:getWidth() end - ----Gets the wrapping properties of a Texture. ---- ----This function returns the currently set horizontal and vertical wrapping modes for the texture. ----@return WrapMode, WrapMode, WrapMode -function Texture:getWrap() end - ----Gets whether the Texture can be drawn and sent to a Shader. ---- ----Canvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas. ---- ----Non-readable Canvases can still be rendered to. ----@return boolean -function Texture:isReadable() end - ----Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D. ---- ----When using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation. ---- ----Depth texture comparison can only be used with readable depth-formatted Canvases. ----@param compare CompareMode @The comparison mode used when sampling from this texture in a shader. -function Texture:setDepthSampleMode(compare) end - ----Sets the filter mode of the Texture. ----@param min FilterMode @Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels). ----@param mag FilterMode @Filter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels). ----@param anisotropy number @Maximum amount of anisotropic filtering to use. -function Texture:setFilter(min, mag, anisotropy) end - ----Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. ---- ----Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues. ---- ----In 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. ---- ----Due 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. ----@param filtermode FilterMode @The filter mode to use in between mipmap levels. 'nearest' will often give better performance. ----@param sharpness number @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. -function Texture:setMipmapFilter(filtermode, sharpness) end - ----Sets the wrapping properties of a Texture. ---- ----This function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture's extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions. ---- ----Clamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad. ----@param horiz WrapMode @Horizontal wrapping mode of the texture. ----@param vert WrapMode @Vertical wrapping mode of the texture. ----@param depth WrapMode @Wrapping mode for the z-axis of a Volume texture. -function Texture:setWrap(horiz, vert, depth) end - ---endregion Texture ---region Video ----@class Video ----A drawable video. -local Video = {} ----Gets the width and height of the Video in pixels. ----@return number, number -function Video:getDimensions() end - ----Gets the scaling filters used when drawing the Video. ----@return FilterMode, FilterMode, number -function Video:getFilter() end - ----Gets the height of the Video in pixels. ----@return number -function Video:getHeight() end - ----Gets the audio Source used for playing back the video's audio. May return nil if the video has no audio, or if Video:setSource is called with a nil argument. ----@return Source -function Video:getSource() end - ----Gets the VideoStream object used for decoding and controlling the video. ----@return VideoStream -function Video:getStream() end - ----Gets the width of the Video in pixels. ----@return number -function Video:getWidth() end - ----Gets whether the Video is currently playing. ----@return boolean -function Video:isPlaying() end - ----Pauses the Video. -function Video:pause() end - ----Starts playing the Video. In order for the video to appear onscreen it must be drawn with love.graphics.draw. -function Video:play() end - ----Rewinds the Video to the beginning. -function Video:rewind() end - ----Sets the current playback position of the Video. ----@param offset number @The time in seconds since the beginning of the Video. -function Video:seek(offset) end - ----Sets the scaling filters used when drawing the Video. ----@param min FilterMode @The filter mode used when scaling the Video down. ----@param mag FilterMode @The filter mode used when scaling the Video up. ----@param anisotropy number @Maximum amount of anisotropic filtering used. -function Video:setFilter(min, mag, anisotropy) end - ----Sets the audio Source used for playing back the video's audio. The audio Source also controls playback speed and synchronization. ----@param source Source @The audio Source used for audio playback, or nil to disable audio synchronization. -function Video:setSource(source) end - ----Gets the current playback position of the Video. ----@return number -function Video:tell() end - ---endregion Video ----Text alignment. -AlignMode = { - ---Align text center. - ['center'] = 1, - ---Align text left. - ['left'] = 2, - ---Align text right. - ['right'] = 3, - ---Align text both left and right. - ['justify'] = 4, -} ----Different types of arcs that can be drawn. -ArcType = { - ---The arc is drawn like a slice of pie, with the arc circle connected to the center at its end-points. - ['pie'] = 1, - ---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. - ['open'] = 2, - ---The arc circle's two end-points are connected to each other. - ['closed'] = 3, -} ----Types of particle area spread distribution. -AreaSpreadDistribution = { - ---Uniform distribution. - ['uniform'] = 1, - ---Normal (gaussian) distribution. - ['normal'] = 2, - ---Uniform distribution in an ellipse. - ['ellipse'] = 3, - ---Distribution in an ellipse with particles spawning at the edges of the ellipse. - ['borderellipse'] = 4, - ---Distribution in a rectangle with particles spawning at the edges of the rectangle. - ['borderrectangle'] = 5, - ---No distribution - area spread is disabled. - ['none'] = 6, -} ----Different ways alpha affects color blending. See BlendMode and the BlendMode Formulas for additional notes. -BlendAlphaMode = { - ---The RGB values of what's drawn are multiplied by the alpha values of those colors during blending. This is the default alpha mode. - ['alphamultiply'] = 1, - ---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"). - ['premultiplied'] = 2, -} ----Different ways to do color blending. See BlendAlphaMode and the BlendMode Formulas for additional notes. -BlendMode = { - ---Alpha blending (normal). The alpha of what's drawn determines its opacity. - ['alpha'] = 1, - ---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. - ['replace'] = 2, - ---'Screen' blending. - ['screen'] = 3, - ---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. - ['add'] = 4, - ---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. - ['subtract'] = 5, - ---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. - ['multiply'] = 6, - ---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. - ['lighten'] = 7, - ---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. - ['darken'] = 8, - ---Additive blend mode. - ['additive'] = 9, - ---Subtractive blend mode. - ['subtractive'] = 10, - ---Multiply blend mode. - ['multiplicative'] = 11, - ---Premultiplied alpha blend mode. - ['premultiplied'] = 12, -} ----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. -CompareMode = { - ---* stencil tests: the stencil value of the pixel must be equal to the supplied value. ----* depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel. - ['equal'] = 1, - ---* stencil tests: the stencil value of the pixel must not be equal to the supplied value. ----* depth tests: the depth value of the drawn object at that pixel must not be equal to the existing depth value of that pixel. - ['notequal'] = 2, - ---* stencil tests: the stencil value of the pixel must be less than the supplied value. ----* depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel. - ['less'] = 3, - ---* stencil tests: the stencil value of the pixel must be less than or equal to the supplied value. ----* 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. - ['lequal'] = 4, - ---* stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value. ----* 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. - ['gequal'] = 5, - ---* stencil tests: the stencil value of the pixel must be greater than the supplied value. ----* depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel. - ['greater'] = 6, - ---Objects will never be drawn. - ['never'] = 7, - ---Objects will always be drawn. Effectively disables the depth or stencil test. - ['always'] = 8, -} ----How Mesh geometry is culled when rendering. -CullMode = { - ---Back-facing triangles in Meshes are culled (not rendered). The vertex order of a triangle determines whether it is back- or front-facing. - ['back'] = 1, - ---Front-facing triangles in Meshes are culled. - ['front'] = 2, - ---Both back- and front-facing triangles in Meshes are rendered. - ['none'] = 3, -} ----Controls whether shapes are drawn as an outline, or filled. -DrawMode = { - ---Draw filled shape. - ['fill'] = 1, - ---Draw outlined shape. - ['line'] = 2, -} ----How the image is filtered when scaling. -FilterMode = { - ---Scale image with linear interpolation. - ['linear'] = 1, - ---Scale image with nearest neighbor interpolation. - ['nearest'] = 2, -} ----Graphics features that can be checked for with love.graphics.getSupported. -GraphicsFeature = { - ---Whether the "clampzero" WrapMode is supported. - ['clampzero'] = 1, - ---Whether the "lighten" and "darken" BlendModes are supported. - ['lighten'] = 2, - ---Whether multiple formats can be used in the same love.graphics.setCanvas call. - ['multicanvasformats'] = 3, - ---Whether GLSL 3 Shaders can be used. - ['glsl3'] = 4, - ---Whether mesh instancing is supported. - ['instancing'] = 5, - ---Whether textures with non-power-of-two dimensions can use mipmapping and the 'repeat' WrapMode. - ['fullnpot'] = 6, - ---Whether pixel shaders can use "highp" 32 bit floating point numbers (as opposed to just 16 bit or lower precision). - ['pixelshaderhighp'] = 7, - ---Whether shaders can use the dFdx, dFdy, and fwidth functions for computing derivatives. - ['shaderderivatives'] = 8, -} ----Types of system-dependent graphics limits checked for using love.graphics.getSystemLimits. -GraphicsLimit = { - ---The maximum size of points. - ['pointsize'] = 1, - ---The maximum width or height of Images and Canvases. - ['texturesize'] = 2, - ---The maximum number of simultaneously active canvases (via love.graphics.setCanvas.) - ['multicanvas'] = 3, - ---The maximum number of antialiasing samples for a Canvas. - ['canvasmsaa'] = 4, - ---The maximum number of layers in an Array texture. - ['texturelayers'] = 5, - ---The maximum width, height, or depth of a Volume texture. - ['volumetexturesize'] = 6, - ---The maximum width or height of a Cubemap texture. - ['cubetexturesize'] = 7, - ---The maximum amount of anisotropic filtering. Texture:setMipmapFilter internally clamps the given anisotropy value to the system's limit. - ['anisotropy'] = 8, -} ----Vertex map datatype for Data variant of Mesh:setVertexMap. -IndexDataType = { - ---The vertex map is array of unsigned word (16-bit). - ['uint16'] = 1, - ---The vertex map is array of unsigned dword (32-bit). - ['uint32'] = 2, -} ----Line join style. -LineJoin = { - ---The ends of the line segments beveled in an angle so that they join seamlessly. - ['miter'] = 1, - ---No cap applied to the ends of the line segments. - ['none'] = 2, - ---Flattens the point where line segments join together. - ['bevel'] = 3, -} ----The styles in which lines are drawn. -LineStyle = { - ---Draw rough lines. - ['rough'] = 1, - ---Draw smooth lines. - ['smooth'] = 2, -} ----How a Mesh's vertices are used when drawing. -MeshDrawMode = { - ---The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons. - ['fan'] = 1, - ---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. - ['strip'] = 2, - ---The vertices create unconnected triangles. - ['triangles'] = 3, - ---The vertices are drawn as unconnected points (see love.graphics.setPointSize.) - ['points'] = 4, -} ----Controls whether a Canvas has mipmaps, and its behaviour when it does. -MipmapMode = { - ---The Canvas has no mipmaps. - ['none'] = 1, - ---The Canvas has mipmaps. love.graphics.setCanvas can be used to render to a specific mipmap level, or Canvas:generateMipmaps can (re-)compute all mipmap levels based on the base level. - ['auto'] = 2, - ---The Canvas has mipmaps, and all mipmap levels will automatically be recomputed when switching away from the Canvas with love.graphics.setCanvas. - ['manual'] = 3, -} ----How newly created particles are added to the ParticleSystem. -ParticleInsertMode = { - ---Particles are inserted at the top of the ParticleSystem's list of particles. - ['top'] = 1, - ---Particles are inserted at the bottom of the ParticleSystem's list of particles. - ['bottom'] = 2, - ---Particles are inserted at random positions in the ParticleSystem's list of particles. - ['random'] = 3, -} ----Usage hints for SpriteBatches and Meshes to optimize data storage and access. -SpriteBatchUsage = { - ---The object's data will change occasionally during its lifetime. - ['dynamic'] = 1, - ---The object will not be modified after initial sprites or vertices are added. - ['static'] = 2, - ---The object data will always change between draws. - ['stream'] = 3, -} ----Graphics state stack types used with love.graphics.push. -StackType = { - ---The transformation stack (love.graphics.translate, love.graphics.rotate, etc.) - ['transform'] = 1, - ---All love.graphics state, including transform state. - ['all'] = 2, -} ----How a stencil function modifies the stencil values of pixels it touches. -StencilAction = { - ---The stencil value of a pixel will be replaced by the value specified in love.graphics.stencil, if any object touches the pixel. - ['replace'] = 1, - ---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. - ['increment'] = 2, - ---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. - ['decrement'] = 3, - ---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. - ['incrementwrap'] = 4, - ---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. - ['decrementwrap'] = 5, - ---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. - ['invert'] = 6, -} ----Types of textures (2D, cubemap, etc.) -TextureType = { - ---Regular 2D texture with width and height. - ['2d'] = 1, - ---Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues. - ['array'] = 2, - ---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. - ['cube'] = 3, - ---3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis. - ['volume'] = 4, -} ----The frequency at which a vertex shader fetches the vertex attribute's data from the Mesh when it's drawn. ---- ----Per-instance attributes can be used to render a Mesh many times with different positions, colors, or other attributes via a single love.graphics.drawInstanced call, without using the love_InstanceID vertex shader variable. -VertexAttributeStep = { - ---The vertex attribute will have a unique value for each vertex in the Mesh. - ['pervertex'] = 1, - ---The vertex attribute will have a unique value for each instance of the Mesh. - ['perinstance'] = 2, -} ----How Mesh geometry vertices are ordered. -VertexWinding = { - ---Clockwise. - ['cw'] = 1, - ---Counter-clockwise. - ['ccw'] = 2, -} ----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. -WrapMode = { - ---Clamp the texture. Appears only once. The area outside the texture's normal range is colored based on the edge pixels of the texture. - ['clamp'] = 1, - ---Repeat the texture. Fills the whole available extent. - ['repeat'] = 2, - ---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. - ['mirroredrepeat'] = 3, - ---Clamp the texture. Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.) - ['clampzero'] = 4, -} ----Applies the given Transform object to the current coordinate transformation. ---- ----This effectively multiplies the existing coordinate transformation's matrix with the Transform object's internal matrix to produce the new coordinate transformation. ----@param transform Transform @The Transform object to apply to the current graphics coordinate transform. -function m.applyTransform(transform) end - ----Draws a filled or unfilled arc at position (x, y). The arc is drawn from angle1 to angle2 in radians. The segments parameter determines how many segments are used to draw the arc. The more segments, the smoother the edge. ----@param drawmode DrawMode @How to draw the arc. ----@param x number @The position of the center along x-axis. ----@param y number @The position of the center along y-axis. ----@param radius number @Radius of the arc. ----@param angle1 number @The angle at which the arc begins. ----@param angle2 number @The angle at which the arc terminates. ----@param segments number @The number of segments used for drawing the arc. ----@overload fun(drawmode:DrawMode, arctype:ArcType, x:number, y:number, radius:number, angle1:number, angle2:number, segments:number):void -function m.arc(drawmode, x, y, radius, angle1, angle2, segments) end - ----Creates a screenshot once the current frame is done (after love.draw has finished). ---- ----Since this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what's drawn to the screen in that frame. ----@param filename string @The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats. ----@overload fun(callback:function):void ----@overload fun(channel:Channel):void -function m.captureScreenshot(filename) end - ----Draws a circle. ----@param mode DrawMode @How to draw the circle. ----@param x number @The position of the center along x-axis. ----@param y number @The position of the center along y-axis. ----@param radius number @The radius of the circle. ----@overload fun(mode:DrawMode, x:number, y:number, radius:number, segments:number):void -function m.circle(mode, x, y, radius) end - ----Clears the screen or active Canvas to the specified color. ---- ----This function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function. ---- ----Note that the scissor area bounds the cleared region. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ---- ----In versions prior to background color instead. ----@overload fun(r:number, g:number, b:number, a:number, clearstencil:boolean, cleardepth:boolean):void ----@overload fun(color:table, ...:table, clearstencil:boolean, cleardepth:boolean):void ----@overload fun(clearcolor:boolean, clearstencil:boolean, cleardepth:boolean):void -function m.clear() end - ----Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases. ---- ----If the active Canvas has just been changed and the 'replace' BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.discard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices. ---- ----On some desktop systems this function may do nothing. ----@param discardcolor boolean @Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active.) ----@param discardstencil boolean @Whether to discard the contents of the stencil buffer of the screen / active Canvas. ----@overload fun(discardcolors:table, discardstencil:boolean):void -function m.discard(discardcolor, discardstencil) end - ----Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, Text object, or Video) on the screen with optional rotation, scaling and shearing. ---- ----Objects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system. ---- ----It's possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline. ---- ----Note that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation. ---- ----The right and bottom edges of the object are shifted at an angle defined by the shearing factors. ---- ----When using the default shader anything drawn with this function will be tinted according to the currently selected color. Set it to pure white to preserve the object's original colors. ----@param drawable Drawable @A drawable object. ----@param x number @The position to draw the object (x-axis). ----@param y number @The position to draw the object (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@overload fun(texture:Texture, quad:Quad, x:number, y:number, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(drawable:Drawable, transform:Transform):void ----@overload fun(texture:Texture, quad:Quad, transform:Transform):void -function m.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky) end - ----Draws many instances of a Mesh with a single draw call, using hardware geometry instancing. ---- ----Each instance can have unique properties (positions, colors, etc.) but will not by default unless a custom per-instance vertex attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other. ---- ----Instancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check. ----@param mesh Mesh @The mesh to render. ----@param instancecount number @The number of instances to render. ----@param x number @The position to draw the instances (x-axis). ----@param y number @The position to draw the instances (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@overload fun(mesh:Mesh, instancecount:number, transform:Transform):void -function m.drawInstanced(mesh, instancecount, x, y, r, sx, sy, ox, oy, kx, ky) end - ----Draws a layer of an Array Texture. ----@param texture Texture @The Array Texture to draw. ----@param layerindex number @The index of the layer to use when drawing. ----@param x number @The position to draw the texture (x-axis). ----@param y number @The position to draw the texture (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@overload fun(texture:Texture, layerindex:number, quad:Quad, x:number, y:number, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(texture:Texture, layerindex:number, transform:Transform):void ----@overload fun(texture:Texture, layerindex:number, quad:Quad, transform:Transform):void -function m.drawLayer(texture, layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end - ----Draws an ellipse. ----@param mode DrawMode @How to draw the ellipse. ----@param x number @The position of the center along x-axis. ----@param y number @The position of the center along y-axis. ----@param radiusx number @The radius of the ellipse along the x-axis (half the ellipse's width). ----@param radiusy number @The radius of the ellipse along the y-axis (half the ellipse's height). ----@overload fun(mode:DrawMode, x:number, y:number, radiusx:number, radiusy:number, segments:number):void -function m.ellipse(mode, x, y, radiusx, radiusy) end - ----Immediately renders any pending automatically batched draws. ---- ----LÖVE will call this function internally as needed when most state is changed, so it is not necessary to manually call it. ---- ----The current batch will be automatically flushed by color), as well as Shader:send and methods on Textures which change their state. Using a different Image in consecutive love.graphics.draw calls will also flush the current batch. ---- ----SpriteBatches, ParticleSystems, Meshes, and Text objects do their own batching and do not affect automatic batching of other draws, aside from flushing the current batch when they're drawn. -function m.flushBatch() end - ----Gets the current background color. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@return number, number, number, number -function m.getBackgroundColor() end - ----Gets the blending mode. ----@return BlendMode, BlendAlphaMode -function m.getBlendMode() end - ----Gets the current target Canvas. ----@return Canvas -function m.getCanvas() end - ----Gets the available Canvas formats, and whether each is supported. ----@return table ----@overload fun(readable:boolean):table -function m.getCanvasFormats() end - ----Gets the current color. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@return number, number, number, number -function m.getColor() end - ----Gets the active color components used when drawing. Normally all 4 components are active unless love.graphics.setColorMask has been used. ---- ----The color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love.graphics.clear and Canvas:clear as well. ----@return boolean, boolean, boolean, boolean -function m.getColorMask() end - ----Gets the DPI scale factor of the window. ---- ----The DPI scale factor represents relative pixel density. The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.graphics.getDPIScale() would return 2 in that case. ---- ----The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. ---- ----The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. ----@return number -function m.getDPIScale() end - ----Returns the default scaling filters used with Images, Canvases, and Fonts. ----@return FilterMode, FilterMode, number -function m.getDefaultFilter() end - ----Gets the current depth test mode and whether writing to the depth buffer is enabled. ---- ----This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images. ----@return CompareMode, boolean -function m.getDepthMode() end - ----Gets the width and height in pixels of the window. ----@return number, number -function m.getDimensions() end - ----Gets the current Font object. ----@return Font -function m.getFont() end - ----Gets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing. ---- ----This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices. ----@return VertexWinding -function m.getFrontFaceWinding() end - ----Gets the height in pixels of the window. ----@return number -function m.getHeight() end - ----Gets the raw and compressed pixel formats usable for Images, and whether each is supported. ----@return table -function m.getImageFormats() end - ----Gets the line join style. ----@return LineJoin -function m.getLineJoin() end - ----Gets the line style. ----@return LineStyle -function m.getLineStyle() end - ----Gets the current line width. ----@return number -function m.getLineWidth() end - ----Gets whether back-facing triangles in a Mesh are culled. ---- ----Mesh face culling is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer. ----@return CullMode -function m.getMeshCullMode() end - ----Gets the height in pixels of the window. ---- ----The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getHeight for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelHeight only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). ----@return number -function m.getPixelHeight() end - ----Gets the width in pixels of the window. ---- ----The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). ----@return number -function m.getPixelWidth() end - ----Gets the point size. ----@return number -function m.getPointSize() end - ----Gets information about the system's video card and drivers. ----@return string, string, string, string -function m.getRendererInfo() end - ----Gets the current scissor box. ----@return number, number, number, number -function m.getScissor() end - ----Gets the current Shader. Returns nil if none is set. ----@return Shader -function m.getShader() end - ----Gets the current depth of the transform / state stack (the number of pushes without corresponding pops). ----@return number -function m.getStackDepth() end - ----Gets performance-related rendering statistics. ----@return table ----@overload fun(stats:table):table -function m.getStats() end - ----Gets the current stencil test configuration. ---- ----When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil. ---- ----Each Canvas has its own per-pixel stencil values. ----@return CompareMode, number -function m.getStencilTest() end - ----Gets the optional graphics features and whether they're supported on the system. ---- ----Some older or low-end systems don't always support all graphics features. ----@return table -function m.getSupported() end - ----Gets the system-dependent maximum values for love.graphics features. ----@return table -function m.getSystemLimits() end - ----Gets the available texture types, and whether each is supported. ----@return table -function m.getTextureTypes() end - ----Gets the width in pixels of the window. ----@return number -function m.getWidth() end - ----Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like love.graphics.setScissor. ---- ----The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. ---- ----The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). ----@param x number @The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. ----@param y number @The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. ----@param width number @The width of the rectangle to intersect with the existing scissor rectangle. ----@param height number @The height of the rectangle to intersect with the existing scissor rectangle. -function m.intersectScissor(x, y, width, height) end - ----Converts the given 2D position from screen-space into global coordinates. ---- ----This effectively applies the reverse of the current graphics transformations to the given position. A similar Transform:inverseTransformPoint method exists for Transform objects. ----@param screenX number @The x component of the screen-space position. ----@param screenY number @The y component of the screen-space position. ----@return number, number -function m.inverseTransformPoint(screenX, screenY) end - ----Gets whether the graphics module is able to be used. If it is not active, love.graphics function and method calls will not work correctly and may cause the program to crash. ----The graphics module is inactive if a window is not open, or if the app is in the background on iOS. Typically the app's execution will be automatically paused by the system, in the latter case. ----@return boolean -function m.isActive() end - ----Gets whether gamma-correct rendering is supported and enabled. It can be enabled by setting t.gammacorrect = true in love.conf. ---- ----Not all devices support gamma-correct rendering, in which case it will be automatically disabled and this function will return false. It is supported on desktop systems which have graphics cards that are capable of using OpenGL 3 / DirectX 10, and iOS devices that can use OpenGL ES 3. ----@return boolean -function m.isGammaCorrect() end - ----Gets whether wireframe mode is used when drawing. ----@return boolean -function m.isWireframe() end - ----Draws lines between points. ----@param x1 number @The position of first point on the x-axis. ----@param y1 number @The position of first point on the y-axis. ----@param x2 number @The position of second point on the x-axis. ----@param y2 number @The position of second point on the y-axis. ----@param ... number @You can continue passing point positions to draw a polyline. ----@overload fun(points:table):void -function m.line(x1, y1, x2, y2, ...) end - ----Creates a new array Image. ---- ----An array image / array texture is a single object which contains multiple 'layers' or 'slices' of 2D sub-images. It can be thought of similarly to a texture atlas or sprite sheet, but it doesn't suffer from the same tile / quad bleeding artifacts that texture atlases do – although every sub-image must have the same dimensions. ---- ----A specific layer of an array image can be drawn with love.graphics.drawLayer / SpriteBatch:addLayer, or with the Quad variant of love.graphics.draw and Quad:setLayer, or via a custom Shader. ---- ----To use an array image in a Shader, it must be declared as a ArrayImage or sampler2DArray type (instead of Image or sampler2D). The Texel(ArrayImage image, vec3 texturecoord) shader function must be used to get pixel colors from a slice of the array image. The vec3 argument contains the texture coordinate in the first two components, and the 0-based slice index in the third component. ----@param slices table @A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each sub-image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the slice index of that sub-table. ----@param settings table @Optional table of settings to configure the array image, containing the following fields: ----@return Image -function m.newArrayImage(slices, settings) end - ----Creates a new Canvas object for offscreen rendering. ----@return Canvas ----@overload fun(width:number, height:number):Canvas ----@overload fun(width:number, height:number, settings:table):Canvas ----@overload fun(width:number, height:number, layers:number, settings:table):Canvas -function m.newCanvas() end - ----Creates a new cubemap Image. ---- ----Cubemap images have 6 faces (sides) which represent a cube. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send). ---- ----To use a cubemap image in a Shader, it must be declared as a CubeImage or samplerCube type (instead of Image or sampler2D). The Texel(CubeImage image, vec3 direction) shader function must be used to get pixel colors from the cubemap. The vec3 argument is a normalized direction from the center of the cube, rather than explicit texture coordinates. ---- ----Each face in a cubemap image must have square dimensions. ---- ----For variants of this function which accept a single image containing multiple cubemap faces, they must be laid out in one of the following forms in the image: ---- ---- +y ---- ----+z +x -z ---- ---- -y ---- ---- -x ---- ----or: ---- ---- +y ---- -----x +z +x -z ---- ---- -y ---- ----or: ---- ----+x ---- -----x ---- ----+y ---- -----y ---- ----+z ---- -----z ---- ----or: ---- ----+x -x +y -y +z -z ----@param filename string @The filepath to a cubemap image file (or a File, FileData, or ImageData). ----@param settings table @Optional table of settings to configure the cubemap image, containing the following fields: ----@return Image ----@overload fun(faces:table, settings:table):Image -function m.newCubeImage(filename, settings) end - ----Creates a new Font from a TrueType Font or BMFont file. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object. ---- ----All variants which accept a filename can also accept a Data object instead. ----@param filename string @The filepath to the BMFont or TrueType font file. ----@return Font ----@overload fun(filename:string, size:number, hinting:HintingMode, dpiscale:number):Font ----@overload fun(filename:string, imagefilename:string):Font ----@overload fun(size:number, hinting:HintingMode, dpiscale:number):Font -function m.newFont(filename) end - ----Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image. ----@param filename string @The filepath to the image file. ----@return Image ----@overload fun(imageData:ImageData):Image ----@overload fun(compressedImageData:CompressedImageData):Image ----@overload fun(filename:string, flags:table):Image -function m.newImage(filename) end - ----Creates a new specifically formatted image. ---- ----In versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string. ----@param filename string @The filepath to the image file. ----@param glyphs string @A string of the characters in the image in order from left to right. ----@return Font ----@overload fun(imageData:ImageData, glyphs:string):Font ----@overload fun(filename:string, glyphs:string, extraspacing:number):Font -function m.newImageFont(filename, glyphs) end - ----Creates a new Mesh. ---- ----Use Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it's drawn. ---- ----In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. ----@param vertices table @The table filled with vertex information tables for each vertex as follows: ----@param mode MeshDrawMode @How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. ----@param usage SpriteBatchUsage @The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. ----@return Mesh ----@overload fun(vertexcount:number, mode:MeshDrawMode, usage:SpriteBatchUsage):Mesh ----@overload fun(vertexformat:table, vertices:table, mode:MeshDrawMode, usage:SpriteBatchUsage):Mesh ----@overload fun(vertexformat:table, vertexcount:number, mode:MeshDrawMode, usage:SpriteBatchUsage):Mesh ----@overload fun(vertexcount:number, texture:Texture, mode:MeshDrawMode):Mesh -function m.newMesh(vertices, mode, usage) end - ----Creates a new ParticleSystem. ----@param image Image @The image to use. ----@param buffer number @The max number of particles at the same time. ----@return ParticleSystem ----@overload fun(texture:Texture, buffer:number):ParticleSystem -function m.newParticleSystem(image, buffer) end - ----Creates a new Quad. ---- ----The purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation. ----@param x number @The top-left position in the Image along the x-axis. ----@param y number @The top-left position in the Image along the y-axis. ----@param width number @The width of the Quad in the Image. (Must be greater than 0.) ----@param height number @The height of the Quad in the Image. (Must be greater than 0.) ----@param sw number @The reference width, the width of the Image. (Must be greater than 0.) ----@param sh number @The reference height, the height of the Image. (Must be greater than 0.) ----@return Quad -function m.newQuad(x, y, width, height, sw, sh) end - ----Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both. ---- ----Shaders are small programs which are run on the graphics card when drawing. Vertex shaders are run once for each vertex (for example, an image has 4 vertices - one at each corner. A Mesh might have many more.) Pixel shaders are run once for each pixel on the screen which the drawn object touches. Pixel shader code is executed after all the object's vertices have been processed by the vertex shader. ----@param code string @The pixel shader or vertex shader code, or a filename pointing to a file with the code. ----@return Shader ----@overload fun(pixelcode:string, vertexcode:string):Shader -function m.newShader(code) end - ----Creates a new SpriteBatch object. ----@param image Image @The Image to use for the sprites. ----@param maxsprites number @The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch. ----@return SpriteBatch ----@overload fun(image:Image, maxsprites:number, usage:SpriteBatchUsage):SpriteBatch ----@overload fun(texture:Texture, maxsprites:number, usage:SpriteBatchUsage):SpriteBatch -function m.newSpriteBatch(image, maxsprites) end - ----Creates a new drawable Text object. ----@param font Font @The font to use for the text. ----@param textstring string @The initial string of text that the new Text object will contain. May be nil. ----@return Text -function m.newText(font, textstring) end - ----Creates a new drawable Video. Currently only Ogg Theora video files are supported. ----@param filename string @The file path to the Ogg Theora video file. ----@return Video ----@overload fun(videostream:VideoStream):Video ----@overload fun(filename:string, settings:table):Video ----@overload fun(filename:string, loadaudio:boolean):Video ----@overload fun(videostream:VideoStream, loadaudio:boolean):Video -function m.newVideo(filename) end - ----Creates a new volume (3D) Image. ---- ----Volume images are 3D textures with width, height, and depth. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send). ---- ----To use a volume image in a Shader, it must be declared as a VolumeImage or sampler3D type (instead of Image or sampler2D). The Texel(VolumeImage image, vec3 texcoords) shader function must be used to get pixel colors from the volume image. The vec3 argument is a normalized texture coordinate with the z component representing the depth to sample at (ranging from 1). ---- ----Volume images are typically used as lookup tables in shaders for color grading, for example, because sampling using a texture coordinate that is partway in between two pixels can interpolate across all 3 dimensions in the volume image, resulting in a smooth gradient even when a small-sized volume image is used as the lookup table. ---- ----Array images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them. ----@param layers table @A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap. ----@param settings table @Optional table of settings to configure the volume image, containing the following fields: ----@return Image -function m.newVolumeImage(layers, settings) end - ----Resets the current coordinate transformation. ---- ----This function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults. -function m.origin() end - ----Draws one or more points. ----@param x number @The position of the first point on the x-axis. ----@param y number @The position of the first point on the y-axis. ----@param ... number @The x and y coordinates of additional points. ----@overload fun(points:table):void ----@overload fun(points:table):void -function m.points(x, y, ...) end - ----Draw a polygon. ---- ----Following the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon's vertices. ----@param mode DrawMode @How to draw the polygon. ----@param ... number @The vertices of the polygon. ----@overload fun(mode:DrawMode, vertices:table):void -function m.polygon(mode, ...) end - ----Pops the current coordinate transformation from the transformation stack. ---- ----This function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push. -function m.pop() end - ----Displays the results of drawing operations on the screen. ---- ----This function is used when writing your own love.run function. It presents all the results of your drawing operations on the screen. See the example in love.run for a typical use of this function. -function m.present() end - ----Draws text on screen. If no Font is set, one will be created and set (once) if needed. ---- ----As of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don't script with this in mind, the text won't be in the right position, or possibly even on screen. ---- ----love.graphics.print and love.graphics.printf both support UTF-8 encoding. You'll also need a proper Font for special characters. ---- ----In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. ----@param text string @The text to draw. ----@param x number @The position to draw the object (x-axis). ----@param y number @The position to draw the object (y-axis). ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@overload fun(coloredtext:table, x:number, y:number, angle:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(text:string, transform:Transform):void ----@overload fun(coloredtext:table, transform:Transform):void ----@overload fun(text:string, font:Font, transform:Transform):void ----@overload fun(coloredtext:table, font:Font, transform:Transform):void -function m.print(text, x, y, r, sx, sy, ox, oy, kx, ky) end - ----Draws formatted text, with word wrap and alignment. ---- ----See additional notes in love.graphics.print. ---- ----The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. ---- ----In version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case. ---- ----In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. ----@param text string @A text string. ----@param x number @The position on the x-axis. ----@param y number @The position on the y-axis. ----@param limit number @Wrap the line after this many horizontal pixels. ----@param align AlignMode @The alignment. ----@param r number @Orientation (radians). ----@param sx number @Scale factor (x-axis). ----@param sy number @Scale factor (y-axis). ----@param ox number @Origin offset (x-axis). ----@param oy number @Origin offset (y-axis). ----@param kx number @Shearing factor (x-axis). ----@param ky number @Shearing factor (y-axis). ----@overload fun(text:string, font:Font, x:number, y:number, limit:number, align:AlignMode, r:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(text:string, transform:Transform, limit:number, align:AlignMode):void ----@overload fun(text:string, font:Font, transform:Transform, limit:number, align:AlignMode):void ----@overload fun(coloredtext:table, x:number, y:number, limit:number, align:AlignMode, angle:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(coloredtext:table, font:Font, x:number, y:number, limit:number, align:AlignMode, angle:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):void ----@overload fun(coloredtext:table, transform:Transform, limit:number, align:AlignMode):void ----@overload fun(coloredtext:table, font:Font, transform:Transform, limit:number, align:AlignMode):void -function m.printf(text, x, y, limit, align, r, sx, sy, ox, oy, kx, ky) end - ----Copies and pushes the current coordinate transformation to the transformation stack. ---- ----This function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push. ----@overload fun(stack:StackType):void -function m.push() end - ----Draws a rectangle. ----@param mode DrawMode @How to draw the rectangle. ----@param x number @The position of top-left corner along the x-axis. ----@param y number @The position of top-left corner along the y-axis. ----@param width number @Width of the rectangle. ----@param height number @Height of the rectangle. ----@overload fun(mode:DrawMode, x:number, y:number, width:number, height:number, rx:number, ry:number, segments:number):void -function m.rectangle(mode, x, y, width, height) end - ----Replaces the current coordinate transformation with the given Transform object. ----@param transform Transform @The Transform object to replace the current graphics coordinate transform with. -function m.replaceTransform(transform) end - ----Resets the current graphics settings. ---- ----Calling reset makes the current drawing color white, the current background color black, disables any active color component masks, disables wireframe mode and resets the current graphics transformation to the origin. It also sets both the point and line drawing modes to smooth and their sizes to 1.0. -function m.reset() end - ----Rotates the coordinate system in two dimensions. ---- ----Calling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw() exits. ----@param angle number @The amount to rotate the coordinate system in radians. -function m.rotate(angle) end - ----Scales the coordinate system in two dimensions. ---- ----By default the coordinate system in LÖVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation. ---- ----After scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation. ---- ----Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. ---- ----Scaling lasts until love.draw() exits. ----@param sx number @The scaling in the direction of the x-axis. ----@param sy number @The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx. -function m.scale(sx, sy) end - ----Sets the background color. ----@param red number @The red component (0-1). ----@param green number @The green component (0-1). ----@param blue number @The blue component (0-1). ----@param alpha number @The alpha component (0-1). -function m.setBackgroundColor(red, green, blue, alpha) end - ----Sets the blending mode. ----@param mode BlendMode @The blend mode to use. ----@overload fun(mode:BlendMode, alphamode:BlendAlphaMode):void -function m.setBlendMode(mode) end - ----Captures drawing operations to a Canvas. ----@param canvas Canvas @The new target. ----@param mipmap number @The mipmap level to render to, for Canvases with mipmaps. ----@overload fun(canvas1:Canvas, canvas2:Canvas, ...:Canvas):void ----@overload fun(canvas:Canvas, slice:number, mipmap:number):void ----@overload fun(setup:table):void -function m.setCanvas(canvas, mipmap) end - ----Sets the color used for drawing. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param red number @The amount of red. ----@param green number @The amount of green. ----@param blue number @The amount of blue. ----@param alpha number @The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image. ----@overload fun(rgba:table):void -function m.setColor(red, green, blue, alpha) end - ----Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if '''red''' is set to '''false''', no further changes will be made to the red component of any pixels. ----@param red boolean @Render red component. ----@param green boolean @Render green component. ----@param blue boolean @Render blue component. ----@param alpha boolean @Render alpha component. -function m.setColorMask(red, green, blue, alpha) end - ----Sets the default scaling filters used with Images, Canvases, and Fonts. ----@param min FilterMode @Filter mode used when scaling the image down. ----@param mag FilterMode @Filter mode used when scaling the image up. ----@param anisotropy number @Maximum amount of Anisotropic Filtering used. -function m.setDefaultFilter(min, mag, anisotropy) end - ----Configures depth testing and writing to the depth buffer. ---- ----This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images. ----@param comparemode CompareMode @Depth comparison mode used for depth testing. ----@param write boolean @Whether to write update / write values to the depth buffer when rendering. -function m.setDepthMode(comparemode, write) end - ----Set an already-loaded Font as the current font or create and load a new one from the file and size. ---- ----It's recommended that Font objects are created with love.graphics.newFont in the loading stage and then passed to this function in the drawing stage. ----@param font Font @The Font object to use. -function m.setFont(font) end - ----Sets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing. ---- ----This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices. ----@param winding VertexWinding @The winding mode to use. The default winding is counterclockwise ('ccw'). -function m.setFrontFaceWinding(winding) end - ----Sets the line join style. See LineJoin for the possible options. ----@param join LineJoin @The LineJoin to use. -function m.setLineJoin(join) end - ----Sets the line style. ----@param style LineStyle @The LineStyle to use. Line styles include smooth and rough. -function m.setLineStyle(style) end - ----Sets the line width. ----@param width number @The width of the line. -function m.setLineWidth(width) end - ----Sets whether back-facing triangles in a Mesh are culled. ---- ----This is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer. ---- ----By default, both front- and back-facing triangles in Meshes are rendered. ----@param mode CullMode @The Mesh face culling mode to use (whether to render everything, cull back-facing triangles, or cull front-facing triangles). -function m.setMeshCullMode(mode) end - ----Creates and sets a new Font. ----@param size number @The size of the font. ----@return Font ----@overload fun(filename:string, size:number):Font ----@overload fun(file:File, size:number):Font ----@overload fun(data:Data, size:number):Font ----@overload fun(rasterizer:Rasterizer):Font -function m.setNewFont(size) end - ----Sets the point size. ----@param size number @The new point size. -function m.setPointSize(size) end - ----Sets or disables scissor. ---- ----The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. ---- ----The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). ----@param x number @x coordinate of upper left corner. ----@param y number @y coordinate of upper left corner. ----@param width number @width of clipping rectangle. ----@param height number @height of clipping rectangle. -function m.setScissor(x, y, width, height) end - ----Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next ''love.graphics.setShader'' will be drawn using the Shader object specified. ----@param shader Shader @The new shader. -function m.setShader(shader) end - ----Configures or disables stencil testing. ---- ----When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil. ----@param comparemode CompareMode @The type of comparison to make for each pixel. ----@param comparevalue number @The value to use when comparing with the stencil value of each pixel. Must be between 0 and 255. -function m.setStencilTest(comparemode, comparevalue) end - ----Sets whether wireframe lines will be used when drawing. ----@param enable boolean @True to enable wireframe mode when drawing, false to disable it. -function m.setWireframe(enable) end - ----Shears the coordinate system. ----@param kx number @The shear factor on the x-axis. ----@param ky number @The shear factor on the y-axis. -function m.shear(kx, ky) end - ----Draws geometry as a stencil. ---- ----The geometry drawn by the supplied function sets invisible stencil values of pixels, instead of setting pixel colors. The stencil buffer (which contains those stencil values) can act like a mask / stencil - love.graphics.setStencilTest can be used afterward to determine how further rendering is affected by the stencil values in each pixel. ---- ----Stencil values are integers within the range of 255. ----@param stencilfunction function @Function which draws geometry. The stencil values of pixels, rather than the color of each pixel, will be affected by the geometry. ----@param action StencilAction @How to modify any stencil values of pixels that are touched by what's drawn in the stencil function. ----@param value number @The new stencil value to use for pixels if the 'replace' stencil action is used. Has no effect with other stencil actions. Must be between 0 and 255. ----@param keepvalues boolean @True to preserve old stencil values of pixels, false to re-set every pixel's stencil value to 0 before executing the stencil function. love.graphics.clear will also re-set all stencil values. -function m.stencil(stencilfunction, action, value, keepvalues) end - ----Converts the given 2D position from global coordinates into screen-space. ---- ----This effectively applies the current graphics transformations to the given position. A similar Transform:transformPoint method exists for Transform objects. ----@param globalX number @The x component of the position in global coordinates. ----@param globalY number @The y component of the position in global coordinates. ----@return number, number -function m.transformPoint(globalX, globalY) end - ----Translates the coordinate system in two dimensions. ---- ----When this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy. ---- ----Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. ---- ----This change lasts until love.draw() exits or else a love.graphics.pop reverts to a previous love.graphics.push. ---- ----Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating. ----@param dx number @The translation relative to the x-axis. ----@param dy number @The translation relative to the y-axis. -function m.translate(dx, dy) end - ----Validates shader code. Check if specified shader code does not contain any errors. ----@param gles boolean @Validate code as GLSL ES shader. ----@param code string @The pixel shader or vertex shader code, or a filename pointing to a file with the code. ----@return boolean, string ----@overload fun(gles:boolean, pixelcode:string, vertexcode:string):boolean, string -function m.validateShader(gles, code) end - -return m \ No newline at end of file diff --git a/api/love.image.lua b/api/love.image.lua deleted file mode 100644 index 5b02b2d..0000000 --- a/api/love.image.lua +++ /dev/null @@ -1,364 +0,0 @@ ----@class love.image ----Provides an interface to decode encoded image data. -local m = {} - ---region CompressedImageData ----@class CompressedImageData ----Represents compressed image data designed to stay compressed in RAM. ---- ----CompressedImageData encompasses standard compressed texture formats such as DXT1, DXT5, and BC5 / 3Dc. ---- ----You can't draw CompressedImageData directly to the screen. See Image for that. -local CompressedImageData = {} ----Gets the width and height of the CompressedImageData. ----@return number, number ----@overload fun(level:number):number, number -function CompressedImageData:getDimensions() end - ----Gets the format of the CompressedImageData. ----@return CompressedImageFormat -function CompressedImageData:getFormat() end - ----Gets the height of the CompressedImageData. ----@return number ----@overload fun(level:number):number -function CompressedImageData:getHeight() end - ----Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count. ----@return number -function CompressedImageData:getMipmapCount() end - ----Gets the width of the CompressedImageData. ----@return number ----@overload fun(level:number):number -function CompressedImageData:getWidth() end - ---endregion CompressedImageData ---region ImageData ----@class ImageData ----Raw (decoded) image data. ---- ----You can't draw ImageData directly to screen. See Image for that. -local ImageData = {} ----Encodes the ImageData and optionally writes it to the save directory. ----@param format ImageFormat @The format to encode the image as. ----@param filename string @The filename to write the file to. If nil, no file will be written but the FileData will still be returned. ----@return FileData ----@overload fun(outFile:string):void ----@overload fun(outFile:string, format:ImageFormat):void -function ImageData:encode(format, filename) end - ----Gets the width and height of the ImageData in pixels. ----@return number, number -function ImageData:getDimensions() end - ----Gets the height of the ImageData in pixels. ----@return number -function ImageData:getHeight() end - ----Gets the color of a pixel at a specific position in the image. ---- ----Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param x number @The position of the pixel on the x-axis. ----@param y number @The position of the pixel on the y-axis. ----@return number, number, number, number -function ImageData:getPixel(x, y) end - ----Gets the width of the ImageData in pixels. ----@return number -function ImageData:getWidth() end - ----Transform an image by applying a function to every pixel. ---- ----This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData. ---- ----The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel. ---- ----function pixelFunction(x, y, r, g, b, a) ---- ---- -- template for defining your own pixel mapping function ---- ---- -- perform computations giving the new values for r, g, b and a ---- ---- -- ... ---- ---- return r, g, b, a ---- ----end ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param pixelFunction function @Function to apply to every pixel. ----@param x number @The x-axis of the top-left corner of the area within the ImageData to apply the function to. ----@param y number @The y-axis of the top-left corner of the area within the ImageData to apply the function to. ----@param width number @The width of the area within the ImageData to apply the function to. ----@param height number @The height of the area within the ImageData to apply the function to. -function ImageData:mapPixel(pixelFunction, x, y, width, height) end - ----Paste into ImageData from another source ImageData. ----@param source ImageData @Source ImageData from which to copy. ----@param dx number @Destination top-left position on x-axis. ----@param dy number @Destination top-left position on y-axis. ----@param sx number @Source top-left position on x-axis. ----@param sy number @Source top-left position on y-axis. ----@param sw number @Source width. ----@param sh number @Source height. -function ImageData:paste(source, dx, dy, sx, sy, sw, sh) end - ----Sets the color of a pixel at a specific position in the image. ---- ----Valid x and y values start at 0 and go up to image width and height minus 1. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param x number @The position of the pixel on the x-axis. ----@param y number @The position of the pixel on the y-axis. ----@param r number @The red component (0-1). ----@param g number @The green component (0-1). ----@param b number @The blue component (0-1). ----@param a number @The alpha component (0-1). -function ImageData:setPixel(x, y, r, g, b, a) end - ---endregion ImageData ----Compressed image data formats. Here and here are a couple overviews of many of the formats. ---- ----Unlike traditional PNG or jpeg, these formats stay compressed in RAM and in the graphics card's VRAM. This is good for saving memory space as well as improving performance, since the graphics card will be able to keep more of the image's pixels in its fast-access cache when drawing it. -CompressedImageFormat = { - ---The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems. - ['DXT1'] = 1, - ---The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format. - ['DXT3'] = 2, - ---The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems. - ['DXT5'] = 3, - ---The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel. - ['BC4'] = 4, - ---The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. - ['BC4s'] = 5, - ---The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel. - ['BC5'] = 6, - ---The signed variant of the BC5 format. - ['BC5s'] = 7, - ---The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems. - ['BC6h'] = 8, - ---The signed variant of the BC6H format. Stores RGB data in the range of +65504. - ['BC6hs'] = 9, - ---The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel. - ['BC7'] = 10, - ---The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices. - ['ETC1'] = 11, - ---The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices. - ['ETC2rgb'] = 12, - ---The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices. - ['ETC2rgba'] = 13, - ---The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel. - ['ETC2rgba1'] = 14, - ---The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel. - ['EACr'] = 15, - ---The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. - ['EACrs'] = 16, - ---The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel. - ['EACrg'] = 17, - ---The signed two-channel variant of the EAC format. - ['EACrgs'] = 18, - ---The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized. - ['PVR1rgb2'] = 19, - ---The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel. - ['PVR1rgb4'] = 20, - ---The 2 bit per pixel RGBA variant of the PVRTC1 format. - ['PVR1rgba2'] = 21, - ---The 4 bit per pixel RGBA variant of the PVRTC1 format. - ['PVR1rgba4'] = 22, - ---The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel. - ['ASTC4x4'] = 23, - ---The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel. - ['ASTC5x4'] = 24, - ---The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel. - ['ASTC5x5'] = 25, - ---The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel. - ['ASTC6x5'] = 26, - ---The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel. - ['ASTC6x6'] = 27, - ---The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel. - ['ASTC8x5'] = 28, - ---The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel. - ['ASTC8x6'] = 29, - ---The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel. - ['ASTC8x8'] = 30, - ---The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel. - ['ASTC10x5'] = 31, - ---The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel. - ['ASTC10x6'] = 32, - ---The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel. - ['ASTC10x8'] = 33, - ---The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel. - ['ASTC10x10'] = 34, - ---The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel. - ['ASTC12x10'] = 35, - ---The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel. - ['ASTC12x12'] = 36, -} ----Encoded image formats. -ImageFormat = { - ---Targa image format. - ['tga'] = 1, - ---PNG image format. - ['png'] = 2, - ---JPG image format. - ['jpg'] = 3, - ---BMP image format. - ['bmp'] = 4, -} ----Pixel formats for Textures, ImageData, and CompressedImageData. -PixelFormat = { - ---Indicates unknown pixel format, used internally. - ['unknown'] = 1, - ---Alias for rgba8, or srgba8 if gamma-correct rendering is enabled. - ['normal'] = 2, - ---A format suitable for high dynamic range content - an alias for the rgba16f format, normally. - ['hdr'] = 3, - ---Single-channel (red component) format (8 bpp). - ['r8'] = 4, - ---Two channels (red and green components) with 8 bits per channel (16 bpp). - ['rg8'] = 5, - ---8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders). - ['rgba8'] = 6, - ---gamma-correct version of rgba8. - ['srgba8'] = 7, - ---Single-channel (red component) format (16 bpp). - ['r16'] = 8, - ---Two channels (red and green components) with 16 bits per channel (32 bpp). - ['rg16'] = 9, - ---16 bits per channel (64 bpp) RGBA. Color channel values range from 0-65535 (0-1 in shaders). - ['rgba16'] = 10, - ---Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504]. - ['r16f'] = 11, - ---Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504]. - ['rg16f'] = 12, - ---Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504]. - ['rgba16f'] = 13, - ---Floating point single-channel format (32 bpp). - ['r32f'] = 14, - ---Floating point two-channel format with 32 bits per channel (64 bpp). - ['rg32f'] = 15, - ---Floating point RGBA with 32 bits per channel (128 bpp). - ['rgba32f'] = 16, - ---Same as rg8, but accessed as (L, L, L, A) - ['la8'] = 17, - ---4 bits per channel (16 bpp) RGBA. - ['rgba4'] = 18, - ---RGB with 5 bits each, and a 1-bit alpha channel (16 bpp). - ['rgb5a1'] = 19, - ---RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format. - ['rgb565'] = 20, - ---RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp). - ['rgb10a2'] = 21, - ---Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024]. - ['rg11b10f'] = 22, - ---No depth buffer and 8-bit stencil buffer. - ['stencil8'] = 23, - ---16-bit depth buffer and no stencil buffer. - ['depth16'] = 24, - ---24-bit depth buffer and no stencil buffer. - ['depth24'] = 25, - ---32-bit float depth buffer and no stencil buffer. - ['depth32f'] = 26, - ---24-bit depth buffer and 8-bit stencil buffer. - ['depth24stencil8'] = 27, - ---32-bit float depth buffer and 8-bit stencil buffer. - ['depth32fstencil8'] = 28, - ---The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images on desktop systems. - ['DXT1'] = 29, - ---The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format. - ['DXT3'] = 30, - ---The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems. - ['DXT5'] = 31, - ---The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel. - ['BC4'] = 32, - ---The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. - ['BC4s'] = 33, - ---The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel. - ['BC5'] = 34, - ---The signed variant of the BC5 format. - ['BC5s'] = 35, - ---The BC6H format. Stores half-precision floating-point RGB data in the range of 65504 at 8 bits per pixel. Suitable for HDR images on desktop systems. - ['BC6h'] = 36, - ---The signed variant of the BC6H format. Stores RGB data in the range of +65504. - ['BC6hs'] = 37, - ---The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel. - ['BC7'] = 38, - ---The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices. - ['ETC1'] = 39, - ---The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices. - ['ETC2rgb'] = 40, - ---The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices. - ['ETC2rgba'] = 41, - ---The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel. - ['ETC2rgba1'] = 42, - ---The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel. - ['EACr'] = 43, - ---The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of 1 instead of 1 in shaders. - ['EACrs'] = 44, - ---The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel. - ['EACrg'] = 45, - ---The signed two-channel variant of the EAC format. - ['EACrgs'] = 46, - ---The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized. - ['PVR1rgb2'] = 47, - ---The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel. - ['PVR1rgb4'] = 48, - ---The 2 bit per pixel RGBA variant of the PVRTC1 format. - ['PVR1rgba2'] = 49, - ---The 4 bit per pixel RGBA variant of the PVRTC1 format. - ['PVR1rgba4'] = 50, - ---The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel. - ['ASTC4x4'] = 51, - ---The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel. - ['ASTC5x4'] = 52, - ---The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel. - ['ASTC5x5'] = 53, - ---The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel. - ['ASTC6x5'] = 54, - ---The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel. - ['ASTC6x6'] = 55, - ---The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel. - ['ASTC8x5'] = 56, - ---The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel. - ['ASTC8x6'] = 57, - ---The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel. - ['ASTC8x8'] = 58, - ---The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel. - ['ASTC10x5'] = 59, - ---The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel. - ['ASTC10x6'] = 60, - ---The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel. - ['ASTC10x8'] = 61, - ---The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel. - ['ASTC10x10'] = 62, - ---The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel. - ['ASTC12x10'] = 63, - ---The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel. - ['ASTC12x12'] = 64, -} ----Determines whether a file can be loaded as CompressedImageData. ----@param filename string @The filename of the potentially compressed image file. ----@return boolean ----@overload fun(fileData:FileData):boolean -function m.isCompressed(filename) end - ----Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page. ----@param filename string @The filename of the compressed image file. ----@return CompressedImageData ----@overload fun(fileData:FileData):CompressedImageData -function m.newCompressedData(filename) end - ----Creates a new ImageData object. ----@param width number @The width of the ImageData. ----@param height number @The height of the ImageData. ----@return ImageData ----@overload fun(width:number, height:number, format:PixelFormat, data:string):ImageData ----@overload fun(width:number, height:number, data:string):ImageData ----@overload fun(filename:string):ImageData ----@overload fun(filedata:FileData):ImageData -function m.newImageData(width, height) end - -return m \ No newline at end of file diff --git a/api/love.joystick.lua b/api/love.joystick.lua deleted file mode 100644 index 19c96dd..0000000 --- a/api/love.joystick.lua +++ /dev/null @@ -1,229 +0,0 @@ ----@class love.joystick ----Provides an interface to the user's joystick. -local m = {} - ---region Joystick ----@class Joystick ----Represents a physical joystick. -local Joystick = {} ----Gets the direction of each axis. ----@return number, number, number -function Joystick:getAxes() end - ----Gets the direction of an axis. ----@param axis number @The index of the axis to be checked. ----@return number -function Joystick:getAxis(axis) end - ----Gets the number of axes on the joystick. ----@return number -function Joystick:getAxisCount() end - ----Gets the number of buttons on the joystick. ----@return number -function Joystick:getButtonCount() end - ----Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems. ---- ----Can be used to show different icons, etc. for different gamepads. ----@return number, number, number -function Joystick:getDeviceInfo() end - ----Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent. ----@return string -function Joystick:getGUID() end - ----Gets the direction of a virtual gamepad axis. If the Joystick isn't recognized as a gamepad or isn't connected, this function will always return 0. ----@param axis GamepadAxis @The virtual axis to be checked. ----@return number -function Joystick:getGamepadAxis(axis) end - ----Gets the button, axis or hat that a virtual gamepad input is bound to. ----@param axis GamepadAxis @The virtual gamepad axis to get the binding for. ----@return JoystickInputType, number, JoystickHat ----@overload fun(button:GamepadButton):JoystickInputType, number, JoystickHat -function Joystick:getGamepadMapping(axis) end - ----Gets the full gamepad mapping string of this Joystick, or nil if it's not recognized as a gamepad. ---- ----The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings. ----@return string -function Joystick:getGamepadMappingString() end - ----Gets the direction of the Joystick's hat. ----@param hat number @The index of the hat to be checked. ----@return JoystickHat -function Joystick:getHat(hat) end - ----Gets the number of hats on the joystick. ----@return number -function Joystick:getHatCount() end - ----Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it '''will''' change when the game is re-launched. ----@return number, number -function Joystick:getID() end - ----Gets the name of the joystick. ----@return string -function Joystick:getName() end - ----Gets the current vibration motor strengths on a Joystick with rumble support. ----@return number, number -function Joystick:getVibration() end - ----Gets whether the Joystick is connected. ----@return boolean -function Joystick:isConnected() end - ----Checks if a button on the Joystick is pressed. ---- ----LÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1. ----@param buttonN number @The index of a button to check. ----@return boolean -function Joystick:isDown(buttonN) end - ----Gets whether the Joystick is recognized as a gamepad. If this is the case, the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis, Joystick:isGamepadDown, love.gamepadpressed, and related functions. ---- ----LÖVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with love.joystick.setGamepadMapping. ----@return boolean -function Joystick:isGamepad() end - ----Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false. ----@param buttonN GamepadButton @The gamepad button to check. ----@return boolean -function Joystick:isGamepadDown(buttonN) end - ----Gets whether the Joystick supports vibration. ----@return boolean -function Joystick:isVibrationSupported() end - ----Sets the vibration motor speeds on a Joystick with rumble support. Most common gamepads have this functionality, although not all drivers give proper support. Use Joystick:isVibrationSupported to check. ----@param left number @Strength of the left vibration motor on the Joystick. Must be in the range of 1. ----@param right number @Strength of the right vibration motor on the Joystick. Must be in the range of 1. ----@return boolean ----@overload fun(left:number, right:number, duration:number):boolean -function Joystick:setVibration(left, right) end - ---endregion Joystick ----Virtual gamepad axes. -GamepadAxis = { - ---The x-axis of the left thumbstick. - ['leftx'] = 1, - ---The y-axis of the left thumbstick. - ['lefty'] = 2, - ---The x-axis of the right thumbstick. - ['rightx'] = 3, - ---The y-axis of the right thumbstick. - ['righty'] = 4, - ---Left analog trigger. - ['triggerleft'] = 5, - ---Right analog trigger. - ['triggerright'] = 6, -} ----Virtual gamepad buttons. -GamepadButton = { - ---Bottom face button (A). - ['a'] = 1, - ---Right face button (B). - ['b'] = 2, - ---Left face button (X). - ['x'] = 3, - ---Top face button (Y). - ['y'] = 4, - ---Back button. - ['back'] = 5, - ---Guide button. - ['guide'] = 6, - ---Start button. - ['start'] = 7, - ---Left stick click button. - ['leftstick'] = 8, - ---Right stick click button. - ['rightstick'] = 9, - ---Left bumper. - ['leftshoulder'] = 10, - ---Right bumper. - ['rightshoulder'] = 11, - ---D-pad up. - ['dpup'] = 12, - ---D-pad down. - ['dpdown'] = 13, - ---D-pad left. - ['dpleft'] = 14, - ---D-pad right. - ['dpright'] = 15, -} ----Joystick hat positions. -JoystickHat = { - ---Centered - ['c'] = 1, - ---Down - ['d'] = 2, - ---Left - ['l'] = 3, - ---Left+Down - ['ld'] = 4, - ---Left+Up - ['lu'] = 5, - ---Right - ['r'] = 6, - ---Right+Down - ['rd'] = 7, - ---Right+Up - ['ru'] = 8, - ---Up - ['u'] = 9, -} ----Types of Joystick inputs. -JoystickInputType = { - ---Analog axis. - ['axis'] = 1, - ---Button. - ['button'] = 2, - ---8-direction hat value. - ['hat'] = 3, -} ----Gets the full gamepad mapping string of the Joysticks which have the given GUID, or nil if the GUID isn't recognized as a gamepad. ---- ----The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings. ----@param guid string @The GUID value to get the mapping string for. ----@return string -function m.getGamepadMappingString(guid) end - ----Gets the number of connected joysticks. ----@return number -function m.getJoystickCount() end - ----Gets a list of connected Joysticks. ----@return table -function m.getJoysticks() end - ----Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings. ---- ----It also recognizes any SDL gamecontroller mapping string, such as those created with Steam's Big Picture controller configure interface, or this nice database. If a new mapping is loaded for an already known controller GUID, the later version will overwrite the one currently loaded. ----@param filename string @The filename to load the mappings string from. ----@overload fun(mappings:string):void -function m.loadGamepadMappings(filename) end - ----Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified. ---- ----The mappings are stored as a string for use with love.joystick.loadGamepadMappings. ----@param filename string @The filename to save the mappings string to. ----@return string -function m.saveGamepadMappings(filename) end - ----Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. For example, if this function is used with a GUID returned by a Dualshock 3 controller in OS X, the binding will affect Joystick:getGamepadAxis and Joystick:isGamepadDown for ''all'' Dualshock 3 controllers used with the game when run in OS X. ---- ----LÖVE includes built-in gamepad bindings for many common controllers. This function lets you change the bindings or add new ones for types of Joysticks which aren't recognized as gamepads by default. ---- ----The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout. ----@param guid string @The OS-dependent GUID for the type of Joystick the binding will affect. ----@param button GamepadButton @The virtual gamepad button to bind. ----@param inputtype JoystickInputType @The type of input to bind the virtual gamepad button to. ----@param inputindex number @The index of the axis, button, or hat to bind the virtual gamepad button to. ----@param hatdir JoystickHat @The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise. ----@return boolean ----@overload fun(guid:string, axis:GamepadAxis, inputtype:JoystickInputType, inputindex:number, hatdir:JoystickHat):boolean -function m.setGamepadMapping(guid, button, inputtype, inputindex, hatdir) end - -return m \ No newline at end of file diff --git a/api/love.keyboard.lua b/api/love.keyboard.lua deleted file mode 100644 index c2597bf..0000000 --- a/api/love.keyboard.lua +++ /dev/null @@ -1,744 +0,0 @@ ----@class love.keyboard ----Provides an interface to the user's keyboard. -local m = {} - ----All the keys you can press. Note that some keys may not be available on your keyboard or system. -KeyConstant = { - ---The A key - ['a'] = 1, - ---The B key - ['b'] = 2, - ---The C key - ['c'] = 3, - ---The D key - ['d'] = 4, - ---The E key - ['e'] = 5, - ---The F key - ['f'] = 6, - ---The G key - ['g'] = 7, - ---The H key - ['h'] = 8, - ---The I key - ['i'] = 9, - ---The J key - ['j'] = 10, - ---The K key - ['k'] = 11, - ---The L key - ['l'] = 12, - ---The M key - ['m'] = 13, - ---The N key - ['n'] = 14, - ---The O key - ['o'] = 15, - ---The P key - ['p'] = 16, - ---The Q key - ['q'] = 17, - ---The R key - ['r'] = 18, - ---The S key - ['s'] = 19, - ---The T key - ['t'] = 20, - ---The U key - ['u'] = 21, - ---The V key - ['v'] = 22, - ---The W key - ['w'] = 23, - ---The X key - ['x'] = 24, - ---The Y key - ['y'] = 25, - ---The Z key - ['z'] = 26, - ---The zero key - ['0'] = 27, - ---The one key - ['1'] = 28, - ---The two key - ['2'] = 29, - ---The three key - ['3'] = 30, - ---The four key - ['4'] = 31, - ---The five key - ['5'] = 32, - ---The six key - ['6'] = 33, - ---The seven key - ['7'] = 34, - ---The eight key - ['8'] = 35, - ---The nine key - ['9'] = 36, - ---Space key - ['space'] = 37, - ---Exclamation mark key - ['!'] = 38, - ---Double quote key - ['"'] = 39, - ---Hash key - ['#'] = 40, - ---Dollar key - ['$'] = 41, - ---Ampersand key - ['&'] = 42, - ---Single quote key - ['\''] = 43, - ---Left parenthesis key - ['('] = 44, - ---Right parenthesis key - [')'] = 45, - ---Asterisk key - ['*'] = 46, - ---Plus key - ['+'] = 47, - ---Comma key - [','] = 48, - ---Hyphen-minus key - ['-'] = 49, - ---Full stop key - ['.'] = 50, - ---Slash key - ['/'] = 51, - ---Colon key - [':'] = 52, - ---Semicolon key - [';'] = 53, - ---Less-than key - ['<'] = 54, - ---Equal key - ['='] = 55, - ---Greater-than key - ['>'] = 56, - ---Question mark key - ['?'] = 57, - ---At sign key - ['@'] = 58, - ---Left square bracket key - ['['] = 59, - ---Backslash key - ['\\'] = 60, - ---Right square bracket key - [']'] = 61, - ---Caret key - ['^'] = 62, - ---Underscore key - ['_'] = 63, - ---Grave accent key - ['`'] = 64, - ---The numpad zero key - ['kp0'] = 65, - ---The numpad one key - ['kp1'] = 66, - ---The numpad two key - ['kp2'] = 67, - ---The numpad three key - ['kp3'] = 68, - ---The numpad four key - ['kp4'] = 69, - ---The numpad five key - ['kp5'] = 70, - ---The numpad six key - ['kp6'] = 71, - ---The numpad seven key - ['kp7'] = 72, - ---The numpad eight key - ['kp8'] = 73, - ---The numpad nine key - ['kp9'] = 74, - ---The numpad decimal point key - ['kp.'] = 75, - ---The numpad division key - ['kp/'] = 76, - ---The numpad multiplication key - ['kp*'] = 77, - ---The numpad substraction key - ['kp-'] = 78, - ---The numpad addition key - ['kp+'] = 79, - ---The numpad enter key - ['kpenter'] = 80, - ---The numpad equals key - ['kp='] = 81, - ---Up cursor key - ['up'] = 82, - ---Down cursor key - ['down'] = 83, - ---Right cursor key - ['right'] = 84, - ---Left cursor key - ['left'] = 85, - ---Home key - ['home'] = 86, - ---End key - ['end'] = 87, - ---Page up key - ['pageup'] = 88, - ---Page down key - ['pagedown'] = 89, - ---Insert key - ['insert'] = 90, - ---Backspace key - ['backspace'] = 91, - ---Tab key - ['tab'] = 92, - ---Clear key - ['clear'] = 93, - ---Return key - ['return'] = 94, - ---Delete key - ['delete'] = 95, - ---The 1st function key - ['f1'] = 96, - ---The 2nd function key - ['f2'] = 97, - ---The 3rd function key - ['f3'] = 98, - ---The 4th function key - ['f4'] = 99, - ---The 5th function key - ['f5'] = 100, - ---The 6th function key - ['f6'] = 101, - ---The 7th function key - ['f7'] = 102, - ---The 8th function key - ['f8'] = 103, - ---The 9th function key - ['f9'] = 104, - ---The 10th function key - ['f10'] = 105, - ---The 11th function key - ['f11'] = 106, - ---The 12th function key - ['f12'] = 107, - ---The 13th function key - ['f13'] = 108, - ---The 14th function key - ['f14'] = 109, - ---The 15th function key - ['f15'] = 110, - ---Num-lock key - ['numlock'] = 111, - ---Caps-lock key - ['capslock'] = 112, - ---Scroll-lock key - ['scrollock'] = 113, - ---Right shift key - ['rshift'] = 114, - ---Left shift key - ['lshift'] = 115, - ---Right control key - ['rctrl'] = 116, - ---Left control key - ['lctrl'] = 117, - ---Right alt key - ['ralt'] = 118, - ---Left alt key - ['lalt'] = 119, - ---Right meta key - ['rmeta'] = 120, - ---Left meta key - ['lmeta'] = 121, - ---Left super key - ['lsuper'] = 122, - ---Right super key - ['rsuper'] = 123, - ---Mode key - ['mode'] = 124, - ---Compose key - ['compose'] = 125, - ---Pause key - ['pause'] = 126, - ---Escape key - ['escape'] = 127, - ---Help key - ['help'] = 128, - ---Print key - ['print'] = 129, - ---System request key - ['sysreq'] = 130, - ---Break key - ['break'] = 131, - ---Menu key - ['menu'] = 132, - ---Power key - ['power'] = 133, - ---Euro (€) key - ['euro'] = 134, - ---Undo key - ['undo'] = 135, - ---WWW key - ['www'] = 136, - ---Mail key - ['mail'] = 137, - ---Calculator key - ['calculator'] = 138, - ---Application search key - ['appsearch'] = 139, - ---Application home key - ['apphome'] = 140, - ---Application back key - ['appback'] = 141, - ---Application forward key - ['appforward'] = 142, - ---Application refresh key - ['apprefresh'] = 143, - ---Application bookmarks key - ['appbookmarks'] = 144, -} ----Keyboard scancodes. ---- ----Scancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. ---- ----Using scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate 'unknown' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support. ---- ----One could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can't get modifiers on their own from it, only the final symbols that were generated. -Scancode = { - ---The 'A' key on an American layout. - ['a'] = 1, - ---The 'B' key on an American layout. - ['b'] = 2, - ---The 'C' key on an American layout. - ['c'] = 3, - ---The 'D' key on an American layout. - ['d'] = 4, - ---The 'E' key on an American layout. - ['e'] = 5, - ---The 'F' key on an American layout. - ['f'] = 6, - ---The 'G' key on an American layout. - ['g'] = 7, - ---The 'H' key on an American layout. - ['h'] = 8, - ---The 'I' key on an American layout. - ['i'] = 9, - ---The 'J' key on an American layout. - ['j'] = 10, - ---The 'K' key on an American layout. - ['k'] = 11, - ---The 'L' key on an American layout. - ['l'] = 12, - ---The 'M' key on an American layout. - ['m'] = 13, - ---The 'N' key on an American layout. - ['n'] = 14, - ---The 'O' key on an American layout. - ['o'] = 15, - ---The 'P' key on an American layout. - ['p'] = 16, - ---The 'Q' key on an American layout. - ['q'] = 17, - ---The 'R' key on an American layout. - ['r'] = 18, - ---The 'S' key on an American layout. - ['s'] = 19, - ---The 'T' key on an American layout. - ['t'] = 20, - ---The 'U' key on an American layout. - ['u'] = 21, - ---The 'V' key on an American layout. - ['v'] = 22, - ---The 'W' key on an American layout. - ['w'] = 23, - ---The 'X' key on an American layout. - ['x'] = 24, - ---The 'Y' key on an American layout. - ['y'] = 25, - ---The 'Z' key on an American layout. - ['z'] = 26, - ---The '1' key on an American layout. - ['1'] = 27, - ---The '2' key on an American layout. - ['2'] = 28, - ---The '3' key on an American layout. - ['3'] = 29, - ---The '4' key on an American layout. - ['4'] = 30, - ---The '5' key on an American layout. - ['5'] = 31, - ---The '6' key on an American layout. - ['6'] = 32, - ---The '7' key on an American layout. - ['7'] = 33, - ---The '8' key on an American layout. - ['8'] = 34, - ---The '9' key on an American layout. - ['9'] = 35, - ---The '0' key on an American layout. - ['0'] = 36, - ---The 'return' / 'enter' key on an American layout. - ['return'] = 37, - ---The 'escape' key on an American layout. - ['escape'] = 38, - ---The 'backspace' key on an American layout. - ['backspace'] = 39, - ---The 'tab' key on an American layout. - ['tab'] = 40, - ---The spacebar on an American layout. - ['space'] = 41, - ---The minus key on an American layout. - ['-'] = 42, - ---The equals key on an American layout. - ['='] = 43, - ---The left-bracket key on an American layout. - ['['] = 44, - ---The right-bracket key on an American layout. - [']'] = 45, - ---The backslash key on an American layout. - ['\\'] = 46, - ---The non-U.S. hash scancode. - ['nonus#'] = 47, - ---The semicolon key on an American layout. - [';'] = 48, - ---The apostrophe key on an American layout. - ['\''] = 49, - ---The back-tick / grave key on an American layout. - ['`'] = 50, - ---The comma key on an American layout. - [','] = 51, - ---The period key on an American layout. - ['.'] = 52, - ---The forward-slash key on an American layout. - ['/'] = 53, - ---The capslock key on an American layout. - ['capslock'] = 54, - ---The F1 key on an American layout. - ['f1'] = 55, - ---The F2 key on an American layout. - ['f2'] = 56, - ---The F3 key on an American layout. - ['f3'] = 57, - ---The F4 key on an American layout. - ['f4'] = 58, - ---The F5 key on an American layout. - ['f5'] = 59, - ---The F6 key on an American layout. - ['f6'] = 60, - ---The F7 key on an American layout. - ['f7'] = 61, - ---The F8 key on an American layout. - ['f8'] = 62, - ---The F9 key on an American layout. - ['f9'] = 63, - ---The F10 key on an American layout. - ['f10'] = 64, - ---The F11 key on an American layout. - ['f11'] = 65, - ---The F12 key on an American layout. - ['f12'] = 66, - ---The F13 key on an American layout. - ['f13'] = 67, - ---The F14 key on an American layout. - ['f14'] = 68, - ---The F15 key on an American layout. - ['f15'] = 69, - ---The F16 key on an American layout. - ['f16'] = 70, - ---The F17 key on an American layout. - ['f17'] = 71, - ---The F18 key on an American layout. - ['f18'] = 72, - ---The F19 key on an American layout. - ['f19'] = 73, - ---The F20 key on an American layout. - ['f20'] = 74, - ---The F21 key on an American layout. - ['f21'] = 75, - ---The F22 key on an American layout. - ['f22'] = 76, - ---The F23 key on an American layout. - ['f23'] = 77, - ---The F24 key on an American layout. - ['f24'] = 78, - ---The left control key on an American layout. - ['lctrl'] = 79, - ---The left shift key on an American layout. - ['lshift'] = 80, - ---The left alt / option key on an American layout. - ['lalt'] = 81, - ---The left GUI (command / windows / super) key on an American layout. - ['lgui'] = 82, - ---The right control key on an American layout. - ['rctrl'] = 83, - ---The right shift key on an American layout. - ['rshift'] = 84, - ---The right alt / option key on an American layout. - ['ralt'] = 85, - ---The right GUI (command / windows / super) key on an American layout. - ['rgui'] = 86, - ---The printscreen key on an American layout. - ['printscreen'] = 87, - ---The scroll-lock key on an American layout. - ['scrolllock'] = 88, - ---The pause key on an American layout. - ['pause'] = 89, - ---The insert key on an American layout. - ['insert'] = 90, - ---The home key on an American layout. - ['home'] = 91, - ---The numlock / clear key on an American layout. - ['numlock'] = 92, - ---The page-up key on an American layout. - ['pageup'] = 93, - ---The forward-delete key on an American layout. - ['delete'] = 94, - ---The end key on an American layout. - ['end'] = 95, - ---The page-down key on an American layout. - ['pagedown'] = 96, - ---The right-arrow key on an American layout. - ['right'] = 97, - ---The left-arrow key on an American layout. - ['left'] = 98, - ---The down-arrow key on an American layout. - ['down'] = 99, - ---The up-arrow key on an American layout. - ['up'] = 100, - ---The non-U.S. backslash scancode. - ['nonusbackslash'] = 101, - ---The application key on an American layout. Windows contextual menu, compose key. - ['application'] = 102, - ---The 'execute' key on an American layout. - ['execute'] = 103, - ---The 'help' key on an American layout. - ['help'] = 104, - ---The 'menu' key on an American layout. - ['menu'] = 105, - ---The 'select' key on an American layout. - ['select'] = 106, - ---The 'stop' key on an American layout. - ['stop'] = 107, - ---The 'again' key on an American layout. - ['again'] = 108, - ---The 'undo' key on an American layout. - ['undo'] = 109, - ---The 'cut' key on an American layout. - ['cut'] = 110, - ---The 'copy' key on an American layout. - ['copy'] = 111, - ---The 'paste' key on an American layout. - ['paste'] = 112, - ---The 'find' key on an American layout. - ['find'] = 113, - ---The keypad forward-slash key on an American layout. - ['kp/'] = 114, - ---The keypad '*' key on an American layout. - ['kp*'] = 115, - ---The keypad minus key on an American layout. - ['kp-'] = 116, - ---The keypad plus key on an American layout. - ['kp+'] = 117, - ---The keypad equals key on an American layout. - ['kp='] = 118, - ---The keypad enter key on an American layout. - ['kpenter'] = 119, - ---The keypad '1' key on an American layout. - ['kp1'] = 120, - ---The keypad '2' key on an American layout. - ['kp2'] = 121, - ---The keypad '3' key on an American layout. - ['kp3'] = 122, - ---The keypad '4' key on an American layout. - ['kp4'] = 123, - ---The keypad '5' key on an American layout. - ['kp5'] = 124, - ---The keypad '6' key on an American layout. - ['kp6'] = 125, - ---The keypad '7' key on an American layout. - ['kp7'] = 126, - ---The keypad '8' key on an American layout. - ['kp8'] = 127, - ---The keypad '9' key on an American layout. - ['kp9'] = 128, - ---The keypad '0' key on an American layout. - ['kp0'] = 129, - ---The keypad period key on an American layout. - ['kp.'] = 130, - ---The 1st international key on an American layout. Used on Asian keyboards. - ['international1'] = 131, - ---The 2nd international key on an American layout. - ['international2'] = 132, - ---The 3rd international key on an American layout. Yen. - ['international3'] = 133, - ---The 4th international key on an American layout. - ['international4'] = 134, - ---The 5th international key on an American layout. - ['international5'] = 135, - ---The 6th international key on an American layout. - ['international6'] = 136, - ---The 7th international key on an American layout. - ['international7'] = 137, - ---The 8th international key on an American layout. - ['international8'] = 138, - ---The 9th international key on an American layout. - ['international9'] = 139, - ---Hangul/English toggle scancode. - ['lang1'] = 140, - ---Hanja conversion scancode. - ['lang2'] = 141, - ---Katakana scancode. - ['lang3'] = 142, - ---Hiragana scancode. - ['lang4'] = 143, - ---Zenkaku/Hankaku scancode. - ['lang5'] = 144, - ---The mute key on an American layout. - ['mute'] = 145, - ---The volume up key on an American layout. - ['volumeup'] = 146, - ---The volume down key on an American layout. - ['volumedown'] = 147, - ---The audio next track key on an American layout. - ['audionext'] = 148, - ---The audio previous track key on an American layout. - ['audioprev'] = 149, - ---The audio stop key on an American layout. - ['audiostop'] = 150, - ---The audio play key on an American layout. - ['audioplay'] = 151, - ---The audio mute key on an American layout. - ['audiomute'] = 152, - ---The media select key on an American layout. - ['mediaselect'] = 153, - ---The 'WWW' key on an American layout. - ['www'] = 154, - ---The Mail key on an American layout. - ['mail'] = 155, - ---The calculator key on an American layout. - ['calculator'] = 156, - ---The 'computer' key on an American layout. - ['computer'] = 157, - ---The AC Search key on an American layout. - ['acsearch'] = 158, - ---The AC Home key on an American layout. - ['achome'] = 159, - ---The AC Back key on an American layout. - ['acback'] = 160, - ---The AC Forward key on an American layout. - ['acforward'] = 161, - ---Th AC Stop key on an American layout. - ['acstop'] = 162, - ---The AC Refresh key on an American layout. - ['acrefresh'] = 163, - ---The AC Bookmarks key on an American layout. - ['acbookmarks'] = 164, - ---The system power scancode. - ['power'] = 165, - ---The brightness-down scancode. - ['brightnessdown'] = 166, - ---The brightness-up scancode. - ['brightnessup'] = 167, - ---The display switch scancode. - ['displayswitch'] = 168, - ---The keyboard illumination toggle scancode. - ['kbdillumtoggle'] = 169, - ---The keyboard illumination down scancode. - ['kbdillumdown'] = 170, - ---The keyboard illumination up scancode. - ['kbdillumup'] = 171, - ---The eject scancode. - ['eject'] = 172, - ---The system sleep scancode. - ['sleep'] = 173, - ---The alt-erase key on an American layout. - ['alterase'] = 174, - ---The sysreq key on an American layout. - ['sysreq'] = 175, - ---The 'cancel' key on an American layout. - ['cancel'] = 176, - ---The 'clear' key on an American layout. - ['clear'] = 177, - ---The 'prior' key on an American layout. - ['prior'] = 178, - ---The 'return2' key on an American layout. - ['return2'] = 179, - ---The 'separator' key on an American layout. - ['separator'] = 180, - ---The 'out' key on an American layout. - ['out'] = 181, - ---The 'oper' key on an American layout. - ['oper'] = 182, - ---The 'clearagain' key on an American layout. - ['clearagain'] = 183, - ---The 'crsel' key on an American layout. - ['crsel'] = 184, - ---The 'exsel' key on an American layout. - ['exsel'] = 185, - ---The keypad 00 key on an American layout. - ['kp00'] = 186, - ---The keypad 000 key on an American layout. - ['kp000'] = 187, - ---The thousands-separator key on an American layout. - ['thsousandsseparator'] = 188, - ---The decimal separator key on an American layout. - ['decimalseparator'] = 189, - ---The currency unit key on an American layout. - ['currencyunit'] = 190, - ---The currency sub-unit key on an American layout. - ['currencysubunit'] = 191, - ---The 'app1' scancode. - ['app1'] = 192, - ---The 'app2' scancode. - ['app2'] = 193, - ---An unknown key. - ['unknown'] = 194, -} ----Gets the key corresponding to the given hardware scancode. ---- ----Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. ---- ----Scancodes are useful for creating default controls that have the same physical locations on on all systems. ----@param scancode Scancode @The scancode to get the key from. ----@return KeyConstant -function m.getKeyFromScancode(scancode) end - ----Gets the hardware scancode corresponding to the given key. ---- ----Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. ---- ----Scancodes are useful for creating default controls that have the same physical locations on on all systems. ----@param key KeyConstant @The key to get the scancode from. ----@return Scancode -function m.getScancodeFromKey(key) end - ----Gets whether key repeat is enabled. ----@return boolean -function m.hasKeyRepeat() end - ----Gets whether text input events are enabled. ----@return boolean -function m.hasTextInput() end - ----Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased. ----@param key KeyConstant @The key to check. ----@return boolean ----@overload fun(key:KeyConstant, ...:KeyConstant):boolean -function m.isDown(key) end - ----Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased. ---- ----Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode 'w' is used if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. ----@param scancode Scancode @A Scancode to check. ----@param ... Scancode @Additional Scancodes to check. ----@return boolean -function m.isScancodeDown(scancode, ...) end - ----Enables or disables key repeat for love.keypressed. It is disabled by default. ----@param enable boolean @Whether repeat keypress events should be enabled when a key is held down. -function m.setKeyRepeat(enable) end - ----Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android. ---- ----On touch devices, this shows the system's native on-screen keyboard when it's enabled. ----@param enable boolean @Whether text input events should be enabled. ----@overload fun(enable:boolean, x:number, y:number, w:number, h:number):void -function m.setTextInput(enable) end - -return m \ No newline at end of file diff --git a/api/love.lua b/api/love.lua deleted file mode 100644 index d50c445..0000000 --- a/api/love.lua +++ /dev/null @@ -1,96 +0,0 @@ ----@class love -local m = {} - ---region ByteData ----@class ByteData ----Data object containing arbitrary bytes in an contiguous memory. ---- ----There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but Data:getPointer can be used with LuaJIT's FFI to access and write to the contents directly. -local ByteData = {} ---endregion ByteData ---region Data ----@class Data ----The superclass of all data. -local Data = {} ---endregion Data ---region Drawable ----@class Drawable ----Superclass for all things that can be drawn on screen. This is an abstract type that can't be created directly. -local Drawable = {} ---endregion Drawable ---region Object ----@class Object ----The superclass of all LÖVE types. -local Object = {} ---endregion Object ----@type love.audio -m.audio = nil - ----@type love.data -m.data = nil - ----@type love.event -m.event = nil - ----@type love.filesystem -m.filesystem = nil - ----@type love.graphics -m.graphics = nil - ----@type love.image -m.image = nil - ----@type love.joystick -m.joystick = nil - ----@type love.keyboard -m.keyboard = nil - ----@type love.math -m.math = nil - ----@type love.mouse -m.mouse = nil - ----@type love.physics -m.physics = nil - ----@type love.sound -m.sound = nil - ----@type love.system -m.system = nil - ----@type love.thread -m.thread = nil - ----@type love.timer -m.timer = nil - ----@type love.touch -m.touch = nil - ----@type love.video -m.video = nil - ----@type love.window -m.window = nil - ----Gets the current running version of LÖVE. ----@return number, number, number, string -function m.getVersion() end - ----Gets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise. ---- ----When deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console. ----@return boolean -function m.hasDeprecationOutput() end - ----Sets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise. ---- ----When deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console. ----@param enable boolean @Whether to enable or disable deprecation output. -function m.setDeprecationOutput(enable) end - -return m \ No newline at end of file diff --git a/api/love.math.lua b/api/love.math.lua deleted file mode 100644 index d012fc6..0000000 --- a/api/love.math.lua +++ /dev/null @@ -1,382 +0,0 @@ ----@class love.math ----Provides system-independent mathematical functions. -local m = {} - ---region BezierCurve ----@class BezierCurve ----A Bézier curve object that can evaluate and render Bézier curves of arbitrary degree. ---- ----For more information on Bézier curves check this great article on Wikipedia. -local BezierCurve = {} ----Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive). ---- ----This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose. ----@param t number @Where to evaluate the curve. ----@return number, number -function BezierCurve:evaluate(t) end - ----Get coordinates of the i-th control point. Indices start with 1. ----@param i number @Index of the control point. ----@return number, number -function BezierCurve:getControlPoint(i) end - ----Get the number of control points in the Bézier curve. ----@return number -function BezierCurve:getControlPointCount() end - ----Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1. ----@return number -function BezierCurve:getDegree() end - ----Get the derivative of the Bézier curve. ---- ----This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t. ----@return BezierCurve -function BezierCurve:getDerivative() end - ----Gets a BezierCurve that corresponds to the specified segment of this BezierCurve. ----@param startpoint number @The starting point along the curve. Must be between 0 and 1. ----@param endpoint number @The end of the segment. Must be between 0 and 1. ----@return BezierCurve -function BezierCurve:getSegment(startpoint, endpoint) end - ----Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc. ----@param x number @Position of the control point along the x axis. ----@param y number @Position of the control point along the y axis. ----@param i number @Index of the control point. -function BezierCurve:insertControlPoint(x, y, i) end - ----Removes the specified control point. ----@param index number @The index of the control point to remove. -function BezierCurve:removeControlPoint(index) end - ----Get a list of coordinates to be used with love.graphics.line. ---- ----This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter. ---- ----If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate. ----@param depth number @Number of recursive subdivision steps. ----@return table -function BezierCurve:render(depth) end - ----Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line. ---- ----This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter. ---- ----If you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate. ----@param startpoint number @The starting point along the curve. Must be between 0 and 1. ----@param endpoint number @The end of the segment to render. Must be between 0 and 1. ----@param depth number @Number of recursive subdivision steps. ----@return table -function BezierCurve:renderSegment(startpoint, endpoint, depth) end - ----Rotate the Bézier curve by an angle. ----@param angle number @Rotation angle in radians. ----@param ox number @X coordinate of the rotation center. ----@param oy number @Y coordinate of the rotation center. -function BezierCurve:rotate(angle, ox, oy) end - ----Scale the Bézier curve by a factor. ----@param s number @Scale factor. ----@param ox number @X coordinate of the scaling center. ----@param oy number @Y coordinate of the scaling center. -function BezierCurve:scale(s, ox, oy) end - ----Set coordinates of the i-th control point. Indices start with 1. ----@param i number @Index of the control point. ----@param x number @Position of the control point along the x axis. ----@param y number @Position of the control point along the y axis. -function BezierCurve:setControlPoint(i, x, y) end - ----Move the Bézier curve by an offset. ----@param dx number @Offset along the x axis. ----@param dy number @Offset along the y axis. -function BezierCurve:translate(dx, dy) end - ---endregion BezierCurve ---region RandomGenerator ----@class RandomGenerator ----A random number generation object which has its own random state. -local RandomGenerator = {} ----Gets the seed of the random number generator object. ---- ----The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1. ----@return number, number -function RandomGenerator:getSeed() end - ----Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE. ---- ----This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number. ----@return string -function RandomGenerator:getState() end - ----Generates a pseudo-random number in a platform independent manner. ----@return number ----@overload fun(max:number):number ----@overload fun(min:number, max:number):number -function RandomGenerator:random() end - ----Get a normally distributed pseudo random number. ----@param stddev number @Standard deviation of the distribution. ----@param mean number @The mean of the distribution. ----@return number -function RandomGenerator:randomNormal(stddev, mean) end - ----Sets the seed of the random number generator using the specified integer number. ----@param seed number @The integer number with which you want to seed the randomization. Must be within the range of 2^53. ----@overload fun(low:number, high:number):void -function RandomGenerator:setSeed(seed) end - ----Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE. ---- ----This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value. ----@param state string @The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState. -function RandomGenerator:setState(state) end - ---endregion RandomGenerator ---region Transform ----@class Transform ----Object containing a coordinate system transformation. ---- ----The love.graphics module has several functions and function variants which accept Transform objects. -local Transform = {} ----Applies the given other Transform object to this one. ---- ----This effectively multiplies this Transform's internal transformation matrix with the other Transform's (i.e. self * other), and stores the result in this object. ----@param other Transform @The other Transform object to apply to this Transform. ----@return Transform -function Transform:apply(other) end - ----Creates a new copy of this Transform. ----@return Transform -function Transform:clone() end - ----Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order. ----@return number, number, number, number -function Transform:getMatrix() end - ----Creates a new Transform containing the inverse of this Transform. ----@return Transform -function Transform:inverse() end - ----Applies the reverse of the Transform object's transformation to the given 2D position. ---- ----This effectively converts the given position from the local coordinate space of the Transform into global coordinates. ---- ----One use of this method can be to convert a screen-space mouse position into global world coordinates, if the given Transform has transformations applied that are used for a camera system in-game. ----@param localX number @The x component of the position with the transform applied. ----@param localY number @The y component of the position with the transform applied. ----@return number, number -function Transform:inverseTransformPoint(localX, localY) end - ----Checks whether the Transform is an affine transformation. ----@return boolean -function Transform:isAffine2DTransform() end - ----Resets the Transform to an identity state. All previously applied transformations are erased. ----@return Transform -function Transform:reset() end - ----Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations. ----@param angle number @The relative angle in radians to rotate this Transform by. ----@return Transform -function Transform:rotate(angle) end - ----Scales the Transform's coordinate system. This method does not reset any previously applied transformations. ----@param sx number @The relative scale factor along the x-axis. ----@param sy number @The relative scale factor along the y-axis. ----@return Transform -function Transform:scale(sx, sy) end - ----Directly sets the Transform's internal 4x4 transformation matrix. ----@param e1_1 number @The first column of the first row of the matrix. ----@param e1_2 number @The second column of the first row of the matrix. ----@param ... number @Additional matrix elements. ----@param e4_4 number @The fourth column of the fourth row of the matrix. ----@return Transform ----@overload fun(layout:MatrixLayout, e1_1:number, e1_2:number, ...:number, e4_4:number):Transform ----@overload fun(layout:MatrixLayout, matrix:table):Transform ----@overload fun(layout:MatrixLayout, matrix:table):Transform -function Transform:setMatrix(e1_1, e1_2, ..., e4_4) end - ----Resets the Transform to the specified transformation parameters. ----@param x number @The position of the Transform on the x-axis. ----@param y number @The position of the Transform on the y-axis. ----@param angle number @The orientation of the Transform in radians. ----@param sx number @Scale factor on the x-axis. ----@param sy number @Scale factor on the y-axis. ----@param ox number @Origin offset on the x-axis. ----@param oy number @Origin offset on the y-axis. ----@param kx number @Shearing / skew factor on the x-axis. ----@param ky number @Shearing / skew factor on the y-axis. ----@return Transform -function Transform:setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky) end - ----Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations. ----@param kx number @The shear factor along the x-axis. ----@param ky number @The shear factor along the y-axis. ----@return Transform -function Transform:shear(kx, ky) end - ----Applies the Transform object's transformation to the given 2D position. ---- ----This effectively converts the given position from global coordinates into the local coordinate space of the Transform. ----@param globalX number @The x component of the position in global coordinates. ----@param globalY number @The y component of the position in global coordinates. ----@return number, number -function Transform:transformPoint(globalX, globalY) end - ----Applies a translation to the Transform's coordinate system. This method does not reset any previously applied transformations. ----@param dx number @The relative translation along the x-axis. ----@param dy number @The relative translation along the y-axis. ----@return Transform -function Transform:translate(dx, dy) end - ---endregion Transform ----The layout of matrix elements (row-major or column-major). -MatrixLayout = { - ---The matrix is row-major: - ['row'] = 1, - ---The matrix is column-major: - ['column'] = 2, -} ----Converts a color from 0..255 to 0..1 range. ----@param rb number @Red color component in 0..255 range. ----@param gb number @Green color component in 0..255 range. ----@param bb number @Blue color component in 0..255 range. ----@param ab number @Alpha color component in 0..255 range. ----@return number, number, number, number -function m.colorFromBytes(rb, gb, bb, ab) end - ----Converts a color from 0..1 to 0..255 range. ----@param r number @Red color component. ----@param g number @Green color component. ----@param b number @Blue color component. ----@param a number @Alpha color component. ----@return number, number, number, number -function m.colorToBytes(r, g, b, a) end - ----Compresses a string or data using a specific compression algorithm. ----@param rawstring string @The raw (un-compressed) string to compress. ----@param format CompressedDataFormat @The format to use when compressing the string. ----@param level number @The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used. ----@return CompressedData ----@overload fun(data:Data, format:CompressedDataFormat, level:number):CompressedData -function m.compress(rawstring, format, level) end - ----Decompresses a CompressedData or previously compressed string or Data object. ----@param compressedData CompressedData @The compressed data to decompress. ----@return string ----@overload fun(compressedstring:string, format:CompressedDataFormat):string ----@overload fun(data:Data, format:CompressedDataFormat):string -function m.decompress(compressedData) end - ----Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LÖVE doesn't handle conversions automatically. ---- ----Read more about gamma-correct rendering here, here, and here. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param r number @The red channel of the sRGB color to convert. ----@param g number @The green channel of the sRGB color to convert. ----@param b number @The blue channel of the sRGB color to convert. ----@return number, number, number ----@overload fun(color:table):number, number, number ----@overload fun(c:number):number -function m.gammaToLinear(r, g, b) end - ----Gets the seed of the random number generator. ---- ----The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed can be an integer value up to 2^64. ----@return number, number -function m.getRandomSeed() end - ----Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with love.math.setRandomState or RandomGenerator:setState. ---- ----This is different from love.math.getRandomSeed in that getRandomState gets the random number generator's current state, whereas getRandomSeed gets the previously set seed number. ----@return string -function m.getRandomState() end - ----Checks whether a polygon is convex. ---- ----PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons. ----@param vertices table @The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. ----@return boolean ----@overload fun(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number):boolean -function m.isConvex(vertices) end - ----Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing. ---- ----In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-converted. Colors calculated using math are often in the linear RGB space. ---- ----Read more about gamma-correct rendering here, here, and here. ---- ----In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ----@param lr number @The red channel of the linear RGB color to convert. ----@param lg number @The green channel of the linear RGB color to convert. ----@param lb number @The blue channel of the linear RGB color to convert. ----@return number, number, number ----@overload fun(color:table):number, number, number ----@overload fun(lc:number):number -function m.linearToGamma(lr, lg, lb) end - ----Creates a new BezierCurve object. ---- ----The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc. ----@param vertices table @The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. ----@return BezierCurve ----@overload fun(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number):BezierCurve -function m.newBezierCurve(vertices) end - ----Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions. ----@return RandomGenerator ----@overload fun(seed:number):RandomGenerator ----@overload fun(low:number, high:number):RandomGenerator -function m.newRandomGenerator() end - ----Creates a new Transform object. ----@return Transform ----@overload fun(x:number, y:number, angle:number, sx:number, sy:number, ox:number, oy:number, kx:number, ky:number):Transform -function m.newTransform() end - ----Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments. ---- ----Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation. ---- ----There are many webpages which discuss Perlin and Simplex noise in detail. ----@param x number @The number used to generate the noise value. ----@return number ----@overload fun(x:number, y:number):number ----@overload fun(x:number, y:number, z:number):number ----@overload fun(x:number, y:number, z:number, w:number):number -function m.noise(x) end - ----Generates a pseudo-random number in a platform independent manner. The default love.run seeds this function at startup, so you generally don't need to seed it yourself. ----@return number ----@overload fun(max:number):number ----@overload fun(min:number, max:number):number -function m.random() end - ----Get a normally distributed pseudo random number. ----@param stddev number @Standard deviation of the distribution. ----@param mean number @The mean of the distribution. ----@return number -function m.randomNormal(stddev, mean) end - ----Sets the seed of the random number generator using the specified integer number. This is called internally at startup, so you generally don't need to call it yourself. ----@param seed number @The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1. ----@overload fun(low:number, high:number):void -function m.setRandomSeed(seed) end - ----Sets the current state of the random number generator. The value used as an argument for this function is an opaque implementation-dependent string and should only originate from a previous call to love.math.getRandomState. ---- ----This is different from love.math.setRandomSeed in that setRandomState directly sets the random number generator's current implementation-dependent state, whereas setRandomSeed gives it a new seed value. ----@param state string @The new state of the random number generator, represented as a string. This should originate from a previous call to love.math.getRandomState. -function m.setRandomState(state) end - ----Decomposes a simple convex or concave polygon into triangles. ----@param polygon table @Polygon to triangulate. Must not intersect itself. ----@return table ----@overload fun(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number):table -function m.triangulate(polygon) end - -return m \ No newline at end of file diff --git a/api/love.mouse.lua b/api/love.mouse.lua deleted file mode 100644 index bb38312..0000000 --- a/api/love.mouse.lua +++ /dev/null @@ -1,152 +0,0 @@ ----@class love.mouse ----Provides an interface to the user's mouse. -local m = {} - ---region Cursor ----@class Cursor ----Represents a hardware cursor. -local Cursor = {} ----Gets the type of the Cursor. ----@return CursorType -function Cursor:getType() end - ---endregion Cursor ----Types of hardware cursors. -CursorType = { - ---The cursor is using a custom image. - ['image'] = 1, - ---An arrow pointer. - ['arrow'] = 2, - ---An I-beam, normally used when mousing over editable or selectable text. - ['ibeam'] = 3, - ---Wait graphic. - ['wait'] = 4, - ---Small wait cursor with an arrow pointer. - ['waitarrow'] = 5, - ---Crosshair symbol. - ['crosshair'] = 6, - ---Double arrow pointing to the top-left and bottom-right. - ['sizenwse'] = 7, - ---Double arrow pointing to the top-right and bottom-left. - ['sizenesw'] = 8, - ---Double arrow pointing left and right. - ['sizewe'] = 9, - ---Double arrow pointing up and down. - ['sizens'] = 10, - ---Four-pointed arrow pointing up, down, left, and right. - ['sizeall'] = 11, - ---Slashed circle or crossbones. - ['no'] = 12, - ---Hand symbol. - ['hand'] = 13, -} ----Gets the current Cursor. ----@return Cursor -function m.getCursor() end - ----Returns the current position of the mouse. ----@return number, number -function m.getPosition() end - ----Gets whether relative mode is enabled for the mouse. ---- ----If relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen. ---- ----The reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated. ----@return boolean -function m.getRelativeMode() end - ----Gets a Cursor object representing a system-native hardware cursor. ---- ----Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates. ----@param ctype CursorType @The type of system cursor to get. ----@return Cursor -function m.getSystemCursor(ctype) end - ----Returns the current x-position of the mouse. ----@return number -function m.getX() end - ----Returns the current y-position of the mouse. ----@return number -function m.getY() end - ----Gets whether cursor functionality is supported. ---- ----If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors. ----@return boolean -function m.hasCursor() end - ----Gets whether cursor functionality is supported. ---- ----If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors. ----@return boolean -function m.isCursorSupported() end - ----Checks whether a certain mouse button is down. ---- ----This function does not detect mouse wheel scrolling; you must use the love.wheelmoved (or love.mousepressed in version 0.9.2 and older) callback for that. ----@param button number @The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependant. ----@param ... number @Additional button numbers to check. ----@return boolean -function m.isDown(button, ...) end - ----Checks if the mouse is grabbed. ----@return boolean -function m.isGrabbed() end - ----Checks if the cursor is visible. ----@return boolean -function m.isVisible() end - ----Creates a new hardware Cursor object from an image file or ImageData. ---- ----Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates. ---- ----The hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is. For example, the normal arrow pointer normally has its hot spot at the top left of the image, but a crosshair cursor might have it in the middle. ----@param imageData ImageData @The ImageData to use for the new Cursor. ----@param hotx number @The x-coordinate in the ImageData of the cursor's hot spot. ----@param hoty number @The y-coordinate in the ImageData of the cursor's hot spot. ----@return Cursor ----@overload fun(filename:string, hotx:number, hoty:number):Cursor ----@overload fun(fileData:FileData, hotx:number, hoty:number):Cursor -function m.newCursor(imageData, hotx, hoty) end - ----Sets the current mouse cursor. ----@param cursor Cursor @The Cursor object to use as the current mouse cursor. -function m.setCursor(cursor) end - ----Grabs the mouse and confines it to the window. ----@param grab boolean @True to confine the mouse, false to let it leave the window. -function m.setGrabbed(grab) end - ----Sets the current position of the mouse. Non-integer values are floored. ----@param x number @The new position of the mouse along the x-axis. ----@param y number @The new position of the mouse along the y-axis. -function m.setPosition(x, y) end - ----Sets whether relative mode is enabled for the mouse. ---- ----When relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen. ---- ----The reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated. ----@param enable boolean @True to enable relative mode, false to disable it. -function m.setRelativeMode(enable) end - ----Sets the current visibility of the cursor. ----@param visible boolean @True to set the cursor to visible, false to hide the cursor. -function m.setVisible(visible) end - ----Sets the current X position of the mouse. ---- ----Non-integer values are floored. ----@param x number @The new position of the mouse along the x-axis. -function m.setX(x) end - ----Sets the current Y position of the mouse. ---- ----Non-integer values are floored. ----@param y number @The new position of the mouse along the y-axis. -function m.setY(y) end - -return m \ No newline at end of file diff --git a/api/love.physics.lua b/api/love.physics.lua deleted file mode 100644 index 0b507f5..0000000 --- a/api/love.physics.lua +++ /dev/null @@ -1,1677 +0,0 @@ ----@class love.physics ----Can simulate 2D rigid body physics in a realistic manner. This module is based on Box2D, and this API corresponds to the Box2D API as closely as possible. -local m = {} - ---region Body ----@class Body ----Bodies are objects with velocity and position. -local Body = {} ----Applies an angular impulse to a body. This makes a single, instantaneous addition to the body momentum. ---- ----A body with with a larger mass will react less. The reaction does '''not''' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce. ----@param impulse number @The impulse in kilogram-square meter per second. -function Body:applyAngularImpulse(impulse) end - ----Apply force to a Body. ---- ----A force pushes a body in a direction. A body with with a larger mass will react less. The reaction also depends on how long a force is applied: since the force acts continuously over the entire timestep, a short timestep will only push the body for a short time. Thus forces are best used for many timesteps to give a continuous push to a body (like gravity). For a single push that is independent of timestep, it is better to use Body:applyLinearImpulse. ---- ----If the position to apply the force is not given, it will act on the center of mass of the body. The part of the force not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia). ---- ----Note that the force components and position must be given in world coordinates. ----@param fx number @The x component of force to apply to the center of mass. ----@param fy number @The y component of force to apply to the center of mass. ----@overload fun(fx:number, fy:number, x:number, y:number):void -function Body:applyForce(fx, fy) end - ----Applies an impulse to a body. ---- ----This makes a single, instantaneous addition to the body momentum. ---- ----An impulse pushes a body in a direction. A body with with a larger mass will react less. The reaction does '''not''' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce. ---- ----If the position to apply the impulse is not given, it will act on the center of mass of the body. The part of the impulse not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia). ---- ----Note that the impulse components and position must be given in world coordinates. ----@param ix number @The x component of the impulse applied to the center of mass. ----@param iy number @The y component of the impulse applied to the center of mass. ----@overload fun(ix:number, iy:number, x:number, y:number):void -function Body:applyLinearImpulse(ix, iy) end - ----Apply torque to a body. ---- ----Torque is like a force that will change the angular velocity (spin) of a body. The effect will depend on the rotational inertia a body has. ----@param torque number @The torque to apply. -function Body:applyTorque(torque) end - ----Explicitly destroys the Body and all fixtures and joints attached to it. ---- ----An error will occur if you attempt to use the object after calling this function. In 0.7.2, when you don't have time to wait for garbage collection, this function may be used to free the object immediately. -function Body:destroy() end - ----Get the angle of the body. ---- ----The angle is measured in radians. If you need to transform it to degrees, use math.deg. ---- ----A value of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes ''clockwise'' from our point of view. ----@return number -function Body:getAngle() end - ----Gets the Angular damping of the Body ---- ----The angular damping is the ''rate of decrease of the angular velocity over time'': A spinning body with no damping and no external forces will continue spinning indefinitely. A spinning body with damping will gradually stop spinning. ---- ----Damping is not the same as friction - they can be modelled together. However, only damping is provided by Box2D (and LOVE). ---- ----Damping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity meaning full damping. Normally you will use a damping value between 0 and 0.1. ----@return number -function Body:getAngularDamping() end - ----Get the angular velocity of the Body. ---- ----The angular velocity is the ''rate of change of angle over time''. ---- ----It is changed in World:update by applying torques, off centre forces/impulses, and angular damping. It can be set directly with Body:setAngularVelocity. ---- ----If you need the ''rate of change of position over time'', use Body:getLinearVelocity. ----@return number -function Body:getAngularVelocity() end - ----Gets a list of all Contacts attached to the Body. ----@return table -function Body:getContacts() end - ----Returns a table with all fixtures. ----@return table -function Body:getFixtures() end - ----Returns the gravity scale factor. ----@return number -function Body:getGravityScale() end - ----Gets the rotational inertia of the body. ---- ----The rotational inertia is how hard is it to make the body spin. ----@return number -function Body:getInertia() end - ----Returns a table containing the Joints attached to this Body. ----@return table -function Body:getJoints() end - ----Gets the linear damping of the Body. ---- ----The linear damping is the ''rate of decrease of the linear velocity over time''. A moving body with no damping and no external forces will continue moving indefinitely, as is the case in space. A moving body with damping will gradually stop moving. ---- ----Damping is not the same as friction - they can be modelled together. ----@return number -function Body:getLinearDamping() end - ----Gets the linear velocity of the Body from its center of mass. ---- ----The linear velocity is the ''rate of change of position over time''. ---- ----If you need the ''rate of change of angle over time'', use Body:getAngularVelocity. ---- ----If you need to get the linear velocity of a point different from the center of mass: ---- ----* Body:getLinearVelocityFromLocalPoint allows you to specify the point in local coordinates. ---- ----* Body:getLinearVelocityFromWorldPoint allows you to specify the point in world coordinates. ---- ----See page 136 of 'Essential Mathematics for Games and Interactive Applications' for definitions of local and world coordinates. ----@return number, number -function Body:getLinearVelocity() end - ----Get the linear velocity of a point on the body. ---- ----The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning. ---- ----The point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates. ----@param x number @The x position to measure velocity. ----@param y number @The y position to measure velocity. ----@return number, number -function Body:getLinearVelocityFromLocalPoint(x, y) end - ----Get the linear velocity of a point on the body. ---- ----The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning. ---- ----The point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates. ----@param x number @The x position to measure velocity. ----@param y number @The y position to measure velocity. ----@return number, number -function Body:getLinearVelocityFromWorldPoint(x, y) end - ----Get the center of mass position in local coordinates. ---- ----Use Body:getWorldCenter to get the center of mass in world coordinates. ----@return number, number -function Body:getLocalCenter() end - ----Transform a point from world coordinates to local coordinates. ----@param worldX number @The x position in world coordinates. ----@param worldY number @The y position in world coordinates. ----@return number, number -function Body:getLocalPoint(worldX, worldY) end - ----Transform a vector from world coordinates to local coordinates. ----@param worldX number @The vector x component in world coordinates. ----@param worldY number @The vector y component in world coordinates. ----@return number, number -function Body:getLocalVector(worldX, worldY) end - ----Get the mass of the body. ---- ----Static bodies always have a mass of 0. ----@return number -function Body:getMass() end - ----Returns the mass, its center, and the rotational inertia. ----@return number, number, number, number -function Body:getMassData() end - ----Get the position of the body. ---- ----Note that this may not be the center of mass of the body. ----@return number, number -function Body:getPosition() end - ----Get the position and angle of the body. ---- ----Note that the position may not be the center of mass of the body. An angle of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view. ----@return number, number, number -function Body:getTransform() end - ----Returns the type of the body. ----@return BodyType -function Body:getType() end - ----Returns the Lua value associated with this Body. ----@return any -function Body:getUserData() end - ----Gets the World the body lives in. ----@return World -function Body:getWorld() end - ----Get the center of mass position in world coordinates. ---- ----Use Body:getLocalCenter to get the center of mass in local coordinates. ----@return number, number -function Body:getWorldCenter() end - ----Transform a point from local coordinates to world coordinates. ----@param localX number @The x position in local coordinates. ----@param localY number @The y position in local coordinates. ----@return number, number -function Body:getWorldPoint(localX, localY) end - ----Transforms multiple points from local coordinates to world coordinates. ----@param x1 number @The x position of the first point. ----@param y1 number @The y position of the first point. ----@param x2 number @The x position of the second point. ----@param y2 number @The y position of the second point. ----@return number, number, number, number -function Body:getWorldPoints(x1, y1, x2, y2) end - ----Transform a vector from local coordinates to world coordinates. ----@param localX number @The vector x component in local coordinates. ----@param localY number @The vector y component in local coordinates. ----@return number, number -function Body:getWorldVector(localX, localY) end - ----Get the x position of the body in world coordinates. ----@return number -function Body:getX() end - ----Get the y position of the body in world coordinates. ----@return number -function Body:getY() end - ----Returns whether the body is actively used in the simulation. ----@return boolean -function Body:isActive() end - ----Returns the sleep status of the body. ----@return boolean -function Body:isAwake() end - ----Get the bullet status of a body. ---- ----There are two methods to check for body collisions: ---- ----* at their location when the world is updated (default) ---- ----* using continuous collision detection (CCD) ---- ----The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly. ---- ----Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet. ----@return boolean -function Body:isBullet() end - ----Gets whether the Body is destroyed. Destroyed bodies cannot be used. ----@return boolean -function Body:isDestroyed() end - ----Returns whether the body rotation is locked. ----@return boolean -function Body:isFixedRotation() end - ----Returns the sleeping behaviour of the body. ----@return boolean -function Body:isSleepingAllowed() end - ----Gets whether the Body is touching the given other Body. ----@param otherbody Body @The other body to check. ----@return boolean -function Body:isTouching(otherbody) end - ----Resets the mass of the body by recalculating it from the mass properties of the fixtures. -function Body:resetMassData() end - ----Sets whether the body is active in the world. ---- ----An inactive body does not take part in the simulation. It will not move or cause any collisions. ----@param active boolean @If the body is active or not. -function Body:setActive(active) end - ----Set the angle of the body. ---- ----The angle is measured in radians. If you need to transform it from degrees, use math.rad. ---- ----A value of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes ''clockwise'' from our point of view. ---- ----It is possible to cause a collision with another body by changing its angle. ----@param angle number @The angle in radians. -function Body:setAngle(angle) end - ----Sets the angular damping of a Body ---- ----See Body:getAngularDamping for a definition of angular damping. ---- ----Angular damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will look unrealistic. ----@param damping number @The new angular damping. -function Body:setAngularDamping(damping) end - ----Sets the angular velocity of a Body. ---- ----The angular velocity is the ''rate of change of angle over time''. ---- ----This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. ----@param w number @The new angular velocity, in radians per second -function Body:setAngularVelocity(w) end - ----Wakes the body up or puts it to sleep. ----@param awake boolean @The body sleep status. -function Body:setAwake(awake) end - ----Set the bullet status of a body. ---- ----There are two methods to check for body collisions: ---- ----* at their location when the world is updated (default) ---- ----* using continuous collision detection (CCD) ---- ----The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly. ---- ----Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet. ----@param status boolean @The bullet status of the body. -function Body:setBullet(status) end - ----Set whether a body has fixed rotation. ---- ----Bodies with fixed rotation don't vary the speed at which they rotate. Calling this function causes the mass to be reset. ----@param isFixed boolean @Whether the body should have fixed rotation. -function Body:setFixedRotation(isFixed) end - ----Sets a new gravity scale factor for the body. ----@param scale number @The new gravity scale factor. -function Body:setGravityScale(scale) end - ----Set the inertia of a body. ----@param inertia number @The new moment of inertia, in kilograms * pixel squared. -function Body:setInertia(inertia) end - ----Sets the linear damping of a Body ---- ----See Body:getLinearDamping for a definition of linear damping. ---- ----Linear damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will make the objects look 'floaty'(if gravity is enabled). ----@param ld number @The new linear damping -function Body:setLinearDamping(ld) end - ----Sets a new linear velocity for the Body. ---- ----This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. ----@param x number @The x-component of the velocity vector. ----@param y number @The y-component of the velocity vector. -function Body:setLinearVelocity(x, y) end - ----Sets a new body mass. ----@param mass number @The mass, in kilograms. -function Body:setMass(mass) end - ----Overrides the calculated mass data. ----@param x number @The x position of the center of mass. ----@param y number @The y position of the center of mass. ----@param mass number @The mass of the body. ----@param inertia number @The rotational inertia. -function Body:setMassData(x, y, mass, inertia) end - ----Set the position of the body. ---- ----Note that this may not be the center of mass of the body. ---- ----This function cannot wake up the body. ----@param x number @The x position. ----@param y number @The y position. -function Body:setPosition(x, y) end - ----Sets the sleeping behaviour of the body. Should sleeping be allowed, a body at rest will automatically sleep. A sleeping body is not simulated unless it collided with an awake body. Be wary that one can end up with a situation like a floating sleeping body if the floor was removed. ----@param allowed boolean @True if the body is allowed to sleep or false if not. -function Body:setSleepingAllowed(allowed) end - ----Set the position and angle of the body. ---- ----Note that the position may not be the center of mass of the body. An angle of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view. ---- ----This function cannot wake up the body. ----@param x number @The x component of the position. ----@param y number @The y component of the position. ----@param angle number @The angle in radians. -function Body:setTransform(x, y, angle) end - ----Sets a new body type. ----@param type BodyType @The new type. -function Body:setType(type) end - ----Associates a Lua value with the Body. ---- ----To delete the reference, explicitly pass nil. ----@param value any @The Lua value to associate with the Body. -function Body:setUserData(value) end - ----Set the x position of the body. ---- ----This function cannot wake up the body. ----@param x number @The x position. -function Body:setX(x) end - ----Set the y position of the body. ---- ----This function cannot wake up the body. ----@param y number @The y position. -function Body:setY(y) end - ---endregion Body ---region ChainShape ----@class ChainShape ----A ChainShape consists of multiple line segments. It can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape. ---- ----Unlike the PolygonShape, the ChainShape does not have a vertices limit or has to form a convex shape, but self intersections are not supported. -local ChainShape = {} ----Returns a child of the shape as an EdgeShape. ----@param index number @The index of the child. ----@return EdgeShape -function ChainShape:getChildEdge(index) end - ----Gets the vertex that establishes a connection to the next shape. ---- ----Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@return number, number -function ChainShape:getNextVertex() end - ----Returns a point of the shape. ----@param index number @The index of the point to return. ----@return number, number -function ChainShape:getPoint(index) end - ----Returns all points of the shape. ----@return number, number, number, number -function ChainShape:getPoints() end - ----Gets the vertex that establishes a connection to the previous shape. ---- ----Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@return number, number -function ChainShape:getPreviousVertex() end - ----Returns the number of vertices the shape has. ----@return number -function ChainShape:getVertexCount() end - ----Sets a vertex that establishes a connection to the next shape. ---- ----This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@param x number @The x-component of the vertex. ----@param y number @The y-component of the vertex. -function ChainShape:setNextVertex(x, y) end - ----Sets a vertex that establishes a connection to the previous shape. ---- ----This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@param x number @The x-component of the vertex. ----@param y number @The y-component of the vertex. -function ChainShape:setPreviousVertex(x, y) end - ---endregion ChainShape ---region CircleShape ----@class CircleShape ----Circle extends Shape and adds a radius and a local position. -local CircleShape = {} ----Gets the center point of the circle shape. ----@return number, number -function CircleShape:getPoint() end - ----Gets the radius of the circle shape. ----@return number -function CircleShape:getRadius() end - ----Sets the location of the center of the circle shape. ----@param x number @The x-component of the new center point of the circle. ----@param y number @The y-component of the new center point of the circle. -function CircleShape:setPoint(x, y) end - ----Sets the radius of the circle. ----@param radius number @The radius of the circle -function CircleShape:setRadius(radius) end - ---endregion CircleShape ---region Contact ----@class Contact ----Contacts are objects created to manage collisions in worlds. -local Contact = {} ----Gets the two Fixtures that hold the shapes that are in contact. ----@return Fixture, Fixture -function Contact:getFixtures() end - ----Get the friction between two shapes that are in contact. ----@return number -function Contact:getFriction() end - ----Get the normal vector between two shapes that are in contact. ---- ----This function returns the coordinates of a unit vector that points from the first shape to the second. ----@return number, number -function Contact:getNormal() end - ----Returns the contact points of the two colliding fixtures. There can be one or two points. ----@return number, number, number, number -function Contact:getPositions() end - ----Get the restitution between two shapes that are in contact. ----@return number -function Contact:getRestitution() end - ----Returns whether the contact is enabled. The collision will be ignored if a contact gets disabled in the preSolve callback. ----@return boolean -function Contact:isEnabled() end - ----Returns whether the two colliding fixtures are touching each other. ----@return boolean -function Contact:isTouching() end - ----Resets the contact friction to the mixture value of both fixtures. -function Contact:resetFriction() end - ----Resets the contact restitution to the mixture value of both fixtures. -function Contact:resetRestitution() end - ----Enables or disables the contact. ----@param enabled boolean @True to enable or false to disable. -function Contact:setEnabled(enabled) end - ----Sets the contact friction. ----@param friction number @The contact friction. -function Contact:setFriction(friction) end - ----Sets the contact restitution. ----@param restitution number @The contact restitution. -function Contact:setRestitution(restitution) end - ---endregion Contact ---region DistanceJoint ----@class DistanceJoint ----Keeps two bodies at the same distance. -local DistanceJoint = {} ----Gets the damping ratio. ----@return number -function DistanceJoint:getDampingRatio() end - ----Gets the response speed. ----@return number -function DistanceJoint:getFrequency() end - ----Gets the equilibrium distance between the two Bodies. ----@return number -function DistanceJoint:getLength() end - ----Sets the damping ratio. ----@param ratio number @The damping ratio. -function DistanceJoint:setDampingRatio(ratio) end - ----Sets the response speed. ----@param Hz number @The response speed. -function DistanceJoint:setFrequency(Hz) end - ----Sets the equilibrium distance between the two Bodies. ----@param l number @The length between the two Bodies. -function DistanceJoint:setLength(l) end - ---endregion DistanceJoint ---region EdgeShape ----@class EdgeShape ----A EdgeShape is a line segment. They can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape. -local EdgeShape = {} ----Gets the vertex that establishes a connection to the next shape. ---- ----Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@return number, number -function EdgeShape:getNextVertex() end - ----Returns the local coordinates of the edge points. ----@return number, number, number, number -function EdgeShape:getPoints() end - ----Gets the vertex that establishes a connection to the previous shape. ---- ----Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@return number, number -function EdgeShape:getPreviousVertex() end - ----Sets a vertex that establishes a connection to the next shape. ---- ----This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@param x number @The x-component of the vertex. ----@param y number @The y-component of the vertex. -function EdgeShape:setNextVertex(x, y) end - ----Sets a vertex that establishes a connection to the previous shape. ---- ----This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. ----@param x number @The x-component of the vertex. ----@param y number @The y-component of the vertex. -function EdgeShape:setPreviousVertex(x, y) end - ---endregion EdgeShape ---region Fixture ----@class Fixture ----Fixtures attach shapes to bodies. -local Fixture = {} ----Destroys the fixture. -function Fixture:destroy() end - ----Returns the body to which the fixture is attached. ----@return Body -function Fixture:getBody() end - ----Returns the points of the fixture bounding box. In case the fixture has multiple children a 1-based index can be specified. For example, a fixture will have multiple children with a chain shape. ----@param index number @A bounding box of the fixture. ----@return number, number, number, number -function Fixture:getBoundingBox(index) end - ----Returns the categories the fixture belongs to. ----@return number, number -function Fixture:getCategory() end - ----Returns the density of the fixture. ----@return number -function Fixture:getDensity() end - ----Returns the filter data of the fixture. ---- ----Categories and masks are encoded as the bits of a 16-bit integer. ----@return number, number, number -function Fixture:getFilterData() end - ----Returns the friction of the fixture. ----@return number -function Fixture:getFriction() end - ----Returns the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it's negative. The group zero means no group. ---- ----The groups range from -32768 to 32767. ----@return number -function Fixture:getGroupIndex() end - ----Returns which categories this fixture should '''NOT''' collide with. ----@return number, number -function Fixture:getMask() end - ----Returns the mass, its center and the rotational inertia. ----@return number, number, number, number -function Fixture:getMassData() end - ----Returns the restitution of the fixture. ----@return number -function Fixture:getRestitution() end - ----Returns the shape of the fixture. This shape is a reference to the actual data used in the simulation. It's possible to change its values between timesteps. ----@return Shape -function Fixture:getShape() end - ----Returns the Lua value associated with this fixture. ----@return any -function Fixture:getUserData() end - ----Gets whether the Fixture is destroyed. Destroyed fixtures cannot be used. ----@return boolean -function Fixture:isDestroyed() end - ----Returns whether the fixture is a sensor. ----@return boolean -function Fixture:isSensor() end - ----Casts a ray against the shape of the fixture and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. ---- ----The ray starts on the first point of the input line and goes towards the second point of the line. The fifth argument is the maximum distance the ray is going to travel as a scale factor of the input line length. ---- ----The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children. ---- ----The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point. ---- ----hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction ----@param x1 number @The x position of the input line starting point. ----@param y1 number @The y position of the input line starting point. ----@param x2 number @The x position of the input line end point. ----@param y2 number @The y position of the input line end point. ----@param maxFraction number @Ray length parameter. ----@param childIndex number @The index of the child the ray gets cast against. ----@return number, number, number -function Fixture:rayCast(x1, y1, x2, y2, maxFraction, childIndex) end - ----Sets the categories the fixture belongs to. There can be up to 16 categories represented as a number from 1 to 16. ---- ----All fixture's default category is 1. ----@param category1 number @The first category. ----@param category2 number @The second category. -function Fixture:setCategory(category1, category2) end - ----Sets the density of the fixture. Call Body:resetMassData if this needs to take effect immediately. ----@param density number @The fixture density in kilograms per square meter. -function Fixture:setDensity(density) end - ----Sets the filter data of the fixture. ---- ----Groups, categories, and mask can be used to define the collision behaviour of the fixture. ---- ----If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. If the group is zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each other's categories selected, the return value of the custom contact filter will be used. They always collide if none was set. ---- ----There can be up to 16 categories. Categories and masks are encoded as the bits of a 16-bit integer. ---- ----When created, prior to calling this function, all fixtures have category set to 1, mask set to 65535 (all categories) and group set to 0. ---- ----This function allows setting all filter data for a fixture at once. To set only the categories, the mask or the group, you can use Fixture:setCategory, Fixture:setMask or Fixture:setGroupIndex respectively. ----@param categories number @The categories as an integer from 0 to 65535. ----@param mask number @The mask as an integer from 0 to 65535. ----@param group number @The group as an integer from -32768 to 32767. -function Fixture:setFilterData(categories, mask, group) end - ----Sets the friction of the fixture. ---- ----Friction determines how shapes react when they 'slide' along other shapes. Low friction indicates a slippery surface, like ice, while high friction indicates a rough surface, like concrete. Range: 0.0 - 1.0. ----@param friction number @The fixture friction. -function Fixture:setFriction(friction) end - ----Sets the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it's negative. The group zero means no group. ---- ----The groups range from -32768 to 32767. ----@param group number @The group as an integer from -32768 to 32767. -function Fixture:setGroupIndex(group) end - ----Sets the category mask of the fixture. There can be up to 16 categories represented as a number from 1 to 16. ---- ----This fixture will '''NOT''' collide with the fixtures that are in the selected categories if the other fixture also has a category of this fixture selected. ----@param mask1 number @The first category. ----@param mask2 number @The second category. -function Fixture:setMask(mask1, mask2) end - ----Sets the restitution of the fixture. ----@param restitution number @The fixture restitution. -function Fixture:setRestitution(restitution) end - ----Sets whether the fixture should act as a sensor. ---- ----Sensors do not cause collision responses, but the begin-contact and end-contact World callbacks will still be called for this fixture. ----@param sensor boolean @The sensor status. -function Fixture:setSensor(sensor) end - ----Associates a Lua value with the fixture. ---- ----To delete the reference, explicitly pass nil. ----@param value any @The Lua value to associate with the fixture. -function Fixture:setUserData(value) end - ----Checks if a point is inside the shape of the fixture. ----@param x number @The x position of the point. ----@param y number @The y position of the point. ----@return boolean -function Fixture:testPoint(x, y) end - ---endregion Fixture ---region FrictionJoint ----@class FrictionJoint ----A FrictionJoint applies friction to a body. -local FrictionJoint = {} ----Gets the maximum friction force in Newtons. ----@return number -function FrictionJoint:getMaxForce() end - ----Gets the maximum friction torque in Newton-meters. ----@return number -function FrictionJoint:getMaxTorque() end - ----Sets the maximum friction force in Newtons. ----@param maxForce number @Max force in Newtons. -function FrictionJoint:setMaxForce(maxForce) end - ----Sets the maximum friction torque in Newton-meters. ----@param torque number @Maximum torque in Newton-meters. -function FrictionJoint:setMaxTorque(torque) end - ---endregion FrictionJoint ---region GearJoint ----@class GearJoint ----Keeps bodies together in such a way that they act like gears. -local GearJoint = {} ----Get the Joints connected by this GearJoint. ----@return Joint, Joint -function GearJoint:getJoints() end - ----Get the ratio of a gear joint. ----@return number -function GearJoint:getRatio() end - ----Set the ratio of a gear joint. ----@param ratio number @The new ratio of the joint. -function GearJoint:setRatio(ratio) end - ---endregion GearJoint ---region Joint ----@class Joint ----Attach multiple bodies together to interact in unique ways. -local Joint = {} ----Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function. ---- ----In 0.7.2, when you don't have time to wait for garbage collection, this function ---- ----may be used to free the object immediately. -function Joint:destroy() end - ----Get the anchor points of the joint. ----@return number, number, number, number -function Joint:getAnchors() end - ----Gets the bodies that the Joint is attached to. ----@return Body, Body -function Joint:getBodies() end - ----Gets whether the connected Bodies collide. ----@return boolean -function Joint:getCollideConnected() end - ----Returns the reaction force in newtons on the second body ----@param x number @How long the force applies. Usually the inverse time step or 1/dt. ----@return number, number -function Joint:getReactionForce(x) end - ----Returns the reaction torque on the second body. ----@param invdt number @How long the force applies. Usually the inverse time step or 1/dt. ----@return number -function Joint:getReactionTorque(invdt) end - ----Gets a string representing the type. ----@return JointType -function Joint:getType() end - ----Returns the Lua value associated with this Joint. ----@return any -function Joint:getUserData() end - ----Gets whether the Joint is destroyed. Destroyed joints cannot be used. ----@return boolean -function Joint:isDestroyed() end - ----Associates a Lua value with the Joint. ---- ----To delete the reference, explicitly pass nil. ----@param value any @The Lua value to associate with the Joint. -function Joint:setUserData(value) end - ---endregion Joint ---region MotorJoint ----@class MotorJoint ----Controls the relative motion between two Bodies. Position and rotation offsets can be specified, as well as the maximum motor force and torque that will be applied to reach the target offsets. -local MotorJoint = {} ----Gets the target angular offset between the two Bodies the Joint is attached to. ----@return number -function MotorJoint:getAngularOffset() end - ----Gets the target linear offset between the two Bodies the Joint is attached to. ----@return number, number -function MotorJoint:getLinearOffset() end - ----Sets the target angluar offset between the two Bodies the Joint is attached to. ----@param angleoffset number @The target angular offset in radians: the second body's angle minus the first body's angle. -function MotorJoint:setAngularOffset(angleoffset) end - ----Sets the target linear offset between the two Bodies the Joint is attached to. ----@param x number @The x component of the target linear offset, relative to the first Body. ----@param y number @The y component of the target linear offset, relative to the first Body. -function MotorJoint:setLinearOffset(x, y) end - ---endregion MotorJoint ---region MouseJoint ----@class MouseJoint ----For controlling objects with the mouse. -local MouseJoint = {} ----Returns the damping ratio. ----@return number -function MouseJoint:getDampingRatio() end - ----Returns the frequency. ----@return number -function MouseJoint:getFrequency() end - ----Gets the highest allowed force. ----@return number -function MouseJoint:getMaxForce() end - ----Gets the target point. ----@return number, number -function MouseJoint:getTarget() end - ----Sets a new damping ratio. ----@param ratio number @The new damping ratio. -function MouseJoint:setDampingRatio(ratio) end - ----Sets a new frequency. ----@param freq number @The new frequency in hertz. -function MouseJoint:setFrequency(freq) end - ----Sets the highest allowed force. ----@param f number @The max allowed force. -function MouseJoint:setMaxForce(f) end - ----Sets the target point. ----@param x number @The x-component of the target. ----@param y number @The y-component of the target. -function MouseJoint:setTarget(x, y) end - ---endregion MouseJoint ---region PolygonShape ----@class PolygonShape ----A PolygonShape is a convex polygon with up to 8 vertices. -local PolygonShape = {} ----Get the local coordinates of the polygon's vertices. ---- ----This function has a variable number of return values. It can be used in a nested fashion with love.graphics.polygon. ----@return number, number, number, number -function PolygonShape:getPoints() end - ---endregion PolygonShape ---region PrismaticJoint ----@class PrismaticJoint ----Restricts relative motion between Bodies to one shared axis. -local PrismaticJoint = {} ----Checks whether the limits are enabled. ----@return boolean -function PrismaticJoint:areLimitsEnabled() end - ----Gets the world-space axis vector of the Prismatic Joint. ----@return number, number -function PrismaticJoint:getAxis() end - ----Get the current joint angle speed. ----@return number -function PrismaticJoint:getJointSpeed() end - ----Get the current joint translation. ----@return number -function PrismaticJoint:getJointTranslation() end - ----Gets the joint limits. ----@return number, number -function PrismaticJoint:getLimits() end - ----Gets the lower limit. ----@return number -function PrismaticJoint:getLowerLimit() end - ----Gets the maximum motor force. ----@return number -function PrismaticJoint:getMaxMotorForce() end - ----Returns the current motor force. ----@param invdt number @How long the force applies. Usually the inverse time step or 1/dt. ----@return number -function PrismaticJoint:getMotorForce(invdt) end - ----Gets the motor speed. ----@return number -function PrismaticJoint:getMotorSpeed() end - ----Gets the upper limit. ----@return number -function PrismaticJoint:getUpperLimit() end - ----Checks whether the motor is enabled. ----@return boolean -function PrismaticJoint:isMotorEnabled() end - ----Sets the limits. ----@param lower number @The lower limit, usually in meters. ----@param upper number @The upper limit, usually in meters. -function PrismaticJoint:setLimits(lower, upper) end - ----Enables/disables the joint limit. ----@return boolean -function PrismaticJoint:setLimitsEnabled() end - ----Sets the lower limit. ----@param lower number @The lower limit, usually in meters. -function PrismaticJoint:setLowerLimit(lower) end - ----Set the maximum motor force. ----@param f number @The maximum motor force, usually in N. -function PrismaticJoint:setMaxMotorForce(f) end - ----Enables/disables the joint motor. ----@param enable boolean @True to enable, false to disable. -function PrismaticJoint:setMotorEnabled(enable) end - ----Sets the motor speed. ----@param s number @The motor speed, usually in meters per second. -function PrismaticJoint:setMotorSpeed(s) end - ----Sets the upper limit. ----@param upper number @The upper limit, usually in meters. -function PrismaticJoint:setUpperLimit(upper) end - ---endregion PrismaticJoint ---region PulleyJoint ----@class PulleyJoint ----Allows you to simulate bodies connected through pulleys. -local PulleyJoint = {} ----Get the total length of the rope. ----@return number -function PulleyJoint:getConstant() end - ----Get the ground anchor positions in world coordinates. ----@return number, number, number, number -function PulleyJoint:getGroundAnchors() end - ----Get the current length of the rope segment attached to the first body. ----@return number -function PulleyJoint:getLengthA() end - ----Get the current length of the rope segment attached to the second body. ----@return number -function PulleyJoint:getLengthB() end - ----Get the maximum lengths of the rope segments. ----@return number, number -function PulleyJoint:getMaxLengths() end - ----Get the pulley ratio. ----@return number -function PulleyJoint:getRatio() end - ----Set the total length of the rope. ---- ----Setting a new length for the rope updates the maximum length values of the joint. ----@param length number @The new length of the rope in the joint. -function PulleyJoint:setConstant(length) end - ----Set the maximum lengths of the rope segments. ---- ----The physics module also imposes maximum values for the rope segments. If the parameters exceed these values, the maximum values are set instead of the requested values. ----@param max1 number @The new maximum length of the first segment. ----@param max2 number @The new maximum length of the second segment. -function PulleyJoint:setMaxLengths(max1, max2) end - ----Set the pulley ratio. ----@param ratio number @The new pulley ratio of the joint. -function PulleyJoint:setRatio(ratio) end - ---endregion PulleyJoint ---region RevoluteJoint ----@class RevoluteJoint ----Allow two Bodies to revolve around a shared point. -local RevoluteJoint = {} ----Checks whether limits are enabled. ----@return boolean -function RevoluteJoint:areLimitsEnabled() end - ----Get the current joint angle. ----@return number -function RevoluteJoint:getJointAngle() end - ----Get the current joint angle speed. ----@return number -function RevoluteJoint:getJointSpeed() end - ----Gets the joint limits. ----@return number, number -function RevoluteJoint:getLimits() end - ----Gets the lower limit. ----@return number -function RevoluteJoint:getLowerLimit() end - ----Gets the maximum motor force. ----@return number -function RevoluteJoint:getMaxMotorTorque() end - ----Gets the motor speed. ----@return number -function RevoluteJoint:getMotorSpeed() end - ----Get the current motor force. ----@return number -function RevoluteJoint:getMotorTorque() end - ----Gets the upper limit. ----@return number -function RevoluteJoint:getUpperLimit() end - ----Checks whether limits are enabled. ----@return boolean -function RevoluteJoint:hasLimitsEnabled() end - ----Checks whether the motor is enabled. ----@return boolean -function RevoluteJoint:isMotorEnabled() end - ----Sets the limits. ----@param lower number @The lower limit, in radians. ----@param upper number @The upper limit, in radians. -function RevoluteJoint:setLimits(lower, upper) end - ----Enables/disables the joint limit. ----@param enable boolean @True to enable, false to disable. -function RevoluteJoint:setLimitsEnabled(enable) end - ----Sets the lower limit. ----@param lower number @The lower limit, in radians. -function RevoluteJoint:setLowerLimit(lower) end - ----Set the maximum motor force. ----@param f number @The maximum motor force, in Nm. -function RevoluteJoint:setMaxMotorTorque(f) end - ----Enables/disables the joint motor. ----@param enable boolean @True to enable, false to disable. -function RevoluteJoint:setMotorEnabled(enable) end - ----Sets the motor speed. ----@param s number @The motor speed, radians per second. -function RevoluteJoint:setMotorSpeed(s) end - ----Sets the upper limit. ----@param upper number @The upper limit, in radians. -function RevoluteJoint:setUpperLimit(upper) end - ---endregion RevoluteJoint ---region RopeJoint ----@class RopeJoint ----The RopeJoint enforces a maximum distance between two points on two bodies. It has no other effect. -local RopeJoint = {} ----Gets the maximum length of a RopeJoint. ----@return number -function RopeJoint:getMaxLength() end - ----Sets the maximum length of a RopeJoint. ----@param maxLength number @The new maximum length of the RopeJoint. -function RopeJoint:setMaxLength(maxLength) end - ---endregion RopeJoint ---region Shape ----@class Shape ----Shapes are solid 2d geometrical objects which handle the mass and collision of a Body in love.physics. ---- ----Shapes are attached to a Body via a Fixture. The Shape object is copied when this happens. ---- ----The Shape's position is relative to the position of the Body it has been attached to. -local Shape = {} ----Returns the points of the bounding box for the transformed shape. ----@param tx number @The translation of the shape on the x-axis. ----@param ty number @The translation of the shape on the y-axis. ----@param tr number @The shape rotation. ----@param childIndex number @The index of the child to compute the bounding box of. ----@return number, number, number, number -function Shape:computeAABB(tx, ty, tr, childIndex) end - ----Computes the mass properties for the shape with the specified density. ----@param density number @The shape density. ----@return number, number, number, number -function Shape:computeMass(density) end - ----Returns the number of children the shape has. ----@return number -function Shape:getChildCount() end - ----Gets the radius of the shape. ----@return number -function Shape:getRadius() end - ----Gets a string representing the Shape. ---- ----This function can be useful for conditional debug drawing. ----@return ShapeType -function Shape:getType() end - ----Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position. ---- ----The ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length. ---- ----The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children. ---- ----The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point. ---- ----hitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction ----@param x1 number @The x position of the input line starting point. ----@param y1 number @The y position of the input line starting point. ----@param x2 number @The x position of the input line end point. ----@param y2 number @The y position of the input line end point. ----@param maxFraction number @Ray length parameter. ----@param tx number @The translation of the shape on the x-axis. ----@param ty number @The translation of the shape on the y-axis. ----@param tr number @The shape rotation. ----@param childIndex number @The index of the child the ray gets cast against. ----@return number, number, number -function Shape:rayCast(x1, y1, x2, y2, maxFraction, tx, ty, tr, childIndex) end - ----This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches. ----@param tx number @Translates the shape along the x-axis. ----@param ty number @Translates the shape along the y-axis. ----@param tr number @Rotates the shape. ----@param x number @The x-component of the point. ----@param y number @The y-component of the point. ----@return boolean -function Shape:testPoint(tx, ty, tr, x, y) end - ---endregion Shape ---region WeldJoint ----@class WeldJoint ----A WeldJoint essentially glues two bodies together. -local WeldJoint = {} ----Returns the damping ratio of the joint. ----@return number -function WeldJoint:getDampingRatio() end - ----Returns the frequency. ----@return number -function WeldJoint:getFrequency() end - ----Sets a new damping ratio. ----@param ratio number @The new damping ratio. -function WeldJoint:setDampingRatio(ratio) end - ----Sets a new frequency. ----@param freq number @The new frequency in hertz. -function WeldJoint:setFrequency(freq) end - ---endregion WeldJoint ---region WheelJoint ----@class WheelJoint ----Restricts a point on the second body to a line on the first body. -local WheelJoint = {} ----Gets the world-space axis vector of the Wheel Joint. ----@return number, number -function WheelJoint:getAxis() end - ----Returns the current joint translation speed. ----@return number -function WheelJoint:getJointSpeed() end - ----Returns the current joint translation. ----@return number -function WheelJoint:getJointTranslation() end - ----Returns the maximum motor torque. ----@return number -function WheelJoint:getMaxMotorTorque() end - ----Returns the speed of the motor. ----@return number -function WheelJoint:getMotorSpeed() end - ----Returns the current torque on the motor. ----@param invdt number @How long the force applies. Usually the inverse time step or 1/dt. ----@return number -function WheelJoint:getMotorTorque(invdt) end - ----Returns the damping ratio. ----@return number -function WheelJoint:getSpringDampingRatio() end - ----Returns the spring frequency. ----@return number -function WheelJoint:getSpringFrequency() end - ----Sets a new maximum motor torque. ----@param maxTorque number @The new maximum torque for the joint motor in newton meters. -function WheelJoint:setMaxMotorTorque(maxTorque) end - ----Starts and stops the joint motor. ----@param enable boolean @True turns the motor on and false turns it off. -function WheelJoint:setMotorEnabled(enable) end - ----Sets a new speed for the motor. ----@param speed number @The new speed for the joint motor in radians per second. -function WheelJoint:setMotorSpeed(speed) end - ----Sets a new damping ratio. ----@param ratio number @The new damping ratio. -function WheelJoint:setSpringDampingRatio(ratio) end - ----Sets a new spring frequency. ----@param freq number @The new frequency in hertz. -function WheelJoint:setSpringFrequency(freq) end - ---endregion WheelJoint ---region World ----@class World ----A world is an object that contains all bodies and joints. -local World = {} ----Destroys the world, taking all bodies, joints, fixtures and their shapes with it. ---- ----An error will occur if you attempt to use any of the destroyed objects after calling this function. -function World:destroy() end - ----Returns a table with all bodies. ----@return table -function World:getBodies() end - ----Returns the number of bodies in the world. ----@return number -function World:getBodyCount() end - ----Returns functions for the callbacks during the world update. ----@return function, function, function, function -function World:getCallbacks() end - ----Returns the number of contacts in the world. ----@return number -function World:getContactCount() end - ----Returns the function for collision filtering. ----@return function -function World:getContactFilter() end - ----Returns a table with all Contacts. ----@return table -function World:getContacts() end - ----Get the gravity of the world. ----@return number, number -function World:getGravity() end - ----Returns the number of joints in the world. ----@return number -function World:getJointCount() end - ----Returns a table with all joints. ----@return table -function World:getJoints() end - ----Gets whether the World is destroyed. Destroyed worlds cannot be used. ----@return boolean -function World:isDestroyed() end - ----Returns if the world is updating its state. ---- ----This will return true inside the callbacks from World:setCallbacks. ----@return boolean -function World:isLocked() end - ----Gets the sleep behaviour of the world. ----@return boolean -function World:isSleepingAllowed() end - ----Calls a function for each fixture inside the specified area by searching for any overlapping bounding box (Fixture:getBoundingBox). ----@param topLeftX number @The x position of the top-left point. ----@param topLeftY number @The y position of the top-left point. ----@param bottomRightX number @The x position of the bottom-right point. ----@param bottomRightY number @The y position of the bottom-right point. ----@param callback function @This function gets passed one argument, the fixture, and should return a boolean. The search will continue if it is true or stop if it is false. -function World:queryBoundingBox(topLeftX, topLeftY, bottomRightX, bottomRightY, callback) end - ----Casts a ray and calls a function for each fixtures it intersects. ----@param fixture Fixture @The fixture intersecting the ray. ----@param x number @The x position of the intersection point. ----@param y number @The y position of the intersection point. ----@param xn number @The x value of the surface normal vector of the shape edge. ----@param yn number @The y value of the surface normal vector of the shape edge. ----@param fraction number @The position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value). ----@return number -function World:rayCast(fixture, x, y, xn, yn, fraction) end - ----Sets functions for the collision callbacks during the world update. ---- ----Four Lua functions can be given as arguments. The value nil removes a function. ---- ----When called, each function will be passed three arguments. The first two arguments are the colliding fixtures and the third argument is the Contact between them. The postSolve callback additionally gets the normal and tangent impulse for each contact point. See notes. ---- ----If you are interested to know when exactly each callback is called, consult a Box2d manual ----@param beginContact function @Gets called when two fixtures begin to overlap. ----@param endContact function @Gets called when two fixtures cease to overlap. This will also be called outside of a world update, when colliding objects are destroyed. ----@param preSolve function @Gets called before a collision gets resolved. ----@param postSolve function @Gets called after the collision has been resolved. -function World:setCallbacks(beginContact, endContact, preSolve, postSolve) end - ----Sets a function for collision filtering. ---- ----If the group and category filtering doesn't generate a collision decision, this function gets called with the two fixtures as arguments. The function should return a boolean value where true means the fixtures will collide and false means they will pass through each other. ----@param filter function @The function handling the contact filtering. -function World:setContactFilter(filter) end - ----Set the gravity of the world. ----@param x number @The x component of gravity. ----@param y number @The y component of gravity. -function World:setGravity(x, y) end - ----Sets the sleep behaviour of the world. ----@param allow boolean @True if bodies in the world are allowed to sleep, or false if not. -function World:setSleepingAllowed(allow) end - ----Translates the World's origin. Useful in large worlds where floating point precision issues become noticeable at far distances from the origin. ----@param x number @The x component of the new origin with respect to the old origin. ----@param y number @The y component of the new origin with respect to the old origin. -function World:translateOrigin(x, y) end - ----Update the state of the world. ----@param dt number @The time (in seconds) to advance the physics simulation. ----@param velocityiterations number @The maximum number of steps used to determine the new velocities when resolving a collision. ----@param positioniterations number @The maximum number of steps used to determine the new positions when resolving a collision. -function World:update(dt, velocityiterations, positioniterations) end - ---endregion World ----The types of a Body. -BodyType = { - ---Static bodies do not move. - ['static'] = 1, - ---Dynamic bodies collide with all bodies. - ['dynamic'] = 2, - ---Kinematic bodies only collide with dynamic bodies. - ['kinematic'] = 3, -} ----Different types of joints. -JointType = { - ---A DistanceJoint. - ['distance'] = 1, - ---A FrictionJoint. - ['friction'] = 2, - ---A GearJoint. - ['gear'] = 3, - ---A MouseJoint. - ['mouse'] = 4, - ---A PrismaticJoint. - ['prismatic'] = 5, - ---A PulleyJoint. - ['pulley'] = 6, - ---A RevoluteJoint. - ['revolute'] = 7, - ---A RopeJoint. - ['rope'] = 8, - ---A WeldJoint. - ['weld'] = 9, -} ----The different types of Shapes, as returned by Shape:getType. -ShapeType = { - ---The Shape is a CircleShape. - ['circle'] = 1, - ---The Shape is a PolygonShape. - ['polygon'] = 2, - ---The Shape is a EdgeShape. - ['edge'] = 3, - ---The Shape is a ChainShape. - ['chain'] = 4, -} ----Returns the two closest points between two fixtures and their distance. ----@param fixture1 Fixture @The first fixture. ----@param fixture2 Fixture @The second fixture. ----@return number, number, number, number, number -function m.getDistance(fixture1, fixture2) end - ----Returns the meter scale factor. ---- ----All coordinates in the physics module are divided by this number, creating a convenient way to draw the objects directly to the screen without the need for graphics transformations. ---- ----It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. ----@return number -function m.getMeter() end - ----Creates a new body. ---- ----There are three types of bodies. ---- ----* Static bodies do not move, have a infinite mass, and can be used for level boundaries. ---- ----* Dynamic bodies are the main actors in the simulation, they collide with everything. ---- ----* Kinematic bodies do not react to forces and only collide with dynamic bodies. ---- ----The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData. ----@param world World @The world to create the body in. ----@param x number @The x position of the body. ----@param y number @The y position of the body. ----@param type BodyType @The type of the body. ----@return Body -function m.newBody(world, x, y, type) end - ----Creates a new ChainShape. ----@param loop boolean @If the chain should loop back to the first point. ----@param x1 number @The x position of the first point. ----@param y1 number @The y position of the first point. ----@param x2 number @The x position of the second point. ----@param y2 number @The y position of the second point. ----@param ... number @Additional point positions. ----@return ChainShape ----@overload fun(loop:boolean, points:table):ChainShape -function m.newChainShape(loop, x1, y1, x2, y2, ...) end - ----Creates a new CircleShape. ----@param radius number @The radius of the circle. ----@return CircleShape ----@overload fun(x:number, y:number, radius:number):CircleShape -function m.newCircleShape(radius) end - ----Creates a DistanceJoint between two bodies. ---- ----This joint constrains the distance between two points on two bodies to be constant. These two points are specified in world coordinates and the two bodies are assumed to be in place when this joint is created. The first anchor point is connected to the first body and the second to the second body, and the points define the length of the distance joint. ----@param body1 Body @The first body to attach to the joint. ----@param body2 Body @The second body to attach to the joint. ----@param x1 number @The x position of the first anchor point (world space). ----@param y1 number @The y position of the first anchor point (world space). ----@param x2 number @The x position of the second anchor point (world space). ----@param y2 number @The y position of the second anchor point (world space). ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return DistanceJoint -function m.newDistanceJoint(body1, body2, x1, y1, x2, y2, collideConnected) end - ----Creates a new EdgeShape. ----@param x1 number @The x position of the first point. ----@param y1 number @The y position of the first point. ----@param x2 number @The x position of the second point. ----@param y2 number @The y position of the second point. ----@return EdgeShape -function m.newEdgeShape(x1, y1, x2, y2) end - ----Creates and attaches a Fixture to a body. ---- ----Note that the Shape object is copied rather than kept as a reference when the Fixture is created. To get the Shape object that the Fixture owns, use Fixture:getShape. ----@param body Body @The body which gets the fixture attached. ----@param shape Shape @The shape to be copied to the fixture. ----@param density number @The density of the fixture. ----@return Fixture -function m.newFixture(body, shape, density) end - ----Create a friction joint between two bodies. A FrictionJoint applies friction to a body. ----@param body1 Body @The first body to attach to the joint. ----@param body2 Body @The second body to attach to the joint. ----@param x number @The x position of the anchor point. ----@param y number @The y position of the anchor point. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return FrictionJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, collideConnected:boolean):FrictionJoint -function m.newFrictionJoint(body1, body2, x, y, collideConnected) end - ----Create a GearJoint connecting two Joints. ---- ----The gear joint connects two joints that must be either prismatic or revolute joints. Using this joint requires that the joints it uses connect their respective bodies to the ground and have the ground as the first body. When destroying the bodies and joints you must make sure you destroy the gear joint before the other joints. ---- ----The gear joint has a ratio the determines how the angular or distance values of the connected joints relate to each other. The formula coordinate1 + ratio * coordinate2 always has a constant value that is set when the gear joint is created. ----@param joint1 Joint @The first joint to connect with a gear joint. ----@param joint2 Joint @The second joint to connect with a gear joint. ----@param ratio number @The gear ratio. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return GearJoint -function m.newGearJoint(joint1, joint2, ratio, collideConnected) end - ----Creates a joint between two bodies which controls the relative motion between them. ---- ----Position and rotation offsets can be specified once the MotorJoint has been created, as well as the maximum motor force and torque that will be be applied to reach the target offsets. ----@param body1 Body @The first body to attach to the joint. ----@param body2 Body @The second body to attach to the joint. ----@param correctionFactor number @The joint's initial position correction factor, in the range of 1. ----@return MotorJoint ----@overload fun(body1:Body, body2:Body, correctionFactor:number, collideConnected:boolean):MotorJoint -function m.newMotorJoint(body1, body2, correctionFactor) end - ----Create a joint between a body and the mouse. ---- ----This joint actually connects the body to a fixed point in the world. To make it follow the mouse, the fixed point must be updated every timestep (example below). ---- ----The advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine. ----@param body Body @The body to attach to the mouse. ----@param x number @The x position of the connecting point. ----@param y number @The y position of the connecting point. ----@return MouseJoint -function m.newMouseJoint(body, x, y) end - ----Creates a new PolygonShape. ---- ----This shape can have 8 vertices at most, and must form a convex shape. ----@param x1 number @The x position of the first point. ----@param y1 number @The y position of the first point. ----@param x2 number @The x position of the second point. ----@param y2 number @The y position of the second point. ----@param x3 number @The x position of the third point. ----@param y3 number @The y position of the third point. ----@param ... number @You can continue passing more point positions to create the PolygonShape. ----@return PolygonShape ----@overload fun(vertices:table):PolygonShape -function m.newPolygonShape(x1, y1, x2, y2, x3, y3, ...) end - ----Creates a PrismaticJoint between two bodies. ---- ----A prismatic joint constrains two bodies to move relatively to each other on a specified axis. It does not allow for relative rotation. Its definition and operation are similar to a revolute joint, but with translation and force substituted for angle and torque. ----@param body1 Body @The first body to connect with a prismatic joint. ----@param body2 Body @The second body to connect with a prismatic joint. ----@param x number @The x coordinate of the anchor point. ----@param y number @The y coordinate of the anchor point. ----@param ax number @The x coordinate of the axis vector. ----@param ay number @The y coordinate of the axis vector. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return PrismaticJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, ax:number, ay:number, collideConnected:boolean):PrismaticJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, ax:number, ay:number, collideConnected:boolean, referenceAngle:number):PrismaticJoint -function m.newPrismaticJoint(body1, body2, x, y, ax, ay, collideConnected) end - ----Creates a PulleyJoint to join two bodies to each other and the ground. ---- ----The pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant length1 + ratio * length2, which is set when the pulley joint is created. ---- ----Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths  be used to constrain the maximum lengths each side can attain. ----@param body1 Body @The first body to connect with a pulley joint. ----@param body2 Body @The second body to connect with a pulley joint. ----@param gx1 number @The x coordinate of the first body's ground anchor. ----@param gy1 number @The y coordinate of the first body's ground anchor. ----@param gx2 number @The x coordinate of the second body's ground anchor. ----@param gy2 number @The y coordinate of the second body's ground anchor. ----@param x1 number @The x coordinate of the pulley joint anchor in the first body. ----@param y1 number @The y coordinate of the pulley joint anchor in the first body. ----@param x2 number @The x coordinate of the pulley joint anchor in the second body. ----@param y2 number @The y coordinate of the pulley joint anchor in the second body. ----@param ratio number @The joint ratio. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return PulleyJoint -function m.newPulleyJoint(body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio, collideConnected) end - ----Shorthand for creating rectangular PolygonShapes. ---- ----By default, the local origin is located at the '''center''' of the rectangle as opposed to the top left for graphics. ----@param width number @The width of the rectangle. ----@param height number @The height of the rectangle. ----@return PolygonShape ----@overload fun(x:number, y:number, width:number, height:number, angle:number):PolygonShape -function m.newRectangleShape(width, height) end - ----Creates a pivot joint between two bodies. ---- ----This joint connects two bodies to a point around which they can pivot. ----@param body1 Body @The first body. ----@param body2 Body @The second body. ----@param x number @The x position of the connecting point. ----@param y number @The y position of the connecting point. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return RevoluteJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, collideConnected:boolean, referenceAngle:number):RevoluteJoint -function m.newRevoluteJoint(body1, body2, x, y, collideConnected) end - ----Creates a joint between two bodies. Its only function is enforcing a max distance between these bodies. ----@param body1 Body @The first body to attach to the joint. ----@param body2 Body @The second body to attach to the joint. ----@param x1 number @The x position of the first anchor point. ----@param y1 number @The y position of the first anchor point. ----@param x2 number @The x position of the second anchor point. ----@param y2 number @The y position of the second anchor point. ----@param maxLength number @The maximum distance for the bodies. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return RopeJoint -function m.newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength, collideConnected) end - ----Creates a constraint joint between two bodies. A WeldJoint essentially glues two bodies together. The constraint is a bit soft, however, due to Box2D's iterative solver. ----@param body1 Body @The first body to attach to the joint. ----@param body2 Body @The second body to attach to the joint. ----@param x number @The x position of the anchor point (world space). ----@param y number @The y position of the anchor point (world space). ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return WeldJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, collideConnected:boolean):WeldJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, collideConnected:boolean, referenceAngle:number):WeldJoint -function m.newWeldJoint(body1, body2, x, y, collideConnected) end - ----Creates a wheel joint. ----@param body1 Body @The first body. ----@param body2 Body @The second body. ----@param x number @The x position of the anchor point. ----@param y number @The y position of the anchor point. ----@param ax number @The x position of the axis unit vector. ----@param ay number @The y position of the axis unit vector. ----@param collideConnected boolean @Specifies whether the two bodies should collide with each other. ----@return WheelJoint ----@overload fun(body1:Body, body2:Body, x1:number, y1:number, x2:number, y2:number, ax:number, ay:number, collideConnected:boolean):WheelJoint -function m.newWheelJoint(body1, body2, x, y, ax, ay, collideConnected) end - ----Creates a new World. ----@param xg number @The x component of gravity. ----@param yg number @The y component of gravity. ----@param sleep boolean @Whether the bodies in this world are allowed to sleep. ----@return World -function m.newWorld(xg, yg, sleep) end - ----Sets the pixels to meter scale factor. ---- ----All coordinates in the physics module are divided by this number and converted to meters, and it creates a convenient way to draw the objects directly to the screen without the need for graphics transformations. ---- ----It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30. ----@param scale number @The scale factor as an integer. -function m.setMeter(scale) end - -return m \ No newline at end of file diff --git a/api/love.sound.lua b/api/love.sound.lua deleted file mode 100644 index 449813c..0000000 --- a/api/love.sound.lua +++ /dev/null @@ -1,88 +0,0 @@ ----@class love.sound ----This module is responsible for decoding sound files. It can't play the sounds, see love.audio for that. -local m = {} - ---region Decoder ----@class Decoder ----An object which can gradually decode a sound file. -local Decoder = {} ----Creates a new copy of current decoder. ---- ----The new decoder will start decoding from the beginning of the audio stream. ----@return Decoder -function Decoder:clone() end - ----Returns the number of bits per sample. ----@return number -function Decoder:getBitDepth() end - ----Returns the number of channels in the stream. ----@return number -function Decoder:getChannelCount() end - ----Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all. ----@return number -function Decoder:getDuration() end - ----Returns the sample rate of the Decoder. ----@return number -function Decoder:getSampleRate() end - ---endregion Decoder ---region SoundData ----@class SoundData ----Contains raw audio samples. ---- ----You can not play SoundData back directly. You must wrap a Source object around it. -local SoundData = {} ----Returns the number of bits per sample. ----@return number -function SoundData:getBitDepth() end - ----Returns the number of channels in the SoundData. ----@return number -function SoundData:getChannelCount() end - ----Gets the duration of the sound data. ----@return number -function SoundData:getDuration() end - ----Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order. ----@param i number @An integer value specifying the position of the sample (starting at 0). ----@return number ----@overload fun(i:number, channel:number):number -function SoundData:getSample(i) end - ----Returns the number of samples per channel of the SoundData. ----@return number -function SoundData:getSampleCount() end - ----Returns the sample rate of the SoundData. ----@return number -function SoundData:getSampleRate() end - ----Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order. ----@param i number @An integer value specifying the position of the sample (starting at 0). ----@param sample number @The normalized samplepoint (range -1.0 to 1.0). ----@overload fun(i:number, channel:number, sample:number):void -function SoundData:setSample(i, sample) end - ---endregion SoundData ----Attempts to find a decoder for the encoded sound data in the specified file. ----@param file File @The file with encoded sound data. ----@param buffer number @The size of each decoded chunk, in bytes. ----@return Decoder ----@overload fun(filename:string, buffer:number):Decoder -function m.newDecoder(file, buffer) end - ----Creates new SoundData from a filepath, File, or Decoder. It's also possible to create SoundData with a custom sample rate, channel and bit depth. ---- ----The sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way. ----@param filename string @The file name of the file to load. ----@return SoundData ----@overload fun(file:File):SoundData ----@overload fun(decoder:Decoder):SoundData ----@overload fun(samples:number, rate:number, bits:number, channels:number):SoundData -function m.newSoundData(filename) end - -return m \ No newline at end of file diff --git a/api/love.system.lua b/api/love.system.lua deleted file mode 100644 index edcb8c3..0000000 --- a/api/love.system.lua +++ /dev/null @@ -1,53 +0,0 @@ ----@class love.system ----Provides access to information about the user's system. -local m = {} - ----The basic state of the system's power supply. -PowerState = { - ---Cannot determine power status. - ['unknown'] = 1, - ---Not plugged in, running on a battery. - ['battery'] = 2, - ---Plugged in, no battery available. - ['nobattery'] = 3, - ---Plugged in, charging battery. - ['charging'] = 4, - ---Plugged in, battery is fully charged. - ['charged'] = 5, -} ----Gets text from the clipboard. ----@return string -function m.getClipboardText() end - ----Gets the current operating system. In general, LÖVE abstracts away the need to know the current operating system, but there are a few cases where it can be useful (especially in combination with os.execute.) ----@return string -function m.getOS() end - ----Gets information about the system's power supply. ----@return PowerState, number, number -function m.getPowerInfo() end - ----Gets the amount of logical processor in the system. ----@return number -function m.getProcessorCount() end - ----Gets whether another application on the system is playing music in the background. ---- ----Currently this is implemented on iOS and Android, and will always return false on other operating systems. The t.audio.mixwithsystem flag in love.conf can be used to configure whether background audio / music from other apps should play while LÖVE is open. ----@return boolean -function m.hasBackgroundMusic() end - ----Opens a URL with the user's web or file browser. ----@param url string @The URL to open. Must be formatted as a proper URL. ----@return boolean -function m.openURL(url) end - ----Puts text in the clipboard. ----@param text string @The new text to hold in the system's clipboard. -function m.setClipboardText(text) end - ----Causes the device to vibrate, if possible. Currently this will only work on Android and iOS devices that have a built-in vibration motor. ----@param seconds number @The duration to vibrate for. If called on an iOS device, it will always vibrate for 0.5 seconds due to limitations in the iOS system APIs. -function m.vibrate(seconds) end - -return m \ No newline at end of file diff --git a/api/love.thread.lua b/api/love.thread.lua deleted file mode 100644 index c873d5c..0000000 --- a/api/love.thread.lua +++ /dev/null @@ -1,117 +0,0 @@ ----@class love.thread ----Allows you to work with threads. ---- ----Threads are separate Lua environments, running in parallel to the main code. As their code runs separately, they can be used to compute complex operations without adversely affecting the frame rate of the main thread. However, as they are separate environments, they cannot access the variables and functions of the main thread, and communication between threads is limited. ---- ----All LOVE objects (userdata) are shared among threads so you'll only have to send their references across threads. You may run into concurrency issues if you manipulate an object on multiple threads at the same time. ---- ----When a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require. -local m = {} - ---region Channel ----@class Channel ----An object which can be used to send and receive data between different threads. -local Channel = {} ----Clears all the messages in the Channel queue. -function Channel:clear() end - ----Retrieves the value of a Channel message and removes it from the message queue. ---- ----It waits until a message is in the queue then returns the message value. ----@return Variant ----@overload fun(timeout:number):Variant -function Channel:demand() end - ----Retrieves the number of messages in the thread Channel queue. ----@return number -function Channel:getCount() end - ----Gets whether a pushed value has been popped or otherwise removed from the Channel. ----@param id number @An id value previously returned by Channel:push. ----@return boolean -function Channel:hasRead(id) end - ----Retrieves the value of a Channel message, but leaves it in the queue. ---- ----It returns nil if there's no message in the queue. ----@return Variant -function Channel:peek() end - ----Executes the specified function atomically with respect to this Channel. ---- ----Calling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel's methods at the same time, the different calls on each Thread might end up interleaved (e.g. one or more of the second thread's calls may happen in between the first thread's calls.) ---- ----This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned. ----@param func function @The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called. ----@param arg1 any @Additional arguments that the given function will receive when it is called. ----@param ... any @Additional arguments that the given function will receive when it is called. ----@return any, any -function Channel:performAtomic(func, arg1, ...) end - ----Retrieves the value of a Channel message and removes it from the message queue. ---- ----It returns nil if there are no messages in the queue. ----@return Variant -function Channel:pop() end - ----Send a message to the thread Channel. ---- ----See Variant for the list of supported types. ----@param value Variant @The contents of the message. ----@return number -function Channel:push(value) end - ----Send a message to the thread Channel and wait for a thread to accept it. ---- ----See Variant for the list of supported types. ----@param value Variant @The contents of the message. ----@return boolean ----@overload fun(value:Variant, timeout:number):boolean -function Channel:supply(value) end - ---endregion Channel ---region Thread ----@class Thread ----A Thread is a chunk of code that can run in parallel with other threads. Data can be sent between different threads with Channel objects. -local Thread = {} ----Retrieves the error string from the thread if it produced an error. ----@return string -function Thread:getError() end - ----Returns whether the thread is currently running. ---- ----Threads which are not running can be (re)started with Thread:start. ----@return boolean -function Thread:isRunning() end - ----Starts the thread. ---- ----Beginning with version 0.9.0, threads can be restarted after they have completed their execution. ----@overload fun(arg1:Variant, arg2:Variant, ...:Variant):void -function Thread:start() end - ----Wait for a thread to finish. ---- ----This call will block until the thread finishes. -function Thread:wait() end - ---endregion Thread ----Creates or retrieves a named thread channel. ----@param name string @The name of the channel you want to create or retrieve. ----@return Channel -function m.getChannel(name) end - ----Create a new unnamed thread channel. ---- ----One use for them is to pass new unnamed channels to other threads via Channel:push on a named channel. ----@return Channel -function m.newChannel() end - ----Creates a new Thread from a filename, string or FileData object containing Lua code. ----@param filename string @The name of the Lua file to use as the source. ----@return Thread ----@overload fun(fileData:FileData):Thread ----@overload fun(codestring:string):Thread -function m.newThread(filename) end - -return m \ No newline at end of file diff --git a/api/love.timer.lua b/api/love.timer.lua deleted file mode 100644 index bcb49ec..0000000 --- a/api/love.timer.lua +++ /dev/null @@ -1,33 +0,0 @@ ----@class love.timer ----Provides an interface to the user's clock. -local m = {} - ----Returns the average delta time (seconds per frame) over the last second. ----@return number -function m.getAverageDelta() end - ----Returns the time between the last two frames. ----@return number -function m.getDelta() end - ----Returns the current frames per second. ----@return number -function m.getFPS() end - ----Returns the value of a timer with an unspecified starting time. ---- ----This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown. ----@return number -function m.getTime() end - ----Pauses the current thread for the specified amount of time. ----@param s number @Seconds to sleep for. -function m.sleep(s) end - ----Measures the time between two frames. ---- ----Calling this changes the return value of love.timer.getDelta. ----@return number -function m.step() end - -return m \ No newline at end of file diff --git a/api/love.touch.lua b/api/love.touch.lua deleted file mode 100644 index b12a953..0000000 --- a/api/love.touch.lua +++ /dev/null @@ -1,19 +0,0 @@ ----@class love.touch ----Provides an interface to touch-screen presses. -local m = {} - ----Gets the current position of the specified touch-press, in pixels. ----@param id light userdata @The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. ----@return number, number -function m.getPosition(id) end - ----Gets the current pressure of the specified touch-press. ----@param id light userdata @The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. ----@return number -function m.getPressure(id) end - ----Gets a list of all active touch-presses. ----@return table -function m.getTouches() end - -return m \ No newline at end of file diff --git a/api/love.video.lua b/api/love.video.lua deleted file mode 100644 index 215aabf..0000000 --- a/api/love.video.lua +++ /dev/null @@ -1,18 +0,0 @@ ----@class love.video ----This module is responsible for decoding, controlling, and streaming video files. ---- ----It can't draw the videos, see love.graphics.newVideo and Video objects for that. -local m = {} - ---region VideoStream ----@class VideoStream ----An object which decodes, streams, and controls Videos. -local VideoStream = {} ---endregion VideoStream ----Creates a new VideoStream. Currently only Ogg Theora video files are supported. VideoStreams can't draw videos, see love.graphics.newVideo for that. ----@param filename string @The file path to the Ogg Theora video file. ----@return VideoStream ----@overload fun(file:File):VideoStream -function m.newVideoStream(filename) end - -return m \ No newline at end of file diff --git a/api/love.window.lua b/api/love.window.lua deleted file mode 100644 index 935cdce..0000000 --- a/api/love.window.lua +++ /dev/null @@ -1,233 +0,0 @@ ----@class love.window ----Provides an interface for modifying and retrieving information about the program's window. -local m = {} - ----Types of device display orientation. -DisplayOrientation = { - ---Orientation cannot be determined. - ['unknown'] = 1, - ---Landscape orientation. - ['landscape'] = 2, - ---Landscape orientation (flipped). - ['landscapeflipped'] = 3, - ---Portrait orientation. - ['portrait'] = 4, - ---Portrait orientation (flipped). - ['portraitflipped'] = 5, -} ----Types of fullscreen modes. -FullscreenType = { - ---Sometimes known as borderless fullscreen windowed mode. A borderless screen-sized window is created which sits on top of all desktop UI elements. The window is automatically resized to match the dimensions of the desktop, and its size cannot be changed. - ['desktop'] = 1, - ---Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor. - ['exclusive'] = 2, - ---Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor. - ['normal'] = 3, -} ----Types of message box dialogs. Different types may have slightly different looks. -MessageBoxType = { - ---Informational dialog. - ['info'] = 1, - ---Warning dialog. - ['warning'] = 2, - ---Error dialog. - ['error'] = 3, -} ----Closes the window. It can be reopened with love.window.setMode. -function m.close() end - ----Converts a number from pixels to density-independent units. ---- ----The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.fromPixels(1600) would return 800 in that case. ---- ----This function converts coordinates from pixels to the size users are expecting them to display at onscreen. love.window.toPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. ---- ----Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. ----@param pixelvalue number @A number in pixels to convert to density-independent units. ----@return number ----@overload fun(px:number, py:number):number, number -function m.fromPixels(pixelvalue) end - ----Gets the DPI scale factor associated with the window. ---- ----The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.getDPIScale() would return 2.0 in that case. ---- ----The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. ---- ----The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. ----@return number -function m.getDPIScale() end - ----Gets the name of a display. ----@param displayindex number @The index of the display to get the name of. ----@return string -function m.getDisplayName(displayindex) end - ----Gets current device display orientation. ----@param index number @Display index to get its display orientation, or nil for default display index. ----@return DisplayOrientation -function m.getDisplayOrientation(index) end - ----Gets whether the window is fullscreen. ----@return boolean, FullscreenType -function m.getFullscreen() end - ----Gets a list of supported fullscreen modes. ----@param display number @The index of the display, if multiple monitors are available. ----@return table -function m.getFullscreenModes(display) end - ----Gets the window icon. ----@return ImageData -function m.getIcon() end - ----Gets the display mode and properties of the window. ----@return number, number, table -function m.getMode() end - ----Gets the position of the window on the screen. ---- ----The window position is in the coordinate space of the display it is currently in. ----@return number, number, number -function m.getPosition() end - ----Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user. ----@return number, number, number, number -function m.getSafeArea() end - ----Gets the window title. ----@return string -function m.getTitle() end - ----Gets current vertical synchronization (vsync). ----@return number -function m.getVSync() end - ----Checks if the game window has keyboard focus. ----@return boolean -function m.hasFocus() end - ----Checks if the game window has mouse focus. ----@return boolean -function m.hasMouseFocus() end - ----Gets whether the display is allowed to sleep while the program is running. ---- ----Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. ----@return boolean -function m.isDisplaySleepEnabled() end - ----Gets whether the Window is currently maximized. ---- ----The window can be maximized if it is not fullscreen and is resizable, and either the user has pressed the window's Maximize button or love.window.maximize has been called. ----@return boolean -function m.isMaximized() end - ----Gets whether the Window is currently minimized. ----@return boolean -function m.isMinimized() end - ----Checks if the window is open. ----@return boolean -function m.isOpen() end - ----Checks if the game window is visible. ---- ----The window is considered visible if it's not minimized and the program isn't hidden. ----@return boolean -function m.isVisible() end - ----Makes the window as large as possible. ---- ----This function has no effect if the window isn't resizable, since it essentially programmatically presses the window's 'maximize' button. -function m.maximize() end - ----Minimizes the window to the system's task bar / dock. -function m.minimize() end - ----Causes the window to request the attention of the user if it is not in the foreground. ---- ----In Windows the taskbar icon will flash, and in OS X the dock icon will bounce. ----@param continuous boolean @Whether to continuously request attention until the window becomes active, or to do it only once. -function m.requestAttention(continuous) end - ----Restores the size and position of the window if it was minimized or maximized. -function m.restore() end - ----Sets whether the display is allowed to sleep while the program is running. ---- ----Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed. ----@param enable boolean @True to enable system display sleep, false to disable it. -function m.setDisplaySleepEnabled(enable) end - ----Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected. ----@param fullscreen boolean @Whether to enter or exit fullscreen mode. ----@return boolean ----@overload fun(fullscreen:boolean, fstype:FullscreenType):boolean -function m.setFullscreen(fullscreen) end - ----Sets the window icon until the game is quit. Not all operating systems support very large icon images. ----@param imagedata ImageData @The window icon image. ----@return boolean -function m.setIcon(imagedata) end - ----Sets the display mode and properties of the window. ---- ----If width or height is 0, setMode will use the width and height of the desktop. ---- ----Changing the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with canvases beforehand or re-draw to them afterward if you need to. ----@param width number @Display width. ----@param height number @Display height. ----@param flags table @The flags table with the options: ----@return boolean -function m.setMode(width, height, flags) end - ----Sets the position of the window on the screen. ---- ----The window position is in the coordinate space of the specified display. ----@param x number @The x-coordinate of the window's position. ----@param y number @The y-coordinate of the window's position. ----@param display number @The index of the display that the new window position is relative to. -function m.setPosition(x, y, display) end - ----Sets the window title. ----@param title string @The new window title. -function m.setTitle(title) end - ----Sets vertical synchronization mode. ----@param vsync number @VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync. -function m.setVSync(vsync) end - ----Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons. ----@param title string @The title of the message box. ----@param message string @The text inside the message box. ----@param type MessageBoxType @The type of the message box. ----@param attachtowindow boolean @Whether the message box should be attached to the love window or free-floating. ----@return boolean ----@overload fun(title:string, message:string, buttonlist:table, type:MessageBoxType, attachtowindow:boolean):number -function m.showMessageBox(title, message, type, attachtowindow) end - ----Converts a number from density-independent units to pixels. ---- ----The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.toPixels(800) would return 1600 in that case. ---- ----This is used to convert coordinates from the size users are expecting them to display at onscreen to pixels. love.window.fromPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. ---- ----Most LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units. ----@param value number @A number in density-independent units to convert to pixels. ----@return number ----@overload fun(x:number, y:number):number, number -function m.toPixels(value) end - ----Sets the display mode and properties of the window, without modifying unspecified properties. ---- ----If width or height is 0, updateMode will use the width and height of the desktop. ---- ----Changing the display mode may have side effects: for example, canvases will be cleared. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to. ----@param width number @Window width. ----@param height number @Window height. ----@param settings table @The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode. ----@return boolean -function m.updateMode(width, height, settings) end - -return m \ No newline at end of file diff --git a/love-api b/love-api new file mode 160000 index 0000000..5d83a94 --- /dev/null +++ b/love-api @@ -0,0 +1 @@ +Subproject commit 5d83a940a19bb6747205beb1e10beee1944d0dcd diff --git a/love_api.lua b/love_api.lua deleted file mode 100644 index f7ab134..0000000 --- a/love_api.lua +++ /dev/null @@ -1,1203 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - version = '11.3', - functions = { - { - name = 'getVersion', - description = 'Gets the current running version of LÖVE.', - variants = { - { - description = 'For LÖVE versions below 0.9.1, the following variables can be used instead (and still work in 0.9.2 and newer):\n\nlove._version_major\n\nlove._version_minor\n\nlove._version_revision', - returns = { - { - type = 'number', - name = 'major', - description = 'The major version of LÖVE, i.e. 0 for version 0.9.1.', - }, - { - type = 'number', - name = 'minor', - description = 'The minor version of LÖVE, i.e. 9 for version 0.9.1.', - }, - { - type = 'number', - name = 'revision', - description = 'The revision version of LÖVE, i.e. 1 for version 0.9.1.', - }, - { - type = 'string', - name = 'codename', - description = 'The codename of the current version, i.e. \'Baby Inspector\' for version 0.9.1.', - }, - }, - }, - }, - }, - { - name = 'hasDeprecationOutput', - description = 'Gets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise.\n\nWhen deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'Whether deprecation output is enabled.', - }, - }, - }, - }, - }, - { - name = 'setDeprecationOutput', - description = 'Sets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise.\n\nWhen deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'Whether to enable or disable deprecation output.', - }, - }, - }, - }, - }, - }, - callbacks = { - { - name = 'conf', - description = 'If a file called conf.lua is present in your game folder (or .love file), it is run before the LÖVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LÖVE \'boot\' script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff.', - variants = { - { - arguments = { - { - type = 'table', - name = 't', - description = 'The love.conf function takes one argument: a table filled with all the default values which you can overwrite to your liking. If you want to change the default window size, for instance, do:\n\nfunction love.conf(t)\n t.window.width = 1024\n t.window.height = 768\nend\n\nIf you don\'t need the physics module or joystick module, do the following.\n\nfunction love.conf(t)\n t.modules.joystick = false\n t.modules.physics = false\nend\n\nSetting unused modules to false is encouraged when you release your game. It reduces startup time slightly (especially if the joystick module is disabled) and reduces memory usage (slightly).\n\nNote that you can\'t disable love.filesystem; it\'s mandatory. The same goes for the love module itself. love.graphics needs love.window to be enabled.', - table = { - { - type = 'string', - name = 'identity', - description = 'This flag determines the name of the save directory for your game. Note that you can only specify the name, not the location where it will be created:\nt.identity = "gabe_HL3" -- Correct\n\nt.identity = "c:/Users/gabe/HL3" -- Incorrect\nAlternatively love.filesystem.setIdentity can be used to set the save directory outside of the config file.', - default = 'nil', - }, - { - type = 'boolean', - name = 'appendidentity', - description = 'This flag determines if game directory should be searched first then save directory (true) or otherwise (false)', - default = 'false', - }, - { - type = 'string', - name = 'version', - description = 't.version should be a string, representing the version of LÖVE for which your game was made. It should be formatted as "X.Y.Z" where X is the major release number, Y the minor, and Z the patch level. It allows LÖVE to display a warning if it isn\'t compatible. Its default is the version of LÖVE running.', - default = '"11.3"', - }, - { - type = 'boolean', - name = 'console', - description = 'Determines whether a console should be opened alongside the game window (Windows only) or not. Note: On OSX you can get console output by running LÖVE through the terminal.', - default = 'false', - }, - { - type = 'boolean', - name = 'accelerometerjoystick', - description = 'Sets whether the device accelerometer on iOS and Android should be exposed as a 3-axis Joystick. Disabling the accelerometer when it\'s not used may reduce CPU usage.', - default = 'true', - }, - { - type = 'boolean', - name = 'externalstorage', - description = 'Sets whether files are saved in external storage (true) or internal storage (false) on Android.', - default = 'false', - }, - { - type = 'boolean', - name = 'gammacorrect', - description = 'Determines whether gamma-correct rendering is enabled, when the system supports it.', - default = 'false', - }, - { - type = 'table', - name = 'audio', - description = 'Audio options.', - table = { - { - type = 'boolean', - name = 'mic', - description = 'Request microphone permission from the user. When user allows it, love.audio.getRecordingDevices will lists recording devices available. Otherwise, love.audio.getRecordingDevices returns empty table and a message is shown to inform user when called.', - default = 'false', - }, - { - type = 'boolean', - name = 'mixwithsystem', - description = 'Sets whether background audio / music from other apps should play while LÖVE is open. See love.system.hasBackgroundMusic for more details.', - default = 'true', - }, - }, - }, - { - type = 'table', - name = 'window', - description = 'It is possible to defer window creation until love.window.setMode is first called in your code. To do so, set t.window = nil in love.conf (or t.screen = nil in older versions.) If this is done, LÖVE may crash if any function from love.graphics is called before the first love.window.setMode in your code.\n\nThe t.window table was named t.screen in versions prior to 0.9.0. The t.screen table doesn\'t exist in love.conf in 0.9.0, and the t.window table doesn\'t exist in love.conf in 0.8.0. This means love.conf will fail to execute (therefore it will fall back to default values) if care is not taken to use the correct table for the LÖVE version being used.', - table = { - { - type = 'string', - name = 'title', - description = 'Sets the title of the window the game is in. Alternatively love.window.setTitle can be used to change the window title outside of the config file.', - default = '"Untitled"', - }, - { - type = 'string', - name = 'icon', - description = 'A filepath to an image to use as the window\'s icon. Not all operating systems support very large icon images. The icon can also be changed with love.window.setIcon.', - default = 'nil', - }, - { - type = 'number', - name = 'width', - description = 'Sets the window\'s dimensions. If these flags are set to 0 LÖVE automatically uses the user\'s desktop dimensions.', - default = '800', - }, - { - type = 'number', - name = 'height', - description = 'Sets the window\'s dimensions. If these flags are set to 0 LÖVE automatically uses the user\'s desktop dimensions.', - default = '600', - }, - { - type = 'boolean', - name = 'borderless', - description = 'Removes all border visuals from the window. Note that the effects may wary between operating systems.', - default = 'false', - }, - { - type = 'boolean', - name = 'resizable', - description = 'If set to true this allows the user to resize the game\'s window.', - default = 'false', - }, - { - type = 'number', - name = 'minwidth', - description = 'Sets the minimum width and height for the game\'s window if it can be resized by the user. If you set lower values to window.width and window.height LÖVE will always favor the minimum dimensions set via window.minwidth and window.minheight.', - default = '1', - }, - { - type = 'number', - name = 'minheight', - description = 'Sets the minimum width and height for the game\'s window if it can be resized by the user. If you set lower values to window.width and window.height LÖVE will always favor the minimum dimensions set via window.minwidth and window.minheight.', - default = '1', - }, - { - type = 'boolean', - name = 'fullscreen', - description = 'Whether to run the game in fullscreen (true) or windowed (false) mode. The fullscreen can also be toggled via love.window.setFullscreen or love.window.setMode.', - default = 'false', - }, - { - type = 'string', - name = 'fullscreentype', - description = 'Specifies the type of fullscreen mode to use (normal or desktop). Generally the desktop is recommended, as it is less restrictive than normal mode on some operating systems.', - default = '"desktop"', - }, - { - type = 'boolean', - name = 'usedpiscale', - description = 'Sets whetever to enable or disable automatic DPI scaling.', - default = 'true', - }, - { - type = 'number', - name = 'vsync', - description = 'Enables or deactivates vertical synchronization. Vsync tries to keep the game at a steady framerate and can prevent issues like screen tearing. It is recommended to keep vsync activated if you don\'t know about the possible implications of turning it off. Before LÖVE 11.0, this value was boolean (true or false). Since LÖVE 11.0, this value is number (1 to enable vsync, 0 to disable vsync, -1 to use adaptive vsync when supported).\n\nNote that in iOS, vertical synchronization is always enabled and cannot be changed.', - default = 'true', - }, - { - type = 'number', - name = 'depth', - description = 'The number of bits per sample in the depth buffer (16/24/32, default nil)', - default = 'nil', - }, - { - type = 'number', - name = 'stencil', - description = 'Then number of bits per sample in the depth buffer (generally 8, default nil)', - default = 'nil', - }, - { - type = 'number', - name = 'msaa', - description = 'The number of samples to use with multi-sampled antialiasing.', - default = '0', - }, - { - type = 'number', - name = 'display', - description = 'The index of the display to show the window in, if multiple monitors are available.', - default = '1', - }, - { - type = 'boolean', - name = 'highdpi', - description = 'See love.window.getPixelScale, love.window.toPixels, and love.window.fromPixels. It is recommended to keep this option disabled if you can\'t test your game on a Mac or iOS system with a Retina display, because code will need tweaking to make sure things look correct.', - default = 'false', - }, - { - type = 'number', - name = 'x', - description = 'Determines the position of the window on the user\'s screen. Alternatively love.window.setPosition can be used to change the position on the fly.', - default = 'nil', - }, - { - type = 'number', - name = 'y', - description = 'Determines the position of the window on the user\'s screen. Alternatively love.window.setPosition can be used to change the position on the fly.', - default = 'nil', - }, - }, - }, - { - type = 'table', - name = 'modules', - description = 'Module options.', - table = { - { - type = 'boolean', - name = 'audio', - description = 'Enable the audio module.', - default = 'true', - }, - { - type = 'boolean', - name = 'event', - description = 'Enable the event module.', - default = 'true', - }, - { - type = 'boolean', - name = 'graphics', - description = 'Enable the graphics module.', - default = 'true', - }, - { - type = 'boolean', - name = 'image', - description = 'Enable the image module.', - default = 'true', - }, - { - type = 'boolean', - name = 'joystick', - description = 'Enable the joystick module.', - default = 'true', - }, - { - type = 'boolean', - name = 'keyboard', - description = 'Enable the keyboard module.', - default = 'true', - }, - { - type = 'boolean', - name = 'math', - description = 'Enable the math module.', - default = 'true', - }, - { - type = 'boolean', - name = 'mouse', - description = 'Enable the mouse module.', - default = 'true', - }, - { - type = 'boolean', - name = 'physics', - description = 'Enable the physics module.', - default = 'true', - }, - { - type = 'boolean', - name = 'sound', - description = 'Enable the sound module.', - default = 'true', - }, - { - type = 'boolean', - name = 'system', - description = 'Enable the system module.', - default = 'true', - }, - { - type = 'boolean', - name = 'timer', - description = 'Enable the timer module.', - default = 'true', - }, - { - type = 'boolean', - name = 'touch', - description = 'Enable the touch module.', - default = 'true', - }, - { - type = 'boolean', - name = 'video', - description = 'Enable the video module.', - default = 'true', - }, - { - type = 'boolean', - name = 'window', - description = 'Enable the window module.', - default = 'true', - }, - { - type = 'boolean', - name = 'thread', - description = 'Enable the thread module.', - default = 'true', - }, - }, - }, - }, - }, - }, - }, - }, - }, - { - name = 'directorydropped', - description = 'Callback function triggered when a directory is dragged and dropped onto the window.', - variants = { - { - description = 'Paths passed into this callback are able to be used with love.filesystem.mount, which is the only way to get read access via love.filesystem to the dropped directory. love.filesystem.mount does not generally accept other full platform-dependent directory paths that haven\'t been dragged and dropped onto the window.', - arguments = { - { - type = 'string', - name = 'path', - description = 'The full platform-dependent path to the directory. It can be used as an argument to love.filesystem.mount, in order to gain read access to the directory with love.filesystem.', - }, - }, - }, - }, - }, - { - name = 'displayrotated', - description = 'Called when the device display orientation changed, for example, user rotated their phone 180 degrees.', - variants = { - { - arguments = { - { - type = 'number', - name = 'index', - description = 'The index of the display that changed orientation.', - }, - { - type = 'DisplayOrientation', - name = 'orientation', - description = 'The new orientation.', - }, - }, - }, - }, - }, - { - name = 'draw', - description = 'Callback function used to draw on the screen every frame.', - variants = { - { - }, - }, - }, - { - name = 'errorhandler', - description = 'The error handler, used to display error messages.', - variants = { - { - arguments = { - { - type = 'string', - name = 'msg', - description = 'The error message.', - }, - }, - }, - }, - }, - { - name = 'filedropped', - description = 'Callback function triggered when a file is dragged and dropped onto the window.', - variants = { - { - description = '', - arguments = { - { - type = 'DroppedFile', - name = 'file', - description = 'The unopened File object representing the file that was dropped.', - }, - }, - }, - }, - }, - { - name = 'focus', - description = 'Callback function triggered when window receives or loses focus.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'focus', - description = 'True if the window gains focus, false if it loses focus. ', - }, - }, - }, - }, - }, - { - name = 'gamepadaxis', - description = 'Called when a Joystick\'s virtual gamepad axis is moved.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'GamepadAxis', - name = 'axis', - description = 'The virtual gamepad axis.', - }, - { - type = 'number', - name = 'value', - description = 'The new axis value.', - }, - }, - }, - }, - }, - { - name = 'gamepadpressed', - description = 'Called when a Joystick\'s virtual gamepad button is pressed.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'GamepadButton', - name = 'button', - description = 'The virtual gamepad button.', - }, - }, - }, - }, - }, - { - name = 'gamepadreleased', - description = 'Called when a Joystick\'s virtual gamepad button is released.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'GamepadButton', - name = 'button', - description = 'The virtual gamepad button.', - }, - }, - }, - }, - }, - { - name = 'joystickadded', - description = 'Called when a Joystick is connected.', - variants = { - { - description = 'This callback is also triggered after love.load for every Joystick which was already connected when the game started up.', - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The newly connected Joystick object.', - }, - }, - }, - }, - }, - { - name = 'joystickaxis', - description = 'Called when a joystick axis moves.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'number', - name = 'axis', - description = 'The axis number.', - }, - { - type = 'number', - name = 'value', - description = 'The new axis value.', - }, - }, - }, - }, - }, - { - name = 'joystickhat', - description = 'Called when a joystick hat direction changes.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'number', - name = 'hat', - description = 'The hat number.', - }, - { - type = 'JoystickHat', - name = 'direction', - description = 'The new hat direction.', - }, - }, - }, - }, - }, - { - name = 'joystickpressed', - description = 'Called when a joystick button is pressed.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'number', - name = 'button', - description = 'The button number.', - }, - }, - }, - }, - }, - { - name = 'joystickreleased', - description = 'Called when a joystick button is released.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The joystick object.', - }, - { - type = 'number', - name = 'button', - description = 'The button number.', - }, - }, - }, - }, - }, - { - name = 'joystickremoved', - description = 'Called when a Joystick is disconnected.', - variants = { - { - arguments = { - { - type = 'Joystick', - name = 'joystick', - description = 'The now-disconnected Joystick object.', - }, - }, - }, - }, - }, - { - name = 'keypressed', - description = 'Callback function triggered when a key is pressed.', - variants = { - { - description = 'Scancodes are keyboard layout-independent, so the scancode \'w\' will be generated if the key in the same place as the \'w\' key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nKey repeat needs to be enabled with love.keyboard.setKeyRepeat for repeat keypress events to be received. This does not affect love.textinput.', - arguments = { - { - type = 'KeyConstant', - name = 'key', - description = 'Character of the pressed key.', - }, - { - type = 'Scancode', - name = 'scancode', - description = 'The scancode representing the pressed key.', - }, - { - type = 'boolean', - name = 'isrepeat', - description = 'Whether this keypress event is a repeat. The delay between key repeats depends on the user\'s system settings.', - }, - }, - }, - { - description = 'Key repeat needs to be enabled with love.keyboard.setKeyRepeat for repeat keypress events to be received.', - arguments = { - { - type = 'KeyConstant', - name = 'key', - description = 'Character of the key pressed.', - }, - { - type = 'boolean', - name = 'isrepeat', - description = 'Whether this keypress event is a repeat. The delay between key repeats depends on the user\'s system settings.', - }, - }, - }, - }, - }, - { - name = 'keyreleased', - description = 'Callback function triggered when a keyboard key is released.', - variants = { - { - description = 'Scancodes are keyboard layout-independent, so the scancode \'w\' will be 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.', - arguments = { - { - type = 'KeyConstant', - name = 'key', - description = 'Character of the released key.', - }, - { - type = 'Scancode', - name = 'scancode', - description = 'The scancode representing the released key.', - }, - }, - }, - }, - }, - { - name = 'load', - description = 'This function is called exactly once at the beginning of the game.', - variants = { - { - description = 'In LÖVE 11.0, the passed arguments excludes the game name and the fused command-line flag (if exist) when runs from non-fused LÖVE executable. Previous version pass the argument as-is without any filtering.', - arguments = { - { - type = 'table', - name = 'arg', - description = 'Command-line arguments given to the game.', - }, - { - type = 'table', - name = 'unfilteredArg', - description = 'Unfiltered command-line arguments given to the executable (see #Notes).', - }, - }, - }, - }, - }, - { - name = 'lowmemory', - description = 'Callback function triggered when the system is running out of memory on mobile devices.\n\nMobile operating systems may forcefully kill the game if it uses too much memory, so any non-critical resource should be removed if possible (by setting all variables referencing the resources to \'\'\'nil\'\'\'), when this event is triggered. Sounds and images in particular tend to use the most memory.', - variants = { - { - }, - }, - }, - { - name = 'mousefocus', - description = 'Callback function triggered when window receives or loses mouse focus.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'focus', - description = 'Whether the window has mouse focus or not.', - }, - }, - }, - }, - }, - { - name = 'mousemoved', - description = 'Callback function triggered when the mouse is moved.', - variants = { - { - description = 'If Relative Mode is enabled for the mouse, the \'\'\'dx\'\'\' and \'\'\'dy\'\'\' arguments of this callback will update but \'\'\'x\'\'\' and \'\'\'y\'\'\' are not guaranteed to.', - arguments = { - { - type = 'number', - name = 'x', - description = 'The mouse position on the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The mouse position on the y-axis.', - }, - { - type = 'number', - name = 'dx', - description = 'The amount moved along the x-axis since the last time love.mousemoved was called.', - }, - { - type = 'number', - name = 'dy', - description = 'The amount moved along the y-axis since the last time love.mousemoved was called.', - }, - { - type = 'boolean', - name = 'istouch', - description = 'True if the mouse button press originated from a touchscreen touch-press.', - }, - }, - }, - }, - }, - { - name = 'mousepressed', - description = 'Callback function triggered when a mouse button is pressed.', - variants = { - { - description = 'Use love.wheelmoved to detect mouse wheel motion. It will not register as a button press in version 0.10.0 and newer.', - arguments = { - { - type = 'number', - name = 'x', - description = 'Mouse x position, in pixels.', - }, - { - type = 'number', - name = 'y', - description = 'Mouse y position, in pixels.', - }, - { - type = 'number', - name = 'button', - description = 'The button index that was pressed. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.', - }, - { - type = 'boolean', - name = 'istouch', - description = 'True if the mouse button press originated from a touchscreen touch-press.', - }, - { - type = 'number', - name = 'presses', - description = 'The number of presses in a short time frame and small area, used to simulate double, triple clicks', - }, - }, - }, - }, - }, - { - name = 'mousereleased', - description = 'Callback function triggered when a mouse button is released.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'Mouse x position, in pixels.', - }, - { - type = 'number', - name = 'y', - description = 'Mouse y position, in pixels.', - }, - { - type = 'number', - name = 'button', - description = 'The button index that was released. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.', - }, - { - type = 'boolean', - name = 'istouch', - description = 'True if the mouse button release originated from a touchscreen touch-release.', - }, - { - type = 'number', - name = 'presses', - description = 'The number of presses in a short time frame and small area, used to simulate double, triple clicks', - }, - }, - }, - }, - }, - { - name = 'quit', - description = 'Callback function triggered when the game is closed.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'r', - description = 'Abort quitting. If true, do not close the game.', - }, - }, - }, - }, - }, - { - name = 'resize', - description = 'Called when the window is resized, for example if the user resizes the window, or if love.window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.', - variants = { - { - description = 'Calls to love.window.setMode will \'\'\'only\'\'\' trigger this event if the width or height of the window after the call doesn\'t match the requested width and height. This can happen if a fullscreen mode is requested which doesn\'t match any supported mode, or if the fullscreen type is \'desktop\' and the requested width or height don\'t match the desktop resolution.\n\nSince 11.0, this function returns width and height in DPI-scaled units rather than pixels.', - arguments = { - { - type = 'number', - name = 'w', - description = 'The new width.', - }, - { - type = 'number', - name = 'h', - description = 'The new height.', - }, - }, - }, - }, - }, - { - name = 'run', - description = 'The main function, containing the main loop. A sensible default is used when left out.', - variants = { - { - returns = { - { - type = 'function', - name = 'mainLoop', - description = 'Function which handlers one frame, including events and rendering when called.', - }, - }, - }, - }, - }, - { - name = 'textedited', - description = 'Called when the candidate text for an IME (Input Method Editor) has changed.\n\nThe candidate text is not the final text that the user will eventually choose. Use love.textinput for that.', - variants = { - { - description = '', - arguments = { - { - type = 'string', - name = 'text', - description = 'The UTF-8 encoded unicode candidate text.', - }, - { - type = 'number', - name = 'start', - description = 'The start cursor of the selected candidate text.', - }, - { - type = 'number', - name = 'length', - description = 'The length of the selected candidate text. May be 0.', - }, - }, - }, - }, - }, - { - name = 'textinput', - description = 'Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text \'@\' will be generated.', - variants = { - { - description = 'Although Lua strings can store UTF-8 encoded unicode text just fine, many functions in Lua\'s string library will not treat the text as you might expect. For example, #text (and string.len(text)) will give the number of \'\'bytes\'\' in the string, rather than the number of unicode characters. The Lua wiki and a presentation by one of Lua\'s creators give more in-depth explanations, with some tips.\n\nThe utf8 library can be used to operate on UTF-8 encoded unicode text (such as the text argument given in this function.)\n\nOn Android and iOS, textinput is disabled by default; call love.keyboard.setTextInput to enable it.', - arguments = { - { - type = 'string', - name = 'text', - description = 'The UTF-8 encoded unicode text.', - }, - }, - }, - }, - }, - { - name = 'threaderror', - description = 'Callback function triggered when a Thread encounters an error.', - variants = { - { - arguments = { - { - type = 'Thread', - name = 'thread', - description = 'The thread which produced the error.', - }, - { - type = 'string', - name = 'errorstr', - description = 'The error message.', - }, - }, - }, - }, - }, - { - name = 'touchmoved', - description = 'Callback function triggered when a touch press moves inside the touch screen.', - variants = { - { - description = 'The identifier is only guaranteed to be unique for the specific touch press until love.touchreleased is called with that identifier, at which point it may be reused for new touch presses.\n\nThe unofficial Android and iOS ports of LÖVE 0.9.2 reported touch positions as normalized values in the range of 1, whereas this API reports positions in pixels.', - arguments = { - { - type = 'light userdata', - name = 'id', - description = 'The identifier for the touch press.', - }, - { - type = 'number', - name = 'x', - description = 'The x-axis position of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'y', - description = 'The y-axis position of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'dx', - description = 'The x-axis movement of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'dy', - description = 'The y-axis movement of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'pressure', - description = 'The amount of pressure being applied. Most touch screens aren\'t pressure sensitive, in which case the pressure will be 1.', - }, - }, - }, - }, - }, - { - name = 'touchpressed', - description = 'Callback function triggered when the touch screen is touched.', - variants = { - { - description = 'The identifier is only guaranteed to be unique for the specific touch press until love.touchreleased is called with that identifier, at which point it may be reused for new touch presses.\n\nThe unofficial Android and iOS ports of LÖVE 0.9.2 reported touch positions as normalized values in the range of 1, whereas this API reports positions in pixels.', - arguments = { - { - type = 'light userdata', - name = 'id', - description = 'The identifier for the touch press.', - }, - { - type = 'number', - name = 'x', - description = 'The x-axis position of the touch press inside the window, in pixels.', - }, - { - type = 'number', - name = 'y', - description = 'The y-axis position of the touch press inside the window, in pixels.', - }, - { - type = 'number', - name = 'dx', - description = 'The x-axis movement of the touch press inside the window, in pixels. This should always be zero.', - }, - { - type = 'number', - name = 'dy', - description = 'The y-axis movement of the touch press inside the window, in pixels. This should always be zero.', - }, - { - type = 'number', - name = 'pressure', - description = 'The amount of pressure being applied. Most touch screens aren\'t pressure sensitive, in which case the pressure will be 1.', - }, - }, - }, - }, - }, - { - name = 'touchreleased', - description = 'Callback function triggered when the touch screen stops being touched.', - variants = { - { - description = 'The identifier is only guaranteed to be unique for the specific touch press until love.touchreleased is called with that identifier, at which point it may be reused for new touch presses.\n\nThe unofficial Android and iOS ports of LÖVE 0.9.2 reported touch positions as normalized values in the range of 1, whereas this API reports positions in pixels.', - arguments = { - { - type = 'light userdata', - name = 'id', - description = 'The identifier for the touch press.', - }, - { - type = 'number', - name = 'x', - description = 'The x-axis position of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'y', - description = 'The y-axis position of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'dx', - description = 'The x-axis movement of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'dy', - description = 'The y-axis movement of the touch inside the window, in pixels.', - }, - { - type = 'number', - name = 'pressure', - description = 'The amount of pressure being applied. Most touch screens aren\'t pressure sensitive, in which case the pressure will be 1.', - }, - }, - }, - }, - }, - { - name = 'update', - description = 'Callback function used to update the state of the game every frame.', - variants = { - { - arguments = { - { - type = 'number', - name = 'dt', - description = 'Time since the last update in seconds.', - }, - }, - }, - }, - }, - { - name = 'visible', - description = 'Callback function triggered when window is minimized/hidden or unminimized by the user.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'visible', - description = 'True if the window is visible, false if it isn\'t.', - }, - }, - }, - }, - }, - { - name = 'wheelmoved', - description = 'Callback function triggered when the mouse wheel is moved.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'Amount of horizontal mouse wheel movement. Positive values indicate movement to the right.', - }, - { - type = 'number', - name = 'y', - description = 'Amount of vertical mouse wheel movement. Positive values indicate upward movement.', - }, - }, - }, - }, - }, - }, - types = { - { - name = 'ByteData', - description = 'Data object containing arbitrary bytes in an contiguous memory.\n\nThere are currently no LÖVE functions provided for manipulating the contents of a ByteData, but Data:getPointer can be used with LuaJIT\'s FFI to access and write to the contents directly.', - supertypes = { - 'Object', - 'Data', - }, - functions = { - }, - }, - { - name = 'Data', - description = 'The superclass of all data.', - supertypes = { - 'Object', - }, - functions = { - }, - }, - { - name = 'Drawable', - description = 'Superclass for all things that can be drawn on screen. This is an abstract type that can\'t be created directly.', - supertypes = { - 'Object', - }, - functions = { - }, - }, - { - name = 'Object', - description = 'The superclass of all LÖVE types.', - functions = { - }, - }, - }, - modules = { - require(path .. 'modules.audio.Audio'), - require(path .. 'modules.data.Data'), - require(path .. 'modules.event.Event'), - require(path .. 'modules.filesystem.Filesystem'), - require(path .. 'modules.graphics.Graphics'), - require(path .. 'modules.image.Image'), - require(path .. 'modules.joystick.Joystick'), - require(path .. 'modules.keyboard.Keyboard'), - require(path .. 'modules.math.Math'), - require(path .. 'modules.mouse.Mouse'), - require(path .. 'modules.physics.Physics'), - require(path .. 'modules.sound.Sound'), - require(path .. 'modules.system.System'), - require(path .. 'modules.thread.Thread'), - require(path .. 'modules.timer.Timer'), - require(path .. 'modules.touch.Touch'), - require(path .. 'modules.video.Video'), - require(path .. 'modules.window.Window'), - }, -} \ No newline at end of file diff --git a/love_api.lua b/love_api.lua new file mode 120000 index 0000000..e2956f1 --- /dev/null +++ b/love_api.lua @@ -0,0 +1 @@ +love-api/love_api.lua \ No newline at end of file diff --git a/modules b/modules new file mode 120000 index 0000000..15c3b06 --- /dev/null +++ b/modules @@ -0,0 +1 @@ +love-api/modules \ No newline at end of file diff --git a/modules/audio/Audio.lua b/modules/audio/Audio.lua deleted file mode 100644 index b5ad744..0000000 --- a/modules/audio/Audio.lua +++ /dev/null @@ -1,748 +0,0 @@ -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', - description = 'Gets the current number of simultaneously playing sources.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The current number of simultaneously playing sources.', - }, - }, - }, - }, - }, - { - name = 'getDistanceModel', - description = 'Returns the distance attenuation model.', - variants = { - { - returns = { - { - type = 'DistanceModel', - name = 'model', - description = 'The current distance model. The default is \'inverseclamped\'.', - }, - }, - }, - }, - }, - { - name = 'getDopplerScale', - description = 'Gets the current global scale factor for velocity-based doppler effects.', - variants = { - { - returns = { - { - type = 'number', - name = 'scale', - description = 'The current doppler scale factor.', - }, - }, - }, - }, - }, - { - name = 'getEffect', - description = 'Gets the settings associated with an effect.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - description = 'The name of the effect.', - }, - }, - returns = { - { - type = 'table', - name = 'settings', - description = 'The settings associated with the effect.', - }, - }, - }, - }, - }, - { - name = 'getMaxSceneEffects', - 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.', - }, - }, - }, - }, - }, - { - 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.', - }, - }, - }, - }, - }, - { - name = 'getOrientation', - description = 'Returns the orientation of the listener.', - variants = { - { - returns = { - { - type = 'number', - name = 'fx, fy, fz', - description = 'Forward vector of the listener orientation.', - }, - { - type = 'number', - name = 'ux, uy, uz', - description = 'Up vector of the listener orientation.', - }, - }, - }, - }, - }, - { - name = 'getPosition', - 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.', - }, - { - type = 'number', - name = 'y', - description = 'The Y position of the listener.', - }, - { - type = 'number', - name = 'z', - description = 'The Z position of the listener.', - }, - }, - }, - }, - }, - { - name = 'getRecordingDevices', - 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.', - variants = { - { - description = 'Audio recording for Android is supported since 11.3. However, it\'s not supported when APK from Play Store is used.', - returns = { - { - type = 'table', - name = 'devices', - description = 'The list of connected recording devices.', - }, - }, - }, - }, - }, - { - name = 'getSourceCount', - description = 'Gets the current number of simultaneously playing sources.', - variants = { - { - returns = { - { - type = 'number', - name = 'numSources', - description = 'The current number of simultaneously playing sources.', - }, - }, - }, - }, - }, - { - name = 'getVelocity', - description = 'Returns the velocity of the listener.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The X velocity of the listener.', - }, - { - type = 'number', - name = 'y', - description = 'The Y velocity of the listener.', - }, - { - type = 'number', - name = 'z', - description = 'The Z velocity of the listener.', - }, - }, - }, - }, - }, - { - name = 'getVolume', - description = 'Returns the master volume.', - variants = { - { - returns = { - { - type = 'number', - name = 'volume', - description = 'The current master volume', - }, - }, - }, - }, - }, - { - name = 'isEffectsSupported', - 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.', - }, - }, - }, - }, - }, - { - 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.\n\nSources created from SoundData are always static.', - variants = { - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filepath to the audio file.', - }, - { - type = 'SourceType', - name = 'type', - description = 'Streaming or static source.', - }, - }, - returns = { - { - type = 'Source', - name = 'source', - description = 'A new Source that can play the specified audio.', - }, - }, - }, - { - arguments = { - { - type = 'File', - name = 'file', - description = 'A File pointing to an audio file.', - }, - { - type = 'SourceType', - name = 'type', - description = 'Streaming or static source.', - }, - }, - returns = { - { - type = 'Source', - name = 'source', - description = 'A new Source that can play the specified audio.', - }, - }, - }, - { - arguments = { - { - type = 'Decoder', - name = 'decoder', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'FileData', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'SoundData', - 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\'.', - }, - }, - }, - }, - }, - { - name = 'pause', - description = 'Pauses specific or all currently played Sources.', - variants = { - { - description = 'Pauses all currently active Sources and returns them.', - returns = { - { - 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 = 'Source', - name = 'source', - description = 'The first Source to pause.', - }, - { - type = 'Source', - name = '...', - description = 'Additional Sources to pause.', - }, - }, - }, - { - description = 'Pauses the given Sources.', - arguments = { - { - type = 'table', - name = 'sources', - description = 'A table containing a list of Sources to pause.', - }, - }, - }, - }, - }, - { - name = 'play', - description = 'Plays the specified Source.', - variants = { - { - arguments = { - { - type = 'Source', - name = 'source', - 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', - description = 'Sets the distance attenuation model.', - variants = { - { - arguments = { - { - type = 'DistanceModel', - name = 'model', - description = 'The new distance model.', - }, - }, - }, - }, - }, - { - name = 'setDopplerScale', - description = 'Sets a global scale factor for velocity-based doppler effects. The default scale value is 1.', - variants = { - { - arguments = { - { - type = 'number', - name = 'scale', - 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.\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.', - }, - { - type = 'table', - name = 'settings', - description = 'The settings to use for this effect, with the following fields:', - table = { - { - type = 'EffectType', - name = 'type', - description = 'The type of effect to use.', - }, - { - type = 'number', - name = 'volume', - description = 'The volume of the effect.', - }, - { - type = 'number', - name = '...', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'name', - 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', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the effect was successfully disabled.', - }, - }, - }, - }, - }, - { - name = 'setMixWithSystem', - description = 'Sets whether the system should mix the audio with the system\'s audio.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'mix', - description = 'True to enable mixing, false to disable it.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if the change succeeded, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'setOrientation', - description = 'Sets the orientation of the listener.', - variants = { - { - arguments = { - { - type = 'number', - name = 'fx, fy, fz', - description = 'Forward vector of the listener orientation.', - }, - { - type = 'number', - name = 'ux, uy, uz', - description = 'Up vector of the listener orientation.', - }, - }, - }, - }, - }, - { - name = 'setPosition', - description = 'Sets the position of the listener, which determines how sounds play.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position of the listener.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the listener.', - }, - { - type = 'number', - name = 'z', - description = 'The z position of the listener.', - }, - }, - }, - }, - }, - { - name = 'setVelocity', - description = 'Sets the velocity of the listener.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The X velocity of the listener.', - }, - { - type = 'number', - name = 'y', - description = 'The Y velocity of the listener.', - }, - { - type = 'number', - name = 'z', - description = 'The Z velocity of the listener.', - }, - }, - }, - }, - }, - { - name = 'setVolume', - description = 'Sets the master volume.', - variants = { - { - arguments = { - { - type = 'number', - name = 'volume', - 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 only stop the specified source.', - arguments = { - { - type = 'Source', - name = 'source', - 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'), - require(path .. 'enums.EffectType'), - require(path .. 'enums.EffectWaveform'), - require(path .. 'enums.FilterType'), - require(path .. 'enums.SourceType'), - require(path .. 'enums.TimeUnit'), - }, -} \ No newline at end of file diff --git a/modules/audio/enums/DistanceModel.lua b/modules/audio/enums/DistanceModel.lua deleted file mode 100644 index b11e229..0000000 --- a/modules/audio/enums/DistanceModel.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - name = 'DistanceModel', - description = 'The different distance models.\n\nExtended information can be found in the chapter "3.4. Attenuation By Distance" of the OpenAL 1.1 specification.', - constants = { - { - name = 'none', - description = 'Sources do not get attenuated.', - }, - { - name = 'inverse', - 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\'\'\'.', - }, - { - name = 'linear', - description = 'Linear attenuation.', - }, - { - name = 'linearclamped', - description = 'Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named \'\'\'linear clamped\'\'\'.', - }, - { - name = 'exponent', - description = 'Exponential attenuation.', - }, - { - name = 'exponentclamped', - 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/SourceType.lua b/modules/audio/enums/SourceType.lua deleted file mode 100644 index 62bee04..0000000 --- a/modules/audio/enums/SourceType.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'SourceType', - description = 'Types of audio sources.\n\nA good rule of thumb is to use stream for music files and static for all short sound effects. Basically, you want to avoid loading large files into memory at once.', - constants = { - { - name = 'static', - description = 'The whole audio is decoded.', - }, - { - name = 'stream', - description = 'The audio is decoded in chunks when needed.', - }, - { - name = '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 deleted file mode 100644 index 0429e1d..0000000 --- a/modules/audio/enums/TimeUnit.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'TimeUnit', - description = 'Units that represent time.', - constants = { - { - name = 'seconds', - description = 'Regular seconds.', - }, - { - name = 'samples', - description = 'Audio samples.', - }, - }, -} \ No newline at end of file diff --git a/modules/audio/types/Source.lua b/modules/audio/types/Source.lua deleted file mode 100644 index 1d89264..0000000 --- a/modules/audio/types/Source.lua +++ /dev/null @@ -1,892 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Source', - 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.', - constructors = { - 'newQueueableSource', - 'newSource', - }, - 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.', - 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.', - }, - }, - }, - }, - }, - { - 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 = 'getAirAbsorption', - description = 'Gets the amount of air absorption applied to the Source.\n\nBy default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.', - variants = { - { - description = 'Audio air absorption functionality is not supported on iOS.', - returns = { - { - type = 'number', - name = 'amount', - description = 'The amount of air absorption applied to the Source.', - }, - }, - }, - }, - }, - { - name = 'getAttenuationDistances', - 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 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 current maximum attenuation distance.', - }, - }, - }, - }, - }, - { - name = 'getChannelCount', - description = 'Gets the number of channels in the Source. Only 1-channel (mono) Sources can use directional and positional effects.', - variants = { - { - returns = { - { - type = 'number', - name = 'channels', - description = '1 for mono, 2 for stereo.', - }, - }, - }, - }, - }, - { - name = 'getCone', - description = 'Gets the Source\'s directional volume cones. Together with Source:setDirection, the cone angles allow for the Source\'s volume to vary depending on its direction.', - variants = { - { - returns = { - { - 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.', - }, - { - 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.', - }, - { - type = 'number', - name = 'outerVolume', - description = 'The Source\'s volume when the listener is outside both the inner and outer cone angles.', - }, - }, - }, - }, - }, - { - name = 'getDirection', - description = 'Gets the direction of the Source.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The X part of the direction vector.', - }, - { - type = 'number', - name = 'y', - description = 'The Y part of the direction vector.', - }, - { - type = 'number', - name = 'z', - description = 'The Z part of the direction vector.', - }, - }, - }, - }, - }, - { - name = 'getDuration', - description = 'Gets the duration of the Source. For streaming Sources it may not always be sample-accurate, and may return -1 if the duration cannot be determined at all.', - variants = { - { - arguments = { - { - type = 'TimeUnit', - name = 'unit', - 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.', - }, - }, - }, - }, - }, - { - 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.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - description = 'The name of the effect.', - }, - { - type = 'table', - name = 'filtersettings', - description = 'An optional empty table that will be filled with the filter settings.', - default = '{}', - }, - }, - 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:', - table = { - { - type = 'number', - name = 'volume', - 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.', - }, - { - type = 'number', - name = 'lowgain', - 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 = { - { - returns = { - { - type = 'table', - name = 'settings', - 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 to use.', - }, - { - type = 'number', - name = 'volume', - 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.', - }, - { - type = 'number', - name = 'lowgain', - 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 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.', - }, - }, - }, - }, - }, - { - name = 'getPitch', - description = 'Gets the current pitch of the Source.', - variants = { - { - returns = { - { - type = 'number', - name = 'pitch', - description = 'The pitch, where 1.0 is normal.', - }, - }, - }, - }, - }, - { - name = 'getPosition', - description = 'Gets the position of the Source.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The X position of the Source.', - }, - { - type = 'number', - name = 'y', - description = 'The Y position of the Source.', - }, - { - type = 'number', - name = 'z', - description = 'The Z position of the Source.', - }, - }, - }, - }, - }, - { - name = 'getRolloff', - description = 'Returns the rolloff factor of the source.', - variants = { - { - returns = { - { - type = 'number', - name = 'rolloff', - description = 'The rolloff factor.', - }, - }, - }, - }, - }, - { - name = 'getType', - description = 'Gets the type of the Source.', - variants = { - { - returns = { - { - type = 'SourceType', - name = 'sourcetype', - description = 'The type of the source.', - }, - }, - }, - }, - }, - { - name = 'getVelocity', - description = 'Gets the velocity of the Source.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The X part of the velocity vector.', - }, - { - type = 'number', - name = 'y', - description = 'The Y part of the velocity vector.', - }, - { - type = 'number', - name = 'z', - description = 'The Z part of the velocity vector.', - }, - }, - }, - }, - }, - { - name = 'getVolume', - description = 'Gets the current volume of the Source.', - variants = { - { - returns = { - { - type = 'number', - name = 'volume', - description = 'The volume of the Source, where 1.0 is normal volume.', - }, - }, - }, - }, - }, - { - name = 'getVolumeLimits', - description = 'Returns the volume limits of the source.', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum volume.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum volume.', - }, - }, - }, - }, - }, - { - name = 'isLooping', - description = 'Returns whether the Source will loop.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'loop', - description = 'True if the Source will loop, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isPlaying', - description = 'Returns whether the Source is playing.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'playing', - description = 'True if the Source is playing, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isRelative', - 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.', - }, - }, - }, - }, - }, - { - name = 'pause', - description = 'Pauses the Source.', - variants = { - { - }, - }, - }, - { - name = 'play', - description = 'Starts playing the Source.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the Source was able to successfully start playing.', - }, - }, - }, - }, - }, - { - name = 'queue', - description = 'Queues SoundData for playback in a queueable Source.\n\nThis method requires the Source to be created via love.audio.newQueueableSource.', - variants = { - { - arguments = { - { - type = 'SoundData', - name = 'sounddata', - 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.', - }, - }, - }, - }, - }, - { - name = 'seek', - description = 'Sets the currently playing position of the Source.', - variants = { - { - arguments = { - { - type = 'number', - name = 'offset', - description = 'The position to seek to.', - }, - { - type = 'TimeUnit', - name = 'unit', - description = 'The unit of the position value.', - default = '\'seconds\'', - }, - }, - }, - }, - }, - { - name = 'setAirAbsorption', - description = 'Sets the amount of air absorption applied to the Source.\n\nBy default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.\n\nAir absorption can simulate sound transmission through foggy air, dry air, smoky atmosphere, etc. It can be used to simulate different atmospheric conditions within different locations in an area.', - variants = { - { - description = 'Audio air absorption functionality is not supported on iOS.', - arguments = { - { - type = 'number', - name = 'amount', - description = 'The amount of air absorption applied to the Source. Must be between 0 and 10.', - }, - }, - }, - }, - }, - { - name = 'setAttenuationDistances', - 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 attenuation distance. If the current DistanceModel is clamped, this is the minimum attenuation distance.', - }, - { - type = 'number', - name = 'max', - description = 'The new maximum attenuation distance.', - }, - }, - }, - }, - }, - { - name = 'setCone', - description = 'Sets the Source\'s directional volume cones. Together with Source:setDirection, the cone angles allow for the Source\'s volume to vary depending on its direction.', - variants = { - { - arguments = { - { - 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.', - }, - { - 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.', - }, - { - type = 'number', - name = 'outerVolume', - description = 'The Source\'s volume when the listener is outside both the inner and outer cone angles.', - default = '0', - }, - }, - }, - }, - }, - { - name = 'setDirection', - description = 'Sets the direction vector of the Source. A zero vector makes the source non-directional.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The X part of the direction vector.', - }, - { - type = 'number', - name = 'y', - description = 'The Y part of the direction vector.', - }, - { - type = 'number', - name = 'z', - 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.', - }, - { - type = 'boolean', - name = 'enable', - description = 'If false and the given effect name was previously enabled on this Source, disables the effect.', - default = 'true', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - 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.', - }, - { - type = 'table', - name = 'filtersettings', - 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.', - }, - { - type = 'number', - name = 'volume', - 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.', - }, - { - 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.', - }, - }, - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the effect and filter were successfully applied to this Source.', - }, - }, - }, - }, - }, - { - name = 'setFilter', - description = 'Sets a low-pass, high-pass, or band-pass filter to apply when playing the Source.', - variants = { - { - arguments = { - { - type = 'table', - name = 'settings', - description = 'The filter settings to use for this Source, with the following fields:', - table = { - { - type = 'FilterType', - name = 'type', - description = 'The type of filter to use.', - }, - { - type = 'number', - name = 'volume', - 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.', - }, - { - 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.', - }, - }, - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the filter was successfully applied to the Source.', - }, - }, - }, - { - description = 'Disables filtering on this Source.\n\n', - }, - }, - }, - { - name = 'setLooping', - description = 'Sets whether the Source should loop.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'loop', - description = 'True if the source should loop, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'setPitch', - description = 'Sets the pitch of the Source.', - variants = { - { - arguments = { - { - 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.', - }, - }, - }, - }, - }, - { - name = 'setPosition', - 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.', - }, - { - type = 'number', - name = 'y', - description = 'The Y position of the Source.', - }, - { - type = 'number', - name = 'z', - description = 'The Z position of the Source.', - }, - }, - }, - }, - }, - { - name = 'setRelative', - description = 'Sets whether the 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.', - 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.', - variants = { - { - arguments = { - { - type = 'number', - name = 'rolloff', - 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 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.', - }, - { - type = 'number', - name = 'y', - description = 'The Y part of the velocity vector.', - }, - { - type = 'number', - name = 'z', - description = 'The Z part of the velocity vector.', - }, - }, - }, - }, - }, - { - name = 'setVolume', - description = 'Sets the current volume of the Source.', - variants = { - { - arguments = { - { - type = 'number', - name = 'volume', - description = 'The volume for a Source, where 1.0 is normal volume. Volume cannot be raised above 1.0.', - }, - }, - }, - }, - }, - { - name = 'setVolumeLimits', - description = 'Sets the volume limits of the source. The limits have to be numbers from 0 to 1.', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum volume.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum volume.', - }, - }, - }, - }, - }, - { - name = 'stop', - description = 'Stops a Source.', - variants = { - { - }, - }, - }, - { - name = 'tell', - description = 'Gets the currently playing position of the Source.', - variants = { - { - arguments = { - { - type = 'TimeUnit', - name = 'unit', - description = 'The type of unit for the return value.', - default = '\'seconds\'', - }, - }, - returns = { - { - type = 'number', - name = 'position', - description = 'The currently playing position of the Source.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/event/Event.lua b/modules/event/Event.lua deleted file mode 100644 index 46e2571..0000000 --- a/modules/event/Event.lua +++ /dev/null @@ -1,177 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'event', - description = 'Manages events, like keypresses.', - types = { - }, - functions = { - { - name = 'clear', - description = 'Clears the event queue.', - variants = { - { - }, - }, - }, - { - name = 'poll', - description = 'Returns an iterator for messages in the event queue.', - variants = { - { - returns = { - { - type = 'function', - name = 'i', - description = 'Iterator function usable in a for loop.', - }, - }, - }, - }, - }, - { - name = 'pump', - 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.\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 = 'n', - description = 'The name of the event.', - }, - { - type = 'Variant', - name = 'a', - description = 'First event argument.', - default = 'nil', - }, - { - type = 'Variant', - name = 'b', - description = 'Second event argument.', - default = 'nil', - }, - { - type = 'Variant', - name = 'c', - description = 'Third event argument.', - default = 'nil', - }, - { - 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', - }, - }, - }, - }, - }, - { - 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 = '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 = '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.', - variants = { - { - returns = { - { - type = 'Event', - name = 'n', - description = 'The name of event.', - }, - { - type = 'Variant', - name = 'a', - description = 'First event argument.', - }, - { - type = 'Variant', - name = 'b', - description = 'Second event argument.', - }, - { - type = 'Variant', - name = 'c', - description = 'Third event argument.', - }, - { - type = 'Variant', - name = 'd', - 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'), - }, -} \ No newline at end of file diff --git a/modules/event/enums/Event.lua b/modules/event/enums/Event.lua deleted file mode 100644 index 111d182..0000000 --- a/modules/event/enums/Event.lua +++ /dev/null @@ -1,154 +0,0 @@ -return { - name = 'Event', - 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 = 'joystickpressed', - description = 'Joystick pressed', - }, - { - name = 'joystickreleased', - description = 'Joystick released', - }, - { - name = 'keypressed', - description = 'Key pressed', - }, - { - name = 'keyreleased', - description = 'Key released', - }, - { - name = 'mousepressed', - description = 'Mouse pressed', - }, - { - name = 'mousereleased', - description = 'Mouse released', - }, - { - name = 'quit', - description = 'Quit', - }, - { - name = 'resize', - 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', - }, - { - name = 'joystickadded', - description = 'Joystick connected', - }, - { - 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 deleted file mode 100644 index 1672052..0000000 --- a/modules/filesystem/Filesystem.lua +++ /dev/null @@ -1,1017 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'filesystem', - description = 'Provides an interface to the user\'s filesystem.', - types = { - require(path .. 'types.DroppedFile'), - require(path .. 'types.File'), - require(path .. 'types.FileData'), - }, - functions = { - { - name = 'append', - description = 'Append data to an existing file.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - description = 'The name (and path) of the file.', - }, - { - type = 'string', - name = 'data', - description = 'The string data 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.', - }, - { - 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.', - }, - { - type = 'string', - name = 'errormsg', - description = 'The error message on failure.', - }, - }, - }, - }, - }, - { - name = 'areSymlinksEnabled', - description = 'Gets whether love.filesystem follows symbolic links.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enable', - description = 'Whether love.filesystem follows symbolic links.', - }, - }, - }, - }, - }, - { - name = 'createDirectory', - 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.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if the directory was created, false if not.', - }, - }, - }, - }, - }, - { - name = 'getAppdataDirectory', - description = 'Returns the application data directory (could be the same as getUserDirectory)', - variants = { - { - returns = { - { - type = 'string', - name = 'path', - 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.', - 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.', - }, - }, - }, - }, - }, - { - name = 'getDirectoryItems', - description = 'Returns a table with the names of files and subdirectories in the specified path. The table is not sorted in any way; the order is undefined.\n\nIf the path passed to the function exists in the game and the save directory, it will list the files and directories from both places.', - variants = { - { - arguments = { - { - type = 'string', - name = 'dir', - 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 = '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. \n\nNote that this only returns the name of the folder to store your files in, not the full path.', - variants = { - { - returns = { - { - type = 'string', - name = 'name', - description = 'The identity that is used as write directory.', - }, - }, - }, - }, - }, - { - name = 'getInfo', - description = 'Gets information about the specified file or directory.', - variants = { - { - arguments = { - { - type = 'string', - name = 'path', - 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 = { - { - 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:', - 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 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 = '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.)', - }, - { - 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.)', - }, - { - 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.', - }, - }, - }, - }, - }, - }, - }, - { - 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.', - }, - }, - returns = { - { - type = 'string', - name = 'realdir', - 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.', - 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.', - }, - }, - }, - }, - }, - { - name = 'getSaveDirectory', - 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 = 'dir', - description = 'The absolute path to the save directory.', - }, - }, - }, - }, - }, - { - name = 'getSource', - description = 'Returns the full path to the the .love file or directory. If the game is fused to the LÖVE executable, then the executable is returned.', - variants = { - { - returns = { - { - type = 'string', - name = 'path', - 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 (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.', - }, - }, - }, - }, - }, - { - name = 'getUserDirectory', - description = 'Returns the path of the user\'s directory', - variants = { - { - returns = { - { - type = 'string', - name = 'path', - description = 'The path of the user\'s directory', - }, - }, - }, - }, - }, - { - name = 'getWorkingDirectory', - description = 'Gets the current working directory.', - variants = { - { - returns = { - { - type = 'string', - name = 'cwd', - description = 'The current working directory.', - }, - }, - }, - }, - }, - { - name = 'init', - description = 'Initializes love.filesystem, will be called internally, so should not be used explicitly.', - variants = { - { - arguments = { - { - type = 'string', - name = 'appname', - 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.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'fused', - description = 'True if the game is in fused mode, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'lines', - description = 'Iterate over the lines in a file.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - 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', - }, - }, - }, - }, - }, - { - name = 'load', - description = 'Loads a Lua file (but does not run it).', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - description = 'The name (and path) of the file.', - }, - }, - returns = { - { - type = 'function', - name = '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.\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.', - }, - { - 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', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - 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 = '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.', - }, - { - 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', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if the archive was successfully mounted, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'newFile', - 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.', - }, - { - type = 'FileMode', - name = 'mode', - description = 'The mode to open the file in.', - }, - }, - returns = { - { - type = 'File', - name = 'file', - description = 'The new File object, or nil if an error occurred.', - }, - { - type = 'string', - name = 'errorstr', - description = 'The error string if an error occurred.', - }, - }, - }, - }, - }, - { - name = 'newFileData', - description = 'Creates a new FileData object.', - variants = { - { - arguments = { - { - type = 'string', - name = 'contents', - description = 'The contents of the file.', - }, - { - type = 'string', - name = 'name', - description = 'The name of the file.', - }, - }, - returns = { - { - type = 'FileData', - name = 'data', - description = 'Your new FileData.', - }, - }, - }, - { - description = 'Creates a new FileData from a file on the storage device.', - arguments = { - { - type = 'string', - name = 'filepath', - description = 'Path to the file.', - }, - }, - returns = { - { - type = 'FileData', - name = 'data', - description = 'The new FileData, or nil if an error occurred.', - }, - { - type = 'string', - name = 'err', - description = 'The error string, if an error occurred.', - }, - }, - }, - }, - }, - { - name = 'read', - description = 'Read the contents of a file.', - variants = { - { - arguments = { - { - 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 = 'string', - name = '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 = 'FileData or string', - name = 'contents', - description = 'FileData or string containing 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.', - }, - }, - }, - }, - }, - { - name = 'remove', - 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.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - 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.', - 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.', - }, - }, - }, - }, - }, - { - name = 'setIdentity', - 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.', - }, - }, - }, - { - arguments = { - { - 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.', - 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.', - }, - }, - }, - }, - }, - { - name = 'setSource', - description = 'Sets the source of the game, where the code is present. This function can only be called once, and is normally automatically done by LÖVE.', - variants = { - { - arguments = { - { - type = 'string', - name = 'path', - description = 'Absolute path to the game\'s source folder.', - }, - }, - }, - }, - }, - { - name = 'setSymlinksEnabled', - description = 'Sets whether love.filesystem follows symbolic links. It is enabled by default in version 0.10.0 and newer, and disabled by default in 0.9.2.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'Whether love.filesystem should follow symbolic links.', - }, - }, - }, - }, - }, - { - name = 'unmount', - description = 'Unmounts a zip file or folder previously mounted for reading with love.filesystem.mount.', - variants = { - { - arguments = { - { - type = 'string', - name = 'archive', - 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.', - }, - }, - }, - }, - }, - { - name = 'write', - 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.', - }, - { - type = 'string', - name = 'data', - description = 'The string data to write to the file.', - }, - { - type = 'number', - name = 'size', - description = 'How many bytes to write.', - default = 'all', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'If the operation was successful.', - }, - { - type = 'string', - name = 'message', - 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.', - }, - { - type = 'Data', - name = 'data', - description = 'The Data object to write to the file.', - }, - { - type = 'number', - name = 'size', - description = 'How many bytes to write.', - default = 'all', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'If the operation was successful.', - }, - { - type = 'string', - name = 'message', - description = 'Error message if operation was unsuccessful.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.BufferMode'), - require(path .. 'enums.FileDecoder'), - require(path .. 'enums.FileMode'), - require(path .. 'enums.FileType'), - }, -} \ No newline at end of file diff --git a/modules/filesystem/enums/BufferMode.lua b/modules/filesystem/enums/BufferMode.lua deleted file mode 100644 index 0066d07..0000000 --- a/modules/filesystem/enums/BufferMode.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'BufferMode', - description = 'Buffer modes for File objects.', - constants = { - { - name = 'none', - 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.', - }, - { - name = 'full', - 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 deleted file mode 100644 index 61f4336..0000000 --- a/modules/filesystem/enums/FileDecoder.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'FileDecoder', - description = 'How to decode a given FileData.', - constants = { - { - name = 'file', - description = 'The data is unencoded.', - }, - { - name = 'base64', - 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 deleted file mode 100644 index a59f08d..0000000 --- a/modules/filesystem/enums/FileMode.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - name = 'FileMode', - description = 'The different modes you can open a File in.', - constants = { - { - name = 'r', - description = 'Open a file for read.', - }, - { - name = 'w', - description = 'Open a file for write.', - }, - { - name = 'a', - description = 'Open a file for append.', - }, - { - name = 'c', - description = 'Do not open a file (represents a closed file.)', - }, - }, -} \ No newline at end of file diff --git a/modules/filesystem/types/File.lua b/modules/filesystem/types/File.lua deleted file mode 100644 index 52d70ea..0000000 --- a/modules/filesystem/types/File.lua +++ /dev/null @@ -1,374 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'File', - description = 'Represents a file on the filesystem. A function that takes a file path can also take a File.', - constructors = { - 'newFile', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'close', - description = 'Closes a File.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether closing was successful.', - }, - }, - }, - }, - }, - { - name = 'flush', - description = 'Flushes any buffered written data in the file to the disk.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'success', - 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.', - }, - }, - }, - }, - }, - { - name = 'getBuffer', - description = 'Gets the buffer mode of a file.', - variants = { - { - returns = { - { - type = 'BufferMode', - name = 'mode', - description = 'The current buffer mode of the file.', - }, - { - type = 'number', - name = 'size', - description = 'The maximum size in bytes of the file\'s buffer.', - }, - }, - }, - }, - }, - { - name = 'getFilename', - description = 'Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path.', - variants = { - { - returns = { - { - type = 'string', - name = 'filename', - description = 'The filename of the File.', - }, - }, - }, - }, - }, - { - name = 'getMode', - description = 'Gets the FileMode the file has been opened with.', - variants = { - { - returns = { - { - type = 'FileMode', - name = 'mode', - description = 'The mode this file has been opened with.', - }, - }, - }, - }, - }, - { - name = 'getSize', - description = 'Returns the file size.', - variants = { - { - returns = { - { - type = 'number', - name = 'size', - description = 'The file size in bytes.', - }, - }, - }, - }, - }, - { - name = 'isEOF', - description = 'Gets whether end-of-file has been reached.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'eof', - description = 'Whether EOF has been reached.', - }, - }, - }, - }, - }, - { - name = 'isOpen', - description = 'Gets whether the file is open.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'open', - description = 'True if the file is currently open, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'lines', - description = 'Iterate over all the lines in a file.', - variants = { - { - returns = { - { - type = 'function', - name = 'iterator', - description = 'The iterator (can be used in for loops).', - }, - }, - }, - }, - }, - { - name = 'open', - 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.', - }, - }, - returns = { - { - type = 'boolean', - name = 'ok', - description = 'True on success, false otherwise.', - }, - { - type = 'string', - name = 'err', - description = 'The error string if an error occurred.', - }, - }, - }, - }, - }, - { - name = 'read', - description = 'Read a number of bytes from a file.', - variants = { - { - arguments = { - { - type = 'number', - name = 'bytes', - description = 'The number of bytes to read.', - default = 'all', - }, - }, - returns = { - { - type = 'string', - name = 'contents', - 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 = 'FileData or string', - name = 'contents', - description = 'FileData or string containing the read bytes.', - }, - { - type = 'number', - name = 'size', - description = 'How many bytes have been read.', - }, - }, - }, - }, - }, - { - name = 'seek', - description = 'Seek to a position in a file', - variants = { - { - arguments = { - { - type = 'number', - name = 'pos', - description = 'The position to seek to', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - 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.\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.', - }, - { - type = 'number', - name = 'size', - description = 'The maximum size in bytes of the file\'s buffer.', - default = '0', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - 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.', - }, - }, - }, - }, - }, - { - name = 'tell', - description = 'Returns the position in the file.', - variants = { - { - returns = { - { - type = 'number', - name = 'pos', - description = 'The current position.', - }, - }, - }, - }, - }, - { - name = 'write', - description = 'Write data to a file.', - variants = { - { - arguments = { - { - type = 'string', - name = 'data', - 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', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the operation was successful.', - }, - { - type = 'string', - name = 'errorstr', - description = 'The error string if an error occurred.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/filesystem/types/FileData.lua b/modules/filesystem/types/FileData.lua deleted file mode 100644 index f3a0c64..0000000 --- a/modules/filesystem/types/FileData.lua +++ /dev/null @@ -1,45 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'FileData', - description = 'Data representing the contents of a file.', - constructors = { - 'newFileData', - }, - supertypes = { - 'Data', - 'Object', - }, - functions = { - { - name = 'getExtension', - description = 'Gets the extension of the FileData.', - variants = { - { - returns = { - { - type = 'string', - name = 'ext', - description = 'The extension of the file the FileData represents.', - }, - }, - }, - }, - }, - { - name = 'getFilename', - description = 'Gets the filename of the FileData.', - variants = { - { - returns = { - { - type = 'string', - name = 'name', - description = 'The name of the file the FileData represents.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/Graphics.lua b/modules/graphics/Graphics.lua deleted file mode 100644 index 385046c..0000000 --- a/modules/graphics/Graphics.lua +++ /dev/null @@ -1,4854 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'graphics', - description = 'The primary responsibility for the love.graphics module is the drawing of lines, shapes, text, Images and other Drawable objects onto the screen. Its secondary responsibilities include loading external files (including Images and Fonts) into memory, creating specialized objects (such as ParticleSystems or Canvases) and managing screen geometry.\n\nLÖVE\'s coordinate system is rooted in the upper-left corner of the screen, which is at location (0, 0). The x axis is horizontal: larger values are further to the right. The y axis is vertical: larger values are further towards the bottom.\n\nIn many cases, you draw images or shapes in terms of their upper-left corner.\n\nMany of the functions are used to manipulate the graphics coordinate system, which is essentially the way coordinates are mapped to the display. You can change the position, scale, and even rotation in this way.', - types = { - require(path .. 'types.Canvas'), - require(path .. 'types.Drawable'), - require(path .. 'types.Font'), - 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'), - }, - 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.', - arguments = { - { - type = 'DrawMode', - name = 'drawmode', - description = 'How to draw the arc.', - }, - { - type = 'number', - name = 'x', - description = 'The position of the center along x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the center along y-axis.', - }, - { - type = 'number', - name = 'radius', - description = 'Radius of the arc.', - }, - { - type = 'number', - name = 'angle1', - description = 'The angle at which the arc begins.', - }, - { - type = 'number', - name = 'angle2', - 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 = '', - arguments = { - { - type = 'DrawMode', - name = 'drawmode', - description = 'How to draw the arc.', - }, - { - type = 'ArcType', - name = 'arctype', - description = 'The type of arc to draw.', - }, - { - type = 'number', - name = 'x', - description = 'The position of the center along x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the center along y-axis.', - }, - { - type = 'number', - name = 'radius', - description = 'Radius of the arc.', - }, - { - type = 'number', - name = 'angle1', - description = 'The angle at which the arc begins.', - }, - { - type = 'number', - name = 'angle2', - description = 'The angle at which the arc terminates.', - }, - { - type = 'number', - name = 'segments', - description = 'The number of segments used for drawing the arc.', - default = '10', - }, - }, - }, - }, - }, - { - name = 'captureScreenshot', - description = 'Creates a screenshot once the current frame is done (after love.draw has finished).\n\nSince this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what\'s drawn to the screen in that frame.', - variants = { - { - description = 'Capture a screenshot and save it to a file at the end of the current frame.', - arguments = { - { - 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 = 'Capture a screenshot and call a callback with the generated ImageData at the end of the current frame.', - arguments = { - { - 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 = 'Capture a screenshot and push the generated ImageData to a Channel at the end of the current frame.', - arguments = { - { - type = 'Channel', - name = 'channel', - description = 'The Channel to push the generated ImageData to.', - }, - }, - }, - }, - }, - { - name = 'circle', - description = 'Draws a circle.', - variants = { - { - arguments = { - { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the circle.', - }, - { - type = 'number', - name = 'x', - description = 'The position of the center along x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the center along y-axis.', - }, - { - type = 'number', - name = 'radius', - description = 'The radius of the circle.', - }, - }, - }, - { - arguments = { - { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the circle.', - }, - { - type = 'number', - name = 'x', - description = 'The position of the center along x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the center along y-axis.', - }, - { - type = 'number', - name = 'radius', - 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.', - }, - }, - }, - }, - }, - { - name = 'clear', - 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 or active Canvas to the specified color.', - arguments = { - { - type = 'number', - name = 'r', - 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.', - }, - { - type = 'number', - name = 'b', - 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', - }, - { - 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.\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.', - }, - { - type = 'table', - name = '...', - 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.', - 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', - }, - { - type = 'boolean', - name = 'discardstencil', - description = 'Whether to discard the contents of the stencil buffer of the screen / active Canvas.', - default = 'true', - }, - }, - }, - { - 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.', - }, - { - type = 'boolean', - name = 'discardstencil', - description = 'Whether to discard the contents of the stencil buffer of the screen / active Canvas.', - default = 'true', - }, - }, - }, - }, - }, - { - 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.\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.', - }, - { - 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', - }, - }, - }, - { - 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 = 'number', - name = 'x', - description = 'The position to draw the object (x-axis).', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the object (y-axis).', - }, - { - 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 = '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 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.', - }, - { - type = 'number', - name = 'instancecount', - description = 'The number of instances to render.', - }, - { - type = 'number', - name = 'x', - description = 'The position to draw the instances (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the instances (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', - }, - }, - }, - { - arguments = { - { - type = 'Mesh', - name = 'mesh', - description = 'The mesh to render.', - }, - { - type = 'number', - name = 'instancecount', - description = 'The number of instances to render.', - }, - { - type = 'Transform', - name = 'transform', - description = 'A transform object.', - }, - }, - }, - }, - }, - { - name = 'drawLayer', - description = 'Draws a layer of an Array Texture.', - variants = { - { - description = 'Draws a layer of an Array Texture.', - arguments = { - { - type = 'Texture', - name = 'texture', - description = 'The Array Texture to draw.', - }, - { - type = 'number', - name = 'layerindex', - 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', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the texture (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 = '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.', - }, - { - type = 'number', - name = 'layerindex', - 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.', - }, - { - type = 'number', - name = 'x', - description = 'The position to draw the texture (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the texture (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 = 'Draws a layer of an Array Texture using the specified Transform.', - arguments = { - { - type = 'Texture', - name = 'texture', - description = 'The Array Texture to draw.', - }, - { - type = 'number', - name = 'layerindex', - description = 'The index of the layer to use when drawing.', - }, - { - type = 'Transform', - name = 'transform', - description = 'A transform object.', - }, - }, - }, - { - 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.', - }, - { - type = 'number', - name = 'layerindex', - 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.', - }, - { - type = 'Transform', - name = 'transform', - description = 'A transform object.', - }, - }, - }, - }, - }, - { - name = 'ellipse', - description = 'Draws an ellipse.', - variants = { - { - arguments = { - { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the ellipse.', - }, - { - type = 'number', - name = 'x', - description = 'The position of the center along x-axis.', - }, - { - type = 'number', - name = 'y', - 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).', - }, - { - type = 'number', - name = 'radiusy', - 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.', - }, - { - type = 'number', - name = 'x', - description = 'The position of the center along x-axis.', - }, - { - type = 'number', - name = 'y', - 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).', - }, - { - type = 'number', - name = 'radiusy', - 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.', - }, - }, - }, - }, - }, - { - 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 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.\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).', - }, - { - type = 'number', - name = 'g', - description = 'The green component (0-1).', - }, - { - type = 'number', - name = 'b', - description = 'The blue component (0-1).', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component (0-1).', - }, - }, - }, - }, - }, - { - name = 'getBlendMode', - description = 'Gets the blending mode.', - variants = { - { - returns = { - { - type = 'BlendMode', - name = '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.', - }, - }, - }, - }, - }, - { - name = 'getCanvas', - description = 'Gets the current target Canvas.', - variants = { - { - returns = { - { - type = 'Canvas', - name = 'canvas', - 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 = { - { - 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.', - }, - }, - }, - { - 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 (taking into account the readable parameter). Not all systems support all formats.', - }, - }, - }, - }, - }, - { - name = 'getColor', - 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).', - }, - { - type = 'number', - name = 'g', - description = 'The green component (0-1).', - }, - { - type = 'number', - name = 'b', - description = 'The blue component (0-1).', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component (0-1).', - }, - }, - }, - }, - }, - { - name = 'getColorMask', - description = 'Gets the active color components used when drawing. Normally all 4 components are active unless love.graphics.setColorMask has been used.\n\nThe color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love.graphics.clear and Canvas:clear as well.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'r', - description = 'Whether the red color component is active when rendering.', - }, - { - type = 'boolean', - name = 'g', - description = 'Whether the green color component is active when rendering.', - }, - { - type = 'boolean', - name = 'b', - description = 'Whether the blue color component is active when rendering.', - }, - { - type = 'boolean', - name = 'a', - 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', - description = 'Returns the default scaling filters used with Images, Canvases, and Fonts.', - variants = { - { - returns = { - { - type = 'FilterMode', - name = 'min', - description = 'Filter mode used when scaling the image down.', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'Filter mode used when scaling the image up.', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of Anisotropic Filtering used.', - }, - }, - }, - }, - }, - { - name = 'getDepthMode', - description = 'Gets the current depth test mode and whether writing to the depth buffer is enabled.\n\nThis is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.', - variants = { - { - returns = { - { - type = 'CompareMode', - name = 'comparemode', - 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.', - }, - }, - }, - }, - }, - { - name = 'getDimensions', - description = 'Gets the width and height in pixels of the window.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the window.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the window.', - }, - }, - }, - }, - }, - { - name = 'getFont', - description = 'Gets the current Font object.', - variants = { - { - returns = { - { - type = 'Font', - name = 'font', - description = 'The current Font. Automatically creates and sets the default font, if none is set yet.', - }, - }, - }, - }, - }, - { - name = 'getFrontFaceWinding', - description = 'Gets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing.\n\nThis is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices.', - variants = { - { - returns = { - { - type = 'VertexWinding', - name = 'winding', - description = 'The winding mode being used. The default winding is counterclockwise (\'ccw\').', - }, - }, - }, - }, - }, - { - name = 'getHeight', - description = 'Gets the height in pixels of the window.', - variants = { - { - returns = { - { - type = 'number', - name = 'height', - description = 'The height of the window.', - }, - }, - }, - }, - }, - { - name = 'getImageFormats', - description = 'Gets the raw and compressed pixel formats usable for Images, and whether each is supported.', - variants = { - { - returns = { - { - 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.', - }, - }, - }, - }, - }, - { - name = 'getLineJoin', - description = 'Gets the line join style.', - variants = { - { - returns = { - { - type = 'LineJoin', - name = 'join', - description = 'The LineJoin style.', - }, - }, - }, - }, - }, - { - name = 'getLineStyle', - description = 'Gets the line style.', - variants = { - { - returns = { - { - type = 'LineStyle', - name = '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).', - }, - }, - }, - }, - }, - { - 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 = 'pixelheight', - description = 'The height of the window in pixels.', - }, - }, - }, - }, - }, - { - 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 = '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.', - }, - { - type = 'number', - name = 'canvasswitches', - 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.', - }, - { - type = 'number', - name = 'images', - description = 'The number of Image objects currently loaded.', - }, - { - type = 'number', - name = 'canvases', - description = 'The number of Canvas objects currently loaded.', - }, - { - type = 'number', - name = 'fonts', - 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.', - }, - { - 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.', - }, - }, - }, - }, - }, - { - description = 'This variant accepts an existing table to fill in, instead of creating a new one.', - arguments = { - { - type = 'table', - name = 'stats', - description = 'A table which will be filled in with the stat fields below.', - }, - }, - returns = { - { - type = 'table', - name = 'stats', - description = 'The table that was passed in above, now containing the following fields:', - table = { - { - type = 'number', - name = 'drawcalls', - 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.', - }, - { - type = 'number', - name = 'texturememory', - 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.', - }, - { - type = 'number', - name = 'canvases', - description = 'The number of Canvas objects currently loaded.', - }, - { - type = 'number', - name = 'fonts', - 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.', - }, - { - 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 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 = 'CompareMode', - name = 'comparemode', - description = 'The type of comparison that is made for each pixel. Will be \'always\' if stencil testing is disabled.', - }, - { - type = 'number', - name = 'comparevalue', - description = 'The value used when comparing with the stencil value of each pixel.', - }, - }, - }, - }, - }, - { - name = 'getSupported', - description = 'Gets the optional graphics features and whether they\'re supported on the system.\n\nSome older or low-end systems don\'t always support all graphics features.', - variants = { - { - returns = { - { - type = 'table', - name = 'features', - description = 'A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported.', - }, - }, - }, - }, - }, - { - name = 'getSystemLimits', - description = 'Gets the system-dependent maximum values for love.graphics features.', - variants = { - { - returns = { - { - type = 'table', - name = 'limits', - description = 'A table containing GraphicsLimit keys, and number values.', - }, - }, - }, - }, - }, - { - name = 'getTextureTypes', - description = 'Gets the available texture types, and whether each is supported.', - variants = { - { - returns = { - { - 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.', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Gets the width in pixels of the window.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - 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, ...).', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - 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.', - }, - { - type = 'number', - name = 'width', - 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.', - }, - }, - }, - }, - }, - { - name = 'inverseTransformPoint', - description = 'Converts the given 2D position from screen-space into global coordinates.\n\nThis effectively applies the reverse of the current graphics transformations to the given position. A similar Transform:inverseTransformPoint method exists for Transform objects.', - variants = { - { - arguments = { - { - type = 'number', - name = 'screenX', - description = 'The x component of the screen-space position.', - }, - { - type = 'number', - name = 'screenY', - description = 'The y component of the screen-space position.', - }, - }, - 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 = 'isActive', - description = 'Gets whether the graphics module is able to be used. If it is not active, love.graphics function and method calls will not work correctly and may cause the program to crash.\nThe graphics module is inactive if a window is not open, or if the app is in the background on iOS. Typically the app\'s execution will be automatically paused by the system, in the latter case.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'active', - description = 'Whether the graphics module is active and able to be used.' - }, - }, - }, - }, - }, - { - 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.', - }, - }, - }, - }, - }, - { - name = 'isWireframe', - description = 'Gets whether wireframe mode is used when drawing.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'wireframe', - description = 'True if wireframe lines are used when drawing, false if it\'s not.', - }, - }, - }, - }, - }, - { - name = 'line', - description = 'Draws lines between points.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x1', - description = 'The position of first point on the x-axis.', - }, - { - type = 'number', - name = 'y1', - description = 'The position of first point on the y-axis.', - }, - { - type = 'number', - name = 'x2', - description = 'The position of second point on the x-axis.', - }, - { - type = 'number', - name = 'y2', - description = 'The position of second point on the y-axis.', - }, - { - type = 'number', - name = '...', - description = 'You can continue passing point positions to draw a polyline.', - }, - }, - }, - { - arguments = { - { - type = 'table', - name = 'points', - description = 'A table of point positions, as described above.', - }, - }, - }, - }, - }, - { - 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 = '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 = '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', - }, - }, - }, - }, - returns = { - { - type = 'Image', - name = 'image', - description = 'An Array Image object.', - }, - }, - }, - }, - }, - { - name = 'newCanvas', - description = 'Creates a new Canvas object for offscreen rendering.', - variants = { - { - returns = { - { - type = 'Canvas', - name = 'canvas', - description = 'A new Canvas with dimensions equal to the window\'s size in pixels.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'width', - description = 'The desired width of the Canvas.', - }, - { - type = 'number', - name = 'height', - description = 'The desired height of the Canvas.', - }, - }, - returns = { - { - type = 'Canvas', - name = 'canvas', - description = 'A new Canvas with specified width and height.', - }, - }, - }, - { - 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 = 'width', - description = 'The desired width of the Canvas.', - }, - { - type = 'number', - name = 'height', - description = 'The desired height of the Canvas.', - }, - { - type = 'table', - name = 'settings', - description = 'A table containing the given fields:', - table = { - { - type = 'TextureType', - name = 'type', - description = 'The type of Canvas to create.', - default = '\'2d\'', - }, - { - 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 = 'msaa', - description = 'The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.', - default = '0', - }, - { - type = 'number', - 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 = 'MipmapMode', - name = 'mipmaps', - description = 'Whether the Canvas has mipmaps, and whether to automatically regenerate them if so.', - default = '\'none\'', - }, - }, - }, - }, - returns = { - { - type = 'Canvas', - name = 'canvas', - description = 'A new Canvas with specified width and height.', - }, - }, - }, - { - description = 'Creates a volume or array texture-type Canvas.', - arguments = { - { - type = 'number', - name = 'width', - description = 'The desired width of the Canvas.', - }, - { - type = 'number', - name = 'height', - description = 'The desired height of the Canvas.', - }, - { - 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 = 'settings', - description = 'A table containing the given fields:', - table = { - { - type = 'TextureType', - name = 'type', - description = 'The type of Canvas to create.', - default = '\'array\'', - }, - { - 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 = 'msaa', - description = 'The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.', - default = '0', - }, - { - type = 'number', - 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 = 'MipmapMode', - name = 'mipmaps', - description = 'Whether the Canvas has mipmaps, and whether to automatically regenerate them if so.', - default = '\'none\'', - }, - }, - }, - }, - returns = { - { - type = 'Canvas', - name = 'canvas', - description = 'A new Canvas with specified width and height.', - }, - }, - }, - }, - }, - { - 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 a cubemap image file (or a File, FileData, or ImageData).', - }, - { - 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 cubemap Image object.', - }, - }, - }, - { - description = 'Creates a cubemap Image given a different image file for each cube face.', - arguments = { - { - 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 = '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 cubemap Image 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.', - 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 BMFont or TrueType font file.', - }, - }, - returns = { - { - type = 'Font', - name = 'font', - description = 'A Font object which can be used to draw text on screen.', - }, - }, - }, - { - description = 'Create a new TrueType font.', - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filepath to the TrueType font file.', - }, - { - type = 'number', - name = 'size', - description = 'The size of the font in pixels.', - }, - { - type = 'HintingMode', - name = 'hinting', - description = 'True Type hinting mode.', - default = '\'normal\'', - }, - { - type = 'number', - name = 'dpiscale', - description = 'The DPI scale factor of the font.', - default = 'love.graphics.getDPIScale()', - }, - }, - 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 = '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.', - arguments = { - { - type = 'number', - name = 'size', - description = 'The size of the font in pixels.', - default = '12', - }, - { - type = 'HintingMode', - name = 'hinting', - description = 'True Type hinting mode.', - default = '\'normal\'', - }, - { - type = 'number', - name = 'dpiscale', - description = 'The DPI scale factor of the font.', - default = 'love.graphics.getDPIScale()', - }, - }, - returns = { - { - type = 'Font', - name = 'font', - description = 'A Font object which can be used to draw text on screen.', - }, - }, - }, - }, - }, - { - 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 = 'filename', - description = 'The filepath to the image file.', - }, - }, - returns = { - { - type = 'Image', - name = 'image', - description = 'An Image object which can be drawn on screen.', - }, - }, - }, - { - arguments = { - { - type = 'ImageData', - name = 'imageData', - description = 'An ImageData object. The Image will use this ImageData to reload itself when love.window.setMode is called.', - }, - }, - 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.', - }, - }, - returns = { - { - type = 'Image', - name = 'image', - description = 'An Image object which can be drawn on screen.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filepath to the image file (or a FileData or ImageData or CompressedImageData object).', - }, - { - 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', - }, - }, - }, - }, - returns = { - { - type = 'Image', - name = 'image', - description = 'A new Image object which can be drawn on screen.', - }, - }, - }, - }, - }, - { - 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 filepath to the image 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.', - }, - }, - }, - { - arguments = { - { - type = 'ImageData', - name = 'imageData', - description = 'The ImageData object to create the font from.', - }, - { - 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 = '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 = 'string', - name = 'filename', - description = 'The filepath to the image file.', - }, - { - type = 'string', - name = 'glyphs', - description = 'A string of the characters in the image in order from left to right.', - }, - { - type = 'number', - 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 = 'vertices', - description = 'The table filled with vertex information tables for each vertex as follows:', - table = { - { - type = 'number', - 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.', - }, - { - type = 'number', - 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 = '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.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'pixelcode', - 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.', - }, - }, - returns = { - { - type = 'Shader', - name = 'shader', - description = 'A Shader object for use in drawing operations.', - }, - }, - }, - }, - }, - { - 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 = '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 = 'Transform', - name = 'transform', - description = 'Transformation object.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'text', - description = 'The text to draw.', - }, - { - type = 'Font', - name = 'font', - description = 'The Font object to use.', - }, - { - 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 = 'tables and strings', - name = '...', - description = 'Additional colors and strings.', - }, - }, - }, - { - type = 'Font', - name = 'font', - description = 'The Font object to use.', - }, - { - type = 'Transform', - name = 'transform', - description = 'Transformation object.', - }, - }, - }, - }, - }, - { - 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 = 'string', - name = 'text', - description = 'A text string.', - }, - { - type = 'number', - name = 'x', - description = 'The position on the x-axis.', - }, - { - type = 'number', - name = 'y', - 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', - }, - { - 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 = 'A text string.', - }, - { - type = 'Font', - name = 'font', - description = 'The Font object to use.', - }, - { - type = 'number', - name = 'x', - description = 'The position on the x-axis.', - }, - { - type = 'number', - name = 'y', - 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', - }, - { - 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 = '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', - 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 (x-axis).', - }, - { - type = 'number', - name = 'y', - 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', - }, - { - 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 / skew factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shearing / skew 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 = 'Font', - name = 'font', - description = 'The Font object to use.', - }, - { - type = 'number', - name = 'x', - description = 'The position on the x-axis.', - }, - { - type = 'number', - name = 'y', - 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 = 'angle', - 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 = '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 = '', - 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 = '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\'', - }, - }, - }, - }, - }, - { - 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', - description = 'The type of stack to push (e.g. just transformation state, or all love.graphics state).', - }, - }, - }, - }, - }, - { - name = 'rectangle', - description = 'Draws a rectangle.', - variants = { - { - arguments = { - { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the rectangle.', - }, - { - type = 'number', - name = 'x', - 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.', - }, - { - type = 'number', - name = 'width', - description = 'Width of the rectangle.', - }, - { - type = 'number', - name = 'height', - description = 'Height of the rectangle.', - }, - }, - }, - { - description = 'Draws a rectangle with rounded corners.', - arguments = { - { - type = 'DrawMode', - name = 'mode', - description = 'How to draw the rectangle.', - }, - { - type = 'number', - name = 'x', - 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.', - }, - { - type = 'number', - name = 'width', - description = 'Width of the rectangle.', - }, - { - type = 'number', - name = 'height', - 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.', - }, - { - type = 'number', - name = 'ry', - description = 'The y-axis radius of each round corner. Cannot be greater than half the rectangle\'s height.', - default = 'rx', - }, - { - 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', - }, - }, - }, - }, - }, - { - name = 'replaceTransform', - description = 'Replaces the current coordinate transformation with the given Transform object.', - variants = { - { - arguments = { - { - type = 'Transform', - name = 'transform', - 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, 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.', - variants = { - { - arguments = { - { - type = 'number', - name = 'angle', - 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.', - variants = { - { - arguments = { - { - type = 'number', - name = 'sx', - 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', - }, - }, - }, - }, - }, - { - name = 'setBackgroundColor', - description = 'Sets the background color.', - variants = { - { - arguments = { - { - type = 'number', - name = 'red', - description = 'The red component (0-1).', - }, - { - type = 'number', - name = 'green', - description = 'The green component (0-1).', - }, - { - type = 'number', - name = 'blue', - description = 'The blue component (0-1).', - }, - { - type = 'number', - name = 'alpha', - description = 'The alpha component (0-1).', - default = '1', - }, - }, - }, - { - }, - { - }, - }, - }, - { - name = 'setBlendMode', - description = 'Sets the blending mode.', - variants = { - { - arguments = { - { - type = 'BlendMode', - name = 'mode', - 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.', - }, - { - type = 'BlendAlphaMode', - name = 'alphamode', - 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 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 = '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 = '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.', - }, - { - type = 'Canvas', - name = 'canvas2', - description = 'The second render target.', - }, - { - type = 'Canvas', - name = '...', - 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.\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.', - }, - { - type = 'number', - name = 'green', - description = 'The amount of green.', - }, - { - type = 'number', - name = '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.', - 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.', - }, - }, - }, - }, - }, - { - 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.', - variants = { - { - description = 'Enables color masking for the specified color components.', - arguments = { - { - type = 'boolean', - name = 'red', - description = 'Render red component.', - }, - { - type = 'boolean', - name = 'green', - description = 'Render green component.', - }, - { - type = 'boolean', - name = 'blue', - description = 'Render blue component.', - }, - { - type = 'boolean', - name = 'alpha', - description = 'Render alpha component.', - }, - }, - }, - { - description = 'Disables color masking.', - }, - }, - }, - { - name = 'setDefaultFilter', - 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.', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'Filter mode used when scaling the image up.', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of Anisotropic Filtering used.', - default = '1', - }, - }, - }, - }, - }, - { - name = 'setDepthMode', - description = 'Configures depth testing and writing to the depth buffer.\n\nThis is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images.', - variants = { - { - arguments = { - { - type = 'CompareMode', - name = 'comparemode', - 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 = 'Disables depth testing and depth writes.', - }, - }, - }, - { - name = 'setFont', - description = 'Set an already-loaded Font as the current font or create and load a new one from the file and size.\n\nIt\'s recommended that Font objects are created with love.graphics.newFont in the loading stage and then passed to this function in the drawing stage.', - variants = { - { - arguments = { - { - type = 'Font', - name = 'font', - description = 'The Font object to use.', - }, - }, - }, - }, - }, - { - name = 'setFrontFaceWinding', - description = 'Sets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing.\n\nThis is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices.', - variants = { - { - arguments = { - { - type = 'VertexWinding', - name = 'winding', - description = 'The winding mode to use. The default winding is counterclockwise (\'ccw\').', - }, - }, - }, - }, - }, - { - name = 'setLineJoin', - description = 'Sets the line join style. See LineJoin for the possible options.', - variants = { - { - arguments = { - { - type = 'LineJoin', - name = 'join', - description = 'The LineJoin to use.', - }, - }, - }, - }, - }, - { - name = 'setLineStyle', - description = 'Sets the line style.', - variants = { - { - arguments = { - { - type = 'LineStyle', - name = 'style', - description = 'The LineStyle to use. Line styles include smooth and rough.', - }, - }, - }, - }, - }, - { - name = 'setLineWidth', - description = 'Sets the line width.', - variants = { - { - arguments = { - { - type = 'number', - name = 'width', - 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.\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).', - }, - }, - }, - }, - }, - { - name = 'setNewFont', - 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.', - }, - { - type = 'number', - name = 'size', - description = 'The size of the font.', - default = '12', - }, - }, - returns = { - { - type = 'Font', - name = 'font', - description = 'The new font.', - }, - }, - }, - { - arguments = { - { - type = 'File', - name = 'file', - description = 'A File with the font.', - }, - { - type = 'number', - name = 'size', - description = 'The size of the font.', - default = '12', - }, - }, - returns = { - { - type = 'Font', - name = 'font', - description = 'The new font.', - }, - }, - }, - { - arguments = { - { - type = 'Data', - name = 'data', - description = 'A Data with the font.', - }, - { - type = 'number', - name = 'size', - description = 'The size of the font.', - default = '12', - }, - }, - returns = { - { - type = 'Font', - name = 'font', - description = 'The new font.', - }, - }, - }, - { - arguments = { - { - type = 'Rasterizer', - name = 'rasterizer', - description = 'A rasterizer.', - }, - }, - returns = { - { - type = 'Font', - name = 'font', - description = 'The new font.', - }, - }, - }, - }, - }, - { - name = 'setPointSize', - description = 'Sets the point size.', - variants = { - { - arguments = { - { - type = 'number', - name = '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. \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 = 'x coordinate of upper left corner.', - }, - { - type = 'number', - name = 'y', - description = 'y coordinate of upper left corner.', - }, - { - type = 'number', - name = 'width', - description = 'width of clipping rectangle.', - }, - { - type = 'number', - name = 'height', - 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.', - variants = { - { - arguments = { - { - type = 'CompareMode', - name = 'comparemode', - 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 255.', - }, - }, - }, - { - description = 'Disables stencil testing.', - }, - }, - }, - { - name = 'setWireframe', - 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.', - }, - }, - }, - }, - }, - { - name = 'shear', - description = 'Shears the coordinate system.', - variants = { - { - arguments = { - { - type = 'number', - name = 'kx', - description = 'The shear factor on the x-axis.', - }, - { - type = 'number', - name = 'ky', - 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 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.', - }, - { - type = 'StencilAction', - name = 'action', - 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', - }, - { - 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', - }, - }, - }, - }, - }, - { - name = 'transformPoint', - description = 'Converts the given 2D position from global coordinates into screen-space.\n\nThis effectively applies the current graphics transformations to the given position. A similar Transform:transformPoint method exists for Transform objects.', - 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 = 'screenX', - description = 'The x component of the position with graphics transformations applied.', - }, - { - type = 'number', - 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.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.', - }, - { - type = 'number', - name = 'dy', - description = 'The translation relative to the y-axis.', - }, - }, - }, - }, - }, - { - name = 'validateShader', - 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.', - }, - { - type = 'string', - name = '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.', - }, - { - type = 'string', - name = 'message', - description = 'Reason why shader code validation failed (or nil if validation succeded).', - }, - }, - }, - { - arguments = { - { - type = 'boolean', - name = 'gles', - 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.', - }, - { - type = 'string', - name = 'vertexcode', - 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.', - }, - { - type = 'string', - name = 'message', - description = 'Reason why shader code validation failed (or nil if validation succeded).', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.AlignMode'), - require(path .. 'enums.ArcType'), - require(path .. 'enums.AreaSpreadDistribution'), - require(path .. 'enums.BlendAlphaMode'), - require(path .. 'enums.BlendMode'), - require(path .. 'enums.CompareMode'), - require(path .. 'enums.CullMode'), - require(path .. 'enums.DrawMode'), - require(path .. 'enums.FilterMode'), - require(path .. 'enums.GraphicsFeature'), - require(path .. 'enums.GraphicsLimit'), - require(path .. 'enums.IndexDataType'), - require(path .. 'enums.LineJoin'), - require(path .. 'enums.LineStyle'), - require(path .. 'enums.MeshDrawMode'), - require(path .. 'enums.MipmapMode'), - require(path .. 'enums.ParticleInsertMode'), - require(path .. 'enums.SpriteBatchUsage'), - require(path .. 'enums.StackType'), - require(path .. 'enums.StencilAction'), - require(path .. 'enums.TextureType'), - require(path .. 'enums.VertexAttributeStep'), - require(path .. 'enums.VertexWinding'), - require(path .. 'enums.WrapMode'), - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/AlignMode.lua b/modules/graphics/enums/AlignMode.lua deleted file mode 100644 index 70df137..0000000 --- a/modules/graphics/enums/AlignMode.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - name = 'AlignMode', - description = 'Text alignment.', - constants = { - { - name = 'center', - description = 'Align text center.', - }, - { - name = 'left', - description = 'Align text left.', - }, - { - name = 'right', - description = 'Align text right.', - }, - { - name = 'justify', - 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 deleted file mode 100644 index 9ac5f72..0000000 --- a/modules/graphics/enums/ArcType.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'ArcType', - description = 'Different types of arcs that can be drawn.', - 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.', - }, - { - 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.', - }, - { - name = 'closed', - 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 deleted file mode 100644 index 634ae7c..0000000 --- a/modules/graphics/enums/AreaSpreadDistribution.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - name = 'AreaSpreadDistribution', - description = 'Types of particle area spread distribution.', - constants = { - { - name = 'uniform', - description = 'Uniform distribution.', - }, - { - name = 'normal', - description = 'Normal (gaussian) distribution.', - }, - { - name = '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.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/BlendAlphaMode.lua b/modules/graphics/enums/BlendAlphaMode.lua deleted file mode 100644 index 9ce2c7a..0000000 --- a/modules/graphics/enums/BlendAlphaMode.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'BlendAlphaMode', - description = 'Different ways alpha affects color blending. See BlendMode and the BlendMode Formulas for additional notes.', - 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.', - }, - { - 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").', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/BlendMode.lua b/modules/graphics/enums/BlendMode.lua deleted file mode 100644 index dd57175..0000000 --- a/modules/graphics/enums/BlendMode.lua +++ /dev/null @@ -1,54 +0,0 @@ -return { - name = 'BlendMode', - description = 'Different ways to do color blending. See BlendAlphaMode and the BlendMode Formulas for additional notes.', - constants = { - { - name = 'alpha', - 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.', - }, - { - name = 'screen', - 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.', - }, - { - 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.', - }, - { - 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.', - }, - { - 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.', - }, - { - 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.', - }, - { - 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/CanvasFormat.lua b/modules/graphics/enums/CanvasFormat.lua deleted file mode 100644 index aa154ed..0000000 --- a/modules/graphics/enums/CanvasFormat.lua +++ /dev/null @@ -1,74 +0,0 @@ -return { - name = 'CanvasFormat', - description = 'Canvas formats.', - constants = { - { - name = 'normal', - description = 'The default Canvas format - usually an alias for the rgba8 format, or the srgb format if gamma-correct rendering is enabled in LÖVE 0.10.0 and newer.' - }, - { - name = 'hdr', - description = 'A format suitable for high dynamic range content - an alias for the rgba16f format, normally.' - }, - { - name = 'rgba8', - description = '8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).' - }, - { - name = 'rgba4', - description = '4 bits per channel (16 bpp) RGBA.' - }, - { - name = 'rgb5a1', - description = 'RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).' - }, - { - name = 'rgb565', - description = 'RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.' - }, - { - name = 'rgb10a2', - description = 'RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).' - }, - { - name = 'rgba16f', - description = 'Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].' - }, - { - name = 'rgba32f', - description = 'Floating point RGBA with 32 bits per channel (128 bpp).' - }, - { - name = 'rg11b10f', - description = 'Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].' - }, - { - name = 'srgb', - description = 'The same as rgba8, but the Canvas is interpreted as being in the sRGB color space. Everything drawn to the Canvas will be converted from linear RGB to sRGB. When the Canvas is drawn (or used in a shader), it will be decoded from sRGB to linear RGB. This reduces color banding when doing gamma-correct rendering, since sRGB encoding has more precision than linear RGB for darker colors.' - }, - { - name = 'r8', - description = 'Single-channel (red component) format (8 bpp).' - }, - { - name = 'rg8', - description = 'Two channels (red and green components) with 8 bits per channel (16 bpp).' - }, - { - name = 'r16f', - description = 'Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].' - }, - { - name = 'rg16f', - description = 'Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].' - }, - { - name = 'r32f', - description = 'Floating point single-channel format (32 bpp).' - }, - { - name = 'rg32f', - description = 'Floating point two-channel format with 32 bits per channel (64 bpp).' - } - } -} diff --git a/modules/graphics/enums/CompareMode.lua b/modules/graphics/enums/CompareMode.lua deleted file mode 100644 index 53e97fa..0000000 --- a/modules/graphics/enums/CompareMode.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - name = 'CompareMode', - 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.', - constants = { - { - name = 'equal', - description = '* stencil tests: the stencil value of the pixel must be equal to the supplied value.\n* depth tests: the depth value of the drawn object at that pixel must be equal to the existing depth value of that pixel.', - }, - { - name = 'notequal', - description = '* stencil tests: the stencil value of the pixel must not be equal to the supplied value.\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.', - }, - { - name = 'less', - description = '* stencil tests: the stencil value of the pixel must be less than the supplied value.\n* depth tests: the depth value of the drawn object at that pixel must be less than the existing depth value of that pixel.', - }, - { - name = 'lequal', - description = '* stencil tests: the stencil value of the pixel must be less than or equal to the supplied value.\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.', - }, - { - name = 'gequal', - description = '* stencil tests: the stencil value of the pixel must be greater than or equal to the supplied value.\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.', - }, - { - name = 'greater', - description = '* stencil tests: the stencil value of the pixel must be greater than the supplied value.\n* depth tests: the depth value of the drawn object at that pixel must be greater than the existing depth value of that pixel.', - }, - { - name = 'never', - description = 'Objects will never be drawn.', - }, - { - name = 'always', - description = 'Objects will always be drawn. Effectively disables the depth or stencil test.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/DrawMode.lua b/modules/graphics/enums/DrawMode.lua deleted file mode 100644 index 06ca6e3..0000000 --- a/modules/graphics/enums/DrawMode.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'DrawMode', - description = 'Controls whether shapes are drawn as an outline, or filled.', - constants = { - { - name = 'fill', - description = 'Draw filled shape.', - }, - { - name = 'line', - description = 'Draw outlined shape.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/FilterMode.lua b/modules/graphics/enums/FilterMode.lua deleted file mode 100644 index 04c2a94..0000000 --- a/modules/graphics/enums/FilterMode.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'FilterMode', - description = 'How the image is filtered when scaling.', - constants = { - { - name = 'linear', - description = 'Scale image with linear interpolation.', - }, - { - name = 'nearest', - 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 deleted file mode 100644 index faaa7ee..0000000 --- a/modules/graphics/enums/GraphicsFeature.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - name = 'GraphicsFeature', - description = 'Graphics features that can be checked for with love.graphics.getSupported.', - constants = { - { - name = 'clampzero', - description = 'Whether the "clampzero" WrapMode is supported.', - }, - { - name = 'lighten', - description = 'Whether the "lighten" and "darken" BlendModes are supported.', - }, - { - name = 'multicanvasformats', - 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.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/GraphicsLimit.lua b/modules/graphics/enums/GraphicsLimit.lua deleted file mode 100644 index 61cf462..0000000 --- a/modules/graphics/enums/GraphicsLimit.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - name = 'GraphicsLimit', - description = 'Types of system-dependent graphics limits checked for using love.graphics.getSystemLimits.', - constants = { - { - name = 'pointsize', - description = 'The maximum size of points.', - }, - { - name = 'texturesize', - description = 'The maximum width or height of Images and Canvases.', - }, - { - name = 'multicanvas', - description = 'The maximum number of simultaneously active canvases (via love.graphics.setCanvas.)', - }, - { - name = 'canvasmsaa', - 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.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/LineJoin.lua b/modules/graphics/enums/LineJoin.lua deleted file mode 100644 index 6f1f417..0000000 --- a/modules/graphics/enums/LineJoin.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'LineJoin', - description = 'Line join style.', - constants = { - { - name = 'miter', - description = 'The ends of the line segments beveled in an angle so that they join seamlessly.', - }, - { - name = 'none', - description = 'No cap applied to the ends of the line segments.', - }, - { - 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 deleted file mode 100644 index 374858a..0000000 --- a/modules/graphics/enums/LineStyle.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'LineStyle', - description = 'The styles in which lines are drawn.', - constants = { - { - name = 'rough', - description = 'Draw rough lines.', - }, - { - name = 'smooth', - description = 'Draw smooth lines.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/MeshDrawMode.lua b/modules/graphics/enums/MeshDrawMode.lua deleted file mode 100644 index 42713ac..0000000 --- a/modules/graphics/enums/MeshDrawMode.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - name = 'MeshDrawMode', - description = 'How a Mesh\'s vertices are used when drawing.', - 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.', - }, - { - 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.', - }, - { - name = 'triangles', - description = 'The vertices create unconnected triangles.', - }, - { - name = 'points', - 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 deleted file mode 100644 index f531033..0000000 --- a/modules/graphics/enums/ParticleInsertMode.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'ParticleInsertMode', - description = 'How newly created particles are added to the ParticleSystem.', - constants = { - { - name = 'top', - 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.', - }, - { - name = 'random', - 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 deleted file mode 100644 index 82a3ab6..0000000 --- a/modules/graphics/enums/SpriteBatchUsage.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'SpriteBatchUsage', - description = 'Usage hints for SpriteBatches and Meshes to optimize data storage and access.', - constants = { - { - name = 'dynamic', - 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.', - }, - { - name = 'stream', - 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 deleted file mode 100644 index 246adcf..0000000 --- a/modules/graphics/enums/StackType.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - name = 'StackType', - description = 'Graphics state stack types used with love.graphics.push.', - constants = { - { - name = 'transform', - description = 'The transformation stack (love.graphics.translate, love.graphics.rotate, etc.)', - }, - { - name = 'all', - 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 deleted file mode 100644 index 15e6745..0000000 --- a/modules/graphics/enums/StencilAction.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - name = 'StencilAction', - description = 'How a stencil function modifies the stencil values of pixels it touches.', - 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.', - }, - { - 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 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.', - }, - { - 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 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 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 255.', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/enums/WrapMode.lua b/modules/graphics/enums/WrapMode.lua deleted file mode 100644 index 615f977..0000000 --- a/modules/graphics/enums/WrapMode.lua +++ /dev/null @@ -1,22 +0,0 @@ -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 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 = '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 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.', - }, - { - 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.)', - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Canvas.lua b/modules/graphics/types/Canvas.lua deleted file mode 100644 index 5277344..0000000 --- a/modules/graphics/types/Canvas.lua +++ /dev/null @@ -1,127 +0,0 @@ -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 love.graphics.isSupported("canvas") could be used to check for support at runtime.', - constructors = { - 'newCanvas', - 'getCanvas', - }, - 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 = 'getMSAA', - description = 'Gets the number of multisample antialiasing (MSAA) samples used when drawing to the Canvas.\n\nThis may be different than the number used as an argument to love.graphics.newCanvas if the system running LÖVE doesn\'t support that number.', - variants = { - { - returns = { - { - type = 'number', - name = 'samples', - 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 = 'newImageData', - description = 'Generates ImageData from the contents of the Canvas.', - variants = { - { - returns = { - { - type = 'ImageData', - name = 'data', - 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 (in pixels) of the area within the Canvas to capture.', - }, - { - type = 'number', - name = 'y', - 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 in pixels of the area within the Canvas to capture.', - }, - { - type = 'number', - name = 'height', - 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.', - }, - }, - }, - }, - }, - { - name = 'renderTo', - 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.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Font.lua b/modules/graphics/types/Font.lua deleted file mode 100644 index 0cd98b2..0000000 --- a/modules/graphics/types/Font.lua +++ /dev/null @@ -1,312 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Font', - description = 'Defines the shape of characters that can be drawn onto the screen.', - constructors = { - 'getFont', - 'newFont', - 'setNewFont', - 'newImageFont', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'getAscent', - 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.', - }, - }, - }, - }, - }, - { - name = 'getBaseline', - 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.', - }, - }, - }, - }, - }, - { - 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.\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.', - }, - }, - }, - }, - }, - { - name = 'getFilter', - description = 'Gets the filter mode for a font.', - variants = { - { - returns = { - { - type = 'FilterMode', - name = 'min', - description = 'Filter mode used when minifying the font.', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'Filter mode used when magnifying the font.', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.', - }, - }, - }, - }, - }, - { - name = 'getHeight', - 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.', - }, - }, - }, - }, - }, - { - name = 'getLineHeight', - 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.', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Determines the maximum width (accounting for newlines) taken by the given string.', - variants = { - { - arguments = { - { - type = 'string', - name = 'text', - description = 'A string.', - }, - }, - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the text.', - }, - }, - }, - }, - }, - { - name = 'getWrap', - description = 'Gets formatting information for text, given a wrap limit.\n\nThis function accounts for newlines correctly (i.e. \'\\n\').', - variants = { - { - arguments = { - { - type = 'string', - name = 'text', - 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.', - }, - }, - returns = { - { - type = 'number', - name = 'width', - description = 'The maximum width of the wrapped text.', - }, - { - type = 'table', - name = 'wrappedtext', - description = 'A sequence containing each line of text that was wrapped.', - }, - }, - }, - }, - }, - { - name = 'hasGlyphs', - description = 'Gets whether the Font can render a character or string.', - variants = { - { - arguments = { - { - type = 'string', - name = 'text', - description = 'A UTF-8 encoded unicode string.', - }, - }, - returns = { - { - type = 'boolean', - name = 'hasglyph', - 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 = '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 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).', - 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.', - }, - { - type = 'Font', - name = '...', - description = 'Additional fallback Fonts.', - }, - }, - }, - }, - }, - { - name = 'setFilter', - description = 'Sets the filter mode for a font.', - variants = { - { - arguments = { - { - type = 'FilterMode', - name = 'min', - description = 'How to scale a font down.', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'How to scale a font up.', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.', - default = '1', - }, - }, - }, - }, - }, - { - name = 'setLineHeight', - description = 'Sets the line height.\n\nWhen 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.', - variants = { - { - arguments = { - { - type = 'number', - name = 'height', - description = 'The new line height.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Image.lua b/modules/graphics/types/Image.lua deleted file mode 100644 index 0183aaa..0000000 --- a/modules/graphics/types/Image.lua +++ /dev/null @@ -1,92 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Image', - description = 'Drawable image type.', - constructors = { - 'newImage', - 'newVolumeImage', - 'newCubeImage', - 'newArrayImage', - }, - supertypes = { - 'Texture', - 'Drawable', - 'Object', - }, - functions = { - { - name = 'getFlags', - description = 'Gets the flags used when the image was created.', - variants = { - { - returns = { - { - type = 'table', - name = 'flags', - description = 'A table with ImageFlag keys.', - }, - }, - }, - }, - }, - { - name = 'isCompressed', - description = 'Gets whether the Image was created from CompressedData.\n\nCompressed images take up less space in VRAM, and drawing a compressed image will generally be more efficient than drawing one created from raw pixel data.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'compressed', - description = 'Whether the Image is stored as a compressed texture on the GPU.', - }, - }, - }, - }, - }, - { - name = 'replacePixels', - description = 'Replace the contents of an Image.', - variants = { - { - arguments = { - { - type = 'ImageData', - name = 'data', - description = 'The new ImageData to replace the contents with.', - }, - { - type = 'number', - name = 'slice', - 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', - }, - { - 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.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Mesh.lua b/modules/graphics/types/Mesh.lua deleted file mode 100644 index e68af0c..0000000 --- a/modules/graphics/types/Mesh.lua +++ /dev/null @@ -1,815 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Mesh', - description = 'A 2D polygon mesh used for drawing arbitrary textured shapes.', - constructors = { - 'newMesh', - }, - supertypes = { - 'Drawable', - 'Object', - }, - functions = { - { - 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.', - }, - { - 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.', - }, - { - 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', - description = 'Removes a previously attached vertex attribute from this Mesh.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - description = 'The name of the attached vertex attribute to detach.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the attribute was successfully detached.', - }, - }, - }, - }, - }, - { - name = 'getDrawMode', - description = 'Gets the mode used when drawing the Mesh.', - variants = { - { - returns = { - { - type = 'MeshDrawMode', - name = 'mode', - description = 'The mode used when drawing the Mesh.', - }, - }, - }, - }, - }, - { - name = 'getDrawRange', - 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.', - }, - { - 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.', - }, - }, - }, - }, - }, - { - name = 'getTexture', - description = 'Gets the texture (Image or Canvas) used when drawing the Mesh.', - variants = { - { - returns = { - { - type = 'Texture', - name = 'texture', - 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.\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 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.', - }, - { - type = 'number', - name = '...', - 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 vertex you want to retrieve the information for.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'The position of the vertex on the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the vertex on the y-axis.', - }, - { - type = 'number', - name = 'u', - description = 'The horizontal component of the texture coordinate.', - }, - { - type = 'number', - name = 'v', - description = 'The vertical component of the texture coordinate.', - }, - { - type = 'number', - name = 'r', - description = 'The red component of the vertex\'s color.', - }, - { - type = 'number', - name = 'g', - description = 'The green component of the vertex\'s color.', - }, - { - type = 'number', - name = 'b', - description = 'The blue component of the vertex\'s color.', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component of the vertex\'s color.', - }, - }, - }, - }, - }, - { - name = 'getVertexAttribute', - description = 'Gets 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 = { - { - arguments = { - { - type = 'number', - name = 'vertexindex', - 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 retrieved (one-based).', - }, - }, - returns = { - { - type = 'number', - name = 'value1', - description = 'The value of the first component of the attribute.', - }, - { - type = 'number', - name = 'value2', - description = 'The value of the second component of the attribute.', - }, - { - type = 'number', - name = '...', - description = 'Any additional vertex attribute components.', - }, - }, - }, - }, - }, - { - name = 'getVertexCount', - description = 'Gets the total number of vertices in the Mesh.', - variants = { - { - returns = { - { - type = 'number', - 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', - name = 'format', - description = 'The vertex format of the Mesh, which is a table containing tables for each vertex attribute the Mesh was created with, in the form of {attribute, ...}.', - 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 attributes in the Mesh.', - }, - }, - }, - }, - }, - }, - }, - { - name = 'getVertexMap', - description = 'Gets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen.\n\nIf no vertex map has been set previously via Mesh:setVertexMap, then this function will return nil in LÖVE 0.10.0+, or an empty table in 0.9.2 and older.', - variants = { - { - returns = { - { - type = 'table', - name = 'map', - 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 be checked.', - }, - }, - returns = { - { - type = 'boolean', - name = 'enabled', - 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.', - }, - { - type = 'boolean', - name = 'enable', - description = 'Whether the vertex attribute is used when drawing this Mesh.', - }, - }, - }, - }, - }, - { - name = 'setDrawMode', - description = 'Sets the mode used when drawing the Mesh.', - variants = { - { - arguments = { - { - type = 'MeshDrawMode', - name = 'mode', - 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.', - variants = { - { - arguments = { - { - type = 'number', - 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 = '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.', - }, - }, - }, - { - name = 'setTexture', - 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 = '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.\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 (one-based).', - }, - { - type = 'number', - name = 'attributecomponent', - 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 = '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 (one-based).', - }, - { - type = 'table', - name = 'vertex', - description = 'A table with vertex information, in the form of {attributecomponent, ...}.', - table = { - { - type = 'number', - name = 'attributecomponent', - 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 = 'Sets 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 modify (one-based).', - }, - { - type = 'number', - name = 'x', - description = 'The position of the vertex on the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the vertex on the y-axis.', - }, - { - type = 'number', - name = 'u', - description = 'The horizontal component of the texture coordinate.', - }, - { - type = 'number', - name = 'v', - description = 'The vertical component of the texture coordinate.', - }, - { - type = 'number', - name = 'r', - description = 'The red component of the vertex\'s color.', - default = '1', - }, - { - type = 'number', - name = 'g', - description = 'The green component of the vertex\'s color.', - default = '1', - }, - { - type = 'number', - name = 'b', - description = 'The blue component of the vertex\'s color.', - default = '1', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component of the vertex\'s color.', - default = '1', - }, - }, - }, - { - description = 'Sets 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 modify (one-based).', - }, - { - type = 'table', - name = 'vertex', - description = 'A table with vertex information.', - table = { - { - type = 'number', - 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.', - }, - { - type = 'number', - 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 v texture coordinate. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.)', - }, - { - type = 'number', - name = '5', - description = 'The red color component.', - default = '1', - }, - { - type = 'number', - name = '6', - description = 'The green color component.', - default = '1', - }, - { - type = 'number', - name = '7', - description = 'The blue color component.', - default = '1', - }, - { - type = 'number', - name = '8', - description = 'The alpha color component.', - default = '1', - }, - }, - }, - }, - }, - }, - }, - { - 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 (one-based).', - }, - { - type = 'number', - name = 'attributeindex', - description = 'The index of the attribute within the vertex to be modified (one-based).', - }, - { - type = 'number', - name = 'value1', - description = 'The new value for the first component of the attribute.', - }, - { - type = 'number', - name = 'value2', - description = 'The new value for the second component of the attribute.', - }, - { - type = 'number', - name = '...', - description = 'Any additional vertex attribute components.', - }, - }, - }, - }, - }, - { - name = 'setVertexMap', - description = 'Sets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen.\n\nThe vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters or duplicating vertices. It is especially useful when combined with different Mesh Draw Modes.', - variants = { - { - arguments = { - { - type = 'table', - name = 'map', - 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 Mesh:getVertexCount().', - }, - { - type = 'number', - name = 'vi2', - 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.', - }, - }, - }, - { - 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. 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', - 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 = '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.', - arguments = { - { - type = 'table', - name = 'vertices', - description = 'The table filled with vertex information tables for each vertex as follows:', - table = { - { - type = 'number', - 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.', - }, - { - type = 'number', - 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 1, but can be greater or less (see WrapMode).', - }, - { - type = 'number', - name = '5', - description = 'The red color component.', - default = '1', - }, - { - type = 'number', - name = '6', - description = 'The green color component.', - default = '1', - }, - { - type = 'number', - name = '7', - description = 'The blue color component.', - default = '1', - }, - { - type = 'number', - name = '8', - description = 'The alpha color component.', - default = '1', - }, - }, - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/ParticleSystem.lua b/modules/graphics/types/ParticleSystem.lua deleted file mode 100644 index cb6dcb3..0000000 --- a/modules/graphics/types/ParticleSystem.lua +++ /dev/null @@ -1,1213 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'ParticleSystem', - 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.', - constructors = { - 'newParticleSystem', - }, - supertypes = { - 'Drawable', - 'Object', - }, - functions = { - { - name = 'clone', - 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.', - }, - }, - }, - }, - }, - { - name = 'emit', - description = 'Emits a burst of particles from the particle emitter.', - variants = { - { - arguments = { - { - 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 = 'getBufferSize', - description = 'Gets the maximum number of particles the ParticleSystem can have at once.', - variants = { - { - returns = { - { - type = 'number', - name = 'size', - description = 'The maximum number of particles.', - }, - }, - }, - }, - }, - { - name = 'getColors', - 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).', - }, - { - type = 'number', - name = 'g1', - description = 'First color, green component (0-1).', - }, - { - type = 'number', - name = 'b1', - description = 'First color, blue component (0-1).', - }, - { - type = 'number', - name = 'a1', - description = 'First color, alpha component (0-1).', - }, - { - type = 'number', - name = 'r2', - description = 'Second color, red component (0-1).', - }, - { - type = 'number', - name = 'g2', - description = 'Second color, green component (0-1).', - }, - { - type = 'number', - name = 'b2', - description = 'Second color, blue component (0-1).', - }, - { - type = 'number', - name = 'a2', - 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 = '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 of the particle emitter (in radians).', - variants = { - { - returns = { - { - type = 'number', - name = 'direction', - 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', - description = 'Gets the amount of particles emitted per second.', - variants = { - { - returns = { - { - type = 'number', - name = 'rate', - 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 used when the ParticleSystem adds new particles.', - variants = { - { - returns = { - { - type = 'ParticleInsertMode', - name = 'mode', - description = 'The mode used when the ParticleSystem adds new particles.', - }, - }, - }, - }, - }, - { - name = 'getLinearAcceleration', - description = 'Gets the linear acceleration (acceleration along the x and y axes) for particles.\n\nEvery particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax.', - variants = { - { - returns = { - { - type = 'number', - name = 'xmin', - description = 'The minimum acceleration along the x axis.', - }, - { - type = 'number', - name = 'ymin', - description = 'The minimum acceleration along the y axis.', - }, - { - type = 'number', - name = 'xmax', - description = 'The maximum acceleration along the x axis.', - }, - { - type = 'number', - name = 'ymax', - description = 'The maximum acceleration along the y axis.', - }, - }, - }, - }, - }, - { - name = 'getLinearDamping', - description = 'Gets the amount of linear damping (constant deceleration) for particles.', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum amount of linear damping applied to particles.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum amount of linear damping applied to particles.', - }, - }, - }, - }, - }, - { - name = 'getOffset', - description = 'Gets the particle image\'s draw offset.', - variants = { - { - returns = { - { - type = 'number', - 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 = 'getParticleLifetime', - description = 'Gets the lifetime of the particles.', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum life of the particles (in seconds).', - }, - { - type = 'number', - name = 'max', - description = 'The maximum life of the particles (in seconds).', - }, - }, - }, - }, - }, - { - name = 'getPosition', - description = 'Gets the position of the emitter.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'Position along x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'Position along y-axis.', - }, - }, - }, - }, - }, - { - name = 'getQuads', - description = 'Gets the series of Quads used for the particle sprites.', - variants = { - { - returns = { - { - type = 'table', - name = 'quads', - description = 'A table containing the Quads used.', - }, - }, - }, - }, - }, - { - name = 'getRadialAcceleration', - description = 'Gets the radial acceleration (away from the emitter).', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum acceleration.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum acceleration.', - }, - }, - }, - }, - }, - { - name = 'getRotation', - description = 'Gets the rotation of the image upon particle creation (in radians).', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum initial angle (radians).', - }, - { - type = 'number', - name = 'max', - description = 'The maximum initial angle (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 = 'variation', - description = 'The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', - }, - }, - }, - }, - }, - { - name = 'getSizes', - 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.', - }, - { - type = 'number', - name = 'size2', - description = 'The second size.', - }, - { - type = 'number', - name = 'size8', - description = 'The eighth size.', - }, - }, - }, - }, - }, - { - name = 'getSpeed', - description = 'Gets the speed of the particles.', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum linear speed of the particles.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum linear speed of the particles.', - }, - }, - }, - }, - }, - { - name = 'getSpin', - description = 'Gets the spin of the sprite.', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum spin (radians per second).', - }, - { - type = 'number', - name = 'max', - 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 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 amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', - }, - }, - }, - }, - }, - { - name = 'getSpread', - description = 'Gets the amount of directional spread of the particle emitter (in radians).', - variants = { - { - returns = { - { - type = 'number', - name = 'spread', - description = 'The spread of the emitter (radians).', - }, - }, - }, - }, - }, - { - name = 'getTangentialAcceleration', - description = 'Gets the tangential acceleration (acceleration perpendicular to the particle\'s direction).', - variants = { - { - returns = { - { - type = 'number', - name = 'min', - description = 'The minimum acceleration.', - }, - { - type = 'number', - name = 'max', - 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', - description = 'Gets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enable', - description = 'True if relative particle rotation is enabled, false if it\'s disabled.', - }, - }, - }, - }, - }, - { - name = 'isActive', - description = 'Checks whether the particle system is actively emitting particles.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'active', - description = 'True if system is active, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isPaused', - description = 'Checks whether the particle system is paused.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'paused', - description = 'True if system is paused, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isStopped', - description = 'Checks whether the particle system is stopped.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'stopped', - description = 'True if system is stopped, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'moveTo', - description = 'Moves the position of the emitter. This results in smoother particle spawning behaviour than if ParticleSystem:setPosition is used every frame.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'Position along x-axis.', - }, - { - type = 'number', - name = 'y', - 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 = 'setBufferSize', - description = 'Sets the size of the buffer (the max allowed amount of particles in the system).', - variants = { - { - arguments = { - { - type = 'number', - 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.\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).', - }, - { - type = 'number', - name = 'g1', - description = 'First color, green component (0-1).', - }, - { - type = 'number', - name = 'b1', - description = 'First color, blue component (0-1).', - }, - { - type = 'number', - name = 'a1', - description = 'First color, alpha component (0-1).', - }, - { - type = 'number', - name = 'r2', - description = 'Second color, red component (0-1).', - }, - { - type = 'number', - name = 'g2', - description = 'Second color, green component (0-1).', - }, - { - type = 'number', - name = 'b2', - description = 'Second color, blue component (0-1).', - }, - { - type = 'number', - name = 'a2', - 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 = 'b8', - description = 'Eighth color, blue component (0-1).', - }, - { - type = 'number', - name = 'a8', - description = 'Eighth color, alpha component (0-1).', - }, - }, - }, - }, - }, - { - name = 'setDirection', - description = 'Sets the direction the particles will be emitted in.', - variants = { - { - arguments = { - { - type = 'number', - name = 'direction', - 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', - description = 'Sets the amount of particles emitted per second.', - variants = { - { - arguments = { - { - type = 'number', - name = 'rate', - description = 'The amount of particles per second.', - }, - }, - }, - }, - }, - { - name = 'setEmitterLifetime', - description = 'Sets how long the particle system should emit particles (if -1 then it emits particles forever).', - variants = { - { - arguments = { - { - type = 'number', - name = 'life', - description = 'The lifetime of the emitter (in seconds).', - }, - }, - }, - }, - }, - { - name = 'setInsertMode', - description = 'Sets the mode to use when the ParticleSystem adds new particles.', - variants = { - { - arguments = { - { - type = 'ParticleInsertMode', - name = 'mode', - description = 'The mode to use when the ParticleSystem adds new particles.', - }, - }, - }, - }, - }, - { - name = 'setLinearAcceleration', - description = 'Sets the linear acceleration (acceleration along the x and y axes) for particles.\n\nEvery particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax.', - variants = { - { - arguments = { - { - type = 'number', - name = 'xmin', - description = 'The minimum acceleration along the x axis.', - }, - { - type = 'number', - name = 'ymin', - description = 'The minimum acceleration along the y axis.', - }, - { - type = 'number', - name = 'xmax', - description = 'The maximum acceleration along the x axis.', - default = 'xmin', - }, - { - type = 'number', - name = 'ymax', - description = 'The maximum acceleration along the y axis.', - default = 'ymin', - }, - }, - }, - }, - }, - { - name = 'setLinearDamping', - description = 'Sets the amount of linear damping (constant deceleration) for particles.', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum amount of linear damping applied to particles.', - }, - { - type = 'number', - name = 'max', - 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.\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.', - }, - { - type = 'number', - name = 'y', - description = 'The y coordinate of the rotation offset.', - }, - }, - }, - }, - }, - { - name = 'setParticleLifetime', - description = 'Sets the lifetime of the particles.', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum life of the particles (in seconds).', - }, - { - type = 'number', - name = 'max', - description = 'The maximum life of the particles (in seconds).', - default = 'min', - }, - }, - }, - }, - }, - { - name = 'setPosition', - description = 'Sets the position of the emitter.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'Position along x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'Position along y-axis.', - }, - }, - }, - }, - }, - { - name = 'setQuads', - description = 'Sets a series of Quads to use for the particle sprites. Particles will choose a Quad from the list based on the particle\'s current lifetime, allowing for the use of animated sprite sheets with ParticleSystems.', - variants = { - { - arguments = { - { - type = 'Quad', - name = 'quad1', - description = 'The first Quad to use.', - }, - { - type = 'Quad', - name = 'quad2', - description = 'The second Quad to use.', - }, - }, - }, - { - arguments = { - { - type = 'table', - name = 'quads', - description = 'A table containing the Quads to use.', - }, - }, - }, - }, - }, - { - name = 'setRadialAcceleration', - description = 'Set the radial acceleration (away from the emitter).', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum acceleration.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum acceleration.', - default = 'min', - }, - }, - }, - }, - }, - { - name = 'setRelativeRotation', - description = 'Sets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'True to enable relative particle rotation, false to disable it.', - }, - }, - }, - }, - }, - { - name = 'setRotation', - description = 'Sets the rotation of the image upon particle creation (in radians).', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum initial angle (radians).', - }, - { - type = 'number', - name = 'max', - description = 'The maximum initial angle (radians).', - default = 'min', - }, - }, - }, - }, - }, - { - 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', - description = 'Sets 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.', - variants = { - { - arguments = { - { - type = 'number', - name = 'size1', - description = 'The first size.', - }, - { - type = 'number', - name = 'size2', - description = 'The second size.', - }, - { - type = 'number', - name = 'size8', - description = 'The eighth size.', - }, - }, - }, - }, - }, - { - name = 'setSpeed', - description = 'Sets the speed of the particles.', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum linear speed of the particles.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum linear speed of the particles.', - default = 'min', - }, - }, - }, - }, - }, - { - name = 'setSpin', - description = 'Sets the spin of the sprite.', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum spin (radians per second).', - }, - { - type = 'number', - name = 'max', - description = 'The maximum spin (radians per second).', - default = 'min', - }, - }, - }, - }, - }, - { - name = 'setSpinVariation', - 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 amount of variation (0 meaning no variation and 1 meaning full variation between start and end).', - }, - }, - }, - }, - }, - { - name = 'setSpread', - description = 'Sets the amount of spread for the system.', - variants = { - { - arguments = { - { - type = 'number', - name = 'spread', - description = 'The amount of spread (radians).', - }, - }, - }, - }, - }, - { - name = 'setTangentialAcceleration', - description = 'Sets the tangential acceleration (acceleration perpendicular to the particle\'s direction).', - variants = { - { - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum acceleration.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum acceleration.', - default = 'min', - }, - }, - }, - }, - }, - { - 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', - description = 'Updates the particle system; moving, creating and killing particles.', - variants = { - { - arguments = { - { - type = 'number', - name = 'dt', - description = 'The time (seconds) since last frame.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Quad.lua b/modules/graphics/types/Quad.lua deleted file mode 100644 index 95ee5ce..0000000 --- a/modules/graphics/types/Quad.lua +++ /dev/null @@ -1,104 +0,0 @@ -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 = { - { - name = 'getTextureDimensions', - description = 'Gets reference texture dimensions initially specified in love.graphics.newQuad.', - variants = { - { - returns = { - { - type = 'number', - name = 'sw', - description = 'The Texture width used by the Quad.', - }, - { - type = 'number', - name = 'sh', - description = 'The Texture height used by the Quad.', - }, - }, - }, - }, - }, - { - name = 'getViewport', - description = 'Gets the current viewport of this Quad.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The top-left corner along the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The top-left corner along the y-axis.', - }, - { - type = 'number', - name = 'w', - description = 'The width of the viewport.', - }, - { - type = 'number', - name = 'h', - description = 'The height of the viewport.', - }, - }, - }, - }, - }, - { - name = 'setViewport', - description = 'Sets the texture coordinates according to a viewport.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The top-left corner along the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The top-left corner along the y-axis.', - }, - { - type = 'number', - name = 'w', - description = 'The width of the viewport.', - }, - { - type = 'number', - name = 'h', - 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.)', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Shader.lua b/modules/graphics/types/Shader.lua deleted file mode 100644 index d80780e..0000000 --- a/modules/graphics/types/Shader.lua +++ /dev/null @@ -1,257 +0,0 @@ -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/moonshine', - constructors = { - 'getShader', - 'newShader', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'getWarnings', - description = 'Returns any warning and error messages from compiling the shader code. This can be used for debugging your shaders if there\'s anything the graphics hardware doesn\'t like.', - variants = { - { - returns = { - { - type = 'string', - name = 'warnings', - description = 'Warning and error messages (if any).', - }, - }, - }, - }, - }, - { - name = 'hasUniform', - description = 'Gets whether a uniform / extern variable exists in the Shader.\n\nIf a graphics driver\'s shader compiler determines that a uniform / extern variable doesn\'t affect the final output of the shader, it may optimize the variable out. This function will return false in that case.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - 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.', - }, - }, - }, - }, - }, - { - 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, 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.', - }, - { - type = 'number', - name = 'number', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'name', - 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.', - }, - { - 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).', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'name', - 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}, ... } 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.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'name', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'name', - description = 'Name of the boolean to send to the shader.', - }, - { - type = 'boolean', - name = 'boolean', - 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.', - }, - }, - }, - { - 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 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.', - }, - { - type = 'table', - name = 'color', - 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).', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/SpriteBatch.lua b/modules/graphics/types/SpriteBatch.lua deleted file mode 100644 index b0a61a1..0000000 --- a/modules/graphics/types/SpriteBatch.lua +++ /dev/null @@ -1,867 +0,0 @@ -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 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.', - constructors = { - 'newSpriteBatch', - }, - supertypes = { - 'Drawable', - 'Object', - }, - functions = { - { - name = 'add', - 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).', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the object (y-axis).', - }, - { - 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 = 'Shear factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shear factor (y-axis).', - default = '0', - }, - }, - returns = { - { - type = 'number', - name = 'id', - description = 'An identifier for the added sprite.', - }, - }, - }, - { - description = 'Adds a Quad to the batch.', - arguments = { - { - type = 'Quad', - name = 'quad', - description = 'The Quad to add.', - }, - { - type = 'number', - name = 'x', - description = 'The position to draw the object (x-axis).', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the object (y-axis).', - }, - { - 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 = 'Shear factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shear factor (y-axis).', - default = '0', - }, - }, - returns = { - { - type = 'number', - name = 'id', - 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 ).', - 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.', - }, - { - type = 'Mesh', - name = 'mesh', - 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.\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', - description = 'Gets the maximum number of sprites the SpriteBatch can hold.', - variants = { - { - returns = { - { - type = 'number', - name = 'size', - 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.\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).', - }, - { - type = 'number', - name = 'g', - description = 'The green component (0-1).', - }, - { - type = 'number', - name = 'b', - description = 'The blue component (0-1).', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component (0-1).', - }, - }, - }, - }, - }, - { - name = 'getCount', - description = 'Gets the number of sprites currently in the SpriteBatch.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The number of sprites currently in the batch.', - }, - }, - }, - }, - }, - { - name = 'getTexture', - description = 'Gets the texture (Image or Canvas) used by the SpriteBatch.', - variants = { - { - returns = { - { - type = 'Texture', - name = 'texture', - description = 'The Image or Canvas used by the SpriteBatch.', - }, - }, - }, - }, - }, - { - name = 'set', - description = 'Changes a sprite in the batch. This requires the sprite index returned by SpriteBatch:add or SpriteBatch:addLayer.', - variants = { - { - arguments = { - { - type = 'number', - 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).', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the object (y-axis).', - }, - { - 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 = 'Shear factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shear factor (y-axis).', - default = '0', - }, - }, - }, - { - 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 = '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.', - }, - { - type = 'number', - name = 'x', - description = 'The position to draw the object (x-axis).', - }, - { - type = 'number', - name = 'y', - description = 'The position to draw the object (y-axis).', - }, - { - 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 = 'Shear factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shear factor (y-axis).', - default = '0', - }, - }, - }, - }, - }, - { - name = 'setColor', - 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.', - }, - { - type = 'number', - name = 'g', - description = 'The amount of green.', - }, - { - type = 'number', - name = 'b', - description = 'The amount of blue.', - }, - { - type = 'number', - name = 'a', - description = 'The amount of alpha.', - default = '1', - }, - }, - }, - { - description = 'Disables all per-sprite colors for this SpriteBatch.', - }, - }, - }, - { - name = 'setDrawRange', - description = 'Restricts the drawn sprites in the SpriteBatch to a subset of the total.', - variants = { - { - arguments = { - { - type = 'number', - name = 'start', - 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 = '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 = '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 = '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 in the batch.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Text.lua b/modules/graphics/types/Text.lua deleted file mode 100644 index a6d3c59..0000000 --- a/modules/graphics/types/Text.lua +++ /dev/null @@ -1,647 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Text', - description = 'Drawable text.', - constructors = { - 'newText', - }, - supertypes = { - 'Drawable', - 'Object', - }, - functions = { - { - name = 'add', - description = 'Adds additional colored text to the Text object at the specified position.', - variants = { - { - arguments = { - { - type = 'string', - name = 'textstring', - 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', - }, - { - type = 'number', - name = 'y', - description = 'The position of the new text on the y-axis.', - default = '0', - }, - { - type = 'number', - name = 'angle', - description = 'The orientation of the new 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', - }, - }, - returns = { - { - type = 'number', - name = 'index', - 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 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 new text on the x-axis.', - default = '0', - }, - { - type = 'number', - name = 'y', - description = 'The position of the new text on the y-axis.', - default = '0', - }, - { - type = 'number', - name = 'angle', - description = 'The orientation of the new 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', - }, - }, - returns = { - { - type = 'number', - name = 'index', - 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.\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.', - }, - { - type = 'number', - name = 'wraplimit', - 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 = 'x', - description = 'The position of the new text (x-axis).', - }, - { - type = 'number', - name = 'y', - description = 'The position of the new text (y-axis).', - }, - { - type = 'number', - name = 'angle', - 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 / skew factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shearing / skew factor (y-axis).', - default = '0', - }, - }, - returns = { - { - type = 'number', - name = 'index', - 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 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 = 'wraplimit', - 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 = 'x', - description = 'The position of the new text (x-axis).', - }, - { - type = 'number', - name = 'y', - description = 'The position of the new text (y-axis).', - }, - { - type = 'number', - name = 'angle', - 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 / skew factor (x-axis).', - default = '0', - }, - { - type = 'number', - name = 'ky', - description = 'Shearing / skew factor (y-axis).', - default = '0', - }, - }, - returns = { - { - type = 'number', - name = 'index', - 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', - description = 'Gets the width and height of the text in pixels.', - variants = { - { - returns = { - { - 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.', - }, - { - 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 = 'Gets the width and height of a specific sub-string that was previously added to the Text object.', - arguments = { - { - type = 'number', - name = 'index', - 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).', - }, - { - type = 'number', - name = 'height', - description = 'The height of the sub-string (before scaling and other transformations).', - }, - }, - }, - }, - }, - { - name = 'getFont', - description = 'Gets the Font used with the Text object.', - variants = { - { - returns = { - { - type = 'Font', - name = 'font', - description = 'The font used with this Text object.', - }, - }, - }, - }, - }, - { - name = 'getHeight', - description = 'Gets the height of the text in pixels.', - variants = { - { - 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.', - }, - }, - }, - { - description = 'Gets the height of a specific sub-string that was previously added to the Text object.', - arguments = { - { - type = 'number', - name = 'index', - 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).', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Gets the width of the text in pixels.', - variants = { - { - returns = { - { - 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 = 'Gets the width of a specific sub-string that was previously added to the Text object.', - arguments = { - { - type = 'number', - name = 'index', - 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).', - }, - }, - }, - }, - }, - { - name = 'set', - description = 'Replaces the contents of the Text object with a new unformatted string.', - variants = { - { - arguments = { - { - type = 'string', - name = 'textstring', - 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, ...}.', - 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.', - }, - }, - }, - }, - }, - }, - }, - { - 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', - description = 'Replaces the contents of the Text object with a new formatted string.', - variants = { - { - arguments = { - { - type = 'string', - name = 'textstring', - 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.', - }, - { - type = 'AlignMode', - name = 'align', - 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, ...}.', - 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 = 'wraplimit', - 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.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Texture.lua b/modules/graphics/types/Texture.lua deleted file mode 100644 index 481be91..0000000 --- a/modules/graphics/types/Texture.lua +++ /dev/null @@ -1,396 +0,0 @@ -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.', - 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.', - variants = { - { - returns = { - { - type = 'number', - name = 'depth', - description = 'The depth of the volume Texture.', - }, - }, - }, - }, - }, - { - name = 'getDepthSampleMode', - description = 'Gets the comparison mode used when sampling from a depth texture in a shader.\n\nDepth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.', - variants = { - { - returns = { - { - type = 'CompareMode', - name = 'compare', - description = 'The comparison mode used when sampling from this texture in a shader, or nil if setDepthSampleMode has not been called on this Texture.', - default = 'nil', - }, - }, - }, - }, - }, - { - name = 'getDimensions', - description = 'Gets the width and height of the Texture.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the Texture.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the Texture.', - }, - }, - }, - }, - }, - { - name = 'getFilter', - description = 'Gets the filter mode of the Texture.', - variants = { - { - returns = { - { - type = 'FilterMode', - name = 'min', - description = 'Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'Filter mode to use when magnifying the texture (rendering it at a smaller size on-screen than its size in pixels).', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.', - }, - }, - }, - }, - }, - { - name = 'getFormat', - description = 'Gets the pixel format of the Texture.', - variants = { - { - returns = { - { - type = 'PixelFormat', - name = 'format', - description = 'The pixel format the Texture was created with.', - }, - }, - }, - }, - }, - { - name = 'getHeight', - description = 'Gets the height of the Texture.', - variants = { - { - returns = { - { - type = 'number', - name = 'height', - description = 'The height of the Texture.', - }, - }, - }, - }, - }, - { - name = 'getLayerCount', - description = 'Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures.', - variants = { - { - returns = { - { - type = 'number', - name = 'layers', - description = 'The number of layers in the Array Texture.', - }, - }, - }, - }, - }, - { - name = 'getMipmapCount', - description = 'Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1.', - variants = { - { - returns = { - { - type = 'number', - name = 'mipmaps', - 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 = 'getPixelDimensions', - description = 'Gets the width and height in pixels of the Texture.\n\nTexture:getDimensions gets the dimensions of the texture in units scaled by the texture\'s DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions 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.', - }, - { - type = 'number', - name = 'pixelheight', - description = 'The height of the Texture, in pixels.', - }, - }, - }, - }, - }, - { - 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', - description = 'Gets the type of the Texture.', - variants = { - { - returns = { - { - type = 'TextureType', - name = 'texturetype', - description = 'The type of the Texture.', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Gets the width of the Texture.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the Texture.', - }, - }, - }, - }, - }, - { - name = 'getWrap', - description = 'Gets the wrapping properties of a Texture.\n\nThis function returns the currently set horizontal and vertical wrapping modes for the texture.', - variants = { - { - returns = { - { - type = 'WrapMode', - name = 'horiz', - description = 'Horizontal wrapping mode of the texture.', - }, - { - type = 'WrapMode', - name = 'vert', - description = 'Vertical wrapping mode of the texture.', - }, - { - type = 'WrapMode', - name = 'depth', - description = 'Wrapping mode for the z-axis of a Volume texture.', - }, - }, - }, - }, - }, - { - name = 'isReadable', - description = 'Gets whether the Texture can be drawn and sent to a Shader.\n\nCanvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas.\n\nNon-readable Canvases can still be rendered to.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'readable', - description = 'Whether the Texture is readable.', - }, - }, - }, - }, - }, - { - name = 'setDepthSampleMode', - description = 'Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D.\n\nWhen using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation.\n\nDepth texture comparison can only be used with readable depth-formatted Canvases.', - variants = { - { - arguments = { - { - type = 'CompareMode', - name = 'compare', - description = 'The comparison mode used when sampling from this texture in a shader.', - }, - }, - }, - }, - }, - { - name = 'setFilter', - description = 'Sets the filter mode of the Texture.', - variants = { - { - arguments = { - { - type = 'FilterMode', - name = 'min', - description = 'Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'Filter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels).', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering to use.', - default = '1', - }, - }, - }, - }, - }, - { - 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.', - }, - }, - }, - { - name = 'setWrap', - description = 'Sets the wrapping properties of a Texture.\n\nThis function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture\'s extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions.\n\nClamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad.', - variants = { - { - arguments = { - { - type = 'WrapMode', - name = 'horiz', - description = 'Horizontal wrapping mode of the texture.', - }, - { - type = 'WrapMode', - name = 'vert', - description = 'Vertical wrapping mode of the texture.', - default = 'horiz', - }, - { - type = 'WrapMode', - name = 'depth', - description = 'Wrapping mode for the z-axis of a Volume texture.', - default = 'horiz', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/graphics/types/Video.lua b/modules/graphics/types/Video.lua deleted file mode 100644 index f52a04a..0000000 --- a/modules/graphics/types/Video.lua +++ /dev/null @@ -1,231 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Video', - description = 'A drawable video.', - constructors = { - 'newVideo', - }, - supertypes = { - 'Drawable', - 'Object', - }, - functions = { - { - name = 'getDimensions', - description = 'Gets the width and height of the Video in pixels.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the Video.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the Video.', - }, - }, - }, - }, - }, - { - name = 'getFilter', - description = 'Gets the scaling filters used when drawing the Video.', - variants = { - { - returns = { - { - type = 'FilterMode', - name = 'min', - description = 'The filter mode used when scaling the Video down.', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'The filter mode used when scaling the Video up.', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.', - }, - }, - }, - }, - }, - { - name = 'getHeight', - description = 'Gets the height of the Video in pixels.', - variants = { - { - returns = { - { - type = 'number', - name = 'height', - description = 'The height of the Video.', - }, - }, - }, - }, - }, - { - name = 'getSource', - description = 'Gets the audio Source used for playing back the video\'s audio. May return nil if the video has no audio, or if Video:setSource is called with a nil argument.', - variants = { - { - returns = { - { - type = 'Source', - name = 'source', - description = 'The audio Source used for audio playback, or nil if the video has no audio.', - }, - }, - }, - }, - }, - { - name = 'getStream', - description = 'Gets the VideoStream object used for decoding and controlling the video.', - variants = { - { - returns = { - { - type = 'VideoStream', - name = 'stream', - description = 'The VideoStream used for decoding and controlling the video.', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Gets the width of the Video in pixels.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the Video.', - }, - }, - }, - }, - }, - { - name = 'isPlaying', - description = 'Gets whether the Video is currently playing.', - variants = { - { - returns = { - { - type = 'boolean', - name = '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', - description = 'Sets the current playback position of the Video.', - variants = { - { - arguments = { - { - type = 'number', - name = 'offset', - description = 'The time in seconds since the beginning of the Video.', - }, - }, - }, - }, - }, - { - name = 'setFilter', - description = 'Sets the scaling filters used when drawing the Video.', - variants = { - { - arguments = { - { - type = 'FilterMode', - name = 'min', - description = 'The filter mode used when scaling the Video down.', - }, - { - type = 'FilterMode', - name = 'mag', - description = 'The filter mode used when scaling the Video up.', - }, - { - type = 'number', - name = 'anisotropy', - description = 'Maximum amount of anisotropic filtering used.', - default = '1', - }, - }, - }, - }, - }, - { - name = 'setSource', - description = 'Sets the audio Source used for playing back the video\'s audio. The audio Source also controls playback speed and synchronization.', - variants = { - { - arguments = { - { - type = 'Source', - name = 'source', - description = 'The audio Source used for audio playback, or nil to disable audio synchronization.', - default = 'nil', - }, - }, - }, - }, - }, - { - name = 'tell', - description = 'Gets the current playback position of the Video.', - variants = { - { - returns = { - { - type = 'number', - name = 'seconds', - description = 'The time in seconds since the beginning of the Video.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/image/Image.lua b/modules/image/Image.lua deleted file mode 100644 index db5b591..0000000 --- a/modules/image/Image.lua +++ /dev/null @@ -1,211 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'image', - description = 'Provides an interface to decode encoded image data.', - types = { - require(path .. 'types.CompressedImageData'), - require(path .. 'types.ImageData'), - }, - functions = { - { - name = 'isCompressed', - description = 'Determines whether a file can be loaded as CompressedImageData.', - variants = { - { - arguments = { - { - type = 'string', - name = 'filename', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'FileData', - name = 'fileData', - description = 'A FileData potentially containing a compressed image.', - }, - }, - returns = { - { - type = 'boolean', - name = 'compressed', - description = 'Whether the FileData can be loaded as CompressedImageData or not.', - }, - }, - }, - }, - }, - { - name = 'newCompressedData', - description = 'Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page.', - variants = { - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filename of the compressed image file.', - }, - }, - returns = { - { - type = 'CompressedImageData', - name = 'compressedImageData', - description = 'The new CompressedImageData object.', - }, - }, - }, - { - arguments = { - { - type = 'FileData', - name = 'fileData', - description = 'A FileData containing a compressed image.', - }, - }, - returns = { - { - type = 'CompressedImageData', - name = 'compressedImageData', - description = 'The new CompressedImageData object.', - }, - }, - }, - }, - }, - { - name = 'newImageData', - description = 'Creates a new ImageData object.', - variants = { - { - arguments = { - { - type = 'number', - name = 'width', - description = 'The width of the ImageData.', - }, - { - type = 'number', - name = 'height', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'width', - description = 'The width of the ImageData.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the ImageData.', - }, - { - type = 'PixelFormat', - name = 'format', - description = 'The pixel format of the ImageData.', - default = '\'rgba8\'', - }, - { - type = 'string', - name = 'data', - 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.', - }, - }, - }, - { - 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.', - }, - }, - returns = { - { - type = 'ImageData', - name = 'imageData', - description = 'The new ImageData object.', - }, - }, - }, - { - arguments = { - { - type = 'FileData', - name = 'filedata', - description = 'The encoded file data to decode into image data.', - }, - }, - returns = { - { - type = 'ImageData', - name = 'imageData', - description = 'The new ImageData object.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.CompressedImageFormat'), - require(path .. 'enums.ImageFormat'), - require(path .. 'enums.PixelFormat'), - }, -} \ No newline at end of file diff --git a/modules/image/enums/CompressedImageFormat.lua b/modules/image/enums/CompressedImageFormat.lua deleted file mode 100644 index f3d11fb..0000000 --- a/modules/image/enums/CompressedImageFormat.lua +++ /dev/null @@ -1,150 +0,0 @@ -return { - name = 'CompressedImageFormat', - description = 'Compressed image data formats. Here and here are a couple overviews of many of the formats.\n\nUnlike traditional PNG or jpeg, these formats stay compressed in RAM and in the graphics card\'s VRAM. This is good for saving memory space as well as improving performance, since the graphics card will be able to keep more of the image\'s pixels in its fast-access cache when drawing it.', - 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 on desktop systems.', - }, - { - name = 'DXT3', - description = 'The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.', - }, - { - name = 'DXT5', - description = 'The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on desktop systems.', - }, - { - name = 'BC4', - description = 'The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.', - }, - { - name = 'BC4s', - 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', - description = 'The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.', - }, - { - name = 'BC5s', - description = 'The signed variant of the BC5 format.', - }, - { - name = 'BC6h', - 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.', - }, - { - name = 'BC7', - description = 'The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.', - }, - { - name = 'ETC1', - 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.', - }, - { - 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.', - }, - { - 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.', - }, - { - name = 'EACr', - 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 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.', - }, - { - name = 'EACrgs', - 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.', - }, - { - name = 'PVR1rgb4', - 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.', - }, - { - name = 'PVR1rgba4', - 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.', - }, - { - name = 'ASTC5x4', - 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.', - }, - { - name = 'ASTC6x5', - 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.', - }, - { - name = 'ASTC8x5', - 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.', - }, - { - name = 'ASTC8x8', - 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.', - }, - { - name = 'ASTC10x6', - 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.', - }, - { - name = 'ASTC10x10', - 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.', - }, - { - name = 'ASTC12x12', - 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 deleted file mode 100644 index 85661ab..0000000 --- a/modules/image/enums/ImageFormat.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - name = 'ImageFormat', - description = 'Encoded image formats.', - constants = { - { - name = 'tga', - description = 'Targa image format.', - }, - { - name = 'png', - 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 deleted file mode 100644 index 02a9009..0000000 --- a/modules/image/types/CompressedImageData.lua +++ /dev/null @@ -1,149 +0,0 @@ -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', - }, - supertypes = { - 'Data', - 'Object', - }, - functions = { - { - name = 'getDimensions', - description = 'Gets the width and height of the CompressedImageData.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the CompressedImageData.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the CompressedImageData.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'level', - description = 'A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().', - }, - }, - returns = { - { - type = 'number', - name = 'width', - description = 'The width of a specific mipmap level of the CompressedImageData.', - }, - { - type = 'number', - name = 'height', - description = 'The height of a specific mipmap level of the CompressedImageData.', - }, - }, - }, - }, - }, - { - name = 'getFormat', - description = 'Gets the format of the CompressedImageData.', - variants = { - { - returns = { - { - type = 'CompressedImageFormat', - name = 'format', - description = 'The format of the CompressedImageData.', - }, - }, - }, - }, - }, - { - name = 'getHeight', - description = 'Gets the height of the CompressedImageData.', - variants = { - { - returns = { - { - type = 'number', - name = 'height', - description = 'The height of the CompressedImageData.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'level', - description = 'A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().', - }, - }, - returns = { - { - type = 'number', - name = 'height', - 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.', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Gets the width of the CompressedImageData.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the CompressedImageData.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'level', - description = 'A mipmap level. Must be in the range of CompressedImageData:getMipmapCount().', - }, - }, - returns = { - { - type = 'number', - name = 'width', - description = 'The width of a specific mipmap level of the CompressedImageData.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/image/types/ImageData.lua b/modules/image/types/ImageData.lua deleted file mode 100644 index ac46cd6..0000000 --- a/modules/image/types/ImageData.lua +++ /dev/null @@ -1,283 +0,0 @@ -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 = { - { - name = 'encode', - description = 'Encodes the ImageData and optionally writes it to the save directory.', - variants = { - { - arguments = { - { - type = 'ImageFormat', - name = 'format', - 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', - }, - }, - returns = { - { - type = 'FileData', - name = 'filedata', - 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', - description = 'Gets the width and height of the ImageData in pixels.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'The width of the ImageData in pixels.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the ImageData in pixels.', - }, - }, - }, - }, - }, - { - name = 'getHeight', - description = 'Gets the height of the ImageData in pixels.', - variants = { - { - returns = { - { - type = 'number', - name = 'height', - 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.\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.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the pixel on the y-axis.', - }, - }, - returns = { - { - type = 'number', - name = 'r', - description = 'The red component (0-1).', - }, - { - type = 'number', - name = 'g', - description = 'The green component (0-1).', - }, - { - type = 'number', - name = 'b', - description = 'The blue component (0-1).', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component (0-1).', - }, - }, - }, - }, - }, - { - name = 'getWidth', - description = 'Gets the width of the ImageData in pixels.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - 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 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 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.', - }, - { - type = 'number', - name = 'dx', - description = 'Destination top-left position on x-axis.', - }, - { - type = 'number', - name = 'dy', - description = 'Destination top-left position on y-axis.', - }, - { - type = 'number', - name = 'sx', - description = 'Source top-left position on x-axis.', - }, - { - type = 'number', - name = 'sy', - description = 'Source top-left position on y-axis.', - }, - { - type = 'number', - name = 'sw', - description = 'Source width.', - }, - { - type = 'number', - name = 'sh', - 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.\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.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the pixel on the y-axis.', - }, - { - type = 'number', - name = 'r', - description = 'The red component (0-1).', - }, - { - type = 'number', - name = 'g', - description = 'The green component (0-1).', - }, - { - type = 'number', - name = 'b', - description = 'The blue component (0-1).', - }, - { - type = 'number', - name = 'a', - description = 'The alpha component (0-1).', - }, - }, - }, - }, - }, - }, -} diff --git a/modules/joystick/Joystick.lua b/modules/joystick/Joystick.lua deleted file mode 100644 index 75b85c8..0000000 --- a/modules/joystick/Joystick.lua +++ /dev/null @@ -1,209 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'joystick', - description = 'Provides an interface to the user\'s joystick.', - types = { - require(path .. 'types.Joystick'), - }, - functions = { - { - name = 'getGamepadMappingString', - description = 'Gets the full gamepad mapping string of the Joysticks which have the given GUID, or nil if the GUID isn\'t recognized as a gamepad.\n\nThe mapping string contains binding information used to map the Joystick\'s buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings.', - variants = { - { - arguments = { - { - type = 'string', - name = 'guid', - description = 'The GUID value to get the mapping string for.', - }, - }, - returns = { - { - type = 'string', - name = 'mappingstring', - description = 'A string containing the Joystick\'s gamepad mappings, or nil if the GUID is not recognized as a gamepad.', - }, - }, - }, - }, - }, - { - name = 'getJoystickCount', - description = 'Gets the number of connected joysticks.', - variants = { - { - returns = { - { - type = 'number', - name = 'joystickcount', - description = 'The number of connected joysticks.', - }, - }, - }, - }, - }, - { - name = 'getJoysticks', - description = 'Gets a list of connected Joysticks.', - variants = { - { - returns = { - { - type = 'table', - name = 'joysticks', - description = 'The list of currently connected Joysticks.', - }, - }, - }, - }, - }, - { - name = 'loadGamepadMappings', - 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 = 'Loads a gamepad mappings string directly.', - arguments = { - { - type = 'string', - name = 'mappings', - description = 'The mappings string to load.', - }, - }, - }, - }, - }, - { - name = 'saveGamepadMappings', - 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.', - }, - }, - returns = { - { - type = 'string', - name = 'mappings', - 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.', - }, - }, - }, - }, - }, - { - 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.', - variants = { - { - arguments = { - { - type = 'string', - name = 'guid', - 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.', - }, - { - type = 'JoystickInputType', - name = 'inputtype', - 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.', - }, - { - type = 'JoystickHat', - 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 = '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.', - }, - { - type = 'GamepadAxis', - name = 'axis', - description = 'The virtual gamepad axis to bind.', - }, - { - type = 'JoystickInputType', - name = 'inputtype', - 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.', - }, - { - type = 'JoystickHat', - 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 axis was successfully bound.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.GamepadAxis'), - require(path .. 'enums.GamepadButton'), - require(path .. 'enums.JoystickHat'), - require(path .. 'enums.JoystickInputType'), - }, -} \ No newline at end of file diff --git a/modules/joystick/enums/GamepadAxis.lua b/modules/joystick/enums/GamepadAxis.lua deleted file mode 100644 index 9591ba1..0000000 --- a/modules/joystick/enums/GamepadAxis.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - name = 'GamepadAxis', - description = 'Virtual gamepad axes.', - constants = { - { - name = 'leftx', - description = 'The x-axis of the left thumbstick.', - }, - { - name = 'lefty', - description = 'The y-axis of the left thumbstick.', - }, - { - name = 'rightx', - description = 'The x-axis of the right thumbstick.', - }, - { - name = 'righty', - description = 'The y-axis of the right thumbstick.', - }, - { - name = 'triggerleft', - description = 'Left analog trigger.', - }, - { - name = 'triggerright', - description = 'Right analog trigger.', - }, - }, -} \ No newline at end of file diff --git a/modules/joystick/enums/GamepadButton.lua b/modules/joystick/enums/GamepadButton.lua deleted file mode 100644 index 9c1c280..0000000 --- a/modules/joystick/enums/GamepadButton.lua +++ /dev/null @@ -1,66 +0,0 @@ -return { - name = 'GamepadButton', - description = 'Virtual gamepad buttons.', - constants = { - { - name = 'a', - description = 'Bottom face button (A).', - }, - { - name = 'b', - description = 'Right face button (B).', - }, - { - name = 'x', - description = 'Left face button (X).', - }, - { - name = 'y', - description = 'Top face button (Y).', - }, - { - name = 'back', - description = 'Back button.', - }, - { - name = 'guide', - description = 'Guide button.', - }, - { - name = 'start', - description = 'Start button.', - }, - { - name = 'leftstick', - description = 'Left stick click button.', - }, - { - name = 'rightstick', - description = 'Right stick click button.', - }, - { - name = 'leftshoulder', - description = 'Left bumper.', - }, - { - name = 'rightshoulder', - description = 'Right bumper.', - }, - { - name = 'dpup', - description = 'D-pad up.', - }, - { - name = 'dpdown', - description = 'D-pad down.', - }, - { - name = 'dpleft', - description = 'D-pad left.', - }, - { - name = 'dpright', - description = 'D-pad right.', - }, - }, -} \ No newline at end of file diff --git a/modules/joystick/enums/JoystickHat.lua b/modules/joystick/enums/JoystickHat.lua deleted file mode 100644 index e1f3dfa..0000000 --- a/modules/joystick/enums/JoystickHat.lua +++ /dev/null @@ -1,42 +0,0 @@ -return { - name = 'JoystickHat', - description = 'Joystick hat positions.', - constants = { - { - name = 'c', - description = 'Centered', - }, - { - name = 'd', - description = 'Down', - }, - { - name = 'l', - description = 'Left', - }, - { - name = 'ld', - description = 'Left+Down', - }, - { - name = 'lu', - description = 'Left+Up', - }, - { - name = 'r', - description = 'Right', - }, - { - name = 'rd', - description = 'Right+Down', - }, - { - name = 'ru', - description = 'Right+Up', - }, - { - name = 'u', - description = 'Up', - }, - }, -} \ No newline at end of file diff --git a/modules/joystick/enums/JoystickInputType.lua b/modules/joystick/enums/JoystickInputType.lua deleted file mode 100644 index 6253088..0000000 --- a/modules/joystick/enums/JoystickInputType.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'JoystickInputType', - description = 'Types of Joystick inputs.', - constants = { - { - name = 'axis', - description = 'Analog axis.', - }, - { - name = 'button', - description = 'Button.', - }, - { - name = 'hat', - 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 deleted file mode 100644 index 1066e7d..0000000 --- a/modules/joystick/types/Joystick.lua +++ /dev/null @@ -1,474 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Joystick', - description = 'Represents a physical joystick.', - supertypes = { - 'Object', - }, - functions = { - { - name = 'getAxes', - description = 'Gets the direction of each axis.', - variants = { - { - returns = { - { - type = 'number', - name = 'axisDir1', - description = 'Direction of axis1.', - }, - { - type = 'number', - name = 'axisDir2', - description = 'Direction of axis2.', - }, - { - type = 'number', - name = 'axisDirN', - description = 'Direction of axisN.', - }, - }, - }, - }, - }, - { - name = 'getAxis', - description = 'Gets the direction of an axis.', - variants = { - { - arguments = { - { - type = 'number', - name = 'axis', - description = 'The index of the axis to be checked.', - }, - }, - returns = { - { - type = 'number', - name = 'direction', - description = 'Current value of the axis.', - }, - }, - }, - }, - }, - { - name = 'getAxisCount', - description = 'Gets the number of axes on the joystick.', - variants = { - { - returns = { - { - type = 'number', - name = 'axes', - description = 'The number of axes available.', - }, - }, - }, - }, - }, - { - name = 'getButtonCount', - description = 'Gets the number of buttons on the joystick.', - variants = { - { - returns = { - { - type = 'number', - name = 'buttons', - description = 'The number of buttons available.', - }, - }, - }, - }, - }, - { - name = 'getDeviceInfo', - description = 'Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems.\n\nCan be used to show different icons, etc. for different gamepads.', - variants = { - { - description = 'Some Linux distribution may not ship with SDL 2.0.6 or later, in which case this function will returns 0 for all the three values.', - returns = { - { - type = 'number', - name = 'vendorID', - description = 'The USB vendor ID of the joystick.', - }, - { - type = 'number', - name = 'productID', - description = 'The USB product ID of the joystick.', - }, - { - type = 'number', - name = 'productVersion', - description = 'The product version of the joystick.', - }, - }, - }, - }, - }, - { - name = 'getGUID', - description = 'Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent.', - variants = { - { - returns = { - { - type = 'string', - name = 'guid', - description = 'The Joystick type\'s OS-dependent unique identifier.', - }, - }, - }, - }, - }, - { - name = 'getGamepadAxis', - description = 'Gets the direction of a virtual gamepad axis. If the Joystick isn\'t recognized as a gamepad or isn\'t connected, this function will always return 0.', - variants = { - { - arguments = { - { - type = 'GamepadAxis', - name = 'axis', - description = 'The virtual axis to be checked.', - }, - }, - returns = { - { - type = 'number', - name = 'direction', - 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.', - }, - }, - returns = { - { - type = 'JoystickInputType', - name = 'inputtype', - 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.', - }, - { - type = 'JoystickHat', - name = 'hatdirection', - 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 = 'GamepadButton', - name = 'button', - 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.', - }, - { - type = 'number', - name = 'inputindex', - 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.', - }, - }, - }, - }, - }, - { - name = 'getGamepadMappingString', - description = 'Gets the full gamepad mapping string of this Joystick, or nil if it\'s not recognized as a gamepad.\n\nThe mapping string contains binding information used to map the Joystick\'s buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings.', - variants = { - { - returns = { - { - type = 'string', - name = 'mappingstring', - description = 'A string containing the Joystick\'s gamepad mappings, or nil if the Joystick is not recognized as a gamepad.', - }, - }, - }, - }, - }, - { - name = 'getHat', - description = 'Gets the direction of the Joystick\'s hat.', - variants = { - { - arguments = { - { - type = 'number', - name = 'hat', - description = 'The index of the hat to be checked.', - }, - }, - returns = { - { - type = 'JoystickHat', - name = 'direction', - description = 'The direction the hat is pushed.', - }, - }, - }, - }, - }, - { - name = 'getHatCount', - description = 'Gets the number of hats on the joystick.', - variants = { - { - returns = { - { - type = 'number', - name = 'hats', - 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.', - variants = { - { - returns = { - { - type = 'number', - name = 'id', - 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.', - }, - }, - }, - }, - }, - { - name = 'getName', - description = 'Gets the name of the joystick.', - variants = { - { - returns = { - { - type = 'string', - name = 'name', - description = 'The name of the joystick.', - }, - }, - }, - }, - }, - { - name = 'getVibration', - description = 'Gets the current vibration motor strengths on a Joystick with rumble support.', - variants = { - { - returns = { - { - type = 'number', - name = 'left', - 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.', - }, - }, - }, - }, - }, - { - name = 'isConnected', - description = 'Gets whether the Joystick is connected.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'connected', - description = 'True if the Joystick is currently connected, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isDown', - description = 'Checks if a button on the Joystick is pressed.\n\nLÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1.', - variants = { - { - arguments = { - { - type = 'number', - 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.', - }, - }, - }, - }, - }, - { - 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, 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.', - }, - }, - }, - }, - }, - { - name = 'isGamepadDown', - description = 'Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn\'t connected, then this function will always return false.', - variants = { - { - arguments = { - { - type = 'GamepadButton', - name = 'buttonN', - description = 'The gamepad button to check.', - }, - }, - returns = { - { - type = 'boolean', - name = 'anyDown', - 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.', - }, - }, - }, - }, - }, - { - name = 'setVibration', - 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 1.', - }, - { - type = 'number', - name = 'right', - 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 = 'Disables vibration.', - returns = { - { - type = 'boolean', - name = 'success', - 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 1.', - }, - { - type = 'number', - name = 'right', - 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.', - default = '-1', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if the vibration was successfully applied, false if not.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/keyboard/Keyboard.lua b/modules/keyboard/Keyboard.lua deleted file mode 100644 index 5e9ef64..0000000 --- a/modules/keyboard/Keyboard.lua +++ /dev/null @@ -1,219 +0,0 @@ -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.', - variants = { - { - arguments = { - { - type = 'Scancode', - name = 'scancode', - 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.', - }, - }, - }, - }, - }, - { - 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.', - variants = { - { - arguments = { - { - type = 'KeyConstant', - name = 'key', - 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.', - }, - }, - }, - }, - }, - { - name = 'hasKeyRepeat', - description = 'Gets whether key repeat is enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'Whether key repeat is enabled.', - }, - }, - }, - }, - }, - { - name = 'hasTextInput', - description = 'Gets whether text input events are enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'Whether text input events are enabled.', - }, - }, - }, - }, - }, - { - name = 'isDown', - description = 'Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased.', - variants = { - { - arguments = { - { - type = 'KeyConstant', - name = 'key', - description = 'The key to check.', - }, - }, - returns = { - { - type = 'boolean', - name = 'down', - description = 'True if the key is down, false if not.', - }, - }, - }, - { - arguments = { - { - type = 'KeyConstant', - name = 'key', - description = 'A key to check.', - }, - { - type = 'KeyConstant', - name = '...', - description = 'Additional keys to check.', - }, - }, - returns = { - { - type = 'boolean', - name = 'anyDown', - 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.', - variants = { - { - arguments = { - { - type = 'Scancode', - name = 'scancode', - description = 'A Scancode to check.', - }, - { - type = 'Scancode', - name = '...', - description = 'Additional Scancodes to check.', - }, - }, - returns = { - { - type = 'boolean', - name = 'down', - description = 'True if any supplied Scancode is down, false if not.', - }, - }, - }, - }, - }, - { - name = 'setKeyRepeat', - 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.', - }, - }, - }, - }, - }, - { - 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.\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 = '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.', - }, - { - type = 'number', - name = 'x', - description = 'Text rectangle x position.', - }, - { - type = 'number', - name = 'y', - description = 'Text rectangle y position.', - }, - { - type = 'number', - name = 'w', - description = 'Text rectangle width.', - }, - { - type = 'number', - name = 'h', - description = 'Text rectangle height.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.KeyConstant'), - require(path .. 'enums.Scancode'), - }, -} \ No newline at end of file diff --git a/modules/keyboard/enums/KeyConstant.lua b/modules/keyboard/enums/KeyConstant.lua deleted file mode 100644 index de8a685..0000000 --- a/modules/keyboard/enums/KeyConstant.lua +++ /dev/null @@ -1,582 +0,0 @@ -return { - name = 'KeyConstant', - description = 'All the keys you can press. Note that some keys may not be available on your keyboard or system.', - 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', - }, - { - 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', - }, - { - 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', - }, - { - 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', - }, - { - 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 deleted file mode 100644 index 27fb965..0000000 --- a/modules/keyboard/enums/Scancode.lua +++ /dev/null @@ -1,782 +0,0 @@ -return { - name = 'Scancode', - description = 'Keyboard scancodes.\n\nScancodes are keyboard layout-independent, so the scancode "w" will be generated if the key in the same place as the "w" key on an American QWERTY keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nUsing scancodes, rather than keycodes, is useful because keyboards with layouts differing from the US/UK layout(s) might have keys that generate \'unknown\' keycodes, but the scancodes will still be detected. This however would necessitate having a list for each keyboard layout one would choose to support.\n\nOne could use textinput or textedited instead, but those only give back the end result of keys used, i.e. you can\'t get modifiers on their own from it, only the final symbols that were generated.', - constants = { - { - name = 'a', - description = 'The \'A\' key on an American layout.', - }, - { - name = 'b', - description = 'The \'B\' key on an American layout.', - }, - { - name = 'c', - description = 'The \'C\' key on an American layout.', - }, - { - name = 'd', - description = 'The \'D\' key on an American layout.', - }, - { - name = 'e', - description = 'The \'E\' key on an American layout.', - }, - { - name = 'f', - description = 'The \'F\' key on an American layout.', - }, - { - name = 'g', - description = 'The \'G\' key on an American layout.', - }, - { - name = 'h', - description = 'The \'H\' key on an American layout.', - }, - { - name = 'i', - description = 'The \'I\' key on an American layout.', - }, - { - name = 'j', - description = 'The \'J\' key on an American layout.', - }, - { - name = 'k', - description = 'The \'K\' key on an American layout.', - }, - { - name = 'l', - description = 'The \'L\' key on an American layout.', - }, - { - name = 'm', - description = 'The \'M\' key on an American layout.', - }, - { - name = 'n', - description = 'The \'N\' key on an American layout.', - }, - { - name = 'o', - description = 'The \'O\' key on an American layout.', - }, - { - name = 'p', - description = 'The \'P\' key on an American layout.', - }, - { - name = 'q', - description = 'The \'Q\' key on an American layout.', - }, - { - name = 'r', - description = 'The \'R\' key on an American layout.', - }, - { - name = 's', - description = 'The \'S\' key on an American layout.', - }, - { - name = 't', - description = 'The \'T\' key on an American layout.', - }, - { - name = 'u', - description = 'The \'U\' key on an American layout.', - }, - { - name = 'v', - description = 'The \'V\' key on an American layout.', - }, - { - name = 'w', - description = 'The \'W\' key on an American layout.', - }, - { - name = 'x', - description = 'The \'X\' key on an American layout.', - }, - { - name = 'y', - description = 'The \'Y\' key on an American layout.', - }, - { - name = 'z', - description = 'The \'Z\' key on an American layout.', - }, - { - name = '1', - description = 'The \'1\' key on an American layout.', - }, - { - name = '2', - description = 'The \'2\' key on an American layout.', - }, - { - name = '3', - description = 'The \'3\' key on an American layout.', - }, - { - name = '4', - description = 'The \'4\' key on an American layout.', - }, - { - name = '5', - description = 'The \'5\' key on an American layout.', - }, - { - name = '6', - description = 'The \'6\' key on an American layout.', - }, - { - name = '7', - description = 'The \'7\' key on an American layout.', - }, - { - name = '8', - description = 'The \'8\' key on an American layout.', - }, - { - name = '9', - description = 'The \'9\' key on an American layout.', - }, - { - name = '0', - description = 'The \'0\' key on an American layout.', - }, - { - name = 'return', - description = 'The \'return\' / \'enter\' key on an American layout.', - }, - { - name = 'escape', - description = 'The \'escape\' key on an American layout.', - }, - { - name = 'backspace', - description = 'The \'backspace\' key on an American layout.', - }, - { - name = 'tab', - description = 'The \'tab\' key on an American layout.', - }, - { - name = 'space', - description = 'The spacebar on an American layout.', - }, - { - name = '-', - description = 'The minus key on an American layout.', - }, - { - name = '=', - description = 'The equals key on an American layout.', - }, - { - name = '[', - description = 'The left-bracket key on an American layout.', - }, - { - name = ']', - description = 'The right-bracket key on an American layout.', - }, - { - name = '\\', - description = 'The backslash key on an American layout.', - }, - { - name = 'nonus#', - description = 'The non-U.S. hash scancode.', - }, - { - name = ';', - description = 'The semicolon key on an American layout.', - }, - { - name = '\'', - description = 'The apostrophe key on an American layout.', - }, - { - name = '`', - description = 'The back-tick / grave key on an American layout.', - }, - { - name = ',', - description = 'The comma key on an American layout.', - }, - { - name = '.', - description = 'The period key on an American layout.', - }, - { - name = '/', - description = 'The forward-slash key on an American layout.', - }, - { - name = 'capslock', - description = 'The capslock key on an American layout.', - }, - { - name = 'f1', - description = 'The F1 key on an American layout.', - }, - { - name = 'f2', - description = 'The F2 key on an American layout.', - }, - { - name = 'f3', - description = 'The F3 key on an American layout.', - }, - { - name = 'f4', - description = 'The F4 key on an American layout.', - }, - { - name = 'f5', - description = 'The F5 key on an American layout.', - }, - { - name = 'f6', - description = 'The F6 key on an American layout.', - }, - { - name = 'f7', - description = 'The F7 key on an American layout.', - }, - { - name = 'f8', - description = 'The F8 key on an American layout.', - }, - { - name = 'f9', - description = 'The F9 key on an American layout.', - }, - { - name = 'f10', - description = 'The F10 key on an American layout.', - }, - { - name = 'f11', - description = 'The F11 key on an American layout.', - }, - { - name = 'f12', - description = 'The F12 key on an American layout.', - }, - { - name = 'f13', - description = 'The F13 key on an American layout.', - }, - { - name = 'f14', - description = 'The F14 key on an American layout.', - }, - { - name = 'f15', - description = 'The F15 key on an American layout.', - }, - { - name = 'f16', - description = 'The F16 key on an American layout.', - }, - { - name = 'f17', - description = 'The F17 key on an American layout.', - }, - { - name = 'f18', - description = 'The F18 key on an American layout.', - }, - { - name = 'f19', - description = 'The F19 key on an American layout.', - }, - { - name = 'f20', - description = 'The F20 key on an American layout.', - }, - { - name = 'f21', - description = 'The F21 key on an American layout.', - }, - { - name = 'f22', - description = 'The F22 key on an American layout.', - }, - { - name = 'f23', - description = 'The F23 key on an American layout.', - }, - { - name = 'f24', - description = 'The F24 key on an American layout.', - }, - { - name = 'lctrl', - description = 'The left control key on an American layout.', - }, - { - name = 'lshift', - description = 'The left shift key on an American layout.', - }, - { - name = 'lalt', - description = 'The left alt / option key on an American layout.', - }, - { - name = 'lgui', - description = 'The left GUI (command / windows / super) key on an American layout.', - }, - { - name = 'rctrl', - description = 'The right control key on an American layout.', - }, - { - name = 'rshift', - description = 'The right shift key on an American layout.', - }, - { - name = 'ralt', - description = 'The right alt / option key on an American layout.', - }, - { - name = 'rgui', - description = 'The right GUI (command / windows / super) key on an American layout.', - }, - { - name = 'printscreen', - description = 'The printscreen key on an American layout.', - }, - { - name = 'scrolllock', - description = 'The scroll-lock key on an American layout.', - }, - { - name = 'pause', - description = 'The pause key on an American layout.', - }, - { - name = 'insert', - description = 'The insert key on an American layout.', - }, - { - name = 'home', - description = 'The home key on an American layout.', - }, - { - name = 'numlock', - description = 'The numlock / clear key on an American layout.', - }, - { - name = 'pageup', - description = 'The page-up key on an American layout.', - }, - { - name = 'delete', - description = 'The forward-delete key on an American layout.', - }, - { - name = 'end', - description = 'The end key on an American layout.', - }, - { - name = 'pagedown', - description = 'The page-down key on an American layout.', - }, - { - name = 'right', - description = 'The right-arrow key on an American layout.', - }, - { - name = 'left', - description = 'The left-arrow key on an American layout.', - }, - { - name = 'down', - description = 'The down-arrow key on an American layout.', - }, - { - name = 'up', - description = 'The up-arrow key on an American layout.', - }, - { - name = 'nonusbackslash', - description = 'The non-U.S. backslash scancode.', - }, - { - name = 'application', - description = 'The application key on an American layout. Windows contextual menu, compose key.', - }, - { - name = 'execute', - description = 'The \'execute\' key on an American layout.', - }, - { - name = 'help', - description = 'The \'help\' key on an American layout.', - }, - { - name = 'menu', - description = 'The \'menu\' key on an American layout.', - }, - { - name = 'select', - description = 'The \'select\' key on an American layout.', - }, - { - name = 'stop', - description = 'The \'stop\' key on an American layout.', - }, - { - name = 'again', - description = 'The \'again\' key on an American layout.', - }, - { - name = 'undo', - description = 'The \'undo\' key on an American layout.', - }, - { - name = 'cut', - description = 'The \'cut\' key on an American layout.', - }, - { - name = 'copy', - description = 'The \'copy\' key on an American layout.', - }, - { - name = 'paste', - description = 'The \'paste\' key on an American layout.', - }, - { - name = 'find', - description = 'The \'find\' key on an American layout.', - }, - { - name = 'kp/', - description = 'The keypad forward-slash key on an American layout.', - }, - { - name = 'kp*', - description = 'The keypad \'*\' key on an American layout.', - }, - { - name = 'kp-', - description = 'The keypad minus key on an American layout.', - }, - { - name = 'kp+', - description = 'The keypad plus key on an American layout.', - }, - { - name = 'kp=', - description = 'The keypad equals key on an American layout.', - }, - { - name = 'kpenter', - description = 'The keypad enter key on an American layout.', - }, - { - name = 'kp1', - description = 'The keypad \'1\' key on an American layout.', - }, - { - name = 'kp2', - description = 'The keypad \'2\' key on an American layout.', - }, - { - name = 'kp3', - description = 'The keypad \'3\' key on an American layout.', - }, - { - name = 'kp4', - description = 'The keypad \'4\' key on an American layout.', - }, - { - name = 'kp5', - description = 'The keypad \'5\' key on an American layout.', - }, - { - name = 'kp6', - description = 'The keypad \'6\' key on an American layout.', - }, - { - name = 'kp7', - description = 'The keypad \'7\' key on an American layout.', - }, - { - name = 'kp8', - description = 'The keypad \'8\' key on an American layout.', - }, - { - name = 'kp9', - description = 'The keypad \'9\' key on an American layout.', - }, - { - name = 'kp0', - description = 'The keypad \'0\' key on an American layout.', - }, - { - name = 'kp.', - description = 'The keypad period key on an American layout.', - }, - { - name = 'international1', - description = 'The 1st international key on an American layout. Used on Asian keyboards.', - }, - { - name = 'international2', - description = 'The 2nd international key on an American layout.', - }, - { - name = 'international3', - description = 'The 3rd international key on an American layout. Yen.', - }, - { - name = 'international4', - description = 'The 4th international key on an American layout.', - }, - { - name = 'international5', - description = 'The 5th international key on an American layout.', - }, - { - name = 'international6', - description = 'The 6th international key on an American layout.', - }, - { - name = 'international7', - description = 'The 7th international key on an American layout.', - }, - { - name = 'international8', - description = 'The 8th international key on an American layout.', - }, - { - name = 'international9', - description = 'The 9th international key on an American layout.', - }, - { - name = 'lang1', - description = 'Hangul/English toggle scancode.', - }, - { - name = 'lang2', - description = 'Hanja conversion scancode.', - }, - { - name = 'lang3', - description = 'Katakana scancode.', - }, - { - name = 'lang4', - description = 'Hiragana scancode.', - }, - { - name = 'lang5', - description = 'Zenkaku/Hankaku scancode.', - }, - { - name = 'mute', - description = 'The mute key on an American layout.', - }, - { - name = 'volumeup', - description = 'The volume up key on an American layout.', - }, - { - name = 'volumedown', - description = 'The volume down key on an American layout.', - }, - { - name = 'audionext', - description = 'The audio next track key on an American layout.', - }, - { - name = 'audioprev', - description = 'The audio previous track key on an American layout.', - }, - { - name = 'audiostop', - description = 'The audio stop key on an American layout.', - }, - { - name = 'audioplay', - description = 'The audio play key on an American layout.', - }, - { - name = 'audiomute', - description = 'The audio mute key on an American layout.', - }, - { - name = 'mediaselect', - description = 'The media select key on an American layout.', - }, - { - name = 'www', - description = 'The \'WWW\' key on an American layout.', - }, - { - name = 'mail', - description = 'The Mail key on an American layout.', - }, - { - name = 'calculator', - description = 'The calculator key on an American layout.', - }, - { - name = 'computer', - description = 'The \'computer\' key on an American layout.', - }, - { - name = 'acsearch', - description = 'The AC Search key on an American layout.', - }, - { - name = 'achome', - description = 'The AC Home key on an American layout.', - }, - { - name = 'acback', - description = 'The AC Back key on an American layout.', - }, - { - name = 'acforward', - description = 'The AC Forward key on an American layout.', - }, - { - name = 'acstop', - description = 'Th AC Stop key on an American layout.', - }, - { - name = 'acrefresh', - description = 'The AC Refresh key on an American layout.', - }, - { - name = 'acbookmarks', - description = 'The AC Bookmarks key on an American layout.', - }, - { - name = 'power', - description = 'The system power scancode.', - }, - { - name = 'brightnessdown', - description = 'The brightness-down scancode.', - }, - { - name = 'brightnessup', - description = 'The brightness-up scancode.', - }, - { - name = 'displayswitch', - description = 'The display switch scancode.', - }, - { - name = 'kbdillumtoggle', - description = 'The keyboard illumination toggle scancode.', - }, - { - name = 'kbdillumdown', - description = 'The keyboard illumination down scancode.', - }, - { - name = 'kbdillumup', - description = 'The keyboard illumination up scancode.', - }, - { - name = 'eject', - description = 'The eject scancode.', - }, - { - name = 'sleep', - description = 'The system sleep scancode.', - }, - { - name = 'alterase', - description = 'The alt-erase key on an American layout.', - }, - { - name = 'sysreq', - description = 'The sysreq key on an American layout.', - }, - { - name = 'cancel', - description = 'The \'cancel\' key on an American layout.', - }, - { - name = 'clear', - description = 'The \'clear\' key on an American layout.', - }, - { - name = 'prior', - description = 'The \'prior\' key on an American layout.', - }, - { - name = 'return2', - description = 'The \'return2\' key on an American layout.', - }, - { - name = 'separator', - description = 'The \'separator\' key on an American layout.', - }, - { - name = 'out', - description = 'The \'out\' key on an American layout.', - }, - { - name = 'oper', - description = 'The \'oper\' key on an American layout.', - }, - { - name = 'clearagain', - description = 'The \'clearagain\' key on an American layout.', - }, - { - name = 'crsel', - description = 'The \'crsel\' key on an American layout.', - }, - { - name = 'exsel', - description = 'The \'exsel\' key on an American layout.', - }, - { - name = 'kp00', - description = 'The keypad 00 key on an American layout.', - }, - { - name = 'kp000', - description = 'The keypad 000 key on an American layout.', - }, - { - name = 'thsousandsseparator', - description = 'The thousands-separator key on an American layout.', - }, - { - name = 'decimalseparator', - description = 'The decimal separator key on an American layout.', - }, - { - name = 'currencyunit', - description = 'The currency unit key on an American layout.', - }, - { - name = 'currencysubunit', - description = 'The currency sub-unit key on an American layout.', - }, - { - name = 'app1', - description = 'The \'app1\' scancode.', - }, - { - name = 'app2', - description = 'The \'app2\' scancode.', - }, - { - name = 'unknown', - description = 'An unknown key.', - }, - }, -} \ No newline at end of file diff --git a/modules/math/Math.lua b/modules/math/Math.lua deleted file mode 100644 index 8e96c38..0000000 --- a/modules/math/Math.lua +++ /dev/null @@ -1,1014 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'math', - description = 'Provides system-independent mathematical functions.', - types = { - require(path .. 'types.BezierCurve'), - require(path .. 'types.RandomGenerator'), - require(path .. 'types.Transform'), - }, - functions = { - { - name = 'colorFromBytes', - description = 'Converts a color from 0..255 to 0..1 range.', - variants = { - { - description = 'Here\'s implementation for 11.2 and earlier.\n\nfunction love.math.colorFromBytes(r, g, b, a)\n\n if type(r) == \'table\' then\n\n r, g, b, a = rr[2, rr[4\n\n end\n\n r = clamp01(floor(r + 0.5) / 255)\n\n g = clamp01(floor(g + 0.5) / 255)\n\n b = clamp01(floor(b + 0.5) / 255)\n\n a = a ~= nil and clamp01(floor(a + 0.5) / 255) or nil\n\n return r, g, b, a\n\nend\n\nWhere clamp01 is defined as follows\n\nlocal function clamp01(x)\n\n return math.min(math.max(x, 0), 1)\n\nend', - arguments = { - { - type = 'number', - name = 'rb', - description = 'Red color component in 0..255 range.', - }, - { - type = 'number', - name = 'gb', - description = 'Green color component in 0..255 range.', - }, - { - type = 'number', - name = 'bb', - description = 'Blue color component in 0..255 range.', - }, - { - type = 'number', - name = 'ab', - description = 'Alpha color component in 0..255 range.', - default = 'nil', - }, - }, - returns = { - { - type = 'number', - name = 'r', - description = 'Red color component in 0..1 range.', - }, - { - type = 'number', - name = 'g', - description = 'Green color component in 0..1 range.', - }, - { - type = 'number', - name = 'b', - description = 'Blue color component in 0..1 range.', - }, - { - type = 'number', - name = 'a', - description = 'Alpha color component in 0..1 range or nil if alpha is not specified.', - }, - }, - }, - }, - }, - { - name = 'colorToBytes', - description = 'Converts a color from 0..1 to 0..255 range.', - variants = { - { - description = 'Here\'s implementation for 11.2 and earlier.\n\nfunction love.math.colorToBytes(r, g, b, a)\n\n if type(r) == \'table\' then\n\n r, g, b, a = rr[2, rr[4\n\n end\n\n r = floor(clamp01(r) * 255 + 0.5)\n\n g = floor(clamp01(g) * 255 + 0.5)\n\n b = floor(clamp01(b) * 255 + 0.5)\n\n a = a ~= nil and floor(clamp01(a) * 255 + 0.5) or nil\n\n return r, g, b, a\n\nend\n\nWhere clamp01 is defined as follows\n\nlocal function clamp01(x)\n\n return math.min(math.max(x, 0), 1)\n\nend', - arguments = { - { - type = 'number', - name = 'r', - description = 'Red color component.', - }, - { - type = 'number', - name = 'g', - description = 'Green color component.', - }, - { - type = 'number', - name = 'b', - description = 'Blue color component.', - }, - { - type = 'number', - name = 'a', - description = 'Alpha color component.', - default = 'nil', - }, - }, - returns = { - { - type = 'number', - name = 'rb', - description = 'Red color component in 0..255 range.', - }, - { - type = 'number', - name = 'gb', - description = 'Green color component in 0..255 range.', - }, - { - type = 'number', - name = 'bb', - description = 'Blue color component in 0..255 range.', - }, - { - type = 'number', - name = 'ab', - description = 'Alpha color component in 0..255 range or nil if alpha is not specified.', - }, - }, - }, - }, - }, - { - name = 'compress', - description = 'Compresses a string or data using a specific compression algorithm.', - variants = { - { - arguments = { - { - type = 'string', - name = 'rawstring', - description = 'The raw (un-compressed) string to compress.', - }, - { - type = 'CompressedDataFormat', - name = 'format', - 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', - }, - }, - returns = { - { - type = 'CompressedData', - name = 'compressedData', - 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.', - }, - { - type = 'CompressedDataFormat', - name = 'format', - 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', - }, - }, - returns = { - { - type = 'CompressedData', - name = 'compressedData', - description = 'A new Data object containing the compressed version of the raw data.', - }, - }, - }, - }, - }, - { - name = 'decompress', - description = 'Decompresses a CompressedData or previously compressed string or Data object.', - variants = { - { - arguments = { - { - type = 'CompressedData', - name = 'compressedData', - description = 'The compressed data to decompress.', - }, - }, - returns = { - { - type = 'string', - name = 'rawstring', - description = 'A string containing the raw decompressed data.', - }, - }, - }, - { - arguments = { - { - type = 'string', - 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.', - }, - }, - returns = { - { - type = 'string', - name = 'rawstring', - 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.', - }, - { - type = 'CompressedDataFormat', - name = 'format', - description = 'The format that was used to compress the given data.', - }, - }, - returns = { - { - type = 'string', - name = 'rawstring', - 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.\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.', - }, - { - type = 'number', - name = 'g', - description = 'The green channel of the sRGB color to convert.', - }, - { - type = 'number', - name = 'b', - 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.', - }, - { - type = 'number', - name = 'lg', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'table', - name = 'color', - 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.', - }, - { - type = 'number', - name = 'lg', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'c', - 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.', - }, - }, - }, - }, - }, - { - name = 'getRandomSeed', - 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 seed value.', - }, - { - type = 'number', - name = 'high', - 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 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 random number generator, represented as a string.', - }, - }, - }, - }, - }, - { - name = 'isConvex', - 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, ...}.', - }, - }, - returns = { - { - type = 'boolean', - name = '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.', - }, - { - type = 'number', - name = 'y1', - 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.', - }, - { - type = 'number', - name = 'y2', - 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.', - }, - { - type = 'number', - name = 'y3', - description = 'The position of the third vertex of the polygon on the y-axis.', - }, - }, - returns = { - { - type = 'boolean', - name = '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.\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.', - }, - { - type = 'number', - name = 'lg', - 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.', - }, - }, - returns = { - { - type = 'number', - name = 'cr', - 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.', - }, - { - type = 'number', - name = 'cb', - 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.', - }, - }, - returns = { - { - type = 'number', - name = 'cr', - 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.', - }, - { - type = 'number', - name = 'cb', - 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.', - }, - }, - returns = { - { - type = 'number', - name = 'c', - description = 'The value of the color channel in gamma sRGB space.', - }, - }, - }, - }, - }, - { - name = 'newBezierCurve', - description = 'Creates a new BezierCurve object.\n\nThe number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc.', - variants = { - { - arguments = { - { - type = 'table', - name = 'vertices', - 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.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'x1', - 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.', - }, - { - type = 'number', - name = 'x2', - 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.', - }, - { - type = 'number', - name = 'x3', - 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.', - }, - }, - returns = { - { - type = 'BezierCurve', - name = 'curve', - description = 'A Bézier curve object.', - }, - }, - }, - }, - }, - { - name = 'newRandomGenerator', - description = 'Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions.', - variants = { - { - returns = { - { - type = 'RandomGenerator', - name = 'rng', - 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.', - }, - }, - returns = { - { - type = 'RandomGenerator', - name = 'rng', - description = 'The new Random Number Generator object.', - }, - }, - }, - { - description = 'See RandomGenerator:setSeed.', - arguments = { - { - type = 'number', - name = 'low', - 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 seed number to use for this object.', - }, - }, - returns = { - { - type = 'RandomGenerator', - name = 'rng', - description = 'The new Random Number Generator object.', - }, - }, - }, - }, - }, - { - name = 'newTransform', - description = 'Creates a new Transform object.', - variants = { - { - description = 'Creates a Transform with no transformations applied. Call methods on the returned object to apply transformations.', - returns = { - { - type = 'Transform', - name = 'transform', - description = 'The new Transform object.', - }, - }, - }, - { - description = 'Creates a Transform with the specified transformation applied on creation.', - arguments = { - { - type = 'number', - name = 'x', - 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.', - }, - { - type = 'number', - name = 'angle', - description = 'The orientation of the new 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 new Transform object.', - }, - }, - }, - }, - }, - { - name = 'noise', - description = 'Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments.\n\nSimplex noise is closely related to Perlin noise. It is widely used for procedural content generation.\n\nThere are many webpages which discuss Perlin and Simplex noise in detail.', - variants = { - { - description = 'Generates Simplex noise from 1 dimension.', - arguments = { - { - type = 'number', - name = 'x', - description = 'The number used to generate the noise value.', - }, - }, - returns = { - { - type = 'number', - name = 'value', - description = 'The noise value in the range of 1.', - }, - }, - }, - { - description = 'Generates Simplex noise from 2 dimensions.', - arguments = { - { - type = 'number', - name = 'x', - 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.', - }, - }, - returns = { - { - type = 'number', - name = 'value', - 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.', - arguments = { - { - type = 'number', - name = 'x', - 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.', - }, - { - type = 'number', - name = 'z', - 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 1.', - }, - }, - }, - { - description = 'Generates Perlin noise (Simplex noise in version 0.9.2 and older) from 4 dimensions.', - arguments = { - { - type = 'number', - name = 'x', - 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.', - }, - { - type = 'number', - name = 'z', - 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.', - }, - }, - returns = { - { - type = 'number', - name = 'value', - description = 'The noise value in the range of 1.', - }, - }, - }, - }, - }, - { - name = 'random', - 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 1.', - returns = { - { - type = 'number', - name = 'number', - description = 'The pseudo-random number.', - }, - }, - }, - { - description = 'Get a uniformly distributed pseudo-random integer within max.', - arguments = { - { - type = 'number', - name = 'max', - description = 'The maximum possible value it should return.', - }, - }, - returns = { - { - type = 'number', - name = 'number', - description = 'The pseudo-random integer number.', - }, - }, - }, - { - description = 'Get uniformly distributed pseudo-random integer within max.', - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum possible value it should return.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum possible value it should return.', - }, - }, - returns = { - { - type = 'number', - name = 'number', - description = 'The pseudo-random integer number.', - }, - }, - }, - }, - }, - { - name = 'randomNormal', - description = 'Get a normally distributed pseudo random number.', - variants = { - { - arguments = { - { - type = 'number', - name = 'stddev', - description = 'Standard deviation of the distribution.', - default = '1', - }, - { - type = 'number', - name = 'mean', - description = 'The mean of the distribution.', - default = '0', - }, - }, - returns = { - { - type = 'number', - name = 'number', - 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. 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 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 seed value. Must be within the range of 2^32 - 1.', - }, - { - type = 'number', - name = 'high', - description = 'The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.', - }, - }, - }, - }, - }, - { - name = 'setRandomState', - 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 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 = 'Decomposes a simple convex or concave polygon into triangles.', - variants = { - { - arguments = { - { - type = 'table', - name = 'polygon', - 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}, ...}.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'x1', - 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.', - }, - { - type = 'number', - name = 'x2', - 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.', - }, - { - type = 'number', - name = 'x3', - 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.', - }, - }, - 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}, ...}.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.MatrixLayout'), - }, -} \ No newline at end of file diff --git a/modules/math/enums/CompressedDataFormat.lua b/modules/math/enums/CompressedDataFormat.lua deleted file mode 100644 index 0b73d21..0000000 --- a/modules/math/enums/CompressedDataFormat.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - name = 'CompressedDataFormat', - description = 'Compressed data formats.', - 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. 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.', - }, - { - 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.', - }, - { - 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 deleted file mode 100644 index e704d1d..0000000 --- a/modules/math/types/BezierCurve.lua +++ /dev/null @@ -1,336 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'BezierCurve', - 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.', - constructors = { - 'newBezierCurve', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'evaluate', - description = 'Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive).\n\nThis function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose.', - variants = { - { - arguments = { - { - type = 'number', - name = 't', - description = 'Where to evaluate the curve.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'x coordinate of the curve at parameter t.', - }, - { - type = 'number', - name = 'y', - description = 'y coordinate of the curve at parameter t.', - }, - }, - }, - }, - }, - { - name = 'getControlPoint', - description = 'Get coordinates of the i-th control point. Indices start with 1.', - variants = { - { - arguments = { - { - type = 'number', - name = 'i', - description = 'Index of the control point.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'Position of the control point along the x axis.', - }, - { - type = 'number', - name = 'y', - description = 'Position of the control point along the y axis.', - }, - }, - }, - }, - }, - { - name = 'getControlPointCount', - description = 'Get the number of control points in the Bézier curve.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The number of control points.', - }, - }, - }, - }, - }, - { - name = 'getDegree', - description = 'Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1.', - variants = { - { - returns = { - { - type = 'number', - name = 'degree', - description = 'Degree of the Bézier curve.', - }, - }, - }, - }, - }, - { - name = 'getDerivative', - description = 'Get the derivative of the Bézier curve.\n\nThis function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t.', - variants = { - { - returns = { - { - type = 'BezierCurve', - name = 'derivative', - description = 'The derivative curve.', - }, - }, - }, - }, - }, - { - name = 'getSegment', - description = 'Gets a BezierCurve that corresponds to the specified segment of this BezierCurve.', - variants = { - { - arguments = { - { - type = 'number', - name = 'startpoint', - 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.', - }, - }, - returns = { - { - type = 'BezierCurve', - name = 'curve', - description = 'A BezierCurve that corresponds to the specified segment.', - }, - }, - }, - }, - }, - { - name = 'insertControlPoint', - description = 'Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'Position of the control point along the x axis.', - }, - { - type = 'number', - name = 'y', - description = 'Position of the control point along the y axis.', - }, - { - type = 'number', - name = 'i', - description = 'Index of the control point.', - default = '-1', - }, - }, - }, - }, - }, - { - name = 'removeControlPoint', - description = 'Removes the specified control point.', - variants = { - { - arguments = { - { - type = 'number', - name = 'index', - description = 'The index of the control point to remove.', - }, - }, - }, - }, - }, - { - name = 'render', - description = 'Get a list of coordinates to be used with love.graphics.line.\n\nThis function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.\n\nIf you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate.', - variants = { - { - arguments = { - { - type = 'number', - name = 'depth', - description = 'Number of recursive subdivision steps.', - default = '5', - }, - }, - returns = { - { - type = 'table', - name = 'coordinates', - description = 'List of x,y-coordinate pairs of points on the curve.', - }, - }, - }, - }, - }, - { - name = 'renderSegment', - description = 'Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line.\n\nThis function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.\n\nIf you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate.', - variants = { - { - arguments = { - { - type = 'number', - name = 'startpoint', - 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.', - }, - { - type = 'number', - name = 'depth', - description = 'Number of recursive subdivision steps.', - default = '5', - }, - }, - returns = { - { - type = 'table', - name = 'coordinates', - description = 'List of x,y-coordinate pairs of points on the specified part of the curve.', - }, - }, - }, - }, - }, - { - name = 'rotate', - description = 'Rotate the Bézier curve by an angle.', - variants = { - { - arguments = { - { - type = 'number', - name = 'angle', - description = 'Rotation angle in radians.', - }, - { - type = 'number', - name = 'ox', - description = 'X coordinate of the rotation center.', - default = '0', - }, - { - type = 'number', - name = 'oy', - description = 'Y coordinate of the rotation center.', - default = '0', - }, - }, - }, - }, - }, - { - name = 'scale', - description = 'Scale the Bézier curve by a factor.', - variants = { - { - arguments = { - { - type = 'number', - name = 's', - description = 'Scale factor.', - }, - { - type = 'number', - name = 'ox', - description = 'X coordinate of the scaling center.', - default = '0', - }, - { - type = 'number', - name = 'oy', - description = 'Y coordinate of the scaling center.', - default = '0', - }, - }, - }, - }, - }, - { - name = 'setControlPoint', - description = 'Set coordinates of the i-th control point. Indices start with 1.', - variants = { - { - arguments = { - { - type = 'number', - name = 'i', - description = 'Index of the control point.', - }, - { - type = 'number', - name = 'x', - description = 'Position of the control point along the x axis.', - }, - { - type = 'number', - name = 'y', - description = 'Position of the control point along the y axis.', - }, - }, - }, - }, - }, - { - name = 'translate', - description = 'Move the Bézier curve by an offset.', - variants = { - { - arguments = { - { - type = 'number', - name = 'dx', - description = 'Offset along the x axis.', - }, - { - type = 'number', - name = 'dy', - description = 'Offset along the y axis.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/math/types/CompressedData.lua b/modules/math/types/CompressedData.lua deleted file mode 100644 index b7d90b0..0000000 --- a/modules/math/types/CompressedData.lua +++ /dev/null @@ -1,27 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'CompressedData', - 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 = { - { - name = 'getFormat', - description = 'Gets the compression format of the CompressedData.', - variants = { - { - returns = { - { - type = 'CompressedDataFormat', - name = 'format', - description = 'The format of the CompressedData.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/math/types/RandomGenerator.lua b/modules/math/types/RandomGenerator.lua deleted file mode 100644 index ff9240c..0000000 --- a/modules/math/types/RandomGenerator.lua +++ /dev/null @@ -1,181 +0,0 @@ -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 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 RandomGenerator\'s 64 bit seed value.', - }, - { - type = 'number', - name = 'high', - 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 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.', - }, - }, - }, - }, - }, - { - name = 'random', - description = 'Generates a pseudo-random number in a platform independent manner.', - variants = { - { - description = 'Get uniformly distributed pseudo-random number within 1.', - returns = { - { - type = 'number', - name = 'number', - description = 'The pseudo-random number.', - }, - }, - }, - { - description = 'Get uniformly distributed pseudo-random integer number within max.', - arguments = { - { - type = 'number', - name = 'max', - description = 'The maximum possible value it should return.', - }, - }, - returns = { - { - type = 'number', - name = 'number', - description = 'The pseudo-random integer number.', - }, - }, - }, - { - description = 'Get uniformly distributed pseudo-random integer number within max.', - arguments = { - { - type = 'number', - name = 'min', - description = 'The minimum possible value it should return.', - }, - { - type = 'number', - name = 'max', - description = 'The maximum possible value it should return.', - }, - }, - returns = { - { - type = 'number', - name = 'number', - description = 'The pseudo-random integer number.', - }, - }, - }, - }, - }, - { - name = 'randomNormal', - description = 'Get a normally distributed pseudo random number.', - variants = { - { - arguments = { - { - type = 'number', - name = 'stddev', - description = 'Standard deviation of the distribution.', - default = '1', - }, - { - type = 'number', - name = 'mean', - description = 'The mean of the distribution.', - default = '0', - }, - }, - returns = { - { - type = 'number', - name = 'number', - 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 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 seed value. Must be within the range of 2^32 - 1.', - }, - { - type = 'number', - name = 'high', - 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 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.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/mouse/Mouse.lua b/modules/mouse/Mouse.lua deleted file mode 100644 index 9160198..0000000 --- a/modules/mouse/Mouse.lua +++ /dev/null @@ -1,407 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'mouse', - description = 'Provides an interface to the user\'s mouse.', - types = { - require(path .. 'types.Cursor'), - }, - functions = { - { - name = 'getCursor', - description = 'Gets the current Cursor.', - variants = { - { - returns = { - { - type = 'Cursor', - name = 'cursor', - description = 'The current cursor, or nil if no cursor is set.', - }, - }, - }, - }, - }, - { - name = 'getPosition', - description = 'Returns the current position of the mouse.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The position of the mouse along the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The position of the mouse along the y-axis.', - }, - }, - }, - }, - }, - { - name = 'getRelativeMode', - description = 'Gets whether relative mode is enabled for the mouse.\n\nIf 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.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - 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\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. ', - }, - }, - returns = { - { - type = 'Cursor', - name = 'cursor', - description = 'The Cursor object representing the system cursor type.', - }, - }, - }, - }, - }, - { - name = 'getX', - 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.', - }, - }, - }, - }, - }, - { - name = 'getY', - 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.', - }, - }, - }, - }, - }, - { - name = 'hasCursor', - description = 'Gets whether cursor functionality is supported.\n\nIf it isn\'t supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'hascursor', - description = 'Whether the system has cursor functionality.', - }, - }, - }, - }, - }, - { - name = 'isCursorSupported', - description = 'Gets whether cursor functionality is supported.\n\nIf it isn\'t supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'supported', - description = 'Whether the system has cursor functionality.', - }, - }, - }, - }, - }, - { - name = 'isDown', - 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.', - }, - }, - }, - }, - }, - { - name = 'isGrabbed', - description = 'Checks if the mouse is grabbed.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'grabbed', - description = 'True if the cursor is grabbed, false if it is not.', - }, - }, - }, - }, - }, - { - name = 'isVisible', - description = 'Checks if the cursor is visible.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'visible', - description = 'True if the cursor to visible, false if the cursor is hidden.', - }, - }, - }, - }, - }, - { - name = 'newCursor', - description = 'Creates a new hardware Cursor object from an image file or ImageData.\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.\n\nThe hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is. For example, the normal arrow pointer normally has its hot spot at the top left of the image, but a crosshair cursor might have it in the middle.', - variants = { - { - arguments = { - { - type = 'ImageData', - name = 'imageData', - 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', - }, - { - type = 'number', - name = 'hoty', - description = 'The y-coordinate in the ImageData of the cursor\'s hot spot.', - default = '0', - }, - }, - returns = { - { - type = 'Cursor', - name = 'cursor', - description = 'The new Cursor object.', - }, - }, - }, - { - arguments = { - { - type = 'string', - 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', - }, - { - type = 'number', - name = 'hoty', - description = 'The y-coordinate in the image of the cursor\'s hot spot.', - default = '0', - }, - }, - returns = { - { - type = 'Cursor', - name = 'cursor', - description = 'The new Cursor object.', - }, - }, - }, - { - arguments = { - { - type = 'FileData', - name = 'fileData', - 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', - }, - { - type = 'number', - name = 'hoty', - description = 'The y-coordinate in the image of the cursor\'s hot spot.', - default = '0', - }, - }, - returns = { - { - type = 'Cursor', - name = 'cursor', - description = 'The new Cursor object.', - }, - }, - }, - }, - }, - { - name = 'setCursor', - description = 'Sets the current mouse cursor.', - variants = { - { - arguments = { - { - type = 'Cursor', - name = 'cursor', - description = 'The Cursor object to use as the current mouse cursor.', - }, - }, - }, - { - description = 'Resets the current mouse cursor to the default.', - }, - }, - }, - { - name = 'setGrabbed', - description = 'Grabs the mouse and confines it to the window.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'grab', - description = 'True to confine the mouse, false to let it leave the window.', - }, - }, - }, - }, - }, - { - name = 'setPosition', - description = 'Sets the current position of the mouse. Non-integer values are floored.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - 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.', - }, - }, - }, - }, - }, - { - 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 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.', - }, - }, - }, - }, - }, - { - name = 'setVisible', - 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.', - }, - }, - }, - }, - }, - { - name = 'setX', - 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.', - }, - }, - }, - }, - }, - { - name = 'setY', - 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.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.CursorType'), - }, -} \ No newline at end of file diff --git a/modules/mouse/enums/CursorType.lua b/modules/mouse/enums/CursorType.lua deleted file mode 100644 index b5ede5d..0000000 --- a/modules/mouse/enums/CursorType.lua +++ /dev/null @@ -1,58 +0,0 @@ -return { - name = 'CursorType', - description = 'Types of hardware cursors.', - constants = { - { - name = 'image', - description = 'The cursor is using a custom image.', - }, - { - name = 'arrow', - description = 'An arrow pointer.', - }, - { - name = 'ibeam', - description = 'An I-beam, normally used when mousing over editable or selectable text.', - }, - { - name = 'wait', - description = 'Wait graphic.', - }, - { - name = 'waitarrow', - description = 'Small wait cursor with an arrow pointer.', - }, - { - name = 'crosshair', - description = 'Crosshair symbol.', - }, - { - name = 'sizenwse', - description = 'Double arrow pointing to the top-left and bottom-right.', - }, - { - name = 'sizenesw', - description = 'Double arrow pointing to the top-right and bottom-left.', - }, - { - name = 'sizewe', - description = 'Double arrow pointing left and right.', - }, - { - name = 'sizens', - description = 'Double arrow pointing up and down.', - }, - { - name = 'sizeall', - description = 'Four-pointed arrow pointing up, down, left, and right.', - }, - { - name = 'no', - description = 'Slashed circle or crossbones.', - }, - { - name = 'hand', - description = 'Hand symbol.', - }, - }, -} \ No newline at end of file diff --git a/modules/mouse/types/Cursor.lua b/modules/mouse/types/Cursor.lua deleted file mode 100644 index 339402e..0000000 --- a/modules/mouse/types/Cursor.lua +++ /dev/null @@ -1,31 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Cursor', - description = 'Represents a hardware cursor.', - constructors = { - 'getCursor', - 'newCursor', - 'getSystemCursor', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'getType', - description = 'Gets the type of the Cursor.', - variants = { - { - returns = { - { - type = 'CursorType', - name = 'ctype', - description = 'The type of the Cursor.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/Physics.lua b/modules/physics/Physics.lua deleted file mode 100644 index 0bb9f58..0000000 --- a/modules/physics/Physics.lua +++ /dev/null @@ -1,1445 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'physics', - description = 'Can simulate 2D rigid body physics in a realistic manner. This module is based on Box2D, and this API corresponds to the Box2D API as closely as possible.', - types = { - require(path .. 'types.Body'), - require(path .. 'types.ChainShape'), - require(path .. 'types.CircleShape'), - require(path .. 'types.Contact'), - require(path .. 'types.DistanceJoint'), - require(path .. 'types.EdgeShape'), - require(path .. 'types.Fixture'), - require(path .. 'types.FrictionJoint'), - require(path .. 'types.GearJoint'), - require(path .. 'types.Joint'), - require(path .. 'types.MotorJoint'), - require(path .. 'types.MouseJoint'), - require(path .. 'types.PolygonShape'), - require(path .. 'types.PrismaticJoint'), - require(path .. 'types.PulleyJoint'), - require(path .. 'types.RevoluteJoint'), - require(path .. 'types.RopeJoint'), - require(path .. 'types.Shape'), - require(path .. 'types.WeldJoint'), - require(path .. 'types.WheelJoint'), - require(path .. 'types.World'), - }, - functions = { - { - name = 'getDistance', - description = 'Returns the two closest points between two fixtures and their distance.', - variants = { - { - arguments = { - { - type = 'Fixture', - name = 'fixture1', - description = 'The first fixture.', - }, - { - type = 'Fixture', - name = 'fixture2', - description = 'The second fixture.', - }, - }, - returns = { - { - type = 'number', - name = 'distance', - description = 'The distance of the two points.', - }, - { - type = 'number', - name = 'x1', - description = 'The x-coordinate of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y-coordinate of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x-coordinate of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y-coordinate of the second point.', - }, - }, - }, - }, - }, - { - name = 'getMeter', - description = 'Returns the meter scale factor.\n\nAll coordinates in the physics module are divided by this number, creating a convenient way to draw the objects directly to the screen without the need for graphics transformations.\n\nIt is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters.', - variants = { - { - returns = { - { - type = 'number', - name = 'scale', - description = 'The scale factor as an integer.', - }, - }, - }, - }, - }, - { - name = 'newBody', - description = 'Creates a new body.\n\nThere are three types of bodies. \n\n* Static bodies do not move, have a infinite mass, and can be used for level boundaries. \n\n* Dynamic bodies are the main actors in the simulation, they collide with everything. \n\n* Kinematic bodies do not react to forces and only collide with dynamic bodies.\n\nThe mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData.', - variants = { - { - arguments = { - { - type = 'World', - name = 'world', - description = 'The world to create the body in.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the body.', - default = '0', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the body.', - default = '0', - }, - { - type = 'BodyType', - name = 'type', - description = 'The type of the body.', - default = '\'static\'', - }, - }, - returns = { - { - type = 'Body', - name = 'body', - description = 'A new body.', - }, - }, - }, - }, - }, - { - name = 'newChainShape', - description = 'Creates a new ChainShape.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'loop', - description = 'If the chain should loop back to the first point.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second point.', - }, - { - type = 'number', - name = '...', - description = 'Additional point positions.', - }, - }, - returns = { - { - type = 'ChainShape', - name = 'shape', - description = 'The new shape.', - }, - }, - }, - { - arguments = { - { - type = 'boolean', - name = 'loop', - description = 'If the chain should loop back to the first point.', - }, - { - type = 'table', - name = 'points', - description = 'A list of points to construct the ChainShape, in the form of {x1, y1, x2, y2, ...}.', - }, - }, - returns = { - { - type = 'ChainShape', - name = 'shape', - description = 'The new shape.', - }, - }, - }, - }, - }, - { - name = 'newCircleShape', - description = 'Creates a new CircleShape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'radius', - description = 'The radius of the circle.', - }, - }, - returns = { - { - type = 'CircleShape', - name = 'shape', - description = 'The new shape.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position of the circle.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the circle.', - }, - { - type = 'number', - name = 'radius', - description = 'The radius of the circle.', - }, - }, - returns = { - { - type = 'CircleShape', - name = 'shape', - description = 'The new shape.', - }, - }, - }, - }, - }, - { - name = 'newDistanceJoint', - description = 'Creates a DistanceJoint between two bodies.\n\nThis joint constrains the distance between two points on two bodies to be constant. These two points are specified in world coordinates and the two bodies are assumed to be in place when this joint is created. The first anchor point is connected to the first body and the second to the second body, and the points define the length of the distance joint.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first anchor point (world space).', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first anchor point (world space).', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second anchor point (world space).', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second anchor point (world space).', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'DistanceJoint', - name = 'joint', - description = 'The new distance joint.', - }, - }, - }, - }, - }, - { - name = 'newEdgeShape', - description = 'Creates a new EdgeShape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x1', - description = 'The x position of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second point.', - }, - }, - returns = { - { - type = 'EdgeShape', - name = 'shape', - description = 'The new shape.', - }, - }, - }, - }, - }, - { - name = 'newFixture', - description = 'Creates and attaches a Fixture to a body.\n\nNote that the Shape object is copied rather than kept as a reference when the Fixture is created. To get the Shape object that the Fixture owns, use Fixture:getShape.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body', - description = 'The body which gets the fixture attached.', - }, - { - type = 'Shape', - name = 'shape', - description = 'The shape to be copied to the fixture.', - }, - { - type = 'number', - name = 'density', - description = 'The density of the fixture.', - default = '1', - }, - }, - returns = { - { - type = 'Fixture', - name = 'fixture', - description = 'The new fixture.', - }, - }, - }, - }, - }, - { - name = 'newFrictionJoint', - description = 'Create a friction joint between two bodies. A FrictionJoint applies friction to a body.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the anchor point.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the anchor point.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'FrictionJoint', - name = 'joint', - description = 'The new FrictionJoint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first anchor point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first anchor point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second anchor point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second anchor point.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'FrictionJoint', - name = 'joint', - description = 'The new FrictionJoint.', - }, - }, - }, - }, - }, - { - name = 'newGearJoint', - description = 'Create a GearJoint connecting two Joints.\n\nThe gear joint connects two joints that must be either prismatic or revolute joints. Using this joint requires that the joints it uses connect their respective bodies to the ground and have the ground as the first body. When destroying the bodies and joints you must make sure you destroy the gear joint before the other joints.\n\nThe gear joint has a ratio the determines how the angular or distance values of the connected joints relate to each other. The formula coordinate1 + ratio * coordinate2 always has a constant value that is set when the gear joint is created.', - variants = { - { - arguments = { - { - type = 'Joint', - name = 'joint1', - description = 'The first joint to connect with a gear joint.', - }, - { - type = 'Joint', - name = 'joint2', - description = 'The second joint to connect with a gear joint.', - }, - { - type = 'number', - name = 'ratio', - description = 'The gear ratio.', - default = '1', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'GearJoint', - name = 'joint', - description = 'The new gear joint.', - }, - }, - }, - }, - }, - { - name = 'newMotorJoint', - description = 'Creates a joint between two bodies which controls the relative motion between them.\n\nPosition and rotation offsets can be specified once the MotorJoint has been created, as well as the maximum motor force and torque that will be be applied to reach the target offsets.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'correctionFactor', - description = 'The joint\'s initial position correction factor, in the range of 1.', - default = '0.3', - }, - }, - returns = { - { - type = 'MotorJoint', - name = 'joint', - description = 'The new MotorJoint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'correctionFactor', - description = 'The joint\'s initial position correction factor, in the range of 1.', - default = '0.3', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'MotorJoint', - name = 'joint', - description = 'The new MotorJoint.', - }, - }, - }, - }, - }, - { - name = 'newMouseJoint', - description = 'Create a joint between a body and the mouse.\n\nThis joint actually connects the body to a fixed point in the world. To make it follow the mouse, the fixed point must be updated every timestep (example below).\n\nThe advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine. ', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body', - description = 'The body to attach to the mouse.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the connecting point.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the connecting point.', - }, - }, - returns = { - { - type = 'MouseJoint', - name = 'joint', - description = 'The new mouse joint.', - }, - }, - }, - }, - }, - { - name = 'newPolygonShape', - description = 'Creates a new PolygonShape.\n\nThis shape can have 8 vertices at most, and must form a convex shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x1', - description = 'The x position of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second point.', - }, - { - type = 'number', - name = 'x3', - description = 'The x position of the third point.', - }, - { - type = 'number', - name = 'y3', - description = 'The y position of the third point.', - }, - { - type = 'number', - name = '...', - description = 'You can continue passing more point positions to create the PolygonShape.', - }, - }, - returns = { - { - type = 'PolygonShape', - name = 'shape', - description = 'A new PolygonShape.', - }, - }, - }, - { - arguments = { - { - type = 'table', - name = 'vertices', - description = 'A list of vertices to construct the polygon, in the form of {x1, y1, x2, y2, x3, y3, ...}.', - }, - }, - returns = { - { - type = 'PolygonShape', - name = 'shape', - description = 'A new PolygonShape.', - }, - }, - }, - }, - }, - { - name = 'newPrismaticJoint', - description = 'Creates a PrismaticJoint between two bodies.\n\nA prismatic joint constrains two bodies to move relatively to each other on a specified axis. It does not allow for relative rotation. Its definition and operation are similar to a revolute joint, but with translation and force substituted for angle and torque.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to connect with a prismatic joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to connect with a prismatic joint.', - }, - { - type = 'number', - name = 'x', - description = 'The x coordinate of the anchor point.', - }, - { - type = 'number', - name = 'y', - description = 'The y coordinate of the anchor point.', - }, - { - type = 'number', - name = 'ax', - description = 'The x coordinate of the axis vector.', - }, - { - type = 'number', - name = 'ay', - description = 'The y coordinate of the axis vector.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'PrismaticJoint', - name = 'joint', - description = 'The new prismatic joint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to connect with a prismatic joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to connect with a prismatic joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x coordinate of the first anchor point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y coordinate of the first anchor point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x coordinate of the second anchor point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y coordinate of the second anchor point.', - }, - { - type = 'number', - name = 'ax', - description = 'The x coordinate of the axis unit vector.', - }, - { - type = 'number', - name = 'ay', - description = 'The y coordinate of the axis unit vector.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'PrismaticJoint', - name = 'joint', - description = 'The new prismatic joint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to connect with a prismatic joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to connect with a prismatic joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x coordinate of the first anchor point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y coordinate of the first anchor point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x coordinate of the second anchor point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y coordinate of the second anchor point.', - }, - { - type = 'number', - name = 'ax', - description = 'The x coordinate of the axis unit vector.', - }, - { - type = 'number', - name = 'ay', - description = 'The y coordinate of the axis unit vector.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - { - type = 'number', - name = 'referenceAngle', - description = 'The reference angle between body1 and body2, in radians.', - default = '0', - }, - }, - returns = { - { - type = 'PrismaticJoint', - name = 'joint', - description = 'The new prismatic joint.', - }, - }, - }, - }, - }, - { - name = 'newPulleyJoint', - description = 'Creates a PulleyJoint to join two bodies to each other and the ground.\n\nThe pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant length1 + ratio * length2, which is set when the pulley joint is created.\n\nPulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths  be used to constrain the maximum lengths each side can attain.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to connect with a pulley joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to connect with a pulley joint.', - }, - { - type = 'number', - name = 'gx1', - description = 'The x coordinate of the first body\'s ground anchor.', - }, - { - type = 'number', - name = 'gy1', - description = 'The y coordinate of the first body\'s ground anchor.', - }, - { - type = 'number', - name = 'gx2', - description = 'The x coordinate of the second body\'s ground anchor.', - }, - { - type = 'number', - name = 'gy2', - description = 'The y coordinate of the second body\'s ground anchor.', - }, - { - type = 'number', - name = 'x1', - description = 'The x coordinate of the pulley joint anchor in the first body.', - }, - { - type = 'number', - name = 'y1', - description = 'The y coordinate of the pulley joint anchor in the first body.', - }, - { - type = 'number', - name = 'x2', - description = 'The x coordinate of the pulley joint anchor in the second body.', - }, - { - type = 'number', - name = 'y2', - description = 'The y coordinate of the pulley joint anchor in the second body.', - }, - { - type = 'number', - name = 'ratio', - description = 'The joint ratio.', - default = '1', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'true', - }, - }, - returns = { - { - type = 'PulleyJoint', - name = 'joint', - description = 'The new pulley joint.', - }, - }, - }, - }, - }, - { - name = 'newRectangleShape', - description = 'Shorthand for creating rectangular PolygonShapes. \n\nBy default, the local origin is located at the \'\'\'center\'\'\' of the rectangle as opposed to the top left for graphics.', - variants = { - { - arguments = { - { - type = 'number', - name = 'width', - description = 'The width of the rectangle.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the rectangle.', - }, - }, - returns = { - { - type = 'PolygonShape', - name = 'shape', - description = 'A new PolygonShape.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The offset along the x-axis.', - }, - { - type = 'number', - name = 'y', - description = 'The offset along the y-axis.', - }, - { - type = 'number', - name = 'width', - description = 'The width of the rectangle.', - }, - { - type = 'number', - name = 'height', - description = 'The height of the rectangle.', - }, - { - type = 'number', - name = 'angle', - description = 'The initial angle of the rectangle.', - default = '0', - }, - }, - returns = { - { - type = 'PolygonShape', - name = 'shape', - description = 'A new PolygonShape.', - }, - }, - }, - }, - }, - { - name = 'newRevoluteJoint', - description = 'Creates a pivot joint between two bodies.\n\nThis joint connects two bodies to a point around which they can pivot.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the connecting point.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the connecting point.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'RevoluteJoint', - name = 'joint', - description = 'The new revolute joint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first connecting point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first connecting point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second connecting point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second connecting point.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - { - type = 'number', - name = 'referenceAngle', - description = 'The reference angle between body1 and body2, in radians.', - default = '0', - }, - }, - returns = { - { - type = 'RevoluteJoint', - name = 'joint', - description = 'The new revolute joint.', - }, - }, - }, - }, - }, - { - name = 'newRopeJoint', - description = 'Creates a joint between two bodies. Its only function is enforcing a max distance between these bodies.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first anchor point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first anchor point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second anchor point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second anchor point.', - }, - { - type = 'number', - name = 'maxLength', - description = 'The maximum distance for the bodies.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'RopeJoint', - name = 'joint', - description = 'The new RopeJoint.', - }, - }, - }, - }, - }, - { - name = 'newWeldJoint', - description = 'Creates a constraint joint between two bodies. A WeldJoint essentially glues two bodies together. The constraint is a bit soft, however, due to Box2D\'s iterative solver.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the anchor point (world space).', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the anchor point (world space).', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'WeldJoint', - name = 'joint', - description = 'The new WeldJoint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first anchor point (world space).', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first anchor point (world space).', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second anchor point (world space).', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second anchor point (world space).', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'WeldJoint', - name = 'joint', - description = 'The new WeldJoint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body to attach to the joint.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body to attach to the joint.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first anchor point (world space).', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first anchor point (world space).', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second anchor point (world space).', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second anchor point (world space).', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - { - type = 'number', - name = 'referenceAngle', - description = 'The reference angle between body1 and body2, in radians.', - default = '0', - }, - }, - returns = { - { - type = 'WeldJoint', - name = 'joint', - description = 'The new WeldJoint.', - }, - }, - }, - }, - }, - { - name = 'newWheelJoint', - description = 'Creates a wheel joint.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the anchor point.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the anchor point.', - }, - { - type = 'number', - name = 'ax', - description = 'The x position of the axis unit vector.', - }, - { - type = 'number', - name = 'ay', - description = 'The y position of the axis unit vector.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'WheelJoint', - name = 'joint', - description = 'The new WheelJoint.', - }, - }, - }, - { - arguments = { - { - type = 'Body', - name = 'body1', - description = 'The first body.', - }, - { - type = 'Body', - name = 'body2', - description = 'The second body.', - }, - { - type = 'number', - name = 'x1', - description = 'The x position of the first anchor point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first anchor point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second anchor point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second anchor point.', - }, - { - type = 'number', - name = 'ax', - description = 'The x position of the axis unit vector.', - }, - { - type = 'number', - name = 'ay', - description = 'The y position of the axis unit vector.', - }, - { - type = 'boolean', - name = 'collideConnected', - description = 'Specifies whether the two bodies should collide with each other.', - default = 'false', - }, - }, - returns = { - { - type = 'WheelJoint', - name = 'joint', - description = 'The new WheelJoint.', - }, - }, - }, - }, - }, - { - name = 'newWorld', - description = 'Creates a new World.', - variants = { - { - arguments = { - { - type = 'number', - name = 'xg', - description = 'The x component of gravity.', - default = '0', - }, - { - type = 'number', - name = 'yg', - description = 'The y component of gravity.', - default = '0', - }, - { - type = 'boolean', - name = 'sleep', - description = 'Whether the bodies in this world are allowed to sleep.', - default = 'true', - }, - }, - returns = { - { - type = 'World', - name = 'world', - description = 'A brave new World.', - }, - }, - }, - }, - }, - { - name = 'setMeter', - description = 'Sets the pixels to meter scale factor.\n\nAll coordinates in the physics module are divided by this number and converted to meters, and it creates a convenient way to draw the objects directly to the screen without the need for graphics transformations.\n\nIt is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30.', - variants = { - { - arguments = { - { - type = 'number', - name = 'scale', - description = 'The scale factor as an integer.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.BodyType'), - require(path .. 'enums.JointType'), - require(path .. 'enums.ShapeType'), - }, -} \ No newline at end of file diff --git a/modules/physics/enums/BodyType.lua b/modules/physics/enums/BodyType.lua deleted file mode 100644 index 9ddcc06..0000000 --- a/modules/physics/enums/BodyType.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'BodyType', - description = 'The types of a Body. ', - constants = { - { - name = 'static', - description = 'Static bodies do not move.', - }, - { - name = 'dynamic', - description = 'Dynamic bodies collide with all bodies.', - }, - { - name = 'kinematic', - description = 'Kinematic bodies only collide with dynamic bodies.', - }, - }, -} \ No newline at end of file diff --git a/modules/physics/enums/JointType.lua b/modules/physics/enums/JointType.lua deleted file mode 100644 index 86773ed..0000000 --- a/modules/physics/enums/JointType.lua +++ /dev/null @@ -1,42 +0,0 @@ -return { - name = 'JointType', - description = 'Different types of joints.', - constants = { - { - name = 'distance', - description = 'A DistanceJoint.', - }, - { - name = 'friction', - description = 'A FrictionJoint.', - }, - { - name = 'gear', - description = 'A GearJoint.', - }, - { - name = 'mouse', - description = 'A MouseJoint.', - }, - { - name = 'prismatic', - description = 'A PrismaticJoint.', - }, - { - name = 'pulley', - description = 'A PulleyJoint.', - }, - { - name = 'revolute', - description = 'A RevoluteJoint.', - }, - { - name = 'rope', - description = 'A RopeJoint.', - }, - { - name = 'weld', - description = 'A WeldJoint.', - }, - }, -} \ No newline at end of file diff --git a/modules/physics/enums/ShapeType.lua b/modules/physics/enums/ShapeType.lua deleted file mode 100644 index 39f3df8..0000000 --- a/modules/physics/enums/ShapeType.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - name = 'ShapeType', - description = 'The different types of Shapes, as returned by Shape:getType.', - constants = { - { - name = 'circle', - description = 'The Shape is a CircleShape.', - }, - { - name = 'polygon', - description = 'The Shape is a PolygonShape.', - }, - { - name = 'edge', - description = 'The Shape is a EdgeShape.', - }, - { - name = 'chain', - description = 'The Shape is a ChainShape.', - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/Body.lua b/modules/physics/types/Body.lua deleted file mode 100644 index 293b8f3..0000000 --- a/modules/physics/types/Body.lua +++ /dev/null @@ -1,1199 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Body', - description = 'Bodies are objects with velocity and position.', - constructors = { - 'newBody', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'applyAngularImpulse', - description = 'Applies an angular impulse to a body. This makes a single, instantaneous addition to the body momentum.\n\nA body with with a larger mass will react less. The reaction does \'\'\'not\'\'\' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce.', - variants = { - { - arguments = { - { - type = 'number', - name = 'impulse', - description = 'The impulse in kilogram-square meter per second.', - }, - }, - }, - }, - }, - { - name = 'applyForce', - description = 'Apply force to a Body.\n\nA force pushes a body in a direction. A body with with a larger mass will react less. The reaction also depends on how long a force is applied: since the force acts continuously over the entire timestep, a short timestep will only push the body for a short time. Thus forces are best used for many timesteps to give a continuous push to a body (like gravity). For a single push that is independent of timestep, it is better to use Body:applyLinearImpulse.\n\nIf the position to apply the force is not given, it will act on the center of mass of the body. The part of the force not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia).\n\nNote that the force components and position must be given in world coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'fx', - description = 'The x component of force to apply to the center of mass.', - }, - { - type = 'number', - name = 'fy', - description = 'The y component of force to apply to the center of mass.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'fx', - description = 'The x component of force to apply.', - }, - { - type = 'number', - name = 'fy', - description = 'The y component of force to apply.', - }, - { - type = 'number', - name = 'x', - description = 'The x position to apply the force.', - }, - { - type = 'number', - name = 'y', - description = 'The y position to apply the force.', - }, - }, - }, - }, - }, - { - name = 'applyLinearImpulse', - description = 'Applies an impulse to a body.\n\nThis makes a single, instantaneous addition to the body momentum.\n\nAn impulse pushes a body in a direction. A body with with a larger mass will react less. The reaction does \'\'\'not\'\'\' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce.\n\nIf the position to apply the impulse is not given, it will act on the center of mass of the body. The part of the impulse not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia). \n\nNote that the impulse components and position must be given in world coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ix', - description = 'The x component of the impulse applied to the center of mass.', - }, - { - type = 'number', - name = 'iy', - description = 'The y component of the impulse applied to the center of mass.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'ix', - description = 'The x component of the impulse.', - }, - { - type = 'number', - name = 'iy', - description = 'The y component of the impulse.', - }, - { - type = 'number', - name = 'x', - description = 'The x position to apply the impulse.', - }, - { - type = 'number', - name = 'y', - description = 'The y position to apply the impulse.', - }, - }, - }, - }, - }, - { - name = 'applyTorque', - description = 'Apply torque to a body.\n\nTorque is like a force that will change the angular velocity (spin) of a body. The effect will depend on the rotational inertia a body has.', - variants = { - { - arguments = { - { - type = 'number', - name = 'torque', - description = 'The torque to apply.', - }, - }, - }, - }, - }, - { - name = 'destroy', - description = 'Explicitly destroys the Body and all fixtures and joints attached to it.\n\nAn error will occur if you attempt to use the object after calling this function. In 0.7.2, when you don\'t have time to wait for garbage collection, this function may be used to free the object immediately.', - variants = { - { - }, - }, - }, - { - name = 'getAngle', - description = 'Get the angle of the body.\n\nThe angle is measured in radians. If you need to transform it to degrees, use math.deg.\n\nA value of 0 radians will mean \'looking to the right\'. Although radians increase counter-clockwise, the y axis points down so it becomes \'\'clockwise\'\' from our point of view.', - variants = { - { - returns = { - { - type = 'number', - name = 'angle', - description = 'The angle in radians.', - }, - }, - }, - }, - }, - { - name = 'getAngularDamping', - description = 'Gets the Angular damping of the Body\n\nThe angular damping is the \'\'rate of decrease of the angular velocity over time\'\': A spinning body with no damping and no external forces will continue spinning indefinitely. A spinning body with damping will gradually stop spinning.\n\nDamping is not the same as friction - they can be modelled together. However, only damping is provided by Box2D (and LOVE).\n\nDamping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity meaning full damping. Normally you will use a damping value between 0 and 0.1.', - variants = { - { - returns = { - { - type = 'number', - name = 'damping', - description = 'The value of the angular damping.', - }, - }, - }, - }, - }, - { - name = 'getAngularVelocity', - description = 'Get the angular velocity of the Body.\n\nThe angular velocity is the \'\'rate of change of angle over time\'\'.\n\nIt is changed in World:update by applying torques, off centre forces/impulses, and angular damping. It can be set directly with Body:setAngularVelocity.\n\nIf you need the \'\'rate of change of position over time\'\', use Body:getLinearVelocity.', - variants = { - { - returns = { - { - type = 'number', - name = 'w', - description = 'The angular velocity in radians/second.', - }, - }, - }, - }, - }, - { - name = 'getContacts', - description = 'Gets a list of all Contacts attached to the Body.', - variants = { - { - returns = { - { - type = 'table', - name = 'contacts', - description = 'A list with all contacts associated with the Body.', - }, - }, - }, - }, - }, - { - name = 'getFixtures', - description = 'Returns a table with all fixtures.', - variants = { - { - returns = { - { - type = 'table', - name = 'fixtures', - description = 'A sequence with all fixtures.', - }, - }, - }, - }, - }, - { - name = 'getGravityScale', - description = 'Returns the gravity scale factor.', - variants = { - { - returns = { - { - type = 'number', - name = 'scale', - description = 'The gravity scale factor.', - }, - }, - }, - }, - }, - { - name = 'getInertia', - description = 'Gets the rotational inertia of the body.\n\nThe rotational inertia is how hard is it to make the body spin.', - variants = { - { - returns = { - { - type = 'number', - name = 'inertia', - description = 'The rotational inertial of the body.', - }, - }, - }, - }, - }, - { - name = 'getJoints', - description = 'Returns a table containing the Joints attached to this Body.', - variants = { - { - returns = { - { - type = 'table', - name = 'joints', - description = 'A sequence with the Joints attached to the Body.', - }, - }, - }, - }, - }, - { - name = 'getLinearDamping', - description = 'Gets the linear damping of the Body.\n\nThe linear damping is the \'\'rate of decrease of the linear velocity over time\'\'. A moving body with no damping and no external forces will continue moving indefinitely, as is the case in space. A moving body with damping will gradually stop moving.\n\nDamping is not the same as friction - they can be modelled together.', - variants = { - { - returns = { - { - type = 'number', - name = 'damping', - description = 'The value of the linear damping.', - }, - }, - }, - }, - }, - { - name = 'getLinearVelocity', - description = 'Gets the linear velocity of the Body from its center of mass.\n\nThe linear velocity is the \'\'rate of change of position over time\'\'.\n\nIf you need the \'\'rate of change of angle over time\'\', use Body:getAngularVelocity.\n\nIf you need to get the linear velocity of a point different from the center of mass:\n\n* Body:getLinearVelocityFromLocalPoint allows you to specify the point in local coordinates.\n\n* Body:getLinearVelocityFromWorldPoint allows you to specify the point in world coordinates.\n\nSee page 136 of \'Essential Mathematics for Games and Interactive Applications\' for definitions of local and world coordinates.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the velocity vector', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the velocity vector', - }, - }, - }, - }, - }, - { - name = 'getLinearVelocityFromLocalPoint', - description = 'Get the linear velocity of a point on the body.\n\nThe linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.\n\nThe point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position to measure velocity.', - }, - { - type = 'number', - name = 'y', - description = 'The y position to measure velocity.', - }, - }, - returns = { - { - type = 'number', - name = 'vx', - description = 'The x component of velocity at point (x,y).', - }, - { - type = 'number', - name = 'vy', - description = 'The y component of velocity at point (x,y).', - }, - }, - }, - }, - }, - { - name = 'getLinearVelocityFromWorldPoint', - description = 'Get the linear velocity of a point on the body.\n\nThe linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.\n\nThe point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position to measure velocity.', - }, - { - type = 'number', - name = 'y', - description = 'The y position to measure velocity.', - }, - }, - returns = { - { - type = 'number', - name = 'vx', - description = 'The x component of velocity at point (x,y).', - }, - { - type = 'number', - name = 'vy', - description = 'The y component of velocity at point (x,y).', - }, - }, - }, - }, - }, - { - name = 'getLocalCenter', - description = 'Get the center of mass position in local coordinates.\n\nUse Body:getWorldCenter to get the center of mass in world coordinates.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x coordinate of the center of mass.', - }, - { - type = 'number', - name = 'y', - description = 'The y coordinate of the center of mass.', - }, - }, - }, - }, - }, - { - name = 'getLocalPoint', - description = 'Transform a point from world coordinates to local coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'worldX', - description = 'The x position in world coordinates.', - }, - { - type = 'number', - name = 'worldY', - description = 'The y position in world coordinates.', - }, - }, - returns = { - { - type = 'number', - name = 'localX', - description = 'The x position in local coordinates.', - }, - { - type = 'number', - name = 'localY', - description = 'The y position in local coordinates.', - }, - }, - }, - }, - }, - { - name = 'getLocalVector', - description = 'Transform a vector from world coordinates to local coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'worldX', - description = 'The vector x component in world coordinates.', - }, - { - type = 'number', - name = 'worldY', - description = 'The vector y component in world coordinates.', - }, - }, - returns = { - { - type = 'number', - name = 'localX', - description = 'The vector x component in local coordinates.', - }, - { - type = 'number', - name = 'localY', - description = 'The vector y component in local coordinates.', - }, - }, - }, - }, - }, - { - name = 'getMass', - description = 'Get the mass of the body.\n\nStatic bodies always have a mass of 0.', - variants = { - { - returns = { - { - type = 'number', - name = 'mass', - description = 'The mass of the body (in kilograms).', - }, - }, - }, - }, - }, - { - name = 'getMassData', - description = 'Returns the mass, its center, and the rotational inertia.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x position of the center of mass.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the center of mass.', - }, - { - type = 'number', - name = 'mass', - description = 'The mass of the body.', - }, - { - type = 'number', - name = 'inertia', - description = 'The rotational inertia.', - }, - }, - }, - }, - }, - { - name = 'getPosition', - description = 'Get the position of the body.\n\nNote that this may not be the center of mass of the body.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x position.', - }, - { - type = 'number', - name = 'y', - description = 'The y position.', - }, - }, - }, - }, - }, - { - name = 'getTransform', - description = 'Get the position and angle of the body.\n\nNote that the position may not be the center of mass of the body. An angle of 0 radians will mean \'looking to the right\'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x component of the position.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of the position.', - }, - { - type = 'number', - name = 'angle', - description = 'The angle in radians.', - }, - }, - }, - }, - }, - { - name = 'getType', - description = 'Returns the type of the body.', - variants = { - { - returns = { - { - type = 'BodyType', - name = 'type', - description = 'The body type.', - }, - }, - }, - }, - }, - { - name = 'getUserData', - description = 'Returns the Lua value associated with this Body.', - variants = { - { - returns = { - { - type = 'any', - name = 'value', - description = 'The Lua value associated with the Body.', - }, - }, - }, - }, - }, - { - name = 'getWorld', - description = 'Gets the World the body lives in.', - variants = { - { - returns = { - { - type = 'World', - name = 'world', - description = 'The world the body lives in.', - }, - }, - }, - }, - }, - { - name = 'getWorldCenter', - description = 'Get the center of mass position in world coordinates.\n\nUse Body:getLocalCenter to get the center of mass in local coordinates.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x coordinate of the center of mass.', - }, - { - type = 'number', - name = 'y', - description = 'The y coordinate of the center of mass.', - }, - }, - }, - }, - }, - { - name = 'getWorldPoint', - description = 'Transform a point from local coordinates to world coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'localX', - description = 'The x position in local coordinates.', - }, - { - type = 'number', - name = 'localY', - description = 'The y position in local coordinates.', - }, - }, - returns = { - { - type = 'number', - name = 'worldX', - description = 'The x position in world coordinates.', - }, - { - type = 'number', - name = 'worldY', - description = 'The y position in world coordinates.', - }, - }, - }, - }, - }, - { - name = 'getWorldPoints', - description = 'Transforms multiple points from local coordinates to world coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x1', - description = 'The x position of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the second point.', - }, - }, - returns = { - { - type = 'number', - name = 'x1', - description = 'The transformed x position of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The transformed y position of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The transformed x position of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The transformed y position of the second point.', - }, - }, - }, - }, - }, - { - name = 'getWorldVector', - description = 'Transform a vector from local coordinates to world coordinates.', - variants = { - { - arguments = { - { - type = 'number', - name = 'localX', - description = 'The vector x component in local coordinates.', - }, - { - type = 'number', - name = 'localY', - description = 'The vector y component in local coordinates.', - }, - }, - returns = { - { - type = 'number', - name = 'worldX', - description = 'The vector x component in world coordinates.', - }, - { - type = 'number', - name = 'worldY', - description = 'The vector y component in world coordinates.', - }, - }, - }, - }, - }, - { - name = 'getX', - description = 'Get the x position of the body in world coordinates.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x position in world coordinates.', - }, - }, - }, - }, - }, - { - name = 'getY', - description = 'Get the y position of the body in world coordinates.', - variants = { - { - returns = { - { - type = 'number', - name = 'y', - description = 'The y position in world coordinates.', - }, - }, - }, - }, - }, - { - name = 'isActive', - description = 'Returns whether the body is actively used in the simulation.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'status', - description = 'True if the body is active or false if not.', - }, - }, - }, - }, - }, - { - name = 'isAwake', - description = 'Returns the sleep status of the body.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'status', - description = 'True if the body is awake or false if not.', - }, - }, - }, - }, - }, - { - name = 'isBullet', - description = 'Get the bullet status of a body.\n\nThere are two methods to check for body collisions:\n\n* at their location when the world is updated (default)\n\n* using continuous collision detection (CCD)\n\nThe default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.\n\nNote that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'status', - description = 'The bullet status of the body.', - }, - }, - }, - }, - }, - { - name = 'isDestroyed', - description = 'Gets whether the Body is destroyed. Destroyed bodies cannot be used.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'destroyed', - description = 'Whether the Body is destroyed.', - }, - }, - }, - }, - }, - { - name = 'isFixedRotation', - description = 'Returns whether the body rotation is locked.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'fixed', - description = 'True if the body\'s rotation is locked or false if not.', - }, - }, - }, - }, - }, - { - name = 'isSleepingAllowed', - description = 'Returns the sleeping behaviour of the body.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'allowed', - description = 'True if the body is allowed to sleep or false if not.', - }, - }, - }, - }, - }, - { - name = 'isTouching', - description = 'Gets whether the Body is touching the given other Body.', - variants = { - { - arguments = { - { - type = 'Body', - name = 'otherbody', - description = 'The other body to check.', - }, - }, - returns = { - { - type = 'boolean', - name = 'touching', - description = 'True if this body is touching the other body, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'resetMassData', - description = 'Resets the mass of the body by recalculating it from the mass properties of the fixtures.', - variants = { - { - }, - }, - }, - { - name = 'setActive', - description = 'Sets whether the body is active in the world.\n\nAn inactive body does not take part in the simulation. It will not move or cause any collisions.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'active', - description = 'If the body is active or not.', - }, - }, - }, - }, - }, - { - name = 'setAngle', - description = 'Set the angle of the body.\n\nThe angle is measured in radians. If you need to transform it from degrees, use math.rad.\n\nA value of 0 radians will mean \'looking to the right\'. Although radians increase counter-clockwise, the y axis points down so it becomes \'\'clockwise\'\' from our point of view.\n\nIt is possible to cause a collision with another body by changing its angle. ', - variants = { - { - arguments = { - { - type = 'number', - name = 'angle', - description = 'The angle in radians.', - }, - }, - }, - }, - }, - { - name = 'setAngularDamping', - description = 'Sets the angular damping of a Body\n\nSee Body:getAngularDamping for a definition of angular damping.\n\nAngular damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will look unrealistic.', - variants = { - { - arguments = { - { - type = 'number', - name = 'damping', - description = 'The new angular damping.', - }, - }, - }, - }, - }, - { - name = 'setAngularVelocity', - description = 'Sets the angular velocity of a Body.\n\nThe angular velocity is the \'\'rate of change of angle over time\'\'.\n\nThis function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. ', - variants = { - { - arguments = { - { - type = 'number', - name = 'w', - description = 'The new angular velocity, in radians per second', - }, - }, - }, - }, - }, - { - name = 'setAwake', - description = 'Wakes the body up or puts it to sleep.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'awake', - description = 'The body sleep status.', - }, - }, - }, - }, - }, - { - name = 'setBullet', - description = 'Set the bullet status of a body.\n\nThere are two methods to check for body collisions:\n\n* at their location when the world is updated (default)\n\n* using continuous collision detection (CCD)\n\nThe default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.\n\nNote that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'status', - description = 'The bullet status of the body.', - }, - }, - }, - }, - }, - { - name = 'setFixedRotation', - description = 'Set whether a body has fixed rotation.\n\nBodies with fixed rotation don\'t vary the speed at which they rotate. Calling this function causes the mass to be reset. ', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'isFixed', - description = 'Whether the body should have fixed rotation.', - }, - }, - }, - }, - }, - { - name = 'setGravityScale', - description = 'Sets a new gravity scale factor for the body.', - variants = { - { - arguments = { - { - type = 'number', - name = 'scale', - description = 'The new gravity scale factor.', - }, - }, - }, - }, - }, - { - name = 'setInertia', - description = 'Set the inertia of a body.', - variants = { - { - arguments = { - { - type = 'number', - name = 'inertia', - description = 'The new moment of inertia, in kilograms * pixel squared.', - }, - }, - }, - }, - }, - { - name = 'setLinearDamping', - description = 'Sets the linear damping of a Body\n\nSee Body:getLinearDamping for a definition of linear damping.\n\nLinear damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will make the objects look \'floaty\'(if gravity is enabled).', - variants = { - { - arguments = { - { - type = 'number', - name = 'ld', - description = 'The new linear damping', - }, - }, - }, - }, - }, - { - name = 'setLinearVelocity', - description = 'Sets a new linear velocity for the Body.\n\nThis function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the velocity vector.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the velocity vector.', - }, - }, - }, - }, - }, - { - name = 'setMass', - description = 'Sets a new body mass.', - variants = { - { - arguments = { - { - type = 'number', - name = 'mass', - description = 'The mass, in kilograms.', - }, - }, - }, - }, - }, - { - name = 'setMassData', - description = 'Overrides the calculated mass data.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position of the center of mass.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the center of mass.', - }, - { - type = 'number', - name = 'mass', - description = 'The mass of the body.', - }, - { - type = 'number', - name = 'inertia', - description = 'The rotational inertia.', - }, - }, - }, - }, - }, - { - name = 'setPosition', - description = 'Set the position of the body.\n\nNote that this may not be the center of mass of the body.\n\nThis function cannot wake up the body.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position.', - }, - { - type = 'number', - name = 'y', - description = 'The y position.', - }, - }, - }, - }, - }, - { - name = 'setSleepingAllowed', - description = 'Sets the sleeping behaviour of the body. Should sleeping be allowed, a body at rest will automatically sleep. A sleeping body is not simulated unless it collided with an awake body. Be wary that one can end up with a situation like a floating sleeping body if the floor was removed.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'allowed', - description = 'True if the body is allowed to sleep or false if not.', - }, - }, - }, - }, - }, - { - name = 'setTransform', - description = 'Set the position and angle of the body.\n\nNote that the position may not be the center of mass of the body. An angle of 0 radians will mean \'looking to the right\'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view.\n\nThis function cannot wake up the body.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x component of the position.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of the position.', - }, - { - type = 'number', - name = 'angle', - description = 'The angle in radians.', - }, - }, - }, - }, - }, - { - name = 'setType', - description = 'Sets a new body type.', - variants = { - { - arguments = { - { - type = 'BodyType', - name = 'type', - description = 'The new type.', - }, - }, - }, - }, - }, - { - name = 'setUserData', - description = 'Associates a Lua value with the Body.\n\nTo delete the reference, explicitly pass nil.', - variants = { - { - arguments = { - { - type = 'any', - name = 'value', - description = 'The Lua value to associate with the Body.', - }, - }, - }, - }, - }, - { - name = 'setX', - description = 'Set the x position of the body.\n\nThis function cannot wake up the body. ', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position.', - }, - }, - }, - }, - }, - { - name = 'setY', - description = 'Set the y position of the body.\n\nThis function cannot wake up the body. ', - variants = { - { - arguments = { - { - type = 'number', - name = 'y', - description = 'The y position.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/ChainShape.lua b/modules/physics/types/ChainShape.lua deleted file mode 100644 index a925803..0000000 --- a/modules/physics/types/ChainShape.lua +++ /dev/null @@ -1,189 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'ChainShape', - description = 'A ChainShape consists of multiple line segments. It can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape.\n\nUnlike the PolygonShape, the ChainShape does not have a vertices limit or has to form a convex shape, but self intersections are not supported.', - constructors = { - 'newChainShape', - }, - supertypes = { - 'Shape', - 'Object', - }, - functions = { - { - name = 'getChildEdge', - description = 'Returns a child of the shape as an EdgeShape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'index', - description = 'The index of the child.', - }, - }, - returns = { - { - type = 'EdgeShape', - name = 'shape', - description = 'The child as an EdgeShape.', - }, - }, - }, - }, - }, - { - name = 'getNextVertex', - description = 'Gets the vertex that establishes a connection to the next shape.\n\nSetting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex, or nil if ChainShape:setNextVertex hasn\'t been called.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex, or nil if ChainShape:setNextVertex hasn\'t been called.', - }, - }, - }, - }, - }, - { - name = 'getPoint', - description = 'Returns a point of the shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'index', - description = 'The index of the point to return.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'The x-coordinate of the point.', - }, - { - type = 'number', - name = 'y', - description = 'The y-coordinate of the point.', - }, - }, - }, - }, - }, - { - name = 'getPoints', - description = 'Returns all points of the shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'x1', - description = 'The x-coordinate of the first point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y-coordinate of the first point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x-coordinate of the second point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y-coordinate of the second point.', - }, - }, - }, - }, - }, - { - name = 'getPreviousVertex', - description = 'Gets the vertex that establishes a connection to the previous shape.\n\nSetting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex, or nil if ChainShape:setPreviousVertex hasn\'t been called.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex, or nil if ChainShape:setPreviousVertex hasn\'t been called.', - }, - }, - }, - }, - }, - { - name = 'getVertexCount', - description = 'Returns the number of vertices the shape has.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The number of vertices.', - }, - }, - }, - }, - }, - { - name = 'setNextVertex', - description = 'Sets a vertex that establishes a connection to the next shape.\n\nThis can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex.', - }, - }, - }, - }, - }, - { - name = 'setPreviousVertex', - description = 'Sets a vertex that establishes a connection to the previous shape.\n\nThis can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/CircleShape.lua b/modules/physics/types/CircleShape.lua deleted file mode 100644 index f826093..0000000 --- a/modules/physics/types/CircleShape.lua +++ /dev/null @@ -1,85 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'CircleShape', - description = 'Circle extends Shape and adds a radius and a local position.', - constructors = { - 'newCircleShape', - }, - supertypes = { - 'Shape', - 'Object', - }, - functions = { - { - name = 'getPoint', - description = 'Gets the center point of the circle shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the center point of the circle.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the center point of the circle.', - }, - }, - }, - }, - }, - { - name = 'getRadius', - description = 'Gets the radius of the circle shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'radius', - description = 'The radius of the circle', - }, - }, - }, - }, - }, - { - name = 'setPoint', - description = 'Sets the location of the center of the circle shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the new center point of the circle.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the new center point of the circle.', - }, - }, - }, - }, - }, - { - name = 'setRadius', - description = 'Sets the radius of the circle.', - variants = { - { - arguments = { - { - type = 'number', - name = 'radius', - description = 'The radius of the circle', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/Contact.lua b/modules/physics/types/Contact.lua deleted file mode 100644 index 539f679..0000000 --- a/modules/physics/types/Contact.lua +++ /dev/null @@ -1,202 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Contact', - description = 'Contacts are objects created to manage collisions in worlds.', - supertypes = { - 'Object', - }, - functions = { - { - name = 'getFixtures', - description = 'Gets the two Fixtures that hold the shapes that are in contact.', - variants = { - { - returns = { - { - type = 'Fixture', - name = 'fixtureA', - description = 'The first Fixture.', - }, - { - type = 'Fixture', - name = 'fixtureB', - description = 'The second Fixture.', - }, - }, - }, - }, - }, - { - name = 'getFriction', - description = 'Get the friction between two shapes that are in contact.', - variants = { - { - returns = { - { - type = 'number', - name = 'friction', - description = 'The friction of the contact.', - }, - }, - }, - }, - }, - { - name = 'getNormal', - description = 'Get the normal vector between two shapes that are in contact.\n\nThis function returns the coordinates of a unit vector that points from the first shape to the second.', - variants = { - { - returns = { - { - type = 'number', - name = 'nx', - description = 'The x component of the normal vector.', - }, - { - type = 'number', - name = 'ny', - description = 'The y component of the normal vector.', - }, - }, - }, - }, - }, - { - name = 'getPositions', - description = 'Returns the contact points of the two colliding fixtures. There can be one or two points.', - variants = { - { - returns = { - { - type = 'number', - name = 'x1', - description = 'The x coordinate of the first contact point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y coordinate of the first contact point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x coordinate of the second contact point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y coordinate of the second contact point.', - }, - }, - }, - }, - }, - { - name = 'getRestitution', - description = 'Get the restitution between two shapes that are in contact.', - variants = { - { - returns = { - { - type = 'number', - name = 'restitution', - description = 'The restitution between the two shapes.', - }, - }, - }, - }, - }, - { - name = 'isEnabled', - description = 'Returns whether the contact is enabled. The collision will be ignored if a contact gets disabled in the preSolve callback.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if enabled, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isTouching', - description = 'Returns whether the two colliding fixtures are touching each other.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'touching', - description = 'True if they touch or false if not.', - }, - }, - }, - }, - }, - { - name = 'resetFriction', - description = 'Resets the contact friction to the mixture value of both fixtures.', - variants = { - { - }, - }, - }, - { - name = 'resetRestitution', - description = 'Resets the contact restitution to the mixture value of both fixtures.', - variants = { - { - }, - }, - }, - { - name = 'setEnabled', - description = 'Enables or disables the contact.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enabled', - description = 'True to enable or false to disable.', - }, - }, - }, - }, - }, - { - name = 'setFriction', - description = 'Sets the contact friction.', - variants = { - { - arguments = { - { - type = 'number', - name = 'friction', - description = 'The contact friction.', - }, - }, - }, - }, - }, - { - name = 'setRestitution', - description = 'Sets the contact restitution.', - variants = { - { - arguments = { - { - type = 'number', - name = 'restitution', - description = 'The contact restitution.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/DistanceJoint.lua b/modules/physics/types/DistanceJoint.lua deleted file mode 100644 index da1f532..0000000 --- a/modules/physics/types/DistanceJoint.lua +++ /dev/null @@ -1,105 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'DistanceJoint', - description = 'Keeps two bodies at the same distance.', - constructors = { - 'newDistanceJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getDampingRatio', - description = 'Gets the damping ratio.', - variants = { - { - returns = { - { - type = 'number', - name = 'ratio', - description = 'The damping ratio.', - }, - }, - }, - }, - }, - { - name = 'getFrequency', - description = 'Gets the response speed.', - variants = { - { - returns = { - { - type = 'number', - name = 'Hz', - description = 'The response speed.', - }, - }, - }, - }, - }, - { - name = 'getLength', - description = 'Gets the equilibrium distance between the two Bodies.', - variants = { - { - returns = { - { - type = 'number', - name = 'l', - description = 'The length between the two Bodies.', - }, - }, - }, - }, - }, - { - name = 'setDampingRatio', - description = 'Sets the damping ratio.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ratio', - description = 'The damping ratio.', - }, - }, - }, - }, - }, - { - name = 'setFrequency', - description = 'Sets the response speed.', - variants = { - { - arguments = { - { - type = 'number', - name = 'Hz', - description = 'The response speed.', - }, - }, - }, - }, - }, - { - name = 'setLength', - description = 'Sets the equilibrium distance between the two Bodies.', - variants = { - { - arguments = { - { - type = 'number', - name = 'l', - description = 'The length between the two Bodies.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/EdgeShape.lua b/modules/physics/types/EdgeShape.lua deleted file mode 100644 index a2c03b8..0000000 --- a/modules/physics/types/EdgeShape.lua +++ /dev/null @@ -1,125 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'EdgeShape', - description = 'A EdgeShape is a line segment. They can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape.', - constructors = { - 'newEdgeShape', - }, - supertypes = { - 'Shape', - 'Object', - }, - functions = { - { - name = 'getNextVertex', - description = 'Gets the vertex that establishes a connection to the next shape.\n\nSetting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex, or nil if EdgeShape:setNextVertex hasn\'t been called.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex, or nil if EdgeShape:setNextVertex hasn\'t been called.', - }, - }, - }, - }, - }, - { - name = 'getPoints', - description = 'Returns the local coordinates of the edge points.', - variants = { - { - returns = { - { - type = 'number', - name = 'x1', - description = 'The x-component of the first vertex.', - }, - { - type = 'number', - name = 'y1', - description = 'The y-component of the first vertex.', - }, - { - type = 'number', - name = 'x2', - description = 'The x-component of the second vertex.', - }, - { - type = 'number', - name = 'y2', - description = 'The y-component of the second vertex.', - }, - }, - }, - }, - }, - { - name = 'getPreviousVertex', - description = 'Gets the vertex that establishes a connection to the previous shape.\n\nSetting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn\'t been called.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn\'t been called.', - }, - }, - }, - }, - }, - { - name = 'setNextVertex', - description = 'Sets a vertex that establishes a connection to the next shape.\n\nThis can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex.', - }, - }, - }, - }, - }, - { - name = 'setPreviousVertex', - description = 'Sets a vertex that establishes a connection to the previous shape.\n\nThis can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the vertex.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the vertex.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/Fixture.lua b/modules/physics/types/Fixture.lua deleted file mode 100644 index ee6995c..0000000 --- a/modules/physics/types/Fixture.lua +++ /dev/null @@ -1,530 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Fixture', - description = 'Fixtures attach shapes to bodies.', - constructors = { - 'newFixture', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'destroy', - description = 'Destroys the fixture.', - variants = { - { - }, - }, - }, - { - name = 'getBody', - description = 'Returns the body to which the fixture is attached.', - variants = { - { - returns = { - { - type = 'Body', - name = 'body', - description = 'The parent body.', - }, - }, - }, - }, - }, - { - name = 'getBoundingBox', - description = 'Returns the points of the fixture bounding box. In case the fixture has multiple children a 1-based index can be specified. For example, a fixture will have multiple children with a chain shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'index', - description = 'A bounding box of the fixture.', - default = '1', - }, - }, - returns = { - { - type = 'number', - name = 'topLeftX', - description = 'The x position of the top-left point.', - }, - { - type = 'number', - name = 'topLeftY', - description = 'The y position of the top-left point.', - }, - { - type = 'number', - name = 'bottomRightX', - description = 'The x position of the bottom-right point.', - }, - { - type = 'number', - name = 'bottomRightY', - description = 'The y position of the bottom-right point.', - }, - }, - }, - }, - }, - { - name = 'getCategory', - description = 'Returns the categories the fixture belongs to.', - variants = { - { - returns = { - { - type = 'number', - name = 'category1', - description = 'The first category.', - }, - { - type = 'number', - name = 'category2', - description = 'The second category.', - }, - }, - }, - }, - }, - { - name = 'getDensity', - description = 'Returns the density of the fixture.', - variants = { - { - returns = { - { - type = 'number', - name = 'density', - description = 'The fixture density in kilograms per square meter.', - }, - }, - }, - }, - }, - { - name = 'getFilterData', - description = 'Returns the filter data of the fixture.\n\nCategories and masks are encoded as the bits of a 16-bit integer.', - variants = { - { - returns = { - { - type = 'number', - name = 'categories', - description = 'The categories as an integer from 0 to 65535.', - }, - { - type = 'number', - name = 'mask', - description = 'The mask as an integer from 0 to 65535.', - }, - { - type = 'number', - name = 'group', - description = 'The group as an integer from -32768 to 32767.', - }, - }, - }, - }, - }, - { - name = 'getFriction', - description = 'Returns the friction of the fixture.', - variants = { - { - returns = { - { - type = 'number', - name = 'friction', - description = 'The fixture friction.', - }, - }, - }, - }, - }, - { - name = 'getGroupIndex', - description = 'Returns the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it\'s negative. The group zero means no group.\n\nThe groups range from -32768 to 32767.', - variants = { - { - returns = { - { - type = 'number', - name = 'group', - description = 'The group of the fixture.', - }, - }, - }, - }, - }, - { - name = 'getMask', - description = 'Returns which categories this fixture should \'\'\'NOT\'\'\' collide with.', - variants = { - { - returns = { - { - type = 'number', - name = 'mask1', - description = 'The first category selected by the mask.', - }, - { - type = 'number', - name = 'mask2', - description = 'The second category selected by the mask.', - }, - }, - }, - }, - }, - { - name = 'getMassData', - description = 'Returns the mass, its center and the rotational inertia.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x position of the center of mass.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the center of mass.', - }, - { - type = 'number', - name = 'mass', - description = 'The mass of the fixture.', - }, - { - type = 'number', - name = 'inertia', - description = 'The rotational inertia.', - }, - }, - }, - }, - }, - { - name = 'getRestitution', - description = 'Returns the restitution of the fixture.', - variants = { - { - returns = { - { - type = 'number', - name = 'restitution', - description = 'The fixture restitution.', - }, - }, - }, - }, - }, - { - name = 'getShape', - description = 'Returns the shape of the fixture. This shape is a reference to the actual data used in the simulation. It\'s possible to change its values between timesteps.', - variants = { - { - returns = { - { - type = 'Shape', - name = 'shape', - description = 'The fixture\'s shape.', - }, - }, - }, - }, - }, - { - name = 'getUserData', - description = 'Returns the Lua value associated with this fixture.', - variants = { - { - returns = { - { - type = 'any', - name = 'value', - description = 'The Lua value associated with the fixture.', - }, - }, - }, - }, - }, - { - name = 'isDestroyed', - description = 'Gets whether the Fixture is destroyed. Destroyed fixtures cannot be used.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'destroyed', - description = 'Whether the Fixture is destroyed.', - }, - }, - }, - }, - }, - { - name = 'isSensor', - description = 'Returns whether the fixture is a sensor.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'sensor', - description = 'If the fixture is a sensor.', - }, - }, - }, - }, - }, - { - name = 'rayCast', - description = 'Casts a ray against the shape of the fixture and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned.\n\nThe ray starts on the first point of the input line and goes towards the second point of the line. The fifth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.\n\nThe childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.\n\nThe world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.\n\nhitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction', - variants = { - { - arguments = { - { - type = 'number', - name = 'x1', - description = 'The x position of the input line starting point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the input line starting point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the input line end point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the input line end point.', - }, - { - type = 'number', - name = 'maxFraction', - description = 'Ray length parameter.', - }, - { - type = 'number', - name = 'childIndex', - description = 'The index of the child the ray gets cast against.', - default = '1', - }, - }, - returns = { - { - type = 'number', - name = 'xn', - description = 'The x component of the normal vector of the edge where the ray hit the shape.', - }, - { - type = 'number', - name = 'yn', - description = 'The y component of the normal vector of the edge where the ray hit the shape.', - }, - { - type = 'number', - name = 'fraction', - description = 'The position on the input line where the intersection happened as a factor of the line length.', - }, - }, - }, - }, - }, - { - name = 'setCategory', - description = 'Sets the categories the fixture belongs to. There can be up to 16 categories represented as a number from 1 to 16.\n\nAll fixture\'s default category is 1.', - variants = { - { - arguments = { - { - type = 'number', - name = 'category1', - description = 'The first category.', - }, - { - type = 'number', - name = 'category2', - description = 'The second category.', - }, - }, - }, - }, - }, - { - name = 'setDensity', - description = 'Sets the density of the fixture. Call Body:resetMassData if this needs to take effect immediately.', - variants = { - { - arguments = { - { - type = 'number', - name = 'density', - description = 'The fixture density in kilograms per square meter.', - }, - }, - }, - }, - }, - { - name = 'setFilterData', - description = 'Sets the filter data of the fixture.\n\nGroups, categories, and mask can be used to define the collision behaviour of the fixture.\n\nIf two fixtures are in the same group they either always collide if the group is positive, or never collide if it\'s negative. If the group is zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that\'s not the case. If they do have each other\'s categories selected, the return value of the custom contact filter will be used. They always collide if none was set.\n\nThere can be up to 16 categories. Categories and masks are encoded as the bits of a 16-bit integer.\n\nWhen created, prior to calling this function, all fixtures have category set to 1, mask set to 65535 (all categories) and group set to 0.\n\nThis function allows setting all filter data for a fixture at once. To set only the categories, the mask or the group, you can use Fixture:setCategory, Fixture:setMask or Fixture:setGroupIndex respectively.', - variants = { - { - arguments = { - { - type = 'number', - name = 'categories', - description = 'The categories as an integer from 0 to 65535.', - }, - { - type = 'number', - name = 'mask', - description = 'The mask as an integer from 0 to 65535.', - }, - { - type = 'number', - name = 'group', - description = 'The group as an integer from -32768 to 32767.', - }, - }, - }, - }, - }, - { - name = 'setFriction', - description = 'Sets the friction of the fixture.\n\nFriction determines how shapes react when they \'slide\' along other shapes. Low friction indicates a slippery surface, like ice, while high friction indicates a rough surface, like concrete. Range: 0.0 - 1.0.', - variants = { - { - arguments = { - { - type = 'number', - name = 'friction', - description = 'The fixture friction.', - }, - }, - }, - }, - }, - { - name = 'setGroupIndex', - description = 'Sets the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it\'s negative. The group zero means no group.\n\nThe groups range from -32768 to 32767.', - variants = { - { - arguments = { - { - type = 'number', - name = 'group', - description = 'The group as an integer from -32768 to 32767.', - }, - }, - }, - }, - }, - { - name = 'setMask', - description = 'Sets the category mask of the fixture. There can be up to 16 categories represented as a number from 1 to 16.\n\nThis fixture will \'\'\'NOT\'\'\' collide with the fixtures that are in the selected categories if the other fixture also has a category of this fixture selected.', - variants = { - { - arguments = { - { - type = 'number', - name = 'mask1', - description = 'The first category.', - }, - { - type = 'number', - name = 'mask2', - description = 'The second category.', - }, - }, - }, - }, - }, - { - name = 'setRestitution', - description = 'Sets the restitution of the fixture.', - variants = { - { - arguments = { - { - type = 'number', - name = 'restitution', - description = 'The fixture restitution.', - }, - }, - }, - }, - }, - { - name = 'setSensor', - description = 'Sets whether the fixture should act as a sensor.\n\nSensors do not cause collision responses, but the begin-contact and end-contact World callbacks will still be called for this fixture.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'sensor', - description = 'The sensor status.', - }, - }, - }, - }, - }, - { - name = 'setUserData', - description = 'Associates a Lua value with the fixture.\n\nTo delete the reference, explicitly pass nil.', - variants = { - { - arguments = { - { - type = 'any', - name = 'value', - description = 'The Lua value to associate with the fixture.', - }, - }, - }, - }, - }, - { - name = 'testPoint', - description = 'Checks if a point is inside the shape of the fixture.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x position of the point.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the point.', - }, - }, - returns = { - { - type = 'boolean', - name = 'isInside', - description = 'True if the point is inside or false if it is outside.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/FrictionJoint.lua b/modules/physics/types/FrictionJoint.lua deleted file mode 100644 index 932a11e..0000000 --- a/modules/physics/types/FrictionJoint.lua +++ /dev/null @@ -1,75 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'FrictionJoint', - description = 'A FrictionJoint applies friction to a body.', - constructors = { - 'newFrictionJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getMaxForce', - description = 'Gets the maximum friction force in Newtons.', - variants = { - { - returns = { - { - type = 'number', - name = 'force', - description = 'Maximum force in Newtons.', - }, - }, - }, - }, - }, - { - name = 'getMaxTorque', - description = 'Gets the maximum friction torque in Newton-meters.', - variants = { - { - returns = { - { - type = 'number', - name = 'torque', - description = 'Maximum torque in Newton-meters.', - }, - }, - }, - }, - }, - { - name = 'setMaxForce', - description = 'Sets the maximum friction force in Newtons.', - variants = { - { - arguments = { - { - type = 'number', - name = 'maxForce', - description = 'Max force in Newtons.', - }, - }, - }, - }, - }, - { - name = 'setMaxTorque', - description = 'Sets the maximum friction torque in Newton-meters.', - variants = { - { - arguments = { - { - type = 'number', - name = 'torque', - description = 'Maximum torque in Newton-meters.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/GearJoint.lua b/modules/physics/types/GearJoint.lua deleted file mode 100644 index 95ada1b..0000000 --- a/modules/physics/types/GearJoint.lua +++ /dev/null @@ -1,65 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'GearJoint', - description = 'Keeps bodies together in such a way that they act like gears.', - constructors = { - 'newGearJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getJoints', - description = 'Get the Joints connected by this GearJoint.', - variants = { - { - returns = { - { - type = 'Joint', - name = 'joint1', - description = 'The first connected Joint.', - }, - { - type = 'Joint', - name = 'joint2', - description = 'The second connected Joint.', - }, - }, - }, - }, - }, - { - name = 'getRatio', - description = 'Get the ratio of a gear joint.', - variants = { - { - returns = { - { - type = 'number', - name = 'ratio', - description = 'The ratio of the joint.', - }, - }, - }, - }, - }, - { - name = 'setRatio', - description = 'Set the ratio of a gear joint.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ratio', - description = 'The new ratio of the joint.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/Joint.lua b/modules/physics/types/Joint.lua deleted file mode 100644 index 714aca4..0000000 --- a/modules/physics/types/Joint.lua +++ /dev/null @@ -1,193 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Joint', - description = 'Attach multiple bodies together to interact in unique ways.', - supertypes = { - 'Object', - }, - functions = { - { - name = 'destroy', - description = 'Explicitly destroys the Joint. An error will occur if you attempt to use the object after calling this function.\n\nIn 0.7.2, when you don\'t have time to wait for garbage collection, this function \n\nmay be used to free the object immediately.', - variants = { - { - }, - }, - }, - { - name = 'getAnchors', - description = 'Get the anchor points of the joint.', - variants = { - { - returns = { - { - type = 'number', - name = 'x1', - description = 'The x-component of the anchor on Body 1.', - }, - { - type = 'number', - name = 'y1', - description = 'The y-component of the anchor on Body 1.', - }, - { - type = 'number', - name = 'x2', - description = 'The x-component of the anchor on Body 2.', - }, - { - type = 'number', - name = 'y2', - description = 'The y-component of the anchor on Body 2.', - }, - }, - }, - }, - }, - { - name = 'getBodies', - description = 'Gets the bodies that the Joint is attached to.', - variants = { - { - returns = { - { - type = 'Body', - name = 'bodyA', - description = 'The first Body.', - }, - { - type = 'Body', - name = 'bodyB', - description = 'The second Body.', - }, - }, - }, - }, - }, - { - name = 'getCollideConnected', - description = 'Gets whether the connected Bodies collide.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'c', - description = 'True if they collide, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'getReactionForce', - description = 'Returns the reaction force in newtons on the second body', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'How long the force applies. Usually the inverse time step or 1/dt.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the force.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the force.', - }, - }, - }, - }, - }, - { - name = 'getReactionTorque', - description = 'Returns the reaction torque on the second body.', - variants = { - { - arguments = { - { - type = 'number', - name = 'invdt', - description = 'How long the force applies. Usually the inverse time step or 1/dt.', - }, - }, - returns = { - { - type = 'number', - name = 'torque', - description = 'The reaction torque on the second body.', - }, - }, - }, - }, - }, - { - name = 'getType', - description = 'Gets a string representing the type.', - variants = { - { - returns = { - { - type = 'JointType', - name = 'type', - description = 'A string with the name of the Joint type.', - }, - }, - }, - }, - }, - { - name = 'getUserData', - description = 'Returns the Lua value associated with this Joint.', - variants = { - { - returns = { - { - type = 'any', - name = 'value', - description = 'The Lua value associated with the Joint.', - }, - }, - }, - }, - }, - { - name = 'isDestroyed', - description = 'Gets whether the Joint is destroyed. Destroyed joints cannot be used.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'destroyed', - description = 'Whether the Joint is destroyed.', - }, - }, - }, - }, - }, - { - name = 'setUserData', - description = 'Associates a Lua value with the Joint.\n\nTo delete the reference, explicitly pass nil.', - variants = { - { - arguments = { - { - type = 'any', - name = 'value', - description = 'The Lua value to associate with the Joint.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/MotorJoint.lua b/modules/physics/types/MotorJoint.lua deleted file mode 100644 index 8277ec9..0000000 --- a/modules/physics/types/MotorJoint.lua +++ /dev/null @@ -1,85 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'MotorJoint', - description = 'Controls the relative motion between two Bodies. Position and rotation offsets can be specified, as well as the maximum motor force and torque that will be applied to reach the target offsets.', - constructors = { - 'newMotorJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getAngularOffset', - description = 'Gets the target angular offset between the two Bodies the Joint is attached to.', - variants = { - { - returns = { - { - type = 'number', - name = 'angleoffset', - description = 'The target angular offset in radians: the second body\'s angle minus the first body\'s angle.', - }, - }, - }, - }, - }, - { - name = 'getLinearOffset', - description = 'Gets the target linear offset between the two Bodies the Joint is attached to.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x component of the target linear offset, relative to the first Body.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of the target linear offset, relative to the first Body.', - }, - }, - }, - }, - }, - { - name = 'setAngularOffset', - description = 'Sets the target angluar offset between the two Bodies the Joint is attached to.', - variants = { - { - arguments = { - { - type = 'number', - name = 'angleoffset', - description = 'The target angular offset in radians: the second body\'s angle minus the first body\'s angle.', - }, - }, - }, - }, - }, - { - name = 'setLinearOffset', - description = 'Sets the target linear offset between the two Bodies the Joint is attached to.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x component of the target linear offset, relative to the first Body.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of the target linear offset, relative to the first Body.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/MouseJoint.lua b/modules/physics/types/MouseJoint.lua deleted file mode 100644 index 079f9b2..0000000 --- a/modules/physics/types/MouseJoint.lua +++ /dev/null @@ -1,145 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'MouseJoint', - description = 'For controlling objects with the mouse.', - constructors = { - 'newMouseJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getDampingRatio', - description = 'Returns the damping ratio.', - variants = { - { - returns = { - { - type = 'number', - name = 'ratio', - description = 'The new damping ratio.', - }, - }, - }, - }, - }, - { - name = 'getFrequency', - description = 'Returns the frequency.', - variants = { - { - returns = { - { - type = 'number', - name = 'freq', - description = 'The frequency in hertz.', - }, - }, - }, - }, - }, - { - name = 'getMaxForce', - description = 'Gets the highest allowed force.', - variants = { - { - returns = { - { - type = 'number', - name = 'f', - description = 'The max allowed force.', - }, - }, - }, - }, - }, - { - name = 'getTarget', - description = 'Gets the target point.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-component of the target.', - }, - { - type = 'number', - name = 'y', - description = 'The x-component of the target.', - }, - }, - }, - }, - }, - { - name = 'setDampingRatio', - description = 'Sets a new damping ratio.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ratio', - description = 'The new damping ratio.', - }, - }, - }, - }, - }, - { - name = 'setFrequency', - description = 'Sets a new frequency.', - variants = { - { - arguments = { - { - type = 'number', - name = 'freq', - description = 'The new frequency in hertz.', - }, - }, - }, - }, - }, - { - name = 'setMaxForce', - description = 'Sets the highest allowed force.', - variants = { - { - arguments = { - { - type = 'number', - name = 'f', - description = 'The max allowed force.', - }, - }, - }, - }, - }, - { - name = 'setTarget', - description = 'Sets the target point.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-component of the target.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the target.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/PolygonShape.lua b/modules/physics/types/PolygonShape.lua deleted file mode 100644 index b24b049..0000000 --- a/modules/physics/types/PolygonShape.lua +++ /dev/null @@ -1,46 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'PolygonShape', - description = 'A PolygonShape is a convex polygon with up to 8 vertices.', - constructors = { - 'newPolygonShape', - 'newRectangleShape', - }, - supertypes = { - 'Shape', - 'Object', - }, - functions = { - { - name = 'getPoints', - description = 'Get the local coordinates of the polygon\'s vertices.\n\nThis function has a variable number of return values. It can be used in a nested fashion with love.graphics.polygon.', - variants = { - { - returns = { - { - type = 'number', - name = 'x1', - description = 'The x-component of the first vertex.', - }, - { - type = 'number', - name = 'y1', - description = 'The y-component of the first vertex.', - }, - { - type = 'number', - name = 'x2', - description = 'The x-component of the second vertex.', - }, - { - type = 'number', - name = 'y2', - description = 'The y-component of the second vertex.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/PrismaticJoint.lua b/modules/physics/types/PrismaticJoint.lua deleted file mode 100644 index ce9f332..0000000 --- a/modules/physics/types/PrismaticJoint.lua +++ /dev/null @@ -1,307 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'PrismaticJoint', - description = 'Restricts relative motion between Bodies to one shared axis.', - constructors = { - 'newPrismaticJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'areLimitsEnabled', - description = 'Checks whether the limits are enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if enabled, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'getAxis', - description = 'Gets the world-space axis vector of the Prismatic Joint.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-axis coordinate of the world-space axis vector.', - }, - { - type = 'number', - name = 'y', - description = 'The y-axis coordinate of the world-space axis vector.', - }, - }, - }, - }, - }, - { - name = 'getJointSpeed', - description = 'Get the current joint angle speed.', - variants = { - { - returns = { - { - type = 'number', - name = 's', - description = 'Joint angle speed in meters/second.', - }, - }, - }, - }, - }, - { - name = 'getJointTranslation', - description = 'Get the current joint translation.', - variants = { - { - returns = { - { - type = 'number', - name = 't', - description = 'Joint translation, usually in meters..', - }, - }, - }, - }, - }, - { - name = 'getLimits', - description = 'Gets the joint limits.', - variants = { - { - returns = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, usually in meters.', - }, - { - type = 'number', - name = 'upper', - description = 'The upper limit, usually in meters.', - }, - }, - }, - }, - }, - { - name = 'getLowerLimit', - description = 'Gets the lower limit.', - variants = { - { - returns = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, usually in meters.', - }, - }, - }, - }, - }, - { - name = 'getMaxMotorForce', - description = 'Gets the maximum motor force.', - variants = { - { - returns = { - { - type = 'number', - name = 'f', - description = 'The maximum motor force, usually in N.', - }, - }, - }, - }, - }, - { - name = 'getMotorForce', - description = 'Returns the current motor force.', - variants = { - { - arguments = { - { - type = 'number', - name = 'invdt', - description = 'How long the force applies. Usually the inverse time step or 1/dt.', - }, - }, - returns = { - { - type = 'number', - name = 'force', - description = 'The force on the motor in newtons.', - }, - }, - }, - }, - }, - { - name = 'getMotorSpeed', - description = 'Gets the motor speed.', - variants = { - { - returns = { - { - type = 'number', - name = 's', - description = 'The motor speed, usually in meters per second.', - }, - }, - }, - }, - }, - { - name = 'getUpperLimit', - description = 'Gets the upper limit.', - variants = { - { - returns = { - { - type = 'number', - name = 'upper', - description = 'The upper limit, usually in meters.', - }, - }, - }, - }, - }, - { - name = 'isMotorEnabled', - description = 'Checks whether the motor is enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if enabled, false if disabled.', - }, - }, - }, - }, - }, - { - name = 'setLimits', - description = 'Sets the limits.', - variants = { - { - arguments = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, usually in meters.', - }, - { - type = 'number', - name = 'upper', - description = 'The upper limit, usually in meters.', - }, - }, - }, - }, - }, - { - name = 'setLimitsEnabled', - description = 'Enables/disables the joint limit.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enable', - description = 'True if enabled, false if disabled.', - }, - }, - }, - }, - }, - { - name = 'setLowerLimit', - description = 'Sets the lower limit.', - variants = { - { - arguments = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, usually in meters.', - }, - }, - }, - }, - }, - { - name = 'setMaxMotorForce', - description = 'Set the maximum motor force.', - variants = { - { - arguments = { - { - type = 'number', - name = 'f', - description = 'The maximum motor force, usually in N.', - }, - }, - }, - }, - }, - { - name = 'setMotorEnabled', - description = 'Enables/disables the joint motor.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'True to enable, false to disable.', - }, - }, - }, - }, - }, - { - name = 'setMotorSpeed', - description = 'Sets the motor speed.', - variants = { - { - arguments = { - { - type = 'number', - name = 's', - description = 'The motor speed, usually in meters per second.', - }, - }, - }, - }, - }, - { - name = 'setUpperLimit', - description = 'Sets the upper limit.', - variants = { - { - arguments = { - { - type = 'number', - name = 'upper', - description = 'The upper limit, usually in meters.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/PulleyJoint.lua b/modules/physics/types/PulleyJoint.lua deleted file mode 100644 index f71fc68..0000000 --- a/modules/physics/types/PulleyJoint.lua +++ /dev/null @@ -1,175 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'PulleyJoint', - description = 'Allows you to simulate bodies connected through pulleys.', - constructors = { - 'newPulleyJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getConstant', - description = 'Get the total length of the rope.', - variants = { - { - returns = { - { - type = 'number', - name = 'length', - description = 'The length of the rope in the joint.', - }, - }, - }, - }, - }, - { - name = 'getGroundAnchors', - description = 'Get the ground anchor positions in world coordinates.', - variants = { - { - returns = { - { - type = 'number', - name = 'a1x', - description = 'The x coordinate of the first anchor.', - }, - { - type = 'number', - name = 'a1y', - description = 'The y coordinate of the first anchor.', - }, - { - type = 'number', - name = 'a2x', - description = 'The x coordinate of the second anchor.', - }, - { - type = 'number', - name = 'a2y', - description = 'The y coordinate of the second anchor.', - }, - }, - }, - }, - }, - { - name = 'getLengthA', - description = 'Get the current length of the rope segment attached to the first body.', - variants = { - { - returns = { - { - type = 'number', - name = 'length', - description = 'The length of the rope segment.', - }, - }, - }, - }, - }, - { - name = 'getLengthB', - description = 'Get the current length of the rope segment attached to the second body.', - variants = { - { - returns = { - { - type = 'number', - name = 'length', - description = 'The length of the rope segment.', - }, - }, - }, - }, - }, - { - name = 'getMaxLengths', - description = 'Get the maximum lengths of the rope segments.', - variants = { - { - returns = { - { - type = 'number', - name = 'len1', - description = 'The maximum length of the first rope segment.', - }, - { - type = 'number', - name = 'len2', - description = 'The maximum length of the second rope segment.', - }, - }, - }, - }, - }, - { - name = 'getRatio', - description = 'Get the pulley ratio.', - variants = { - { - returns = { - { - type = 'number', - name = 'ratio', - description = 'The pulley ratio of the joint.', - }, - }, - }, - }, - }, - { - name = 'setConstant', - description = 'Set the total length of the rope.\n\nSetting a new length for the rope updates the maximum length values of the joint.', - variants = { - { - arguments = { - { - type = 'number', - name = 'length', - description = 'The new length of the rope in the joint.', - }, - }, - }, - }, - }, - { - name = 'setMaxLengths', - description = 'Set the maximum lengths of the rope segments.\n\nThe physics module also imposes maximum values for the rope segments. If the parameters exceed these values, the maximum values are set instead of the requested values.', - variants = { - { - arguments = { - { - type = 'number', - name = 'max1', - description = 'The new maximum length of the first segment.', - }, - { - type = 'number', - name = 'max2', - description = 'The new maximum length of the second segment.', - }, - }, - }, - }, - }, - { - name = 'setRatio', - description = 'Set the pulley ratio.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ratio', - description = 'The new pulley ratio of the joint.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/RevoluteJoint.lua b/modules/physics/types/RevoluteJoint.lua deleted file mode 100644 index 68c055e..0000000 --- a/modules/physics/types/RevoluteJoint.lua +++ /dev/null @@ -1,295 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'RevoluteJoint', - description = 'Allow two Bodies to revolve around a shared point.', - constructors = { - 'newRevoluteJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'areLimitsEnabled', - description = 'Checks whether limits are enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if enabled, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'getJointAngle', - description = 'Get the current joint angle.', - variants = { - { - returns = { - { - type = 'number', - name = 'angle', - description = 'The joint angle in radians.', - }, - }, - }, - }, - }, - { - name = 'getJointSpeed', - description = 'Get the current joint angle speed.', - variants = { - { - returns = { - { - type = 'number', - name = 's', - description = 'Joint angle speed in radians/second.', - }, - }, - }, - }, - }, - { - name = 'getLimits', - description = 'Gets the joint limits.', - variants = { - { - returns = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, in radians.', - }, - { - type = 'number', - name = 'upper', - description = 'The upper limit, in radians.', - }, - }, - }, - }, - }, - { - name = 'getLowerLimit', - description = 'Gets the lower limit.', - variants = { - { - returns = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, in radians.', - }, - }, - }, - }, - }, - { - name = 'getMaxMotorTorque', - description = 'Gets the maximum motor force.', - variants = { - { - returns = { - { - type = 'number', - name = 'f', - description = 'The maximum motor force, in Nm.', - }, - }, - }, - }, - }, - { - name = 'getMotorSpeed', - description = 'Gets the motor speed.', - variants = { - { - returns = { - { - type = 'number', - name = 's', - description = 'The motor speed, radians per second.', - }, - }, - }, - }, - }, - { - name = 'getMotorTorque', - description = 'Get the current motor force.', - variants = { - { - returns = { - { - type = 'number', - name = 'f', - description = 'The current motor force, in Nm.', - }, - }, - }, - }, - }, - { - name = 'getUpperLimit', - description = 'Gets the upper limit.', - variants = { - { - returns = { - { - type = 'number', - name = 'upper', - description = 'The upper limit, in radians.', - }, - }, - }, - }, - }, - { - name = 'hasLimitsEnabled', - description = 'Checks whether limits are enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if enabled, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isMotorEnabled', - description = 'Checks whether the motor is enabled.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if enabled, false if disabled.', - }, - }, - }, - }, - }, - { - name = 'setLimits', - description = 'Sets the limits.', - variants = { - { - arguments = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, in radians.', - }, - { - type = 'number', - name = 'upper', - description = 'The upper limit, in radians.', - }, - }, - }, - }, - }, - { - name = 'setLimitsEnabled', - description = 'Enables/disables the joint limit.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'True to enable, false to disable.', - }, - }, - }, - }, - }, - { - name = 'setLowerLimit', - description = 'Sets the lower limit.', - variants = { - { - arguments = { - { - type = 'number', - name = 'lower', - description = 'The lower limit, in radians.', - }, - }, - }, - }, - }, - { - name = 'setMaxMotorTorque', - description = 'Set the maximum motor force.', - variants = { - { - arguments = { - { - type = 'number', - name = 'f', - description = 'The maximum motor force, in Nm.', - }, - }, - }, - }, - }, - { - name = 'setMotorEnabled', - description = 'Enables/disables the joint motor.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'True to enable, false to disable.', - }, - }, - }, - }, - }, - { - name = 'setMotorSpeed', - description = 'Sets the motor speed.', - variants = { - { - arguments = { - { - type = 'number', - name = 's', - description = 'The motor speed, radians per second.', - }, - }, - }, - }, - }, - { - name = 'setUpperLimit', - description = 'Sets the upper limit.', - variants = { - { - arguments = { - { - type = 'number', - name = 'upper', - description = 'The upper limit, in radians.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/RopeJoint.lua b/modules/physics/types/RopeJoint.lua deleted file mode 100644 index cb9cd55..0000000 --- a/modules/physics/types/RopeJoint.lua +++ /dev/null @@ -1,45 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'RopeJoint', - description = 'The RopeJoint enforces a maximum distance between two points on two bodies. It has no other effect.', - constructors = { - 'newRopeJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getMaxLength', - description = 'Gets the maximum length of a RopeJoint.', - variants = { - { - returns = { - { - type = 'number', - name = 'maxLength', - description = 'The maximum length of the RopeJoint.', - }, - }, - }, - }, - }, - { - name = 'setMaxLength', - description = 'Sets the maximum length of a RopeJoint.', - variants = { - { - arguments = { - { - type = 'number', - name = 'maxLength', - description = 'The new maximum length of the RopeJoint.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/Shape.lua b/modules/physics/types/Shape.lua deleted file mode 100644 index 7d23bd4..0000000 --- a/modules/physics/types/Shape.lua +++ /dev/null @@ -1,261 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Shape', - description = 'Shapes are solid 2d geometrical objects which handle the mass and collision of a Body in love.physics.\n\nShapes are attached to a Body via a Fixture. The Shape object is copied when this happens. \n\nThe Shape\'s position is relative to the position of the Body it has been attached to.', - supertypes = { - 'Object', - }, - functions = { - { - name = 'computeAABB', - description = 'Returns the points of the bounding box for the transformed shape.', - variants = { - { - arguments = { - { - type = 'number', - name = 'tx', - description = 'The translation of the shape on the x-axis.', - }, - { - type = 'number', - name = 'ty', - description = 'The translation of the shape on the y-axis.', - }, - { - type = 'number', - name = 'tr', - description = 'The shape rotation.', - }, - { - type = 'number', - name = 'childIndex', - description = 'The index of the child to compute the bounding box of.', - default = '1', - }, - }, - returns = { - { - type = 'number', - name = 'topLeftX', - description = 'The x position of the top-left point.', - }, - { - type = 'number', - name = 'topLeftY', - description = 'The y position of the top-left point.', - }, - { - type = 'number', - name = 'bottomRightX', - description = 'The x position of the bottom-right point.', - }, - { - type = 'number', - name = 'bottomRightY', - description = 'The y position of the bottom-right point.', - }, - }, - }, - }, - }, - { - name = 'computeMass', - description = 'Computes the mass properties for the shape with the specified density.', - variants = { - { - arguments = { - { - type = 'number', - name = 'density', - description = 'The shape density.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'The x postition of the center of mass.', - }, - { - type = 'number', - name = 'y', - description = 'The y postition of the center of mass.', - }, - { - type = 'number', - name = 'mass', - description = 'The mass of the shape.', - }, - { - type = 'number', - name = 'inertia', - description = 'The rotational inertia.', - }, - }, - }, - }, - }, - { - name = 'getChildCount', - description = 'Returns the number of children the shape has.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The number of children.', - }, - }, - }, - }, - }, - { - name = 'getRadius', - description = 'Gets the radius of the shape.', - variants = { - { - returns = { - { - type = 'number', - name = 'radius', - description = 'The radius of the shape.', - }, - }, - }, - }, - }, - { - name = 'getType', - description = 'Gets a string representing the Shape.\n\nThis function can be useful for conditional debug drawing.', - variants = { - { - returns = { - { - type = 'ShapeType', - name = 'type', - description = 'The type of the Shape.', - }, - }, - }, - }, - }, - { - name = 'rayCast', - description = 'Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.\n\nThe ray starts on the first point of the input line and goes towards the second point of the line. The fourth argument is the maximum distance the ray is going to travel as a scale factor of the input line length.\n\nThe childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.\n\nThe world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.\n\nhitx, hity = x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction', - variants = { - { - arguments = { - { - type = 'number', - name = 'x1', - description = 'The x position of the input line starting point.', - }, - { - type = 'number', - name = 'y1', - description = 'The y position of the input line starting point.', - }, - { - type = 'number', - name = 'x2', - description = 'The x position of the input line end point.', - }, - { - type = 'number', - name = 'y2', - description = 'The y position of the input line end point.', - }, - { - type = 'number', - name = 'maxFraction', - description = 'Ray length parameter.', - }, - { - type = 'number', - name = 'tx', - description = 'The translation of the shape on the x-axis.', - }, - { - type = 'number', - name = 'ty', - description = 'The translation of the shape on the y-axis.', - }, - { - type = 'number', - name = 'tr', - description = 'The shape rotation.', - }, - { - type = 'number', - name = 'childIndex', - description = 'The index of the child the ray gets cast against.', - default = '1', - }, - }, - returns = { - { - type = 'number', - name = 'xn', - description = 'The x component of the normal vector of the edge where the ray hit the shape.', - }, - { - type = 'number', - name = 'yn', - description = 'The y component of the normal vector of the edge where the ray hit the shape.', - }, - { - type = 'number', - name = 'fraction', - description = 'The position on the input line where the intersection happened as a factor of the line length.', - }, - }, - }, - }, - }, - { - name = 'testPoint', - description = 'This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.', - variants = { - { - arguments = { - { - type = 'number', - name = 'tx', - description = 'Translates the shape along the x-axis.', - }, - { - type = 'number', - name = 'ty', - description = 'Translates the shape along the y-axis.', - }, - { - type = 'number', - name = 'tr', - description = 'Rotates the shape.', - }, - { - type = 'number', - name = 'x', - description = 'The x-component of the point.', - }, - { - type = 'number', - name = 'y', - description = 'The y-component of the point.', - }, - }, - returns = { - { - type = 'boolean', - name = 'hit', - description = 'True if inside, false if outside', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/WeldJoint.lua b/modules/physics/types/WeldJoint.lua deleted file mode 100644 index fa702d0..0000000 --- a/modules/physics/types/WeldJoint.lua +++ /dev/null @@ -1,75 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'WeldJoint', - description = 'A WeldJoint essentially glues two bodies together.', - constructors = { - 'newWeldJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getDampingRatio', - description = 'Returns the damping ratio of the joint.', - variants = { - { - returns = { - { - type = 'number', - name = 'ratio', - description = 'The damping ratio.', - }, - }, - }, - }, - }, - { - name = 'getFrequency', - description = 'Returns the frequency.', - variants = { - { - returns = { - { - type = 'number', - name = 'freq', - description = 'The frequency in hertz.', - }, - }, - }, - }, - }, - { - name = 'setDampingRatio', - description = 'Sets a new damping ratio.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ratio', - description = 'The new damping ratio.', - }, - }, - }, - }, - }, - { - name = 'setFrequency', - description = 'Sets a new frequency.', - variants = { - { - arguments = { - { - type = 'number', - name = 'freq', - description = 'The new frequency in hertz.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/WheelJoint.lua b/modules/physics/types/WheelJoint.lua deleted file mode 100644 index db055f9..0000000 --- a/modules/physics/types/WheelJoint.lua +++ /dev/null @@ -1,222 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'WheelJoint', - description = 'Restricts a point on the second body to a line on the first body.', - constructors = { - 'newWheelJoint', - }, - supertypes = { - 'Joint', - 'Object', - }, - functions = { - { - name = 'getAxis', - description = 'Gets the world-space axis vector of the Wheel Joint.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-axis coordinate of the world-space axis vector.', - }, - { - type = 'number', - name = 'y', - description = 'The y-axis coordinate of the world-space axis vector.', - }, - }, - }, - }, - }, - { - name = 'getJointSpeed', - description = 'Returns the current joint translation speed.', - variants = { - { - returns = { - { - type = 'number', - name = 'speed', - description = 'The translation speed of the joint in meters per second.', - }, - }, - }, - }, - }, - { - name = 'getJointTranslation', - description = 'Returns the current joint translation.', - variants = { - { - returns = { - { - type = 'number', - name = 'position', - description = 'The translation of the joint in meters.', - }, - }, - }, - }, - }, - { - name = 'getMaxMotorTorque', - description = 'Returns the maximum motor torque.', - variants = { - { - returns = { - { - type = 'number', - name = 'maxTorque', - description = 'The maximum torque of the joint motor in newton meters.', - }, - }, - }, - }, - }, - { - name = 'getMotorSpeed', - description = 'Returns the speed of the motor.', - variants = { - { - returns = { - { - type = 'number', - name = 'speed', - description = 'The speed of the joint motor in radians per second.', - }, - }, - }, - }, - }, - { - name = 'getMotorTorque', - description = 'Returns the current torque on the motor.', - variants = { - { - arguments = { - { - type = 'number', - name = 'invdt', - description = 'How long the force applies. Usually the inverse time step or 1/dt.', - }, - }, - returns = { - { - type = 'number', - name = 'torque', - description = 'The torque on the motor in newton meters.', - }, - }, - }, - }, - }, - { - name = 'getSpringDampingRatio', - description = 'Returns the damping ratio.', - variants = { - { - returns = { - { - type = 'number', - name = 'ratio', - description = 'The damping ratio.', - }, - }, - }, - }, - }, - { - name = 'getSpringFrequency', - description = 'Returns the spring frequency.', - variants = { - { - returns = { - { - type = 'number', - name = 'freq', - description = 'The frequency in hertz.', - }, - }, - }, - }, - }, - { - name = 'setMaxMotorTorque', - description = 'Sets a new maximum motor torque.', - variants = { - { - arguments = { - { - type = 'number', - name = 'maxTorque', - description = 'The new maximum torque for the joint motor in newton meters.', - }, - }, - }, - }, - }, - { - name = 'setMotorEnabled', - description = 'Starts and stops the joint motor.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'True turns the motor on and false turns it off.', - }, - }, - }, - }, - }, - { - name = 'setMotorSpeed', - description = 'Sets a new speed for the motor.', - variants = { - { - arguments = { - { - type = 'number', - name = 'speed', - description = 'The new speed for the joint motor in radians per second.', - }, - }, - }, - }, - }, - { - name = 'setSpringDampingRatio', - description = 'Sets a new damping ratio.', - variants = { - { - arguments = { - { - type = 'number', - name = 'ratio', - description = 'The new damping ratio.', - }, - }, - }, - }, - }, - { - name = 'setSpringFrequency', - description = 'Sets a new spring frequency.', - variants = { - { - arguments = { - { - type = 'number', - name = 'freq', - description = 'The new frequency in hertz.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/physics/types/World.lua b/modules/physics/types/World.lua deleted file mode 100644 index 477f68d..0000000 --- a/modules/physics/types/World.lua +++ /dev/null @@ -1,432 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'World', - description = 'A world is an object that contains all bodies and joints.', - constructors = { - 'newWorld', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'destroy', - description = 'Destroys the world, taking all bodies, joints, fixtures and their shapes with it. \n\nAn error will occur if you attempt to use any of the destroyed objects after calling this function.', - variants = { - { - }, - }, - }, - { - name = 'getBodies', - description = 'Returns a table with all bodies.', - variants = { - { - returns = { - { - type = 'table', - name = 'bodies', - description = 'A sequence with all bodies.', - }, - }, - }, - }, - }, - { - name = 'getBodyCount', - description = 'Returns the number of bodies in the world.', - variants = { - { - returns = { - { - type = 'number', - name = 'n', - description = 'The number of bodies in the world.', - }, - }, - }, - }, - }, - { - name = 'getCallbacks', - description = 'Returns functions for the callbacks during the world update.', - variants = { - { - returns = { - { - type = 'function', - name = 'beginContact', - description = 'Gets called when two fixtures begin to overlap.', - }, - { - type = 'function', - name = 'endContact', - description = 'Gets called when two fixtures cease to overlap.', - }, - { - type = 'function', - name = 'preSolve', - description = 'Gets called before a collision gets resolved.', - }, - { - type = 'function', - name = 'postSolve', - description = 'Gets called after the collision has been resolved.', - }, - }, - }, - }, - }, - { - name = 'getContactCount', - description = 'Returns the number of contacts in the world.', - variants = { - { - returns = { - { - type = 'number', - name = 'n', - description = 'The number of contacts in the world.', - }, - }, - }, - }, - }, - { - name = 'getContactFilter', - description = 'Returns the function for collision filtering.', - variants = { - { - returns = { - { - type = 'function', - name = 'contactFilter', - description = 'The function that handles the contact filtering.', - }, - }, - }, - }, - }, - { - name = 'getContacts', - description = 'Returns a table with all Contacts.', - variants = { - { - returns = { - { - type = 'table', - name = 'contacts', - description = 'A sequence with all Contacts.', - }, - }, - }, - }, - }, - { - name = 'getGravity', - description = 'Get the gravity of the world.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x component of gravity.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of gravity.', - }, - }, - }, - }, - }, - { - name = 'getJointCount', - description = 'Returns the number of joints in the world.', - variants = { - { - returns = { - { - type = 'number', - name = 'n', - description = 'The number of joints in the world.', - }, - }, - }, - }, - }, - { - name = 'getJoints', - description = 'Returns a table with all joints.', - variants = { - { - returns = { - { - type = 'table', - name = 'joints', - description = 'A sequence with all joints.', - }, - }, - }, - }, - }, - { - name = 'isDestroyed', - description = 'Gets whether the World is destroyed. Destroyed worlds cannot be used.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'destroyed', - description = 'Whether the World is destroyed.', - }, - }, - }, - }, - }, - { - name = 'isLocked', - description = 'Returns if the world is updating its state.\n\nThis will return true inside the callbacks from World:setCallbacks.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'locked', - description = 'Will be true if the world is in the process of updating its state.', - }, - }, - }, - }, - }, - { - name = 'isSleepingAllowed', - description = 'Gets the sleep behaviour of the world.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'allow', - description = 'True if bodies in the world are allowed to sleep, or false if not.', - }, - }, - }, - }, - }, - { - name = 'queryBoundingBox', - description = 'Calls a function for each fixture inside the specified area by searching for any overlapping bounding box (Fixture:getBoundingBox).', - variants = { - { - arguments = { - { - type = 'number', - name = 'topLeftX', - description = 'The x position of the top-left point.', - }, - { - type = 'number', - name = 'topLeftY', - description = 'The y position of the top-left point.', - }, - { - type = 'number', - name = 'bottomRightX', - description = 'The x position of the bottom-right point.', - }, - { - type = 'number', - name = 'bottomRightY', - description = 'The y position of the bottom-right point.', - }, - { - type = 'function', - name = 'callback', - description = 'This function gets passed one argument, the fixture, and should return a boolean. The search will continue if it is true or stop if it is false.', - }, - }, - }, - }, - }, - { - name = 'rayCast', - description = 'Casts a ray and calls a function for each fixtures it intersects. ', - variants = { - { - description = 'There is a bug in LÖVE 0.8.0 where the normal vector passed to the callback function gets scaled by love.physics.getMeter.', - arguments = { - { - type = 'Fixture', - name = 'fixture', - description = 'The fixture intersecting the ray.', - }, - { - type = 'number', - name = 'x', - description = 'The x position of the intersection point.', - }, - { - type = 'number', - name = 'y', - description = 'The y position of the intersection point.', - }, - { - type = 'number', - name = 'xn', - description = 'The x value of the surface normal vector of the shape edge.', - }, - { - type = 'number', - name = 'yn', - description = 'The y value of the surface normal vector of the shape edge.', - }, - { - type = 'number', - name = 'fraction', - description = 'The position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value).', - }, - }, - returns = { - { - type = 'number', - name = 'control', - description = 'The ray can be controlled with the return value. A positive value sets a new ray length where 1 is the default value. A value of 0 terminates the ray. If the callback function returns -1, the intersection gets ignored as if it didn\'t happen.', - }, - }, - }, - }, - }, - { - name = 'setCallbacks', - description = 'Sets functions for the collision callbacks during the world update.\n\nFour Lua functions can be given as arguments. The value nil removes a function.\n\nWhen called, each function will be passed three arguments. The first two arguments are the colliding fixtures and the third argument is the Contact between them. The postSolve callback additionally gets the normal and tangent impulse for each contact point. See notes.\n\nIf you are interested to know when exactly each callback is called, consult a Box2d manual', - variants = { - { - arguments = { - { - type = 'function', - name = 'beginContact', - description = 'Gets called when two fixtures begin to overlap.', - }, - { - type = 'function', - name = 'endContact', - description = 'Gets called when two fixtures cease to overlap. This will also be called outside of a world update, when colliding objects are destroyed.', - }, - { - type = 'function', - name = 'preSolve', - description = 'Gets called before a collision gets resolved.', - }, - { - type = 'function', - name = 'postSolve', - description = 'Gets called after the collision has been resolved.', - }, - }, - }, - }, - }, - { - name = 'setContactFilter', - description = 'Sets a function for collision filtering.\n\nIf the group and category filtering doesn\'t generate a collision decision, this function gets called with the two fixtures as arguments. The function should return a boolean value where true means the fixtures will collide and false means they will pass through each other.', - variants = { - { - arguments = { - { - type = 'function', - name = 'filter', - description = 'The function handling the contact filtering.', - }, - }, - }, - }, - }, - { - name = 'setGravity', - description = 'Set the gravity of the world.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x component of gravity.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of gravity.', - }, - }, - }, - }, - }, - { - name = 'setSleepingAllowed', - description = 'Sets the sleep behaviour of the world.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'allow', - description = 'True if bodies in the world are allowed to sleep, or false if not.', - }, - }, - }, - }, - }, - { - name = 'translateOrigin', - description = 'Translates the World\'s origin. Useful in large worlds where floating point precision issues become noticeable at far distances from the origin.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x component of the new origin with respect to the old origin.', - }, - { - type = 'number', - name = 'y', - description = 'The y component of the new origin with respect to the old origin.', - }, - }, - }, - }, - }, - { - name = 'update', - description = 'Update the state of the world.', - variants = { - { - arguments = { - { - type = 'number', - name = 'dt', - description = 'The time (in seconds) to advance the physics simulation.', - }, - { - type = 'number', - name = 'velocityiterations', - description = 'The maximum number of steps used to determine the new velocities when resolving a collision.', - default = '8', - }, - { - type = 'number', - name = 'positioniterations', - description = 'The maximum number of steps used to determine the new positions when resolving a collision.', - default = '3', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/sound/Sound.lua b/modules/sound/Sound.lua deleted file mode 100644 index ebff096..0000000 --- a/modules/sound/Sound.lua +++ /dev/null @@ -1,152 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'sound', - description = 'This module is responsible for decoding sound files. It can\'t play the sounds, see love.audio for that.', - types = { - require(path .. 'types.Decoder'), - require(path .. 'types.SoundData'), - }, - functions = { - { - name = 'newDecoder', - description = 'Attempts to find a decoder for the encoded sound data in the specified file.', - variants = { - { - arguments = { - { - type = 'File', - name = 'file', - description = 'The file with encoded sound data.', - }, - { - type = 'number', - name = 'buffer', - description = 'The size of each decoded chunk, in bytes.', - default = '2048', - }, - }, - returns = { - { - type = 'Decoder', - name = 'decoder', - description = 'A new Decoder object.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The filename of the file with encoded sound data.', - }, - { - type = 'number', - name = 'buffer', - description = 'The size of each decoded chunk, in bytes.', - default = '2048', - }, - }, - returns = { - { - type = 'Decoder', - name = 'decoder', - description = 'A new Decoder object.', - }, - }, - }, - }, - }, - { - name = 'newSoundData', - description = 'Creates new SoundData from a filepath, File, or Decoder. It\'s also possible to create SoundData with a custom sample rate, channel and bit depth.\n\nThe sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way.', - variants = { - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The file name of the file to load.', - }, - }, - returns = { - { - type = 'SoundData', - name = 'soundData', - description = 'A new SoundData object.', - }, - }, - }, - { - arguments = { - { - type = 'File', - name = 'file', - description = 'A File pointing to an audio file.', - }, - }, - returns = { - { - type = 'SoundData', - name = 'soundData', - description = 'A new SoundData object.', - }, - }, - }, - { - arguments = { - { - type = 'Decoder', - name = 'decoder', - description = 'Decode data from this Decoder until EOF.', - }, - }, - returns = { - { - type = 'SoundData', - name = 'soundData', - description = 'A new SoundData object.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'samples', - description = 'Total number of samples.', - }, - { - type = 'number', - name = 'rate', - description = 'Number of samples per second', - default = '44100', - }, - { - type = 'number', - name = 'bits', - description = 'Bits per sample (8 or 16).', - default = '16', - }, - { - type = 'number', - name = 'channels', - description = 'Either 1 for mono or 2 for stereo.', - default = '2', - }, - }, - returns = { - { - type = 'SoundData', - name = 'soundData', - description = 'A new SoundData object.', - }, - }, - }, - }, - }, - }, - enums = { - }, -} \ No newline at end of file diff --git a/modules/sound/types/Decoder.lua b/modules/sound/types/Decoder.lua deleted file mode 100644 index 6526782..0000000 --- a/modules/sound/types/Decoder.lua +++ /dev/null @@ -1,89 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Decoder', - description = 'An object which can gradually decode a sound file.', - constructors = { - 'newDecoder', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'clone', - description = 'Creates a new copy of current decoder.\n\nThe new decoder will start decoding from the beginning of the audio stream.', - variants = { - { - returns = { - { - type = 'Decoder', - name = 'decoder', - description = 'New copy of the decoder.', - }, - }, - }, - }, - }, - { - name = 'getBitDepth', - description = 'Returns the number of bits per sample.', - variants = { - { - returns = { - { - type = 'number', - name = 'bitDepth', - description = 'Either 8, or 16.', - }, - }, - }, - }, - }, - { - name = 'getChannelCount', - description = 'Returns the number of channels in the stream.', - variants = { - { - returns = { - { - type = 'number', - name = 'channels', - description = '1 for mono, 2 for stereo.', - }, - }, - }, - }, - }, - { - name = 'getDuration', - description = 'Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all.', - variants = { - { - returns = { - { - type = 'number', - name = 'duration', - description = 'The duration of the sound file in seconds, or -1 if it cannot be determined.', - }, - }, - }, - }, - }, - { - name = 'getSampleRate', - description = 'Returns the sample rate of the Decoder.', - variants = { - { - returns = { - { - type = 'number', - name = 'rate', - description = 'Number of samples per second.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/sound/types/SoundData.lua b/modules/sound/types/SoundData.lua deleted file mode 100644 index c42a3a0..0000000 --- a/modules/sound/types/SoundData.lua +++ /dev/null @@ -1,174 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'SoundData', - description = 'Contains raw audio samples.\n\nYou can not play SoundData back directly. You must wrap a Source object around it.', - constructors = { - 'newSoundData', - }, - supertypes = { - 'Data', - 'Object', - }, - functions = { - { - name = 'getBitDepth', - description = 'Returns the number of bits per sample.', - variants = { - { - returns = { - { - type = 'number', - name = 'bitdepth', - description = 'Either 8, or 16.', - }, - }, - }, - }, - }, - { - name = 'getChannelCount', - description = 'Returns the number of channels in the SoundData.', - variants = { - { - returns = { - { - type = 'number', - name = 'channels', - description = '1 for mono, 2 for stereo.', - }, - }, - }, - }, - }, - { - name = 'getDuration', - description = 'Gets the duration of the sound data.', - variants = { - { - returns = { - { - type = 'number', - name = 'duration', - description = 'The duration of the sound data in seconds.', - }, - }, - }, - }, - }, - { - name = 'getSample', - description = 'Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.', - variants = { - { - arguments = { - { - type = 'number', - name = 'i', - description = 'An integer value specifying the position of the sample (starting at 0).', - }, - }, - returns = { - { - type = 'number', - name = 'sample', - description = 'The normalized samplepoint (range -1.0 to 1.0).', - }, - }, - }, - { - description = 'Gets the value of a sample using an explicit sample index instead of interleaving them in the sample position parameter.', - arguments = { - { - type = 'number', - name = 'i', - description = 'An integer value specifying the position of the sample (starting at 0).', - }, - { - type = 'number', - name = 'channel', - description = 'The index of the channel to get within the given sample.', - }, - }, - returns = { - { - type = 'number', - name = 'sample', - description = 'The normalized samplepoint (range -1.0 to 1.0).', - }, - }, - }, - }, - }, - { - name = 'getSampleCount', - description = 'Returns the number of samples per channel of the SoundData.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'Total number of samples.', - }, - }, - }, - }, - }, - { - name = 'getSampleRate', - description = 'Returns the sample rate of the SoundData.', - variants = { - { - returns = { - { - type = 'number', - name = 'rate', - description = 'Number of samples per second.', - }, - }, - }, - }, - }, - { - name = 'setSample', - description = 'Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.', - variants = { - { - arguments = { - { - type = 'number', - name = 'i', - description = 'An integer value specifying the position of the sample (starting at 0).', - }, - { - type = 'number', - name = 'sample', - description = 'The normalized samplepoint (range -1.0 to 1.0).', - }, - }, - }, - { - description = 'Sets the value of a sample using an explicit sample index instead of interleaving them in the sample position parameter.', - arguments = { - { - type = 'number', - name = 'i', - description = 'An integer value specifying the position of the sample (starting at 0).', - }, - { - type = 'number', - name = 'channel', - description = 'The index of the channel to set within the given sample.', - }, - { - type = 'number', - name = 'sample', - description = 'The normalized samplepoint (range -1.0 to 1.0).', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/system/System.lua b/modules/system/System.lua deleted file mode 100644 index 983d985..0000000 --- a/modules/system/System.lua +++ /dev/null @@ -1,154 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'system', - description = 'Provides access to information about the user\'s system.', - types = { - }, - functions = { - { - name = 'getClipboardText', - description = 'Gets text from the clipboard.', - variants = { - { - returns = { - { - type = 'string', - name = 'text', - description = 'The text currently held in the system\'s clipboard.', - }, - }, - }, - }, - }, - { - name = 'getOS', - description = 'Gets the current operating system. In general, LÖVE abstracts away the need to know the current operating system, but there are a few cases where it can be useful (especially in combination with os.execute.)', - variants = { - { - description = 'In LÖVE version 0.8.0, the \'\'\'love._os\'\'\' string contains the current operating system.', - returns = { - { - type = 'string', - name = 'osString', - description = 'The current operating system. \'OS X\', \'Windows\', \'Linux\', \'Android\' or \'iOS\'.', - }, - }, - }, - }, - }, - { - name = 'getPowerInfo', - description = 'Gets information about the system\'s power supply.', - variants = { - { - returns = { - { - type = 'PowerState', - name = 'state', - description = 'The basic state of the power supply.', - }, - { - type = 'number', - name = 'percent', - description = 'Percentage of battery life left, between 0 and 100. nil if the value can\'t be determined or there\'s no battery.', - }, - { - type = 'number', - name = 'seconds', - description = 'Seconds of battery life left. nil if the value can\'t be determined or there\'s no battery.', - }, - }, - }, - }, - }, - { - name = 'getProcessorCount', - description = 'Gets the amount of logical processor in the system.', - variants = { - { - description = 'The number includes the threads reported if technologies such as Intel\'s Hyper-threading are enabled. For example, on a 4-core CPU with Hyper-threading, this function will return 8.', - returns = { - { - type = 'number', - name = 'processorCount', - description = 'Amount of logical processors.', - }, - }, - }, - }, - }, - { - name = 'hasBackgroundMusic', - description = 'Gets whether another application on the system is playing music in the background.\n\nCurrently this is implemented on iOS and Android, and will always return false on other operating systems. The t.audio.mixwithsystem flag in love.conf can be used to configure whether background audio / music from other apps should play while LÖVE is open.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'backgroundmusic', - description = 'True if the user is playing music in the background via another app, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'openURL', - description = 'Opens a URL with the user\'s web or file browser.', - variants = { - { - description = 'Passing file:// scheme in Android 7.0 (Nougat) and later always result in failure. Prior to 11.2, this will crash LÖVE instead of returning false.', - arguments = { - { - type = 'string', - name = 'url', - description = 'The URL to open. Must be formatted as a proper URL.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the URL was opened successfully.', - }, - }, - }, - }, - }, - { - name = 'setClipboardText', - description = 'Puts text in the clipboard.', - variants = { - { - arguments = { - { - type = 'string', - name = 'text', - description = 'The new text to hold in the system\'s clipboard.', - }, - }, - }, - }, - }, - { - name = 'vibrate', - description = 'Causes the device to vibrate, if possible. Currently this will only work on Android and iOS devices that have a built-in vibration motor.', - variants = { - { - arguments = { - { - type = 'number', - name = 'seconds', - description = 'The duration to vibrate for. If called on an iOS device, it will always vibrate for 0.5 seconds due to limitations in the iOS system APIs.', - default = '0.5', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.PowerState'), - }, -} \ No newline at end of file diff --git a/modules/system/enums/PowerState.lua b/modules/system/enums/PowerState.lua deleted file mode 100644 index 5581905..0000000 --- a/modules/system/enums/PowerState.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - name = 'PowerState', - description = 'The basic state of the system\'s power supply.', - constants = { - { - name = 'unknown', - description = 'Cannot determine power status.', - }, - { - name = 'battery', - description = 'Not plugged in, running on a battery.', - }, - { - name = 'nobattery', - description = 'Plugged in, no battery available.', - }, - { - name = 'charging', - description = 'Plugged in, charging battery.', - }, - { - name = 'charged', - description = 'Plugged in, battery is fully charged.', - }, - }, -} \ No newline at end of file diff --git a/modules/thread/Thread.lua b/modules/thread/Thread.lua deleted file mode 100644 index 0165f79..0000000 --- a/modules/thread/Thread.lua +++ /dev/null @@ -1,105 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'thread', - description = 'Allows you to work with threads.\n\nThreads are separate Lua environments, running in parallel to the main code. As their code runs separately, they can be used to compute complex operations without adversely affecting the frame rate of the main thread. However, as they are separate environments, they cannot access the variables and functions of the main thread, and communication between threads is limited.\n\nAll LOVE objects (userdata) are shared among threads so you\'ll only have to send their references across threads. You may run into concurrency issues if you manipulate an object on multiple threads at the same time.\n\nWhen a Thread is started, it only loads the love.thread module. Every other module has to be loaded with require.', - types = { - require(path .. 'types.Channel'), - require(path .. 'types.Thread'), - }, - functions = { - { - name = 'getChannel', - description = 'Creates or retrieves a named thread channel.', - variants = { - { - arguments = { - { - type = 'string', - name = 'name', - description = 'The name of the channel you want to create or retrieve.', - }, - }, - returns = { - { - type = 'Channel', - name = 'channel', - description = 'The Channel object associated with the name.', - }, - }, - }, - }, - }, - { - name = 'newChannel', - description = 'Create a new unnamed thread channel.\n\nOne use for them is to pass new unnamed channels to other threads via Channel:push on a named channel.', - variants = { - { - returns = { - { - type = 'Channel', - name = 'channel', - description = 'The new Channel object.', - }, - }, - }, - }, - }, - { - name = 'newThread', - description = 'Creates a new Thread from a filename, string or FileData object containing Lua code.', - variants = { - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The name of the Lua file to use as the source.', - }, - }, - returns = { - { - type = 'Thread', - name = 'thread', - description = 'A new Thread that has yet to be started.', - }, - }, - }, - { - arguments = { - { - type = 'FileData', - name = 'fileData', - description = 'The FileData containing the Lua code to use as the source.', - }, - }, - returns = { - { - type = 'Thread', - name = 'thread', - description = 'A new Thread that has yet to be started.', - }, - }, - }, - { - arguments = { - { - type = 'string', - name = 'codestring', - description = 'A string containing the Lua code to use as the source. It needs to either be at least 1024 characters long, or contain at least one newline.', - }, - }, - returns = { - { - type = 'Thread', - name = 'thread', - description = 'A new Thread that has yet to be started.', - }, - }, - }, - }, - }, - }, - enums = { - }, -} \ No newline at end of file diff --git a/modules/thread/types/Channel.lua b/modules/thread/types/Channel.lua deleted file mode 100644 index bfdb599..0000000 --- a/modules/thread/types/Channel.lua +++ /dev/null @@ -1,223 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Channel', - description = 'An object which can be used to send and receive data between different threads.', - constructors = { - 'newChannel', - 'getChannel', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'clear', - description = 'Clears all the messages in the Channel queue.', - variants = { - { - }, - }, - }, - { - name = 'demand', - description = 'Retrieves the value of a Channel message and removes it from the message queue.\n\nIt waits until a message is in the queue then returns the message value.', - variants = { - { - returns = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message.', - }, - }, - }, - { - arguments = { - { - type = 'number', - name = 'timeout', - description = 'The maximum amount of time to wait.', - }, - }, - returns = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message or nil if the timeout expired.', - }, - }, - }, - }, - }, - { - name = 'getCount', - description = 'Retrieves the number of messages in the thread Channel queue.', - variants = { - { - returns = { - { - type = 'number', - name = 'count', - description = 'The number of messages in the queue.', - }, - }, - }, - }, - }, - { - name = 'hasRead', - description = 'Gets whether a pushed value has been popped or otherwise removed from the Channel.', - variants = { - { - arguments = { - { - type = 'number', - name = 'id', - description = 'An id value previously returned by Channel:push.', - }, - }, - returns = { - { - type = 'boolean', - name = 'hasread', - description = 'Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear.', - }, - }, - }, - }, - }, - { - name = 'peek', - description = 'Retrieves the value of a Channel message, but leaves it in the queue.\n\nIt returns nil if there\'s no message in the queue.', - variants = { - { - returns = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message.', - }, - }, - }, - }, - }, - { - name = 'performAtomic', - description = 'Executes the specified function atomically with respect to this Channel.\n\nCalling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel\'s methods at the same time, the different calls on each Thread might end up interleaved (e.g. one or more of the second thread\'s calls may happen in between the first thread\'s calls.)\n\nThis method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned.', - variants = { - { - arguments = { - { - type = 'function', - name = 'func', - description = 'The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called.', - }, - { - type = 'any', - name = 'arg1', - description = 'Additional arguments that the given function will receive when it is called.', - }, - { - type = 'any', - name = '...', - description = 'Additional arguments that the given function will receive when it is called.', - }, - }, - returns = { - { - type = 'any', - name = 'ret1', - description = 'The first return value of the given function (if any.)', - }, - { - type = 'any', - name = '...', - description = 'Any other return values.', - }, - }, - }, - }, - }, - { - name = 'pop', - description = 'Retrieves the value of a Channel message and removes it from the message queue.\n\nIt returns nil if there are no messages in the queue.', - variants = { - { - returns = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message.', - }, - }, - }, - }, - }, - { - name = 'push', - description = 'Send a message to the thread Channel.\n\nSee Variant for the list of supported types.', - variants = { - { - arguments = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message.', - }, - }, - returns = { - { - type = 'number', - name = 'id', - description = 'Identifier which can be supplied to Channel:hasRead', - }, - }, - }, - }, - }, - { - name = 'supply', - description = 'Send a message to the thread Channel and wait for a thread to accept it.\n\nSee Variant for the list of supported types.', - variants = { - { - arguments = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the message was successfully supplied (always true).', - }, - }, - }, - { - arguments = { - { - type = 'Variant', - name = 'value', - description = 'The contents of the message.', - }, - { - type = 'number', - name = 'timeout', - description = 'The maximum amount of time to wait.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the message was successfully supplied before the timeout expired.', - }, - }, - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/thread/types/Thread.lua b/modules/thread/types/Thread.lua deleted file mode 100644 index c37defc..0000000 --- a/modules/thread/types/Thread.lua +++ /dev/null @@ -1,80 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'Thread', - description = 'A Thread is a chunk of code that can run in parallel with other threads. Data can be sent between different threads with Channel objects.', - constructors = { - 'newThread', - }, - supertypes = { - 'Object', - }, - functions = { - { - name = 'getError', - description = 'Retrieves the error string from the thread if it produced an error.', - variants = { - { - returns = { - { - type = 'string', - name = 'err', - description = 'The error message, or nil if the Thread has not caused an error.', - }, - }, - }, - }, - }, - { - name = 'isRunning', - description = 'Returns whether the thread is currently running.\n\nThreads which are not running can be (re)started with Thread:start.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'value', - description = 'True if the thread is running, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'start', - description = 'Starts the thread.\n\nBeginning with version 0.9.0, threads can be restarted after they have completed their execution.', - variants = { - { - }, - { - description = 'Arguments passed to Thread:start are accessible in the thread\'s main file via \'\'\'...\'\'\' (the vararg expression.)', - arguments = { - { - type = 'Variant', - name = 'arg1', - description = 'A string, number, boolean, LÖVE object, or simple table.', - }, - { - type = 'Variant', - name = 'arg2', - description = 'A string, number, boolean, LÖVE object, or simple table.', - }, - { - type = 'Variant', - name = '...', - description = 'You can continue passing values to the thread.', - }, - }, - }, - }, - }, - { - name = 'wait', - description = 'Wait for a thread to finish.\n\nThis call will block until the thread finishes.', - variants = { - { - }, - }, - }, - }, -} \ No newline at end of file diff --git a/modules/timer/Timer.lua b/modules/timer/Timer.lua deleted file mode 100644 index ee58fe8..0000000 --- a/modules/timer/Timer.lua +++ /dev/null @@ -1,102 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'timer', - description = 'Provides an interface to the user\'s clock.', - types = { - }, - functions = { - { - name = 'getAverageDelta', - description = 'Returns the average delta time (seconds per frame) over the last second.', - variants = { - { - returns = { - { - type = 'number', - name = 'delta', - description = 'The average delta time over the last second.', - }, - }, - }, - }, - }, - { - name = 'getDelta', - description = 'Returns the time between the last two frames.', - variants = { - { - returns = { - { - type = 'number', - name = 'dt', - description = 'The time passed (in seconds).', - }, - }, - }, - }, - }, - { - name = 'getFPS', - description = 'Returns the current frames per second.', - variants = { - { - returns = { - { - type = 'number', - name = 'fps', - description = 'The current FPS.', - }, - }, - }, - }, - }, - { - name = 'getTime', - description = 'Returns the value of a timer with an unspecified starting time.\n\nThis function should only be used to calculate differences between points in time, as the starting time of the timer is unknown.', - variants = { - { - returns = { - { - type = 'number', - name = 'time', - description = 'The time in seconds. Given as a decimal, accurate to the microsecond.', - }, - }, - }, - }, - }, - { - name = 'sleep', - description = 'Pauses the current thread for the specified amount of time.', - variants = { - { - arguments = { - { - type = 'number', - name = 's', - description = 'Seconds to sleep for.', - }, - }, - }, - }, - }, - { - name = 'step', - description = 'Measures the time between two frames.\n\nCalling this changes the return value of love.timer.getDelta.', - variants = { - { - returns = { - { - type = 'number', - name = 'dt', - description = 'The time passed (in seconds).', - }, - }, - }, - }, - }, - }, - enums = { - }, -} \ No newline at end of file diff --git a/modules/touch/Touch.lua b/modules/touch/Touch.lua deleted file mode 100644 index 5b1d01c..0000000 --- a/modules/touch/Touch.lua +++ /dev/null @@ -1,78 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'touch', - description = 'Provides an interface to touch-screen presses.', - types = { - }, - functions = { - { - name = 'getPosition', - description = 'Gets the current position of the specified touch-press, in pixels.', - variants = { - { - description = 'The unofficial Android and iOS ports of LÖVE 0.9.2 reported touch-press positions as normalized values in the range of 1, whereas this API reports positions in pixels.', - arguments = { - { - type = 'light userdata', - name = 'id', - description = 'The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'The position along the x-axis of the touch-press inside the window, in pixels.', - }, - { - type = 'number', - name = 'y', - description = 'The position along the y-axis of the touch-press inside the window, in pixels.', - }, - }, - }, - }, - }, - { - name = 'getPressure', - description = 'Gets the current pressure of the specified touch-press.', - variants = { - { - arguments = { - { - type = 'light userdata', - name = 'id', - description = 'The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.', - }, - }, - returns = { - { - type = 'number', - name = 'pressure', - description = 'The pressure of the touch-press. Most touch screens aren\'t pressure sensitive, in which case the pressure will be 1.', - }, - }, - }, - }, - }, - { - name = 'getTouches', - description = 'Gets a list of all active touch-presses.', - variants = { - { - description = 'The id values are the same as those used as arguments to love.touchpressed, love.touchmoved, and love.touchreleased.\n\nThe id value of a specific touch-press is only guaranteed to be unique for the duration of that touch-press. As soon as love.touchreleased is called using that id, it may be reused for a new touch-press via love.touchpressed.', - returns = { - { - type = 'table', - name = 'touches', - description = 'A list of active touch-press id values, which can be used with love.touch.getPosition.', - }, - }, - }, - }, - }, - }, - enums = { - }, -} \ No newline at end of file diff --git a/modules/video/Video.lua b/modules/video/Video.lua deleted file mode 100644 index 5e65573..0000000 --- a/modules/video/Video.lua +++ /dev/null @@ -1,51 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'video', - description = 'This module is responsible for decoding, controlling, and streaming video files.\n\nIt can\'t draw the videos, see love.graphics.newVideo and Video objects for that.', - types = { - require(path .. 'types.VideoStream'), - }, - functions = { - { - name = 'newVideoStream', - description = 'Creates a new VideoStream. Currently only Ogg Theora video files are supported. VideoStreams can\'t draw videos, see love.graphics.newVideo for that.', - variants = { - { - arguments = { - { - type = 'string', - name = 'filename', - description = 'The file path to the Ogg Theora video file.', - }, - }, - returns = { - { - type = 'VideoStream', - name = 'videostream', - description = 'A new VideoStream.', - }, - }, - }, - { - arguments = { - { - type = 'File', - name = 'file', - description = 'The File object containing the Ogg Theora video.', - }, - }, - returns = { - { - type = 'VideoStream', - name = 'videostream', - description = 'A new VideoStream.', - }, - }, - }, - }, - }, - }, - enums = { - }, -} \ No newline at end of file diff --git a/modules/video/types/VideoStream.lua b/modules/video/types/VideoStream.lua deleted file mode 100644 index a411c39..0000000 --- a/modules/video/types/VideoStream.lua +++ /dev/null @@ -1,14 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'VideoStream', - description = 'An object which decodes, streams, and controls Videos.', - constructors = { - 'newVideoStream', - }, - supertypes = { - 'Object', - }, - functions = { - }, -} \ No newline at end of file diff --git a/modules/window/Window.lua b/modules/window/Window.lua deleted file mode 100644 index 705ab61..0000000 --- a/modules/window/Window.lua +++ /dev/null @@ -1,1029 +0,0 @@ -local path = (...):match('(.-)[^%./]+$') - -return { - name = 'window', - description = 'Provides an interface for modifying and retrieving information about the program\'s window.', - types = { - }, - functions = { - { - name = 'close', - description = 'Closes the window. It can be reopened with love.window.setMode.', - variants = { - { - }, - }, - }, - { - name = 'fromPixels', - description = 'Converts a number from pixels to density-independent units.\n\nThe pixel density inside the window might be greater (or smaller) than the \'size\' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.fromPixels(1600) would return 800 in that case.\n\nThis function converts coordinates from pixels to the size users are expecting them to display at onscreen. love.window.toPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.\n\nMost LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units.', - variants = { - { - arguments = { - { - type = 'number', - name = 'pixelvalue', - description = 'A number in pixels to convert to density-independent units.', - }, - }, - returns = { - { - type = 'number', - name = 'value', - description = 'The converted number, in density-independent units.', - }, - }, - }, - { - description = 'The units of love.graphics.getWidth, love.graphics.getHeight, love.mouse.getPosition, mouse events, love.touch.getPosition, and touch events are always in terms of pixels.', - arguments = { - { - type = 'number', - name = 'px', - description = 'The x-axis value of a coordinate in pixels.', - }, - { - type = 'number', - name = 'py', - description = 'The y-axis value of a coordinate in pixels.', - }, - }, - returns = { - { - type = 'number', - name = 'x', - description = 'The converted x-axis value of the coordinate, in density-independent units.', - }, - { - type = 'number', - name = 'y', - description = 'The converted y-axis value of the coordinate, in density-independent units.', - }, - }, - }, - }, - }, - { - name = 'getDPIScale', - description = 'Gets the DPI scale factor associated with the window.\n\nThe pixel density inside the window might be greater (or smaller) than the \'size\' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.getDPIScale() would return 2.0 in that case.\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 terms of pixels.', - returns = { - { - type = 'number', - name = 'scale', - description = 'The pixel scale factor associated with the window.', - }, - }, - }, - }, - }, - { - name = 'getDisplayName', - description = 'Gets the name of a display.', - variants = { - { - arguments = { - { - type = 'number', - name = 'displayindex', - description = 'The index of the display to get the name of.', - default = '1', - }, - }, - returns = { - { - type = 'string', - name = 'name', - description = 'The name of the specified display.', - }, - }, - }, - }, - }, - { - name = 'getDisplayOrientation', - description = 'Gets current device display orientation.', - variants = { - { - arguments = { - { - type = 'number', - name = 'index', - description = 'Display index to get its display orientation, or nil for default display index.', - default = 'nil', - }, - }, - returns = { - { - type = 'DisplayOrientation', - name = 'orientation', - description = 'Current device display orientation.', - }, - }, - }, - }, - }, - { - name = 'getFullscreen', - description = 'Gets whether the window is fullscreen.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'fullscreen', - description = 'True if the window is fullscreen, false otherwise.', - }, - { - type = 'FullscreenType', - name = 'fstype', - description = 'The type of fullscreen mode used.', - }, - }, - }, - }, - }, - { - name = 'getFullscreenModes', - description = 'Gets a list of supported fullscreen modes.', - variants = { - { - arguments = { - { - type = 'number', - name = 'display', - description = 'The index of the display, if multiple monitors are available.', - default = '1', - }, - }, - returns = { - { - type = 'table', - name = 'modes', - description = 'A table of width/height pairs. (Note that this may not be in order.)', - }, - }, - }, - }, - }, - { - name = 'getIcon', - description = 'Gets the window icon.', - variants = { - { - returns = { - { - type = 'ImageData', - name = 'imagedata', - description = 'The window icon imagedata, or nil if no icon has been set with love.window.setIcon.', - }, - }, - }, - }, - }, - { - name = 'getMode', - description = 'Gets the display mode and properties of the window.', - variants = { - { - returns = { - { - type = 'number', - name = 'width', - description = 'Window width.', - }, - { - type = 'number', - name = 'height', - description = 'Window height.', - }, - { - type = 'table', - name = 'flags', - description = 'Table with the window properties:', - table = { - { - type = 'boolean', - name = 'fullscreen', - description = 'Fullscreen (true), or windowed (false).', - }, - { - type = 'FullscreenType', - name = 'fullscreentype', - description = 'The type of fullscreen mode used.', - }, - { - type = 'boolean', - name = 'vsync', - description = 'True if the graphics framerate is synchronized with the monitor\'s refresh rate, false otherwise.', - }, - { - type = 'number', - name = 'msaa', - description = 'The number of antialiasing samples used (0 if MSAA is disabled).', - }, - { - type = 'boolean', - name = 'resizable', - description = 'True if the window is resizable in windowed mode, false otherwise.', - }, - { - type = 'boolean', - name = 'borderless', - description = 'True if the window is borderless in windowed mode, false otherwise.', - }, - { - type = 'boolean', - name = 'centered', - description = 'True if the window is centered in windowed mode, false otherwise.', - }, - { - type = 'number', - name = 'display', - description = 'The index of the display the window is currently in, if multiple monitors are available.', - }, - { - type = 'number', - name = 'minwidth', - description = 'The minimum width of the window, if it\'s resizable.', - }, - { - type = 'number', - name = 'minheight', - description = 'The minimum height of the window, if it\'s resizable.', - }, - { - type = 'boolean', - name = 'highdpi', - description = 'True if high-dpi mode is allowed on Retina displays in OS X. Does nothing on non-Retina displays.', - }, - { - type = 'number', - name = 'refreshrate', - description = 'The refresh rate of the screen\'s current display mode, in Hz. May be 0 if the value can\'t be determined.', - }, - { - type = 'number', - name = 'x', - description = 'The x-coordinate of the window\'s position in its current display.', - }, - { - type = 'number', - name = 'y', - description = 'The y-coordinate of the window\'s position in its current display.', - }, - { - type = 'boolean', - name = 'srgb', - description = 'Removed in 0.10.0 (use love.graphics.isGammaCorrect instead). True if sRGB gamma correction is applied when drawing to the screen.', - }, - }, - }, - }, - }, - }, - }, - { - name = 'getPosition', - description = 'Gets the position of the window on the screen.\n\nThe window position is in the coordinate space of the display it is currently in.', - variants = { - { - returns = { - { - type = 'number', - name = 'x', - description = 'The x-coordinate of the window\'s position.', - }, - { - type = 'number', - name = 'y', - description = 'The y-coordinate of the window\'s position.', - }, - { - type = 'number', - name = 'display', - description = 'The index of the display that the window is in.', - }, - }, - }, - }, - }, - { - name = 'getSafeArea', - description = 'Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user.', - variants = { - { - description = 'Values returned are in DPI-scaled units (the same coordinate system as most other window-related APIs), not in pixels.', - returns = { - { - type = 'number', - name = 'x', - description = 'Starting position of safe area (x-axis).', - }, - { - type = 'number', - name = 'y', - description = 'Starting position of safe area (y-axis).', - }, - { - type = 'number', - name = 'w', - description = 'Width of safe area.', - }, - { - type = 'number', - name = 'h', - description = 'Height of safe area.', - }, - }, - }, - }, - }, - { - name = 'getTitle', - description = 'Gets the window title.', - variants = { - { - returns = { - { - type = 'string', - name = 'title', - description = 'The current window title.', - }, - }, - }, - }, - }, - { - name = 'getVSync', - description = 'Gets current vertical synchronization (vsync).', - variants = { - { - description = 'This can be less expensive alternative to love.window.getMode if you want to get current vsync status.', - returns = { - { - type = 'number', - name = 'vsync', - description = 'Current vsync status. 1 if enabled, 0 if disabled, and -1 for adaptive vsync.', - }, - }, - }, - }, - }, - { - name = 'hasFocus', - description = 'Checks if the game window has keyboard focus.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'focus', - description = 'True if the window has the focus or false if not.', - }, - }, - }, - }, - }, - { - name = 'hasMouseFocus', - description = 'Checks if the game window has mouse focus.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'focus', - description = 'True if the window has mouse focus or false if not.', - }, - }, - }, - }, - }, - { - name = 'isDisplaySleepEnabled', - description = 'Gets whether the display is allowed to sleep while the program is running.\n\nDisplay sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'enabled', - description = 'True if system display sleep is enabled / allowed, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isMaximized', - description = 'Gets whether the Window is currently maximized.\n\nThe window can be maximized if it is not fullscreen and is resizable, and either the user has pressed the window\'s Maximize button or love.window.maximize has been called.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'maximized', - description = 'True if the window is currently maximized in windowed mode, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isMinimized', - description = 'Gets whether the Window is currently minimized.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'minimized', - description = 'True if the window is currently minimized, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isOpen', - description = 'Checks if the window is open.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'open', - description = 'True if the window is open, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'isVisible', - description = 'Checks if the game window is visible.\n\nThe window is considered visible if it\'s not minimized and the program isn\'t hidden.', - variants = { - { - returns = { - { - type = 'boolean', - name = 'visible', - description = 'True if the window is visible or false if not.', - }, - }, - }, - }, - }, - { - name = 'maximize', - description = 'Makes the window as large as possible.\n\nThis function has no effect if the window isn\'t resizable, since it essentially programmatically presses the window\'s \'maximize\' button.', - variants = { - { - }, - }, - }, - { - name = 'minimize', - description = 'Minimizes the window to the system\'s task bar / dock.', - variants = { - { - }, - }, - }, - { - name = 'requestAttention', - description = 'Causes the window to request the attention of the user if it is not in the foreground.\n\nIn Windows the taskbar icon will flash, and in OS X the dock icon will bounce.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'continuous', - description = 'Whether to continuously request attention until the window becomes active, or to do it only once.', - default = 'false', - }, - }, - }, - }, - }, - { - name = 'restore', - description = 'Restores the size and position of the window if it was minimized or maximized.', - variants = { - { - }, - }, - }, - { - name = 'setDisplaySleepEnabled', - description = 'Sets whether the display is allowed to sleep while the program is running.\n\nDisplay sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'enable', - description = 'True to enable system display sleep, false to disable it.', - }, - }, - }, - }, - }, - { - name = 'setFullscreen', - description = 'Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected.', - variants = { - { - arguments = { - { - type = 'boolean', - name = 'fullscreen', - description = 'Whether to enter or exit fullscreen mode.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if an attempt to enter fullscreen was successful, false otherwise.', - }, - }, - }, - { - description = 'If fullscreen mode is entered and the window size doesn\'t match one of the monitor\'s display modes (in normal fullscreen mode) or the window size doesn\'t match the desktop size (in \'desktop\' fullscreen mode), the window will be resized appropriately. The window will revert back to its original size again when fullscreen mode is exited using this function.', - arguments = { - { - type = 'boolean', - name = 'fullscreen', - description = 'Whether to enter or exit fullscreen mode.', - }, - { - type = 'FullscreenType', - name = 'fstype', - description = 'The type of fullscreen mode to use.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if an attempt to enter fullscreen was successful, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'setIcon', - description = 'Sets the window icon until the game is quit. Not all operating systems support very large icon images.', - variants = { - { - arguments = { - { - type = 'ImageData', - name = 'imagedata', - description = 'The window icon image.', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the icon has been set successfully.', - }, - }, - }, - }, - }, - { - name = 'setMode', - description = 'Sets the display mode and properties of the window.\n\nIf width or height is 0, setMode will use the width and height of the desktop. \n\nChanging the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with canvases beforehand or re-draw to them afterward if you need to.', - variants = { - { - description = '* If fullscreen is enabled and the width or height is not supported (see resize event will be triggered.\n\n* If the fullscreen type is \'desktop\', then the window will be automatically resized to the desktop resolution.\n\n* If the width and height is bigger than or equal to the desktop dimensions (this includes setting both to 0) and fullscreen is set to false, it will appear \'visually\' fullscreen, but it\'s not true fullscreen and conf.lua (i.e. t.window = false) and use this function to manually create the window, then you must not call any other love.graphics.* function before this one. Doing so will result in undefined behavior and/or crashes because OpenGL cannot function properly without a window.\n\n* Transparent backgrounds are currently not supported.', - arguments = { - { - type = 'number', - name = 'width', - description = 'Display width.', - }, - { - type = 'number', - name = 'height', - description = 'Display height.', - }, - { - type = 'table', - name = 'flags', - description = 'The flags table with the options:', - table = { - { - type = 'boolean', - name = 'fullscreen', - description = 'Fullscreen (true), or windowed (false).', - default = 'false', - }, - { - type = 'FullscreenType', - name = 'fullscreentype', - description = 'The type of fullscreen to use. This defaults to \'normal\' in 0.9.0 through 0.9.2 and to \'desktop\' in 0.10.0 and older.', - default = '\'desktop\'', - }, - { - type = 'boolean', - name = 'vsync', - description = 'True if LÖVE should wait for vsync, false otherwise.', - default = 'true', - }, - { - type = 'number', - name = 'msaa', - description = 'The number of antialiasing samples.', - default = '0', - }, - { - type = 'boolean', - name = 'stencil', - description = 'Whether a stencil buffer should be allocated. If true, the stencil buffer will have 8 bits.', - default = 'true', - }, - { - type = 'number', - name = 'depth', - description = 'The number of bits in the depth buffer.', - default = '0', - }, - { - type = 'boolean', - name = 'resizable', - description = 'True if the window should be resizable in windowed mode, false otherwise.', - default = 'false', - }, - { - type = 'boolean', - name = 'borderless', - description = 'True if the window should be borderless in windowed mode, false otherwise.', - default = 'false', - }, - { - type = 'boolean', - name = 'centered', - description = 'True if the window should be centered in windowed mode, false otherwise.', - default = 'true', - }, - { - type = 'number', - name = 'display', - description = 'The index of the display to show the window in, if multiple monitors are available.', - default = '1', - }, - { - type = 'number', - name = 'minwidth', - description = 'The minimum width of the window, if it\'s resizable. Cannot be less than 1.', - default = '1', - }, - { - type = 'number', - name = 'minheight', - description = 'The minimum height of the window, if it\'s resizable. Cannot be less than 1.', - default = '1', - }, - { - type = 'boolean', - name = 'highdpi', - description = 'True if high-dpi mode should be used on Retina displays in macOS and iOS. Does nothing on non-Retina displays.', - default = 'false', - }, - { - type = 'number', - name = 'x', - description = 'The x-coordinate of the window\'s position in the specified display.', - default = 'nil', - }, - { - type = 'number', - name = 'y', - description = 'The y-coordinate of the window\'s position in the specified display.', - default = 'nil', - }, - { - type = 'boolean', - name = 'usedpiscale', - description = 'Disables automatic DPI scaling when false.', - default = 'true', - }, - { - type = 'boolean', - name = 'srgb', - description = 'Removed in 0.10.0 (set t.gammacorrect in conf.lua instead). True if sRGB gamma correction should be applied when drawing to the screen.', - default = 'false', - }, - }, - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if successful, false otherwise.', - }, - }, - }, - }, - }, - { - name = 'setPosition', - description = 'Sets the position of the window on the screen.\n\nThe window position is in the coordinate space of the specified display.', - variants = { - { - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-coordinate of the window\'s position.', - }, - { - type = 'number', - name = 'y', - description = 'The y-coordinate of the window\'s position.', - }, - { - type = 'number', - name = 'display', - description = 'The index of the display that the new window position is relative to.', - default = '1', - }, - }, - }, - }, - }, - { - name = 'setTitle', - description = 'Sets the window title.', - variants = { - { - arguments = { - { - type = 'string', - name = 'title', - description = 'The new window title.', - }, - }, - }, - }, - }, - { - name = 'setVSync', - description = 'Sets vertical synchronization mode.', - variants = { - { - description = '* Not all graphics drivers support adaptive vsync (-1 value). In that case, it will be automatically set to 1.\n\n* It is recommended to keep vsync activated if you don\'t know about the possible implications of turning it off.\n\n* This function doesn\'t recreate the window, unlike love.window.setMode and love.window.updateMode.', - arguments = { - { - type = 'number', - name = 'vsync', - description = 'VSync number: 1 to enable, 0 to disable, and -1 for adaptive vsync.', - }, - }, - }, - }, - }, - { - name = 'showMessageBox', - description = 'Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons.', - variants = { - { - description = 'Displays a simple message box with a single \'OK\' button.', - arguments = { - { - type = 'string', - name = 'title', - description = 'The title of the message box.', - }, - { - type = 'string', - name = 'message', - description = 'The text inside the message box.', - }, - { - type = 'MessageBoxType', - name = 'type', - description = 'The type of the message box.', - default = '\'info\'', - }, - { - type = 'boolean', - name = 'attachtowindow', - description = 'Whether the message box should be attached to the love window or free-floating.', - default = 'true', - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'Whether the message box was successfully displayed.', - }, - }, - }, - { - description = 'Displays a message box with a customized list of buttons.', - arguments = { - { - type = 'string', - name = 'title', - description = 'The title of the message box.', - }, - { - type = 'string', - name = 'message', - description = 'The text inside the message box.', - }, - { - type = 'table', - name = 'buttonlist', - description = 'A table containing a list of button names to show. The table can also contain the fields enterbutton and escapebutton, which should be the index of the default button to use when the user presses \'enter\' or \'escape\', respectively.', - }, - { - type = 'MessageBoxType', - name = 'type', - description = 'The type of the message box.', - default = '\'info\'', - }, - { - type = 'boolean', - name = 'attachtowindow', - description = 'Whether the message box should be attached to the love window or free-floating.', - default = 'true', - }, - }, - returns = { - { - type = 'number', - name = 'pressedbutton', - description = 'The index of the button pressed by the user. May be 0 if the message box dialog was closed without pressing a button.', - }, - }, - }, - }, - }, - { - name = 'toPixels', - description = 'Converts a number from density-independent units to pixels.\n\nThe pixel density inside the window might be greater (or smaller) than the \'size\' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.toPixels(800) would return 1600 in that case.\n\nThis is used to convert coordinates from the size users are expecting them to display at onscreen to pixels. love.window.fromPixels does the opposite. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.\n\nMost LÖVE functions return values and expect arguments in terms of pixels rather than density-independent units.', - variants = { - { - arguments = { - { - type = 'number', - name = 'value', - description = 'A number in density-independent units to convert to pixels.', - }, - }, - returns = { - { - type = 'number', - name = 'pixelvalue', - description = 'The converted number, in pixels.', - }, - }, - }, - { - description = 'The units of love.graphics.getWidth, love.graphics.getHeight, love.mouse.getPosition, mouse events, love.touch.getPosition, and touch events are always in terms of pixels.', - arguments = { - { - type = 'number', - name = 'x', - description = 'The x-axis value of a coordinate in density-independent units to convert to pixels.', - }, - { - type = 'number', - name = 'y', - description = 'The y-axis value of a coordinate in density-independent units to convert to pixels.', - }, - }, - returns = { - { - type = 'number', - name = 'px', - description = 'The converted x-axis value of the coordinate, in pixels.', - }, - { - type = 'number', - name = 'py', - description = 'The converted y-axis value of the coordinate, in pixels.', - }, - }, - }, - }, - }, - { - name = 'updateMode', - description = 'Sets the display mode and properties of the window, without modifying unspecified properties.\n\nIf width or height is 0, updateMode will use the width and height of the desktop. \n\nChanging the display mode may have side effects: for example, canvases will be cleared. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to.', - variants = { - { - description = 'If fullscreen is enabled and the width or height is not supported (see resize event will be triggered.\n\nIf the fullscreen type is \'desktop\', then the window will be automatically resized to the desktop resolution.\n\nTransparent backgrounds are currently not supported.', - arguments = { - { - type = 'number', - name = 'width', - description = 'Window width.', - }, - { - type = 'number', - name = 'height', - description = 'Window height.', - }, - { - type = 'table', - name = 'settings', - description = 'The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode.', - table = { - { - type = 'boolean', - name = 'fullscreen', - description = 'Fullscreen (true), or windowed (false).', - }, - { - type = 'FullscreenType', - name = 'fullscreentype', - description = 'The type of fullscreen to use.', - }, - { - type = 'boolean', - name = 'vsync', - description = 'True if LÖVE should wait for vsync, false otherwise.', - }, - { - type = 'number', - name = 'msaa', - description = 'The number of antialiasing samples.', - }, - { - type = 'boolean', - name = 'resizable', - description = 'True if the window should be resizable in windowed mode, false otherwise.', - }, - { - type = 'boolean', - name = 'borderless', - description = 'True if the window should be borderless in windowed mode, false otherwise.', - }, - { - type = 'boolean', - name = 'centered', - description = 'True if the window should be centered in windowed mode, false otherwise.', - }, - { - type = 'number', - name = 'display', - description = 'The index of the display to show the window in, if multiple monitors are available.', - }, - { - type = 'number', - name = 'minwidth', - description = 'The minimum width of the window, if it\'s resizable. Cannot be less than 1.', - }, - { - type = 'number', - name = 'minheight', - description = 'The minimum height of the window, if it\'s resizable. Cannot be less than 1.', - }, - { - type = 'boolean', - name = 'highdpi', - description = 'True if high-dpi mode should be used on Retina displays in macOS and iOS. Does nothing on non-Retina displays.', - }, - { - type = 'number', - name = 'x', - description = 'The x-coordinate of the window\'s position in the specified display.', - }, - { - type = 'number', - name = 'y', - description = 'The y-coordinate of the window\'s position in the specified display.', - }, - }, - }, - }, - returns = { - { - type = 'boolean', - name = 'success', - description = 'True if successful, false otherwise.', - }, - }, - }, - }, - }, - }, - enums = { - require(path .. 'enums.DisplayOrientation'), - require(path .. 'enums.FullscreenType'), - require(path .. 'enums.MessageBoxType'), - }, -} \ No newline at end of file diff --git a/modules/window/enums/FullscreenType.lua b/modules/window/enums/FullscreenType.lua deleted file mode 100644 index f9aed8a..0000000 --- a/modules/window/enums/FullscreenType.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'FullscreenType', - description = 'Types of fullscreen modes.', - constants = { - { - name = 'desktop', - description = 'Sometimes known as borderless fullscreen windowed mode. A borderless screen-sized window is created which sits on top of all desktop UI elements. The window is automatically resized to match the dimensions of the desktop, and its size cannot be changed.', - }, - { - name = 'exclusive', - description = 'Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor.', - }, - { - name = 'normal', - description = 'Standard exclusive-fullscreen mode. Changes the display mode (actual resolution) of the monitor.', - }, - }, -} \ No newline at end of file diff --git a/modules/window/enums/MessageBoxType.lua b/modules/window/enums/MessageBoxType.lua deleted file mode 100644 index ea93edc..0000000 --- a/modules/window/enums/MessageBoxType.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - name = 'MessageBoxType', - description = 'Types of message box dialogs. Different types may have slightly different looks.', - constants = { - { - name = 'info', - description = 'Informational dialog.', - }, - { - name = 'warning', - description = 'Warning dialog.', - }, - { - name = 'error', - description = 'Error dialog.', - }, - }, -} \ No newline at end of file From 8736ae547a65ce5b30441ccbe3cf1506296d253d Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 15:43:09 +0800 Subject: [PATCH 02/57] more newlines --- genEmmyAPI.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 0c3b5a2..eb871de 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -84,7 +84,7 @@ local function genType(name, type) end end - return code + return code .. '\n\n' end local function genEnum(enum) @@ -100,7 +100,7 @@ local function genEnum(enum) end code = code .. '\t[\'' .. name .. '\'] = ' .. i .. ',\n' end - code = code .. '}\n' + code = code .. '}\n\n' return code end @@ -108,7 +108,7 @@ local function genModule(name, api) local f = assert(io.open("api/" .. name .. ".lua", 'w')) f:write("---@class " .. name .. '\n') if api.description then - f:write('---' .. safeDesc(api.description) .. '\n') + f:write('---' .. safeDesc(api.description) .. '\n\n') end f:write("local m = {}\n\n") @@ -117,7 +117,7 @@ local function genModule(name, api) for i, type in ipairs(api.types) do f:write('--region ' .. type.name .. '\n') f:write(genType(type.name, type)) - f:write('--endregion ' .. type.name .. '\n') + f:write('--endregion ' .. type.name .. '\n\n') end end From 817884ef7294ca4fef23a35b30d3f4421c13b553 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 16:38:47 +0800 Subject: [PATCH 03/57] generate better type --- genEmmyAPI.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index eb871de..0b8c660 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -5,6 +5,15 @@ local function safeDesc(src) return string.gsub(src, "\n", "\n---") end +local function genCorrectType(type) + type = string.gsub(type, ' or ', '|') + type = string.gsub(type, 'light userdata', 'userdata') + if type:find(' ') then + print('maybe wrong type: ' .. type) + end + return type +end + local function genReturns(variant) local returns = variant.returns local s = "" @@ -13,9 +22,9 @@ local function genReturns(variant) num = #returns for i, ret in ipairs(returns) do if i == 1 then - s = ret.type + s = genCorrectType(ret.type) else - s = s .. ', ' .. ret.type + s = s .. ', ' .. genCorrectType(ret.type) end end else @@ -39,16 +48,16 @@ local function genFunction(moduleName, fun, static) else argList = argList .. ', ' .. argument.name end - code = code .. '---@param ' .. argument.name .. ' ' .. argument.type .. ' @' .. argument.description .. '\n' + code = code .. '---@param ' .. argument.name .. ' ' .. genCorrectType(argument.type) .. ' @' .. argument.description .. '\n' end else code = code .. '---@overload fun(' for argIdx, argument in ipairs(arguments) do if argIdx == 1 then - code = code .. argument.name .. ':' .. argument.type + code = code .. argument.name .. ':' .. genCorrectType(argument.type) else code = code .. ', ' - code = code .. argument.name .. ':' .. argument.type + code = code .. argument.name .. ':' .. genCorrectType(argument.type) end end code = code .. '):' .. genReturns(variant) From 618f928179e4c6b77fd922c0b499d62244fed610 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 16:40:48 +0800 Subject: [PATCH 04/57] reconstruct genFunction --- genEmmyAPI.lua | 71 +++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 0b8c660..a13ec82 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -14,29 +14,28 @@ local function genCorrectType(type) return type end -local function genReturns(variant) - local returns = variant.returns - local s = "" - local num = 0 - if returns and #returns > 0 then - num = #returns - for i, ret in ipairs(returns) do - if i == 1 then - s = genCorrectType(ret.type) - else - s = s .. ', ' .. genCorrectType(ret.type) - end - end - else - s = "void" - end - return s, num -end - local function genFunction(moduleName, fun, static) local code = "---" .. safeDesc(fun.description) .. "\n" local argList = '' + local function gen_phrase(code, comment, ...) + local res = {'---@'..code, ...} + if comment ~= nil then + table.insert(res, '@'..safeDesc(comment)) + end + return table.concat(res, ' ') .. '\n' + end + + local function map(f, xs) + if xs == nil then return nil end + local res = {} + for _, v in ipairs(xs) do + table.insert(res, f(v)) + end + return res + end + + for vIdx, variant in ipairs(fun.variants) do -- args local arguments = variant.arguments @@ -48,27 +47,33 @@ local function genFunction(moduleName, fun, static) else argList = argList .. ', ' .. argument.name end - code = code .. '---@param ' .. argument.name .. ' ' .. genCorrectType(argument.type) .. ' @' .. argument.description .. '\n' - end - else - code = code .. '---@overload fun(' - for argIdx, argument in ipairs(arguments) do - if argIdx == 1 then - code = code .. argument.name .. ':' .. genCorrectType(argument.type) + if argument.name == '...' then + code = code .. gen_phrase('vararg', argument.description, genCorrectType(argument.type)) else - code = code .. ', ' - code = code .. argument.name .. ':' .. genCorrectType(argument.type) + code = code .. gen_phrase('param', argument.description, argument.name, genCorrectType(argument.type)) end end - code = code .. '):' .. genReturns(variant) - code = code .. '\n' + else + code = code .. gen_phrase('overload', variant.description, + 'fun('.. + table.concat(map( + function(argu) + if argu.name == '...' then return '...' end + return argu.name..': '..genCorrectType(argu.type) end, + arguments), ', ')..'):'.. + table.concat(map( + function(ret) return genCorrectType(ret.type) end, + variant.returns) or {'nil'}, ', ')) end end if vIdx == 1 then - local type, num = genReturns(variant) - if num > 0 then - code = code .. '---@return ' .. type .. '\n' + if variant.returns and #variant.returns > 0 then + for _, ret in ipairs(variant.returns) do + code = code .. gen_phrase('return', ret.description, genCorrectType(ret.type), ret.name) + end + else + code = code .. gen_phrase('return', nil, 'nil') end end end From a0434c2f46b3f156f41cc51027d36dbfed13c4b0 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 16:49:15 +0800 Subject: [PATCH 05/57] generate enums first --- genEmmyAPI.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index a13ec82..7cc606b 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -126,6 +126,13 @@ local function genModule(name, api) end f:write("local m = {}\n\n") + -- enums + if api.enums then + for i, enum in ipairs(api.enums) do + f:write(genEnum(enum)) + end + end + -- types if api.types then for i, type in ipairs(api.types) do @@ -135,13 +142,6 @@ local function genModule(name, api) end end - -- enums - if api.enums then - for i, enum in ipairs(api.enums) do - f:write(genEnum(enum)) - end - end - -- modules if api.modules then for i, m in ipairs(api.modules) do From 0b8cbb85ce23f3b1cde5136527ca9dab7282e0f7 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 17:09:26 +0800 Subject: [PATCH 06/57] add callbacks --- genEmmyAPI.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 7cc606b..9c7b676 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -156,6 +156,13 @@ local function genModule(name, api) f:write(genFunction('m', fun, true)) end + -- callbacks + if api.callbacks then + for i, fun in ipairs(api.callbacks) do + f:write(genFunction('m', fun, true)) + end + end + f:write("return m") f:close() end From 0f7199b2ea75248cd1ea11646f3d6b0d7b3e0b36 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 17:09:47 +0800 Subject: [PATCH 07/57] fix supertypes --- genEmmyAPI.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 9c7b676..0f7c491 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -85,8 +85,16 @@ end local function genType(name, type) local code = "---@class " .. type.name - if type.parenttype then - code = code .. ' : ' .. type.parenttype + if type.supertypes then + code = code .. ' : ' + local printed = false + for _, typename in ipairs(type.supertypes) do + if printed then + code = code .. ', ' + end + code = code .. typename + printed = true + end end code = code .. '\n' code = code .. '---' .. safeDesc(type.description) .. '\n' From 70ee994733ceeb3fe79b0beb44b965fcb1725455 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 17:27:22 +0800 Subject: [PATCH 08/57] new enum generation --- genEmmyAPI.lua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 0f7c491..1974d29 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -110,20 +110,16 @@ local function genType(name, type) end local function genEnum(enum) - local code = '---' .. safeDesc(enum.description) .. '\n' - code = code .. enum.name .. ' = {\n' - for i, const in ipairs(enum.constants) do - code = code .. '\t---' .. safeDesc(const.description) .. '\n' - local name = const.name - if name == '\\' then - name = '\\\\' - elseif name == '\'' then - name = '\\\'' + local code = '---@' .. safeDesc(enum.description) .. '\n' + code = code..'---@alias '..enum.name..'\n' + for _, const in ipairs(enum.constants) do + code = code..'---| "\''..const.name..'\'"' + if const.description then + code = code..' #'..safeDesc(const.description) end - code = code .. '\t[\'' .. name .. '\'] = ' .. i .. ',\n' + code = code..'\n' end - code = code .. '}\n\n' - return code + return code..'\n' end local function genModule(name, api) From e4935ac966d2df1a7fda7a442bd7c2f3acb86a9f Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 18:31:22 +0800 Subject: [PATCH 09/57] temporary workaround for multi-line enum comment --- genEmmyAPI.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 1974d29..905df02 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -115,7 +115,7 @@ local function genEnum(enum) for _, const in ipairs(enum.constants) do code = code..'---| "\''..const.name..'\'"' if const.description then - code = code..' #'..safeDesc(const.description) + code = code..' #'..string.gsub(const.description, '\n', ' ') end code = code..'\n' end From 8a8dcebaa8d6d3419524072b88b87a3ec2ec106b Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 18:31:55 +0800 Subject: [PATCH 10/57] fix parameters that share type and document --- genEmmyAPI.lua | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 905df02..0883a07 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -49,28 +49,52 @@ local function genFunction(moduleName, fun, static) end if argument.name == '...' then code = code .. gen_phrase('vararg', argument.description, genCorrectType(argument.type)) + elseif argument.name:find(',') then + for name in argument.name:gmatch('[^, ]+') do + code = code .. gen_phrase('param', argument.description, name, genCorrectType(argument.type)) + end else code = code .. gen_phrase('param', argument.description, argument.name, genCorrectType(argument.type)) end end else code = code .. gen_phrase('overload', variant.description, - 'fun('.. - table.concat(map( - function(argu) - if argu.name == '...' then return '...' end - return argu.name..': '..genCorrectType(argu.type) end, - arguments), ', ')..'):'.. - table.concat(map( - function(ret) return genCorrectType(ret.type) end, - variant.returns) or {'nil'}, ', ')) + 'fun('..table.concat(map( + function(argu) + if argu.name == '...' then + return '...' + elseif argu.name:find(',') then + local ret = '' + local printed = false + for name in argu.name:gmatch('[^ ,]+') do + if printed then + ret = ret..', ' + end + ret = ret..name..': '..genCorrectType(argu.type) + printed = true + end + return ret + else + return argu.name..': '..genCorrectType(argu.type) + end + end, + arguments), ', ').. + '):'..table.concat(map( + function(ret) return genCorrectType(ret.type) end, + variant.returns) or {'nil'}, ', ')) end end if vIdx == 1 then if variant.returns and #variant.returns > 0 then for _, ret in ipairs(variant.returns) do - code = code .. gen_phrase('return', ret.description, genCorrectType(ret.type), ret.name) + if ret.name:find(',') then + for name in ret.name:gmatch('[^ ,]+') do + code = code .. gen_phrase('return', ret.description, genCorrectType(ret.type), name) + end + else + code = code .. gen_phrase('return', ret.description, genCorrectType(ret.type), ret.name) + end end else code = code .. gen_phrase('return', nil, 'nil') From 8a95af94692143016fe971bfffa458a22b046023 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:20:48 +0800 Subject: [PATCH 11/57] fix typename --- genEmmyAPI.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 0883a07..057811c 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -8,6 +8,9 @@ end local function genCorrectType(type) type = string.gsub(type, ' or ', '|') type = string.gsub(type, 'light userdata', 'userdata') + if type:find("'") then + type = '"'..type..'"' + end if type:find(' ') then print('maybe wrong type: ' .. type) end From 8abb9fc34771b0337950bb86564e0048dc993afb Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:34:10 +0800 Subject: [PATCH 12/57] fix enum --- genEmmyAPI.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 057811c..499dc82 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -137,7 +137,7 @@ local function genType(name, type) end local function genEnum(enum) - local code = '---@' .. safeDesc(enum.description) .. '\n' + local code = '---#' .. safeDesc(enum.description) .. '\n' code = code..'---@alias '..enum.name..'\n' for _, const in ipairs(enum.constants) do code = code..'---| "\''..const.name..'\'"' From 62b2249e86957db8f1c6006a9cb13ff8dd886d30 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:36:26 +0800 Subject: [PATCH 13/57] add additional definitions --- genEmmyAPI.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 499dc82..c2cb322 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -178,7 +178,7 @@ local function genModule(name, api) for i, m in ipairs(api.modules) do f:write("---@type " .. name .. '.' .. m.name .. '\n') f:write("m." .. m.name .. ' = nil\n\n') - genModule(name .. '.' .. m.name, m) + genModule(name .. '.' .. m.name, m):close() end end @@ -195,9 +195,11 @@ local function genModule(name, api) end f:write("return m") - f:close() + return f end -genModule('love', api) +local apifile = genModule('love', api) +apifile:write('\n---@alias Variant table|boolean|string|number|Object') +apifile:close() print('--finished.') From 577ad0484a541dcc974a48564e972509fc09985c Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:37:21 +0800 Subject: [PATCH 14/57] fix module --- genEmmyAPI.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index c2cb322..4be9e2a 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -153,7 +153,7 @@ local function genModule(name, api) local f = assert(io.open("api/" .. name .. ".lua", 'w')) f:write("---@class " .. name .. '\n') if api.description then - f:write('---' .. safeDesc(api.description) .. '\n\n') + f:write('---' .. safeDesc(api.description) .. '\n') end f:write("local m = {}\n\n") From ff2be4a16b16cebb544e58d40b01b0ddb2e3973e Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:41:14 +0800 Subject: [PATCH 15/57] update submodule --- love-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/love-api b/love-api index 5d83a94..0639972 160000 --- a/love-api +++ b/love-api @@ -1 +1 @@ -Subproject commit 5d83a940a19bb6747205beb1e10beee1944d0dcd +Subproject commit 0639972eea560d5fc69d2cb8b57ff3af31cee986 From 96d2983dd126e0b7b20ef7d91e1641ef4716222b Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 23:09:31 +0800 Subject: [PATCH 16/57] update README --- README.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 3c8706b..f3a4f9c 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,13 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em ## How to use it -1. Donwload or clone the [LÖVE API](https://github.com/love2d-community/love-api) into a directory on your computer (if you want the API for an older version, check the "releases" of that repository). -2. Create a directory named `api` in the directory, do not put any files in there or run anything in it. -3. Download `genEmmyAPI.lua` from this repository into the same directory (either click on the filename and click "Raw" and save the file, or donwload or clone repository to your computer and move the file over). -4. Run `genEmmyAPI.lua` in the directory, i.e. run `lua genEmmyAPI.lua` in the terminal. This will generate the API autocomplete files in the `api` folder. -5. Copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). +1. Download or clone the [LÖVE API](https://github.com/26f-studio/love-api) into a directory on your computer . +2. Download `genEmmyAPI.lua` from this repository into the same directory (you could click on the filename and click "Raw" and save the file, or download or clone repository to your computer and move the file over). +3. Alternatively, you can just clone this repository *recursively* `--recursive` **and** with `--config core.symlinks=true`(*you must do this on Windows to correctly generate the symbolic links*). +4. Create an empty directory named `api` in the repository. +5. Run `genEmmyAPI.lua` in the directory, i.e. run `lua genEmmyAPI.lua` in the terminal. It will generate the API in the `api` folder. +6. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API at `Lua.workspace.library` in the settings. +7. Alternatively, you can copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! @@ -19,33 +21,31 @@ When you want to change the LÖVE version you use, just delete the `api` folder ## Example workflow (Linux) ``` -kirby@devbox:~/devel$ git clone https://github.com/love2d-community/love-api.git -Cloning into 'love-api'... -remote: Enumerating objects: 34, done. -remote: Counting objects: 100% (34/34), done. -remote: Compressing objects: 100% (31/31), done. -remote: Total 4170 (delta 15), reused 15 (delta 3), pack-reused 4136 -Receiving objects: 100% (4170/4170), 4.29 MiB | 3.90 MiB/s, done. -Resolving deltas: 100% (2617/2617), done. -kirby@devbox:~/devel$ git clone https://github.com/kindfulkirby/Emmy-love-api.git +$ git clone https://github.com/26f-studio/Emmy-love-api.git --recursive --config core.symlinks=true Cloning into 'Emmy-love-api'... -remote: Enumerating objects: 9, done. -remote: Counting objects: 100% (9/9), done. -remote: Compressing objects: 100% (9/9), done. -remote: Total 210 (delta 1), reused 2 (delta 0), pack-reused 201 -Receiving objects: 100% (210/210), 186.86 KiB | 898.00 KiB/s, done. -Resolving deltas: 100% (91/91), done. -kirby@devbox:~/devel$ cp Emmy-love-api/genEmmyAPI.lua love-api/ -kirby@devbox:~/devel$ cd love-api/ -kirby@devbox:~/devel/love-api$ mkdir api -kirby@devbox:~/devel/love-api$ lua genEmmyAPI.lua +remote: Enumerating objects: 299, done. +remote: Counting objects: 100% (299/299), done. +remote: Compressing objects: 100% (199/199), done. +remote: Total 541 (delta 164), reused 177 (delta 85), pack-reused 242 +Receiving objects: 100% (541/541), 438.58 KiB | 679.00 KiB/s, done. +Resolving deltas: 100% (286/286), done. +Submodule 'love-api' (https://github.com/26f-studio/love-api) registered for path 'love-api' +Cloning into '/tmp/Emmy-love-api/love-api'... +remote: Enumerating objects: 62, done. +remote: Counting objects: 100% (62/62), done. +remote: Compressing objects: 100% (46/46), done. +remote: Total 4852 (delta 29), reused 34 (delta 15), pack-reused 4790 +Receiving objects: 100% (4852/4852), 4.91 MiB | 3.04 MiB/s, done. +Resolving deltas: 100% (3050/3050), done. +Submodule path 'love-api': checked out '0639972eea560d5fc69d2cb8b57ff3af31cee986' +$ cd Emmy-love-api +$ mkdir api +$ lua genEmmyAPI.lua --finished. -kirby@devbox:~/devel/love-api$ cp -r api/ ../mygame/src/ -kirby@devbox:~/devel/love-api$ ``` - ## Credits Original script by https://github.com/tangzx One tiny modification of the script, README by https://github.com/kindfulkirby +Modification by Imple Lee on GitHub. From 85ec4f5ca83291ef8d11882504fdd3c354430f1d Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 23:11:44 +0800 Subject: [PATCH 17/57] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3a4f9c..0dec4fe 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Once you start or refresh your IDE (might be automatic) you should have autocomp ## Other LÖVE versions -When you want to change the LÖVE version you use, just delete the `api` folder from your project, and redo the steps above for the appropriate version of the API. +When you want to change the LÖVE version you use, just delete everything under the `api` folder, and redo the steps above for the appropriate version of the API. ## Example workflow (Linux) From a4b23c263c28d8670910d654b8ec5468679fd37b Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 6 Mar 2021 23:32:23 +0800 Subject: [PATCH 18/57] fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dec4fe..bc1af88 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em 3. Alternatively, you can just clone this repository *recursively* `--recursive` **and** with `--config core.symlinks=true`(*you must do this on Windows to correctly generate the symbolic links*). 4. Create an empty directory named `api` in the repository. 5. Run `genEmmyAPI.lua` in the directory, i.e. run `lua genEmmyAPI.lua` in the terminal. It will generate the API in the `api` folder. -6. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API at `Lua.workspace.library` in the settings. +6. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings. 7. Alternatively, you can copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! From ce03abcfed55c677f4336e123b111f2e401af5ce Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun, 7 Mar 2021 00:23:57 +0800 Subject: [PATCH 19/57] Squashed commit of the following: commit 307cce3a052482cfce717e22e175b3413006f1f5 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:21:25 2021 +0800 add merge as a condition of packaging commit 7361d6c0e86fb6f775b0f268a2e2eb61ecedd5e5 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:19:22 2021 +0800 rename the name of api commit 1031eb2cf62dcfa4a7138afb109516450ad56d3b Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:17:45 2021 +0800 upload the zipped artifact commit 2071439edae1bf22dd5f77b31c4b20e399154938 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:11:51 2021 +0800 keep the `lua` version the same with my own commit d3adb8a28e43ee1e3b5b3464668286fbe406e69f Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:08:30 2021 +0800 test symbolic links commit 52eb08a4bdbe5352a51954f8e3ef96416df2f108 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:06:35 2021 +0800 test symbolic links commit 422d4b27d00e8839ded9f149dfcb8e03424e607b Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:05:19 2021 +0800 test symbolic links commit 10beba3888202615555b007969ba536de8fb0ef0 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:03:00 2021 +0800 fix enum description commit 477badf702b2c77fecaa70e2a28f0a3a571e1172 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun Mar 7 00:00:35 2021 +0800 add upload-related actions commit b9300ad5d9c575252cc9847fd52a315395bfbfab Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat Mar 6 23:55:28 2021 +0800 fix repository position and checkout submodules commit 6ba8c479db9a3b6591c4c126198786b151f456ac Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat Mar 6 23:51:51 2021 +0800 fix `lua -v` commit 7b5c815054fd300061241a9500ca956d0e7e09f1 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat Mar 6 23:49:35 2021 +0800 try another lua library commit ad7861987b0d542493082416945d04c1f0dd9b31 Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat Mar 6 23:45:20 2021 +0800 second try on github actions commit b9c2c7a71d9402444aec1fd8292534ee661576de Author: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat Mar 6 23:41:56 2021 +0800 first try on github actions --- .github/workflows/package.yml | 20 ++++++++++++++++++++ genEmmyAPI.lua | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..53449b3 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,20 @@ +on: [push, pull_request_review, merge] +jobs: + packaging-actions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: leafo/gh-actions-lua@v8.0.0 + with: + luaVersion: "5.3.3" + - run: cd /home/runner/work/Emmy-love-api/Emmy-love-api + - run: mkdir api -p + - run: rm api/* -rf + - run: lua genEmmyAPI.lua + - run: zip -r api.zip api + - uses: actions/upload-artifact@v2 + with: + name: api.zip + path: /home/runner/work/Emmy-love-api/Emmy-love-api/api.zip \ No newline at end of file diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 4be9e2a..25b88d7 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -137,7 +137,10 @@ local function genType(name, type) end local function genEnum(enum) - local code = '---#' .. safeDesc(enum.description) .. '\n' + local code = '' + if enum.description then + code = code..'---#' .. safeDesc(enum.description) .. '\n' + end code = code..'---@alias '..enum.name..'\n' for _, const in ipairs(enum.constants) do code = code..'---| "\''..const.name..'\'"' From 52479fb6156c749031ca56ec985e400d453f2e95 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun, 7 Mar 2021 00:31:43 +0800 Subject: [PATCH 20/57] remove `merge` from actions `on` --- .github/workflows/package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 53449b3..d04be72 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,4 +1,4 @@ -on: [push, pull_request_review, merge] +on: [push, pull_request_review] jobs: packaging-actions: runs-on: ubuntu-latest From 4e4986cef4d75dfb4f9122e139885141794677e6 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun, 7 Mar 2021 00:41:47 +0800 Subject: [PATCH 21/57] describe the GitHub actions in the README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc1af88..b18c954 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,9 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em 3. Alternatively, you can just clone this repository *recursively* `--recursive` **and** with `--config core.symlinks=true`(*you must do this on Windows to correctly generate the symbolic links*). 4. Create an empty directory named `api` in the repository. 5. Run `genEmmyAPI.lua` in the directory, i.e. run `lua genEmmyAPI.lua` in the terminal. It will generate the API in the `api` folder. -6. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings. -7. Alternatively, you can copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). +6. Alternatively, you can download the `api.zip` from the artifacts of the latest GitHub Actions and unzip it as the `api` directory described above. +7. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings. +8. Alternatively, you can copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! From fa8f83ad8aacfb6bde3c429b56a10635814967c7 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun, 7 Mar 2021 01:20:07 +0800 Subject: [PATCH 22/57] add a link in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b18c954..75bd876 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em 3. Alternatively, you can just clone this repository *recursively* `--recursive` **and** with `--config core.symlinks=true`(*you must do this on Windows to correctly generate the symbolic links*). 4. Create an empty directory named `api` in the repository. 5. Run `genEmmyAPI.lua` in the directory, i.e. run `lua genEmmyAPI.lua` in the terminal. It will generate the API in the `api` folder. -6. Alternatively, you can download the `api.zip` from the artifacts of the latest GitHub Actions and unzip it as the `api` directory described above. +6. Alternatively, you can download the `api.zip` from the artifacts of the latest [GitHub Actions](https://github.com/26F-Studio/Emmy-love-api/actions) and unzip it as the `api` directory described above. 7. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings. 8. Alternatively, you can copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). From fe01a1024beac01503e2bb0d9eff4470af046245 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun, 7 Mar 2021 01:24:01 +0800 Subject: [PATCH 23/57] remove the `zip` in the workflow maybe Github will automatically zip it again... --- .github/workflows/package.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d04be72..18672ad 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -13,8 +13,7 @@ jobs: - run: mkdir api -p - run: rm api/* -rf - run: lua genEmmyAPI.lua - - run: zip -r api.zip api - uses: actions/upload-artifact@v2 with: - name: api.zip - path: /home/runner/work/Emmy-love-api/Emmy-love-api/api.zip \ No newline at end of file + name: api + path: /home/runner/work/Emmy-love-api/Emmy-love-api/api \ No newline at end of file From 57c0677e2bc0a146968bf6c22e024517683818c7 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 8 Mar 2021 08:44:14 +0800 Subject: [PATCH 24/57] update usage and example workflow in README --- README.md | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 75bd876..0c1101c 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,24 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em ## How to use it -1. Download or clone the [LÖVE API](https://github.com/26f-studio/love-api) into a directory on your computer . -2. Download `genEmmyAPI.lua` from this repository into the same directory (you could click on the filename and click "Raw" and save the file, or download or clone repository to your computer and move the file over). -3. Alternatively, you can just clone this repository *recursively* `--recursive` **and** with `--config core.symlinks=true`(*you must do this on Windows to correctly generate the symbolic links*). -4. Create an empty directory named `api` in the repository. -5. Run `genEmmyAPI.lua` in the directory, i.e. run `lua genEmmyAPI.lua` in the terminal. It will generate the API in the `api` folder. -6. Alternatively, you can download the `api.zip` from the artifacts of the latest [GitHub Actions](https://github.com/26F-Studio/Emmy-love-api/actions) and unzip it as the `api` directory described above. -7. If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings. -8. Alternatively, you can copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). +### Prepare the `api` directory + +- You can download the `api.zip` from the artifacts of the latest [GitHub Actions](https://github.com/26F-Studio/Emmy-love-api/actions) and unzip the `api` from it. +- Alternatively, you can build the `api` directory by yourself. + +#### How to build the `api` directory by one's own + +1. Prepare the whole project. + - You can clone this repository *recursively* `--recursive` with symbolic links enabled `--config core.symlinks=true`(*this is a must on `Windows` to generate correct symbolic links*). + - Alternatively, you can clone the [LÖVE API](https://github.com/26F-Studio/love-api) and put the `genEmmyAPI.lua`(from this repository) into it. +2. Create an empty directory named `api` in the same directory where `genEmmyAPI.lua` is. +3. `lua genEmmyAPI.lua` and the API is generated in the `api` directory. + + +### Use the APIs in your project + +- Copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). +- If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings and not copy the `api` folder. Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! @@ -22,22 +32,21 @@ When you want to change the LÖVE version you use, just delete everything under ## Example workflow (Linux) ``` -$ git clone https://github.com/26f-studio/Emmy-love-api.git --recursive --config core.symlinks=true +$ git clone https://github.com/26F-Studio/Emmy-love-api.git --recursive --config core.symlinks=true --depth=1 --shallow-submodules --single-branch Cloning into 'Emmy-love-api'... -remote: Enumerating objects: 299, done. -remote: Counting objects: 100% (299/299), done. -remote: Compressing objects: 100% (199/199), done. -remote: Total 541 (delta 164), reused 177 (delta 85), pack-reused 242 -Receiving objects: 100% (541/541), 438.58 KiB | 679.00 KiB/s, done. -Resolving deltas: 100% (286/286), done. +remote: Enumerating objects: 11, done. +remote: Counting objects: 100% (11/11), done. +remote: Compressing objects: 100% (6/6), done. +remote: Total 11 (delta 0), reused 7 (delta 0), pack-reused 0 +Unpacking objects: 100% (11/11), 3.87 KiB | 793.00 KiB/s, done. Submodule 'love-api' (https://github.com/26f-studio/love-api) registered for path 'love-api' -Cloning into '/tmp/Emmy-love-api/love-api'... -remote: Enumerating objects: 62, done. -remote: Counting objects: 100% (62/62), done. -remote: Compressing objects: 100% (46/46), done. -remote: Total 4852 (delta 29), reused 34 (delta 15), pack-reused 4790 -Receiving objects: 100% (4852/4852), 4.91 MiB | 3.04 MiB/s, done. -Resolving deltas: 100% (3050/3050), done. +Cloning into 'Emmy-love-api/love-api'... +remote: Enumerating objects: 196, done. +remote: Counting objects: 100% (196/196), done. +remote: Compressing objects: 100% (153/153), done. +remote: Total 196 (delta 83), reused 82 (delta 30), pack-reused 0 +Receiving objects: 100% (196/196), 174.33 KiB | 448.00 KiB/s, done. +Resolving deltas: 100% (83/83), done. Submodule path 'love-api': checked out '0639972eea560d5fc69d2cb8b57ff3af31cee986' $ cd Emmy-love-api $ mkdir api From 4b067da3c2a890953400973c1920d259f2d8bfdd Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Tue, 9 Mar 2021 20:16:47 +0800 Subject: [PATCH 25/57] update the usage as Lua plugin on VSCode changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c1101c..4e3eb7f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em ### Use the APIs in your project - Copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). -- If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API as `Lua.workspace.library: {".../api": true}` in the settings and not copy the `api` folder. +- If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API by adding a term in `Lua.workspace.library` in the settings and not copy the `api` folder. Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! From 80007a39b8ffbf44fe0c6be6c995828dc2ac24cb Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 13 Mar 2021 23:57:55 +0800 Subject: [PATCH 26/57] properly escape the string, fixes #8 --- genEmmyAPI.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 25b88d7..1522959 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -8,9 +8,7 @@ end local function genCorrectType(type) type = string.gsub(type, ' or ', '|') type = string.gsub(type, 'light userdata', 'userdata') - if type:find("'") then - type = '"'..type..'"' - end + type = string.format("%q", type) if type:find(' ') then print('maybe wrong type: ' .. type) end @@ -143,7 +141,7 @@ local function genEnum(enum) end code = code..'---@alias '..enum.name..'\n' for _, const in ipairs(enum.constants) do - code = code..'---| "\''..const.name..'\'"' + code = code..'---| '..string.format("%q", "'"..const.name.."'") if const.description then code = code..' #'..string.gsub(const.description, '\n', ' ') end From e52d91efb01a05fb6fcf7ae3a0617f0bdc4f3c26 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sun, 14 Mar 2021 01:46:04 +0800 Subject: [PATCH 27/57] fix wrong type annotation, fixes #8 --- genEmmyAPI.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 1522959..5e1b429 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -8,9 +8,10 @@ end local function genCorrectType(type) type = string.gsub(type, ' or ', '|') type = string.gsub(type, 'light userdata', 'userdata') - type = string.format("%q", type) - if type:find(' ') then + if type:find('[^a-zA-Z0-9|_]') then print('maybe wrong type: ' .. type) + type = string.format("%q", type) + print('quoted as: '..type) end return type end From 547077d634032b936931e59bf359239cd965398a Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Thu, 18 Mar 2021 23:56:02 +0800 Subject: [PATCH 28/57] got comment on enums, fixes #2 --- genEmmyAPI.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 5e1b429..693c796 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -138,15 +138,14 @@ end local function genEnum(enum) local code = '' if enum.description then - code = code..'---#' .. safeDesc(enum.description) .. '\n' + code = code..'---' .. safeDesc(enum.description) .. '\n' end code = code..'---@alias '..enum.name..'\n' for _, const in ipairs(enum.constants) do - code = code..'---| '..string.format("%q", "'"..const.name.."'") if const.description then - code = code..' #'..string.gsub(const.description, '\n', ' ') + code = code .. '---' .. safeDesc(const.description) .. '\n' end - code = code..'\n' + code = code..'---| '..string.format("%q", "'"..const.name.."'") .. '\n' end return code..'\n' end From e3e9875c8d77fb6991c1f24922a7a4b64708d14f Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Thu, 1 Apr 2021 18:14:46 +0800 Subject: [PATCH 29/57] update submodule `love-api` --- love-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/love-api b/love-api index 0639972..c4044ea 160000 --- a/love-api +++ b/love-api @@ -1 +1 @@ -Subproject commit 0639972eea560d5fc69d2cb8b57ff3af31cee986 +Subproject commit c4044eace4e776ace3ac0979f5f2ec3ee12bec4c From 510d0f385888a9fc5c9c3c3304e1bbcd3e169bba Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Apr 2021 03:02:48 +0800 Subject: [PATCH 30/57] A total rewrite --- .github/workflows/package.yml | 2 +- checkAPIformat.lua | 156 ++++++++++ genEmmyAPI.lua | 546 ++++++++++++++++++++++++---------- 3 files changed, 545 insertions(+), 159 deletions(-) create mode 100644 checkAPIformat.lua diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 18672ad..d91a41a 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -10,7 +10,7 @@ jobs: with: luaVersion: "5.3.3" - run: cd /home/runner/work/Emmy-love-api/Emmy-love-api - - run: mkdir api -p + - run: mkdir api/love -p - run: rm api/* -rf - run: lua genEmmyAPI.lua - uses: actions/upload-artifact@v2 diff --git a/checkAPIformat.lua b/checkAPIformat.lua new file mode 100644 index 0000000..a3d77e8 --- /dev/null +++ b/checkAPIformat.lua @@ -0,0 +1,156 @@ +---@class my_nullable +---@field name 'nullable' +---@field wrapped my_type + +---@class my_many +---@field name 'many' +---@field wrapped my_type + +---@alias my_type my_nullable|my_many|string + +---@param type my_type +---@return my_nullable +local function optional(type) + return { + name='nullable', + wrapped=type + } +end + +---@param type my_type +---@return my_many +local function array(type) + return { + name='many', + wrapped=type + } +end + +---@param Type my_type +---@return string +local function stringify(Type) + if type(Type) == 'string' then + return string + else + assert(type(Type) == 'table') + if Type.name == 'nullable' then + return stringify(Type.wrapped)..'?' + elseif Type.name == 'many' then + return stringify(Type.wrapped)..'[]' + else + assert(false, 'illegal type') + end + end +end + +-- generated from EmmyLua in `genEmmyAPI.lua` +local metainfo = { + Love={ + version="string", + functions=array("Function"), + modules=array("Module"), + types=array("Type"), + callbacks=array("Function"), + }, + Module={ + name="string", + description="string", + types=array("Type"), + functions=array("Function"), + enums=array("Enum"), + }, + Enum={ + name="string", + description="string", + constants=array("EnumConstant"), + }, + EnumConstant={ + name="string", + description="string", + }, + Type={ + name="string", + description="string", + constructors=optional(array("string")), + functions=optional(array("Function")), + supertypes=optional(array("string")), + }, + Function={ + name="string", + description="string", + variants=array("OneFunction"), + }, + OneFunction={ + returns=optional(array("FunctionField")), + arguments=optional(array("FunctionField")), + description=optional("string"), + }, + FunctionField={ + type="string", + name="string", + default=optional("string"), + description="string", + table=optional(array("FunctionField")), + }, +} + +---@param obj any +---@param Type my_type +---@param prefix string|nil +local function check(obj, Type, prefix) + local function match(expected, got) + print('<'..prefix..'>: expected '..expected..', but got '..got) + end + if prefix == nil then + prefix = '' + end + if type(Type) == 'table' then + if Type.name == 'nullable' then + if obj ~= nil then + check(obj, Type.wrapped, prefix..'?') + end + elseif Type.name == 'many' then + if type(obj) ~= "table" then + match(stringify(Type), type(obj)) + return + end + for key, value in pairs(obj) do + if type(key) ~= "number" then + print('<'..prefix..'>: nonnumeric key', key) + else + check(value, Type.wrapped, prefix..'['..key..']') + end + end + else + assert(false, 'illegal type') + end + elseif Type == 'string' then + if type(obj) ~= 'string' then + match('string', type(obj)) + return + end + else + if type(obj) ~= "table" then + match(stringify(Type), type(obj)) + return + end + local info = assert(metainfo[Type]) + local need_to_be_checked = {} + for k, v in pairs(info) do + need_to_be_checked[k] = v + end + for k, v in pairs(obj) do + if not info[k] then + print('<'..prefix..'>: extra field '..k ..' and value '..type(v)) + else + check(v, info[k], prefix..'.'..k) + need_to_be_checked[k] = nil + end + end + for k, v in pairs(need_to_be_checked) do + check(nil, v, prefix..'.'..k) + end + end +end + +check(require 'love_api', 'Love', 'love') \ No newline at end of file diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 693c796..6ed3e81 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -1,14 +1,94 @@ +--region printed +---@alias printed printed[]|string -local api = require('love_api') +---@param p printed +---@return string, number +local function printing(p) + if type(p) == "string" then + return p, 0 + end + local subprinting, newlines = {}, 1 + for _, subprint in ipairs(p) do + local new_sub, new_num = printing(subprint) + table.insert(subprinting, new_sub) + if new_num >= newlines then + newlines = new_num + 1 + end + end + return table.concat(subprinting, string.rep('\n', newlines)), newlines +end -local function safeDesc(src) - return string.gsub(src, "\n", "\n---") +---@generic T +---@param f fun(t:T):printed +---@param mapped T[] +---@param added printed[]|nil +---@return printed +local function map_add(f, mapped, added) + if added == nil then + added = {} + end + local really_added = false + for _, t in ipairs(mapped) do + table.insert(added, f(t)) + really_added = true + end + if really_added then + return added + else + return {} + end end -local function genCorrectType(type) +---@param p printed +---@return string[] +local function squash(p) + local ret = {} + if type(p) == 'string' then + table.insert(ret, p) + else + for _, pi in ipairs(p) do + for _, item in ipairs(squash(pi)) do + table.insert(ret, item) + end + end + end + return ret +end + +---@param printing printed +local function put(printed, printing, pos) + if pos == nil then + table.insert(printed, printing) + else + table.insert(printed, pos, printing) + end +end +local function putf(printed,...) + put(printed, string.format(...)) +end + +---@param description string +---@param without_first_dashes? boolean +---@return printed +local function gen_desc(description, without_first_dashes) + local ret = {} + for _ in description:gmatch("[^\n]*") do + if without_first_dashes then + table.insert(ret, _) + without_first_dashes = false + else + table.insert(ret, '---'.._) + end + end + return ret +end +--endregion printed + +---@param type string +local function type_corrector(type) type = string.gsub(type, ' or ', '|') type = string.gsub(type, 'light userdata', 'userdata') - if type:find('[^a-zA-Z0-9|_]') then + if type:find('[^a-zA-Z0-9|_-]') then print('maybe wrong type: ' .. type) type = string.format("%q", type) print('quoted as: '..type) @@ -16,191 +96,341 @@ local function genCorrectType(type) return type end -local function genFunction(moduleName, fun, static) - local code = "---" .. safeDesc(fun.description) .. "\n" - local argList = '' +--region prelude +---@class field +---@field default string|nil +---@field description string +---@field type string + +---@alias prelude table> - local function gen_phrase(code, comment, ...) - local res = {'---@'..code, ...} - if comment ~= nil then - table.insert(res, '@'..safeDesc(comment)) +---@param prelude prelude +---@param p printed[] +---@return printed +local function gen_prelude(prelude, p) + local added = false + for typename, fields in pairs(prelude) do + local thisp = {} + put(thisp, '---@class '..typename) + for name, info in pairs(fields) do + local desc = ' # ' + if info.default then + desc = desc..'(default to '..info.default..') ' + end + desc = desc..info.description + if name ~= '...' then + put(thisp, '---@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) + else + print('found ... in table definition '..typename) + put(thisp, '------@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) + end end - return table.concat(res, ' ') .. '\n' + put(p, thisp) + added = true end + if added then + return p + else + return {} + end +end - local function map(f, xs) - if xs == nil then return nil end - local res = {} - for _, v in ipairs(xs) do - table.insert(res, f(v)) +---@param prelude prelude +---@param t FunctionField[] +---@param gen_unique_name fun():string +---@return string typename +local function find_or_add(prelude, t, gen_unique_name) + if t == nil then + return 'table' + end + local actual_fields = {} + for _, field in pairs(t) do + if field.type ~= 'table' then + actual_fields[field.name] = { + type=field.type, + default=field.default, + description=field.description + } + else + local typename = find_or_add(field.table) + actual_fields[field.name] = { + type=typename, + default=field.default, + description=field.description + } end - return res end + local actual_length = #actual_fields + for typename, fields in pairs(prelude) do + if (function() + if #fields ~= actual_length then return end + for fieldname, fieldinfo in pairs(fields) do + local actualinfo = actual_fields[fieldname] + if not actualinfo then return end + if fieldinfo.default ~= actualinfo.default then return end + if fieldinfo.description ~= actualinfo.description then return end + if fieldinfo.type ~= actualinfo.type then return end + end + return true + end)() then + return typename + end + end + local name = gen_unique_name() + prelude[name] = actual_fields + return name +end - - for vIdx, variant in ipairs(fun.variants) do - -- args - local arguments = variant.arguments - if arguments and #arguments > 0 then - if vIdx == 1 then - for argIdx, argument in ipairs(arguments) do - if argIdx == 1 then - argList = argument.name - else - argList = argList .. ', ' .. argument.name - end - if argument.name == '...' then - code = code .. gen_phrase('vararg', argument.description, genCorrectType(argument.type)) - elseif argument.name:find(',') then - for name in argument.name:gmatch('[^, ]+') do - code = code .. gen_phrase('param', argument.description, name, genCorrectType(argument.type)) - end - else - code = code .. gen_phrase('param', argument.description, argument.name, genCorrectType(argument.type)) - end - end - else - code = code .. gen_phrase('overload', variant.description, - 'fun('..table.concat(map( - function(argu) - if argu.name == '...' then - return '...' - elseif argu.name:find(',') then - local ret = '' - local printed = false - for name in argu.name:gmatch('[^ ,]+') do - if printed then - ret = ret..', ' - end - ret = ret..name..': '..genCorrectType(argu.type) - printed = true - end - return ret - else - return argu.name..': '..genCorrectType(argu.type) - end - end, - arguments), ', ').. - '):'..table.concat(map( - function(ret) return genCorrectType(ret.type) end, - variant.returns) or {'nil'}, ', ')) +---@param items FunctionField[] +---@param prelude prelude +---@param gen_unique_name fun():string +---@return fun():FunctionField|nil +local function expand_items(items, prelude, gen_unique_name) + local k = 1 + local temp = nil + return function() + if not items then return end + if temp then + local t = temp() + if t ~= nil then return t end + temp = nil + end + local item = items[k] + k = k + 1 + if not item then return end + local typename = item.type + if typename == 'table' then + typename = find_or_add(prelude, item.table, gen_unique_name) + if typename == 'table' then + print('type is table but no field called table at '..item.name) end + else + typename = type_corrector(typename) + end + local function get_returned(name) + return { + type=typename, + name=name, + default=item.default, + description=item.description + } + end + if not item.name:find(',') then return get_returned(item.name) end + local names = item.name:gmatch('[^ ,]+') + function temp() + local name = names() + if not name then return end + return get_returned(name) end + return temp() + end +end +--endregion prelude + + +---@class Function +---@field name string +---@field description string +---@field variants OneFunction[] + +---@class OneFunction +---@field returns FunctionField[]|nil +---@field arguments FunctionField[]|nil +---@field description string|nil - if vIdx == 1 then - if variant.returns and #variant.returns > 0 then - for _, ret in ipairs(variant.returns) do - if ret.name:find(',') then - for name in ret.name:gmatch('[^ ,]+') do - code = code .. gen_phrase('return', ret.description, genCorrectType(ret.type), name) - end +---@class FunctionField +---@field type string +---@field name string +---@field default string|nil +---@field description string +---@field table FunctionField[]|nil + +---@param prelude prelude +---@param prefix string +local function gen_function(prelude, prefix) + -- use a bug(?) in the language server that '-' is allowed in type name + local prelude_prefix = prefix:gsub('[.:]', '-') + ---@param func Function + ---@return printed + return function(func) + local p = {} + local prelude_counter = 0 + local actual_prefix = prelude_prefix..func.name..'-' + local function gen_unique_name() + prelude_counter = prelude_counter + 1 + return actual_prefix..prelude_counter + end + for _, variant in ipairs(func.variants) do + local desc = func.description + if variant.description then + desc = desc .. '\n' .. variant.description + end + local variantp = gen_desc(desc) + local parameter_list = {} + for argument in expand_items(variant.arguments, prelude, gen_unique_name) do + table.insert(parameter_list, argument.name) + local printed = {} + local show_default = argument.default ~= nil + if argument.name == '...' then + put(printed, '---@vararg') + else + put(printed, '---@param') + if argument.default == 'nil' then + put(printed, argument.name..'?') + show_default = false else - code = code .. gen_phrase('return', ret.description, genCorrectType(ret.type), ret.name) + put(printed, argument.name) end end - else - code = code .. gen_phrase('return', nil, 'nil') + put(printed, argument.type) + put(printed, '@') + if show_default then + put(printed, '(default to '..argument.default..')') + end + put(printed, table.concat(gen_desc(argument.description, true), '\n')) + put(variantp, table.concat(printed, ' ')) end + for returned in expand_items(variant.returns, prelude, gen_unique_name) do + local printed = {} + put(printed, '---@return') + put(printed, returned.type) + put(printed, returned.name) + put(printed, '@') + if returned.default then + put(printed, '(default to '..returned.default..')') + end + put(printed, table.concat(gen_desc(returned.description, true), '\n')) + put(variantp, table.concat(printed, ' ')) + end + put(variantp, 'function '..prefix..func.name..'('..table.concat(parameter_list, ', ')..') end') + put(p, squash(variantp)) end + return p end +end + + +---@alias Callback Function - local dot = static and '.' or ':' - code = code .. "function " .. moduleName .. dot .. fun.name .. "(" .. argList .. ") end\n\n" - return code +---@param prelude prelude +---@param prefix string +local function gen_callback(prelude, prefix) + return gen_function(prelude, prefix) end -local function genType(name, type) - local code = "---@class " .. type.name - if type.supertypes then - code = code .. ' : ' - local printed = false - for _, typename in ipairs(type.supertypes) do - if printed then - code = code .. ', ' - end - code = code .. typename - printed = true - end - end - code = code .. '\n' - code = code .. '---' .. safeDesc(type.description) .. '\n' - code = code .. 'local ' .. name .. ' = {}\n' - -- functions - if type.functions then - for i, fun in ipairs(type.functions) do - code = code .. genFunction(name, fun, false) + +---@class Type +---@field name string +---@field description string +---@field constructors string[]|nil # not used +---@field functions Function[]|nil +---@field supertypes string[]|nil + +---@param prelude prelude +local function gen_type(prelude) + ---@param type Type + ---@return printed + return function(type) + local p = gen_desc(type.description) + put(p, '--region '..type.name, 1) + local type_decl = '---@class '..type.name + if type.supertypes then + type_decl = type_decl..': '..table.concat(type.supertypes, ', ') end + put(p, type_decl) + put(p, 'local '..type.name..' = {}') + p = {p} + put(p, map_add(gen_function(prelude, type.name..':'), type.functions, {'-- functions'})) + put(p, '--endregion '..type.name) + return p end +end + + +---@class EnumConstant +---@field name string +---@field description string - return code .. '\n\n' +---@param enum_constant EnumConstant +---@return printed +local function gen_enum_constant(enum_constant) + local p = gen_desc(enum_constant.description) + putf(p, '---| %q', "'"..enum_constant.name.."'") + return p end -local function genEnum(enum) - local code = '' - if enum.description then - code = code..'---' .. safeDesc(enum.description) .. '\n' - end - code = code..'---@alias '..enum.name..'\n' - for _, const in ipairs(enum.constants) do - if const.description then - code = code .. '---' .. safeDesc(const.description) .. '\n' - end - code = code..'---| '..string.format("%q", "'"..const.name.."'") .. '\n' - end - return code..'\n' + +---@class Enum +---@field name string +---@field description string +---@field constants EnumConstant[] + +---@param enum Enum +---@return printed +local function gen_enum(enum) + local p = gen_desc(enum.description) + put(p, '---@alias '..enum.name) + put(p, map_add(gen_enum_constant, enum.constants)) + return squash(p) end -local function genModule(name, api) - local f = assert(io.open("api/" .. name .. ".lua", 'w')) - f:write("---@class " .. name .. '\n') - if api.description then - f:write('---' .. safeDesc(api.description) .. '\n') - end - f:write("local m = {}\n\n") - -- enums - if api.enums then - for i, enum in ipairs(api.enums) do - f:write(genEnum(enum)) - end - end +WHERE='api/%s.lua' - -- types - if api.types then - for i, type in ipairs(api.types) do - f:write('--region ' .. type.name .. '\n') - f:write(genType(type.name, type)) - f:write('--endregion ' .. type.name .. '\n\n') - end - end - -- modules - if api.modules then - for i, m in ipairs(api.modules) do - f:write("---@type " .. name .. '.' .. m.name .. '\n') - f:write("m." .. m.name .. ' = nil\n\n') - genModule(name .. '.' .. m.name, m):close() - end - end +---@class Module +---@field name string # not used in documentation +---@field description string +---@field types Type[] +---@field functions Function[] +---@field enums Enum[] - -- functions - for i, fun in ipairs(api.functions) do - f:write(genFunction('m', fun, true)) - end +---@param module Module +---@return printed +local function gen_write_module(module) + local p = {} + local header = gen_desc(module.description) + table.insert(header, 'local '..module.name..' = {}') + put(p, header) + local prelude = {} + put(p, map_add(gen_type(prelude), module.types, {'-- types'})) + put(p, map_add(gen_function(prelude, module.name..'.'), module.functions, {'-- functions'})) + put(p, map_add(gen_enum, module.enums, {'-- enums'})) + put(p, gen_prelude(prelude, {'-- preludes'})) + put(p, 'return '..module.name) + local f = assert(io.open(string.format(WHERE, 'love/'..module.name), 'w')) + p, _ = printing(p) + f:write(p) + f:close() + return string.format('love.%s = require "love/%s"', module.name, module.name) +end - -- callbacks - if api.callbacks then - for i, fun in ipairs(api.callbacks) do - f:write(genFunction('m', fun, true)) - end - end - f:write("return m") - return f +---@class Love +---@field version string +---@field functions Function[] +---@field modules Module[] +---@field types Type[] +---@field callbacks Callback[] + +---@param love Love +local function gen_write_love(love) + local p = {} + put(p, 'local love = {}') + putf(p, 'love.version = %q', love.version) + local prelude = {} + put(p, map_add(gen_function(prelude, 'love.'), love.functions, {'-- functions'})) + put(p, map_add(gen_write_module, love.modules, {'-- modules'})) + put(p, map_add(gen_type(prelude), love.types, {'-- types'})) + put(p, map_add(gen_callback(prelude, 'love.'), love.callbacks, {'-- callbacks'})) + put(p, gen_prelude(prelude, {'-- preludes'})) + put(p, 'return love') + put(p, '---@alias Variant table|boolean|string|number|Object') + local f = assert(io.open(string.format(WHERE, 'love'), 'w')) + p, _ = printing(p) + f:write(p) + f:close() end -local apifile = genModule('love', api) -apifile:write('\n---@alias Variant table|boolean|string|number|Object') -apifile:close() -print('--finished.') +gen_write_love(require 'love_api') From 8f23f159566c9db7419d42b28ec78f48f5a0d905 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Apr 2021 03:39:40 +0800 Subject: [PATCH 31/57] fix workflow and use generated annotations --- .github/workflows/package.yml | 3 +- checkAPIformat.lua | 65 +++++++++++++++++++------- genEmmyAPI.lua | 88 +++++++++++++++++------------------ 3 files changed, 91 insertions(+), 65 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d91a41a..842ba42 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -10,8 +10,9 @@ jobs: with: luaVersion: "5.3.3" - run: cd /home/runner/work/Emmy-love-api/Emmy-love-api + - run: rm api -rf - run: mkdir api/love -p - - run: rm api/* -rf + - run: lua checkAPIformat.lua - run: lua genEmmyAPI.lua - uses: actions/upload-artifact@v2 with: diff --git a/checkAPIformat.lua b/checkAPIformat.lua index a3d77e8..4257130 100644 --- a/checkAPIformat.lua +++ b/checkAPIformat.lua @@ -1,9 +1,9 @@ ---@class my_nullable ----@field name 'nullable' +---@field name "'nullable'" ---@field wrapped my_type ---@class my_many ----@field name 'many' +---@field name "'many'" ---@field wrapped my_type ---@alias my_type my_nullable|my_many|string @@ -30,11 +30,11 @@ end ---@return string local function stringify(Type) if type(Type) == 'string' then - return string + return Type else assert(type(Type) == 'table') if Type.name == 'nullable' then - return stringify(Type.wrapped)..'?' + return stringify(Type.wrapped)..'|nil' elseif Type.name == 'many' then return stringify(Type.wrapped)..'[]' else @@ -50,7 +50,7 @@ local metainfo = { functions=array("Function"), modules=array("Module"), types=array("Type"), - callbacks=array("Function"), + callbacks=array("Callback"), }, Module={ name="string", @@ -75,6 +75,7 @@ local metainfo = { functions=optional(array("Function")), supertypes=optional(array("string")), }, + Callback="Function", Function={ name="string", description="string", @@ -97,9 +98,12 @@ local metainfo = { ---@param obj any ---@param Type my_type ---@param prefix string|nil +---@return boolean ok local function check(obj, Type, prefix) - local function match(expected, got) + local ok = true + local function fail_match(expected, got) print('<'..prefix..'>: expected '..expected..', but got '..got) + return false end if prefix == nil then prefix = '' @@ -107,18 +111,18 @@ local function check(obj, Type, prefix) if type(Type) == 'table' then if Type.name == 'nullable' then if obj ~= nil then - check(obj, Type.wrapped, prefix..'?') + ok = ok and check(obj, Type.wrapped, prefix..'?') end elseif Type.name == 'many' then if type(obj) ~= "table" then - match(stringify(Type), type(obj)) - return + return fail_match(stringify(Type), type(obj)) end for key, value in pairs(obj) do if type(key) ~= "number" then print('<'..prefix..'>: nonnumeric key', key) + ok = false else - check(value, Type.wrapped, prefix..'['..key..']') + ok = ok and check(value, Type.wrapped, prefix..'['..key..']') end end else @@ -126,15 +130,16 @@ local function check(obj, Type, prefix) end elseif Type == 'string' then if type(obj) ~= 'string' then - match('string', type(obj)) - return + return fail_match('string', type(obj)) end else + local info = assert(metainfo[Type]) + if type(info) == 'string' then + return check(obj, info, prefix) + end if type(obj) ~= "table" then - match(stringify(Type), type(obj)) - return + return fail_match(stringify(Type), type(obj)) end - local info = assert(metainfo[Type]) local need_to_be_checked = {} for k, v in pairs(info) do need_to_be_checked[k] = v @@ -142,15 +147,39 @@ local function check(obj, Type, prefix) for k, v in pairs(obj) do if not info[k] then print('<'..prefix..'>: extra field '..k ..' and value '..type(v)) + ok = false else - check(v, info[k], prefix..'.'..k) + ok = ok and check(v, info[k], prefix..'.'..k) need_to_be_checked[k] = nil end end for k, v in pairs(need_to_be_checked) do - check(nil, v, prefix..'.'..k) + ok = ok and check(nil, v, prefix..'.'..k) + end + end + return ok +end + +---@return string +local function printer() + local returned = {} + local function p(where, ...) + table.insert(where, string.format(...)) + end + for typename, def in pairs(metainfo) do + local thisone = {} + if type(def) == "string" then + p(thisone, '---@alias %s %s', typename, def) + else + p(thisone, '---@class %s', typename) + for fieldname, fieldtype in pairs(def) do + p(thisone, '---@field %s %s', fieldname, stringify(fieldtype)) + end end + p(returned, table.concat(thisone, '\n')) end + return table.concat(returned, '\n\n') end -check(require 'love_api', 'Love', 'love') \ No newline at end of file +assert(check(require 'love_api', 'Love', 'love')) +print(printer()) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 6ed3e81..8bc4d6c 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -228,22 +228,59 @@ end --endregion prelude ----@class Function +--region api-definition +---@class EnumConstant ---@field name string ---@field description string ----@field variants OneFunction[] ---@class OneFunction ---@field returns FunctionField[]|nil ----@field arguments FunctionField[]|nil ---@field description string|nil +---@field arguments FunctionField[]|nil + +---@alias Callback Function + +---@class Love +---@field types Type[] +---@field version string +---@field functions Function[] +---@field callbacks Callback[] +---@field modules Module[] + +---@class Type +---@field supertypes string[]|nil +---@field name string +---@field description string +---@field constructors string[]|nil +---@field functions Function[]|nil + +---@class Enum +---@field name string +---@field description string +---@field constants EnumConstant[] + +---@class Function +---@field name string +---@field description string +---@field variants OneFunction[] ---@class FunctionField ---@field type string ----@field name string +---@field table FunctionField[]|nil ---@field default string|nil +---@field name string ---@field description string ----@field table FunctionField[]|nil + +---@class Module +---@field types Type[] +---@field name string +---@field description string +---@field functions Function[] +---@field enums Enum[] +--endregion api-definition + + +WHERE='api/%s.lua' ---@param prelude prelude ---@param prefix string @@ -309,23 +346,12 @@ local function gen_function(prelude, prefix) end end - ----@alias Callback Function - ---@param prelude prelude ---@param prefix string local function gen_callback(prelude, prefix) return gen_function(prelude, prefix) end - ----@class Type ----@field name string ----@field description string ----@field constructors string[]|nil # not used ----@field functions Function[]|nil ----@field supertypes string[]|nil - ---@param prelude prelude local function gen_type(prelude) ---@param type Type @@ -346,11 +372,6 @@ local function gen_type(prelude) end end - ----@class EnumConstant ----@field name string ----@field description string - ---@param enum_constant EnumConstant ---@return printed local function gen_enum_constant(enum_constant) @@ -359,12 +380,6 @@ local function gen_enum_constant(enum_constant) return p end - ----@class Enum ----@field name string ----@field description string ----@field constants EnumConstant[] - ---@param enum Enum ---@return printed local function gen_enum(enum) @@ -374,17 +389,6 @@ local function gen_enum(enum) return squash(p) end - -WHERE='api/%s.lua' - - ----@class Module ----@field name string # not used in documentation ----@field description string ----@field types Type[] ----@field functions Function[] ----@field enums Enum[] - ---@param module Module ---@return printed local function gen_write_module(module) @@ -405,14 +409,6 @@ local function gen_write_module(module) return string.format('love.%s = require "love/%s"', module.name, module.name) end - ----@class Love ----@field version string ----@field functions Function[] ----@field modules Module[] ----@field types Type[] ----@field callbacks Callback[] - ---@param love Love local function gen_write_love(love) local p = {} From d20e22d42797a1e81aa798b53aa7009639728a2a Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Apr 2021 14:37:29 +0800 Subject: [PATCH 32/57] simple format change --- genEmmyAPI.lua | 51 +++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 8bc4d6c..d7b6d15 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -27,15 +27,28 @@ local function map_add(f, mapped, added) if added == nil then added = {} end - local really_added = false + local actual_added = {} + local added_times = 0 for _, t in ipairs(mapped) do - table.insert(added, f(t)) - really_added = true + table.insert(actual_added, f(t)) + added_times = added_times + 1 end - if really_added then + if added_times == 0 then + return nil + elseif added_times == 1 then + if type(actual_added[1]) == 'string' then + table.insert(added, actual_added[1]) + else + for _, t in ipairs(actual_added[1]) do + table.insert(added, t) + end + end return added else - return {} + for _, t in ipairs(actual_added) do + table.insert(added, t) + end + return added end end @@ -131,7 +144,7 @@ local function gen_prelude(prelude, p) if added then return p else - return {} + return nil end end @@ -290,14 +303,13 @@ local function gen_function(prelude, prefix) ---@param func Function ---@return printed return function(func) - local p = {} local prelude_counter = 0 local actual_prefix = prelude_prefix..func.name..'-' local function gen_unique_name() prelude_counter = prelude_counter + 1 return actual_prefix..prelude_counter end - for _, variant in ipairs(func.variants) do + return map_add(function(variant) local desc = func.description if variant.description then desc = desc .. '\n' .. variant.description @@ -307,21 +319,19 @@ local function gen_function(prelude, prefix) for argument in expand_items(variant.arguments, prelude, gen_unique_name) do table.insert(parameter_list, argument.name) local printed = {} - local show_default = argument.default ~= nil if argument.name == '...' then put(printed, '---@vararg') else put(printed, '---@param') - if argument.default == 'nil' then + if argument.default then put(printed, argument.name..'?') - show_default = false else put(printed, argument.name) end end put(printed, argument.type) put(printed, '@') - if show_default then + if argument.default then put(printed, '(default to '..argument.default..')') end put(printed, table.concat(gen_desc(argument.description, true), '\n')) @@ -340,9 +350,8 @@ local function gen_function(prelude, prefix) put(variantp, table.concat(printed, ' ')) end put(variantp, 'function '..prefix..func.name..'('..table.concat(parameter_list, ', ')..') end') - put(p, squash(variantp)) - end - return p + return squash(variantp) + end, func.variants) end end @@ -357,16 +366,16 @@ local function gen_type(prelude) ---@param type Type ---@return printed return function(type) - local p = gen_desc(type.description) - put(p, '--region '..type.name, 1) + local p = {'--region '..type.name} + local header = gen_desc(type.description) local type_decl = '---@class '..type.name if type.supertypes then type_decl = type_decl..': '..table.concat(type.supertypes, ', ') end - put(p, type_decl) - put(p, 'local '..type.name..' = {}') - p = {p} - put(p, map_add(gen_function(prelude, type.name..':'), type.functions, {'-- functions'})) + put(header, type_decl) + put(header, 'local '..type.name..' = {}') + put(p, header) + map_add(gen_function(prelude, type.name..':'), type.functions, p) put(p, '--endregion '..type.name) return p end From 150ebbd2a3172d109ae6b589c1787ce40d70a578 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Apr 2021 15:15:01 +0800 Subject: [PATCH 33/57] better error reporting in `genEmmyAPI.lua` --- genEmmyAPI.lua | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index d7b6d15..1edc412 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -151,27 +151,20 @@ end ---@param prelude prelude ---@param t FunctionField[] ---@param gen_unique_name fun():string +---@param traceback string ---@return string typename -local function find_or_add(prelude, t, gen_unique_name) +local function find_or_add(prelude, t, gen_unique_name, traceback) if t == nil then + print('no field called table found at '..traceback) return 'table' end local actual_fields = {} for _, field in pairs(t) do - if field.type ~= 'table' then - actual_fields[field.name] = { - type=field.type, - default=field.default, - description=field.description - } - else - local typename = find_or_add(field.table) - actual_fields[field.name] = { - type=typename, - default=field.default, - description=field.description - } - end + actual_fields[field.name] = { + type=field.type == 'table' and find_or_add(prelude, field.table, gen_unique_name, traceback..'.'..field.name) or field.type, + default=field.default, + description=field.description + } end local actual_length = #actual_fields for typename, fields in pairs(prelude) do @@ -197,8 +190,9 @@ end ---@param items FunctionField[] ---@param prelude prelude ---@param gen_unique_name fun():string +---@param traceback string ---@return fun():FunctionField|nil -local function expand_items(items, prelude, gen_unique_name) +local function expand_items(items, prelude, gen_unique_name, traceback) local k = 1 local temp = nil return function() @@ -213,10 +207,7 @@ local function expand_items(items, prelude, gen_unique_name) if not item then return end local typename = item.type if typename == 'table' then - typename = find_or_add(prelude, item.table, gen_unique_name) - if typename == 'table' then - print('type is table but no field called table at '..item.name) - end + typename = find_or_add(prelude, item.table, gen_unique_name, traceback..'['..(k-1)..']') else typename = type_corrector(typename) end @@ -316,7 +307,7 @@ local function gen_function(prelude, prefix) end local variantp = gen_desc(desc) local parameter_list = {} - for argument in expand_items(variant.arguments, prelude, gen_unique_name) do + for argument in expand_items(variant.arguments, prelude, gen_unique_name, prefix..func.name..':parameters') do table.insert(parameter_list, argument.name) local printed = {} if argument.name == '...' then @@ -337,7 +328,7 @@ local function gen_function(prelude, prefix) put(printed, table.concat(gen_desc(argument.description, true), '\n')) put(variantp, table.concat(printed, ' ')) end - for returned in expand_items(variant.returns, prelude, gen_unique_name) do + for returned in expand_items(variant.returns, prelude, gen_unique_name, prefix..func.name..':returns') do local printed = {} put(printed, '---@return') put(printed, returned.type) From 9b1d8d4b0f542d746abf120549a0527108f95020 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Apr 2021 21:54:49 +0800 Subject: [PATCH 34/57] generate not type when returning `...` --- genEmmyAPI.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 1edc412..837d62b 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -331,7 +331,9 @@ local function gen_function(prelude, prefix) for returned in expand_items(variant.returns, prelude, gen_unique_name, prefix..func.name..':returns') do local printed = {} put(printed, '---@return') - put(printed, returned.type) + if returned.name ~= '...' then + put(printed, returned.type) + end put(printed, returned.name) put(printed, '@') if returned.default then From def8c58857b72fa72612b82403ae39d0960d152f Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 21:46:55 +0800 Subject: [PATCH 35/57] update submodule --- love-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/love-api b/love-api index c4044ea..0333363 160000 --- a/love-api +++ b/love-api @@ -1 +1 @@ -Subproject commit c4044eace4e776ace3ac0979f5f2ec3ee12bec4c +Subproject commit 0333363b76aa8e2372c3545f9aea1d31c68f6c39 From d11b02ddbafadec5b609c3607d67079818754ad9 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 21:49:48 +0800 Subject: [PATCH 36/57] remove unnecessary symbolic link --- checkAPIformat.lua | 2 +- genEmmyAPI.lua | 2 +- love_api.lua | 1 - modules | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) delete mode 120000 love_api.lua delete mode 120000 modules diff --git a/checkAPIformat.lua b/checkAPIformat.lua index 4257130..a146560 100644 --- a/checkAPIformat.lua +++ b/checkAPIformat.lua @@ -181,5 +181,5 @@ local function printer() return table.concat(returned, '\n\n') end -assert(check(require 'love_api', 'Love', 'love')) +assert(check(require 'love-api/love_api', 'Love', 'love')) print(printer()) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 837d62b..41b6375 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -431,4 +431,4 @@ local function gen_write_love(love) end -gen_write_love(require 'love_api') +gen_write_love(require 'love-api/love_api') diff --git a/love_api.lua b/love_api.lua deleted file mode 120000 index e2956f1..0000000 --- a/love_api.lua +++ /dev/null @@ -1 +0,0 @@ -love-api/love_api.lua \ No newline at end of file diff --git a/modules b/modules deleted file mode 120000 index 15c3b06..0000000 --- a/modules +++ /dev/null @@ -1 +0,0 @@ -love-api/modules \ No newline at end of file From 71f19a0e4ee7554d1c955fb5f3002730f125d9cd Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 22:12:08 +0800 Subject: [PATCH 37/57] update github workflow and readme --- .github/workflows/package.yml | 1 - README.md | 25 ++++++++++--------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 842ba42..eaf14b6 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -10,7 +10,6 @@ jobs: with: luaVersion: "5.3.3" - run: cd /home/runner/work/Emmy-love-api/Emmy-love-api - - run: rm api -rf - run: mkdir api/love -p - run: lua checkAPIformat.lua - run: lua genEmmyAPI.lua diff --git a/README.md b/README.md index 4e3eb7f..88e5a42 100644 --- a/README.md +++ b/README.md @@ -4,31 +4,25 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em ## How to use it -### Prepare the `api` directory +### Prepare the `api` folder to put your api in - You can download the `api.zip` from the artifacts of the latest [GitHub Actions](https://github.com/26F-Studio/Emmy-love-api/actions) and unzip the `api` from it. -- Alternatively, you can build the `api` directory by yourself. +- Alternatively, you can build the `api` folder by yourself. -#### How to build the `api` directory by one's own +#### How to build the `api` folder manually -1. Prepare the whole project. - - You can clone this repository *recursively* `--recursive` with symbolic links enabled `--config core.symlinks=true`(*this is a must on `Windows` to generate correct symbolic links*). - - Alternatively, you can clone the [LÖVE API](https://github.com/26F-Studio/love-api) and put the `genEmmyAPI.lua`(from this repository) into it. -2. Create an empty directory named `api` in the same directory where `genEmmyAPI.lua` is. -3. `lua genEmmyAPI.lua` and the API is generated in the `api` directory. +1. Clone this repository *recursively* `--recursive`. +2. Create path `api/love` in the same folder where `genEmmyAPI.lua` is. +3. `lua genEmmyAPI.lua` and the API is generated in `api`. ### Use the APIs in your project -- Copy the `api` folder into your project's source folder, the same folder where `main.lua` is (you can rename it whatever you want, it doesn't have to be called `api`). -- If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), you can specify the API by adding a term in `Lua.workspace.library` in the settings and not copy the `api` folder. +- Copy the content of `api` folder into your project's root directory (the same folder where `main.lua` is). The content is just `love.lua` and a folder called `love`. +- If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), rather than copying, you can [specify the API](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Libraries). Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! -## Other LÖVE versions - -When you want to change the LÖVE version you use, just delete everything under the `api` folder, and redo the steps above for the appropriate version of the API. - ## Example workflow (Linux) ``` @@ -58,4 +52,5 @@ $ lua genEmmyAPI.lua Original script by https://github.com/tangzx One tiny modification of the script, README by https://github.com/kindfulkirby -Modification by Imple Lee on GitHub. + +Hugely modified by Imple Lee on GitHub. From 37a108750577bba44b4d11099e4e7b17cb8c61a5 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 22:16:33 +0800 Subject: [PATCH 38/57] split `checkAPIformat.lua` into multiple files --- checkAPIformat.lua | 125 ++---------------------------------------- metainfo.lua | 100 +++++++++++++++++++++++++++++++++ printAPIinEmmyLua.lua | 24 ++++++++ 3 files changed, 128 insertions(+), 121 deletions(-) create mode 100644 metainfo.lua create mode 100644 printAPIinEmmyLua.lua diff --git a/checkAPIformat.lua b/checkAPIformat.lua index a146560..4409595 100644 --- a/checkAPIformat.lua +++ b/checkAPIformat.lua @@ -1,99 +1,4 @@ ----@class my_nullable ----@field name "'nullable'" ----@field wrapped my_type - ----@class my_many ----@field name "'many'" ----@field wrapped my_type - ----@alias my_type my_nullable|my_many|string - ----@param type my_type ----@return my_nullable -local function optional(type) - return { - name='nullable', - wrapped=type - } -end - ----@param type my_type ----@return my_many -local function array(type) - return { - name='many', - wrapped=type - } -end - ----@param Type my_type ----@return string -local function stringify(Type) - if type(Type) == 'string' then - return Type - else - assert(type(Type) == 'table') - if Type.name == 'nullable' then - return stringify(Type.wrapped)..'|nil' - elseif Type.name == 'many' then - return stringify(Type.wrapped)..'[]' - else - assert(false, 'illegal type') - end - end -end - --- generated from EmmyLua in `genEmmyAPI.lua` -local metainfo = { - Love={ - version="string", - functions=array("Function"), - modules=array("Module"), - types=array("Type"), - callbacks=array("Callback"), - }, - Module={ - name="string", - description="string", - types=array("Type"), - functions=array("Function"), - enums=array("Enum"), - }, - Enum={ - name="string", - description="string", - constants=array("EnumConstant"), - }, - EnumConstant={ - name="string", - description="string", - }, - Type={ - name="string", - description="string", - constructors=optional(array("string")), - functions=optional(array("Function")), - supertypes=optional(array("string")), - }, - Callback="Function", - Function={ - name="string", - description="string", - variants=array("OneFunction"), - }, - OneFunction={ - returns=optional(array("FunctionField")), - arguments=optional(array("FunctionField")), - description=optional("string"), - }, - FunctionField={ - type="string", - name="string", - default=optional("string"), - description="string", - table=optional(array("FunctionField")), - }, -} +local info = require 'metainfo' ---@param obj any ---@param Type my_type @@ -115,7 +20,7 @@ local function check(obj, Type, prefix) end elseif Type.name == 'many' then if type(obj) ~= "table" then - return fail_match(stringify(Type), type(obj)) + return fail_match(info.stringify(Type), type(obj)) end for key, value in pairs(obj) do if type(key) ~= "number" then @@ -133,12 +38,12 @@ local function check(obj, Type, prefix) return fail_match('string', type(obj)) end else - local info = assert(metainfo[Type]) + local info = assert(info.metainfo[Type]) if type(info) == 'string' then return check(obj, info, prefix) end if type(obj) ~= "table" then - return fail_match(stringify(Type), type(obj)) + return fail_match(info.stringify(Type), type(obj)) end local need_to_be_checked = {} for k, v in pairs(info) do @@ -160,26 +65,4 @@ local function check(obj, Type, prefix) return ok end ----@return string -local function printer() - local returned = {} - local function p(where, ...) - table.insert(where, string.format(...)) - end - for typename, def in pairs(metainfo) do - local thisone = {} - if type(def) == "string" then - p(thisone, '---@alias %s %s', typename, def) - else - p(thisone, '---@class %s', typename) - for fieldname, fieldtype in pairs(def) do - p(thisone, '---@field %s %s', fieldname, stringify(fieldtype)) - end - end - p(returned, table.concat(thisone, '\n')) - end - return table.concat(returned, '\n\n') -end - assert(check(require 'love-api/love_api', 'Love', 'love')) -print(printer()) diff --git a/metainfo.lua b/metainfo.lua new file mode 100644 index 0000000..1155fd4 --- /dev/null +++ b/metainfo.lua @@ -0,0 +1,100 @@ +---@class my_nullable +---@field name "'nullable'" +---@field wrapped my_type + +---@class my_many +---@field name "'many'" +---@field wrapped my_type + +---@alias my_type my_nullable|my_many|string + +---@param type my_type +---@return my_nullable +local function optional(type) + return { + name='nullable', + wrapped=type + } +end + +---@param type my_type +---@return my_many +local function array(type) + return { + name='many', + wrapped=type + } +end + +---@param Type my_type +---@return string +local function stringify(Type) + if type(Type) == 'string' then + return Type + else + assert(type(Type) == 'table') + if Type.name == 'nullable' then + return stringify(Type.wrapped)..'|nil' + elseif Type.name == 'many' then + return stringify(Type.wrapped)..'[]' + else + assert(false, 'illegal type') + end + end +end + +local metainfo = { + Love={ + version="string", + functions=array("Function"), + modules=array("Module"), + types=array("Type"), + callbacks=array("Callback"), + }, + Module={ + name="string", + description="string", + types=array("Type"), + functions=array("Function"), + enums=array("Enum"), + }, + Enum={ + name="string", + description="string", + constants=array("EnumConstant"), + }, + EnumConstant={ + name="string", + description="string", + }, + Type={ + name="string", + description="string", + constructors=optional(array("string")), + functions=optional(array("Function")), + supertypes=optional(array("string")), + }, + Callback="Function", + Function={ + name="string", + description="string", + variants=array("OneFunction"), + }, + OneFunction={ + returns=optional(array("FunctionField")), + arguments=optional(array("FunctionField")), + description=optional("string"), + }, + FunctionField={ + type="string", + name="string", + default=optional("string"), + description="string", + table=optional(array("FunctionField")), + }, +} + +return { + metainfo = metainfo, + stringify = stringify +} \ No newline at end of file diff --git a/printAPIinEmmyLua.lua b/printAPIinEmmyLua.lua new file mode 100644 index 0000000..6218713 --- /dev/null +++ b/printAPIinEmmyLua.lua @@ -0,0 +1,24 @@ +local info = require 'metainfo' + +---@return string +local function printer(metainfo) + local returned = {} + local function p(where, ...) + table.insert(where, string.format(...)) + end + for typename, def in pairs(metainfo) do + local thisone = {} + if type(def) == "string" then + p(thisone, '---@alias %s %s', typename, def) + else + p(thisone, '---@class %s', typename) + for fieldname, fieldtype in pairs(def) do + p(thisone, '---@field %s %s', fieldname, info.stringify(fieldtype)) + end + end + p(returned, table.concat(thisone, '\n')) + end + return table.concat(returned, '\n\n') +end + +print(printer(info.metainfo)) \ No newline at end of file From c08013543162edbbd3efcdffde5e91140d4406eb Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 22:25:07 +0800 Subject: [PATCH 39/57] log to `stderr` instead of `stdout` --- genEmmyAPI.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 41b6375..46d3f4a 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -1,3 +1,11 @@ +local function log(...) + io.stderr:write(...) +end +local function logln(...) + log(...) + log('\n') +end + --region printed ---@alias printed printed[]|string @@ -102,9 +110,10 @@ local function type_corrector(type) type = string.gsub(type, ' or ', '|') type = string.gsub(type, 'light userdata', 'userdata') if type:find('[^a-zA-Z0-9|_-]') then - print('maybe wrong type: ' .. type) + io.stderr:write() + logln('maybe wrong type: ' .. type) type = string.format("%q", type) - print('quoted as: '..type) + logln('quoted as: '..type) end return type end @@ -134,7 +143,7 @@ local function gen_prelude(prelude, p) if name ~= '...' then put(thisp, '---@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) else - print('found ... in table definition '..typename) + logln('found ... in table definition '..typename) put(thisp, '------@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) end end @@ -155,7 +164,7 @@ end ---@return string typename local function find_or_add(prelude, t, gen_unique_name, traceback) if t == nil then - print('no field called table found at '..traceback) + logln('no field called table found at '..traceback) return 'table' end local actual_fields = {} From 79f3cd71193fd5028715f9f2633be76dd0eda845 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 22:28:04 +0800 Subject: [PATCH 40/57] update README --- README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 88e5a42..2020f3a 100644 --- a/README.md +++ b/README.md @@ -26,26 +26,25 @@ Once you start or refresh your IDE (might be automatic) you should have autocomp ## Example workflow (Linux) ``` -$ git clone https://github.com/26F-Studio/Emmy-love-api.git --recursive --config core.symlinks=true --depth=1 --shallow-submodules --single-branch +$ git clone https://github.com/26F-Studio/Emmy-love-api.git --recursive --depth=1 --shallow-submodules --single-branch Cloning into 'Emmy-love-api'... -remote: Enumerating objects: 11, done. -remote: Counting objects: 100% (11/11), done. -remote: Compressing objects: 100% (6/6), done. -remote: Total 11 (delta 0), reused 7 (delta 0), pack-reused 0 -Unpacking objects: 100% (11/11), 3.87 KiB | 793.00 KiB/s, done. +remote: Enumerating objects: 12, done. +remote: Counting objects: 100% (12/12), done. +remote: Compressing objects: 100% (9/9), done. +remote: Total 12 (delta 0), reused 5 (delta 0), pack-reused 0 +Unpacking objects: 100% (12/12), 6.49 KiB | 830.00 KiB/s, done. Submodule 'love-api' (https://github.com/26f-studio/love-api) registered for path 'love-api' -Cloning into 'Emmy-love-api/love-api'... -remote: Enumerating objects: 196, done. -remote: Counting objects: 100% (196/196), done. +Cloning into '/tmp/Emmy-love-api/love-api'... +remote: Enumerating objects: 195, done. +remote: Counting objects: 100% (195/195), done. remote: Compressing objects: 100% (153/153), done. -remote: Total 196 (delta 83), reused 82 (delta 30), pack-reused 0 -Receiving objects: 100% (196/196), 174.33 KiB | 448.00 KiB/s, done. +remote: Total 195 (delta 83), reused 81 (delta 30), pack-reused 0 +Receiving objects: 100% (195/195), 174.27 KiB | 281.00 KiB/s, done. Resolving deltas: 100% (83/83), done. -Submodule path 'love-api': checked out '0639972eea560d5fc69d2cb8b57ff3af31cee986' +Submodule path 'love-api': checked out '0333363b76aa8e2372c3545f9aea1d31c68f6c39' $ cd Emmy-love-api -$ mkdir api -$ lua genEmmyAPI.lua ---finished. +$ mkdir -p api/love +$ lua genEmmyAPI.lua 2>/dev/null ``` ## Credits From 047914a26463d8c55ceedcb31f36e90f4a91826f Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 30 Apr 2021 22:47:06 +0800 Subject: [PATCH 41/57] new default syntax --- genEmmyAPI.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 46d3f4a..e3bbda5 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -137,7 +137,7 @@ local function gen_prelude(prelude, p) for name, info in pairs(fields) do local desc = ' # ' if info.default then - desc = desc..'(default to '..info.default..') ' + desc = desc..'(default: `'..info.default..'`) ' end desc = desc..info.description if name ~= '...' then @@ -332,7 +332,7 @@ local function gen_function(prelude, prefix) put(printed, argument.type) put(printed, '@') if argument.default then - put(printed, '(default to '..argument.default..')') + put(printed, '(default: `'..argument.default..'`)') end put(printed, table.concat(gen_desc(argument.description, true), '\n')) put(variantp, table.concat(printed, ' ')) @@ -346,7 +346,7 @@ local function gen_function(prelude, prefix) put(printed, returned.name) put(printed, '@') if returned.default then - put(printed, '(default to '..returned.default..')') + put(printed, '(default: `'..returned.default..'`)') end put(printed, table.concat(gen_desc(returned.description, true), '\n')) put(variantp, table.concat(printed, ' ')) From 3567b8a94bd78703e74aa38881e3599c7582e8a3 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 28 Jun 2021 00:47:22 +0800 Subject: [PATCH 42/57] Mention `Lua.workspace.preloadFileSize` in README closes #11 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2020f3a..938c0d8 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ A script to generate [LÖVE](https://love2d.org/) API autocomplete files for [Em - Copy the content of `api` folder into your project's root directory (the same folder where `main.lua` is). The content is just `love.lua` and a folder called `love`. - If you use [the Lua plugin on VS code](https://github.com/sumneko/lua-language-server), rather than copying, you can [specify the API](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Libraries). +Note that some API files might be too large for this plugin, and you should change the setting `Lua.workspace.preloadFileSize` to be at least `250` to fix it. Once you start or refresh your IDE (might be automatic) you should have autocomplete and quick documentation for LÖVE! From 6160fce8a89b2eabc626acbeabba160ed5244e08 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 28 Jun 2021 00:49:51 +0800 Subject: [PATCH 43/57] remove credit section in `README` This can be found from git log or GitHub statistics. --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 938c0d8..90d319c 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,3 @@ $ cd Emmy-love-api $ mkdir -p api/love $ lua genEmmyAPI.lua 2>/dev/null ``` - -## Credits - -Original script by https://github.com/tangzx -One tiny modification of the script, README by https://github.com/kindfulkirby - -Hugely modified by Imple Lee on GitHub. From b0dd7f9dcc310dba6eddc2eb9160db32a7280772 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:28:45 +0800 Subject: [PATCH 44/57] add `?` to optional field and return value --- genEmmyAPI.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index e3bbda5..cb027c5 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -138,9 +138,10 @@ local function gen_prelude(prelude, p) local desc = ' # ' if info.default then desc = desc..'(default: `'..info.default..'`) ' + name = name..'?' end desc = desc..info.description - if name ~= '...' then + if name ~= '...' and name ~= '...?' then put(thisp, '---@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) else logln('found ... in table definition '..typename) @@ -341,7 +342,11 @@ local function gen_function(prelude, prefix) local printed = {} put(printed, '---@return') if returned.name ~= '...' then - put(printed, returned.type) + if returned.default then + put(printed, returned.type..'?') + else + put(printed, returned.type) + end end put(printed, returned.name) put(printed, '@') From 4fb5747b8f83aa12f00610448aac135f5344b3fd Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:41:24 +0800 Subject: [PATCH 45/57] use `?` to notate generation code --- genEmmyAPI.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index cb027c5..9b1552e 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -29,7 +29,7 @@ end ---@generic T ---@param f fun(t:T):printed ---@param mapped T[] ----@param added printed[]|nil +---@param added? printed[] ---@return printed local function map_add(f, mapped, added) if added == nil then @@ -120,7 +120,7 @@ end --region prelude ---@class field ----@field default string|nil +---@field default? string ---@field description string ---@field type string From fa3d5410a29a2298a6190c2ac4dd6ea6e76c6f36 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:42:53 +0800 Subject: [PATCH 46/57] use `lightuserdata` where the doc says so --- genEmmyAPI.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 9b1552e..fa83070 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -108,7 +108,7 @@ end ---@param type string local function type_corrector(type) type = string.gsub(type, ' or ', '|') - type = string.gsub(type, 'light userdata', 'userdata') + type = string.gsub(type, 'light userdata', 'lightuserdata') if type:find('[^a-zA-Z0-9|_-]') then io.stderr:write() logln('maybe wrong type: ' .. type) From 3d13c3d18ed2010d3eae11e8ac64cb80087ce389 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 5 Jul 2021 18:43:56 +0800 Subject: [PATCH 47/57] preserve order of definition of fields --- genEmmyAPI.lua | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index fa83070..7c35f78 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -124,7 +124,11 @@ end ---@field description string ---@field type string ----@alias prelude table> +---@class datatype +---@field fields table +---@field names string[] + +---@alias prelude table ---@param prelude prelude ---@param p printed[] @@ -134,7 +138,8 @@ local function gen_prelude(prelude, p) for typename, fields in pairs(prelude) do local thisp = {} put(thisp, '---@class '..typename) - for name, info in pairs(fields) do + for _, name in ipairs(fields.names) do + local info = fields.fields[name] local desc = ' # ' if info.default then desc = desc..'(default: `'..info.default..'`) ' @@ -169,18 +174,21 @@ local function find_or_add(prelude, t, gen_unique_name, traceback) return 'table' end local actual_fields = {} + local actual_names = {} for _, field in pairs(t) do actual_fields[field.name] = { type=field.type == 'table' and find_or_add(prelude, field.table, gen_unique_name, traceback..'.'..field.name) or field.type, default=field.default, description=field.description } + table.insert(actual_names, field.name) end local actual_length = #actual_fields for typename, fields in pairs(prelude) do if (function() - if #fields ~= actual_length then return end - for fieldname, fieldinfo in pairs(fields) do + if #fields.names ~= actual_length then return end + for _, fieldname in pairs(fields.names) do + local fieldinfo = fields.fields[fieldname] local actualinfo = actual_fields[fieldname] if not actualinfo then return end if fieldinfo.default ~= actualinfo.default then return end @@ -193,7 +201,10 @@ local function find_or_add(prelude, t, gen_unique_name, traceback) end end local name = gen_unique_name() - prelude[name] = actual_fields + prelude[name] = { + names = actual_names, + fields = actual_fields + } return name end From cbb667765ade901af038abade90ee998f19161c2 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 5 Jul 2021 18:51:53 +0800 Subject: [PATCH 48/57] add traceback to `type_corrector` --- genEmmyAPI.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 7c35f78..7c76ea3 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -106,12 +106,12 @@ end --endregion printed ---@param type string -local function type_corrector(type) +---@param where string +local function type_corrector(type, where) type = string.gsub(type, ' or ', '|') type = string.gsub(type, 'light userdata', 'lightuserdata') if type:find('[^a-zA-Z0-9|_-]') then - io.stderr:write() - logln('maybe wrong type: ' .. type) + logln('maybe wrong type: ' .. type .. ' at ' .. where) type = string.format("%q", type) logln('quoted as: '..type) end @@ -141,16 +141,17 @@ local function gen_prelude(prelude, p) for _, name in ipairs(fields.names) do local info = fields.fields[name] local desc = ' # ' + local normalized_name = name if info.default then desc = desc..'(default: `'..info.default..'`) ' - name = name..'?' + normalized_name = name..'?' end desc = desc..info.description - if name ~= '...' and name ~= '...?' then - put(thisp, '---@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) + if name ~= '...' then + put(thisp, '---@field '..normalized_name..' '..type_corrector(info.type, typename..'.'..name)..table.concat(gen_desc(desc, true), '\n')) else logln('found ... in table definition '..typename) - put(thisp, '------@field '..name..' '..type_corrector(info.type)..table.concat(gen_desc(desc, true), '\n')) + put(thisp, '------@field '..normalized_name..' '..type_corrector(info.type, typename.."."..name)..table.concat(gen_desc(desc, true), '\n')) end end put(p, thisp) @@ -230,7 +231,7 @@ local function expand_items(items, prelude, gen_unique_name, traceback) if typename == 'table' then typename = find_or_add(prelude, item.table, gen_unique_name, traceback..'['..(k-1)..']') else - typename = type_corrector(typename) + typename = type_corrector(typename, traceback..'['..(k-1)..']') end local function get_returned(name) return { From 0c6db6e87e93a74a256ad3a91f22e0ee4a27e7f1 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 5 Jul 2021 19:29:30 +0800 Subject: [PATCH 49/57] fix --- genEmmyAPI.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 7c76ea3..3f3d13a 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -184,11 +184,11 @@ local function find_or_add(prelude, t, gen_unique_name, traceback) } table.insert(actual_names, field.name) end - local actual_length = #actual_fields + local actual_length = #actual_names for typename, fields in pairs(prelude) do if (function() if #fields.names ~= actual_length then return end - for _, fieldname in pairs(fields.names) do + for _, fieldname in ipairs(fields.names) do local fieldinfo = fields.fields[fieldname] local actualinfo = actual_fields[fieldname] if not actualinfo then return end From 2035c6e406d05255c8ebaff0dda5cea9a36b4127 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Mon, 5 Jul 2021 19:51:45 +0800 Subject: [PATCH 50/57] add [] for positional field and comment them out temporarily --- genEmmyAPI.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 3f3d13a..f92eab7 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -141,18 +141,21 @@ local function gen_prelude(prelude, p) for _, name in ipairs(fields.names) do local info = fields.fields[name] local desc = ' # ' - local normalized_name = name + local question = '' if info.default then desc = desc..'(default: `'..info.default..'`) ' - normalized_name = name..'?' + question = '?' end desc = desc..info.description - if name ~= '...' then - put(thisp, '---@field '..normalized_name..' '..type_corrector(info.type, typename..'.'..name)..table.concat(gen_desc(desc, true), '\n')) - else + local extra = '' + if name == '...' then logln('found ... in table definition '..typename) - put(thisp, '------@field '..normalized_name..' '..type_corrector(info.type, typename.."."..name)..table.concat(gen_desc(desc, true), '\n')) + extra = '---' + elseif name:find('^[0-9]+$') then + extra = '---' + name = '['..name..']' end + put(thisp, extra..'---@field '..name..question..' '..type_corrector(info.type, typename..'.'..name)..table.concat(gen_desc(desc, true), '\n')) end put(p, thisp) added = true From c17b1ae66456c056b345cd4d7fc49e651ef7829d Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:27:41 +0800 Subject: [PATCH 51/57] uncomment `[1]`-like fields, close #9 --- genEmmyAPI.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index f92eab7..c3e674a 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -152,7 +152,6 @@ local function gen_prelude(prelude, p) logln('found ... in table definition '..typename) extra = '---' elseif name:find('^[0-9]+$') then - extra = '---' name = '['..name..']' end put(thisp, extra..'---@field '..name..question..' '..type_corrector(info.type, typename..'.'..name)..table.concat(gen_desc(desc, true), '\n')) From 116709883d39ffac9198652f493903b298c4a52e Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:20:21 +0800 Subject: [PATCH 52/57] fix some warnings from language server --- checkAPIformat.lua | 12 ++++++------ genEmmyAPI.lua | 15 ++++++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/checkAPIformat.lua b/checkAPIformat.lua index 4409595..30ecb45 100644 --- a/checkAPIformat.lua +++ b/checkAPIformat.lua @@ -38,23 +38,23 @@ local function check(obj, Type, prefix) return fail_match('string', type(obj)) end else - local info = assert(info.metainfo[Type]) - if type(info) == 'string' then - return check(obj, info, prefix) + local typeinfo = assert(info.metainfo[Type]) + if type(typeinfo) == 'string' then + return check(obj, typeinfo, prefix) end if type(obj) ~= "table" then return fail_match(info.stringify(Type), type(obj)) end local need_to_be_checked = {} - for k, v in pairs(info) do + for k, v in pairs(typeinfo) do need_to_be_checked[k] = v end for k, v in pairs(obj) do - if not info[k] then + if not typeinfo[k] then print('<'..prefix..'>: extra field '..k ..' and value '..type(v)) ok = false else - ok = ok and check(v, info[k], prefix..'.'..k) + ok = ok and check(v, typeinfo[k], prefix..'.'..k) need_to_be_checked[k] = nil end end diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index c3e674a..d02f366 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -42,7 +42,7 @@ local function map_add(f, mapped, added) added_times = added_times + 1 end if added_times == 0 then - return nil + return {} elseif added_times == 1 then if type(actual_added[1]) == 'string' then table.insert(added, actual_added[1]) @@ -76,8 +76,13 @@ local function squash(p) return ret end +---@param printed table ---@param printing printed +---@param pos integer? local function put(printed, printing, pos) + if #printing == 0 then + return + end if pos == nil then table.insert(printed, printing) else @@ -90,7 +95,7 @@ end ---@param description string ---@param without_first_dashes? boolean ----@return printed +---@return printed[] local function gen_desc(description, without_first_dashes) local ret = {} for _ in description:gmatch("[^\n]*") do @@ -162,7 +167,7 @@ local function gen_prelude(prelude, p) if added then return p else - return nil + return {} end end @@ -433,7 +438,7 @@ local function gen_write_module(module) put(p, gen_prelude(prelude, {'-- preludes'})) put(p, 'return '..module.name) local f = assert(io.open(string.format(WHERE, 'love/'..module.name), 'w')) - p, _ = printing(p) + local p, _ = printing(p) f:write(p) f:close() return string.format('love.%s = require "love/%s"', module.name, module.name) @@ -453,7 +458,7 @@ local function gen_write_love(love) put(p, 'return love') put(p, '---@alias Variant table|boolean|string|number|Object') local f = assert(io.open(string.format(WHERE, 'love'), 'w')) - p, _ = printing(p) + local p, _ = printing(p) f:write(p) f:close() end From b97e41f093b9cd9e9f4fe6081d9ea70c4faa9621 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:47:32 +0800 Subject: [PATCH 53/57] move api definitions to its own file --- .gitignore | 3 ++- genEmmyAPI.lua | 49 +------------------------------------------------ 2 files changed, 3 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index b8798c5..7d304f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -api/ \ No newline at end of file +api/ +/api-definition.lua \ No newline at end of file diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index d02f366..9651808 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -262,54 +262,7 @@ end --region api-definition ----@class EnumConstant ----@field name string ----@field description string - ----@class OneFunction ----@field returns FunctionField[]|nil ----@field description string|nil ----@field arguments FunctionField[]|nil - ----@alias Callback Function - ----@class Love ----@field types Type[] ----@field version string ----@field functions Function[] ----@field callbacks Callback[] ----@field modules Module[] - ----@class Type ----@field supertypes string[]|nil ----@field name string ----@field description string ----@field constructors string[]|nil ----@field functions Function[]|nil - ----@class Enum ----@field name string ----@field description string ----@field constants EnumConstant[] - ----@class Function ----@field name string ----@field description string ----@field variants OneFunction[] - ----@class FunctionField ----@field type string ----@field table FunctionField[]|nil ----@field default string|nil ----@field name string ----@field description string - ----@class Module ----@field types Type[] ----@field name string ----@field description string ----@field functions Function[] ----@field enums Enum[] +pcall(require, 'api-definition') --endregion api-definition From 833e0d8d7d7a30790c9d79b3f5734a0a4705dfc3 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:49:46 +0800 Subject: [PATCH 54/57] better handling for callbacks actually worse:( but it keeps the same as the language server version see more at #4 --- checkAPIformat.lua | 6 ++++++ genEmmyAPI.lua | 45 +++++++++++++++++++++++++++++++++++++++++---- metainfo.lua | 24 +++++++++++++++++++++--- 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/checkAPIformat.lua b/checkAPIformat.lua index 30ecb45..5d982a1 100644 --- a/checkAPIformat.lua +++ b/checkAPIformat.lua @@ -22,6 +22,12 @@ local function check(obj, Type, prefix) if type(obj) ~= "table" then return fail_match(info.stringify(Type), type(obj)) end + if Type.num then + if #obj ~= Type.num then + print('<'..prefix..'>: expected '..Type.num..' elements, but got '..#obj) + ok = false + end + end for key, value in pairs(obj) do if type(key) ~= "number" then print('<'..prefix..'>: nonnumeric key', key) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 9651808..e69f42d 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -216,11 +216,12 @@ local function find_or_add(prelude, t, gen_unique_name, traceback) return name end ----@param items FunctionField[] +---@generic T: CallbackField|FunctionField +---@param items T[] ---@param prelude prelude ---@param gen_unique_name fun():string ---@param traceback string ----@return fun():FunctionField|nil +---@return fun():T|nil local function expand_items(items, prelude, gen_unique_name, traceback) local k = 1 local temp = nil @@ -336,8 +337,44 @@ end ---@param prelude prelude ---@param prefix string -local function gen_callback(prelude, prefix) - return gen_function(prelude, prefix) +local function gen_callback(prelude, prefix, f) + local prelude_prefix = prefix:gsub('[.:]', '-') + ---@param func Callback + ---@return printed + return function(func) + local prelude_counter = 0 + local actual_prefix = prelude_prefix..func.name..'-' + local function gen_unique_name() + prelude_counter = prelude_counter + 1 + return actual_prefix..prelude_counter + end + local variant = func.variants[1] + local desc = func.description + if variant.description then + desc = desc .. '\n' .. variant.description + end + local variantp = gen_desc(desc) + local parameter_list = {} + for argument in expand_items(variant.arguments, prelude, gen_unique_name, prefix..func.name..':parameters') do + local printed = {} + put(printed, argument.name) + put(printed, argument.type) + put(parameter_list, table.concat(printed, ': ')) + end + local returns = {} + for returned in expand_items(variant.returns, prelude, gen_unique_name, prefix..func.name..':returns') do + if returned.name ~= '...' then + put(returns, returned.type) + else + put(returns, '...') + end + end + local type = {} + put(type, 'fun('..table.concat(parameter_list, ', ')..')') + put(type, table.concat(returns, ', ')) + put(variantp, '---@alias '..prefix..func.name..' '..table.concat(type, ': ')) + return squash(variantp) + end end ---@param prelude prelude diff --git a/metainfo.lua b/metainfo.lua index 1155fd4..a760e10 100644 --- a/metainfo.lua +++ b/metainfo.lua @@ -5,6 +5,7 @@ ---@class my_many ---@field name "'many'" ---@field wrapped my_type +---@field num integer? ---@alias my_type my_nullable|my_many|string @@ -18,11 +19,13 @@ local function optional(type) end ---@param type my_type +---@param num integer? ---@return my_many -local function array(type) +local function array(type, num) return { name='many', - wrapped=type + wrapped=type, + num=num } end @@ -74,7 +77,22 @@ local metainfo = { functions=optional(array("Function")), supertypes=optional(array("string")), }, - Callback="Function", + Callback={ + name="string", + description="string", + variants=array("OneCallback", 1), + }, + OneCallback={ + returns=optional(array("CallbackField")), + arguments=optional(array("CallbackField")), + description=optional("string"), + }, + CallbackField={ + type="string", + name="string", + description="string", + table=optional(array("FunctionField")), + }, Function={ name="string", description="string", From 5ea561aced90d629f4f7646af58a9485b7346c2d Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:50:16 +0800 Subject: [PATCH 55/57] `cdata` -> `ffi.cdata*` fixes #6 --- genEmmyAPI.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index e69f42d..aeecff0 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -120,6 +120,7 @@ local function type_corrector(type, where) type = string.format("%q", type) logln('quoted as: '..type) end + type = string.gsub(type, 'cdata', 'ffi.cdata*') return type end From c5aa81257d658054cc645ccd89916adeda1b47a0 Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:50:38 +0800 Subject: [PATCH 56/57] add `---@meta` to generated files --- genEmmyAPI.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index aeecff0..90def81 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -419,6 +419,7 @@ end ---@return printed local function gen_write_module(module) local p = {} + put(p, '---@meta') local header = gen_desc(module.description) table.insert(header, 'local '..module.name..' = {}') put(p, header) @@ -438,6 +439,7 @@ end ---@param love Love local function gen_write_love(love) local p = {} + put(p, '---@meta') put(p, 'local love = {}') putf(p, 'love.version = %q', love.version) local prelude = {} From 882ef02039f3026e9177a9b6e80cc66b9bd4e0bd Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Tue, 2 May 2023 02:53:51 +0800 Subject: [PATCH 57/57] set love as a global variable eliminating the need to `require love` in the language server --- genEmmyAPI.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/genEmmyAPI.lua b/genEmmyAPI.lua index 90def81..e110345 100644 --- a/genEmmyAPI.lua +++ b/genEmmyAPI.lua @@ -440,7 +440,7 @@ end local function gen_write_love(love) local p = {} put(p, '---@meta') - put(p, 'local love = {}') + put(p, 'love = {}') putf(p, 'love.version = %q', love.version) local prelude = {} put(p, map_add(gen_function(prelude, 'love.'), love.functions, {'-- functions'})) @@ -448,7 +448,6 @@ local function gen_write_love(love) put(p, map_add(gen_type(prelude), love.types, {'-- types'})) put(p, map_add(gen_callback(prelude, 'love.'), love.callbacks, {'-- callbacks'})) put(p, gen_prelude(prelude, {'-- preludes'})) - put(p, 'return love') put(p, '---@alias Variant table|boolean|string|number|Object') local f = assert(io.open(string.format(WHERE, 'love'), 'w')) local p, _ = printing(p)