├── typings ├── love.event │ ├── enums │ │ ├── index.d.ts │ │ └── Event.d.ts │ ├── index.d.ts │ └── functions.d.ts ├── love.mouse │ ├── types │ │ ├── index.d.ts │ │ └── Cursor.d.ts │ ├── enums │ │ ├── index.d.ts │ │ └── CursorType.d.ts │ └── index.d.ts ├── love.timer │ ├── index.d.ts │ └── functions.d.ts ├── love.touch │ ├── index.d.ts │ └── functions.d.ts ├── love.font │ ├── enums │ │ ├── index.d.ts │ │ └── HintingMode.d.ts │ ├── types │ │ ├── index.d.ts │ │ ├── Rasterizer.d.ts │ │ └── GlyphData.d.ts │ └── index.d.ts ├── love.joystick │ ├── types │ │ └── index.d.ts │ ├── index.d.ts │ ├── enums │ │ ├── index.d.ts │ │ ├── JoystickInputType.d.ts │ │ ├── JoystickHat.d.ts │ │ ├── GamepadAxis.d.ts │ │ └── GamepadButton.d.ts │ └── functions.d.ts ├── love.system │ ├── enums │ │ ├── index.d.ts │ │ └── PowerState.d.ts │ ├── index.d.ts │ └── functions.d.ts ├── love.video │ ├── types │ │ ├── index.d.ts │ │ └── VideoStream.d.ts │ ├── index.d.ts │ └── functions.d.ts ├── love.math │ ├── index.d.ts │ └── types │ │ ├── index.d.ts │ │ └── RandomGenerator.d.ts ├── love.sound │ ├── index.d.ts │ ├── types │ │ ├── index.d.ts │ │ ├── Decoder.d.ts │ │ └── SoundData.d.ts │ └── functions.d.ts ├── love.thread │ ├── index.d.ts │ ├── types │ │ ├── index.d.ts │ │ ├── Thread.d.ts │ │ └── Channel.d.ts │ └── functions.d.ts ├── love.keyboard │ ├── index.d.ts │ ├── enums │ │ ├── index.d.ts │ │ ├── KeyConstant.d.ts │ │ └── ScanCode.d.ts │ └── functions.d.ts ├── love.filesystem │ ├── types │ │ ├── index.d.ts │ │ └── FileData.d.ts │ ├── index.d.ts │ └── enums │ │ ├── index.d.ts │ │ ├── FileDecoder.d.ts │ │ ├── FileType.d.ts │ │ ├── FileMode.d.ts │ │ └── BufferMode.d.ts ├── love.audio │ ├── types │ │ ├── index.d.ts │ │ └── RecordingDevice.d.ts │ ├── structs │ │ ├── index.d.ts │ │ ├── FilterSettings.d.ts │ │ └── EffectSettings.d.ts │ ├── index.d.ts │ └── enums │ │ ├── index.d.ts │ │ ├── TimeUnit.d.ts │ │ ├── EffectType.d.ts │ │ ├── SourceType.d.ts │ │ ├── FilterType.d.ts │ │ ├── EffectWaveform.d.ts │ │ └── DistanceModel.d.ts ├── love.data │ ├── index.d.ts │ ├── types │ │ ├── index.d.ts │ │ ├── ByteData.d.ts │ │ ├── CompressedData.d.ts │ │ └── Data.d.ts │ └── enums │ │ ├── index.d.ts │ │ ├── EncodeFormat.d.ts │ │ ├── ContainerType.d.ts │ │ ├── CompressedDataFormat.d.ts │ │ └── HashFunction.d.ts ├── love.image │ ├── types │ │ ├── index.d.ts │ │ ├── CompressedImageData.d.ts │ │ └── ImageData.d.ts │ ├── index.d.ts │ ├── enums │ │ ├── index.d.ts │ │ ├── ImageFormat.d.ts │ │ ├── CanvasFormat.d.ts │ │ ├── CompressedImageFormat.d.ts │ │ └── PixelFormat.d.ts │ └── functions.d.ts ├── love.window │ ├── enums │ │ ├── index.d.ts │ │ ├── MessageBoxType.d.ts │ │ └── FullscreenType.d.ts │ ├── index.d.ts │ └── structs │ │ ├── index.d.ts │ │ ├── DisplayOrientation.d.ts │ │ └── ButtonList.d.ts ├── love.physics │ ├── index.d.ts │ ├── enums │ │ ├── index.d.ts │ │ ├── BodyType.d.ts │ │ ├── ShapeType.d.ts │ │ └── JointType.d.ts │ └── types │ │ ├── index.d.ts │ │ ├── RopeJoint.d.ts │ │ ├── GearJoint.d.ts │ │ ├── WeldJoint.d.ts │ │ ├── FrictionJoint.d.ts │ │ ├── PolygonShape.d.ts │ │ ├── CircleShape.d.ts │ │ ├── DistanceJoint.d.ts │ │ ├── MotorJoint.d.ts │ │ ├── MouseJoint.d.ts │ │ ├── EdgeShape.d.ts │ │ ├── PulleyJoint.d.ts │ │ ├── Joint.d.ts │ │ ├── ChainShape.d.ts │ │ ├── WheelJoint.d.ts │ │ ├── Contact.d.ts │ │ ├── RevoluteJoint.d.ts │ │ └── PrismaticJoint.d.ts ├── love.graphics │ ├── index.d.ts │ ├── structs │ │ ├── MeshVertexDataType.d.ts │ │ ├── index.d.ts │ │ ├── ImageInformation.d.ts │ │ ├── VertexAttribute.d.ts │ │ ├── ImageSettings.d.ts │ │ ├── VertexInformation.d.ts │ │ └── DisplayFlags.d.ts │ ├── enums │ │ ├── ShaderVariableType.d.ts │ │ ├── LineJoin.d.ts │ │ ├── AlignMode.d.ts │ │ ├── LineStyle.d.ts │ │ ├── ArcType.d.ts │ │ ├── MipmapMode.d.ts │ │ ├── CullMode.d.ts │ │ ├── FilterMode.d.ts │ │ ├── DrawMode.d.ts │ │ ├── StackType.d.ts │ │ ├── TextureType.d.ts │ │ ├── MatrixLayout.d.ts │ │ ├── MeshDrawMode.d.ts │ │ ├── IndexDataType.d.ts │ │ ├── ParticleInsertMode.d.ts │ │ ├── SpriteBatchUsage.d.ts │ │ ├── BlendAlphaMode.d.ts │ │ ├── VertexWinding.d.ts │ │ ├── StencilAction.d.ts │ │ ├── GraphicsFeature.d.ts │ │ ├── BlendMode.d.ts │ │ ├── GraphicsLimit.d.ts │ │ ├── WrapMode.d.ts │ │ ├── VertexAttributeStep.d.ts │ │ ├── index.d.ts │ │ ├── AreaSpreadDistribution.d.ts │ │ └── CompareMode.d.ts │ └── types │ │ ├── index.d.ts │ │ ├── Drawable.d.ts │ │ ├── Quad.d.ts │ │ ├── Image.d.ts │ │ ├── Canvas.d.ts │ │ ├── Shader.d.ts │ │ └── Video.d.ts ├── love │ ├── index.d.ts │ ├── types │ │ ├── LightUserData.d.ts │ │ ├── Version.d.ts │ │ ├── Type.d.ts │ │ └── Types.d.ts │ └── functions.d.ts ├── love.path │ ├── index.d.ts │ └── functions.d.ts ├── love.arg │ ├── index.d.ts │ └── functions.d.ts └── index.d.ts ├── index.d.ts ├── .gitignore ├── namespace.d.ts ├── media └── love-typescript-definitions.png ├── modules.d.ts ├── CONTRIBUTING.md ├── package.json ├── LICENSE └── README.md /typings/love.event/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Event"; 2 | -------------------------------------------------------------------------------- /typings/love.mouse/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Cursor"; 2 | -------------------------------------------------------------------------------- /typings/love.timer/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | -------------------------------------------------------------------------------- /typings/love.touch/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import "./namespace"; 2 | import "./typings"; 3 | -------------------------------------------------------------------------------- /typings/love.font/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./HintingMode"; 2 | -------------------------------------------------------------------------------- /typings/love.joystick/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Joystick"; 2 | -------------------------------------------------------------------------------- /typings/love.mouse/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./CursorType"; 2 | -------------------------------------------------------------------------------- /typings/love.system/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./PowerState"; 2 | -------------------------------------------------------------------------------- /typings/love.video/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./VideoStream"; 2 | -------------------------------------------------------------------------------- /typings/love.event/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | -------------------------------------------------------------------------------- /typings/love.math/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | import "./types"; 3 | -------------------------------------------------------------------------------- /typings/love.sound/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | import "./types"; 3 | -------------------------------------------------------------------------------- /typings/love.system/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | -------------------------------------------------------------------------------- /typings/love.thread/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | import "./types"; 3 | -------------------------------------------------------------------------------- /typings/love.video/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | import "./types"; 3 | -------------------------------------------------------------------------------- /typings/love.keyboard/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | -------------------------------------------------------------------------------- /typings/love.thread/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Channel"; 2 | import "./Thread"; 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | node_modules/ 3 | docs/ 4 | test/*.lua 5 | *.lua 6 | *.js -------------------------------------------------------------------------------- /typings/love.filesystem/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./File"; 2 | import "./FileData"; 3 | -------------------------------------------------------------------------------- /typings/love.font/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./GlyphData"; 2 | import "./Rasterizer"; 3 | -------------------------------------------------------------------------------- /typings/love.sound/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Decoder"; 2 | import "./SoundData"; 3 | -------------------------------------------------------------------------------- /typings/love.audio/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./RecordingDevice"; 2 | import "./Source"; 3 | -------------------------------------------------------------------------------- /typings/love.keyboard/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./KeyConstant"; 2 | import "./ScanCode"; 3 | -------------------------------------------------------------------------------- /typings/love.data/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /typings/love.font/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /typings/love.image/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./CompressedImageData"; 2 | import "./ImageData"; 3 | -------------------------------------------------------------------------------- /typings/love.window/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./FullscreenType"; 2 | import "./MessageBoxType"; 3 | -------------------------------------------------------------------------------- /typings/love.audio/structs/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./EffectSettings"; 2 | import "./FilterSettings"; 3 | -------------------------------------------------------------------------------- /typings/love.image/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /typings/love.joystick/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /typings/love.mouse/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /typings/love.physics/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /typings/love.window/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./structs"; 4 | -------------------------------------------------------------------------------- /typings/love.window/structs/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./ButtonList"; 2 | import "./DisplayOrientation"; 3 | -------------------------------------------------------------------------------- /typings/love.filesystem/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./types"; 4 | -------------------------------------------------------------------------------- /namespace.d.ts: -------------------------------------------------------------------------------- 1 | declare const love: typeof import("love") & 2 | import("./typings/love/handlers").Handlers; 3 | -------------------------------------------------------------------------------- /typings/love.data/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./ByteData"; 2 | import "./CompressedData"; 3 | import "./Data"; 4 | -------------------------------------------------------------------------------- /typings/love.physics/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./BodyType"; 2 | import "./JointType"; 3 | import "./ShapeType"; 4 | -------------------------------------------------------------------------------- /typings/love.audio/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./structs"; 4 | import "./types"; 5 | -------------------------------------------------------------------------------- /typings/love.math/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./BezierCurve"; 2 | import "./RandomGenerator"; 3 | import "./Transform"; 4 | -------------------------------------------------------------------------------- /typings/love.graphics/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./enums"; 2 | import "./functions"; 3 | import "./structs"; 4 | import "./types"; 5 | -------------------------------------------------------------------------------- /media/love-typescript-definitions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hazzard993/love-typescript-definitions/HEAD/media/love-typescript-definitions.png -------------------------------------------------------------------------------- /typings/love.filesystem/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./BufferMode"; 2 | import "./FileDecoder"; 3 | import "./FileMode"; 4 | import "./FileType"; 5 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/MeshVertexDataType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | type MeshVertexDataType = "byte" | "unorm16" | "float"; 3 | } 4 | -------------------------------------------------------------------------------- /typings/love.image/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./CanvasFormat"; 2 | import "./CompressedImageFormat"; 3 | import "./ImageFormat"; 4 | import "./PixelFormat"; 5 | -------------------------------------------------------------------------------- /typings/love.joystick/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./GamepadAxis"; 2 | import "./GamepadButton"; 3 | import "./JoystickHat"; 4 | import "./JoystickInputType"; 5 | -------------------------------------------------------------------------------- /typings/love.data/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./CompressedDataFormat"; 2 | import "./ContainerType"; 3 | import "./EncodeFormat"; 4 | import "./HashFunction"; 5 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/ShaderVariableType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * @todo Needs information 4 | */ 5 | type ShaderVariableType = any; 6 | } 7 | -------------------------------------------------------------------------------- /typings/love.audio/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./DistanceModel"; 2 | import "./EffectType"; 3 | import "./EffectWaveform"; 4 | import "./FilterType"; 5 | import "./SourceType"; 6 | import "./TimeUnit"; 7 | -------------------------------------------------------------------------------- /modules.d.ts: -------------------------------------------------------------------------------- 1 | import "./typings"; 2 | 3 | declare global { 4 | const love: import("./typings/love/handlers").Handlers & { 5 | handlers: import("./typings/love/handlers").Handlers; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./types/Config"; 2 | import "./types/Version"; 3 | import "./types/LightUserData"; 4 | import "./types/Type"; 5 | import "./types/Types"; 6 | import "./handlers"; 7 | import "./functions"; 8 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./DisplayFlags"; 2 | import "./ImageInformation"; 3 | import "./ImageSettings"; 4 | import "./MeshVertexDataType"; 5 | import "./VertexAttribute"; 6 | import "./VertexInformation"; 7 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/LineJoin.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Line join style. 4 | * @link [LineJoin](https://love2d.org/wiki/LineJoin) 5 | */ 6 | type LineJoin = "miter" | "bevel" | "none"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.image/enums/ImageFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.image" { 2 | /** 3 | * Encoded image formats. 4 | * @link [ImageFormat](https://love2d.org/wiki/ImageFormat) 5 | */ 6 | type ImageFormat = "tga" | "png"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.physics/enums/BodyType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * The types of a Body. 4 | * @link [BodyType](https://love2d.org/wiki/BodyType) 5 | */ 6 | type BodyType = "static" | "dynamic" | "kinematic"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/AlignMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Text alignment. 4 | * @link [AlignMode](https://love2d.org/wiki/AlignMode) 5 | */ 6 | type AlignMode = "center" | "left" | "right" | "justify"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/LineStyle.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * The styles in which lines are drawn. 4 | * @link [LineStyle](https://love2d.org/wiki/LineStyle) 5 | */ 6 | type LineStyle = "rough" | "smooth"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.filesystem/enums/FileDecoder.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.filesystem" { 2 | /** 3 | * How to decode a given FileData. 4 | * @link [FileDecoder](https://love2d.org/wiki/FileDecoder) 5 | */ 6 | type FileDecoder = "file" | "base64"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.filesystem/enums/FileType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.filesystem" { 2 | /** 3 | * The type of a file. 4 | * @link [FileType](https://love2d.org/wiki/FileType) 5 | */ 6 | type FileType = "file" | "directory" | "symlink" | "other"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.font/enums/HintingMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.font" { 2 | /** 3 | * True Type hinting mode. 4 | * @link [HintingMode](https://love2d.org/wiki/HintingMode) 5 | */ 6 | type HintingMode = "normal" | "light" | "mono" | "none"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/ArcType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Different types of arcs that can be drawn. 4 | * @link [ArcType](https://love2d.org/wiki/ArcType) 5 | */ 6 | type ArcType = "pie" | "open" | "closed"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/MipmapMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * @todo Needs more information 4 | * @link [MipmapMode](https://love2d.org/wiki/MipmapMode) 5 | */ 6 | type MipmapMode = "none" | "auto" | "manual"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.filesystem/enums/FileMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.filesystem" { 2 | /** 3 | * The different modes you can open a file in. 4 | * @link [FileMode](https://love2d.org/wiki/FileMode) 5 | */ 6 | type FileMode = "r" | "w" | "a" | "c"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/CullMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How Mesh geometry is culled when rendering. 4 | * @link [CullMode](https://love2d.org/wiki/CullMode) 5 | */ 6 | type CullMode = "back" | "front" | "none"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/FilterMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How the image is filtered when scaling. 4 | * @link [FilterMode](https://love2d.org/wiki/FilterMode) 5 | */ 6 | type FilterMode = "linear" | "nearest"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/DrawMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Controls whether shapes are drawn as an outline, or filled. 4 | * @link [DrawMode](https://love2d.org/wiki/DrawMode) 5 | */ 6 | type DrawMode = "fill" | "line"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/StackType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Graphics state stack types used with love.graphics.push. 4 | * @link [StackType](https://love2d.org/wiki/StackType) 5 | */ 6 | type StackType = "transform" | "all"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/TextureType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Types of textures (2D, cubemap, etc.) 4 | * @link [TextureType](https://love2d.org/wiki/TextureType) 5 | */ 6 | type TextureType = "2d" | "array" | "cube" | "volume"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/MatrixLayout.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * The layout of matrix elements (row-major or column-major). 4 | * @link [MatrixLayout](https://love2d.org/wiki/MatrixLayout) 5 | */ 6 | type MatrixLayout = "row" | "column"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.joystick/enums/JoystickInputType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.joystick" { 2 | /** 3 | * Types of Joystick inputs. 4 | * @link [JoystickInputType](https://love2d.org/wiki/JoystickInputType) 5 | */ 6 | type JoystickInputType = "axis" | "button" | "hat"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.data/enums/EncodeFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | /** 3 | * Return type of various data-returning functions. 4 | * @link [EncodeFormat](https://love2d.org/wiki/EncodeFormat) 5 | * @snice 11.0 6 | */ 7 | type EncodeFormat = "base64" | "hex"; 8 | } 9 | -------------------------------------------------------------------------------- /typings/love.event/enums/Event.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.event" { 2 | /** 3 | * Arguments to love.event.push() and the like. 4 | * @link [Event](https://love2d.org/wiki/Event) 5 | * @since 0.6.0 6 | */ 7 | type Event = keyof import("../../love/handlers").Handlers; 8 | } 9 | -------------------------------------------------------------------------------- /typings/love.joystick/enums/JoystickHat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.joystick" { 2 | /** 3 | * Joystick hat positions. 4 | * @link [GamepadButton](https://love2d.org/wiki/GamepadButton) 5 | */ 6 | type JoystickHat = "c" | "d" | "l" | "ld" | "lu" | "r" | "rd" | "ru" | "u"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/MeshDrawMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How a Mesh's vertices are used when drawing. 4 | * @link [MeshDrawMode](https://love2d.org/wiki/MeshDrawMode) 5 | */ 6 | type MeshDrawMode = "fan" | "strip" | "triangles" | "points"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.physics/enums/ShapeType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * The different types of Shapes, as returned by Shape:getType. 4 | * @link [ShapeType](https://love2d.org/wiki/ShapeType) 5 | */ 6 | type ShapeType = "circle" | "polygon" | "edge" | "chain"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.filesystem/enums/BufferMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.filesystem" { 2 | /** 3 | * Buffer modes for File objects. 4 | * 5 | * @link [BufferMode](https://love2d.org/wiki/BufferMode) 6 | * @since 0.9.0 7 | */ 8 | type BufferMode = "none" | "line" | "full"; 9 | } 10 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/IndexDataType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Vertex map datatype for Data variant of Mesh:setVertexMap. 4 | * 5 | * @link [IndexDataType](https://love2d.org/wiki/IndexDataType) 6 | */ 7 | type IndexDataType = "uint16" | "uint32"; 8 | } 9 | -------------------------------------------------------------------------------- /typings/love.path/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | 3 | declare module "love" { 4 | /** 5 | * Contains functions for file path analysis. 6 | * 7 | * Implemented in [boot.lua](https://bitbucket.org/rude/love/src/default/src/scripts/boot.lua) 8 | */ 9 | namespace path {} 10 | } 11 | -------------------------------------------------------------------------------- /typings/love.data/enums/ContainerType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | /** 3 | * Return type of various data-returning functions. 4 | * 5 | * @link [ContainerType](https://love2d.org/wiki/ContainerType) 6 | * @since 11.0 7 | */ 8 | type ContainerType = "data" | "string"; 9 | } 10 | -------------------------------------------------------------------------------- /typings/love.arg/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./functions"; 2 | 3 | declare module "love" { 4 | /** 5 | * Contains functions for analyzing command line arguments. 6 | * 7 | * Implemented in [boot.lua](https://bitbucket.org/rude/love/src/default/src/scripts/boot.lua) 8 | */ 9 | namespace arg {} 10 | } 11 | -------------------------------------------------------------------------------- /typings/love.data/types/ByteData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | /** 3 | * Data object containing arbitrary bytes in an contiguous memory. 4 | * 5 | * @link [ByteData](https://love2d.org/wiki/ByteData) 6 | * @since 11.0 7 | */ 8 | interface ByteData extends Data<"ByteData"> {} 9 | } 10 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/ParticleInsertMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How newly created particles are added to the ParticleSystem. 4 | * @link [ParticleInsertMode](https://love2d.org/wiki/ParticleInsertMode) 5 | */ 6 | type ParticleInsertMode = "top" | "bottom" | "random"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.window/structs/DisplayOrientation.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.window" { 2 | /** 3 | * @link [DisplayOrientation](https://love2d.org/wiki/DisplayOrientation) 4 | */ 5 | type DisplayOrientation = 6 | | "unknown" 7 | | "landscape" 8 | | "portrait" 9 | | "portaitflipped"; 10 | } 11 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/ImageInformation.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { File, FileData } from "love.filesystem"; 3 | import { CompressedImageData } from "love.image"; 4 | /** 5 | * Is not documented. 6 | */ 7 | type ImageInformation = string | File | FileData | CompressedImageData; 8 | } 9 | -------------------------------------------------------------------------------- /typings/love.graphics/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Canvas"; 2 | import "./Drawable"; 3 | import "./Font"; 4 | import "./Image"; 5 | import "./Mesh"; 6 | import "./ParticleSystem"; 7 | import "./Quad"; 8 | import "./Shader"; 9 | import "./SpriteBatch"; 10 | import "./Text"; 11 | import "./Texture"; 12 | import "./Video"; 13 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/SpriteBatchUsage.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Usage hints for SpriteBatches and Meshes to optimize data storage and access. 4 | * @link [SpriteBatchUsage](https://love2d.org/wiki/SpriteBatchUsage) 5 | */ 6 | type SpriteBatchUsage = "dynamic" | "static" | "stream"; 7 | } 8 | -------------------------------------------------------------------------------- /typings/love.window/enums/MessageBoxType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.window" { 2 | /** 3 | * Types of message box dialogs. Different types may have slightly different 4 | * looks. 5 | * @link [MessageBoxType](https://love2d.org/wiki/MessageBoxType) 6 | */ 7 | type MessageBoxType = "info" | "warning" | "error"; 8 | } 9 | -------------------------------------------------------------------------------- /typings/love.video/types/VideoStream.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.video" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * An object which decodes, streams, and controls Videos. 6 | * @link [VideoStream](https://love2d.org/wiki/VideoStream) 7 | */ 8 | interface VideoStream extends Type<"VideoStream"> {} 9 | } 10 | -------------------------------------------------------------------------------- /typings/love.window/structs/ButtonList.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.window" { 2 | /** 3 | * @link [love.window.showMessageBox](https://love2d.org/wiki/love.window.showMessageBox) 4 | */ 5 | interface ButtonList { 6 | [key: number]: string; 7 | enterbutton?: number; 8 | escapebutton?: number; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /typings/love.data/enums/CompressedDataFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | /** 3 | * Return type of various data-returning functions. 4 | * 5 | * @link [CompressedDataFormat](https://love2d.org/wiki/CompressedDataFormat) 6 | * @since 0.10.0 7 | */ 8 | type CompressedDataFormat = "lz4" | "zlib" | "gzip" | "deflate"; 9 | } 10 | -------------------------------------------------------------------------------- /typings/love.system/enums/PowerState.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.system" { 2 | /** 3 | * The basic state of the system's power supply. 4 | * @link [PowerState](https://love2d.org/wiki/PowerState) 5 | */ 6 | type PowerState = 7 | | "unknown" 8 | | "battery" 9 | | "nobattery" 10 | | "charging" 11 | | "charged"; 12 | } 13 | -------------------------------------------------------------------------------- /typings/love.joystick/enums/GamepadAxis.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.joystick" { 2 | /** 3 | * Virtual gamepad axes. 4 | * @link [GamepadAxis](https://love2d.org/wiki/GamepadAxis) 5 | */ 6 | type GamepadAxis = 7 | | "leftx" 8 | | "lefty" 9 | | "rightx" 10 | | "righty" 11 | | "triggerleft" 12 | | "triggerright"; 13 | } 14 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/BlendAlphaMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Different ways alpha affects color blending. See BlendMode and the BlendMode 4 | * Formulas for additional notes. 5 | * @link [BlendAlphaMode](https://love2d.org/wiki/BlendAlphaMode) 6 | */ 7 | type BlendAlphaMode = "alphamultiply" | "premultiplied"; 8 | } 9 | -------------------------------------------------------------------------------- /typings/love/types/LightUserData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love" { 2 | /** 3 | * Used for valid LightUserData typings. 4 | */ 5 | type ValidUserDataTypes = "Touch" | "Pointer"; 6 | 7 | /** 8 | * Inaccessible. Can only be passed to other functions. 9 | */ 10 | type LightUserData = { 11 | __TYPE__: T; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /typings/love.physics/enums/JointType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Different types of joints. 4 | * @link [JointType](https://love2d.org/wiki/JointType) 5 | */ 6 | type JointType = 7 | | "distance" 8 | | "gear" 9 | | "mouse" 10 | | "prismatic" 11 | | "pulley" 12 | | "revolute" 13 | | "friction" 14 | | "weld" 15 | | "rope"; 16 | } 17 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/VertexWinding.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How Mesh geometry vertices are ordered. 4 | * 5 | * | Value | Description | 6 | * |:-|:-| 7 | * | `"cw"` | Clockwise | 8 | * | `"ccw"` | Counter-clockwise | 9 | * 10 | * @link [VertexWinding](https://love2d.org/wiki/VertexWinding) 11 | */ 12 | type VertexWinding = "cw" | "ccw"; 13 | } 14 | -------------------------------------------------------------------------------- /typings/love.audio/enums/TimeUnit.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * Units that represent time. 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"seconds"` | Regular seconds. | 8 | * | `"samples"` | Audio samples. | 9 | * 10 | * @link [TimeUnit](https://love2d.org/wiki/TimeUnit) 11 | * @since 0.8.0 12 | */ 13 | type TimeUnit = "seconds" | "samples"; 14 | } 15 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/StencilAction.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How a stencil function modifies the stencil values of pixels it touches. 4 | * @link [StencilAction](https://love2d.org/wiki/StencilAction) 5 | */ 6 | type StencilAction = 7 | | "replace" 8 | | "increment" 9 | | "decrement" 10 | | "incrementwrap" 11 | | "decrementwrap" 12 | | "invert"; 13 | } 14 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/GraphicsFeature.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Graphics features that can be checked for with love.graphics.getSupported. 4 | * @link [GraphicsFeature](https://love2d.org/wiki/GraphicsFeature) 5 | */ 6 | type GraphicsFeature = 7 | | "clampzero" 8 | | "lighten" 9 | | "multicanvasformats" 10 | | "glsl3" 11 | | "instancing" 12 | | "fullnpot" 13 | | "pixelshaderhighp"; 14 | } 15 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/BlendMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Different ways to do color blending. See BlendAlphaMode and the BlendMode 4 | * Formulas for additional notes. 5 | * @link [BlendMode](https://love2d.org/wiki/BlendMode) 6 | */ 7 | type BlendMode = 8 | | "alpha" 9 | | "replace" 10 | | "screen" 11 | | "add" 12 | | "subtract" 13 | | "multiply" 14 | | "lighten" 15 | | "darken"; 16 | } 17 | -------------------------------------------------------------------------------- /typings/love.mouse/enums/CursorType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.mouse" { 2 | /** 3 | * Types of hardware cursors. 4 | * @link [CursorType](https://love2d.org/wiki/CursorType) 5 | */ 6 | type CursorType = 7 | | "image" 8 | | "arrow" 9 | | "ibeam" 10 | | "wait" 11 | | "waitarrow" 12 | | "crosshair" 13 | | "sizenwse" 14 | | "sizenesw" 15 | | "sizewe" 16 | | "sizens" 17 | | "sizeall" 18 | | "no" 19 | | "hand"; 20 | } 21 | -------------------------------------------------------------------------------- /typings/love.mouse/types/Cursor.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.mouse" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * @link [Cursor](https://love2d.org/wiki/Cursor) 6 | */ 7 | interface Cursor extends Type<"Cursor"> { 8 | /** 9 | * Gets the type of the Cursor. 10 | * 11 | * @return cursortype, The type of the Cursor. 12 | * @link [Cursor:getType](https://love2d.org/wiki/Cursor:getType) 13 | */ 14 | getType(): CursorType; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/VertexAttribute.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * A table containing the attribute's name, it's data type, and the number of components in the attribute. 4 | * ``` 5 | * [name, datatype, components] 6 | * ``` 7 | * @link [love.graphics.newMesh](https://love2d.org/wiki/love.graphics.newMesh) 8 | */ 9 | type VertexAttribute = [ 10 | string, 11 | T, 12 | 1 | 2 | 3 | 4, 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/GraphicsLimit.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Types of system-dependent graphics limits checked for using love.graphics.getSystemLimits. 4 | * @link [GraphicsLimit](https://love2d.org/wiki/GraphicsLimit) 5 | */ 6 | type GraphicsLimit = 7 | | "pointsize" 8 | | "texturesize" 9 | | "multicanvas" 10 | | "canvasmsaa" 11 | | "texturelayers" 12 | | "volumetexturesize" 13 | | "cubetexturesize" 14 | | "anisotropy"; 15 | } 16 | -------------------------------------------------------------------------------- /typings/love.audio/enums/EffectType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * The different types of effects supported by [love.audio.setEffect](https://love2d.org/wiki/love.audio.setEffect). 4 | * 5 | * @link [EffectType](https://love2d.org/wiki/EffectType) 6 | * @since 11.0 7 | */ 8 | type EffectType = 9 | | "chorus" 10 | | "compressor" 11 | | "distortion" 12 | | "echo" 13 | | "equalizer" 14 | | "flanger" 15 | | "reverb" 16 | | "ringmodulator"; 17 | } 18 | -------------------------------------------------------------------------------- /typings/love.joystick/enums/GamepadButton.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.joystick" { 2 | /** 3 | * Virtual gamepad buttons. 4 | * @link [GamepadButton](https://love2d.org/wiki/GamepadButton) 5 | */ 6 | type GamepadButton = 7 | | "a" 8 | | "b" 9 | | "x" 10 | | "y" 11 | | "back" 12 | | "guide" 13 | | "start" 14 | | "leftstick" 15 | | "rightstick" 16 | | "leftshoulder" 17 | | "rightshoulder" 18 | | "dpup" 19 | | "dpdown" 20 | | "dpleft" 21 | | "dpright"; 22 | } 23 | -------------------------------------------------------------------------------- /typings/love.audio/enums/SourceType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * Types of audio sources. 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"static"` | The whole audio is decoded. | 8 | * | `"stream"` | The audio is decoded in chunks when needed. | 9 | * | `"queue"` | The audio must be [manually queued](https://love2d.org/wiki/Source:queue) by the user. | 10 | * 11 | * @link [SourceType](https://love2d.org/wiki/SourceType) 12 | */ 13 | type SourceType = "static" | "stream" | "queue"; 14 | } 15 | -------------------------------------------------------------------------------- /typings/love.image/enums/CanvasFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.image" { 2 | /** 3 | * Canvas formats. 4 | * @link [CanvasFormat](https://love2d.org/wiki/CanvasFormat) 5 | */ 6 | type CanvasFormat = 7 | | "hdr" 8 | | "normal" 9 | | "r16" 10 | | "r16f" 11 | | "r32f" 12 | | "r8" 13 | | "rg11b10f" 14 | | "rg16" 15 | | "rg16f" 16 | | "rg32f" 17 | | "rg8" 18 | | "rgb10a2" 19 | | "rgb565" 20 | | "rgb5a1" 21 | | "rgba16f" 22 | | "rgba32f" 23 | | "rgba4" 24 | | "rgba8" 25 | | "srgb"; 26 | } 27 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/WrapMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * How the image wraps inside a Quad with a larger quad size than image size. This 4 | * also affects how Meshes with texture coordinates which are outside the range of 5 | * [0, 1] are drawn, and the color returned by the Texel Shader function when 6 | * using it to sample from texture coordinates outside of the range of [0, 1]. 7 | * @link [WrapMode](https://love2d.org/wiki/WrapMode) 8 | */ 9 | type WrapMode = "clamp" | "repeat" | "mirroredrepeat" | "clampzero"; 10 | } 11 | -------------------------------------------------------------------------------- /typings/love/types/Version.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love" { 2 | type Version = 3 | | "11.5" 4 | | "11.4" 5 | | "11.3" 6 | | "11.2" 7 | | "11.1" 8 | | "11.0" 9 | | "0.10.2" 10 | | "0.10.1" 11 | | "0.10.0" 12 | | "0.9.2" 13 | | "0.9.1" 14 | | "0.9.0" 15 | | "0.8.0" 16 | | "0.7.2" 17 | | "0.7.1" 18 | | "0.7.0" 19 | | "0.6.2" 20 | | "0.6.1" 21 | | "0.6.0" 22 | | "0.5.0" 23 | | "0.4.0" 24 | | "0.3.2" 25 | | "0.3.1" 26 | | "0.3.0" 27 | | "0.2.1" 28 | | "0.2.0" 29 | | "0.1.1"; 30 | } 31 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/ImageSettings.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | type ImageSettings = { 3 | /** 4 | * 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. 5 | * @default false 6 | */ 7 | mipmaps?: boolean; 8 | 9 | /** 10 | * True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. 11 | * @default false 12 | */ 13 | linear?: boolean; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /typings/love.physics/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./Body"; 2 | import "./ChainShape"; 3 | import "./CircleShape"; 4 | import "./Contact"; 5 | import "./DistanceJoint"; 6 | import "./EdgeShape"; 7 | import "./Fixture"; 8 | import "./FrictionJoint"; 9 | import "./GearJoint"; 10 | import "./Joint"; 11 | import "./MotorJoint"; 12 | import "./MouseJoint"; 13 | import "./PolygonShape"; 14 | import "./PrismaticJoint"; 15 | import "./PulleyJoint"; 16 | import "./RevoluteJoint"; 17 | import "./RopeJoint"; 18 | import "./Shape"; 19 | import "./WeldJoint"; 20 | import "./WheelJoint"; 21 | import "./World"; 22 | -------------------------------------------------------------------------------- /typings/love.data/types/CompressedData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | /** 3 | * Data object containing arbitrary bytes in an contiguous memory. 4 | * 5 | * @link [CompressedData](https://love2d.org/wiki/CompressedData) 6 | */ 7 | interface CompressedData extends Data<"CompressedData"> { 8 | /** 9 | * Gets the compression format of the CompressedData. 10 | * 11 | * @return format, The format of the CompressedData. 12 | * @link [CompressedData:getFormat](https://love2d.org/wiki/CompressedData:getFormat) 13 | */ 14 | getFormat(): CompressedDataFormat; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /typings/love.graphics/types/Drawable.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { Type } from "love"; 3 | type DrawableTypes = 4 | | "Mesh" 5 | | "ParticleSystem" 6 | | "SpriteBatch" 7 | | "Text" 8 | | "Texture" 9 | | "Video" 10 | | "Image" 11 | | "Canvas"; 12 | 13 | /** 14 | * Superclass for all things that can be drawn on screen. This is an abstract type that can't be created directly. 15 | * 16 | * @link [Drawable](https://love2d.org/wiki/Drawable) 17 | */ 18 | interface Drawable extends Type { 19 | _drawable: never; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /typings/love.audio/enums/FilterType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * Types of filters for Sources. 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"lowpass"` | Low-pass filter. High frequency sounds are attenuated. | 8 | * | `"highpass"` | High-pass filter. Low frequency sounds are attenuated. | 9 | * | `"bandpass"` | Band-pass filter. Both high and low frequency sounds are attenuated based on the given parameters. | 10 | * 11 | * @link [FilterType](https://love2d.org/wiki/FilterType) 12 | * @since 11.0 13 | */ 14 | type FilterType = "lowpass" | "highpass" | "bandpass"; 15 | } 16 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/VertexAttributeStep.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * The frequency at which a vertex shader fetches the vertex attribute's 4 | * data from the Mesh when it's drawn. 5 | * 6 | * Per-instance attributes can be used to render a Mesh many times with 7 | * different positions, colors, or other attributes via a single 8 | * love.graphics.drawInstanced call, without using the love_InstanceID 9 | * vertex shader variable. 10 | * @link [VertexAttributeStep](https://love2d.org/wiki/VertexAttributeStep) 11 | */ 12 | type VertexAttributeStep = "pervertex" | "perinstance"; 13 | } 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to love-typescript-definitions 2 | 3 | ## Contributing via Code 4 | 5 | Make sure to run `npm install` to install all dependencies. 6 | 7 | When making any code change, make sure to run `npm run fix:prettier` to match current code formatting. 8 | 9 | ## Contributing via Issues 10 | 11 | Issues are welcome if there's any trouble with using these declarations. 12 | 13 | ## Project Brief 14 | 15 | This project aims to provide TypeScript declarations to build [LÖVE 2D](https://love2d.org/) projects with [TypeScriptToLua](https://github.com/TypeScriptToLua/TypeScriptToLua). 16 | 17 | These definitions are obtained from [the official wiki](https://love2d.org/wiki/Main_Page) and/or the [love-api](https://github.com/love2d-community/love-api). 18 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./AlignMode"; 2 | import "./ArcType"; 3 | import "./AreaSpreadDistribution"; 4 | import "./BlendAlphaMode"; 5 | import "./BlendMode"; 6 | import "./CompareMode"; 7 | import "./CullMode"; 8 | import "./DrawMode"; 9 | import "./FilterMode"; 10 | import "./GraphicsFeature"; 11 | import "./GraphicsLimit"; 12 | import "./IndexDataType"; 13 | import "./LineJoin"; 14 | import "./LineStyle"; 15 | import "./MatrixLayout"; 16 | import "./MeshDrawMode"; 17 | import "./MipmapMode"; 18 | import "./ParticleInsertMode"; 19 | import "./ShaderVariableType"; 20 | import "./SpriteBatchUsage"; 21 | import "./StackType"; 22 | import "./StencilAction"; 23 | import "./TextureType"; 24 | import "./VertexAttributeStep"; 25 | import "./VertexWinding"; 26 | import "./WrapMode"; 27 | -------------------------------------------------------------------------------- /typings/love.window/enums/FullscreenType.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.window" { 2 | /** 3 | * Types of fullscreen modes. 4 | * 5 | * In normal fullscreen mode, if a window size is used which does not match one of 6 | * the monitor's supported display modes, the window will be resized to the next 7 | * largest display mode. 8 | * 9 | * Normal fullscreen mode is sometimes avoided by users because it can cause 10 | * issues in some window managers and with multi-monitor setups. In OS X it 11 | * prevents switching to a different program until fullscreen mode is exited. The 12 | * "desktop" fullscreen mode generally avoids these issues. 13 | * @link [FullscreenType](https://love2d.org/wiki/FullscreenType) 14 | */ 15 | type FullscreenType = "desktop" | "exclusive"; 16 | } 17 | -------------------------------------------------------------------------------- /typings/love.audio/enums/EffectWaveform.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * The different types of waveforms that can be used with the ringmodulator [EffectType](https://love2d.org/wiki/EffectType). 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"sawtooth"` | A sawtooth wave, also known as a ramp wave. Named for its linear rise, and (near-)instantaneous fall along time. | 8 | * | `"sine"` | A sine wave. Follows a trigonometric sine function. | 9 | * | `"square"` | A square wave. Switches between high and low states (near-)instantaneously. | 10 | * | `"triangle"` | A triangle wave. Follows a linear rise and fall that repeats periodically. | 11 | * 12 | * @link [EffectWaveform](https://love2d.org/wiki/EffectWaveform) 13 | * @since 11.0 14 | */ 15 | type EffectWaveform = "sawtooth" | "sine" | "square" | "triangle"; 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "love-typescript-definitions", 3 | "version": "11.5.2", 4 | "description": "Write LÖVE 2D projects with TypeScript", 5 | "license": "MIT", 6 | "keywords": [ 7 | "love2d", 8 | "love", 9 | "lua", 10 | "typescript" 11 | ], 12 | "homepage": "https://github.com/hazzard993/love-typescript-definitions#readme", 13 | "bugs": "https://github.com/hazzard993/love-typescript-definitions/issues", 14 | "repository": "https://github.com/hazzard993/love-typescript-definitions.git", 15 | "scripts": { 16 | "lint:prettier": "prettier --check \"**/*.{js,ts,yml,json,md}\"", 17 | "fix:prettier": "prettier --check --write \"**/*.{js,ts,yml,json,md}\"" 18 | }, 19 | "devDependencies": { 20 | "prettier": "^3.0.3", 21 | "typescript-to-lua": "^1.25.1" 22 | }, 23 | "files": [ 24 | "**/**.d.ts" 25 | ], 26 | "types": "index.d.ts" 27 | } 28 | -------------------------------------------------------------------------------- /typings/love.physics/types/RopeJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * The RopeJoint enforces a maximum distance between two points on two bodies. It has no other effect. 4 | * @link [RopeJoint](https://love2d.org/wiki/RopeJoint) 5 | */ 6 | interface RopeJoint extends Joint<"RopeJoint"> { 7 | /** 8 | * Gets the maximum length of a RopeJoint. 9 | * 10 | * @return maxLength, The maximum length of the RopeJoint. 11 | * @link [RopeJoint:getMaxLength](https://love2d.org/wiki/RopeJoint:getMaxLength) 12 | */ 13 | getMaxLength(): number; 14 | 15 | /** 16 | * Sets the maximum length of a RopeJoint. 17 | * 18 | * @param maxLength The maximum length of the RopeJoint. 19 | * @link [RopeJoint:setMaxLength](https://love2d.org/wiki/RopeJoint:setMaxLength) 20 | */ 21 | setMaxLength(maxLength: number): void; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /typings/love.data/enums/HashFunction.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | /** 3 | * Hash algorithm of love.data.hash. 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"md5"` | MD5 hash algorithm (16 bytes). | 8 | * | `"sha1"` | SHA1 hash algorithm (20 bytes). | 9 | * | `"sha224"` | SHA2 hash algorithm with message digest size of 224 bits (28 bytes). | 10 | * | `"sha256"` | SHA2 hash algorithm with message digest size of 256 bits (32 bytes). | 11 | * | `"sha384"` | SHA2 hash algorithm with message digest size of 384 bits (48 bytes). | 12 | * | `"sha512"` | SHA2 hash algorithm with message digest size of 512 bits (64 bytes). | 13 | * 14 | * @link [HashFunction](https://love2d.org/wiki/HashFunction) 15 | * @since 11.0 16 | */ 17 | type HashFunction = 18 | | "md5" 19 | | "sha1" 20 | | "sha224" 21 | | "sha256" 22 | | "sha384" 23 | | "sha512"; 24 | } 25 | -------------------------------------------------------------------------------- /typings/love.filesystem/types/FileData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.filesystem" { 2 | import { Data } from "love.data"; 3 | 4 | /** 5 | * Data representing the contents of a file. 6 | * 7 | * @link [FileData](https://love2d.org/wiki/FileData) 8 | * @since 0.7.0 9 | */ 10 | interface FileData extends Data<"FileData"> { 11 | /** 12 | * Gets the extension of the FileData. 13 | * 14 | * @return ext, The extension of the file the FileData represents. 15 | * @link [FileData:getExtension](https://love2d.org/wiki/FileData:getExtension) 16 | * @since 0.7.0 17 | */ 18 | getExtension(): string; 19 | 20 | /** 21 | * Gets the filename of the FileData. 22 | * 23 | * @return name, The name of the file the FileData represents. 24 | * @link [FileData:getFilename](https://love2d.org/wiki/FileData:getFilename) 25 | * @since 0.7.0 26 | */ 27 | getFilename(): string; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/AreaSpreadDistribution.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Types of particle area spread distribution. 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"uniform"` | Uniform distribution. | 8 | * | `"normal"` | Normal (gaussian) distribution. | 9 | * | `"ellipse"` | Uniform distribution in an ellipse. | 10 | * | `"borderellipse"` | Distribution in an ellipse with particles spawning at the edges of the ellipse. | 11 | * | `"borderrectangle"` | Distribution in a rectangle with particles spawning at the edges of the rectangle. | 12 | * | `"none"` | No distribution - area spread is disabled. | 13 | * 14 | * @link [AreaSpreadDistribution](https://love2d.org/wiki/AreaSpreadDistribution) 15 | */ 16 | type AreaSpreadDistribution = 17 | | "uniform" 18 | | "normal" 19 | | "ellipse" 20 | | "borderellipse" 21 | | "borderrectangle" 22 | | "none"; 23 | } 24 | -------------------------------------------------------------------------------- /typings/love.arg/functions.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love" { 2 | namespace arg { 3 | /** 4 | * Finds the key in the table with the lowest integral index. The lowest 5 | * will typically the executable, for instance "lua5.1.exe". 6 | * 7 | * @param args The given arguments to look at. 8 | * @returns The lowest argument followed by its index within args. 9 | */ 10 | function getLow( 11 | this: void, 12 | args: string[], 13 | ): LuaMultiReturn<[lowest: string, index: number]>; 14 | function parseOption(this: void): void; 15 | function parseOptions(this: void): void; 16 | 17 | /** 18 | * Returns the arguments that are passed to your game via love.load() 19 | * arguments that were parsed as options are skipped. 20 | * 21 | * @param args The arguments to parse. 22 | * @returns The parsed arguments. 23 | */ 24 | function parseGameArguments(this: void, args: string[]): string[]; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /typings/love.physics/types/GearJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Keeps bodies together in such a way that they act like gears. 4 | * @link [GearJoint](https://love2d.org/wiki/GearJoint) 5 | */ 6 | interface GearJoint extends Joint<"GearJoint"> { 7 | /** 8 | * Get the Joints connected by this GearJoint. 9 | * 10 | * @return joints, The connected joints. 11 | * @link [GearJoint:getJoints](https://love2d.org/wiki/GearJoint:getJoints) 12 | */ 13 | getJoints(): LuaMultiReturn; 14 | 15 | /** 16 | * Get the ratio of a gear joint. 17 | * 18 | * @return ratio, The ratio of the joint. 19 | * @link [GearJoint:getRatio](https://love2d.org/wiki/GearJoint:getRatio) 20 | */ 21 | getRatio(): number; 22 | 23 | /** 24 | * Set the ratio of a gear joint. 25 | * 26 | * @param ratio The new ratio of the joint. 27 | * @link [GearJoint:setRatio](https://love2d.org/wiki/GearJoint:setRatio) 28 | */ 29 | setRatio(ratio: number): void; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /typings/love.audio/structs/FilterSettings.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * Structure used with [Source:setFilter](https://love2d.org/wiki/Source:setFilter) and [Source:getFilter](https://love2d.org/wiki/Source:getFilter). 4 | * @link [Source:setFilter](https://love2d.org/wiki/Source:setFilter) 5 | * @link [Source:getFilter](https://love2d.org/wiki/Source:getFilter) 6 | */ 7 | type FilterSettings = { 8 | /** 9 | * The type of filter to use. 10 | */ 11 | type: FilterType; 12 | 13 | /** 14 | * The overall volume of the audio. 15 | * 16 | * Must be between `0` and `1`. 17 | */ 18 | volume: number; 19 | 20 | /** 21 | * Volume of high-frequency audio. Only applies to low-pass and band-pass filters. 22 | * 23 | * Must be between `0` and `1`. 24 | */ 25 | highgain?: number; 26 | 27 | /** 28 | * Volume of low-frequency audio. Only applies to high-pass and band-pass filters. 29 | * 30 | * Must be between `0` and `1`. 31 | */ 32 | lowgain?: number; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /typings/love.audio/enums/DistanceModel.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * The different distance models. 4 | * 5 | * | Constant | Description | 6 | * | :- | :- | 7 | * | `"none"` | Sources do not get attenuated. | 8 | * | `"inverse"` | Inverse distance attenuation. | 9 | * | `"inverseclamped"` | Inverse distance attenuation. Gain is clamped. | 10 | * | `"linear"` | Linear attenuation. | 11 | * | `"linearclamped"` | Linear attenuation. Gain is clamped | 12 | * | `"exponent"` | Exponential attenuation. | 13 | * | `"exponentclamped"` | Exponential attenuation. Gain is clamped. | 14 | * 15 | * Extended information can be found in the chapter "3.4. Attenuation By Distance" of the [OpenAL 1.1 specification](https://www.openal.org/documentation/openal-1.1-specification.pdf). 16 | * @link [DistanceModel](https://love2d.org/wiki/DistanceModel) 17 | * @since 0.8.0 18 | */ 19 | type DistanceModel = 20 | | "none" 21 | | "inverse" 22 | | "inverseclamped" 23 | | "linear" 24 | | "linearclamped" 25 | | "exponent" 26 | | "exponentclamped"; 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) love-typescript-definitions contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/VertexInformation.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * A vertex information table with the following order of values: 4 | * - [0] - The position of the vertex on the x-axis. 5 | * - [1] - The position of the vertex on the y-axis. 6 | * - [2] (default: 0) - The u texture coordinate of the vertex. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.) 7 | * - [3] (default: 0) - The v texture coordinate of the vertex. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.) 8 | * - [4] (default: 1) - The red component of the vertex color. 9 | * - [5] (default: 1) - The green component of the vertex color. 10 | * - [6] (default: 1) - The blue component of the vertex color. 11 | * - [7] (default: 1) - The alpha component of the vertex color. 12 | * @link [love.graphics.newMesh](https://love2d.org/wiki/love.graphics.newMesh) 13 | */ 14 | type VertexInformation = [ 15 | x: number, 16 | y: number, 17 | u?: number, 18 | v?: number, 19 | r?: number, 20 | g?: number, 21 | b?: number, 22 | a?: number, 23 | ]; 24 | } 25 | -------------------------------------------------------------------------------- /typings/love.physics/types/WeldJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * A WeldJoint essentially glues two bodies together. 4 | * @link [WeldJoint](https://love2d.org/wiki/WeldJoint) 5 | */ 6 | interface WeldJoint extends Joint<"WeldJoint"> { 7 | /** 8 | * Returns the damping ratio of the joint. 9 | * 10 | * @return ratio, The damping ratio. 11 | * @link [WeldJoint:getDampingRatio](https://love2d.org/wiki/WeldJoint:getDampingRatio) 12 | */ 13 | getDampingRatio(): number; 14 | 15 | /** 16 | * Returns the frequency. 17 | * 18 | * @return freq, The frequency in hertz. 19 | * @link [WeldJoint:getFrequency](https://love2d.org/wiki/WeldJoint:getFrequency) 20 | */ 21 | getFrequency(): number; 22 | 23 | /** 24 | * The new damping ratio. 25 | * 26 | * @param ratio The new damping ratio. 27 | * @link [WeldJoint:setDampingRatio](https://love2d.org/wiki/WeldJoint:setDampingRatio) 28 | */ 29 | setDampingRatio(ratio: number): void; 30 | 31 | /** 32 | * Sets a new frequency. 33 | * 34 | * @param freq The new frequency in hertz. 35 | * @link [WeldJoint:setFrequency](https://love2d.org/wiki/WeldJoint:setFrequency) 36 | */ 37 | setFrequency(freq: number): void; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /typings/love.video/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This module is responsible for decoding, controlling, and streaming video 3 | * files. 4 | * 5 | * It can't draw the videos, see love.graphics.newVideo and Video objects for 6 | * that. 7 | * 8 | * @noResolution 9 | * @noSelf 10 | * @link [love.video](https://love2d.org/wiki/love.video) 11 | */ 12 | declare module "love.video" { 13 | import { File } from "love.filesystem"; 14 | 15 | /** 16 | * Creates a new VideoStream. Currently only Ogg Theora video files are supported. 17 | * VideoStreams can't draw videos, see love.graphics.newVideo for that. 18 | * 19 | * @param filename The file path to the Ogg Theora video file. 20 | * @return videostream, A new VideoStream. 21 | * @link [love.video.newVideoStream](https://love2d.org/wiki/love.video.newVideoStream) 22 | */ 23 | function newVideoStream(filename: string): VideoStream; 24 | 25 | /** 26 | * Creates a new VideoStream. Currently only Ogg Theora video files are supported. 27 | * VideoStreams can't draw videos, see love.graphics.newVideo for that. 28 | * 29 | * @param file The File object containing the Ogg Theora video. 30 | * @return videostream, A new VideoStream. 31 | * @link [love.video.newVideoStream](https://love2d.org/wiki/love.video.newVideoStream) 32 | */ 33 | function newVideoStream(file: File): VideoStream; 34 | } 35 | -------------------------------------------------------------------------------- /typings/love.image/enums/CompressedImageFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.image" { 2 | /** 3 | * Compressed image data formats. Here and here are a couple overviews of many of 4 | * the formats. 5 | * 6 | * Unlike traditional PNG or jpeg, these formats stay compressed in RAM and in the 7 | * graphics card's VRAM. This is good for saving memory space as well as improving 8 | * performance, since the graphics card will be able to keep more of the image's 9 | * pixels in its fast-access cache when drawing it. 10 | * @link [CompressedImageFormat](https://love2d.org/wiki/CompressedImageFormat) 11 | */ 12 | type CompressedImageFormat = 13 | | "DXT1" 14 | | "DXT3" 15 | | "DXT5" 16 | | "BC4" 17 | | "BC4s" 18 | | "BC5" 19 | | "BC5s" 20 | | "BC6h" 21 | | "BC6hs" 22 | | "BC7" 23 | | "ETC1" 24 | | "ETC2rgb" 25 | | "ETC2rgba" 26 | | "ETC2rgba1" 27 | | "EACr" 28 | | "EACrs" 29 | | "EACrg" 30 | | "EACrgs" 31 | | "PVR1rgb2" 32 | | "PVR1rgb4" 33 | | "PVR1rgba2" 34 | | "PVR1rgba4" 35 | | "ASTC4x4" 36 | | "ASTC5x4" 37 | | "ASTC5x5" 38 | | "ASTC6x5" 39 | | "ASTC6x6" 40 | | "ASTC8x5" 41 | | "ASTC8x6" 42 | | "ASTC8x8" 43 | | "ASTC10x5" 44 | | "ASTC10x6" 45 | | "ASTC10x8" 46 | | "ASTC10x10" 47 | | "ASTC12x10" 48 | | "ASTC12x12"; 49 | } 50 | -------------------------------------------------------------------------------- /typings/love.image/enums/PixelFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.image" { 2 | /** 3 | * @link [PixelFormat](https://love2d.org/wiki/PixelFormat) 4 | */ 5 | type PixelFormat = 6 | | "hdr" 7 | | "normal" 8 | | "r16" 9 | | "r16f" 10 | | "r32f" 11 | | "r8" 12 | | "rg11b10f" 13 | | "rg16" 14 | | "rg16f" 15 | | "rg32f" 16 | | "rg8" 17 | | "rgb10a2" 18 | | "rgb565" 19 | | "rgb5a1" 20 | | "rgba16f" 21 | | "rgba16" 22 | | "rgba32f" 23 | | "rgba4" 24 | | "rgba8" 25 | | "srgb" 26 | | "srgba8" 27 | | "stencil8" 28 | | "depth16" 29 | | "depth24" 30 | | "depth32f" 31 | | "depth24stencil8" 32 | | "depth32fstencil8" 33 | | "DXT1" 34 | | "DXT3" 35 | | "DXT5" 36 | | "BC4" 37 | | "BC4s" 38 | | "BC5" 39 | | "BC5s" 40 | | "BC6h" 41 | | "BC6hs" 42 | | "BC7" 43 | | "ETC1" 44 | | "ETC2rgb" 45 | | "ETC2rgba" 46 | | "ETC2rgba1" 47 | | "EACr" 48 | | "EACrs" 49 | | "EACrg" 50 | | "EACrgs" 51 | | "PVR1rgb2" 52 | | "PVR1rgb4" 53 | | "PVR1rgba2" 54 | | "PVR1rgba4" 55 | | "ASTC4x4" 56 | | "ASTC5x4" 57 | | "ASTC5x5" 58 | | "ASTC6x5" 59 | | "ASTC6x6" 60 | | "ASTC8x5" 61 | | "ASTC8x6" 62 | | "ASTC8x8" 63 | | "ASTC10x5" 64 | | "ASTC10x6" 65 | | "ASTC10x8" 66 | | "ASTC10x10" 67 | | "ASTC12x10" 68 | | "ASTC12x12"; 69 | } 70 | -------------------------------------------------------------------------------- /typings/love.physics/types/FrictionJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * A FrictionJoint applies friction to a body. 4 | * @link [FrictionJoint](https://love2d.org/wiki/FrictionJoint) 5 | */ 6 | interface FrictionJoint extends Joint<"FrictionJoint"> { 7 | /** 8 | * Gets the maximum friction force in Newtons. 9 | * 10 | * @return force, Maximum force in Newtons. 11 | * @link [FrictionJoint:getMaxForce](https://love2d.org/wiki/FrictionJoint:getMaxForce) 12 | */ 13 | getMaxForce(): number; 14 | 15 | /** 16 | * Gets the maximum friction torque in Newton-meters. 17 | * 18 | * @return torque, Maximum torque in Newton-meters. 19 | * @link [FrictionJoint:getMaxForce](https://love2d.org/wiki/FrictionJoint:getMaxForce) 20 | */ 21 | getMaxTorque(): number; 22 | 23 | /** 24 | * Sets the maximum friction force in Newtons. 25 | * 26 | * @param maxForce Max force in Newtons. 27 | * @link [FrictionJoint:setMaxForce](https://love2d.org/wiki/FrictionJoint:setMaxForce) 28 | */ 29 | setMaxForce(maxForce: number): void; 30 | 31 | /** 32 | * Sets the maximum friction torque in Newton-meters. 33 | * 34 | * @param torque Maximum torque in Newton-meters. 35 | * @link [FrictionJoint:setMaxTorque](https://love2d.org/wiki/FrictionJoint:setMaxTorque) 36 | */ 37 | setMaxTorque(torque: number): void; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /typings/love/types/Type.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love" { 2 | /** 3 | * The superclass of all LÖVE types. 4 | * 5 | * Use `typeOf` to determine what subtype that is. 6 | * @link [Object](https://love2d.org/wiki/Object) 7 | */ 8 | interface Type { 9 | /** @ignore */ 10 | " __opaque": never; 11 | 12 | /** 13 | * Destroys the object's Lua reference. 14 | * 15 | * The object will be completely deleted if it's not referenced by any other LÖVE object or thread. 16 | * @return success, True if the object was released by this call, false if it had been previously released. 17 | * @link [Object:release](https://love2d.org/wiki/Object:release) 18 | */ 19 | release(): this is never; 20 | 21 | /** 22 | * Gets the type of the object as a string. 23 | * 24 | * @return type, The type as a string. 25 | * @link [Object:type](https://love2d.org/wiki/Object:type) 26 | */ 27 | type(): T; 28 | 29 | /** 30 | * Checks whether an object is of a certain type. If the object has the type with 31 | * the specified name in its hierarchy, this function will return true. 32 | * 33 | * @param name The name of the type to check for. 34 | * @return b, True if the object is of the specified type, false otherwise. 35 | * @link [Object:typeOf](https://love2d.org/wiki/Object:typeOf) 36 | */ 37 | typeOf(name: T): this is Types[T]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /typings/love.physics/types/PolygonShape.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * A PolygonShape is a convex polygon with up to 8 vertices. 4 | * @link [PolygonShape](https://love2d.org/wiki/PolygonShape) 5 | */ 6 | interface PolygonShape extends Shape<"PolygonShape"> { 7 | /** 8 | * Get the local coordinates of the polygon's vertices. 9 | * 10 | * This function has a variable number of return values. It can be used in a 11 | * nested fashion with love.graphics.polygon. 12 | * 13 | * This function may have up to 16 return values, since it returns two values for 14 | * each vertex in the polygon. In other words, it can return the coordinates of up 15 | * to 8 points. 16 | * 17 | * @return x1, The x component of the first vertex. 18 | * @return y1, The y component of the first vertex. 19 | * @return x2, The x component of the second vertex. 20 | * @return y2, The y component of the second vertex. 21 | * @return ..., Additional x and y values. 22 | * @link [PolygonShape:getPoints](https://love2d.org/wiki/PolygonShape:getPoints) 23 | */ 24 | getPoints(): LuaMultiReturn; 25 | 26 | /** 27 | * Validates whether the PolygonShape is convex. 28 | * 29 | * Concave PolygonShapes cannot be used in love.physics. 30 | * @return convex, Whether the PolygonShape is convex. 31 | * @link [PolygonShape:validate](https://love2d.org/wiki/PolygonShape:validate) 32 | */ 33 | validate(): boolean; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /typings/love.path/functions.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love" { 2 | namespace path { 3 | /** 4 | * Replace any `\` with `/`. 5 | * 6 | * @param path The path to modify. 7 | * @returns The path in its modified state. 8 | * @link [love.path.normalslashes](https://bitbucket.org/rude/love/src/8d55498fe68106bb279fbc21f36f94e00b5caf09/src/scripts/boot.lua#lines-29) 9 | */ 10 | function normalslashes(this: void, path: string): string; 11 | 12 | /** 13 | * Makes sure there is a slash at the end of a path. 14 | * 15 | * @param path The path to return with a slash at the end. 16 | * @returns A path with a slash at the end. 17 | */ 18 | function endslash(this: void, path: string): string; 19 | 20 | /** 21 | * Checks whether a path is absolute or not. 22 | * 23 | * @param path The path to check. 24 | * @returns `true` if the path is absolute, `false` otherwise. 25 | */ 26 | function abs(this: void, path: string): boolean; 27 | 28 | /** 29 | * Converts any path into a full path. 30 | * 31 | * @param path A relative path from the cwd or a full path. 32 | * @returns The full path. 33 | */ 34 | function getFull(this: void, path: string): string; 35 | 36 | /** 37 | * Returns the leaf of a full path. 38 | * 39 | * `/path/to/file --> file` 40 | * 41 | * @param path The path to obtain the leaf from. 42 | * @returns The last part of the path. 43 | */ 44 | function leaf(this: void, path: string): string; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /typings/love.physics/types/CircleShape.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Circle extends Shape and adds a radius and a local position. 4 | * @link [CircleShape](https://love2d.org/wiki/CircleShape) 5 | */ 6 | interface CircleShape extends Shape<"CircleShape"> { 7 | /** 8 | * Gets the center point of the circle shape. 9 | * 10 | * @return x, The x-component of the center point of the circle. 11 | * @return y, The y-component of the center point of the circle. 12 | * @link [CircleShape:getPoint](https://love2d.org/wiki/CircleShape:getPoint) 13 | */ 14 | getPoint(): LuaMultiReturn<[x: number, y: number]>; 15 | 16 | /** 17 | * Gets the radius of the circle shape. 18 | * 19 | * @return radius, The radius of the circle. 20 | * @link [CircleShape:getRadius](https://love2d.org/wiki/CircleShape:getRadius) 21 | */ 22 | getRadius(): number; 23 | 24 | /** 25 | * Sets the location of the center of the circle shape. 26 | * 27 | * @param x The x-component of the new center point of the circle. 28 | * @param y The y-component of the new center point of the circle. 29 | * @link [CircleShape:setPoint](https://love2d.org/wiki/CircleShape:setPoint) 30 | */ 31 | setPoint(x: number, y: number): void; 32 | 33 | /** 34 | * Sets the radius of the circle. 35 | * 36 | * @param radius The radius of the circle. 37 | * @link [CircleShape:setRadius](https://love2d.org/wiki/CircleShape:setRadius) 38 | */ 39 | setRadius(radius: number): void; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import "./love.arg"; 2 | import "./love.audio"; 3 | import "./love.data"; 4 | import "./love.event"; 5 | import "./love.filesystem"; 6 | import "./love.font"; 7 | import "./love.graphics"; 8 | import "./love.image"; 9 | import "./love.joystick"; 10 | import "./love.keyboard"; 11 | import "./love.math"; 12 | import "./love.mouse"; 13 | import "./love.path"; 14 | import "./love.physics"; 15 | import "./love.sound"; 16 | import "./love.system"; 17 | import "./love.thread"; 18 | import "./love.timer"; 19 | import "./love.touch"; 20 | import "./love.video"; 21 | import "./love.window"; 22 | import "./love"; 23 | 24 | declare module "love" { 25 | const audio: typeof import("love.audio"); 26 | const data: typeof import("love.data"); 27 | const event: typeof import("love.event"); 28 | const filesystem: typeof import("love.filesystem"); 29 | const font: typeof import("love.font"); 30 | const graphics: typeof import("love.graphics"); 31 | const image: typeof import("love.image"); 32 | const joystick: typeof import("love.joystick"); 33 | const keyboard: typeof import("love.keyboard"); 34 | const math: typeof import("love.math"); 35 | const mouse: typeof import("love.mouse"); 36 | const physics: typeof import("love.physics"); 37 | const sound: typeof import("love.sound"); 38 | const system: typeof import("love.system"); 39 | const thread: typeof import("love.thread"); 40 | const timer: typeof import("love.timer"); 41 | const touch: typeof import("love.touch"); 42 | const video: typeof import("love.video"); 43 | const window: typeof import("love.window"); 44 | const handlers: import("./love/handlers").Handlers; 45 | } 46 | -------------------------------------------------------------------------------- /typings/love.graphics/types/Quad.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * A quadrilateral (a polygon with four sides and four corners) with texture coordinate information. 6 | * @link [Quad](https://love2d.org/wiki/Quad) 7 | */ 8 | interface Quad extends Type<"Quad"> { 9 | /** 10 | * Gets reference texture dimensions initially specified in love.graphics.newQuad. 11 | * 12 | * @return sw, The Texture width used by the Quad. 13 | * @return sh, The Texture height used by the Quad. 14 | * @link [Quad:getTextureDimensions](https://love2d.org/wiki/Quad:getTextureDimensions) 15 | */ 16 | getTextureDimensions(): LuaMultiReturn<[sw: number, sh: number]>; 17 | 18 | /** 19 | * Gets the current viewport of this Quad. 20 | * 21 | * @return x, The top-left corner along the x-axis. 22 | * @return y, The top-left corner along the y-axis. 23 | * @return w, The width of the viewport. 24 | * @return h, The height of the viewport. 25 | * @link [Quad:getViewport](https://love2d.org/wiki/Quad:getViewport) 26 | */ 27 | getViewport(): LuaMultiReturn<[x: number, y: number, w: number, h: number]>; 28 | 29 | /** 30 | * Sets the texture coordinates according to a viewport. 31 | * 32 | * @param x The top-left corner along the x-axis. 33 | * @param y The top-right corner along the y-axis. 34 | * @param w The width of the viewport. 35 | * @param h The height of the viewport. 36 | * @link [Quad:setViewport](https://love2d.org/wiki/Quad:setViewport) 37 | */ 38 | setViewport(x: number, y: number, w: number, h: number): void; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /typings/love.touch/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides an interface to touch-screen presses. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.touch](https://love2d.org/wiki/love.touch) 7 | */ 8 | declare module "love.touch" { 9 | import { LightUserData } from "love"; 10 | 11 | /** 12 | * Gets the current position of the specified touch-press, in pixels. 13 | * 14 | * @param id The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. 15 | * @return x, The position along the x-axis of the touch-press inside the window, in pixels. 16 | * @return y, The position along the y-axis of the touch-press inside the window, in pixels. 17 | * @link [love.touch.getPosition](https://love2d.org/wiki/love.touch.getPosition) 18 | */ 19 | function getPosition( 20 | id: LightUserData<"Touch">, 21 | ): LuaMultiReturn<[x: number, y: number]>; 22 | 23 | /** 24 | * Gets the current pressure of the specified touch-press. 25 | * 26 | * @param id The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. 27 | * @return pressure, The pressure of the touch-press. Most touch screens aren't pressure sensitive, in which case the pressure will be 1. 28 | * @link [love.touch.getPressure](https://love2d.org/wiki/love.touch.getPressure) 29 | */ 30 | function getPressure(id: LightUserData<"Touch">): number; 31 | 32 | /** 33 | * Gets a list of all active touch-presses. 34 | * 35 | * @return touches, A list of active touch-press id values, which can be used with love.touch.getPosition. 36 | * @link [love.touch.getTouches](https://love2d.org/wiki/love.touch.getTouches) 37 | */ 38 | function getTouches(): Array>; 39 | } 40 | -------------------------------------------------------------------------------- /typings/love.thread/types/Thread.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.thread" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * 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. 6 | * @link [Thread](https://love2d.org/wiki/Thread) 7 | */ 8 | interface Thread extends Type<"Thread"> { 9 | /** 10 | * Retrieves the error string from the thread if it produced an error. 11 | * 12 | * @return message, The error message. 13 | * @link [Thread:getError](https://love2d.org/wiki/Thread:getError) 14 | */ 15 | getError(): string | undefined; 16 | 17 | /** 18 | * Starts the thread. 19 | * 20 | * Threads can be restarted after they have completed their execution. 21 | * 22 | * @link [Thread:start](https://love2d.org/wiki/Thread:start) 23 | */ 24 | start(): void; 25 | 26 | /** 27 | * Starts the thread. 28 | * 29 | * Threads can be restarted after they have completed their execution. 30 | * 31 | * @param args Arguments to pass to the thread 32 | * @link [Thread:start](https://love2d.org/wiki/Thread:start) 33 | */ 34 | start(...args: Array): void; 35 | 36 | /** 37 | * Wait for a thread to finish. This call will block until the thread finishes. 38 | * 39 | * @link [Thread:wait](https://love2d.org/wiki/Thread:wait) 40 | */ 41 | wait(): void; 42 | 43 | /** 44 | * Returns whether the thread is currently running. 45 | * 46 | * Threads which are not running can be (re)started with Thread:start. 47 | * 48 | * @return running, True if the thread is running, false otherwise. 49 | * @link [Thread:isRunning](https://love2d.org/wiki/Thread:isRunning) 50 | */ 51 | isRunning(): boolean; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /typings/love.physics/types/DistanceJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Keeps two bodies at the same distance. 4 | * @link [DistanceJoint](https://love2d.org/wiki/DistanceJoint) 5 | */ 6 | interface DistanceJoint extends Joint<"DistanceJoint"> { 7 | /** 8 | * Gets the damping ratio. 9 | * 10 | * @return ratio, The damping ratio. 11 | * @link [DistanceJoint:getDampingRatio](https://love2d.org/wiki/DistanceJoint:getDampingRatio) 12 | */ 13 | getDampingRatio(): number; 14 | 15 | /** 16 | * Gets the response speed. 17 | * 18 | * @return Hz, The response speed. 19 | * @link [DistanceJoint:getFrequency](https://love2d.org/wiki/DistanceJoint:getFrequency) 20 | */ 21 | getFrequency(): number; 22 | 23 | /** 24 | * Gets the equilibrium distance between the two Bodies. 25 | * 26 | * @return l, The length between the two Bodies. 27 | * @link [DistanceJoint:getLength](https://love2d.org/wiki/DistanceJoint:getLength) 28 | */ 29 | getLength(): number; 30 | 31 | /** 32 | * Sets the damping ratio. 33 | * 34 | * @param ratio The damping ratio. 35 | * @link [DistanceJoint:setDampingRatio](https://love2d.org/wiki/DistanceJoint:setDampingRatio) 36 | */ 37 | setDampingRatio(ratio: number): void; 38 | 39 | /** 40 | * Sets the response speed. 41 | * 42 | * @param Hz The response speed. 43 | * @link [DistanceJoint:setFrequency](https://love2d.org/wiki/DistanceJoint:setFrequency) 44 | */ 45 | setFrequency(Hz: number): void; 46 | 47 | /** 48 | * Sets the equilibrium distance between the two Bodies. 49 | * 50 | * @param l The length between the two Bodies. 51 | * @link [DistanceJoint:setLength](https://love2d.org/wiki/DistanceJoint:setLength) 52 | */ 53 | setLength(l: number): void; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /typings/love.data/types/Data.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.data" { 2 | import { Type, Types, LightUserData } from "love"; 3 | 4 | type DataTypes = 5 | | "Data" 6 | | "ByteData" 7 | | "FileData" 8 | | "GlyphData" 9 | | "CompressedImageData" 10 | | "ImageData" 11 | | "CompressedData" 12 | | "SoundData"; 13 | 14 | /** 15 | * The superclass of all data. 16 | * @link [Data](https://love2d.org/wiki/Data) 17 | */ 18 | interface Data extends Type { 19 | /** 20 | * Creates a new copy of the Data object. 21 | * @return clone, The new copy. 22 | * @link [Data:clone](https://love2d.org/wiki/Data:clone) 23 | * @since 11.0 24 | */ 25 | clone(): Types[T]; 26 | 27 | /** 28 | * Gets an FFI pointer to the Data. 29 | * 30 | * This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used. 31 | * @link [Data:getFFIPointer](https://love2d.org/wiki/Data:getFFIPointer) 32 | * @returns A raw void* pointer to the Data, or nil if FFI is unavailable. 33 | * @since 11.3 34 | */ 35 | getFFIPointer(): LightUserData<"Pointer">; 36 | 37 | /** 38 | * Gets a pointer to the Data. 39 | * @return pointer, A raw pointer to the Data. 40 | * @link [Data:getPointer](https://love2d.org/wiki/Data:getPointer) 41 | */ 42 | getPointer(): LightUserData<"Pointer">; 43 | 44 | /** 45 | * Gets the size of the Data. 46 | * @return size, The size of the Data in bytes. 47 | * @link [Data:getSize](https://love2d.org/wiki/Data:getSize) 48 | */ 49 | getSize(): number; 50 | 51 | /** 52 | * Gets the full Data as a string. 53 | * @return data, The raw data. 54 | * @link [Data:getString](https://love2d.org/wiki/Data:getString) 55 | * @since 0.9.0 56 | */ 57 | getString(): string; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /typings/love.physics/types/MotorJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Controls the relative motion between two Bodies. 4 | * @link [MotorJoint](https://love2d.org/wiki/MotorJoint) 5 | */ 6 | interface MotorJoint extends Joint<"MotorJoint"> { 7 | /** 8 | * Gets the target angular offset between the two Bodies the Joint is attached to. 9 | * 10 | * @return angularoffset, The target angular offset in radians: the second body's angle minus the first body's angle. 11 | * @link [MotorJoint:getAngularOffset](https://love2d.org/wiki/MotorJoint:getAngularOffset) 12 | */ 13 | getAngularOffset(): number; 14 | 15 | /** 16 | * Gets the target linear offset between the two Bodies the Joint is attached to. 17 | * 18 | * @return x, The x component of the target linear offset, relative to the first Body. 19 | * @return y, The y component of the target linear offset, relative to the first Body. 20 | * @link [MotorJoint:getLinearOffset](https://love2d.org/wiki/MotorJoint:getLinearOffset) 21 | */ 22 | getLinearOffset(): LuaMultiReturn<[x: number, y: number]>; 23 | 24 | /** 25 | * Sets the target angular offset between the two Bodies the Joint is attached to. 26 | * 27 | * @param angularoffset The target angular offset in radians: the second body's angle minus the first body's angle. 28 | * @link [MotorJoint:setAngularOffset](https://love2d.org/wiki/MotorJoint:setAngularOffset) 29 | */ 30 | setAngularOffset(angularoffset: number): void; 31 | 32 | /** 33 | * Sets the target linear offset between the two Bodies the Joint is attached to. 34 | * 35 | * @param x The x component of the target linear offset, relative to the first Body. 36 | * @param y The y component of the target linear offset, relative to the first Body. 37 | * @link [MotorJoint:setLinearOffset](https://love2d.org/wiki/MotorJoint:setLinearOffset) 38 | */ 39 | setLinearOffset(x: number, y: number): void; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /typings/love.timer/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides an interface to the user's clock. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.timer](https://love2d.org/wiki/love.timer) 7 | */ 8 | declare module "love.timer" { 9 | /** 10 | * Returns the average delta time (seconds per frame) over the last second. 11 | * 12 | * @return delta, The average delta time over the last second. 13 | * @link [love.timer.getAverageDelta](https://love2d.org/wiki/love.timer.getAverageDelta) 14 | */ 15 | function getAverageDelta(): number; 16 | 17 | /** 18 | * Returns the time between the last two frames. 19 | * 20 | * @return dt, The time passed (in seconds). 21 | * @link [love.timer.getDelta](https://love2d.org/wiki/love.timer.getDelta) 22 | */ 23 | function getDelta(): number; 24 | 25 | /** 26 | * Returns the current frames per second. 27 | * 28 | * @return fps, The current FPS. 29 | * @link [love.timer.getFPS](https://love2d.org/wiki/love.timer.getFPS) 30 | */ 31 | function getFPS(): number; 32 | 33 | /** 34 | * Returns the value of a timer with an unspecified starting time. This function 35 | * should only be used to calculate differences between points in time, as the 36 | * starting time of the timer is unknown. 37 | * 38 | * @return time, The time in seconds. 39 | * @link [love.timer.getTime](https://love2d.org/wiki/love.timer.getTime) 40 | */ 41 | function getTime(): number; 42 | 43 | /** 44 | * Sleeps the program for the specified amount of time. 45 | * 46 | * @param s Seconds to sleep for. 47 | * @link [love.timer.sleep](https://love2d.org/wiki/love.timer.sleep) 48 | */ 49 | function sleep(s: number): void; 50 | 51 | /** 52 | * Measures the time between two frames. Calling this changes the return value of 53 | * love.timer.getDelta. 54 | * 55 | * @return dt, The time passed (in seconds). 56 | * @link [love.timer.step](https://love2d.org/wiki/love.timer.step) 57 | */ 58 | function step(): number; 59 | } 60 | -------------------------------------------------------------------------------- /typings/love.sound/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This module is responsible for decoding sound files. It can't play the sounds, 3 | * see love.audio for that. 4 | * 5 | * @noResolution 6 | * @noSelf 7 | * @link [love.sound](https://love2d.org/wiki/love.sound) 8 | */ 9 | declare module "love.sound" { 10 | import { File } from "love.filesystem"; 11 | 12 | /** 13 | * Attempts to find a decoder for the encoded sound data in the specified file. 14 | * 15 | * @param buffer The size of each decoded chunk, in bytes. (Default 2048) 16 | * @return decoder, A new Decoder object. 17 | * @link [love.sound.newDecoder](https://love2d.org/wiki/love.sound.newDecoder) 18 | */ 19 | function newDecoder(file: File, buffer?: number): Decoder; 20 | function newDecoder(filename: string, buffer?: number): Decoder; 21 | 22 | /** 23 | * Creates new SoundData from a filepath, File, or Decoder. 24 | * 25 | * 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. 26 | * 27 | * @return soundData, A new SoundData object. 28 | * @link [love.sound.newSoundData](https://love2d.org/wiki/love.sound.newSoundData) 29 | */ 30 | function newSoundData(filename: string): SoundData; 31 | function newSoundData(file: File): SoundData; 32 | function newSoundData(decoder: Decoder): SoundData; 33 | 34 | /** 35 | * Creates SoundData with a custom sample rate, channel and bit depth. 36 | * 37 | * @param samples Total number of samples. 38 | * @param rate Number of samples per second. (Default 44100) 39 | * @param bits Bits per sample (8 or 16). (Default 16) 40 | * @param channels Either 1 for mono or 2 for stereo. (Default 2) 41 | * @return soundData, A new SoundData object. 42 | * @link [love.sound.newSoundData](https://love2d.org/wiki/love.sound.newSoundData) 43 | */ 44 | function newSoundData( 45 | samples: number, 46 | rate?: number, 47 | bits?: number, 48 | channels?: number, 49 | ): SoundData; 50 | } 51 | -------------------------------------------------------------------------------- /typings/love.graphics/types/Image.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { ImageData } from "love.image"; 3 | 4 | /** 5 | * Drawable image type. 6 | * @link [Image](https://love2d.org/wiki/Image) 7 | */ 8 | interface Image extends Texture<"Image"> { 9 | /** 10 | * Gets the flags used when the image was created. 11 | * 12 | * @link [Image:getFlags](https://love2d.org/wiki/(Image):getFlags) 13 | * @return flags, A table with ImageFlag keys. 14 | */ 15 | getFlags(): { 16 | /** 17 | * 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) 18 | */ 19 | linear?: boolean; 20 | /** 21 | * 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) 22 | */ 23 | mipmaps?: boolean | string[]; 24 | }; 25 | 26 | /** 27 | * Gets whether the Image was created from CompressedData. 28 | * @return compressed, Whether the Image is stored as a compressed texture on the GPU. 29 | * @link [Image:isCompressed](https://love2d.org/wiki/(Image):isCompressed) 30 | */ 31 | isCompressed(): boolean; 32 | 33 | /** 34 | * Replaces the contents of an Image. 35 | * 36 | * @param data The new ImageData to replace the contents with. 37 | * @param slice Which slice to replace, if applicable. 38 | * @param mipmap The mimap level of the new ImageData. If 0 Image:replacePixels will generate new mimaps. 39 | * @link [Image:replacePixels](https://love2d.org/wiki/(Image):replacePixels) 40 | */ 41 | replacePixels(data: ImageData, slice: number, mipmap?: number): void; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | TypeScriptToLua + LÖVE 2D 3 |

4 | LÖVE 2D TypeScript Definitions 5 |

6 | LÖVE 2D 7 | npm 8 |

9 |
10 | 11 | Contains declaration files to build [LÖVE 2D](https://love2d.org/) projects with TypeScript! 12 | 13 | Built for use with [TypeScriptToLua](https://github.com/TypeScriptToLua/TypeScriptToLua). Check out [love-typescript-template](https://github.com/hazzard993/love-typescript-template) to get a sample project to build off. 14 | 15 | Or run the following in a terminal to try it out: 16 | 17 | ```sh 18 | # Requires NPX and Love2D to be available via cli 19 | npm init -y 20 | npm install -D typescript-to-lua typescript love-typescript-definitions 21 | echo '{ "compilerOptions": { "target": "ESNext", "lib": ["ESNext"], "moduleResolution": "Node", "types": ["love-typescript-definitions", "@typescript-to-lua/language-extensions"] }, "tstl": { "luaTarget": "JIT" } }' > tsconfig.json 22 | echo "love.draw = () => { love.graphics.print('Hello World') };" > main.ts 23 | npx tstl -p tsconfig.json 24 | love . 25 | ``` 26 | 27 | > TIP: Use _tstl_'s watch mode (`--watch`) if you're after fast and automatic transpilation as files are updated. 28 | 29 | Available on NPM. 30 | 31 | ```sh 32 | npm install love-typescript-definitions 33 | ``` 34 | 35 | ## Other Definitions / Tools to Help 36 | 37 | - [tstl-anim8](https://github.com/maxiy01/tstl-anim8) declarations for anim8, a small animation library for LÖVE. 38 | - [tstl-flux](https://github.com/maxiy01/tstl-flux) declarations for flux, a fast, lightweight tweening library for Lua. 39 | - [tstl-roomy](https://github.com/maxiy01/tstl-roomy) declarations for roomy, a small screen-management lua module. 40 | -------------------------------------------------------------------------------- /typings/love.sound/types/Decoder.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.sound" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * An object which can gradually decode a sound file. 6 | * 7 | * @link [Decoder](https://love2d.org/wiki/Decoder) 8 | */ 9 | interface Decoder extends Type<"Decoder"> { 10 | /** 11 | * Creates a new copy of current decoder. 12 | * 13 | * The new decoder will start decoding from the beginning of the audio stream. 14 | * @returns New copy of the decoder. 15 | * @link [Decoder:clone](https://love2d.org/wiki/Decoder:clone) 16 | */ 17 | clone(): Decoder; 18 | 19 | /** 20 | * Decodes the audio and returns a SoundData object containing the decoded audio data. 21 | * @returns soundData, Decoded audio data. 22 | * @link [Decoder:decode](https://love2d.org/wiki/Decoder:decode) 23 | * @since 11.0 24 | */ 25 | decode(): SoundData; 26 | 27 | /** 28 | * Returns the number of bits per sample. 29 | * 30 | * @return bitDepth, Either 8 or 16. 31 | * @link [Decoder:getBitDepth](https://love2d.org/wiki/Decoder:getBitDepth) 32 | */ 33 | getBitDepth(): number; 34 | 35 | /** 36 | * Returns the number of channels in the stream. 37 | * 38 | * @return channels, 1 for mono, 2 for stereo. 39 | * @link [Decoder:getChannelCount](https://love2d.org/wiki/Decoder:getChannelCount) 40 | */ 41 | getChannelCount(): number; 42 | 43 | /** 44 | * Gets the duration of the sound file. It may not always be sample-accurate, and 45 | * it may return -1 if the duration cannot be determined at all. 46 | * 47 | * @return duration, The duration of the sound file in seconds, or -1 if it cannot be determined. 48 | * @link [Decoder:getDuration](https://love2d.org/wiki/Decoder:getDuration) 49 | */ 50 | getDuration(): number; 51 | 52 | /** 53 | * Returns the sample rate of the Decoder. 54 | * 55 | * @return rate, Number of samples per second. 56 | * @link [Decoder:getSampleRate](https://love2d.org/wiki/Decoder:getSampleRate) 57 | */ 58 | getSampleRate(): number; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /typings/love/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** @noSelf */ 2 | declare module "love" { 3 | /** 4 | * Gets the current running version of LÖVE. 5 | * 6 | * ```ts 7 | * const [major, minor, revision, codename] = love.getVersion(); 8 | * ``` 9 | * 10 | * @returns The major, minor, revision and codename respectively. 11 | * @link [love.getVersion][https://love2d.org/wiki/love.getVersion] 12 | * @link [Version Warnings][https://love2d.org/wiki/Config_Files#version] 13 | */ 14 | function getVersion(): LuaMultiReturn< 15 | [major: number, minor: number, revision: number, codename: string] 16 | >; 17 | 18 | /** 19 | * Sets whether LÖVE displays warnings when using deprecated functionality. 20 | * It is disabled by default in fused mode 21 | * 22 | * This is enabled by default. 23 | * 24 | * [ref]: https://love2d.org/wiki/love.setDeprecationOutput 25 | * @param enable Whether to enable or disable deprecation output. 26 | * @link [love.setDeprecationOutput][ref] 27 | */ 28 | function setDeprecationOutput(enable: boolean): void; 29 | 30 | /** 31 | * Gets whatever the version is compatible with current running version of 32 | * LÖVE. 33 | * 34 | * [ref]: https://love2d.org/wiki/love.isVersionCompatible 35 | * @link [love.isVersionCompatible][ref] 36 | * @returns True if the current version of LÖVE is compatible. 37 | */ 38 | function isVersionCompatible(version: Version): boolean; 39 | function isVersionCompatible( 40 | major: number, 41 | minor: number, 42 | revision: number, 43 | ): boolean; 44 | 45 | /** 46 | * Gets whether LÖVE displays warnings when using deprecated functionality. 47 | * It is disabled by default in fused mode, and enabled by default 48 | * otherwise. 49 | * 50 | * When deprecation output is enabled, the first use of a formally 51 | * deprecated LÖVE API will show a message at the bottom of the screen for a 52 | * short time, and print the message to the console. 53 | * 54 | * [ref]: https://love2d.org/wiki/love.hasDeprecationOutput 55 | * @return enabled, Whether deprecation output is enabled. 56 | * @link [love.hasDeprecationOutput][ref] 57 | */ 58 | function hasDeprecationOutput(): boolean; 59 | } 60 | -------------------------------------------------------------------------------- /typings/love.thread/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Allows you to work with threads. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.thread](https://love2d.org/wiki/love.thread) 7 | */ 8 | declare module "love.thread" { 9 | import { FileData } from "love.filesystem"; 10 | 11 | /** 12 | * Creates or retrieves a named thread channel. 13 | * 14 | * @param name The name of the channel you want to create or retrieve. 15 | * @return channel, A named channel object which can be further manipulated. 16 | * @link [love.thread.getChannel](https://love2d.org/wiki/love.thread.getChannel) 17 | */ 18 | function getChannel(name: string): Channel; 19 | 20 | /** 21 | * Create a new unnamed thread channel. 22 | * 23 | * One use for them is to pass new unnamed channels to other threads via 24 | * Channel:push 25 | * 26 | * @return channel, A unnamed channel object which can be further manipulated. 27 | * @link [love.thread.newChannel](https://love2d.org/wiki/love.thread.newChannel) 28 | */ 29 | function newChannel(): Channel; 30 | 31 | /** 32 | * Creates a new Thread from a filename, string or FileData object containing Lua code. 33 | * 34 | * @param filename The name of the Lua File to use as source. 35 | * @return thread, A new Thread that has yet to be started. 36 | * @link [love.thread.newThread](https://love2d.org/wiki/love.thread.newThread) 37 | */ 38 | function newThread(filename: string): Thread; 39 | 40 | /** 41 | * Creates a new Thread from a File or Data object. 42 | * 43 | * @param fileData The FileData containing the Lua code to use as the source. 44 | * @return thread, A new Thread that has yet to be started. 45 | * @link [love.thread.newThread](https://love2d.org/wiki/love.thread.newThread) 46 | */ 47 | function newThread(fileData: FileData): Thread; 48 | 49 | /** 50 | * Creates a new Thread from a File or Data object. 51 | * 52 | * @param codestring 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. 53 | * @return thread, A new Thread that has yet to be started. 54 | * @link [love.thread.newThread](https://love2d.org/wiki/love.thread.newThread) 55 | */ 56 | function newThread(codestring: string): Thread; 57 | } 58 | -------------------------------------------------------------------------------- /typings/love.font/types/Rasterizer.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.font" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * A Rasterizer handles font rendering, containing the font data (image or TrueType font) and drawable glyphs. 6 | * 7 | * @link [Rasterizer](https://love2d.org/wiki/Rasterizer) 8 | * @since 0.7.0 9 | */ 10 | interface Rasterizer extends Type<"Rasterizer"> { 11 | /** 12 | * Gets font advance. 13 | * 14 | * @link [Rasterizer:getAdvance](https://love2d.org/wiki/Rasterizer:getAdvance) 15 | * @since 0.7.0 16 | */ 17 | getAdvance(): number; 18 | 19 | /** 20 | * Gets ascent height. 21 | * 22 | * @link [Rasterizer:getAscent](https://love2d.org/wiki/Rasterizer:getAscent) 23 | * @since 0.7.0 24 | */ 25 | getAscent(): number; 26 | 27 | /** 28 | * Gets descent height. 29 | * 30 | * @link [Rasterizer:getDescent](https://love2d.org/wiki/Rasterizer:getDescent) 31 | * @since 0.7.0 32 | */ 33 | getDescent(): number; 34 | 35 | /** 36 | * Gets number of glyphs in font. 37 | * 38 | * @link [Rasterizer:getGlyphCount](https://love2d.org/wiki/Rasterizer:getGlyphCount) 39 | * @since 0.7.0 40 | */ 41 | getGlyphCount(): number; 42 | 43 | /** 44 | * Gets glyph data of a specified glyph. 45 | * 46 | * @param glyph Glyph 47 | * @returns Glyph data 48 | * @link [Rasterizer:getGlyphData](https://love2d.org/wiki/Rasterizer:getGlyphData) 49 | * @since 0.7.0 50 | */ 51 | getGlyphData(glyph: string): GlyphData; 52 | 53 | /** 54 | * Gets font height. 55 | * 56 | * @link [Rasterizer:getHeight](https://love2d.org/wiki/Rasterizer:getHeight) 57 | * @since 0.7.0 58 | */ 59 | getHeight(): number; 60 | 61 | /** 62 | * Gets line height of a font. 63 | * 64 | * @link [Rasterizer:getHeight](https://love2d.org/wiki/Rasterizer:getHeight) 65 | * @since 0.7.0 66 | */ 67 | getLineHeight(): number; 68 | 69 | /** 70 | * Checks if font contains specified glyphs. 71 | * 72 | * @param glyphs Glyphs to check for. 73 | * @returns true if the rasterizer contains all the specified Glyphs. 74 | * @since 0.7.0 75 | */ 76 | hasGlyphs(...glyphs: Array): boolean; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /typings/love.event/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Manages events, like keypresses. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.event](https://love2d.org/wiki/love.event) 7 | * @since 0.6.0 8 | */ 9 | declare module "love.event" { 10 | /** 11 | * Clears the event queue. 12 | * @link [love.event.clear](https://love2d.org/wiki/love.event.clear) 13 | * @since 0.7.2 14 | */ 15 | function clear(): void; 16 | 17 | /** 18 | * Returns an iterator for messages in the event queue. 19 | * 20 | * @return i, Iterator function usable in a for loop. 21 | * @link [love.event.poll](https://love2d.org/wiki/love.event.poll) 22 | * @since 0.6.0 23 | */ 24 | function poll(): LuaIterable>; 25 | 26 | /** 27 | * Pump events into the event queue. 28 | * @link [love.event.pump](https://love2d.org/wiki/love.event.pump) 29 | * @since 0.6.0 30 | */ 31 | function pump(): void; 32 | 33 | /** 34 | * Adds an event to the event queue. 35 | * @param args Arguments to follow. 36 | * @link [love.event.push](https://love2d.org/wiki/love.event.push) 37 | * @since 0.6.0 38 | */ 39 | function push( 40 | e: E, 41 | ...args: Parameters[E]> 42 | ): void; 43 | 44 | /** 45 | * Adds the quit event to the queue. 46 | * @param exitstatus The program exit status to use when closing the application. (Default `0`) 47 | * @link [love.event.quit](https://love2d.org/wiki/love.event.quit) 48 | * @since 0.8.0 49 | */ 50 | function quit(exitstatus?: number): void; 51 | 52 | /** 53 | * Adds the quit event to the queue. 54 | * @param restart Restarts the game without relaunching the executable. 55 | * 56 | * This cleanly shuts down the main Lua state instance and creates a brand new one. 57 | * @link [love.event.quit](https://love2d.org/wiki/love.event.quit) 58 | * @since 0.8.0 59 | */ 60 | function quit(restartstr: "restart"): void; 61 | 62 | /** 63 | * Like [love.event.poll](https://love2d.org/wiki/love.event.poll) but blocks until there is an event in the queue. 64 | * @return e, The type of event. 65 | * @return args, The arguments given to the event. 66 | * @link [love.event.wait](https://love2d.org/wiki/love.event.wait) 67 | * @since 0.6.0 68 | */ 69 | function wait(): LuaMultiReturn<[evt: string, ...args: Array]>; 70 | } 71 | -------------------------------------------------------------------------------- /typings/love.physics/types/MouseJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * For controlling objects with the mouse. 4 | * @link [MouseJoint](https://love2d.org/wiki/MouseJoint) 5 | */ 6 | interface MouseJoint extends Joint<"MouseJoint"> { 7 | /** 8 | * Returns the damping ratio. 9 | * 10 | * @return ratio, The new damping ratio. 11 | * @link [MouseJoint:getDampingRatio](https://love2d.org/wiki/MouseJoint:getDampingRatio) 12 | */ 13 | getDampingRatio(): number; 14 | 15 | /** 16 | * Returns the frequency. 17 | * 18 | * @return freq, The frequency in hertz. 19 | * @link [MouseJoint:getFrequency](https://love2d.org/wiki/MouseJoint:getFrequency) 20 | */ 21 | getFrequency(): number; 22 | 23 | /** 24 | * Gets the highest allowed force. 25 | * 26 | * @return f, The max allowed force. 27 | * @link [MouseJoint:getMaxForce](https://love2d.org/wiki/MouseJoint:getMaxForce) 28 | */ 29 | getMaxForce(): number; 30 | 31 | /** 32 | * Gets the target point. 33 | * 34 | * @return x, The x component of the target. 35 | * @return y, The x component of the target. 36 | * @link [MouseJoint:getTarget](https://love2d.org/wiki/MouseJoint:getTarget) 37 | */ 38 | getTarget(): LuaMultiReturn<[x: number, y: number]>; 39 | 40 | /** 41 | * Sets a new damping ratio. 42 | * 43 | * @param ratio The new damping ratio. 44 | * @link [MouseJoint:setDampingRatio](https://love2d.org/wiki/MouseJoint:setDampingRatio) 45 | */ 46 | setDampingRatio(ratio: number): void; 47 | 48 | /** 49 | * Sets a new frequency. 50 | * 51 | * @param freq The new frequency in hertz. 52 | * @link [MouseJoint:setFrequency](https://love2d.org/wiki/MouseJoint:setFrequency) 53 | */ 54 | setFrequency(freq: number): void; 55 | 56 | /** 57 | * Sets the highest allowed force. 58 | * 59 | * @param f The max allowed force. 60 | * @link [MouseJoint:setMaxForce](https://love2d.org/wiki/MouseJoint:setMaxForce) 61 | */ 62 | setMaxForce(f: number): void; 63 | 64 | /** 65 | * Sets the target point. 66 | * 67 | * @param x The x component of the target. 68 | * @param y The y component of the target. 69 | * @link [MouseJoint:setTarget](https://love2d.org/wiki/MouseJoint:setTarget) 70 | */ 71 | setTarget(x: number, y: number): void; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /typings/love.graphics/enums/CompareMode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | /** 3 | * Different types of per-pixel stencil test and depth test comparisons. 4 | * 5 | * The pixels of an object will be drawn if the comparison succeeds, for 6 | * each pixel that the object touches. 7 | * 8 | * *equal* 9 | * - stencil tests: the stencil value of the pixel must be equal to the 10 | * supplied value. 11 | * - depth tests: the depth value of the drawn object at that pixel must be 12 | * equal to the existing depth value of that pixel. 13 | * 14 | * *notequal* 15 | * - stencil tests: the stencil value of the pixel must not be equal to the 16 | * supplied value. 17 | * - depth tests: the depth value of the drawn object at that pixel must not 18 | * be equal to the existing depth value of that pixel. 19 | * 20 | * *less* 21 | * - stencil tests: the stencil value of the pixel must be less than the 22 | * supplied value. 23 | * - depth tests: the depth value of the drawn object at that pixel must be 24 | * less than the existing depth value of that pixel. 25 | * 26 | * *lequal* 27 | * - stencil tests: the stencil value of the pixel must be less than or 28 | * equal to the supplied value. 29 | * - depth tests: the depth value of the drawn object at that pixel must be 30 | * less than or equal to the existing depth value of that pixel. 31 | * 32 | * *gequal* 33 | * - stencil tests: the stencil value of the pixel must be greater than or 34 | * equal to the supplied value. 35 | * - depth tests: the depth value of the drawn object at that pixel must be 36 | * greater than or equal to the existing depth value of that pixel. 37 | * 38 | * *greater* 39 | * - stencil tests: the stencil value of the pixel must be greater than the 40 | * supplied value. 41 | * - depth tests: the depth value of the drawn object at that pixel must be 42 | * greater than the existing depth value of that pixel. 43 | * 44 | * *never* 45 | * - Objects will never be drawn. 46 | * 47 | * *always* 48 | * - Objects will always be drawn. Effectively disables the depth or stencil 49 | * test. 50 | * 51 | * @link [CompareMode](https://love2d.org/wiki/CompareMode) 52 | * @since 0.10.0 53 | */ 54 | type CompareMode = 55 | | "equal" 56 | | "notequal" 57 | | "less" 58 | | "lequal" 59 | | "gequal" 60 | | "greater" 61 | | "never" 62 | | "always"; 63 | } 64 | -------------------------------------------------------------------------------- /typings/love.sound/types/SoundData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.sound" { 2 | import { Data } from "love.data"; 3 | 4 | /** 5 | * Contains raw audio samples. You can not play SoundData back directly. You must wrap a Source object around it. 6 | * 7 | * @link [SoundData](https://love2d.org/wiki/SoundData) 8 | */ 9 | interface SoundData extends Data<"SoundData"> { 10 | /** 11 | * Returns the number of bits per sample. 12 | * 13 | * @return bits, Either 8 or 16. 14 | * @link [SoundData:getBitDepth](https://love2d.org/wiki/SoundData:getBitDepth) 15 | */ 16 | getBitDepth(): number; 17 | 18 | /** 19 | * Returns the number of channels in the stream. 20 | * 21 | * @return channels, 1 for mono, 2 for stereo. 22 | * @link [SoundData:getChannelCount](https://love2d.org/wiki/SoundData:getChannelCount) 23 | */ 24 | getChannelCount(): number; 25 | 26 | /** 27 | * Gets the duration of the sound data. 28 | * 29 | * @return duration, The duration of the sound data in seconds. 30 | * @link [SoundData:getDuration](https://love2d.org/wiki/SoundData:getDuration) 31 | */ 32 | getDuration(): number; 33 | 34 | /** 35 | * Gets the sample at the specified position. 36 | * 37 | * @param i An integer value specifying the position of the sample (0 points to the first sample). 38 | * @return sample, The normalized sample (range -1.0 to 1.0). 39 | * @link [SoundData:getSample](https://love2d.org/wiki/SoundData:getSample) 40 | */ 41 | getSample(i: number): number; 42 | 43 | /** 44 | * Returns the number of samples per channel of the SoundData. 45 | * 46 | * @return count, Total number of samples. 47 | * @link [SoundData:getSampleCount](https://love2d.org/wiki/SoundData:getSampleCount) 48 | */ 49 | getSampleCount(): number; 50 | 51 | /** 52 | * Returns the sample rate of the SoundData. 53 | * 54 | * @return rate, Number of samples per second. 55 | * @link [SoundData:getSampleRate](https://love2d.org/wiki/SoundData:getSampleRate) 56 | */ 57 | getSampleRate(): number; 58 | 59 | /** 60 | * Sets the sample at the specified position. 61 | * 62 | * @param i The position of the sample (0 means first sample). 63 | * @param sample A normalized sample (range -1.0 to 1.0). 64 | * @link [SoundData:setSample](https://love2d.org/wiki/SoundData:setSample) 65 | */ 66 | setSample(i: number, sample: number): void; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /typings/love.graphics/structs/DisplayFlags.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { FullscreenType } from "love.window"; 3 | 4 | /** 5 | * @link [love.window.setMode](https://love2d.org/wiki/love.window.setMode) 6 | */ 7 | type DisplayFlags = { 8 | /** 9 | * Fullscreen (true), or windowed (false). (Default: false) 10 | */ 11 | fullscreen?: boolean; 12 | /** 13 | * 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") 14 | */ 15 | fullscreentype?: FullscreenType; 16 | /** 17 | * Enable automatic DPI scaling. (Default: true) 18 | */ 19 | usedpiscale?: boolean; 20 | /** 21 | * True if LÖVE should wait for vsync, false otherwise. (Default: true) 22 | */ 23 | vsync?: boolean; 24 | /** 25 | * The number of antialiasing samples. (Default: 0) 26 | */ 27 | msaa?: number; 28 | /** 29 | * Whether a stencil buffer should be allocated. If true, the stencil buffer will have 8 bits. (Default: true) 30 | */ 31 | stencil?: boolean; 32 | /** 33 | * The number of bits in the depth buffer. (Default: 0) 34 | */ 35 | depth?: number; 36 | /** 37 | * True if the window should be resizable in windowed mode, false otherwise. (Default: false) 38 | */ 39 | resizable?: boolean; 40 | /** 41 | * True if the window should be borderless in windowed mode, false otherwise. (Default: false) 42 | */ 43 | borderless?: boolean; 44 | /** 45 | * True if the window should be centered in windowed mode, false otherwise. (Default: false) 46 | */ 47 | centered?: boolean; 48 | /** 49 | * The index of the display to show the window in, if multiple monitors are available. (Default: 1) 50 | */ 51 | display?: number; 52 | /** 53 | * The minimum width of the window, if it's resizable. Cannot be less than 1. (Default: 1) 54 | */ 55 | minwidth?: number; 56 | /** 57 | * The minimum height of the window, if it's resizable. Cannot be less than 1. (Default: 1) 58 | */ 59 | minheight?: number; 60 | /** 61 | * True if high-dpi mode should be used on Retina displays in macOS and iOS. Does nothing on non-Retina displays. (Default: false) 62 | */ 63 | highdpi?: boolean; 64 | /** 65 | * The x-coordinate of the window's position in the specified display. (Default: undefined) 66 | */ 67 | x?: number; 68 | /** 69 | * The y-coordinate of the window's position in the specified display. (Default: undefined) 70 | */ 71 | y?: number; 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /typings/love.font/types/GlyphData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.font" { 2 | import { Data } from "love.data"; 3 | import { PixelFormat } from "love.image"; 4 | 5 | /** 6 | * A GlyphData represents a drawable symbol of a font Rasterizer. 7 | * 8 | * @link [GlyphData](https://love2d.org/wiki/GlyphData) 9 | */ 10 | interface GlyphData extends Data<"GlyphData"> { 11 | /** 12 | * Gets glyph advance. 13 | * 14 | * @link [GlyphData:getAdvance](https://love2d.org/wiki/GlyphData:getAdvance) 15 | * @since 0.7.0 16 | */ 17 | getAdvance(): number; 18 | 19 | /** 20 | * Gets glyph bearing. 21 | * 22 | * @returns The glyph bearing X and Y respectively. 23 | * @link [GlyphData:getBearing](https://love2d.org/wiki/GlyphData:getBearing) 24 | * @since 0.7.0 25 | */ 26 | getBearing(): LuaMultiReturn<[bx: number, by: number]>; 27 | 28 | /** 29 | * Gets glyph bounding box. 30 | * 31 | * @returns The X, Y, width and height of the glyph bounding box respectively. 32 | * @link [GlyphData:getBoundingBox](https://love2d.org/wiki/GlyphData:getBoundingBox) 33 | * @since 0.7.0 34 | */ 35 | getBoundingBox(): LuaMultiReturn< 36 | [x: number, y: number, width: number, height: number] 37 | >; 38 | 39 | /** 40 | * Gets glyph dimensions. 41 | * 42 | * @returns The width and height of the glyph respectively. 43 | * @link [GlyphData:getDimensions](https://love2d.org/wiki/GlyphData:getDimensions) 44 | * @since 0.7.0 45 | */ 46 | getDimensions(): LuaMultiReturn<[width: number, height: number]>; 47 | 48 | /** 49 | * Gets glyph pixel format. 50 | * 51 | * @link [GlyphData:getFormat](https://love2d.org/wiki/GlyphData:getFormat) 52 | * @since 11.0 53 | */ 54 | getFormat(): PixelFormat; 55 | 56 | /** 57 | * Gets glyph number. 58 | * 59 | * @link [GlyphData:getGlyph](https://love2d.org/wiki/GlyphData:getGlyph) 60 | * @since 0.7.0 61 | */ 62 | getGlyph(): number; 63 | 64 | /** 65 | * Gets glyph string. 66 | * 67 | * @link [GlyphData:getGlyphString](https://love2d.org/wiki/GlyphData:getGlyphString) 68 | * @since 0.7.0 69 | */ 70 | getGlyphString(): string; 71 | 72 | /** 73 | * Gets glyph height. 74 | * 75 | * @link [GlyphData:getHeight](https://love2d.org/wiki/GlyphData:getHeight) 76 | * @since 0.7.0 77 | */ 78 | getHeight(): number; 79 | 80 | /** 81 | * Gets glyph width. 82 | * 83 | * @link [GlyphData:getHeight](https://love2d.org/wiki/GlyphData:getHeight) 84 | * @since 0.7.0 85 | */ 86 | getWidth(): number; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /typings/love.keyboard/enums/KeyConstant.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.keyboard" { 2 | /** 3 | * All the keys you can press. Note that some keys may not be available on your 4 | * keyboard or system. 5 | * @link [KeyConstant](https://love2d.org/wiki/KeyConstant) 6 | */ 7 | type KeyConstant = 8 | | "a" 9 | | "b" 10 | | "c" 11 | | "d" 12 | | "e" 13 | | "f" 14 | | "g" 15 | | "h" 16 | | "i" 17 | | "j" 18 | | "k" 19 | | "l" 20 | | "m" 21 | | "n" 22 | | "o" 23 | | "p" 24 | | "q" 25 | | "r" 26 | | "s" 27 | | "t" 28 | | "u" 29 | | "v" 30 | | "w" 31 | | "x" 32 | | "y" 33 | | "z" 34 | | "0" 35 | | "1" 36 | | "2" 37 | | "3" 38 | | "4" 39 | | "5" 40 | | "6" 41 | | "7" 42 | | "8" 43 | | "9" 44 | | "space" 45 | | "!" 46 | | '"' 47 | | "#" 48 | | "$" 49 | | "&" 50 | | "'" 51 | | "(" 52 | | ")" 53 | | "*" 54 | | "+" 55 | | "," 56 | | "-" 57 | | "." 58 | | "/" 59 | | ":" 60 | | ";" 61 | | "<" 62 | | "=" 63 | | ">" 64 | | "?" 65 | | "@" 66 | | "[" 67 | | "\\" 68 | | "]" 69 | | "^" 70 | | "_" 71 | | "`" 72 | | "kp0" 73 | | "kp1" 74 | | "kp2" 75 | | "kp3" 76 | | "kp4" 77 | | "kp5" 78 | | "kp6" 79 | | "kp7" 80 | | "kp8" 81 | | "kp9" 82 | | "kp." 83 | | "kp/" 84 | | "kp*" 85 | | "kp-" 86 | | "kp+" 87 | | "kpenter" 88 | | "kp=" 89 | | "up" 90 | | "down" 91 | | "right" 92 | | "left" 93 | | "home" 94 | | "end" 95 | | "pageup" 96 | | "pagedown" 97 | | "insert" 98 | | "backspace" 99 | | "tab" 100 | | "clear" 101 | | "return" 102 | | "delete" 103 | | "f1" 104 | | "f2" 105 | | "f3" 106 | | "f4" 107 | | "f5" 108 | | "f6" 109 | | "f7" 110 | | "f8" 111 | | "f9" 112 | | "f10" 113 | | "f11" 114 | | "f12" 115 | | "f13" 116 | | "f14" 117 | | "f15" 118 | | "numlock" 119 | | "capslock" 120 | | "scrollock" 121 | | "rshift" 122 | | "lshift" 123 | | "rctrl" 124 | | "lctrl" 125 | | "ralt" 126 | | "lalt" 127 | | "rmeta" 128 | | "lmeta" 129 | | "lsuper" 130 | | "rsuper" 131 | | "mode" 132 | | "compose" 133 | | "pause" 134 | | "escape" 135 | | "help" 136 | | "print" 137 | | "sysreq" 138 | | "break" 139 | | "menu" 140 | | "power" 141 | | "euro" 142 | | "undo" 143 | | "www" 144 | | "mail" 145 | | "calculator" 146 | | "appsearch" 147 | | "apphome" 148 | | "appback" 149 | | "appforward" 150 | | "apprefresh" 151 | | "appbookmarks"; 152 | } 153 | -------------------------------------------------------------------------------- /typings/love.graphics/types/Canvas.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { ImageData } from "love.image"; 3 | 4 | /** 5 | * A Canvas is used for off-screen rendering. 6 | * 7 | * @link [Canvas](https://love2d.org/wiki/Canvas) 8 | * @since 0.8.0 9 | */ 10 | interface Canvas extends Texture<"Canvas"> { 11 | /** 12 | * Generates mipmaps for the Canvas, based on the contents of the highest-resolution mipmap level. 13 | * 14 | * @link [Canvas:generateMipmaps](https://love2d.org/wiki/Canvas:generateMipmaps) 15 | * @since 11.0 16 | */ 17 | generateMipmaps(): void; 18 | 19 | /** 20 | * Gets the number of multisample antialiasing (MSAA) samples used when drawing to the Canvas. 21 | * 22 | * @return samples, The number of multisample antialiasing samples used by the canvas when drawing to it. 23 | * @link [Canvas:getMSAA](https://love2d.org/wiki/Canvas:getMSAA) 24 | * @since 0.9.2 25 | */ 26 | getMSAA(): number; 27 | 28 | /** 29 | * Gets the MipmapMode this Canvas was created with. 30 | * 31 | * @return mode, The mipmap mode this Canvas was created with. 32 | * @link [Canvas:getMipmapMode](https://love2d.org/wiki/Canvas:getMipmapMode) 33 | * @since 11.0 34 | */ 35 | getMipmapMode(): MipmapMode; 36 | 37 | /** 38 | * Generates ImageData from the contents of the Canvas. 39 | * 40 | * @return data, The image data stored in the Canvas. 41 | * @link [Canvas:newImageData](https://love2d.org/wiki/Canvas:newImageData) 42 | * @since 0.10.0 43 | */ 44 | newImageData(): ImageData; 45 | 46 | /** 47 | * Generates ImageData from the contents of the Canvas. 48 | * 49 | * @param slice 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. 50 | * @param mipmap The mipmap index to use, for Canvases with mipmaps. (Default 1) 51 | * @param x The x-axis of the top-left corner (in pixels) of the area within the Canvas to capture. 52 | * @param y The y-axis of the top-left corner (in pixels) of the area within the Canvas to capture. 53 | * @param width The width in pixels of the area within the Canvas to capture. 54 | * @param height The height in pixels of the area within the Canvas to capture. 55 | * @return data, The new ImageData made from the Canvas' contents. 56 | * @since 11.0 57 | */ 58 | newImageData( 59 | slice: number, 60 | mipmap: number | undefined, 61 | x: number, 62 | y: number, 63 | width: number, 64 | height: number, 65 | ): ImageData; 66 | 67 | /** 68 | * Render to the Canvas using a function. 69 | * 70 | * @param func A function performing drawing operations. 71 | * @link [Canvas:renderTo](https://love2d.org/wiki/Canvas:renderTo) 72 | * @since 0.8.0 73 | */ 74 | renderTo(func: (this: void) => void): void; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /typings/love.graphics/types/Shader.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * A Shader is used for advanced hardware-accelerated pixel or vertex manipulation. 6 | * @typeparam U An object that contains all uniform variables within this shader associated with a value that can be provided to it. 7 | * @link [Shader](https://love2d.org/wiki/Shader) 8 | */ 9 | interface Shader< 10 | U extends { [key: string]: any } | undefined = undefined, 11 | > extends Type<"Shader"> { 12 | /** 13 | * Returns any warning and error messages from compiling the shader code. This can 14 | * be used for debugging your shaders if there's anything the graphics hardware 15 | * doesn't like. 16 | * 17 | * @return warnings, Warning messages (if any). 18 | * @link [Shader:getWarnings](https://love2d.org/wiki/Shader:getWarnings) 19 | */ 20 | getWarnings(): string; 21 | 22 | /** 23 | * Gets whether a uniform / extern variable exists in the Shader. 24 | * 25 | * If a graphics driver's shader compiler determines that a uniform / extern 26 | * variable doesn't affect the final output of the shader, it may optimize the 27 | * variable out. This function will return false in that case. 28 | * 29 | * @param name The name of the uniform variable. 30 | * @return hasuniform, Whether the uniform exists in the shader and affects its final output. 31 | * @link [Shader:hasUniform](https://love2d.org/wiki/Shader:hasUniform) 32 | */ 33 | hasUniform(name: U extends undefined ? string : keyof U): boolean; 34 | 35 | /** 36 | * Sends one or more values to a special (uniform) variable inside the shader. 37 | * 38 | * Uniform variables have to be marked using the _uniform_ or _extern_ keyword. 39 | * 40 | * @param name The name of the uniform / extern variable to send the value(s) to. 41 | * @param number Number to send to store in the uniform variable. 42 | * @param ... Additional numbers to send if the uniform variable is an array. 43 | * @link [Shader:send](https://love2d.org/wiki/Shader:send) 44 | */ 45 | send( 46 | name: U extends undefined ? string : N, 47 | ...values: U extends undefined ? Array : U[N] 48 | ): void; 49 | 50 | /** 51 | * Sends one or more colors to a special (extern / uniform) vec3 or vec4 variable 52 | * inside the shader. The color components must be in the range of [0, 255], 53 | * unlike Shader:send. The colors are gamma-corrected if global gamma-correction 54 | * is enabled. 55 | * 56 | * @param name The name of the color extern variable to send to in the shader. 57 | * @param colors A table with `[red, green, blue, and optional alpha color]` components in the range of `[0, 1]` to send to the extern as a vector. 58 | * @link [Shader:sendColor](https://love2d.org/wiki/Shader:sendColor) 59 | */ 60 | sendColor( 61 | name: U extends undefined ? string : N, 62 | ...colors: Array<[number, number, number, number?]> 63 | ): void; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /typings/love/types/Types.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love" { 2 | import { RecordingDevice, Source } from "love.audio"; 3 | import { ByteData, CompressedData, Data } from "love.data"; 4 | import { File, FileData } from "love.filesystem"; 5 | import { GlyphData, Rasterizer } from "love.font"; 6 | import { 7 | Canvas, 8 | Drawable, 9 | Font, 10 | Image, 11 | Mesh, 12 | ParticleSystem, 13 | Quad, 14 | Shader, 15 | SpriteBatch, 16 | Text, 17 | Texture, 18 | Video, 19 | } from "love.graphics"; 20 | import { ImageData, CompressedImageData } from "love.image"; 21 | import { Joystick } from "love.joystick"; 22 | import { BezierCurve, RandomGenerator, Transform } from "love.math"; 23 | import { Cursor } from "love.mouse"; 24 | import { 25 | Body, 26 | ChainShape, 27 | CircleShape, 28 | Contact, 29 | DistanceJoint, 30 | EdgeShape, 31 | Fixture, 32 | FrictionJoint, 33 | GearJoint, 34 | Joint, 35 | MotorJoint, 36 | MouseJoint, 37 | PolygonShape, 38 | PrismaticJoint, 39 | PulleyJoint, 40 | RevoluteJoint, 41 | RopeJoint, 42 | Shape, 43 | WeldJoint, 44 | WheelJoint, 45 | World, 46 | } from "love.physics"; 47 | import { Decoder, SoundData } from "love.sound"; 48 | import { Channel, Thread } from "love.thread"; 49 | import { VideoStream } from "love.video"; 50 | 51 | type Types = { 52 | Object: Type; 53 | RecordingDevice: RecordingDevice; 54 | Source: Source; 55 | ByteData: ByteData; 56 | Data: Data; 57 | File: File; 58 | FileData: FileData; 59 | Font: Font; 60 | GlyphData: GlyphData; 61 | Rasterizer: Rasterizer; 62 | Canvas: Canvas; 63 | Drawable: Drawable; 64 | Image: Image; 65 | Mesh: Mesh; 66 | ParticleSystem: ParticleSystem; 67 | Quad: Quad; 68 | Shader: Shader; 69 | SpriteBatch: SpriteBatch; 70 | Text: Text; 71 | Texture: Texture; 72 | Video: Video; 73 | CompressedImageData: CompressedImageData; 74 | ImageData: ImageData; 75 | Joystick: Joystick; 76 | BezierCurve: BezierCurve; 77 | CompressedData: CompressedData; 78 | RandomGenerator: RandomGenerator; 79 | Transform: Transform; 80 | Cursor: Cursor; 81 | Body: Body; 82 | ChainShape: ChainShape; 83 | CircleShape: CircleShape; 84 | Contact: Contact; 85 | DistanceJoint: DistanceJoint; 86 | EdgeShape: EdgeShape; 87 | Fixture: Fixture; 88 | FrictionJoint: FrictionJoint; 89 | GearJoint: GearJoint; 90 | Joint: Joint; 91 | MotorJoint: MotorJoint; 92 | MouseJoint: MouseJoint; 93 | PolygonShape: PolygonShape; 94 | PrismaticJoint: PrismaticJoint; 95 | PulleyJoint: PulleyJoint; 96 | RevoluteJoint: RevoluteJoint; 97 | RopeJoint: RopeJoint; 98 | Shape: Shape; 99 | WeldJoint: WeldJoint; 100 | WheelJoint: WheelJoint; 101 | World: World; 102 | Decoder: Decoder; 103 | SoundData: SoundData; 104 | Channel: Channel; 105 | Thread: Thread; 106 | VideoStream: VideoStream; 107 | }; 108 | } 109 | -------------------------------------------------------------------------------- /typings/love.physics/types/EdgeShape.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * A EdgeShape is a line segment. 4 | * 5 | * They can be used to create the boundaries of your terrain. 6 | * 7 | * The shape does not have volume and can only collide with PolygonShape and CircleShape. 8 | * @link [EdgeShape](https://love2d.org/wiki/EdgeShape) 9 | */ 10 | interface EdgeShape extends Shape<"EdgeShape"> { 11 | /** 12 | * Returns the local coordinates of the edge points. 13 | * 14 | * @return x1, The x component of the first vertex. 15 | * @return y1, The y component of the first vertex. 16 | * @return x2, The x component of the second vertex. 17 | * @return y2, The y component of the second vertex. 18 | * @link [EdgeShape:getPoints](https://love2d.org/wiki/EdgeShape:getPoints) 19 | */ 20 | getPoints(): LuaMultiReturn< 21 | [x1: number, y1: number, x2: number, y2: number] 22 | >; 23 | 24 | /** 25 | * Gets the vertex that establishes a connection to the next shape. 26 | * 27 | * Setting next and previous EdgeShape vertices can help prevent unwanted 28 | * collisions when a flat shape slides along the edge and moves over to the new 29 | * shape. 30 | * 31 | * @return x, The x-component of the vertex, or _nil/undefined_ if EdgeShape:setNextVertex hasn't been called. 32 | * @return y, The y-component of the vertex, or _nil/undefined_ if EdgeShape:setNextVertex hasn't been called. 33 | * @link [EdgeShape:getNextVertex](https://love2d.org/wiki/EdgeShape:getNextVertex) 34 | */ 35 | getNextVertex(): LuaMultiReturn<[x: number, y: number] | []>; 36 | 37 | /** 38 | * Gets the vertex that establishes a connection to the previous shape. 39 | * 40 | * Setting next and previous EdgeShape vertices can help prevent unwanted 41 | * collisions when a flat shape slides along the edge and moves over to the new 42 | * shape. 43 | * 44 | * @return x, The x-component of the vertex, or _nil/undefined_ if EdgeShape:setPreviousVertex hasn't been called. 45 | * @return y, The y-component of the vertex, or _nil/undefined_ if EdgeShape:setPreviousVertex hasn't been called. 46 | * @link [EdgeShape:getPreviousVertex](https://love2d.org/wiki/EdgeShape:getPreviousVertex) 47 | */ 48 | getPreviousVertex(): LuaMultiReturn<[x: number, y: number] | []>; 49 | 50 | /** 51 | * Sets a vertex that establishes a connection to the next shape. 52 | * 53 | * This can help prevent unwanted collisions when a flat shape slides along the 54 | * edge and moves over to the new shape. 55 | * 56 | * @param x The x-component of the vertex. 57 | * @param y The y-component of the vertex. 58 | * @link [EdgeShape:setNextVertex](https://love2d.org/wiki/EdgeShape:setNextVertex) 59 | */ 60 | setNextVertex(x: number, y: number): void; 61 | 62 | /** 63 | * Sets a vertex that establishes a connection to the previous shape. 64 | * 65 | * This can help prevent unwanted collisions when a flat shape slides along the 66 | * edge and moves over to the new shape. 67 | * 68 | * @param x The x-component of the vertex. 69 | * @param y The y-component of the vertex. 70 | * @link [EdgeShape:setPreviousVertex](https://love2d.org/wiki/EdgeShape:setPreviousVertex) 71 | */ 72 | setPreviousVertex(x: number, y: number): void; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /typings/love.image/types/CompressedImageData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.image" { 2 | import { Data } from "love.data"; 3 | 4 | /** 5 | * @link [CompressedImageData](https://love2d.org/wiki/CompressedImageData) 6 | */ 7 | interface CompressedImageData extends Data<"CompressedImageData"> { 8 | /** 9 | * Gets the width and height of the CompressedImageData. 10 | * 11 | * @return width, The width of the CompressedImageData. 12 | * @return height, The height of the CompressedImageData. 13 | * @link [CompressedImageData:getDimensions](https://love2d.org/wiki/CompressedImageData:getDimensions) 14 | * @since 0.9.0 15 | */ 16 | getDimensions(): LuaMultiReturn<[width: number, height: number]>; 17 | 18 | /** 19 | * Gets the width and height of the CompressedImageData. 20 | * 21 | * @param level A mipmap level. Must be in the range of [1, CompressedImageData:getMipmapCount()]. 22 | * @return width, The width of the CompressedImageData. 23 | * @return height, The height of the CompressedImageData. 24 | * @link [CompressedImageData:getDimensions](https://love2d.org/wiki/CompressedImageData:getDimensions) 25 | * @since 0.9.0 26 | */ 27 | getDimensions( 28 | level: number, 29 | ): LuaMultiReturn<[width: number, height: number]>; 30 | 31 | /** 32 | * Gets the format of the CompressedImageData. 33 | * 34 | * @return format, The format of the CompressedImageData. 35 | * @link [CompressedImageData:getFormat](https://love2d.org/wiki/CompressedImageData:getFormat) 36 | * @since 0.9.0 37 | */ 38 | getFormat(): CompressedImageFormat; 39 | 40 | /** 41 | * Gets the height of the CompressedImageData. 42 | * 43 | * @return height, The height of the CompressedImageData. 44 | * @link [CompressedImageData:getHeight](https://love2d.org/wiki/CompressedImageData:getHeight) 45 | * @since 0.9.0 46 | */ 47 | getHeight(): number; 48 | 49 | /** 50 | * Gets the height of the CompressedImageData. 51 | * 52 | * @param level A mipmap level. Must be in the range of [1, CompressedImageData:getMipmapCount()]. 53 | * @return height, The height of the CompressedImageData. 54 | * @link [CompressedImageData:getHeight](https://love2d.org/wiki/CompressedImageData:getHeight) 55 | * @since 0.9.0 56 | */ 57 | getHeight(level: number): number; 58 | 59 | /** 60 | * Gets the number of mipmap levels in the CompressedImageData. The base mipmap 61 | * level (original image) is included in the count. 62 | * 63 | * @return mipmaps, The number of mipmap levels stored in the CompressedImageData. 64 | * @link [CompressedImageData:getMipmapCount](https://love2d.org/wiki/CompressedImageData:getMipmapCount) 65 | * @since 0.9.0 66 | */ 67 | getMipmapCount(): number; 68 | 69 | /** 70 | * Gets the width of the CompressedImageData. 71 | * 72 | * @return width, The width of the CompressedImageData. 73 | * @link [CompressedImageData:getWidth](https://love2d.org/wiki/CompressedImageData:getWidth) 74 | * @since 0.9.0 75 | */ 76 | getWidth(): number; 77 | 78 | /** 79 | * Gets the width of the CompressedImageData. 80 | * 81 | * @param level A mipmap level. Must be in the range of [1, CompressedImageData:getMipmapCount()]. 82 | * @return width, The width of the CompressedImageData. 83 | * @link [CompressedImageData:getWidth](https://love2d.org/wiki/CompressedImageData:getWidth) 84 | * @since 0.9.0 85 | */ 86 | getWidth(level: number): number; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /typings/love.physics/types/PulleyJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Allows you to simulate bodies connected through pulleys. 4 | * @link [PulleyJoint](https://love2d.org/wiki/PulleyJoint) 5 | */ 6 | interface PulleyJoint extends Joint<"PulleyJoint"> { 7 | /** 8 | * Get the total length of the rope. 9 | * 10 | * @return length, The length of the rope in the joint. 11 | * @link [PulleyJoint:getConstant](https://love2d.org/wiki/PulleyJoint:getConstant) 12 | */ 13 | getConstant(): number; 14 | 15 | /** 16 | * Get the ground anchor positions in world coordinates. 17 | * 18 | * @return a1x, The x coordinate of the first anchor. 19 | * @return a1y, The y coordinate of the first anchor. 20 | * @return a2x, The x coordinate of the second anchor. 21 | * @return a2y, The y coordinate of the second anchor. 22 | * @link [PulleyJoint:getGroundAnchors](https://love2d.org/wiki/PulleyJoint:getGroundAnchors) 23 | */ 24 | getGroundAnchors(): LuaMultiReturn< 25 | [a1x: number, a1y: number, a2x: number, a2y: number] 26 | >; 27 | 28 | /** 29 | * Get the current length of the rope segment attached to the first body. 30 | * 31 | * @return length, The length of the rope segment. 32 | * @link [PulleyJoint:getLengthA](https://love2d.org/wiki/PulleyJoint:getLengthA) 33 | */ 34 | getLengthA(): number; 35 | 36 | /** 37 | * Get the current length of the rope segment attached to the second body. 38 | * 39 | * @return length, The length of the rope segment. 40 | * @link [PulleyJoint:getLengthB](https://love2d.org/wiki/PulleyJoint:getLengthB) 41 | */ 42 | getLengthB(): number; 43 | 44 | /** 45 | * Get the maximum lengths of the rope segments. 46 | * 47 | * @return len1, The maximum length of the first rope segment. 48 | * @return len2, The maximum length of the second rope segment. 49 | * @link [PulleyJoint:getMaxLengths](https://love2d.org/wiki/PulleyJoint:getMaxLengths) 50 | */ 51 | getMaxLengths(): LuaMultiReturn<[len1: number, len2: number]>; 52 | 53 | /** 54 | * Get the pulley ratio. 55 | * 56 | * @return ratio, The pulley ratio of the joint. 57 | * @link [PulleyJoint:getRatio](https://love2d.org/wiki/PulleyJoint:getRatio) 58 | */ 59 | getRatio(): number; 60 | 61 | /** 62 | * Set the total length of the rope. 63 | * 64 | * Setting a new length for the rope updates the maximum length values of the 65 | * joint. 66 | * 67 | * @param length The new length of the rope in the joint. 68 | * @link [PulleyJoint:setConstant](https://love2d.org/wiki/PulleyJoint:setConstant) 69 | */ 70 | setConstant(length: number): void; 71 | 72 | /** 73 | * Set the maximum lengths of the rope segments. 74 | * 75 | * The physics module also imposes maximum values for the rope segments. If the 76 | * parameters exceed these values, the maximum values are set instead of the 77 | * requested values. 78 | * 79 | * @param max1 The new maximum length of the first segment. 80 | * @param max2 The new maximum length of the second segment. 81 | * @link [PulleyJoint:setMaxLengths](https://love2d.org/wiki/PulleyJoint:setMaxLengths) 82 | */ 83 | setMaxLengths(max1: number, max2: number): void; 84 | 85 | /** 86 | * Set the pulley ratio. 87 | * 88 | * @param ratio The new pulley ratio of the joint. 89 | * @link [PulleyJoint:setRatio](https://love2d.org/wiki/PulleyJoint:setRatio) 90 | */ 91 | setRatio(ratio: number): void; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /typings/love.system/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides access to information about the user's system. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.system](https://love2d.org/wiki/love.system) 7 | */ 8 | declare module "love.system" { 9 | /** 10 | * Gets text from the clipboard. 11 | * 12 | * @return text, The text currently held in the system's clipboard. 13 | * @link [love.system.getClipboardText](https://love2d.org/wiki/love.system.getClipboardText) 14 | */ 15 | function getClipboardText(): string; 16 | 17 | /** 18 | * Gets the current operating system. In general, LÖVE abstracts away the need to 19 | * know the current operating system, but there are a few cases where it can be 20 | * useful (especially in combination with os.execute.) 21 | * 22 | * @return osString, The current operating system. "OS X", "Windows", "Linux", "Android" or "iOS". 23 | * @link [love.system.getOS](https://love2d.org/wiki/love.system.getOS) 24 | */ 25 | function getOS(): 26 | | "OS X" 27 | | "iOS" 28 | | "UWP" 29 | | "Windows" 30 | | "Android" 31 | | "Linux" 32 | | "Unknown"; 33 | 34 | /** 35 | * Gets information about the system's power supply. 36 | * 37 | * @return state, The basic state of the power supply. 38 | * @return percent, Percentage of battery life left, between 0 and 100. _nil/undefined_ if the value can't be determined or there's no battery. 39 | * @return seconds, Seconds of battery life left. _nil/undefined_ if the value can't be determined or there's no battery. 40 | * @link [love.system.getPowerInfo](https://love2d.org/wiki/love.system.getPowerInfo) 41 | */ 42 | function getPowerInfo(): LuaMultiReturn< 43 | [state: PowerState, percent?: number, seconds?: number] 44 | >; 45 | 46 | /** 47 | * Gets the amount of logical processor in the system. 48 | * 49 | * @return processorCount, Amount of logical processors. 50 | * @link [love.system.getProcessorCount](https://love2d.org/wiki/love.system.getProcessorCount) 51 | */ 52 | function getProcessorCount(): number; 53 | 54 | /** 55 | * Gets whether another application on the system is playing music in the background. 56 | * @return backgroundmusic, True if the user is playing music in the background via another app, false otherwise. 57 | * @link [love.system.hasBackgroundMusic](https://love2d.org/wiki/love.system.hasBackgroundMusic) 58 | */ 59 | function hasBackgroundMusic(): boolean; 60 | 61 | /** 62 | * Opens a URL with the user's web or file browser. 63 | * 64 | * To open a file or folder, "file://" must be prepended to the path. 65 | * 66 | * @param url The URL to open. Must be formatted as a proper URL. 67 | * @return success, Whether the URL was opened successfully. 68 | @link [love.system.openURL](https://love2d.org/wiki/love.system.openURL) 69 | */ 70 | function openURL(url: string): boolean; 71 | 72 | /** 73 | * Puts text in the clipboard. 74 | * 75 | * @param text The new text to hold in the system's clipboard. 76 | * @link [love.system.setClipboardText](https://love2d.org/wiki/love.system.setClipboardText) 77 | */ 78 | function setClipboardText(text: string): void; 79 | 80 | /** 81 | * Causes the device to vibrate, if possible. Currently this will only work on 82 | * Android and iOS devices that have a built-in vibration motor. 83 | * 84 | * @param seconds 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. 85 | * @link [love.system.vibrate](https://love2d.org/wiki/love.system.vibrate) 86 | */ 87 | function vibrate(seconds?: number): void; 88 | } 89 | -------------------------------------------------------------------------------- /typings/love.image/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides an interface to decode encoded image data. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.image](https://love2d.org/wiki/love.image) 7 | */ 8 | declare module "love.image" { 9 | import { FileData } from "love.filesystem"; 10 | 11 | /** 12 | * Determines whether a file can be loaded as CompressedImageData. 13 | * 14 | * @param filename The filename of the potentially compressed image file. 15 | * @return compressed, Whether the file can be loaded as CompressedImageData or not. 16 | * @link [love.image.isCompressed](https://love2d.org/wiki/love.image.isCompressed) 17 | */ 18 | function isCompressed(filename: string): boolean; 19 | 20 | /** 21 | * Determines whether a file can be loaded as CompressedImageData. 22 | * 23 | * @param fileData A FileData potentially containing a compressed image. 24 | * @return compressed, Whether the FileData can be loaded as CompressedImageData or not. 25 | * @link [love.image.](https://love2d.org/wiki/love.image.) 26 | */ 27 | function isCompressed(fileData: FileData): boolean; 28 | 29 | /** 30 | * Create a new CompressedImageData object from a compressed image file. LÖVE 31 | * supports several compressed texture formats, enumerated in the 32 | * CompressedImageFormat page. 33 | * 34 | * @param filename The filename of the compressed image file. 35 | * @return compressedImageData, The new CompressedImageData object. 36 | * @link [love.image.newCompressedData](https://love2d.org/wiki/love.image.newCompressedData) 37 | */ 38 | function newCompressedData(filename: string): CompressedImageData; 39 | 40 | /** 41 | * Create a new CompressedImageData object from a compressed image file. LÖVE 42 | * supports several compressed texture formats, enumerated in the 43 | * CompressedImageFormat page. 44 | * 45 | * @param fileData A FileData containing a compressed image. 46 | * @return compressedImageData, The new CompressedImageData object. 47 | * @link [love.image.newCompressedData](https://love2d.org/wiki/love.image.newCompressedData) 48 | */ 49 | function newCompressedData(fileData: FileData): CompressedImageData; 50 | 51 | /** 52 | * Create a new ImageData object. 53 | * 54 | * @param width The width of the ImageData. 55 | * @param height The height of the ImageData. 56 | * @return imageData, The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero. 57 | * @link [love.image.newImageData](https://love2d.org/wiki/love.image.newImageData) 58 | */ 59 | function newImageData(width: number, height: number): ImageData; 60 | 61 | /** 62 | * Create a new ImageData object. 63 | * 64 | * @param width The width of the ImageData. 65 | * @param height The height of the ImageData. 66 | * @param data The data to load into the ImageData (RGBA bytes, left to right and top to bottom). 67 | * @return imageData, The new ImageData object. 68 | * @link [love.image.newImageData](https://love2d.org/wiki/love.image.newImageData) 69 | */ 70 | function newImageData(width: number, height: number, data: string): ImageData; 71 | 72 | /** 73 | * Create a new ImageData object. 74 | * 75 | * @param filename The filename of the image file. 76 | * @return imageData, The new ImageData object. 77 | * @link [love.image.newImageData](https://love2d.org/wiki/love.image.newImageData) 78 | */ 79 | function newImageData(filename: string): ImageData; 80 | 81 | /** 82 | * Create a new ImageData object. 83 | * 84 | * @param filedata The encoded file data to decode into image data. 85 | * @return imageData, The new ImageData object. 86 | * @link [love.image.newImageData](https://love2d.org/wiki/love.image.newImageData) 87 | */ 88 | function newImageData(filedata: FileData): ImageData; 89 | } 90 | -------------------------------------------------------------------------------- /typings/love.audio/structs/EffectSettings.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | /** 3 | * Structure used with [love.audio.setEffect](https://love2d.org/wiki/love.audio.setEffect) and [love.audio.getEffect](https://love2d.org/wiki/love.audio.getEffect). 4 | * 5 | * Documented [here](https://love2d.org/wiki/EffectType). 6 | * @link [love.audio.setEffect](https://love2d.org/wiki/love.audio.setEffect) 7 | * @link [love.audio.getEffect](https://love2d.org/wiki/love.audio.getEffect) 8 | */ 9 | type EffectSettings = 10 | | ChorusEffectSettings 11 | | CompressorEffectSettings 12 | | DistortionEffectSettings 13 | | EchoEffectSettings 14 | | EqualizerEffectSettings 15 | | FlangerEffectSettings 16 | | ReverbEffectSettings 17 | | RingModulatorEffectSettings; 18 | 19 | /** 20 | * Plays multiple copies of the sound with slight pitch and time variation. 21 | * 22 | * Used to make sounds sound "fuller" or "thicker". 23 | */ 24 | type ChorusEffectSettings = { 25 | type: "chorus"; 26 | waveform?: EffectWaveform; 27 | phase?: number; 28 | rate?: number; 29 | depth?: number; 30 | feedback?: number; 31 | delay?: number; 32 | }; 33 | 34 | /** 35 | * Decreases the dynamic range of the sound, making the loud and quiet parts closer in volume, producing a more uniform amplitude throughout time. 36 | */ 37 | type CompressorEffectSettings = { 38 | type: "compressor"; 39 | enable?: boolean; 40 | }; 41 | 42 | /** 43 | * Alters the sound by amplifying it until it clips, shearing off parts of the signal, leading to a compressed and distorted sound. 44 | */ 45 | type DistortionEffectSettings = { 46 | type: "distortion"; 47 | gain?: number; 48 | edge?: number; 49 | lowcut?: number; 50 | center?: number; 51 | bandwidth?: number; 52 | }; 53 | 54 | /** 55 | * Decaying feedback based effect, on the order of seconds. 56 | * 57 | * Also known as delay; causes the sound to repeat at regular intervals at a decreasing volume. 58 | */ 59 | type EchoEffectSettings = { 60 | type: "echo"; 61 | delay?: number; 62 | tapdelay?: number; 63 | damping?: number; 64 | feedback?: number; 65 | spread?: number; 66 | }; 67 | 68 | /** 69 | * Adjust the frequency components of the sound using a 4-band (low-shelf, two band-pass and a high-shelf) equalizer. 70 | */ 71 | type EqualizerEffectSettings = { 72 | type: "equalizer"; 73 | lowgain?: number; 74 | lowcut?: number; 75 | lowmidgain?: number; 76 | lowmidfrequency?: number; 77 | lowmidbandwidth?: number; 78 | highmidgain?: number; 79 | highmidfrequency?: number; 80 | highmidbandwidth?: number; 81 | highgain?: number; 82 | highcut?: number; 83 | }; 84 | 85 | /** 86 | * 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. 87 | */ 88 | type FlangerEffectSettings = { 89 | type: "flanger"; 90 | phase?: number; 91 | rate?: number; 92 | depth?: number; 93 | feedback?: number; 94 | delay?: number; 95 | }; 96 | 97 | /** 98 | * Decaying feedback based effect, on the order of milliseconds. 99 | * 100 | * Used to simulate the reflection off of the surroundings. 101 | */ 102 | type ReverbEffectSettings = { 103 | type: "reverb"; 104 | gain?: number; 105 | highgain?: number; 106 | density?: number; 107 | diffusion?: number; 108 | decaytime?: number; 109 | decayhighratio?: number; 110 | earlygain?: number; 111 | earlydelay?: number; 112 | lategain?: number; 113 | latedelay?: number; 114 | roomrolloff?: number; 115 | airabsorption?: number; 116 | highlimiit?: boolean; 117 | }; 118 | 119 | /** 120 | * An implementation of amplitude modulation; multiplies the source signal with a simple waveform, to produce either volume changes, or inharmonic overtones. 121 | */ 122 | type RingModulatorEffectSettings = { 123 | type: "ringmodulator"; 124 | waveform?: EffectWaveform; 125 | frequency?: number; 126 | highcut?: number; 127 | }; 128 | } 129 | -------------------------------------------------------------------------------- /typings/love.physics/types/Joint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | import { Type } from "love"; 3 | 4 | type JointTypes = 5 | | "DistanceJoint" 6 | | "FrictionJoint" 7 | | "GearJoint" 8 | | "MotorJoint" 9 | | "MouseJoint" 10 | | "PrismaticJoint" 11 | | "PulleyJoint" 12 | | "RevoluteJoint" 13 | | "RopeJoint" 14 | | "WeldJoint" 15 | | "WheelJoint"; 16 | 17 | /** 18 | * Attach multiple bodies together to interact in unique ways. 19 | * @link [Joint](https://love2d.org/wiki/Joint) 20 | */ 21 | interface Joint extends Type { 22 | /** 23 | * Explicitly destroys the Joint. When you don't have time to wait for garbage 24 | * collection, this function may be used to free the object immediately, but note 25 | * that an error will occur if you attempt to use the object after calling this 26 | * function. 27 | * 28 | * @link [Joint:destroy](https://love2d.org/wiki/Joint:destroy) 29 | */ 30 | destroy(): void; 31 | 32 | /** 33 | * Get the anchor points of the joint. 34 | * 35 | * @return x1, The x component of the anchor on Body 1. 36 | * @return y1, The y component of the anchor on Body 1. 37 | * @return x2, The x component of the anchor on Body 2. 38 | * @return y2, The y component of the anchor on Body 2. 39 | * @link [Joint:getAnchors](https://love2d.org/wiki/Joint:getAnchors) 40 | */ 41 | getAnchors(): LuaMultiReturn< 42 | [x1: number, y2: number, x2: number, y2: number] 43 | >; 44 | 45 | /** 46 | * Gets the bodies that the Joint is attached to. 47 | * 48 | * @return bodyA, The first Body. 49 | * @return bodyB, The second Body. 50 | * @link [Joint:getBodies](https://love2d.org/wiki/Joint:getBodies) 51 | */ 52 | getBodies(): LuaMultiReturn<[bodyA: Body, bodyB: Body]>; 53 | 54 | /** 55 | * Gets whether the connected Bodies collide. 56 | * 57 | * @return c, True if they collide, false otherwise. 58 | * @link [Joint:getCollideConnected](https://love2d.org/wiki/Joint:getCollideConnected) 59 | */ 60 | getCollideConnected(): boolean; 61 | 62 | /** 63 | * Gets the reaction force on Body 2 at the joint anchor. 64 | * 65 | * @param invdt How long the force applies. Usually the inverse time step or 1/dt. 66 | * @return x, The x component of the force. 67 | * @return y, The y component of the force. 68 | * @link [Joint:getReactionForce](https://love2d.org/wiki/Joint:getReactionForce) 69 | */ 70 | getReactionForce(invdt: number): LuaMultiReturn<[x: number, y: number]>; 71 | 72 | /** 73 | * Returns the reaction torque on the second body. 74 | * 75 | * @param invdt How long the force applies. Usually the inverse time step or 1/dt. 76 | * @return torque, The reaction torque on the second body. 77 | * @link [Joint:getReactionTorque](https://love2d.org/wiki/Joint:getReactionTorque) 78 | */ 79 | getReactionTorque(invdt: number): number; 80 | 81 | /** 82 | * Gets a string representing the type. 83 | * 84 | * @return type, A string with the name of the Joint type. 85 | * @link [Joint:getType](https://love2d.org/wiki/Joint:getType) 86 | */ 87 | getType(): JointType; 88 | 89 | /** 90 | * Returns the Lua value associated with this Joint. 91 | * 92 | * @return value, The Lua value associated with the Joint. 93 | * @link [Joint:getUserData](https://love2d.org/wiki/Joint:getUserData) 94 | */ 95 | getUserData(): any; 96 | 97 | /** 98 | * Gets whether the Joint is destroyed. Destroyed joints cannot be used. 99 | * 100 | * @return destroyed, Whether the Joint is destroyed. 101 | * @link [Joint:isDestroyed](https://love2d.org/wiki/Joint:isDestroyed) 102 | */ 103 | isDestroyed(): boolean; 104 | 105 | /** 106 | * Associates a Lua value with the Joint. 107 | * 108 | * To delete the reference, explicitly pass _nil/undefined_. 109 | * 110 | * @param value The Lua value to associate with the Joint. 111 | * @link [Joint:setUserData](https://love2d.org/wiki/Joint:setUserData) 112 | */ 113 | setUserData(value: any): void; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /typings/love.audio/types/RecordingDevice.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.audio" { 2 | import { Type } from "love"; 3 | import { SoundData } from "love.sound"; 4 | 5 | /** 6 | * Represents an audio input device capable of recording sounds. 7 | * 8 | * @link [RecordingDevice](https://love2d.org/wiki/RecordingDevice) 9 | * @since 11.0 10 | */ 11 | interface RecordingDevice extends Type<"RecordingDevice"> { 12 | /** 13 | * Gets the number of bits per sample in the data currently being recorded. 14 | * 15 | * @return bits, The number of bits per sample in the data that's currently being recorded. 16 | * @link [RecordingDevice:getBitDepth](https://love2d.org/wiki/RecordingDevice:getBitDepth) 17 | * @since 11.0 18 | */ 19 | getBitDepth(): number; 20 | 21 | /** 22 | * Gets the number of channels currently being recorded (mono or stereo). 23 | * 24 | * @return channels, The number of channels being recorded (`1` for mono, `2` for stereo). 25 | * @link [RecordingDevice:getChannelCount](https://love2d.org/wiki/RecordingDevice:getChannelCount) 26 | * @since 11.0 27 | */ 28 | getChannelCount(): number; 29 | 30 | /** 31 | * Gets all recorded audio [SoundData](https://love2d.org/wiki/SoundData) stored in the device's internal ring buffer. 32 | * 33 | * @return data, The recorded audio data, or _nil/undefined_ if the device isn't recording. 34 | * @link [RecordingDevice:getData](https://love2d.org/wiki/RecordingDevice:getData) 35 | * @since 11.0 36 | */ 37 | getData(): SoundData | undefined; 38 | 39 | /** 40 | * Gets the name of the recording device. 41 | * 42 | * @return name, The name of the device. 43 | * @link [RecordingDevice:getName](https://love2d.org/wiki/RecordingDevice:getName) 44 | * @since 11.0 45 | */ 46 | getName(): string; 47 | 48 | /** 49 | * Gets the number of currently recorded samples. 50 | * 51 | * @return samples, The number of samples that have been recorded so far. 52 | * @link [RecordingDevice:getSampleCount](https://love2d.org/wiki/RecordingDevice:getSampleCount) 53 | * @since 11.0 54 | */ 55 | getSampleCount(): number; 56 | 57 | /** 58 | * Gets the number of samples per second currently being recorded. 59 | * 60 | * @return rate, The number of samples being recorded per second (sample rate). 61 | * @link [RecordingDevice:getSampleRate](https://love2d.org/wiki/RecordingDevice:getSampleRate) 62 | * @since 11.0 63 | */ 64 | getSampleRate(): number; 65 | 66 | /** 67 | * Gets whether the device is currently recording. 68 | * 69 | * @return recording, `true` if the RecordingDevice is recording, `false` otherwise. 70 | * @link [RecordingDevice:isRecording](https://love2d.org/wiki/RecordingDevice:isRecording) 71 | * @since 11.0 72 | */ 73 | isRecording(): boolean; 74 | 75 | /** 76 | * Begins recording audio using this device. 77 | * 78 | * @param samplecount The maximum number of samples to store in an internal ring buffer when recording. [RecordingDevice:getData](https://love2d.org/wiki/RecordingDevice:getData) clears the internal buffer when called. 79 | * @param samplerate The number of samples per second to store when recording. (Default `8000`) 80 | * @param bitdepth The number of bits per sample. (Default `16`) 81 | * @param channels Whether to record in mono or stereo. Most microphones don't support more than 1 channel. (Default `1`) 82 | * @return success, `true` if the device successfully began recording using the specified parameters, `false` if not. 83 | * @link [RecordingDevice:start](https://love2d.org/wiki/RecordingDevice:start) 84 | * @since 11.0 85 | */ 86 | start( 87 | samplecount: number, 88 | samplerate?: number, 89 | bitdepth?: number, 90 | channels?: number, 91 | ): boolean; 92 | 93 | /** 94 | * Stops recording audio from this device. Any sound data currently in the device's buffer will be returned. 95 | * 96 | * @return data, The sound data currently in the device's buffer, or _nil/undefined_ if the device wasn't recording. 97 | * @link [RecordingDevice:stop](https://love2d.org/wiki/RecordingDevice:stop) 98 | * @since 11.0 99 | */ 100 | stop(): SoundData | undefined; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /typings/love.physics/types/ChainShape.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * A ChainShape consists of multiple line segments. 4 | * 5 | * It can be used to create the boundaries of your terrain. 6 | * 7 | * The shape does not have volume and can only collide with PolygonShape and CircleShape. 8 | * @link [ChainShape](https://love2d.org/wiki/ChainShape) 9 | */ 10 | interface ChainShape extends Shape<"ChainShape"> { 11 | /** 12 | * Returns a child of the shape as an EdgeShape. 13 | * 14 | * @param index The index of the child. 15 | * @return EdgeShape, The child as an EdgeShape. 16 | * @link [ChainShape:getChildEdge](https://love2d.org/wiki/ChainShape:getChildEdge) 17 | */ 18 | getChildEdge(index: number): number; 19 | 20 | /** 21 | * Gets the vertex that establishes a connection to the next shape. 22 | * 23 | * Setting next and previous ChainShape vertices can help prevent unwanted 24 | * collisions when a flat shape slides along the edge and moves over to the new 25 | * shape. 26 | * 27 | * @param x The x-component of the vertex, or _nil/undefined/undefined_ if ChainShape:setNextVertex hasn't been called. 28 | * @param y The y-component of the vertex, or _nil/undefined/undefined_ if ChainShape:setNextVertex hasn't been called. 29 | * @link [ChainShape:getNextVertex](https://love2d.org/wiki/ChainShape:getNextVertex) 30 | */ 31 | getNextVertex(x?: number, y?: number): void; 32 | 33 | /** 34 | * Returns a point of the shape. 35 | * 36 | * @param index The index of the point to return. 37 | * @return x, The x-coordinate of the point. 38 | * @return y, The y-coordinate of the point. 39 | * @link [ChainShape:getPoint](https://love2d.org/wiki/ChainShape:getPoint) 40 | */ 41 | getPoint(index: number): LuaMultiReturn<[x: number, y: number]>; 42 | 43 | /** 44 | * Returns all points of the shape. 45 | * 46 | * @return x1, The x-coordinate of the first point. 47 | * @return y1, The y-coordinate of the first point. 48 | * @return x2, The x-coordinate of the second point. 49 | * @return y2, The y-coordinate of the second point. 50 | * @return ..., Additional x and y values. 51 | * @link [ChainShape:getPoints](https://love2d.org/wiki/ChainShape:getPoints) 52 | */ 53 | getPoints(): LuaMultiReturn; 54 | 55 | /** 56 | * Gets the vertex that establishes a connection to the previous shape. 57 | * 58 | * Setting next and previous ChainShape vertices can help prevent unwanted 59 | * collisions when a flat shape slides along the edge and moves over to the new 60 | * shape. 61 | * 62 | * @return x, The x-component of the vertex, or _nil/undefined_ if ChainShape:setNextVertex hasn't been called. 63 | * @return y, The y-component of the vertex, or _nil/undefined_ if ChainShape:setNextVertex hasn't been called. 64 | * @link [ChainShape:getPreviousVertex](https://love2d.org/wiki/ChainShape:getPreviousVertex) 65 | */ 66 | getPreviousVertex(): LuaMultiReturn<[x: number, y: number] | []>; 67 | 68 | /** 69 | * Returns the number of vertices the shape has. 70 | * 71 | * @return count, The number of vertices. 72 | * @link [ChainShape:getVertexCount](https://love2d.org/wiki/ChainShape:getVertexCount) 73 | */ 74 | getVertexCount(): number; 75 | 76 | /** 77 | * Sets a vertex that establishes a connection to the next shape. 78 | * 79 | * This can help prevent unwanted collisions when a flat shape slides along the 80 | * edge and moves over to the new shape. 81 | * 82 | * @param x The x component of the vertex. 83 | * @param y The y component of the vertex. 84 | * @link [ChainShape:setNextVertex](https://love2d.org/wiki/ChainShape:setNextVertex) 85 | */ 86 | setNextVertex(x: number, y: number): void; 87 | 88 | /** 89 | * Sets a vertex that establishes a connection to the previous shape. 90 | * 91 | * This can help prevent unwanted collisions when a flat shape slides along the 92 | * edge and moves over to the new shape. 93 | * 94 | * @param x The x component of the vertex. 95 | * @param y The y component of the vertex. 96 | * @link [ChainShape:setPreviousVertex](https://love2d.org/wiki/ChainShape:setPreviousVertex) 97 | */ 98 | setPreviousVertex(x: number, y: number): void; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /typings/love.physics/types/WheelJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Restricts a point on the second body to a line on the first body. 4 | * @link [WheelJoint](https://love2d.org/wiki/WheelJoint) 5 | */ 6 | interface WheelJoint extends Joint<"WheelJoint"> { 7 | /** 8 | * Gets the world-space axis vector of the Wheel Joint. 9 | * 10 | * @return x, The x-axis coordinate of the world-space axis vector. 11 | * @return y, The y-axis coordinate of the world-space axis vector. 12 | * @link [WheelJoint:getAxis](https://love2d.org/wiki/WheelJoint:getAxis) 13 | */ 14 | getAxis(): LuaMultiReturn<[x: number, y: number]>; 15 | 16 | /** 17 | * Returns the current joint translation speed. 18 | * 19 | * @return speed, The translation speed of the joint in meters per second. 20 | * @link [WheelJoint:getJointSpeed](https://love2d.org/wiki/WheelJoint:getJointSpeed) 21 | */ 22 | getJointSpeed(): number; 23 | 24 | /** 25 | * Returns the current joint translation. 26 | * 27 | * @return position, The translation of the joint in meters. 28 | * @link [WheelJoint:getJointTranslation](https://love2d.org/wiki/WheelJoint:getJointTranslation) 29 | */ 30 | getJointTranslation(): number; 31 | 32 | /** 33 | * Returns the maximum motor torque. 34 | * 35 | * @return maxTorque, The maximum torque of the joint motor in newton meters. 36 | * @link [WheelJoint:getMaxMotorTorque](https://love2d.org/wiki/WheelJoint:getMaxMotorTorque) 37 | */ 38 | getMaxMotorTorque(): number; 39 | 40 | /** 41 | * Returns the speed of the motor. 42 | * 43 | * @return speed, The speed of the joint motor in radians per second. 44 | * @link [WheelJoint:getMotorSpeed](https://love2d.org/wiki/WheelJoint:getMotorSpeed) 45 | */ 46 | getMotorSpeed(): number; 47 | 48 | /** 49 | * Returns the current torque on the motor. 50 | * 51 | * @param invdt How long the force applies. Usually the inverse time step or 1/dt. 52 | * @return torque, The torque on the motor in newton meters. 53 | * @link [WheelJoint:getMotorTorque](https://love2d.org/wiki/WheelJoint:getMotorTorque) 54 | */ 55 | getMotorTorque(invdt: number): number; 56 | 57 | /** 58 | * Returns the damping ratio. 59 | * 60 | * @return ratio, The damping ratio. 61 | * @link [WheelJoint:getSpringDampingRatio](https://love2d.org/wiki/WheelJoint:getSpringDampingRatio) 62 | */ 63 | getSpringDampingRatio(): number; 64 | 65 | /** 66 | * Returns the spring frequency. 67 | * 68 | * @return freq, The frequency in hertz. 69 | * @link [WheelJoint:getSpringFrequency](https://love2d.org/wiki/WheelJoint:getSpringFrequency) 70 | */ 71 | getSpringFrequency(): number; 72 | 73 | /** 74 | * Checks if the joint motor is running. 75 | * @return on, The status of the joint motor. 76 | * @link [WheelJoint:isMotorEnabled](https://love2d.org/wiki/WheelJoint:isMotorEnabled) 77 | */ 78 | isMotorEnabled(): boolean; 79 | 80 | /** 81 | * Sets a new maximum motor torque. 82 | * 83 | * @param maxTorque The new maximum torque for the joint motor in newton meters. 84 | * @link [WheelJoint:setMaxMotorTorque](https://love2d.org/wiki/WheelJoint:setMaxMotorTorque) 85 | */ 86 | setMaxMotorTorque(maxTorque: number): void; 87 | 88 | /** 89 | * Starts and stops the joint motor. 90 | * 91 | * @param enable True turns the motor on and false turns it off. 92 | * @link [WheelJoint:setMotorEnabled](https://love2d.org/wiki/WheelJoint:setMotorEnabled) 93 | */ 94 | setMotorEnabled(enable: boolean): void; 95 | 96 | /** 97 | * Sets a new speed for the motor. 98 | * 99 | * @param speed The new speed for the joint motor in radians per second. 100 | * @link [WheelJoint:setMotorSpeed](https://love2d.org/wiki/WheelJoint:setMotorSpeed) 101 | */ 102 | setMotorSpeed(speed: number): void; 103 | 104 | /** 105 | * Sets a new damping ratio. 106 | * 107 | * @param ratio The new damping ratio. 108 | * @link [WheelJoint:setSpringDampingRatio](https://love2d.org/wiki/WheelJoint:setSpringDampingRatio) 109 | */ 110 | setSpringDampingRatio(ratio: number): void; 111 | 112 | /** 113 | * Sets a new spring frequency. 114 | * 115 | * @param freq The new frequency in hertz. 116 | * @link [WheelJoint:setSpringFrequency](https://love2d.org/wiki/WheelJoint:setSpringFrequency) 117 | */ 118 | setSpringFrequency(freq: number): void; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /typings/love.keyboard/enums/ScanCode.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.keyboard" { 2 | /** 3 | * Keyboard scancodes. 4 | * 5 | * Scancodes are keyboard layout-independent, so the scancode "w" will be 6 | * generated if the key in the same place as the "w" key on an American QWERTY 7 | * keyboard is pressed, no matter what the key is labelled or what the user's 8 | * operating system settings are. 9 | * 10 | * Using scancodes, rather than keycodes, is useful because keyboards with layouts 11 | * differing from the US/UK layout(s) might have keys that generate 'unknown' 12 | * keycodes, but the scancodes will still be detected. This however would 13 | * necessitate having a list for each keyboard layout one would choose to support. 14 | * 15 | * One could use textinput or textedited instead, but those only give back the end 16 | * result of keys used, i.e. you can't get modifiers on their own from it, only 17 | * the final symbols that were generated. 18 | * @link [Scancode](https://love2d.org/wiki/Scancode) 19 | */ 20 | type Scancode = 21 | | "a" 22 | | "b" 23 | | "c" 24 | | "d" 25 | | "e" 26 | | "f" 27 | | "g" 28 | | "h" 29 | | "i" 30 | | "j" 31 | | "k" 32 | | "l" 33 | | "m" 34 | | "n" 35 | | "o" 36 | | "p" 37 | | "q" 38 | | "r" 39 | | "s" 40 | | "t" 41 | | "u" 42 | | "v" 43 | | "w" 44 | | "x" 45 | | "y" 46 | | "z" 47 | | "1" 48 | | "2" 49 | | "3" 50 | | "4" 51 | | "5" 52 | | "6" 53 | | "7" 54 | | "8" 55 | | "9" 56 | | "0" 57 | | "return" 58 | | "escape" 59 | | "backspace" 60 | | "tab" 61 | | "space" 62 | | "-" 63 | | "=" 64 | | "[" 65 | | "]" 66 | | "\\" 67 | | "nonus#" 68 | | ";" 69 | | "'" 70 | | "`" 71 | | "," 72 | | "." 73 | | "/" 74 | | "capslock" 75 | | "f1" 76 | | "f2" 77 | | "f3" 78 | | "f4" 79 | | "f5" 80 | | "f6" 81 | | "f7" 82 | | "f8" 83 | | "f9" 84 | | "f10" 85 | | "f11" 86 | | "f12" 87 | | "f13" 88 | | "f14" 89 | | "f15" 90 | | "f16" 91 | | "f17" 92 | | "f18" 93 | | "f19" 94 | | "f20" 95 | | "f21" 96 | | "f22" 97 | | "f23" 98 | | "f24" 99 | | "lctrl" 100 | | "lshift" 101 | | "lalt" 102 | | "lgui" 103 | | "rctrl" 104 | | "rshift" 105 | | "ralt" 106 | | "rgui" 107 | | "printscreen" 108 | | "scrolllock" 109 | | "pause" 110 | | "insert" 111 | | "home" 112 | | "numlock" 113 | | "pageup" 114 | | "delete" 115 | | "end" 116 | | "pagedown" 117 | | "right" 118 | | "left" 119 | | "down" 120 | | "up" 121 | | "nonusbackslash" 122 | | "application" 123 | | "execute" 124 | | "help" 125 | | "menu" 126 | | "select" 127 | | "stop" 128 | | "again" 129 | | "undo" 130 | | "cut" 131 | | "copy" 132 | | "paste" 133 | | "find" 134 | | "kp/" 135 | | "kp*" 136 | | "kp-" 137 | | "kp+" 138 | | "kp=" 139 | | "kpenter" 140 | | "kp1" 141 | | "kp2" 142 | | "kp3" 143 | | "kp4" 144 | | "kp5" 145 | | "kp6" 146 | | "kp7" 147 | | "kp8" 148 | | "kp9" 149 | | "kp0" 150 | | "kp." 151 | | "international1" 152 | | "international2" 153 | | "international3" 154 | | "international4" 155 | | "international5" 156 | | "international6" 157 | | "international7" 158 | | "international8" 159 | | "international9" 160 | | "lang1" 161 | | "lang2" 162 | | "lang3" 163 | | "lang4" 164 | | "lang5" 165 | | "mute" 166 | | "volumeup" 167 | | "volumedown" 168 | | "audionext" 169 | | "audioprev" 170 | | "audiostop" 171 | | "audioplay" 172 | | "audiomute" 173 | | "mediaselect" 174 | | "www" 175 | | "mail" 176 | | "calculator" 177 | | "computer" 178 | | "acsearch" 179 | | "achome" 180 | | "acback" 181 | | "acforward" 182 | | "acstop" 183 | | "acrefresh" 184 | | "acbookmarks" 185 | | "power" 186 | | "brightnessdown" 187 | | "brightnessup" 188 | | "displayswitch" 189 | | "kbdillumtoggle" 190 | | "kbdillumdown" 191 | | "kbdillumup" 192 | | "eject" 193 | | "sleep" 194 | | "alterase" 195 | | "sysreq" 196 | | "cancel" 197 | | "clear" 198 | | "prior" 199 | | "return2" 200 | | "separator" 201 | | "out" 202 | | "oper" 203 | | "clearagain" 204 | | "crsel" 205 | | "exsel" 206 | | "kp00" 207 | | "kp000" 208 | | "thsousandsseparator" 209 | | "decimalseparator" 210 | | "currencyunit" 211 | | "currencysubunit" 212 | | "app1" 213 | | "app2" 214 | | "unknown"; 215 | } 216 | -------------------------------------------------------------------------------- /typings/love.keyboard/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides an interface to the user's keyboard. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.keyboard](https://love2d.org/wiki/love.keyboard) 7 | */ 8 | declare module "love.keyboard" { 9 | /** 10 | * Gets the key corresponding to the given hardware scancode. 11 | * 12 | * @param scancode The scancode to get the key from. 13 | * @return key, The key corresponding to the given scancode, or "unknown" if the scancode doesn't map to a KeyConstant on the current system. 14 | * @link [love.keyboard.getKeyFromScancode](https://love2d.org/wiki/love.keyboard.getKeyFromScancode) 15 | */ 16 | function getKeyFromScancode(scancode: Scancode): KeyConstant; 17 | 18 | /** 19 | * Gets the hardware scancode corresponding to the given key. 20 | * 21 | * @param key The key to get the scancode from. 22 | * @return scancode, The scancode corresponding to the given key, or "unknown" if the given key has no known physical representation on the current system. 23 | * @link [love.keyboard.getScancodeFromKey](https://love2d.org/wiki/love.keyboard.getScancodeFromKey) 24 | */ 25 | function getScancodeFromKey(key: KeyConstant): Scancode; 26 | 27 | /** 28 | * Gets whether key repeat is enabled. 29 | * 30 | * @return enabled, Whether key repeat is enabled. 31 | * @link [love.keyboard.hasKeyRepeat](https://love2d.org/wiki/love.keyboard.hasKeyRepeat) 32 | */ 33 | function hasKeyRepeat(): boolean; 34 | 35 | /** 36 | * Gets whether text input events are enabled. 37 | * 38 | * @return enabled, Whether text input events are enabled. 39 | * @link [love.keyboard.hasTextInput](https://love2d.org/wiki/love.keyboard.hasTextInput) 40 | */ 41 | function hasTextInput(): boolean; 42 | 43 | /** 44 | * Gets whether is screen keyboard supported. 45 | * @returns supported, Whether the screen keyboard supported or not. 46 | * @link [love.keyboard.hasScreenKeyboard](https://love2d.org/wiki/love.keyboard.hasScreenKeyboard) 47 | * @since 0.10.0 48 | */ 49 | function hasScreenKeyboard(): boolean; 50 | 51 | /** 52 | * Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased. 53 | * 54 | * @param key The key to check. 55 | * @return down, True if the key is down, false if not. 56 | * @link [love.keyboard.isDown](https://love2d.org/wiki/love.keyboard.isDown) 57 | */ 58 | function isDown(key: KeyConstant): boolean; 59 | 60 | /** 61 | * Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased. 62 | * 63 | * @param keys Keys to check. 64 | * @return anyDown, True if any supplied key is down, false if not. 65 | * @link [love.keyboard.isDown](https://love2d.org/wiki/love.keyboard.isDown) 66 | */ 67 | function isDown(...keys: Array): boolean; 68 | 69 | /** 70 | * Checks if one of the specified Scancodes has been pressed. 71 | * @param scancodes The Scancodes to check. 72 | * @return _true_ if any supplied Scancode is down, _false_ if not. 73 | * @link [love.keyboard.isScancodeDown](https://love2d.org/wiki/love.keyboard.isScancodeDown) 74 | */ 75 | function isScancodeDown(...scancodes: Array): boolean; 76 | 77 | /** 78 | * Enables or disables key repeat. It is disabled by default. 79 | * 80 | * The interval between repeats depends on the user's system settings. 81 | * 82 | * @param enable Whether repeat keypress events should be enabled when a key is held down. 83 | * @link [love.keyboard.setKeyRepeat](https://love2d.org/wiki/love.keyboard.setKeyRepeat) 84 | */ 85 | function setKeyRepeat(enable: boolean): void; 86 | 87 | /** 88 | * Enables or disables text input events. It is enabled by default on Windows, 89 | * Mac, and Linux, and disabled by default on iOS and Android. 90 | * 91 | * @param enable Whether text input events should be enabled. 92 | * @link [love.keyboard.setTextInput](https://love2d.org/wiki/love.keyboard.setTextInput) 93 | */ 94 | function setTextInput(enable: boolean): void; 95 | 96 | /** 97 | * Enables or disables text input events. It is enabled by default on Windows, 98 | * Mac, and Linux, and disabled by default on iOS and Android. 99 | * 100 | * @param enable Whether text input events should be enabled. 101 | * @param x On-screen keyboard x position. 102 | * @param y On-screen keyboard y position. 103 | * @param w On-screen keyboard width. 104 | * @param h On-screen keyboard height. 105 | * @link [love.keyboard.setTextInput](https://love2d.org/wiki/love.keyboard.setTextInput) 106 | */ 107 | function setTextInput( 108 | enable: boolean, 109 | x: number, 110 | y: number, 111 | w: number, 112 | h: number, 113 | ): void; 114 | } 115 | -------------------------------------------------------------------------------- /typings/love.physics/types/Contact.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * Contacts are objects created to manage collisions in worlds. 6 | * 7 | * @link [Contact](https://love2d.org/wiki/Contact) 8 | */ 9 | interface Contact extends Type<"Contact"> { 10 | /** 11 | * Gets the child indices of the shapes of the two colliding fixtures. 12 | * For ChainShapes, an index of 1 is the first edge in the chain. 13 | * 14 | * Used together with Fixture:rayCast or ChainShape:getChildEdge. 15 | * 16 | * @return indexA, The child index of the first fixture's shape. 17 | * @return indexB, The child index of the second fixture's shape. 18 | * @link [Contact:getChildren](https://love2d.org/wiki/Contact:getChildren) 19 | */ 20 | getChildren(): LuaMultiReturn<[indexA: number, indexB: number]>; 21 | 22 | /** 23 | * Gets the two Fixtures that hold the shapes that are in contact. 24 | * 25 | * @return fixtureA, The first Fixture. 26 | * @return fixtureB, The second Fixture. 27 | * @link [Contact:getFixtures](https://love2d.org/wiki/Contact:getFixtures) 28 | */ 29 | getFixtures(): LuaMultiReturn<[fixtureA: Fixture, fixtureB: Fixture]>; 30 | 31 | /** 32 | * Get the friction between two shapes that are in contact. 33 | * 34 | * @return The friction of the contact. 35 | * @link [Contact:getFriction](https://love2d.org/wiki/Contact:getFriction) 36 | */ 37 | getFriction(): number; 38 | 39 | /** 40 | * Get the normal vector between two shapes that are in contact. 41 | * 42 | * @return nx, The x component of the normal vector. 43 | * @return ny, The y component of the normal vector. 44 | * @link [Contact:getNormal](https://love2d.org/wiki/Contact:getNormal) 45 | */ 46 | getNormal(): LuaMultiReturn<[nx: number, ny: number]>; 47 | 48 | /** 49 | * Returns the contact points of the two colliding fixtures. There can be one or two points. 50 | * 51 | * @return x1, The x coordinate of the first contact point. 52 | * @return y1, The y coordinate of the first contact point. 53 | * @return x2, The x coordinate of the second contact point. 54 | * @return y2, The y coordinate of the second contact point. 55 | * @link [Contact:getPositions](https://love2d.org/wiki/Contact:getPositions) 56 | */ 57 | getPositions(): LuaMultiReturn< 58 | [...p1: [x1: number, y1: number], ...p2: [x2?: number, y2?: number]] 59 | >; 60 | 61 | /** 62 | * Get the restitution between two shapes that are in contact. 63 | * 64 | * @return restitution, The restitution between the two shapes. 65 | * @link [Contact:getRestitution](https://love2d.org/wiki/Contact:getRestitution) 66 | */ 67 | getRestitution(): number; 68 | 69 | /** 70 | * Returns whether the contact is enabled. The collision will be ignored if a contact gets disabled in the preSolve callback. 71 | * 72 | * @return enabled, True if enabled, false otherwise. 73 | * @link [Contact:isEnabled](https://love2d.org/wiki/Contact:isEnabled) 74 | */ 75 | isEnabled(): boolean; 76 | 77 | /** 78 | * Returns whether the two colliding fixtures are touching each other. 79 | * 80 | * @return touching, True if they touch or false if not. 81 | * @link [Contact:isTouching](https://love2d.org/wiki/Contact:isTouching) 82 | */ 83 | isTouching(): boolean; 84 | 85 | /** 86 | * Resets the contact friction to the mixture value of both fixtures. 87 | * @link [Contact:resetFriction](https://love2d.org/wiki/Contact:resetFriction) 88 | */ 89 | resetFriction(): void; 90 | 91 | /** 92 | * Resets the contact restitution to the mixture value of both fixtures. 93 | * @link [Contact:resetRestitution](https://love2d.org/wiki/Contact:resetRestitution) 94 | */ 95 | resetRestitution(): void; 96 | 97 | /** 98 | * Enables or disables the contact. 99 | * 100 | * @param enabled True to enable or false to disable. 101 | * @link [Contact:setEnabled](https://love2d.org/wiki/Contact:setEnabled) 102 | */ 103 | setEnabled(enabled: boolean): void; 104 | 105 | /** 106 | * Sets the contact friction. 107 | * 108 | * @param friction The contact friction. 109 | * @link [Contact:setFriction](https://love2d.org/wiki/Contact:setFriction) 110 | */ 111 | setFriction(friction: number): void; 112 | 113 | /** 114 | * Sets the contact restitution. 115 | * 116 | * @param restitution The contact restitution. 117 | * @link [Contact:setRestitution](https://love2d.org/wiki/Contact:setRestitution) 118 | */ 119 | setRestitution(restitution: number): void; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /typings/love.joystick/functions.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides an interface to the user's joystick. 3 | * 4 | * @noResolution 5 | * @noSelf 6 | * @link [love.joystick](https://love2d.org/wiki/love.joystick) 7 | */ 8 | declare module "love.joystick" { 9 | /** 10 | * Gets the number of connected joysticks. 11 | * 12 | * @return joystickcount, The number of connected joysticks. 13 | * @link [love.joystick.getJoystickCount](https://love2d.org/wiki/love.joystick.getJoystickCount) 14 | */ 15 | function getJoystickCount(): number; 16 | 17 | /** 18 | * Gets a list of connected Joysticks. 19 | * 20 | * @return joysticks, The list of currently connected Joysticks. 21 | * @link [love.joystick.getJoysticks](https://love2d.org/wiki/love.joystick.getJoysticks) 22 | */ 23 | function getJoysticks(): Array; 24 | 25 | /** 26 | * 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. 27 | * 28 | * 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. 29 | * @returns A string containing the Joystick's gamepad mappings, or nil if the Joystick is not recognized as a gamepad. 30 | * @link [love.joystick.getGamepadMappingString](https://love2d.org/wiki/love.joystick.getGamepadMappingString) 31 | * @since 11.3 32 | */ 33 | function getGamepadMappingString(): string | undefined; 34 | 35 | /** 36 | * Loads a gamepad mappings string from a file. 37 | * 38 | * @param filename The filename to load the mappings string from. 39 | * @link [love.joystick.loadGamepadMappings](https://love2d.org/wiki/love.joystick.loadGamepadMappings) 40 | */ 41 | function loadGamepadMappings(filename: string): void; 42 | 43 | /** 44 | * Loads a gamepad mappings string directly. 45 | * 46 | * @param mappings The mappings string to load. 47 | * @link [love.joystick.loadGamepadMappings](https://love2d.org/wiki/love.joystick.loadGamepadMappings) 48 | */ 49 | function loadGamepadMappings(mappings: string): void; 50 | 51 | /** 52 | * Saves the gamepad mappings of all relevant joysticks to a file. 53 | * 54 | * @param filename The filename to save the mappings string to. 55 | * @return mappings, The mappings string that was written to the file. 56 | * @link [love.joystick.saveGamepadMappings](https://love2d.org/wiki/love.joystick.saveGamepadMappings) 57 | */ 58 | function saveGamepadMappings(filename: string): string; 59 | 60 | /** 61 | * Returns the mappings string without writing to a file. 62 | * 63 | * @return mappings, The mappings string. 64 | * @link [love.joystick.saveGamepadMappings](https://love2d.org/wiki/love.joystick.saveGamepadMappings) 65 | */ 66 | function saveGamepadMappings(): string; 67 | 68 | /** 69 | * Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. 70 | * 71 | * @param guid The OS-dependent GUID for the type of Joystick the binding will affect. 72 | * @param button The virtual gamepad button to bind. 73 | * @param inputtype The type of input to bind the virtual gamepad button to. 74 | * @param inputindex The index of the axis, button, or hat to bind the virtual gamepad button to. 75 | * @param hatdirection The direction of the hat, if the virtual gamepad button will be bound to a hat. Unspecified otherwise. 76 | * @return success, Whether the virtual gamepad button was successfully bound. 77 | * @link [love.joystick.setGamepadMapping](https://love2d.org/wiki/love.joystick.setGamepadMapping) 78 | */ 79 | function setGamepadMapping( 80 | guid: string, 81 | button: GamepadButton, 82 | inputtype: JoystickInputType, 83 | inputindex: number, 84 | hatdirection?: JoystickHat, 85 | ): boolean; 86 | 87 | /** 88 | * Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. 89 | * 90 | * @param guid The OS-dependent GUID for the type of Joystick the binding will affect. 91 | * @param axis The virtual gamepad axis to bind. 92 | * @param inputtype The type of input to bind the virtual gamepad axis to. 93 | * @param inputindex The index of the axis, button, or hat to bind the virtual gamepad axis to. 94 | * @param hatdirection The direction of the hat, if the virtual gamepad axis will be bound to a hat. Unspecified otherwise. 95 | * @return success, Whether the virtual gamepad button was successfully bound. 96 | * @link [love.joystick.setGamepadMapping](https://love2d.org/wiki/love.joystick.setGamepadMapping) 97 | */ 98 | function setGamepadMapping( 99 | guid: string, 100 | axis: GamepadAxis, 101 | inputtype: JoystickInputType, 102 | inputindex: number, 103 | hatdirection?: JoystickHat, 104 | ): boolean; 105 | } 106 | -------------------------------------------------------------------------------- /typings/love.graphics/types/Video.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.graphics" { 2 | import { Source } from "love.audio"; 3 | import { VideoStream } from "love.video"; 4 | 5 | /** 6 | * A drawable video. 7 | * @link [Video](https://love2d.org/wiki/Video) 8 | */ 9 | interface Video extends Drawable<"Video"> { 10 | /** 11 | * Gets the width and height of the Video in pixels. 12 | * 13 | * @return width, The width of the Video. 14 | * @return height, The height of the video. 15 | * @link [Video:getDimensions](https://love2d.org/wiki/Video:getDimensions) 16 | * @since 0.10.0 17 | */ 18 | getDimensions(): LuaMultiReturn<[width: number, height: number]>; 19 | 20 | /** 21 | * Gets the scaling filters used when drawing the Video. 22 | * 23 | * @return min, The filter mode used when scaling the Video down. 24 | * @return mag, The filter mode used when scaling the Video up. 25 | * @return anisotropy, Maximum amount of anisotropic filtering used. 26 | * @link [Video:getFilter](https://love2d.org/wiki/Video:getFilter) 27 | * @since 0.10.0 28 | */ 29 | getFilter(): LuaMultiReturn< 30 | [min: FilterMode, mag: FilterMode, anisotropy: number] 31 | >; 32 | 33 | /** 34 | * Gets the height of the Video in pixels. 35 | * 36 | * @return height, The height of the Video. 37 | * @link [Video:getHeight](https://love2d.org/wiki/Video:getHeight) 38 | * @since 0.10.0 39 | */ 40 | getHeight(): number; 41 | 42 | /** 43 | * Gets the audio Source used for playing back the video's audio. May return _nil/undefined_ 44 | * if the video has no audio, or if Video:setSource is called with a _nil/undefined_ argument. 45 | * 46 | * @return source, The audio Source used for audio playback, or _nil/undefined_ if the video has no audio. 47 | * @link [Video:getSource](https://love2d.org/wiki/Video:getSource) 48 | * @since 0.10.0 49 | */ 50 | getSource(): Source | undefined; 51 | 52 | /** 53 | * Gets the VideoStream object used for decoding and controlling the video. 54 | * 55 | * @return stream, The VideoStream used for decoding and controlling the video. 56 | * @link [Video:getStream](https://love2d.org/wiki/Video:getStream) 57 | * @since 0.10.0 58 | */ 59 | getStream(): VideoStream; 60 | 61 | /** 62 | * Gets the width of the Video in pixels. 63 | * 64 | * @return width, The width of the Video. 65 | * @link [Video:getWidth](https://love2d.org/wiki/Video:getWidth) 66 | * @since 0.10.0 67 | */ 68 | getWidth(): number; 69 | 70 | /** 71 | * Gets whether the Video is currently playing. 72 | * 73 | * @return playing, Whether the video is playing. 74 | * @link [Video:isPlaying](https://love2d.org/wiki/Video:isPlaying) 75 | * @since 0.10.0 76 | */ 77 | isPlaying(): boolean; 78 | 79 | /** 80 | * Pauses the Video. 81 | * 82 | * @link [Video:pause](https://love2d.org/wiki/Video:pause) 83 | * @since 0.10.0 84 | */ 85 | pause(): void; 86 | 87 | /** 88 | * Starts playing the Video. In order for the video to appear onscreen it must be 89 | * drawn with love.graphics.draw. 90 | * 91 | * @link [Video:play](https://love2d.org/wiki/Video:play) 92 | * @since 0.10.0 93 | */ 94 | play(): void; 95 | 96 | /** 97 | * Rewinds the Video to the beginning. 98 | * 99 | * @link [Video:rewind](https://love2d.org/wiki/Video:rewind) 100 | * @since 0.10.0 101 | */ 102 | rewind(): void; 103 | 104 | /** 105 | * Sets the current playback position of the Video. 106 | * 107 | * @param offset The time in seconds since the beginning of the Video. 108 | * @link [Video:seek](https://love2d.org/wiki/Video:seek) 109 | * @since 0.10.0 110 | */ 111 | seek(offset: number): void; 112 | 113 | /** 114 | * Sets the scaling filters used when drawing the Video. 115 | * 116 | * @param min The filter mode used when scaling the Video down. 117 | * @param mag The filter mode used when scaling the Video up. 118 | * @param anisotropy Maximum amount of anisotropic filtering used. 119 | * @link [Video:setFilter](https://love2d.org/wiki/Video:setFilter) 120 | * @since 0.10.0 121 | */ 122 | setFilter(min: FilterMode, mag: FilterMode, anisotropy?: number): void; 123 | 124 | /** 125 | * Sets the audio Source used for playing back the video's audio. The audio Source 126 | * also controls playback speed and synchronization. 127 | * 128 | * @param source The audio Source used for audio playback. Leave blank to disable audio synchronization. 129 | * @link [Video:setSource](https://love2d.org/wiki/Video:setSource) 130 | * @since 0.10.0 131 | */ 132 | setSource(source?: Source): void; 133 | 134 | /** 135 | * Gets the current playback position of the Video. 136 | * 137 | * @param seconds The time in seconds since the beginning of the Video. 138 | * @link [Video:tell](https://love2d.org/wiki/Video:tell) 139 | * @since 0.10.0 140 | */ 141 | tell(seconds: number): void; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /typings/love.math/types/RandomGenerator.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.math" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * A random number generation object which has its own random state. 6 | * @link [RandomGenerator](https://love2d.org/wiki/RandomGenerator) 7 | */ 8 | interface RandomGenerator extends Type<"RandomGenerator"> { 9 | /** 10 | * Gets the state of the random number generator. 11 | * 12 | * The state is split into two numbers due to Lua's use of doubles for all number 13 | * values - doubles can't accurately represent integer values above 2^53. 14 | * 15 | * @return low, Integer number representing the lower 32 bits of the random number generator's 64 bit state value. 16 | * @return high, Integer number representing the higher 32 bits of the random number generator's 64 bit state value. 17 | * @link [RandomGenerator:getSeed](https://love2d.org/wiki/RandomGenerator:getSeed) 18 | */ 19 | getSeed(): LuaMultiReturn<[low: number, high: number]>; 20 | 21 | /** 22 | * Gets the current state of the random number generator. This returns an opaque 23 | * implementation-dependent string which is only useful for later use with 24 | * RandomGenerator:setState. 25 | * 26 | * This is different from RandomGenerator:getSeed in that getState gets the 27 | * RandomGenerator's current state, whereas getSeed gets the previously set seed 28 | * number. 29 | * 30 | * The value of the state string does not depend on the current operating system. 31 | * 32 | * @return state, The current state of the RandomGenerator object, represented as a string. 33 | * @link [RandomGenerator:getState](https://love2d.org/wiki/RandomGenerator:getState) 34 | */ 35 | getState(): string; 36 | 37 | /** 38 | * Generates a pseudo-random number in a platform independent manner. 39 | * 40 | * @return number, The pseudo random number. 41 | * @link [RandomGenerator:random](https://love2d.org/wiki/RandomGenerator:random) 42 | */ 43 | random(): number; 44 | 45 | /** 46 | * Generates a pseudo-random number in a platform independent manner. 47 | * 48 | * @param max The maximum possible value it should return. 49 | * @return number, The pseudo-random integer number. 50 | * @link [RandomGenerator:random](https://love2d.org/wiki/RandomGenerator:random) 51 | */ 52 | random(max: number): number; 53 | 54 | /** 55 | * Generates a pseudo-random number in a platform independent manner. 56 | * 57 | * @param min The minimum possible value it should return. 58 | * @param max The maximum possible value it should return. 59 | * @return number, The pseudo-random integer number. 60 | * @link [RandomGenerator:random](https://love2d.org/wiki/RandomGenerator:random) 61 | */ 62 | random(min: number, max: number): number; 63 | 64 | /** 65 | * Get a normally distributed pseudo random number. 66 | * 67 | * @param stddev Standard deviation of the distribution. 68 | * @param mean The mean of the distribution. 69 | * @return number, Normally distributed random number with variance (stddev)² and the specified mean. 70 | * @link [RandomGenerator:randomNormal](https://love2d.org/wiki/RandomGenerator:randomNormal) 71 | */ 72 | randomNormal(stddev?: number, mean?: number): number; 73 | 74 | /** 75 | * Sets the seed of the random number generator using the specified integer 76 | * number. 77 | * 78 | * @param seed The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53]. 79 | * @link [RandomGenerator:setSeed](https://love2d.org/wiki/RandomGenerator:setSeed) 80 | */ 81 | setSeed(seed: number): void; 82 | 83 | /** 84 | * Sets the seed of the random number generator using the specified integer 85 | * number. 86 | * 87 | * @param low The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1]. 88 | * @param high The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1]. 89 | * @link [RandomGenerator:setSeed](https://love2d.org/wiki/RandomGenerator:setSeed) 90 | */ 91 | setSeed(low: number, high?: number): void; 92 | 93 | /** 94 | * Sets the current state of the random number generator. The value used as an 95 | * argument for this function is an opaque implementation-dependent string and 96 | * should only originate from a previous call to RandomGenerator:getState. 97 | * 98 | * This is different from RandomGenerator:setSeed in that setState directly sets 99 | * the RandomGenerator's current implementation-dependent state, whereas setSeed 100 | * gives it a new seed value. 101 | * 102 | * The effect of the state string does not depend on the current operating system. 103 | * 104 | * @param state The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState. 105 | * @link [RandomGenerator:setState](https://love2d.org/wiki/RandomGenerator:setState) 106 | */ 107 | setState(state: string): void; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /typings/love.image/types/ImageData.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.image" { 2 | import { Data } from "love.data"; 3 | import { FileData } from "love.filesystem"; 4 | 5 | /** 6 | * Raw (decoded) image data. 7 | * @link [ImageData](https://love2d.org/wiki/ImageData) 8 | */ 9 | interface ImageData extends Data<"ImageData"> { 10 | /** 11 | * Encodes the ImageData and optionally writes it to the save directory. 12 | * 13 | * @param format The format to encode the image as. 14 | * @param filename The filename to write the file to. If unspecified, no file will be written but the FileData will still be returned. 15 | * @return filedata, The encoded image as a new FileData object. 16 | * @link [ImageData:encode](https://love2d.org/wiki/ImageData:encode) 17 | */ 18 | encode(format: ImageFormat, filename?: string): FileData; 19 | 20 | /** 21 | * Gets the width and height of the ImageData in pixels. 22 | * 23 | * @return width, The width of the ImageData in pixels. 24 | * @return height, The height of the ImageData in pixels. 25 | * @link [ImageData:getDimensions](https://love2d.org/wiki/ImageData:getDimensions) 26 | * @since 0.9.0 27 | */ 28 | getDimensions(): LuaMultiReturn<[width: number, height: number]>; 29 | 30 | /** 31 | * Gets the pixel format of the ImageData. 32 | * @return format, The pixel format the ImageData was created with. 33 | * @link [ImageData:getFormat](https://love2d.org/wiki/ImageData:getFormat) 34 | * @since 11.0 35 | */ 36 | getFormat(): PixelFormat; 37 | 38 | /** 39 | * Gets the height of the ImageData in pixels. 40 | * 41 | * @return height, The height of the ImageData in pixels. 42 | * @link [ImageData:getHeight](https://love2d.org/wiki/ImageData:getHeight) 43 | */ 44 | getHeight(): number; 45 | 46 | /** 47 | * Gets the color of a pixel at a specific position in the image. 48 | * 49 | * Valid x and y values start at 0 and go up to image width and height minus 1. 50 | * Non-integer values are floored. 51 | * 52 | * @param x The position of the pixel on the x-axis. 53 | * @param y The position of the pixel on the y-axis. 54 | * @return r, The red component. 55 | * @return g, The green component. 56 | * @return b, The blue component. 57 | * @return a, The alpha component. 58 | * @link [ImageData:getPixel](https://love2d.org/wiki/ImageData:getPixel) 59 | */ 60 | getPixel( 61 | x: number, 62 | y: number, 63 | ): LuaMultiReturn<[r: number, g: number, b: number, a: number]>; 64 | 65 | /** 66 | * Gets the width of the ImageData in pixels. 67 | * 68 | * @return width, The width of the ImageData in pixels. 69 | * @link [ImageData:getWidth](https://love2d.org/wiki/ImageData:getWidth) 70 | */ 71 | getWidth(): number; 72 | 73 | /** 74 | * Transform an image by applying a function to every pixel. 75 | * 76 | * This function is a higher order function. It takes another function as a 77 | * parameter, and calls it once for each pixel in the ImageData. 78 | * 79 | * The function parameter is called with six parameters for each pixel in turn. 80 | * The parameters are numbers that represent the x and y coordinates of the pixel 81 | * and its red, green, blue and alpha values. The function parameter can return up 82 | * to four number values, which become the new r, g, b and a values of the pixel. 83 | * If the function returns fewer values, the remaining components are set to 0. 84 | * 85 | * @param pixelFunction Function parameter to apply to every pixel. 86 | * @link [ImageData:mapPixel](https://love2d.org/wiki/ImageData:mapPixel) 87 | */ 88 | mapPixel(pixelFunction: Function): void; 89 | 90 | /** 91 | * Paste into ImageData from another source ImageData. 92 | * 93 | * @param source Source ImageData from which to copy. 94 | * @param dx Destination top-left position on x-axis. 95 | * @param dy Destination top-left position on y-axis. 96 | * @param sx Source top-left position on x-axis. 97 | * @param sy Source top-left position on y-axis. 98 | * @param sw Source width. 99 | * @param sh Source height. 100 | * @link [ImageData:paste](https://love2d.org/wiki/ImageData:paste) 101 | */ 102 | paste( 103 | source: ImageData, 104 | dx: number, 105 | dy: number, 106 | sx: number, 107 | sy: number, 108 | sw: number, 109 | sh: number, 110 | ): void; 111 | 112 | /** 113 | * Sets the color of a pixel at a specific position in the image. 114 | * 115 | * Valid x and y values start at 0 and go up to image width and height minus 1. 116 | * 117 | * @param x The position of the pixel on the x-axis. 118 | * @param y The position of the pixel on the y-axis. 119 | * @param r The red component (0-255). 120 | * @param g The green component (0-255). 121 | * @param b The blue component (0-255). 122 | * @param a The alpha component (0-255). 123 | * @link [ImageData:setPixel](https://love2d.org/wiki/ImageData:setPixel) 124 | */ 125 | setPixel( 126 | x: number, 127 | y: number, 128 | r: number, 129 | g: number, 130 | b: number, 131 | a: number, 132 | ): void; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /typings/love.physics/types/RevoluteJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Allow two Bodies to revolve around a shared point. 4 | * @link [RevoluteJoint](https://love2d.org/wiki/RevoluteJoint) 5 | */ 6 | interface RevoluteJoint extends Joint<"RevoluteJoint"> { 7 | /** 8 | * Checks whether the limits are enabled. 9 | * 10 | * @return enabled, True if enabled, false otherwise. 11 | * @link [RevoluteJoint:areLimitsEnabled](https://love2d.org/wiki/RevoluteJoint:areLimitsEnabled) 12 | */ 13 | areLimitsEnabled(): boolean; 14 | 15 | /** 16 | * Enables or disables the joint limits. 17 | * 18 | * @param enable True to enable, false to disable. 19 | * @link [RevoluteJoint:setLimitsEnabled](https://love2d.org/wiki/RevoluteJoint:setLimitsEnabled) 20 | */ 21 | setLimitsEnabled(enable: boolean): void; 22 | 23 | /** 24 | * Starts or stops the joint motor. 25 | * 26 | * @param enable True to enable, false to disable. 27 | * @link [RevoluteJoint:setMotorEnabled](https://love2d.org/wiki/RevoluteJoint:setMotorEnabled) 28 | */ 29 | setMotorEnabled(enable: boolean): void; 30 | 31 | /** 32 | * Get the current joint angle. 33 | * 34 | * @return angle, The joint angle in radians. 35 | * @link [RevoluteJoint:getJointAngle](https://love2d.org/wiki/RevoluteJoint:getJointAngle) 36 | */ 37 | getJointAngle(): number; 38 | 39 | /** 40 | * Get the current joint angle speed. 41 | * 42 | * @return s, Joint angle speed in radians/second. 43 | * @link [RevoluteJoint:getJointSpeed](https://love2d.org/wiki/RevoluteJoint:getJointSpeed) 44 | */ 45 | getJointSpeed(): number; 46 | 47 | /** 48 | * Gets the joint limits. 49 | * 50 | * @return lower, The lower limit, in radians. 51 | * @return upper, The upper limit, in radians. 52 | * @link [RevoluteJoint:getLimits](https://love2d.org/wiki/RevoluteJoint:getLimits) 53 | */ 54 | getLimits(): LuaMultiReturn<[lower: number, upper: number]>; 55 | 56 | /** 57 | * Gets the lower limit. 58 | * 59 | * @return lower, The lower limit, in radians. 60 | * @link [RevoluteJoint:getLowerLimit](https://love2d.org/wiki/RevoluteJoint:getLowerLimit) 61 | */ 62 | getLowerLimit(): number; 63 | 64 | /** 65 | * Gets the maximum motor force. 66 | * 67 | * @return f, The maximum motor force, in Nm. 68 | * @link [RevoluteJoint:getMaxMotorTorque](https://love2d.org/wiki/RevoluteJoint:getMaxMotorTorque) 69 | */ 70 | getMaxMotorTorque(): number; 71 | 72 | /** 73 | * Gets the motor speed. 74 | * 75 | * @return s, The motor speed, radians per second. 76 | * @link [RevoluteJoint:getMotorSpeed](https://love2d.org/wiki/RevoluteJoint:getMotorSpeed) 77 | */ 78 | getMotorSpeed(): number; 79 | 80 | /** 81 | * Get the current motor force. 82 | * 83 | * @return f, The current motor force, in Nm. 84 | * @link [RevoluteJoint:getMotorTorque](https://love2d.org/wiki/RevoluteJoint:getMotorTorque) 85 | */ 86 | getMotorTorque(): number; 87 | 88 | /** 89 | * Gets the upper limit. 90 | * 91 | * @return upper, The upper limit, in radians. 92 | * @link [RevoluteJoint:getUpperLimit](https://love2d.org/wiki/RevoluteJoint:getUpperLimit) 93 | */ 94 | getUpperLimit(): number; 95 | 96 | /** 97 | * Checks whether limits are enabled. 98 | * @return enabled, True if enabled, false otherwise. 99 | * @link [RevoluteJoint:hasLimitsEnabled](https://love2d.org/wiki/RevoluteJoint:hasLimitsEnabled) 100 | * @deprecated since 11.0. This function has been renamed to RevoluteJoint:areLimitsEnabled. 101 | */ 102 | hasLimitsEnabled(): boolean; 103 | 104 | /** 105 | * Checks whether the motor is enabled. 106 | * 107 | * @return enabled, True if enabled, false if disabled. 108 | * @link [RevoluteJoint:isMotorEnabled](https://love2d.org/wiki/RevoluteJoint:isMotorEnabled) 109 | */ 110 | isMotorEnabled(): boolean; 111 | 112 | /** 113 | * Sets the limits. 114 | * 115 | * @param lower The lower limit, in radians. 116 | * @param upper The upper limit, in radians. 117 | * @link [RevoluteJoint:setLimits](https://love2d.org/wiki/RevoluteJoint:setLimits) 118 | */ 119 | setLimits(lower: number, upper: number): void; 120 | 121 | /** 122 | * Sets the lower limit. 123 | * 124 | * @param lower The lower limit, in radians. 125 | * @link [RevoluteJoint:setLowerLimit](https://love2d.org/wiki/RevoluteJoint:setLowerLimit) 126 | */ 127 | setLowerLimit(lower: number): void; 128 | 129 | /** 130 | * Set the maximum motor force. 131 | * 132 | * @param f The maximum motor force, in Nm. 133 | * @link [RevoluteJoint:setMaxMotorTorque](https://love2d.org/wiki/RevoluteJoint:setMaxMotorTorque) 134 | */ 135 | setMaxMotorTorque(f: number): void; 136 | 137 | /** 138 | * Sets the motor speed. 139 | * 140 | * @param s The motor speed, radians per second. 141 | * @link [RevoluteJoint:setMotorSpeed](https://love2d.org/wiki/RevoluteJoint:setMotorSpeed) 142 | */ 143 | setMotorSpeed(s: number): void; 144 | 145 | /** 146 | * Sets the upper limit. 147 | * 148 | * @param upper The upper limit, in radians. 149 | * @link [RevoluteJoint:setUpperLimit](https://love2d.org/wiki/RevoluteJoint:setUpperLimit) 150 | */ 151 | setUpperLimit(upper: number): void; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /typings/love.thread/types/Channel.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.thread" { 2 | import { Type } from "love"; 3 | 4 | /** 5 | * An object which can be used to send and receive data between different threads. 6 | * @link [Channel](https://love2d.org/wiki/Channel) 7 | */ 8 | interface Channel extends Type<"Channel"> { 9 | /** 10 | * Clears all the messages in the Channel queue. 11 | * 12 | * @link [Channel:clear](https://love2d.org/wiki/Channel:clear) 13 | */ 14 | clear(): void; 15 | 16 | /** 17 | * Retrieves the value of a Channel message and removes it from the message queue. 18 | * 19 | * It waits until a message is in the queue then returns the message value. 20 | * 21 | * @return value, The contents of the message. 22 | * @link [Channel:demand](https://love2d.org/wiki/Channel:demand) 23 | */ 24 | demand(): T; 25 | 26 | /** 27 | * Retrieves the value of a Channel message and removes it from the message queue. 28 | * 29 | * It waits until a message is in the queue then returns the message value. 30 | * 31 | * @param timeout The maximum amount of time to wait. 32 | * @return value, The contents of the message or _nil/undefined_ if the timeout expired. 33 | * @link [Channel:demand](https://love2d.org/wiki/Channel:demand) 34 | */ 35 | demand(timeout: number): T | undefined; 36 | 37 | /** 38 | * Retrieves the number of messages in the thread Channel queue. 39 | * 40 | * @return count, The number of messages in the queue. 41 | * @link [Channel:getCount](https://love2d.org/wiki/Channel:getCount) 42 | */ 43 | getCount(): number; 44 | 45 | /** 46 | * Gets whether a pushed value has been popped or otherwise removed from the 47 | * Channel. 48 | * 49 | * @param id An id value previously returned by Channel:push. 50 | * @return hasread, Whether the value represented by the id has been removed from the Channel via Channel:pop, Channel:demand, or Channel:clear. 51 | * @link [Channel:hasRead](https://love2d.org/wiki/Channel:hasRead) 52 | */ 53 | hasRead(id: number): boolean; 54 | 55 | /** 56 | * Retrieves the value of a Channel message, but leaves it in the queue. 57 | * 58 | * It returns _nil/undefined_ if there's no message in the queue. 59 | * 60 | * @return value, The contents of the message. 61 | * @link [Channel:peek](https://love2d.org/wiki/Channel:peek) 62 | */ 63 | peek(): T | undefined; 64 | 65 | /** 66 | * Executes the specified function atomically with respect to this Channel. 67 | * 68 | * Calling multiple methods in a row on the same Channel is often useful. However 69 | * if multiple Threads are calling this Channel's methods at the same time, the 70 | * different calls on each Thread might end up interleaved (e.g. one or more of 71 | * the second thread's calls may happen in between the first thread's calls.) 72 | * 73 | * This method avoids that issue by making sure the Thread calling the method has 74 | * exclusive access to the Channel until the specified function has returned. 75 | * 76 | * @param func The export 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. 77 | * @param arg1 Additional arguments that the given function will receive when it is called. 78 | * @param ... Additional arguments that the given function will receive when it is called. 79 | * @return ret1, The first return value of the given export function (if any.) 80 | * @return ..., Any other return values. 81 | * @link [Channel:performAtomic](https://love2d.org/wiki/Channel:performAtomic) 82 | */ 83 | performAtomic any[]>( 84 | func: T, 85 | ...args: Parameters 86 | ): ReturnType; 87 | 88 | /** 89 | * Retrieves the value of a Channel message and removes it from the message queue. 90 | * 91 | * It returns _nil/undefined_ if there are no messages in the queue. 92 | * 93 | * @return value, The contents of the message. 94 | * @link [Channel:pop](https://love2d.org/wiki/Channel:pop) 95 | */ 96 | pop(): T | undefined; 97 | 98 | /** 99 | * Send a message to the thread Channel. 100 | * 101 | * See any for the list of supported types. 102 | * 103 | * @param value The contents of the message. 104 | * @link [Channel:push](https://love2d.org/wiki/Channel:push) 105 | */ 106 | push(value: T): void; 107 | 108 | /** 109 | * Send a message to the thread Channel and wait for a thread to accept it. 110 | * 111 | * See any for the list of supported types. 112 | * 113 | * @param value The contents of the message. 114 | * @return success, Whether the message was successfully supplied (always true). 115 | * @link [Channel:supply](https://love2d.org/wiki/Channel:supply) 116 | */ 117 | supply(value: T): boolean; 118 | 119 | /** 120 | * Send a message to the thread Channel and wait for a thread to accept it. 121 | * 122 | * See any for the list of supported types. 123 | * 124 | * @param value The contents of the message. 125 | * @param timeout The maximum amount of time to wait. 126 | * @return success, Whether the message was successfully supplied before the timeout expired. 127 | * @link [Channel:supply](https://love2d.org/wiki/Channel:supply) 128 | */ 129 | supply(value: T, timeout: number): boolean; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /typings/love.physics/types/PrismaticJoint.d.ts: -------------------------------------------------------------------------------- 1 | declare module "love.physics" { 2 | /** 3 | * Restricts relative motion between Bodies to one shared axis. 4 | * @link [PrismaticJoint](https://love2d.org/wiki/PrismaticJoint) 5 | */ 6 | interface PrismaticJoint extends Joint<"PrismaticJoint"> { 7 | /** 8 | * Checks whether the limits are enabled. 9 | * 10 | * @return enabled, True if enabled, false otherwise. 11 | * @link [PrismaticJoint:areLimitsEnabled](https://love2d.org/wiki/PrismaticJoint:areLimitsEnabled) 12 | */ 13 | areLimitsEnabled(): boolean; 14 | 15 | /** 16 | * Gets the world-space axis vector of the Prismatic Joint. 17 | * 18 | * @return x, The x-axis coordinate of the world-space axis vector. 19 | * @return y, The y-axis coordinate of the world-space axis vector. 20 | * @link [PrismaticJoint:getAxis](https://love2d.org/wiki/PrismaticJoint:getAxis) 21 | */ 22 | getAxis(): LuaMultiReturn<[x: number, y: number]>; 23 | 24 | /** 25 | * Get the current joint angle speed. 26 | * 27 | * @return s, Joint angle speed in meters/second. 28 | * @link [PrismaticJoint:getJointSpeed](https://love2d.org/wiki/PrismaticJoint:getJointSpeed) 29 | */ 30 | getJointSpeed(): number; 31 | 32 | /** 33 | * Get the current joint translation. 34 | * 35 | * @return t, Joint translation, usually in meters. 36 | * @link [PrismaticJoint:getJointTranslation](https://love2d.org/wiki/PrismaticJoint:getJointTranslation) 37 | */ 38 | getJointTranslation(): number; 39 | 40 | /** 41 | * Gets the joint limits. 42 | * 43 | * @return lower, The lower limit, usually in meters. 44 | * @return upper, The upper limit, usually in meters. 45 | * @link [PrismaticJoint:getLimits](https://love2d.org/wiki/PrismaticJoint:getLimits) 46 | */ 47 | getLimits(): LuaMultiReturn<[lower: number, upper: number]>; 48 | 49 | /** 50 | * Gets the lower limit. 51 | * 52 | * @return lower, The lower limit, usually in meters. 53 | * @link [PrismaticJoint:getLowerLimit](https://love2d.org/wiki/PrismaticJoint:getLowerLimit) 54 | */ 55 | getLowerLimit(): number; 56 | 57 | /** 58 | * Gets the maximum motor force. 59 | * 60 | * @return f, The maximum motor force, usually in N. 61 | * @link [PrismaticJoint:getMaxMotorForce](https://love2d.org/wiki/PrismaticJoint:getMaxMotorForce) 62 | */ 63 | getMaxMotorForce(): number; 64 | 65 | /** 66 | * Get the current motor force. 67 | * 68 | * @return f, The current motor force, usually in N. 69 | * @link [PrismaticJoint:getMotorForce](https://love2d.org/wiki/PrismaticJoint:getMotorForce) 70 | */ 71 | getMotorForce(): number; 72 | 73 | /** 74 | * Gets the motor speed. 75 | * 76 | * @return s, The motor speed, usually in meters per second. 77 | * @link [PrismaticJoint:getMotorSpeed](https://love2d.org/wiki/PrismaticJoint:getMotorSpeed) 78 | */ 79 | getMotorSpeed(): number; 80 | 81 | /** 82 | * Gets the upper limit. 83 | * 84 | * @return upper, The upper limit, usually in meters. 85 | * @link [PrismaticJoint:getUpperLimit](https://love2d.org/wiki/PrismaticJoint:getUpperLimit) 86 | */ 87 | getUpperLimit(): number; 88 | 89 | /** 90 | * Checks whether limits are enabled. 91 | * @return enabled, True if enabled, false otherwise. 92 | * @link [PrismaticJoint:hasLimitsEnabled](https://love2d.org/wiki/PrismaticJoint:hasLimitsEnabled) 93 | * @deprecated since 11.0. This function has been renamed to PrismaticJoint:areLimitsEnabled. 94 | */ 95 | hasLimitsEnabled(): boolean; 96 | 97 | /** 98 | * Checks whether the motor is enabled. 99 | * 100 | * @return enabled, True if enabled, false if disabled. 101 | * @link [PrismaticJoint:isMotorEnabled](https://love2d.org/wiki/PrismaticJoint:isMotorEnabled) 102 | */ 103 | isMotorEnabled(): boolean; 104 | 105 | /** 106 | * Sets the limits. 107 | * 108 | * @param lower The lower limit, usually in meters. 109 | * @param upper The upper limit, usually in meters. 110 | * @link [PrismaticJoint:setLimits](https://love2d.org/wiki/PrismaticJoint:setLimits) 111 | */ 112 | setLimits(lower: number, upper: number): void; 113 | 114 | /** 115 | * Enables or disables the limits of the joint. 116 | * 117 | * @param enable True to enable, false to disable. 118 | * @link [PrismaticJoint:setLimitsEnabled](https://love2d.org/wiki/PrismaticJoint:setLimitsEnabled) 119 | */ 120 | setLimitsEnabled(enable: boolean): void; 121 | 122 | /** 123 | * Sets the lower limit. 124 | * 125 | * @param lower The lower limit, usually in meters. 126 | * @link [PrismaticJoint:setLowerLimit](https://love2d.org/wiki/PrismaticJoint:setLowerLimit) 127 | */ 128 | setLowerLimit(lower: number): void; 129 | 130 | /** 131 | * Set the maximum motor force. 132 | * 133 | * @param f The maximum motor force, usually in N. 134 | * @link [PrismaticJoint:setMaxMotorForce](https://love2d.org/wiki/PrismaticJoint:setMaxMotorForce) 135 | */ 136 | setMaxMotorForce(f: number): void; 137 | 138 | /** 139 | * Starts or stops the joint motor. 140 | * 141 | * @param enable True to enable, false to disable. 142 | * @link [PrismaticJoint:setMotorEnabled](https://love2d.org/wiki/PrismaticJoint:setMotorEnabled) 143 | */ 144 | setMotorEnabled(enable: boolean): void; 145 | 146 | /** 147 | * Sets the motor speed. 148 | * 149 | * @param s The motor speed, usually in meters per second. 150 | * @link [PrismaticJoint:setMotorSpeed](https://love2d.org/wiki/PrismaticJoint:setMotorSpeed) 151 | */ 152 | setMotorSpeed(s: number): void; 153 | 154 | /** 155 | * Sets the upper limit. 156 | * 157 | * @param upper The upper limit, usually in meters. 158 | * @link [PrismaticJoint:setUpperLimit](https://love2d.org/wiki/PrismaticJoint:setUpperLimit) 159 | */ 160 | setUpperLimit(upper: number): void; 161 | } 162 | } 163 | --------------------------------------------------------------------------------