You are on page 1of 232
Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Callbacks jove.cont jove.load jove.update love. draw love. quit jove.run Input love. keypressed love. keyreleased love.textedited jove.textinput love. mousepressed jove.mousereleased jove.mousemoved love. mousefocus love. wheelmoved jove.touchmoved love. touchpressed love. touchreleased joystickpressed love. joystickreleased love. joystickaxis ‘ove. joystickhat love. joystickadded love. joystickremoved love. gamepadpressed love. gamepadreleased love. gamepadaxis Window ove.resize ove.visible jove.focus love.filedropped love.directorydropped Error handling jove.errhand love. threaderror jove.lowmemory love.conf If a file called conf.lua is present in your game folder (or .\ove file), it is run before the LOVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LOVE ‘boot’ script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff. love.conf( t ) t table ‘The love.conf function takes one argument: a table filled with all the default values which you can overwrite to your liking. If you want to change the default window size, for instance, do: function love.conf(t) t.window.width = 1024 t.window.heigh 768 end If you don't need the physics module or joystick module, do the following. function love.confi(t) t.modules. joystick = false ‘modules. physics = false end Setting unused modules to false is encouraged when you release your game. It reduces startup time slightly (especially if the joystick module is disabled) and reduces memory usage (slightly). Note that you cant disable love. filesystem; it's mandatory. The same goes for the love Callbacks module itself. love. graphics needs love.window to be enabled. event. teidentity (nil) string This flag determines the name of the save directory for filesystem your game. Note that you can only specify the name, not graphics he location where it will be created: t.identity = image igabe_HL3" -- Correct t.identity = "c:/Users/gabe/HL. joystick Incorrect Alternatively love.filesystem.setidentity can be keyboard Used to set the save directory outside of the config file. math t.version ("0.10.2") string tyersion should be a string, representing the version of mouse LOVE for which your game was made. It should be physics formatted as"X.V.Z' where X is the major release number, sound Y the minor, and Z the patch level. It allows LOVE to system display a warning if it isnt compatible. Its default is the thread version of LOVE running. timer t.console (false) boolean Determines wether a console should be opened alongside touch the game window (Windows only) or not. Note: On OSX video you can get console output by running LOVE through the window terminal. % boolean Sets whether the device accelerometer on 10S and Android -accelerometerjoystick should be exposed as a 3-axis Joystick. Disabling the (true) accelerometer when it's not used may reduce CPU usage. t.externalstorage boolean Sets whether files are saved in external storage (true) or (false) internal storage (false) on Android. t.gammacorrect (false) boolean Determines whether gamma-correct rendering is enabled, ‘when the system supports it. ‘window table It is possible to defer window creation until love.window.setNode is first called in your code. To do so, set t.window = nil in love.conf (or t.screen = nil in older versions.) If this is done, LOVE may crash if any function from love. graphics is called before the first love.window.setMode in your code. The t.window table ‘was named t.screen in versions prior to 0.9.0. The t.screen table doesnt exist in love.canf in 0.9.0, and the t.window table doesn't exist in love.conf in 0.8.0. This means love.conf will fail to execute (therefore it will fall back to default values) if care is not taken to use the correct table for the LOVE version being used. t.modules table ‘Module options. love.directorydropped Callback function triggered when a directory is dragged and dropped onto the window. love.directorydropped( path ) path string The full platform-dependent path to the directory. It can be used as an argument to love. filesystem.mount, in order to gain read access to the directory with love. filesystem. love.draw Callback function used to draw on the screen every frame. love.draw() love.errhand ‘The error handler, used to display error messages. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.errhand( msg ) msg string ‘The error message. love.filedropped Callback function triggered when a file is dragged and dropped onto the window. love.filedropped( file ) file File ‘The unopened File object representing the file that was dropped. love.focus Callback function triggered when window receives or loses focus. love.focus( focus ) focus boolean ‘True if the window gains focus, false if it loses focus. love.gamepadaxis Called when a Joystick’s virtual gamepad axis is moved. love. gamepadaxis( joystick, axis ) joystick Joystick The joystick object. axis GamepadAxis The virtual gamepad axis, love.gamepadpressed Called when a Joystick’s virtual gamepad button is pressed. love.gamepadpressed( joystick, button ) joystick Joystick The joystick object. button GamepadButton The virtual gamepad button. love.gamepadreleased Called when a Joystick’s virtual gamepad button is released. love.gamepadreleased( joystick, button ) Joystick Joystick The joystick object. button GamepadButton The virtual gamepad button. love.joystickadded Called when a Joystick is connected. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window This callback is also triggered after love. load for every Joystick which was already connected when the game started up. love. joystickadded( joystick ) joystick Joystick ‘The newly connected Joystick object. love.joystickaxis Called when a joystick axis moves. love. joystickaxis( joystick, axis, value ) joystick Joystick The joystick object. axis number The axis number. value number The new axis value, love.joystickhat Called when a joystick hat direction changes. love. joystickhat( joystick, hat, direction ) Joystick Joystick The joystick object. hat number ‘The hat number. direction JoystickHat — The new hat direction, love.joystickpressed Called when a joystick button is pressed. love. joystickpressed( joystick, button ) joystick number The joystick number, button number The button number. love.joystickreleased Called when a joystick button is released, love. joystickreleased( joystick, button ) joystick number The joystick number. button number ‘The button number. love.joystickremoved Called when a Joystick is disconnected. love. joystickremoved( joystick ) joystick Joystick ‘The now-disconnected Joystick object. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.keypressed Callback function triggered when a key is pressed. love.keypressed( key, scancode, isrepeat ) key KeyConstant Character of the pressed key. scancode Scancode _The scancode representing the pressed key. isrepeat boolean Whether this keypress event is a repeat. The delay between key repeats depends on the user's system settings. love.keyreleased Callback function triggered when a keyboard key is released. love.keyreleased( key ) key KeyConstant Character of the released key. love.keyreleased( key, scancode ) key KeyConstant Character of the released key. scancode Scancode ‘The scancode representing the released key. Callback function triggered when a keyboard key is released. love.keyreleased( key ) key KeyConstant Character of the released key. love.keyreleased( key, scancode ) key KeyConstant Character of the released key. scancode Scancode _The scancode representing the released key. love.load This function is called exactly once at the beginning of the game. love.load( arg ) arg table Command line arguments given to the game. love.lowmemory Callback function triggered when the system is running out of memory on mobile devices. ‘Mobile operating systems may forcefully kill the game if it uses too much memory, so any non-critical resource should be removed if possible (by setting all variables referencing the resources to nil, and calling collectgarbage()), when this event is triggered. Sounds and images in particular tend to use the most memory. Love. lowmemory() love.mousefocus Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Callback function triggered when window receives or loses mouse focus. love.mousefocus( focus ) focus boolean love.mousemoved Callback function triggered when the mouse is moved. Wether the window has mouse focus or not. love.mousemoved( x, y, dx, dy, istouch ) x number y number éx number éy number istouch boolean love.mousepressed ‘The mouse position on the x-axi ‘The mouse position on the y-axi ‘The amount moved along the x-axis since the last time love.mousemoved was called. ‘The amount moved along the y-axis since the last time love.mousemoved was called. ‘True if the mouse button press originated from a touchscreen touch: press. Callback function triggered when a mouse button is pressed, love.mousepressed( x, y, button, isTouch ) x y button isTouch love.mousereleased number number number boolean Mouse x position, in pixels. ‘Mouse y position, in pixels. ‘The button index that was pressed. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent ‘True if the mouse button press originated from a touchscreen touch-press. Callback function triggered when a mouse button is released. love.mousereleased( x, y, button, isTouch ) y button isTouch love. quit number number number boolean ‘Mouse x position, in pixels. Mouse y position, in pixels. ‘The button index that was released. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent. ‘True if the mouse button press originated from a touchscreen touch-release. Callback function triggered when the game is closed. r love. quit() Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Fr boolean Abort quitting. If true, do not close the game. love.resize Called when the window is resized, for example if the user resizes the window, or if love. window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size, Calls to love.window.setMode will only trigger this event if the width or height of the window after the call doesn't match the requested width and height. This can happen if a fullscreen mode is requested ‘which doesn't match any supported mode, or ifthe fullscreen type is ‘desktop’ and the requested width or height don't match the desktop resolution. love.resize( w, h ) w number The new width, h number The new height. love.run ‘The main function, containing the main loop. A sensible default is used when left out. love.run() love.textedited Called when the candidate text for an IME (Input Method Editor) has changed. ‘The candidate text is not the final text that the user will eventually choose. Use love.textinput for that. love.textedited( text, start, length ) text string The UTF-8 encoded unicode candidate text. start number The start cursor of the selected candidate text length number ‘The length of the selected candidate text. May be 0. love.textinput Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text “@” will be generated. love.textinput( text ) text string ‘The UTF-8 encoded unicode text. love.threaderror Callback function triggered when a Thread encounters an error. love.threaderror( thread, errorstr ) ‘thread Thread ‘The thread which produced the error. errorstr string ‘The error message. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.touchmoved Callback function triggered when a touch press moves inside the touch screen. love.touchmoved( id, x, y, dx, dy, pressure ) id Light userdata x number y number dx number dy number pressure number love.touchpressed ‘The identifier for the touch press. ‘The x-axis position of the touch inside the window, in pixels. ‘The y-axis position of the touch inside the window, in pixels. ‘The x-axis movement of the touch inside the window, in pixels. ‘The y-axis movement of the touch inside the window, in pixels. ‘The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1 Callback function triggered when the touch screen is touched. love.touchpressed( id, x, y, dx, dy, pressure ) id Light userdata x number y number dx number dy number pressure number love.touchreleased ‘The identifier for the touch press. ‘The x-axis position of the touch press inside the window, in pixels. ‘The y-axis position of the touch press inside the window, in pixels. ‘The x-axis movement of the touch press inside the window, in pixels. This should always be zero. ‘The y-axis movement of the touch press inside the window, in pixels. This should always be zero. ‘The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1 Callback function triggered when the touch screen stops being touched. love.touchreleased( id, x, y, dx, dy, pressure ) id Light userdata x number y number dx number dy number pressure number love.update ‘The identifier for the touch press. ‘The x-axis position of the touch inside the window, in pixels. ‘The y-axis position of the touch inside the window, in pixels. ‘The x-axis movement of the touch inside the window, in pixels. The y-axis movement of the touch inside the window, in pixels. ‘The amount of pressure being applied. Most touch screens arent pressure sensitive, in which case the pressure will be 1 Callback function triggered when a key is pressed. love.update( dt ) dt number Time since the last update in seconds. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.visible Callback function triggered when window is minimized/hidden or unminimized by the user. love.visible( visible ) visible boolean ‘True if the window is visible, false if it isnt. love.wheelmoved Callback function triggered when the mouse wheel is moved. love.wheelmoved( x, y ) x number Amount of horizontal mouse wheel movement. Positive values indicate movement to the right. y number Amount of vertical mouse wheel movement. Positive values indicate upward movement. Data The superclass of all data. Functions Data:getPointer Data:getSize Data:getString Supertypes Object Data:getPointer Gets a pointer to the Data. pointer = Data:getPointer() pointer ight ‘Arraw pointer to the Data. userdata Data:getSize Gets the size of the Data. size = Data:getSize() size number ‘The size of the Data in bytes. Data:getString Gets the full Data as a string. data = Data:getString() data string ‘The raw data, callbacks Drawable ase Superclass for all things that can be drawn on screen. This is an abstract type that cantt be created ew directly. filesystem ¥ srePheS upertypes image eres Joystick 3 keyboard math mouse i piysics = Object sound The superclass of all LOVE types. system thread Functions Object:type touch Object:typeor ae ject: type window Object:type Gets the type of the object as a string. type = Object:type() type string The type as a string. Object:typeOf Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. b = Object:typeof( name ) b boolean ‘True if the object is of the specified type, false otherwise. name string ‘The name of the type to check for. love.audio ypes Functions love. audio. get/setDistanceModel love. audio. get/setDopplerScale love audio. getSourceCount love. audio. get/setOrientation love. audio. get/setPosition love audio. get/setVelocity love audio. get/setVolume jove. audio. pause jove.audio.play love audio. resume love. audio.rewind jove.audio.stop Enums DistanceModel SourceType Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window TimeUnit love.audio.getDistanceModel Returns the distance attenuation model. model = love.audio.getDistanceModel() model DistanceModel The current distance model. The default is inverseclamped. love.audio.getDopplerScale Gets the current global scale factor for velocity-based doppler effects. scale = love.audio.getDopplerscale() scale number The current doppler scale factor. love.audio.getOrientation Returns the orientation of the listener. fx, fy, fz, ux, uy, uz = love.audio.getOrientation() fx number ‘The X component of the forward vector of the listener orientation, fy number The Y component of the forward vector of the listener orientation, fz number ‘The Z component of the forward vector of the listener orientation, ux number The X component of the up vector of the listener orientation, uy number ‘The Y component of the up vector of the listener orientation. uz number ‘The Z component of the up vector of the listener orientation. love.audio.getPosition Returns the position of the listener. X, y, z = love.audio.getPosition() Xx number The X position of the listener. y number The ¥ position of the listener. z number The Z position of the listener. love.audio.getSourceCount Returns the number of sources which are currently playing or paused. numSources = love.audio.getSourceCount() numsources number ‘The number of sources which are currently playing or paused. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.audio.getVelocity Returns the velocity of the listener. x, y, z= love.audio.getVelocity() x number The X velocity of the listener. y number The Y velocity of the listener. Zz number ‘The Z velocity of the listener. love.audio.getVolume Returns the master volume. volume = love.audio.getVolume() volume number ‘The current master volume. love.audio.newSource Creates a new Source from a file or SoundData. Sources created from SoundData are always static, source = love.audio.newSource( filename, type ) source Source ‘Anew Source that can play the specified audio. filename string ‘The filepath to create a Source from. ‘type ("stream") SourceType Streaming or static source. source = love.audio.newSource( file, type ) source Source ‘Anew Source that can play the specified audio. file File A File pointing to an audio file. ‘type (“'stream") SourceType Streaming or static source. source = love.audio.newSource( decoder, type ) source Source ‘Anew Source that can play the specified audio. Decoder ‘The Decoder to create a Source from. SourceType Streaming or static source. source = love.audio.newSource( soundData ) source Source ‘Anew Source that can play the specified audio. The SourceType of the returned audio is “static’. soundData SoundData _—_—The SoundData to create a Source from. source = love.audio.newSource( fileData ) source Source ‘Anew Source that can play the specified audio. filepata FileData ‘The FileData to create a Source from. love.audio.pause Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window Pauses currently played Sources. love. audio. pause() love. audio.pause( source ) source Source ‘The source on which to pause the playback. love.audio.play Plays the specified Source. love.audio.play( source ) source Source The Source to play. love.audio.resume Resumes all audio love. audio. resume() love.audio.resume( source ) source Source ‘The source on which to resume the playback. love.audio.rewind Rewinds all playing audio. love. audio. rewind() love.audio.rewind( source ) source Source ‘The source to rewind. love.audio.setDistanceModel Sets the distance attenuation model. love.audio.setDistanceModel( model ) model DistanceModel The new distance model. love.audio.setDopplerScale Sets a global scale factor for velocity-based doppler effects. The default scale value is 1. love. audio. setDopplerScale( scale ) scale number ‘The new doppler scale factor. The scale must be greater than 0. Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window love.audio.setOrientation Sets the orientation of the listener. love. audio. setOrientation( fx, fy, fz, ux, uy, uz ) fx number ‘The X component of the forward vector of the listener orientation, fy number ‘The Y component of the forward vector of the listener orientation, 2 number The Z component of the forward vector of the listener orientation, ux number ‘The X component of the up vector of the listener orientation. uy number ‘The Y component of the up vector of the listener orientation, uz number ‘The Z component of the up vector of the listener orientation. love.audio.setPosition Sets the position of the listener, which determines how sounds play. love.audio.setPosition( x, ys z ) x number ‘The X position of the listener. y number The Y position of the listener. 2 number ‘The Z position of the listener. love.audio.setVelocity Sets the velocity of the listener. love.audio.setVelocity( x, y, z ) x number The X velocity of the listener. y number The Y velocity of the listener. z number The Z velocity of the listener. love.audio.setVolume Sets the master volume. love.audio.setVolume( volume ) volume number 1.0f is max and 0.0f is off. love.audio.stop Stops currently played sources. love. audio. stop() love.audio.stop( source ) source Source ‘The source on which to stop the playback. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Source ‘A Source represents audio you can play back. You can do interesting things with Sources, like set the volume, pitch, and its position relative to the listener. Constructors love. audio.newSource Functions Source:ctone Source:get/setAttenuationDistances Source:getChannels Source:get/setCone Source:get/setDirection Source:getDuration Source:get/setPitch Source:get/ setPosition Source:get/setRolloft Source:getType Source:get/setVelocity Source:get/setVolume Source: get/setVolumeLimits Source:is/setLooping Source:isPaused Source:isPlaying Source:isStopped Source:pause Source:play Source:resume Source:rewind Source:stop Source:tell/seek Supertypes Object Source:clone Creates an identical copy of the Source in the stopped state. Static Sources will use significantly less memory and take much Less time to be created if Source:clone is used to create them instead of love.audio.newSource, so this method should be preferred when making multiple Sources which play the same sound. Cloned Sources inherit all the set-able state of the original Source, but they are initialized stopped. source = Sourci ‘Lone() source Source ‘The new identical copy of this Source. Source:getAttenuationDistances Returns the reference and maximum distance of the source. ref, max = Source:getAttenuationDistances() ref number ‘The reference distance. max number ‘The maximum distance. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Source:getChannels Gets the number of channels in the Source. Only 1-channel (mono) Sources can use directional and positional effects channels = Source:getChannels() channels number 1 for mono, 2 for stereo. Source:getCone Gets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source’s volume to vary depending on its direction, innerAngle, outerAngle, outerVolume = Source:getCone() innerangle number ‘The inner angle from the Source’s direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle. outerAngle number ‘The outer angle from the Source’s direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles. outerVolume number ‘The Source’s volume when the listener is outside both the inner and outer cone angles. Source:getDirection Gets the direction of the Source. X, Ys Z = Source:getDirection() x number The X part of the direction vector. y number The Y part of the direction vector. 2 number The Z part of the direction vector. Source:getDuration Gets the duration of the Source. For streaming Sources it may not always be sample-accurate, and may retum -1 if the duration cannot be determined at all. duration = Source:getDuration( unit ) duration number The duration of the Source, or 1 if it cannot be determined. unit ("seconds") TimeUnit ‘The time unit for the return value. Source:getPitch Gets the current pitch of the Source. pitch = Source:getPitch() pitch number The pitch, where 1.0 is normal. Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window Source:getPosition Gets the position of the Source. X, Ys Z = Source:getPosition() x number The X position of the Source. y number The Y position of the Source. Zz number ‘The Z position of the Source. Source:getRolloff Returns the rolloff factor of the source. rolloff = Source: getRollof#() rolloff number The rolloff factor. Source:getType Gets the type (static or stream) of the Source. sourcetype = Source:getType() sourcetype SourceType The type of the source. Source:getVelocity Gets the velocity of the Source. xX, y, Z = Source:getVelocity() x number The X part of the velocity vector. y number The Y part of the velocity vector. 2 number The Z part of the velocity vector. Source:getVolume Gets the current volume of the Source. volume = Source:getVolume() volume number ‘The volume of the Source, where 1.0 is normal volume. Source:getVolumeLimits Returns the volume limits of the source. min, max = Source:getVolumeLimits() min number The minimum volume. max number ‘The maximum volume, callbacss SOUrce:isLooping ae Returns whether the Source will loop. ev pogee loop = Source: isLooping() a keyboard math mouse . physics SOurce:isPaused oes Returns whether the Source is paused. thread : toe paused = Source:isPaused() touch video paused boolean ‘True if the Source is paused, false otherwise. window Source:isPlaying Returns whether the Source is playing. playing = Source: isPlaying() playing boolean ‘True if the Source is playing, false otherwise. Source:isStopped Returns whether the Source is stopped. stopped = Source: isStopped() stopped boolean True if the Source is stopped, false otherwise. Source:pause Pauses the Source. Source: pause() Source:play Starts playing the Source. success = Source: play() success boolean ‘True if the Source started playing successfully, false otherwise. Source:resume Resumes a paused Source. Source: resume() Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Source:rewind Rewinds a Source. Source: rewind() Source:seek Sets the playing position of the Source. Source:seek( position, unit ) position number unit ("seconds") TimeUnit Source:setDirection ‘The position to seek to. ‘The unit of the position value. Sets the direction vector of the Source. A zero vector makes the source non-directional.. Source:setDirection( x, y, z ) x number y number z number ‘The X part of the direction vector. The Y part of the direction vector. ‘The Z part of the direction vector. Source:setAttenuationDistances Sets the reference and maximum distance of the source. Source: setAttenuationDistances( ref, max ) ref number max number Source:setCone ‘The new reference distance. ‘The new maximum distance. Sets the Source’s directional volume cones. Together with Source:setDirection, the cone angles allow for the Source’s volume to vary depending on its direction. Source:setCone( innerAngle, outerAngle, outerVolume ) innerAngle number outerAngle number outerVolume (8) number Source:setLooping ‘Sets whether the Source should loop. The inner angle from the Source’s direction, in radians. The Source will play at normal volume if the listener fs inside the cone defined by this angle. ‘The outer angle from the Source’s direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles. ‘The Source’s volume when the listener is outside both the inner and outer cone angles. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Source:setLooping( loop ) loop boolean ‘True if the source should loop, false otherwise. Source:setPitch Sets the pitch of the Source. Source:setPitch( pitch ) pitch number Calculated with regard to 1 being the base pitch. Each reduction by 50 percent equals a pitch shift of -12 semitones (one octave reduction). Each doubling equals a pitch shift of 12 semitones (one octave increase). Zero is not a legal value. Source:setPosition Sets the position of the Source. Source:setPosition( x, y, z ) x number The X position of the Source. y number The Y position of the Source. 2 number The Z position of the Source. Source:setRolloff Sets the rolloff factor which affects the strength of the used distance attenuation, Extended information and detailed formulas can be found in the chapter "3.4. Attenuation By Distance of OpenAL 1.1 specification. Source: setRolloff( rolloff ) rolloff number ‘The new rolloff factor. Source:setVelocity Sets the velocity of the Source. This does not change the position of the Source, but is used to calculate the doppler effect. Source:setVelocity( x, y, z ) Xx number The X part of the velocity vector. y number The Y part of the velocity vector. 2 number The Z part of the velocity vector. Source:setVolume Sets the volume of the Source. Source:setVolume( volume ) Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window volume number ‘The volume of the Source, where 1.0 is normal volume. Source:setVolumeLimits Sets the volume limits of the source. The limits have to be numbers from 0 to 1. Source:setVolumeLimits( min, max ) min number’ The minimum volume. max number ‘The maximum volume. Source:stop Stops a Source. Source: stop() Source:tell Gets the currently playing position of the Source. position = Source:tell( unit ) position number ‘The currently playing position of the Source. unit ("seconds") TimeUnit The type of unit for the return value. DistanceModel Sources do not get attenuated. inverse Inverse distance attenuation. inverseclamped Inverse distance attenuation, Gain is clamped. In version 0.9.2 and older this is named inverse clamped. linear Linear attenuation. Linearclamped Linear attenuation. Gain is clamped. In version 0.9.2 and older this is named linear clamped. exponent. Exponential attenuation, exponentclamped Exponential attenuation. Gain is clamped. In version 0.9.2 and older this is named exponent clamped. SourceType static Decode the entire sound at once. stream Stream the sound; decode it gradually. Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window TimeUnit seconds Regular seconds. samples Audio samples. love.event Functions jove.event.clear jove.event. poll jove.event. pump jove.event. push jove.event. quit jove.event.wait Enums Event love.event.clear Clears the event queue. love.event.clear() love.event.poll Returns an iterator for messages in the event queue. i = love.event.poll() i function Iterator function usable in a for loop. love.event.pump Pump events into the event queue. This is a low-level function, and is usually not called by the user, but by love.run. Note that this does need to be called for any OS to think you'e still running, and if you want to handle OS-generated events at all (think callbacks). love.event.pump can only be called from the main thread, but afterwards, the rest of love.event can be used from any other thread. love. event. pump() love.event.push ‘Adds an event to the event queue. love.event.push( e, a, b, c, d ) e Event ‘The name of the event. a (nil) mixed First event argument. b (nil) mixed Second event argument. ¢ (nil) mixed Third event argument. d (nil) mixed Fourth event argument. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.event. quit ‘Adds the quit event to the queue. ‘The quit event is a signal for the event handler to close LOVE. It's possible to abort the exit process with the love. quit callback. love.event.quit() love.event.quit( exitstatus ) exitstatus (@) number ‘The program exit status to use when closing the application. love.event.quit( “restart” ) “restart” string Restarts the game without relaunching the executable. This cleanly shuts down the main Lua state instance and creates a brand new one. love.event.wait Like love.event.poll but blocks until there is an event in the queue. e, a, b, c, d = love.event.wait() fe Event The type of event. a mixed First event argument. b mixed Second event argument. cc mixed Third event argument. do mixed Fourth event argument. Event focus Window focus gained or lost joystickaxis Joystick axis motion joystickhat Joystick hat pressed joystickpressed ‘Joystick pressed joystickreleased Joystick released keypressed Key pressed keyreleased Key released mousefocus Window mouse focus gained or lost mousepressed ‘Mouse pressed mousereleased ‘Mouse released ‘Window size changed by the user threaderror Callbacks 4 Lua error has occurred in a thread. ado event filesystem Quit graphics visible ‘image Window is minimized or un-minimized by the user joystick keyboard math . mowe love.filesystem physics sound system ‘Types thread File tne FileData ‘touch video window Functions love. filesystem. get/setRequirePath love.filesystem.getSource love.filesystem. init love. filesystem. are/setSymtinksEnabled love.ilesystem. isFused love. filesystem. isSymlink love. filesystem. createDirectory love. filesystem. getDirectoryttems love. filesystem. get/setldentity love filesystem isFile love. filesystem isDirectory love. filesystem. exists love.filesystem.load love.filesystem.mount love. filesystem. unmount Directory paths love. filesystem. getAppdataDirectory love. filesystem.getRealDirectory love. filesystem. getSaveDirectory love. filesystem. getSourceBaseDirectory love. filesystem. getUserDirectory love. filesystem. getWorkingDirectory File properties love.filesystem.getLastModified love filesystem.getSize File operations love.filesystem.read love.filesystem.tines love.filesystem.write love.filesystem.append love.filesystem.remove Enums BufferMode FileDecoder FileMode love.filesystem.append ‘Append data to an existing file. success, errormsg = love.filesystem.append( name, data, size ) success boolean ‘True if the operation was successful, or nil if there was an error. errormsg string The error message on failure. Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window name string ‘The name (and path) of the file. data string ‘The data that should be written to the file size (all) number How many bytes to write. love.filesystem.areSymlinksEnabled Gets whether love. filesystem follows symbolic links. enable = love. filesystem.areSymlinksEnabled() enable boolean ‘Whether love. filesystem follows symbolic links. love.filesystem.createDirectory Creates a directory. success = love, filesystem.createDirectory( name ) success boolean ‘True if the directory was created, false if not. name string The directory to create. love.filesystem.exists ‘Check whether a file or directory exists. exists = love.filesystem.exists( filename ) exists boolean ‘True if there fs a file or directory with the specified name. False otherwise. filename string ‘The path to a potential file or directory. love.filesystem.getAppdataDirectory Returns the application data directory (could be the same as getUserDirectory) path = love. filesystem. getAppdataDirectory() path string ‘The path of the application data directory. love.filesystem.getDirectoryltems Returns a table with the names of files and subdirectories in the specified path. The table is not sorted in any way; the order is undefined. If the path passed to the function exists in the game and the save directory, it will ist the files and directories from both places. items = love.filesystem.getDirectoryItems( dir ) items table A sequence with the names of all files and subdirectories as strings. dir string ‘The directory. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.filesystem.getidentity Gets the write directory name for your game. Note that this only returns the name of the folder to store your files in, not the full location, love. filesystem.getIdentity( name ) name string ‘The identity that is used as write directory. love.filesystem.getLastModified Gets the last modification time of a file. modtime, errormsg = love.filesystem.getLastModified( filename ) modtime number ‘The last modification time in seconds since the unix epoch or nil on failure. errormsg string ‘The error message on failure. filename string ‘The path and name to a file. love.filesystem.getRealDirectory Gets the platform-specific absolute path of the directory containing a filepath. This can be used to determine whether a file is inside the save directory or the game's source .love. realdir = love.filesystem.getRealDirectory( filepath ) realdir string ‘The platform-specific full path of the directory containing the filepath. filepath string ‘The filepath to get the directory of, love.filesystem.getRequirePath Gets the filesystem paths that will be searched when require is called. ‘The paths string returned by this function is a sequence of path templates separated by semicolons. The argument passed to require will be inserted in place of any question mark ("") character in each template (after the dot characters in the argument passed to require are replaced by directory separators.) The paths are relative to the game’s source and save directories, as well as any paths mounted with Love. filesystem. mount. paths = love.filesystem.getRequirePath() paths string The paths that the require function will check in love's filesystem. love.filesystem.getSaveDirectory Gets the full path to the designated save directory. This can be useful if you want to use the standard io library (or something else) to read or write in the save directory. path = love. filesystem. getSaveDirectory() Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window path string ‘The absolute path to the save directory. love.filesystem.getSize Gets the size in bytes of a file. size, errormsg = love.filesystem.getSize( filename ) size number ‘The size in bytes of the file, or nil on failure. errormsg string ‘The error message on failure. filename string ‘The path and name to a file. love.filesystem.getSource Returns the full path to the the .love file or directory. If the game is fused to the LOVE executable, then the executable is returned. path = love. filesystem.getSource() path string The full platform-dependent path of the .love file or directory. love.filesystem.getSourceBaseDirectory Returns the full path to the directory containing the .love file. If the game is fused to the LOVE executable, then the directory containing the executable is returned. If love. filesystem. isFused is true, the path returned by this function can be passed to love.filesystem.mount, which will make the directory containing the main game readable by love filesystem. path = love. filesystem. getSourceBaseDirectory() path string ‘The full platform-dependent path of the directory containing the clove file, love.filesystem.getUserDirectory Returns the path of the user's directory. path = love. filesystem.getUserDirectory() path string The path of the user's directory. love.filesystem.getWorkingDirectory Gets the current working directory. path = love. filesystem. getWorkingDirectory() path string The current working directory. love.filesystem. init Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Initializes love. filesystem, will be called internally, so should not be used explicitly. love.filesystem.init( appname ) appname string ‘The name of the application binary, typically love. love.filesystem.isDirectory Check whether something is a directory. isDir = love.filesystem.isDirectory( path ) isDir boolean ‘True if there is a directory with the specified name. False otherwise. path string ‘The path to a potential directory. love.filesystem.isFile ‘Check whether something isa file. isFile = love.filesystem.isFile( path ) isFile boolean ‘True if there is a file with the specified name. False otherwise. path string ‘The path to a potential file, love.filesystem.isFused Gets whether the game is in fused mode or not. If a game is in fused mode, its save directory will be directly in the Appdata directory instead of Appdata/LOVE/. The game will also be able to load C Lua dynamic libraries which are located in the save directory. ‘A game is in fused mode if the source .love has been fused to the executable (see Game Distribution), or if “fused” has been given as a command-line argument when starting the game. fused = love.filesystem.isFused() fused boolean ‘True if the game is in fused mode, false otherwise. love.filesystem.isSymlink Gets whether a filepath is actually a symbolic link. If symbolic links are not enabled (via love. filesystem, setSymlinksEnabled), this function will always retum false. symlink = love.filesystem.isSymlink( path ) symlink boolean ‘True if the path is a symbolic link, false otherwise. path string The file or directory path to check. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.filesystem.lines Iterate over the lines in a file, iterator = love.filesystem.lines( name ) iterator function _A function that iterates over all the lines in the file. name string ‘The name (and path) of the file. love.filesystem.load Loads a Lua file (but does not run it). chunk = love.filesystem.load( name, errormsg ) chunk function The loaded chunk, name string The name (and path) of the file. errormsg (nil) string ‘The error message if file could not be opened. love.filesystem.mount Mounts a zip file or folder in the game's save directory for reading. success = love.filesystem.mount( archive, mountpoint ) success boolean ‘True if the archive was successfully mounted, false otherwise. archive string ‘The folder or zip fie in the game's save directory to mount, mountpoint string ‘The new path the archive will be mounted to. success = love.filesystem.mount( archive, mountpoint, appendToPath ) success boolean ‘True if the archive was successfully mounted, false otherwise. archive string ‘The folder or zip fie in the game's save directory to mount, mountpoint string The new path the archive will be mounted to. appendToPath string Whether the archive will be searched when reading a filepath (false) before or after already-mounted archives. This includes the game's source and save directories. love.filesystem.newFile Creates a new File object. It needs to be opened before it can be accessed. file, errorstr = love.filesystem.newFile( filename, mode ) file File The new File object, or nil if an error occurred. errorstr string ‘The error string if an error occurred. filename string The filename of the file to read. mode ("c") FileMode ‘The mode to open the file in. love.filesystem.newFileData Creates a new FileData object. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window data = love.filesystem.newFileData( contents, name, decoder ) data FileData Your new FileData. contents string The contents of the file. name string ‘The name of the file. decoder ("file") FileDecoder The method to use when decoding the contents. data, err = love.filesystem.newFileData( filepath ) data Filebata The new FileData, or nil if an error occurred. err string The error string, if an error occurred. filepath string Path to the file. love.filesystem.read Read the contents of a file, contents, size = love.filesystem.read( name, bytes ) contents string The file contents. size number How many bytes have been read, name string The name (and path) of the file. bytes (all) number How many bytes to read. love.filesystem.remove Removes a file or directory. success = love.filesystem.remove( name ) success boolean ‘True if the file/directory was removed, false otherwise. name string The file or directory to remove. love.filesystem.setldentity Sets the write directory for your game. Note that you can anly set the name of the folder to store your files in, not the location. love.filesystem.setIdentity( name, appendToPath ) name string ‘The new identity that will be used as write directory. appendToPath boolean Whether the identity directory will be searched when reading a (false) filepath before or after the game's source directory and any currently mounted archives. love.filesystem.setRequirePath Sets the filesystem paths that will be searched when require is called, ‘The paths string given to this function is a sequence of path templates separated by semicolons. The argument passed to require will be inserted in place of any question mark ("2") character in each ‘template (after the dot characters in the argument passed to require are replaced by directory separators.) Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window ‘The paths are relative to the game's source and save directories, as well as any paths mounted with love. filesystem. mount. love.filesystem.setRequirePath( paths ) paths string The paths that the require function will check in love's filesystem. love. filesystem.setSymlinksEnabled Sets whether love. filesystem follows symbolic links. It is enabled by default in version 0.10.0 and newer, and disabled by default in 0.9.2. love. filesystem. setSymlinksEnabled( enable ) enable boolean Whether love.filesystem should follow symbolic links. love.filesystem.unmount Unmounts a zip file or folder previously mounted for reading with love.filesystem.mount. success = love.filesystem.unmount( archive ) success boolean ‘True if the archive was successfully unmounted, false otherwise. archive string The folder or zip file in the game's save directory which is currently mounted. love.filesystem.write Write data to a file. If you are getting the error message “Could not set write directory’, try setting the save directory. This is done either with love. filesystem.setldentity or by setting the identity field in love.conf. success = love.filesystem.write( name, data, size ) success boolean If the operation was successful name string ‘The name (and path) of the file, data string The data that should be written to the file size (all) number How many bytes to write. File Represents a file on the filesystem. Constructors ove filesystem. newFile Functions File:close File:flush File:get/ setBuffer File:getFilename File:getMode Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window File:getsize Le:isEOF File:isOpen Filestines. File:open File:read le:seek File:write Supertypes Object File:close Closes a file. success = File:close() success boolean Whether closing was successful. File:flush Flushes any buffered written data in the file to the disk. success, err = File:flush() success boolean ‘Whether the file successfully flushed any buffered data to the disk. err string ‘The error string, if an error occurred and the file could not be flushed. File:getBuffer Gets the buffer mode of a file. mode, size = File:getBuffer() mode BufferMode ‘The current buffer mode of the file. size number The maximum size in bytes of the file's buffer. File:getFilename Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path. filename = File:getFilename() filename string ‘The filename of the File. File:getMode Gets the FileMode the file has been opened with. mode = File:getMode() Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window mode FileMode ‘The mode this file has been opened with. File:getSize Returns the file size. size = File:getSize() size number ‘The file size File:isEOF Gets whether end-of-file has been reached. eof = File:isEOF() eof boolean ‘Whether EOF has been reached. File:isOpen Gets whether the file is open. open = File:isopen() open boolean ‘True if the file is currently open, false otherwise, File:lines Iterate over all the lines in a file iterator = File:lines() iterator function ‘The iterator (can be used in for loops) File:open Open the file for write, read or append. If you are getting the error message "Could not set write directory’, try setting the save directory. This is. done either with love. filesystem. setldentity or by setting the identity field in love.conf. success = File:open( mode ) success boolean ‘True on success, false otherwise. mode FileMode ‘The mode to open the file in. File:read Read a number of bytes from a file. contents, size = File:read( bytes ) Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window contents string ‘The contents of the read bytes. size number How many bytes have been read. bytes (all) number ‘The number of bytes to read File:seek Seek to a position in a file. success = File:seek( position ) success boolean Whether the operation was successful. position number The position to seek to, File:setBuffer Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode. success, errorstr = File:setBuffer( mode, size ) success boolean Whether the buffer mode was successfully set. errorstr string ‘The error string, if the buffer mode could not be set and an error occurred. mode BufferMode The buffer mode to use. size number ‘The maximum size in bytes of the file's buffer: File:write Write data to a file. success = File:write( data, size ) success boolean Whether the operation was successful. data string The data to write. size (all) number How many bytes to write. FileData Data representing the contents of a file. Constructors love. filesystem. newFileData Functions FileData:getExtension FileData:getFilename Supertypes Data Object FileData:getExtension Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Gets the extension of the FileData. ext = FileData:getExtension() ext string ‘The extension of the file the FileData represents. FileData:getFilename Gets the filename of the FileData. name = FileData:getFilename() name string The name of the file the FileData represents. BufferMode none No buffering. The result of write and append operations appears immediately. line Line buffering. Write and append operations are buffered until a newline is output or the buffer size limit is reached. full Full buffering. Write and append operations are always buffered until the buffer size limit is reached. FileDecoder file ‘The data is unencoded. basesa ‘The data is base64-encoded. FileMode Open a file for read. Open a file for write. a Open a file for append. « Do not open a file (represents a closed file.) love.graphics Types Canvas Font Mesh Image Particlesystem Quad Shader SpriteBatch Callbacks audio event Text Texture Video filesystem Functions graphics image Joystick keyboard math mouse physics sound system thread timer touch video window love.graphics.clear love. graphics. discard love. graphics.newScreenshot love. graphics. present Drawing love. graphics.draw love. graphics. print love. graphics. printf love.graphics.tine love. graphics.polygon love.graphics.rectangle love.graphics.circle love.graphics.ellipse love.graphics.are love. graphics. points Stencil love.graphics.stencit love. graphics. get/setStencitTest Graphics state love. graphics. push love. graphics.pop love.graphics.reset love. graphics. get/setFont love. graphics.setNewFont love. graphics. get/setBackgroundColor love. graphics. get/setBlendMode love. graphics.get/setCanvas love. graphics.get/setCotor love. graphics. get/setColorMask love. graphics. get/setDefaultFilter love. graphics.get/setLineJoin love. graphics.get/setLinestyle love. graphics. get/setLineWidth love.graphics.get/setShader love. graphics. get/setPointSize love. graphics.get/setScissor love. graphics. ntersectScissor love. graphics. is/setWireframe Coordinate system love.graphics.origin love. graphics.rotate love.graphics.scale love.graphics.shear love. graphics. translate window love.graphics.getDimensions love.graphics.getHeight love. graphics. getWidth Info love. graphics. getCanvasFormats love. graphics. getCompressedimageFormats love. graphics. getStats love. graphics.getSystemLimits love. graphics. getRendererinfo love. graphics. getSupported love. graphics.isGammaCorrect, Enums Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window AlignMode arcType ‘AreaSpreadDistribution BlendAlphaMode BlendMode CanvasFormat CompareMode DrawMode FilterMode GraphicsFeature GraphicsLimit LineJoin Linestyle MeshDrawMode ParticlelnsertMode Pointstyle SpriteBatchUsage StackType StencilAction WrapMode love.graphics.arc Draws a filled or unfilled arc at position (x, y). The arc is drawn from anglet to angle? in radians. The segments parameter determines how many segments are used to draw the arc. The more segments, the smoother the edge. love.graphics.arc( drawmode, x, y, radius, angle1, angle2, segments ) drawnode y radius angle1 angle2 segments (10) DrawMode number number number number number number How to draw the arc. ‘The position of the center along x-axis ‘The position of the center along y-axis. Radius of the arc. The angle at which the are begins. The angle at which the arc terminates. ‘The number of segments used for drawing the arc. love.graphics.arc( drawmode, arctype, x, y, radius, angle1, angle2, segments ) drawnode arctype y radius anglea angle2 segments (10) DrawMode Arctype number number number number number number love.graphics.circle Draws a circle. How to draw the arc. The type of arc to draw. ‘The position of the center along x-axis. ‘The position of the center along y-axis. Radius of the arc. The angle at which the arc begins. ‘The angle at which the arc terminates. ‘The number of segments used for drawing the arc. love.graphics.circle( mode, x, y, radius ) mode y DrawMode number number How to draw the circle. ‘The position of the center along x-axis. ‘The position of the center along y-axis. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window radius number ‘The radius of the circle. love.graphics.circle( mode, x, y, radius, segments ) mode DrawMode How to draw the circle. x number ‘The position of the center along x-axis. y number ‘The position of the center along y-axis. radius number ‘The radius of the circle, segments number ‘The number of segments used for drawing the circle. Note: The default variable for the segments parameter varies between different versions of LOVE. love.graphics.clear Clears the screen to the background color in LOVE 0.9.2 and earlier, or to the specified color in 0.10.0 and newer. This function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function, Note that the scissor area bounds the cleared region. love. graphics. clear() love.graphics.clear( r, g, bs @ ) number The red channel of the color to clear the screen to, g number ‘The green channel of the color to clear the screen to b number The blue channel of the color to clear the screen to. a (255) number ‘The alpha channel of the color to clear the screen to. love.graphics.clear( color, ... ) color table A table in the form of {r, g, b, a} containing the color to clear the first active Canvas to. ss. table Additional tables for each active Canvas. love.graphics.discard Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases. If the active Canvas has just been changed and the “replace” BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.ciscard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices. On some desktop systems this function may do nothing. love.graphics.discard( discardcolor, discardstencil ) discardcolor boolean Whether to discard the texture(s) of the active Canvas(es) (the (true) contents of the screen if no Canvas is active). discardstencil boolean Whether to discard the contents of the stencil buffer of the (true) screen / active Canvas. love.graphics.discard( discardcolors, discardstencil ) discardcolors table ‘An array containing boolean values indicating whether to discard Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window the texture of each active Canvas, when multiple simultaneous Canvases are active, discardstencil boolean Whether to discard the contents of the stencil buffer of the (true) screen / active Canvas. love.graphics.draw Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, or Video) an the screen with optional rotation, scaling and shearing. Objects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system. It’s possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline. Note that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation. ‘The right and bottom edges of the object are shifted at an angle defined by the shearing factors. love.graphics.draw( drawable, x, y, Ts SX, SY, Ox, oy, kx, ky ) drawable Drawable A drawable object. x (8) number The position to draw the object (x-axis). y (@) number ‘The position to draw the object (y-axis). (8) number Orientation (radians). sx (1) number Scale factor (x-axis). Can be negative. sy (sx) number Scale factor (y-axis). Can be negative. ox (@) number Origin offset (x-axis). (A value of 20 would effectively move your drawable object 20 pixels to the left.) oy (@) number Origin offset (y-axis). (A value of 20 would effectively move your drawable object 20 pixels up.) ko (@) number Shearing factor (x-axis). ky (@) number Shearing factor (y-axis). love.graphics.draw( texture, quad, x, y, 7, SX, Sy, Ox, oy, kx, ky ) texture Texture A Texture (Image or Canvas) to texture the Quad with. quad Quad The Quad to draw on screen. x (8) number ‘The position to draw the object (x-axis). y (®) number ‘The position to draw the object (y-axis). (8) number Orientation (radians). sx (1) number Scale factor (x-axis). Can be negative. sy (sx) number Scale factor (y-axis). Can be negative. ox (@) number Origin offset (x-axis). oy (@) number Origin offset (y-axis) kx (@) number Shearing factor (x-axis). ky (@) number Shearing factor (y-axis). love.graphics.ellipse Draws an ellipse love.graphics.ellipse( mode, x, y, radiusx, radiusy ) mode DrawMode How to draw the ellipse. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window x number ‘The position of the center along x-axis. y number The position of the center along y-axis radiusx number The radius of the ellipse along the x-axis (half the ellipse’s width.) radiusy number ‘The radius of the ellipse along the y-axis (half the ellipse’s height.) love.graphics.ellipse( mode, x, y, radiusx, radiusy, segments ) mode DrawMode How to draw the ellipse. x number ‘The position of the center along x-axis. y umber ‘The position of the center along y-axis. radiusx number The radius of the ellipse along the x-axis (half the ellipse’s width.) radiusy number ‘The radius of the ellipse along the y-axis (half the ellipse’s height.) segnents number ‘The number of segments used for drawing the ellipse. love.graphics.getBackgroundColor Gets the current background color, r, g, b, a = love.graphics.getBackgroundColor() number ‘The red component (0-255). number ‘The green component (0-255). b number The blue component (0-255). a number The alpha component (0-255). love.graphics.getBlendMode Gets the blending mode. mode, alphamode = love.graphics.getBlendMode() mode BlendHode The current blend mode. alphanode BlendAlphaviode The current blend alpha mode - it determines how the alpha of drawn objects affects blending. love.graphics.getCanvas Gets the current target Canvas. canvas = love.graphics.getCanvas() canvas Canvas, ‘The Canvas set by setCanvas. Returns nil if drawing to the real screen, love.graphics.getCanvasFormats Gets the available Canvas formats, and whether each is supported, formats = love.graphics.getCanvasFormats() formats table A table containing CanvasFormats as keys, and a boolean Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window indicating whether the format is supported as values. Not all systems support all formats. love.graphics.getColor Gets the current color. r, g, b, a = love.graphics.getColor() number ‘The red component (0-255). number ‘The red component (0-255). b number The blue component (0-255). a number ‘The alpha component (0-255). love.graphics.getColorMask Gets the active color components used when drawing. Normally all 4 components are active unless love.graphics. setColorMask has been used. ‘The color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love. graphics.clear and Canvas:clear as well. r, g) b, a = love.graphics.getColorMask() boolean Whether the red color component is active when rendering. & boolean Whether the green color component is active when rendering. b boolean Whether the blue color component is active when rendering. a boolean Whether the alpha color component is active when rendering. love.graphics.getCompressedimageFormats Gets the available compressed image formats, and whether each is supported. formats = love.graphics.getCompressedImageFormats() formats table A table containing CompressedFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats. love.graphics.getDefaultFilter Returns the default scaling filters used with Images, Canvases, and Fonts. min, mag, anisotropy = love.graphics.getDefaultFilter() min Filteriode Filter mode used when scaling the image down. mag FilterMlode Filter mode used when scaling the image up. anisotropy number ‘Maximum amount of Anisotropic Filtering used. love.graphics.getDimensions Gets the width and height of the window. width, height = love.graphics.getDimensions() Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window width number ‘The width of the window. height number The height of the window. love.graphics.getFont Gets the current Font object. font = love.graphics.getFont() font Font ‘The current Font, or nil if none is set. love.graphics.getHeight Gets the height of the window. height = love. graphics. getHeight() height number The height of the window. love.graphics.getLineJoin Gets the line join style. join = love.graphics.getLineJoin() join LineJoin The LineJoin style. love.graphics.getLineStyle Gets the line style. style = love.graphics.getLineStyle() style LineStyle The current line style. love.graphics.getLineWidth Gets the current line width. width = love. graphics. getLineWidth() width number The current line width. love.graphics.getPointSize Gets the point size. size = love.graphics.getPointSize() size number ‘The current point size. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.graphics.getRendererinfo Gets information about the system's video card and drivers. name, version, vendor, device = love.graphics.getRendererInfo() name string version string vendor string device string love.graphics.getScissor Gets the current scissor box. ‘The name of the renderer, e.g. “OpenGL” or “OpenGL ES". ‘The version of the renderer with some extra driver-dependent version info, e.g. "2.1 INTEL-B.10.44", ‘The name of the graphics card vendor, e.g. “Intel Inc’ ‘The name of the graphics card, e.g. "Intel HD Graphics 3000 ‘OpenGL Engine” x, y, width, height = love.graphics.getScissor() x number y number width number height number love.graphics.getShader The x component of the top-left point of the box. ‘The y component of the top-left point of the box. ‘The width of the box. ‘The height of the box. Returns the current Shader. Returns nil if none is set. shader = love.graphics.getShader() shader shader love.graphics.getStats The current Shader. Gets performance-related rendering statistics. drawcalls, canvasswitches, texturememory, images, canvases, fonts, shaderswitches drawcalls number canvasswitches number ‘texturememory number images number canvases number fonts number shaderswitches number love. graphics.getStats() ‘The number of draw calls made so far during the current frame. ‘The number of times the active Canvas has been switched so far during the current frame. ‘The estimated total size in bytes of video memory used by all loaded Images, Canvases, and Fonts. ‘The number of Image objects currently loaded, The number of Canvas objects currently loaded. ‘The number of Font objects currently loaded. ‘The number of times the active Shader has been changed so far during the current frame. love.graphics.getStencilTest Gets whether stencil testing is enabled. When stencil testing fs enabled, the geometry of everything that is drawn will be clipped / stencilled out based on whether it intersects with what has been previously drawn to the stencil buffer. Callbacks audio Each Canvas has its own stencil buffer. event filesystem graphics jovnick enabled boolean Whether stencil testing is enabled. keyboard inverted boolean Whether the steneil test is inverted or not. math mouse physics . sound love.graphics.getSupported system thread timer touch ide Vinbw features = love.graphics.getSupported() enabled, inverted = love.graphics.getStencilTest() Gets the optional graphics features and whether they're supported on the system, ‘Some older or low-end systems don't always support all graphics features. features table A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported. love.graphics.getSystemLimits Gets the system-dependent maximum values for love. graphics features, limits = love.graphics.getSystemLimits() limits table A table containing GraphicsLimit keys, and number values. love.graphics.getWidth Gets the width of the window. width = love.graphics.getWidth() width number ‘The width of the window. love.graphics.intersectScissor Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like ove.graphics.setScissor. ‘The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love. graphics.clear. ‘The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...) love.graphics.intersectScissor( x, y, width, height ) x number ‘The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. y number ‘The y-coordinate of the upper left comer of the rectangle to intersect with the existing scissor rectangle. width number ‘The width of the rectangle to intersect with the existing scissor rectangle. height number ‘The height of the rectangle to intersect with the existing scissor rectangle. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love. graphics. intersectScissor() love.graphics.isGammaCorrect Gets whether gamma-correct rendering is supported and enabled, It can be enabled by setting t.gammacorrect = true in love.conf. Not all devices support gamma-correct rendering, in which case it will be automatically disabled and this function will return false. It is supported on desktop systems which have graphics cards that are capable of using OpenGL 3 / DirectX 10, and iOS devices that can use OpenGL ES 3. gammacorrect = love.graphics. isGammaCorrect() ganmacorrect boolean ‘True if gamma-correct rendering is supported and was enabled in love.conf, false otherwise. love.graphics.isWireframe Gets whether wireframe mode is used when drawing. wireframe = love.graphics.iswireframe() wireframe boolean ‘True if wireframe lines are used when drawing, false if it's not. love.graphics. line Draws lines between points. love.graphics.line( x1, y1, x2, y2, -.. ) x1 number ‘The position of first point on the x-axis. yl number ‘The position of first point on the y-axis. x2 number ‘The position of second point on the x-axis. y2 number ‘The position of second point on the y-axis. ces number ‘You can continue passing point positions to draw a polyline. love.graphics.line( points ) points table A table of point positions. love.graphics.newCanvas Creates a new Canvas object for offscreen rendering. Antialiased Canvases have slightly higher system requirements than normal Canvases. Additionally, the supported maximum number of MSAA samples varies depending on the system. Use love. graphics. getSystemLimit to check. If the number of MSAA samples specified is greater than the maximum supported by the system, the Canvas will still be created but only using the maximum supported amount (this includes 0.) canvas = love.graphics.newCanvas( width, height, format, msaa ) canvas Canvas Anew Canvas object. width (window number ‘The width of the Canvas. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window width) height (window number The height of the Canvas. height) format CanvasFormat The desired texture mode of the Canvas. ("normal") msaa (@) number The desired number of antialiasing samples used when drawing to the Canvas. love.graphics.newFont Creates a new Font. font = love.graphics.newFont( filename, size ) font Font ‘A Font object which can be used to draw text on screen. filename string The filepath to the font file. size (12) number The size of the font in pixels. font = love.graphics.newFont( file, size ) font Font A Font object which can be used to draw text on screen. file File A File pointing to a font. size (12) number The size of the font in pixels. font = love.graphics.newFont( filedata, size ) font Font ‘A Font object which can be used to draw text on screen. filedata FileData The encoded data to decode into a font. size (12) number The size of the font in pixels. font = love.graphics.newFont( size ) font Font ‘A Font object which can be used to draw text on screen. size (12) number The size of the font in pixels. love.graphics.newlmage Creates a new Image from a filepath, FileData, an ImageData, or a CompressedlmageData, and optionally generates or specifies mipmaps for the image. image = love.graphics.newlmage( filename ) image Image ‘An Image object which can be drawn on screen. filename string The filepath to the image file. image = love.graphics.newlmage( imageData ) image Image ‘An Image object which can be drawn on screen. imageData ImageData__An ImageData object. The Image will use this ImageData to reload itself when love.window.setMode is called. image = love.graphics.newlmage( compressedImageData ) image Image ‘An Image object which can be drawn on screen. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window compressedinageData CompressedimageData A CompressedimageData object. The Image will use this CompressedimageData to reload itself when love.window.setMode is called. image = love.graphics.newImage( filename, flags ) image Image filename string flags table flags.linear boolean (false) flags.mipmaps boolean or (false) table ‘An Image object which can be drawn on screen. The filepath to the image file (or a FileData or ImageData or CompressedimageData object). A table containing the following fields: ‘Truc 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. If true, mipmaps for the image will be automatically generated {or taken from the images’ 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. love.graphics.newlmageFont Creates a new Font by loading a specifically formatted image. In versions prior to 0.9.0, LOVE expects 1SO 8859-1 encoding for the glyphs string font = font Font filename string glyphs string font = font Font imageData ImageData glyphs string love.graphics.newImagefont( filename, glyphs ) A Font object which can be used to draw text on screen. ‘The filepath to the image file. A string of the characters in the image in order from left to right. love. graphics.newImageFont( imageData, glyphs ) A Font object which can be used to draw text on screen. ‘The ImageData object to create the font from, A tring of the characters in the image in order from left to right. font = love.graphics.newImageFont( filename, glyphs, extraspacing ) font Font filename string glyphs string extraspacing (0) number love.graphics.newMesh Creates a new Mesh. A Font object which can be used to draw text on screen. ‘The filepath to the image file. A tring of the characters in the image in order from left to right. Additional spacing (positive or negative) to apply to each glyph in the Font. Use Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it's drawn. mesh = love.graphics.newMesh( vertices, mode, usage ) Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window mesh vertices vertices.[1] vertices. [2] vertices.[3] (@) vertices.[4] (0) vertices. [5] (255) vertices. [6] (255) vertices. [7] (255) vertices. [8] (255) mode ("fan") usage dynamic") Mesh ‘The new Mesh. table The table filled with vertex information tables for each vertex as follows: number ‘The position of the vertex on the x-axis, number ‘The position of the vertex on the y-axis. number 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.) number ‘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. ) number ‘The red component of the vertex color. number The green component of the vertex color. number The blue component of the vertex color. number The alpha component of the vertex color. MeshDrawMode How the vertices are used when drawing. The default mode fan’ is sufficient for simple convex polygons. SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh’s memory usage and performance. mesh = love.graphics.newMesh( vertexcount, mode, usage ) vertexcount mode ("fan") usage ("dynamic") Mesh ‘The new Mesh, number ‘The total number of vertices the Mesh will use. Each vertex is initialized to {0,0, 0,0, 255,255,255,255}. MeshDrawMode How the vertices are used when drawing. The default mode “fan is sufficient for simple convex polygons. SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh’s memory usage and performance. mesh = love.graphics.newMesh( vertexformat, vertices, mode, usage ) mesh vertexformat vertexformat Mesh The new Mesh. table A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex. table A table conta ig the attribute's name, it's data type, and the attribute number of components in the attribute, in the form of {name, datatype, components}. vertexformat.... table Additional vertex attribute format tables. vertices table The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}. vertices number The first component of the first vertex attribute in the -attributecomponent vertex. vertices.... number Additional components of all vertex attributes in the vertex. mode ("fan") MeshDrawMode How the vertices are used when drawing. The default mode "fan’ is sufficient for simple convex polygons. usage ("dynamic") SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh’s memory usage and performance. mesh = love.graphics.newMesh( vertexformat, vertexcount, mode, usage ) mesh Mesh Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window vertexformat table vertexformat table attribute vertexformat. table vertexcount number mode ("fan") MeshDrawttode ‘The new Mesh, A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex. ‘table containing the attribute's name, it's data type, and the number of components in the attribute, in the form of {name, datatype, components}. ‘Additional vertex attribute format tables. The total number of vertices the Mesh will use. How the vertices are used when drawing. The default mode fan’ is sufficient for simple convex polygons. usage SpriteBatchUsage The expected usage of the Mesh. The specified usage mode ("dynamic®) affects the Mesh’s memory usage and performance. love.graphics.newParticleSystem Creates a new ParticleSystern. system = love.graphics.newParticleSystem( texture, buffer ) system ParticlesystemA new ParticleSystem. texture Texture buffer number love.graphics.newQuad Creates a new Quad. ‘The Image or Canvas to use. ‘The max number of particles at the same time. The purpose of a Quad is to describe the result of the following transformation on any drawable object. The object is first scaled to dimensions sw * sh. The Quad then describes the rectangular area of dimensions width * height whose upper left corner is at position (x, y) inside the scaled object. quad = love.graphics.newQuad( x, y, width, height, sw, sh ) quad Quad x number y number width number height number sw number sh number ‘The new Quad. The top-left position along the x-axis. The top-left position along the y-axis. The width of the Quad. The height of the Quad. The reference width, the width of the Image. The reference height, the height of the Image. love.graphics.newScreenshot Creates a screenshot and returns the image data. screenshot = love.graphics.newScreenshot( copyAlpha ) screenshot ImageData copyAlpha boolean (false) ‘The image data of the screenshot. Whether to include the screen's alpha channel in the ImageData. If false, the screenshot will be fully opaque. love.graphics.newShader Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Creates 2 new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both. Vertex shader code must contain at least one function, named position, which is the function that will produce transformed vertex positions of drawn objects in screen-space. Pixel shader code must contain at least one function, named effect, which is the function that will produce the color which is blended onto the screen for each pixel a drawn object touches. shader = love.graphics.newShader( code ) shader Shader A Shader object for use in drawing operations. code string The pixel shader or vertex shader code, or a filename pointing to a file with the code. shader = love.graphics.newShader( pixelcode, vertexcode ) shader Shader A Shader object for use in drawing operations. pixeleode string The pixel shader code, or a filename pointing to a file with the vertexcode string Thevene shader code, or filename pointing toa file withthe code. love.graphics.newSpriteBatch Creates new SpriteBatch object. spriteBatch = love.graphics.newSpriteBatch( texture, maxsprites, usage ) spriteBatch SpriteBatch The new SpriteBatch. texture Texture “The Image or Canvas to use for the sprites. naxsprites number “The max number of sprites. (1000) usage SpriteBatchUsage The expected usage of the SpriteBatch. The specified usage (*dynanic”) mode affects the SpriteBatch’s memory usage and Performance. love.graphics.newText Creates a new Font. text = love.graphics.newText( font, textstring ) text Text ‘The new drawable Text object. font Font The font to use for the text. textstring (nil) string ‘The initial string of text that the new Text object will contain. May be nil, love.graphics.newVideo Creates a new drawable Video. Currently only Ogg Theora video files are supported. video = love.graphics.newVideo( filename, loadaudio ) Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window video Video Anew Video, filename string The file path to the Ogg Theora video file. loadaudio (nil) boolean Whether to try to load the video's audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio. video = love.graphics.newVideo( videostream, loadaudio ) video Video Anew Video. videostream VideoStream A video stream object. loadaudio (nil) boolean Whether to try to load the video's audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio. love.graphics.origin Resets the current coordinate transformation. This function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love. graphics. shear or love.graphics.translate, It returns the current transformation state to its defaults. love. graphics. origin() love.graphics.points Draws one or more points. love.graphics.points( x, y, --- ) Xx number The position of the first point on the x-axis y number The position of the first point on the y-axis ses number The x and y coordinates of additional points love.graphics.points( points ) points table A table containing multiple point positions, in the form of {x, ¥, points.x number ‘The position of the first point on the x-axis. points.y number ‘The position of the first point on the y-axis. points.... number The x and y coordinates of additional points. love.graphics.points( points ) points table A table containing multiple individually colored points, in the form of {point, ...}. Each table contains the position and color of a point in the form of {x, y, f, g, b, a}. The color components are optional. points.point table A table containing the position and color of the first point, in the form of {x, y, f, 8, b, a}. The color components are optional. points table Additional tables containing the position and color of more points, in the form of {x, y, f, g, b, a}. The color components are optional. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.graphics.polygon Draw a polygon. Following the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon's vertices. When in fill mode, the polygon must be convex and simple or rendering artifacts may occur. love.graphics.polygon( mode, ... ) mode DrawWode How to draw the polygon. se. umber The vertices of the polygon. love.graphics.polygon( mode, vertices ) mode Drawode How to draw the polygon. vertices table The vertices of the polygon as a table. love.graphics.pop Pops the current coordinate transformation from the transformation stack. This function is always used to reverse a previous push operation, It retums the current transformation state to what it was before the last preceding push. For an example, see the description of love.graphics.push, love. graphics.pop() love.graphics.present Displays the results of drawing operations on the screen. This function is used when writing your own love.run function, It presents all the results of your drawing. operations on the screen. See the example in love.run for a typical use of this function. love. graphics. present() love.graphics.print Draws text on screen. If no Font is set, one will be created and set (once) if needed. ‘As of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don't script with this in mind, the text wor't be in the right position, or possibly even on screen, love. graphics. print and love. graphics.printf both suppport UTF-8 encoding. Youll also need a proper Font for special characters. love.graphics.print( text, x, y, Pr, SX, Sy, Ox, oy, kx, ky ) text string The text to draw. x number The position to draw the object (x-axis). y number The position to draw the object (y-axis). r () number Orientation (radians). sx (1) number Seale factor (x-axis). Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window sy (sx) ox (@) oy (0) kx (@) ky (@) number number number number number Scale factor (y-axis). Origin offset (x-axis). Origin offset (y-axis). Shear factor (x-axis). Shear factor (y-axis) love.graphics.print( coloredtext, x, y, angle, sx, sy, ox, oy, kx, ky ) coloredtext coloredtext colori coloredtext stringt coloredtext color2 coloredtext string2 coloredtext.... angie (6) sx (1) sy (sx) ox (8) oy (@) kx (@) ky (@) table table string table string tables and strings number number number number number number number number number love.graphics.printf Draws formatted text, with word wrap and alignment, A table containing colors and strings to add to the object, in the form of {colort, string1, color?, string2, ...}- A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. A string of text which has a color specified by the previous color. A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. A string of text which has a color specified by the previous color. Additional colors and strings. ‘The position of the new text on the x-axis. ‘The position of the new text on the y-axis. The orientation of the object in radians. Seale factor on the x-axis. Seale factor on the y-axis. Origin offset on the x-axis. Origin offset on the y-axis. Shearing / skew factor on the x-axis. Shearing / skew factor on the y-axis. See additional notes in love. graphics. print. In version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case. love.graphics.printf( text, x, y, limit, align, r, sx, sy, ox, oy, kx, ky) text y Limit align ("left") r @) sx (1) sy (5x) ox (@) oy (8) kx (8) ky (@) string number number number AlignMode number number number number number number number A text string. The position on the x-axis. ‘The position on the y-axis. Wrap the line after this many horizontal pixels. The alignment. Orientation (radians). Scale factor (x-axis). Scale factor (y-axis). Origin offset (x-axis). Origin offset (y-axis). Shear factor (x-axis). Shear factor (y-axis). Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.graphics.printf( coloredtext, x, y, wraplimit, align, angle, sx, SY, OX, oy, kx, ky ) coloredtext table A table containing colors and strings to add to the object, in the form of {colort, string1, color?, string2, ...}- coloredtext table A table containing red, green, blue, and optional alpha colori Components to use as a color for the next string in the table, in the form of {red, green, blue, alpha} coloredtext string A string of text which has a color specified by the previous color. stringl coloredtext table A table containing red, green, blue, and optional alpha color2 Components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext string A string of text which has a color specified by the previous color. string2 coloredtext.... tables and Additional colors and strings. strings x number ‘The position of the new text on the x-axis. y number ‘The position of the new text on the y-axis. weaplimit number ‘The maximum width in pixels of the text before it gets automatically wrapped to a new line. align AlignMode The alignment of the text. angle () number The orientation of the object in radians. sx (1) number Scale factor on the x-axis. sy (sx) number Scale factor on the y-axis. ox (0) number Origin offset on the x-axis cy (@) number Origin offset on the y-axis. lox (@) number Shearing / skew factor on the x-axis. ky (@) number Shearing / skew factor on the y-axis. love.graphics.push Copies and pushes the current coordinate transformation to the transformation stack. This function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push. love.graphics.push( stack ) stack StackType The type of stack to push (e.g. just transformation state, or all (“transform”) love.graphics state). love.graphics.rectangle Draws a rectangle. love.graphics.rectangle( mode, x, y, width, height ) mode DrawMode How to draw the rectangle. x number ‘The position of top-left corner along the x-axis. y number ‘The position of top-left corner along the y-axis. width number Width of the rectangle. height number Height of the rectangle. love.graphics.rectangle( mode, x, y, width, height, rx, ry, segments ) Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window mode DrawMode How to draw the rectangle. x number ‘The position of top-left corner along the x-axis. y number ‘The position of top-left corner along the y-axis. width number Width of the rectangle. height number Height of the rectangle. rx number ‘The x-axis radius of each round corner. Cannot be greater than halt the rectangle's width. ry (Px) number ‘The y-axis radius of each round corner. Cannot be greater than half the rectangle's height. segments (nil) number ‘The number of segments used for drawing the round corners. A default amount will be chosen if no number is given. love.graphics.reset Resets the current graphics settings. Calling reset makes the current drawing color white, the current background color black, resets any active Canvas or Shader, and removes any scissor settings. It sets the BlendMode to alpha. It also sets both the point and line drawing modes to smooth and their sizes to 1.0. love. graphics.reset() love.graphics.rotate Rotates the coordinate system in two dimensions. Calling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw exits. love.graphics.rotate( angle ) angle number ‘The amount to rotate the coordinate system in radians. love.graphics.scale Scales the coordinate system in two dimensions. By default the coordinate system in LOVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation. After scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation. Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. Scaling lasts until love.draw exits love.graphics.scale( sx, sy ) sx number The scaling in the direction of the x-axis. sy (sx) number ‘The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.graphics.setBackgroundColor Sets the background color. love.graphics.setBackgroundColor( r, g, b, a ) number The red component (0-255). © number The green component (0-255). b number ‘The blue component (0-255). (255) number The alpha component (0-255). love.graphics.setBackgroundColor( rgba ) reba table ‘A numerical indexed table with the red, green and blue values as numbers. Alpha is 255 if it is not in the table love.graphics.setBlendMode Sets the blending mode. love.graphics.setBlendMode( mode ) node BlendMlode The blend mode to use. love.graphics.setBlendMode( mode, alphamode ) node Blendilode The blend mode to use. alphanode BlendAlphaMiode What to do with the alpha of drawn objects when blending. (alphamultiply") love.graphics.setCanvas Captures drawing operations to a Canvas. love.graphics.setCanvas( canvas, ... ) canvas Canvas Arender target. ses Canvas Additional render targets. love. graphics. setCanvas() love.graphics.setCanvas( canvasi, canvas2, ... ) canvas1 Canvas The first render target. canvas2. Canvas ‘The second render target. ves Canvas More canvases. love.graphics.setColor Sets the color used for drawing. love.graphics.setColor( red, green, blue, alpha ) red number ‘The amount of red. green number ‘The amount of green. blue number Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window ‘The amount of blue. alpha number ‘The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image. love.graphics.setColor( rgba ) rgba table A numerical indexed table with the red, green, blue and alpha values as numbers. The alpha is optional and defaults to 255 if it is left out. love.graphics.setColorMask Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if red is set to false, no further changes will be made to the red component of any pixels. Enables all color components when called without arguments. love.graphics.setColorMask( red, green, blue, alpha ) red boolean Render red component. green boolean Render green component. blue boolean Render blue component. alpha boolean Render alpha component. love. graphics. setColorMask() love.graphics.setDefaultFilter Sets the default scaling filters used with Images, Canvases, and Fonts. This function does not apply retroactively to loaded images. love.graphics.setDefaultFilter( min, mag, anisotropy ) min FillterMode Filter mode used when scaling the image down, mag (min) FilterMode Filter mode used when scaling the image up. anisotropy (1) number ‘Maximum amount of Anisotropic Filtering used. love.graphics.setFont Set an already-loaded Font as the current font or create and load a new one from the file and size. It’s recommended that Font objects are created with love. graphics.newFont in the loading stage and then passed to this function in the drawing stage. love.graphics.setFont( font ) font Font ‘The Font object to use. love.graphics.setLineJoin Sets the line join style. love.graphics.setLineJoin( join ) Callbacks audio event, filesystem graphics image Joystick keyboard math mouse physics sound system thread timer touch video window join LineJoin The LineJoin to use. love.graphics.setLineStyle Sets the line style. love. graphics. setLinestyle( style ) style LineStyle The LineStyle to use. love.graphics.setLineWidth Sets the line width. love.graphics.setLinewidth( width ) width number ‘The width of the line. love.graphics.setNewFont Creates and sets a new font. font = love.graphics.setNewFont( filename, size ) font Font The new font. filename string ‘The path and name of the file with the font. size (12) number ‘The size of the font. font = love.graphics.setNewFont( file, size ) font Font ‘The new font. file File AFile with the font. size (12) number ‘The size of the font. font = love.graphics.setNewFont( data, size ) font Font ‘The new font. data bata A Data with the font. size (12) number ‘The size of the font. love.graphics.setPointSize Sets the point size. love.graphics.setPointSize( size ) size number ‘The new point size. love.graphics.setScissor Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Sets or disables scissor. The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. love.graphics.setScissor( x, y, width, height ) x number The X coordinate of upper left corner. y number The Y coordinate of upper left corner. width number ‘The width of clipping rectangle. height number The height of clipping rectangle. love. graphics. setScissor() love.graphics.setShader Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next love.graphics.setShader will be drawn using the Shader object specified. Disables the shaders when called without arguments, love. graphics. setShader() love.graphics.setShader( shader ) shader Shader ‘The new shader, love.graphics.setStencilTest Configures or disables stencil testing. When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil Each Canvas has its own per-pixel stencil values. love.graphics.setStenciltest( comparemode, comparevalue ) comparemode CompareMode The type of comparison to make for each pixel. comparevalue number ‘The value to use when comparing with the stencil value of each pixel. Must be between 0 and 255. love. graphics. setStencilTest() love.graphics.setWireframe Sets whether wireframe lines will be used when drawing. Wireframe mode should only be used for debugging. The lines drawn with it enabled do nat behave like regular love. graphics lines: their widths don't scale with the coordinate transformations or with love.graphics.setLineWidth, and they don't use the smooth LineStyle. love.graphics.setWireframe( enable ) enable boolean True to enable wireframe mode when drawing, false to disable it. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window love.graphics.shear Shears the coordinate system. love.graphics.shear( kx, ky ) kx number ‘The shear factor on the x-axis. ky number ‘The shear factor on the y-axis. love.graphics.stencil Draws geometry as a stencil. The geometry drawn by the supplied function sets invisible stencil values of pixels, instead of setting pixel colors. The stencil values of pixels can act like a mask / stencil - love.graphics.setStencilTest can be used afterward to determine how further rendering is affected by the stencil values in each pixel. Each Canvas has its own per-pixel stencil values. Stencil values are within the range of [0, 255]. love.graphics.stencil( stencilfunction, action, value, keepvalues ) stencilfunction function Function which draws geometry. The stencil values of pixels, rather than the color of each pixel, will be affected by the geometry. action StencilAction How to modify any stencil values of pixels that are touched by ("replace") ‘what's drawn in the stencil function. value (1) number The new stencil value to use for pixels if the “replace” stencil action is used. Has no effect with other stencil actions. Must be between 0 and 255. keepvalues boolean ‘True to preserve old stencil values of pixels, false to re-set every (false) pixels stencil value to 0 before executing the stencil function. love.graphics.clear will also re-set all stencil values. love.graphics.translate Translates the coordinate system in two dimensions. When this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy. Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. This change lasts until love. graphics.clear is called (Which is called automatically before love.draw in the default love.run function), or a love.graphics.pop reverts to a previous coordinate system state. ‘Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating. love.graphics.translate( dx, dy ) dx number The translation relative to the x-axis. dy number The translation relative to the y-axis. Canvas ‘A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but Callbacks that will not be visible until you draw it to the actual visible screen. It is also known as “render to audio texture’. event filesystem By drawing things that do not change position often (such as background items) to the Canvas, and then graphics drawing the entire Canvas instead of each item, you can reduce the number of draw operations image performed each frame. joystick keyboard _{n versions prior to 0.10.0, not all graphics cards that LOVE supported could use Canvases. math love. graphics. isSupported("canvas") could be used to check for support at runtime. mouse BhySiS constructors a love. graphics.newCanvas thread Functions timer Canwvas:getDimensions touch Canwvas:get/setFilter video anvas:getFormat window Canvas:getHelght Canvas: getMSAA Canwas:getWidth Canvas:get/setWrap Canvas:newlmageData Canvas:renderTo Supertypes Object Drawable Texture Canvas:getDimensions Gets the width and height of the Canvas. width, height = Canvas:getDimensions() width number ‘The width of the Canvas, in pixels. height number The height of the Canvas, in pixels. Canvas:getFilter Gets the filter mode of the Canvas. min, mag, anisotropy = Canvas: getFilter() min FilterMlode Filter mode used when minifying the canvas. mag FilterMode Filter mode used when magnifying the canvas. anisotropy number ‘Maximum amount of anisotropic filtering used. Canvas:getFormat Gets the texture format of the Canvas. format = Canvas:getFormat() format CanvasFormat The format of the Canvas. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Canvas:getHeight Gets the height of the Canvas. height = Canvas:getHeight() height number ‘The height of the Canvas, in pixels. Canvas:getMSAA Gets the number of multisample antialiasing (MSAA) samples used when drawing to the Canvas. This may be different than the number used as an argument to love.graphics.newCanvas if the system running LOVE doesn't support that number. samples = Canvas: getMSAA() samples number The number of multisample antialiasing samples used by the ‘canvas when drawing to it. Canvas:getWidth Gets the width of the Canvas. width = Canvas: getwidth() width number ‘The width of the Canvas, in pixels. Canvas:getWrap Gets the wrapping properties of a Canvas. This function returns the currently set horizontal and vertical wrapping modes for the Canvas. horizontal, vertical = Canvas:getWrap() horizontal WrapHode Horizontal wrapping mode of the Canvas. vertical Wraplode Vertical wrapping made of the Canvas. Canvas:newlmageData Generates ImageData from the contents of the Canvas. data = Canvas:newImageData() data ImageData ‘The image data stored in the Canvas. data = Canvas:newImageData( x, y, width, height ) data ImageData _The new ImageData made from the Canvas’ contents. x number The x-axis of the top-left corner of the area within the Canvas to capture. y number The y-axis of the top-left corner of the area within the Canvas to capture. width number ‘The width of the area within the Canvas to capture. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window height number ‘The height of the area within the Canvas to capture. Canvas:renderTo Render to the Canvas using a function. Canvas:renderTo( func ) func function ‘A function performing drawing operations. Canvas:setFilter Sets the filter of the Canvas. Canvas:setFilter( min, mag, anisotropy ) min FilterMode — How to scale a canvas down. mag (min) FilterMode How to scale a canvas up. anisotropy (1) number ‘Maximum amount of anisotropic filtering used. Canvas:setWrap Sets the wrapping properties of a Canvas. This function sets the way the edges of a Canvas are treated if it is scaled or rotated. If the WrapMode is set to "clamp", the edge will not be interpolated. If set to “repeat’, the edge will be interpolated with the pixels on the opposing side of the framebuffer. Canvas:setWrap( horizontal, vertical ) horizontal WrapMode Horizontal wrapping mode of the Canvas. vertical WrapMode Vertical wrapping mode of the Canvas. (horizontal) Font Defines the shape of characters than can be drawn onto the screen. Constructors jove.graphics.newFont love. graphics.newlmageFont. love. graphics. setNewFont Fun fons ont:getascent Font: getBaseline Font:getDescent Font:get/setFitter Font:getHeight al-get/setLineHeight Font:getWidth Font:getWrap Font: hasGlyphs Font:setFallbacks Supertypes Object Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Font:getAscent Gets the ascent of the Font. The ascent spans the distance between the baseline and the top of the glyph that reaches farthest from the baseline. ascent = Font:getAscent() ascent number ‘The ascent of the Font in pixels. Font:getBaseline Gets the baseline of the Font. Most scripts share the notion of a baseline: an imaginary horizontal line on which characters rest. In some scripts, parts of glyphs lie below the baseline. baseline = Font:getBaseline() baseline number ‘The baseline of the Font in pixels. Font:getDescent Gets the descent of the Font. The descent spans the distance between the baseline and the lowest descending glyph in a typeface. descent = Font:getDescent() descent number ‘The descent of the Font in pixels. Font:getFilter Gets the filter mode for a font. min, mag, anisotropy = Font:getFilter() min Filtertiode Filter mode used when minifying the font. mag FilterMode Filter mode used when magnifying the font. anisotropy number ‘Maximum amount of anisotropic filtering used. Font:getHeight Gets the height of the Font. The height of the font is the size including any spacing; the height which it will need. height = Font:getHeight() height number ‘The height of the Font in pixels. Font:getLineHeight Gets the line height. This will be the value previously set by Font:setLineHeight, or 1.0 by default. height = Font:getLineHeight() height number The current line height. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Font:getWidth Determines the horizontal size a line of text needs. Does not support line-breaks. width = Font:getWidth( line ) width number The width of the line, line string A line of text. etWrap Gets formatting information for text, given a wrap limit. This function accounts for newlines correctly (i.e. \n). width, wrappedtext = For etWrap( text, wraplimit ) width number ‘The maximum width of the wrapped text. wrappedtext table A sequence containing each line of text that was wrapped. text string The text that will be wrapped. wraplimit number ‘The maximum width in pixels of each line that text is allowed before wrapping. Font:hasGlyphs Gets whether the font can render a particular character. hasglyph = Font:hasGlyphs( character ) hasglyph boolean Whether the font can render the glyph represented by the character. character string A unicode character. hasglyph = Font:hasGlyphs( codepoint ) hasglyph boolean Whether the font can render the glyph represented by the codepoint number. codepoint number A unicode codepoint number. Font:setFallbacks Sets the fallback fonts. When the Font doesnt contain a glyph, it will substitute the glyph from the next. subsequent fallback Fonts. This is akin to setting a “font stack" in Cascading Style Sheets (CSS). Font:setFallbacks( fallbackfont1, ... ) fallbackfont1 Font ‘The first fallback Font to use. see Font. Additional fallback Fonts. Font:setFilter Sets the filter mode for a font. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Font:setFilter( min, mag, anisotropy ) min FilterMode How to scale a font down. mag (min) Filtertlode How to scale a font up. anisotropy (1) number ‘Maximum amount of anisotropic filtering used. Font:setLineHeight Sets the line height. When rendering the font in lines the actual height will be determined by the line height multiplied by the height of the font. The default is 1.0. Font:setLineHeight( height ) height number The new line height. Mesh ‘A.2D polygon mesh used for drawing arbitrary textured shapes. Constructors love. graphics.newMesh Fun Mesh: get/ setDrawMode Mesh:get/setDrawRange Mesh:get/setTexture Mesh:get/setVertex Mesh:get/setVertexAttribute Mesh:getVertexCount Mesh:getVertexFormat Mesh:get/setVertexMap Mesh:is/setAttributeEnabled Mesh:setVertexColors Mesh:setVertices Supertypes Drawable Object Mesh:attachAttribute Attaches a vertex attribute from a different Mesh onto this Mesh, for use when drawing. This can be used to share vertex attribute data between several different Meshes. Mesh:attachattribute( name, mesh ) name string The name of the vertex attribute to attach. mesh Mesh ‘The Mesh to get the vertex attribute from. Mesh:getDrawMode Gets the mode used when drawing the Mesh. mode = Mesh: getDrawMode() mode MeshDrawMode The mode used when drawing the Mesh. Callbacks audio event filesystem graphics image joystick keyboard math mouse physics sound system thread timer touch video window Mesh:getDrawRange Gets the range of vertices used when drawing the Mesh. If the Mesh’s draw range has not been set previousty with Mesh:setDrawRange, this function will return nil. min, max = Mesh:getDrawRange() min number ‘The index of the first vertex used when drawing, or the index of the first value in the vertex map used if one is set for this Mesh. max number ‘The index of the last vertex used when drawing, or the index of the last value in the vertex map used if one is set for this Mesh. Mesh:getTexture Gets the texture (Image or Canvas) used when drawing the Mesh. texture = Mesh:getTexture() texture Texture ‘The Image or Canvas to texture the Mesh with when drawing, or nil if none is set. Mesh:getVertex Gets the properties of a vertex in the Mesh. attributecomponent, ... = Mesh:getVertex( index ) attributecomponent number The first component of the first vertex attribute in the specified vertex. see number Additional components of all vertex attributes in the specified vertex. index number ‘The index of the the vertex you want to retrieve the information for. % Yo Us Vs Ps B by a = Mesh:getVertex( index ) x number ‘The position of the vertex on the x-axis. y number ‘The position of the vertex on the y-axis. u number ‘The horizontal component of the texture coordinate. v number ‘The vertical component of the texture coordinate. number The red component of the vertex's color. number ‘The green component of the vertex’s color. b number ‘The blue component of the vertex’s color. @ number ‘The alpha component of the vertex’s color. index number ‘The index of the the vertex you want to retrieve the information for. Mesh:getVertexAttribute Gets the properties of a specific attribute within a vertex in the Mesh, Meshes without a custom vertex format specified in love. graphics.newMesh have position as their first attribute, texture coordinates as their second attribute, and color as their third attribute.

You might also like