拖放目录

当一个目录拖放到窗口时触发。

拖放目录(path)

path | string | 全依赖于平台的目录路径。

画面显示

用来在屏幕上的每个框架绘制。

画面显示()

拖放文件

当一个文件拖放到窗口触发。

拖放文件(file)

file | File | 未打开的File对象。

窗口获得焦点

窗口接收或失去焦点时触发。

窗口获得焦点(f)

f | boolean | 窗口焦点。

游戏板摇杆

操纵杆的虚拟手柄轴移动时调用。

游戏板摇杆(joystick,axis)

joystick | Joystick | 手柄对象。
axis | GamepadAxis | 虚拟手柄轴。

游戏板按下

操纵杆的虚拟手柄按钮被按下时调用。

游戏板按下(joystick,button)

joystick | Joystick | 手柄对象。
button | GamepadButton | 虚拟手柄按钮。

游戏板放开

操纵杆的虚拟手柄按钮被释放时调用。

游戏板放开(joystick,button)

joystick | Joystick | 手柄对象。
button | GamepadButton | 虚拟手柄按钮。

手柄连入

操纵杆连接时调用。

手柄连入(joystick)

joystick | Joystick | 手柄对象。

手柄摇杆

操纵杆轴移动时调用。

手柄摇杆(joystick,axis,value)

joystick | Joystick | 手柄对象。
axis | number | 轴数。
value | number | 值。

手柄杆帽

操纵杆帽子方向变化时调用。

手柄杆帽(joystick,hat,direction)

joystick | Joystick | 手柄对象。
hat | number | 杆帽数。
direction | JoystickHat | 方向值。

手柄按下

操纵杆按钮被按下时调用。

手柄按下(joystick,button)

joystick | number | 游戏杆数。
button | number | 按钮数。

手柄放开

一个操纵杆按钮被释放时调用。

手柄放开(joystick,button)

joystick | number | 游戏杆数。
button | number | 按钮数。

手柄移除

操纵杆断开连接时调用。

手柄移除(joystick)

joystick | Joystick | 断开的手柄对象。

键盘按下

按键被按下时触发。

键盘按下(key,scancode,isrepeat)

key | KeyConstant | 键
scancode | Scancode | 按下键的扫描代码。
isrepeat | boolean | 这是否按键事件是重复。键重复之间的延迟取决于用户的系统的设置。

键盘放开

按键放开时会触发释放。

键盘放开(key)

key | KeyConstant | 键。

键盘放开(key,scancode)

key | KeyConstant | 键。
scancode | Scancode | 按下键的扫描代码。

按键放开时会触发释放。

键盘放开(key)

key | KeyConstant | 键。

键盘放开(key,scancode)

key | KeyConstant | 键。
scancode | Scancode | 按下键的扫描代码。

引擎创建

在系统创建时调用一次。

引擎创建(arg)

arg | table | 参数表。

内存不足

当系统在移动设备上的内存耗尽时触发。
移动操作系统可以强行关闭游戏，如果它使用了太多的内存，所以任何非关键资源应该被删除，如果可能的（通过设置引用资源，以零所有的变量，并调用collectgarbage（）），当触发此事件。声音，特别是图像倾向于使用最多的内存。

内存不足()

鼠标移动

当鼠标移动时触发。

鼠标移动(x,y,dx,dy)

x | number | X轴的位置。
y | number | Y轴的位置。
dx | number | 自从上一次鼠标移动沿着x轴移动的量被调用。
dy | number | 自从上一次鼠标移动沿Y轴移动的量被调用。

鼠标按下

鼠标按键被按下时触发。

鼠标按下(x,y,button,isTouch)

x | number | X轴的位置。
y | number | Y轴的位置。
button | number | 被按下的键索引。1是主按钮（通常左单击），2是第二按钮。依次类推。
isTouch | boolean | 真如果鼠标键按源于触摸屏触摸机。

鼠标放开

释放鼠标按钮时触发。

鼠标放开(x,y,button,isTouch)

x | number | X轴的位置。
y | number | Y轴的位置。
button | number | 被按下的键索引。1是主按钮（通常左单击），2是第二按钮。依次类推。
isTouch | boolean | True如果鼠标键按源于触摸屏触摸机。

窗口即将销毁

游戏关闭时触发。

r=窗口即将销毁()

r | boolean | False，关闭游戏。True，不关闭游戏。

窗口尺寸变化

当窗口大小，例如，如果用户改变窗口，或称为如果窗口信息被称为在全屏不受支持的宽度或高度和窗口选取最接近的合适的尺寸。
调用窗口显示置信息，如果窗口的呼叫后，宽度和高度没有要求的宽度和高度匹配只会触发此事件。如果请求全屏模式不匹配任何支持的模式，或者如果全屏幕类型是“desktop”，并请求宽度或高度不桌面分辨率匹配会发生这种情况。

窗口尺寸变化(w,h)

w | number | 宽度。
h | number | 高度。

文本编辑

候选文本输入法(输入法编辑)已经改变时调用。
候选人的文字是不是最终文本，用户最终会选择。使用文本输入了点。

文本编辑(text,start,length)

text | string | 在UTF-8编码的Unicode文本候选人。
start | number | 所选择的候选的文字的开始光标。
length | number | 所选择的候选的文字的长度。可能是0。

文本输入

用户输入文本时调用。

文本输入(text)

text | string | 在UTF-8编码的Unicode文本。

线程错误

线程遇到错误时调用。

线程错误(thread,errorstr)

thread | Thread | 产生错误的线程。
errorstr | string | 错误信息。

触屏移动

触碰时会触发按触摸屏内移动。

触屏移动(id,x,y,pressure)

id | light userdata | 该标识为触摸按。
x | number | X轴的位置。
y | number | Y轴的位置。
pressure | number | 施加的压力的量。大多数触摸屏不是压力敏感，在这种情况下压力将是1。

触屏按下

触摸屏触摸时调用。

触屏按下(id,x,y,pressure)

id | light userdata | 该标识为触摸按。
x | number | X轴的位置。
y | number | Y轴的位置。
pressure | number | 施加的压力的量。大多数触摸屏不是压力敏感，在这种情况下压力将是1。

触屏放开

触摸屏停止被触碰时触发。

触屏放开(id,x,y,pressure)

id | light userdata | 该标识为触摸按。
x | number | X轴的位置。
y | number | Y轴的位置。
pressure | number | 施加的压力的量。大多数触摸屏不是压力敏感，在这种情况下压力将是1。

逻辑更新

按键被按下时触发。

逻辑更新(dt)

dt | number | 由于在几秒钟内的最后更新时间。

窗口可视状态

当窗口最小化/隐藏/最小化时触发。

窗口可视状态(v)

v | boolean | 可视状态。

滚轮移动

鼠标滚轮移动时触发。

滚轮移动(x,y)

x | number | 水平鼠标滚轮移动量。正值表示向右移动。
y | number | 垂直鼠标滚轮移动量。正值表示向上运动。

Data:getPointer

获取一个指针数据。

pointer=Data:getPointer()

pointer | light userdata | 原始指针到数据。

Data:getSize

获取数据的大小。

size=Data:getSize()

size | number | 数据的字节大小。

Data:getString

获取完整的数据作为一个字符串。

data=Data:getString()

data | string | 原始数据。

Object:type

获得对象的类型为字符串。

type=Object:type()

type | string | 表示类型的字符串。

Object:typeOf

检查是否一个特定类型的对象。

b=Object:typeOf(name)

b | boolean | True如果对象是指定的类型，否则为false。

name | string | 类型匹配对象。

声音播放love.audio

取距离模式

Returns the distance attenuation model.

model=取距离模式()

model | DistanceModel | The current distance model.The default is'inverse clamped'.

取多普勒缩放

Gets the current global scale factor for velocity-based doppler effects.

scale=取多普勒缩放()

scale | number | The current doppler scale factor.

取声音方位

Returns the orientation of the listener.

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.
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.

取声音位置

Returns the position of the listener.

x,y,z=取声音位置()

x | number | The X position of the listener.
y | number | The Y position of the listener.
z | number | The Z position of the listener.

取声音总数

Returns the number of sources which are currently playing or paused.

numSources=取声音总数()

numSources | number | The number of sources which are currently playing or paused.

取播放速度

Returns the velocity of the listener.

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.

取音量

Returns the master volume.

volume=取音量()

volume | number | The current master volume.

创建声音

Creates a new Source from a file or SoundData.Sources created from SoundData are always static.

source=创建声音(filename,type)

source | Source | A new Source that can play the specified audio.

filename | string | The filepath to create a Source from.
type("stream") | SourceType | Streaming or static source.

source=创建声音(file,type)

source | Source | A new Source that can play the specified audio.

file | File | A File pointing to an audio file.
type("stream") | SourceType | Streaming or static source.

source=创建声音(decoder,type)

source | Source | A new Source that can play the specified audio.

decoder | Decoder | The Decoder to create a Source from.
type("stream") | SourceType | Streaming or static source.

source=创建声音(soundData)

source | Source | A new 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=创建声音(fileData)

source | Source | A new Source that can play the specified audio.

fileData | FileData | The FileData to create a Source from.

暂停播放

Pauses all audio

暂停播放()

暂停播放(source)

source | Source | The source on which to pause the playback.

播放声音

Plays the specified Source.

播放声音(source)

source | Source | The Source to play.

重新播放

Resumes all audio

重新播放()

重新播放(source)

source | Source | The source on which to resume the playback.

倒带播放

Rewinds all playing audio.

倒带播放()

倒带播放(source)

source | Source | The source to rewind.

置距离模式

Sets the distance attenuation model.

置距离模式(model)

model | DistanceModel | The new distance model.

置多普勒缩放

Sets a global scale factor for velocity-based doppler effects.The default scale value is 1.

置多普勒缩放(scale)

scale | number | The new doppler scale factor.The scale must be greater than 0.

置声音方位

Sets the orientation of the listener.

置声音方位(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.
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.

置声音位置

Sets the position of the listener,which determines how sounds play.

置声音位置(x,y,z)

x | number | The X position of the listener.
y | number | The Y position of the listener.
z | number | The Z position of the listener.

置播放速度

Sets the velocity of the listener.

置播放速度(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.

置音量

Sets the master volume.

置音量(volume)

volume | number | 1.0f is max and 0.0f is off.

停止播放

Stops all playing audio.

停止播放()

停止播放(source)

source | Source | The source on which to stop the playback.

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创建声音,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=Source:clone()

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.

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, y, z= Source:getDirection()

x | number | The X part of the direction vector.
y | number | The Y part of the direction vector.
z | 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 return -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.

Source:getPosition

Gets the position of the Source.

x, y, z= Source:getPosition()

x | number | The X position of the Source.
y | number | The Y position of the Source.
z | number | The Z position of the Source.

Source:getRolloff

Returns the rolloff factor of the source.

rolloff= Source:getRolloff()

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.

x, y, z= Source:getVelocity()

x | number | The X part of the velocity vector.
y | number | The Y part of the velocity vector.
z | 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.

Source:isLooping

Returns whether the Source will loop.

loop= Source:isLooping()

loop | boolean | True if the Source will loop, false otherwise.

Source:isPaused

Returns whether the Source is paused.

paused= Source:isPaused()

paused | boolean | True if the Source is paused, false otherwise.

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()

Source:rewind

Rewinds a Source.

Source:rewind()

Source:seek

Sets the playing position of the Source.

Source:seek(position, unit)

position | number | The position to seek to.
unit("seconds") | TimeUnit | The unit of the position value.

Source:setDirection

Sets the direction vector of the Source. A zero vector makes the source non-directional.

Source:setDirection(x, y, z)

x | number | The X part of the direction vector.
y | number | The Y part of the direction vector.
z | number | The Z part of the direction vector.

Source:setAttenuationDistances

Sets the reference and maximum distance of the source.

Source:setAttenuationDistances(ref, max)

ref | number | The new reference distance.
max | number | The new maximum distance.

Source:setCone

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 | 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(0) | number | The Source's volume when the listener is outside both the inner and outer cone angles.

Source:setLooping

Sets whether the Source should loop.

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.
z | number | The Z position of the Source.

Source:setRolloff

Sets the rolloff factor.

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)

x | number | The X part of the velocity vector.
y | number | The Y part of the velocity vector.
z | number | The Z part of the velocity vector.

Source:setVolume

Sets the volume of the Source.

Source:setVolume(volume)

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

none

Sources do not get attenuated.

inverse

Inverse distance attenuation.

inverseclamped

Inverse distance attenuation.Gain is clamped.

linear

Linear attenuation.

linearclamped

Linear attenuation.Gain is clamped.

exponent

Exponential attenuation.

exponentclamped

Exponential attenuation.Gain is clamped.

SourceType

static

Decode the entire sound at once.

stream

Stream the sound;decode it gradually.

TimeUnit

seconds

Regular seconds.

samples

Audio samples.

引擎事件love.event

事件清除

Clears the event queue.

事件清除()

事件投递

Returns an iterator for messages in the event queue.

i=事件投递()

i | function | Iterator function usable in a for loop.

事件弹出

Pump events into the event queue.This is a low-level function,and is usually not called by the user,but by love.run.Note that this does need to be called for any OS to think you're still running, and if you want to handle OS-generated events at all (think callbacks). 事件弹出 can only be called from the main thread, but afterwards, the rest of love.event can be used from any other thread.

事件弹出()

事件压入

Adds an event to the event queue.

事件压入(e, a, b, c, d)

e | Event | The name of the event.
a(nil) | mixed | First event arg.
b(nil) | mixed | Second event arg.
c(nil) | mixed | Third event arg.
d(nil) | mixed | Fourth event arg.

事件停止

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窗口即将销毁callback.

事件停止(exitstatus)

exitstatus(0) | number | The program exit status to use when closing the application.

事件等待

Like事件投递but blocks until there is an event in the queue.

e,a,b,c,d=事件等待()

e | Event | The type of event.
a | mixed | First event arg.
b | mixed | Second event arg.
c | mixed | Third event arg.
d | mixed | Fourth event arg.

Event

窗口获得焦点

Window focus gained or lost

手柄摇杆

Joystick axis motion

手柄杆帽

Joystick hat pressed

手柄按下

Joystick pressed

手柄放开

Joystick released

键盘按下

Key pressed

键盘放开

Key released

mousefocus

Window mouse focus gained or lost

鼠标按下

Mouse pressed

鼠标放开

Mouse released

窗口尺寸变化

Window size changed by the user

线程错误

A Lua error has occurred in a thread.

窗口即将销毁

Quit

窗口可视状态

Window is minimized or un-minimized by the user

文件操作love.filesystem

追加数据

Append data to an existing file.

success,errormsg=追加数据(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.

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.

创建目录

Creates a directory.

ok=创建目录(name)

ok | boolean | True if the directory was created,false if not.

name | string | The directory to create.

是否存在

Check whether a file or directory exists.

exists=是否存在(filename)

exists | boolean | True if there is a file or directory with the specified name.False otherwise.

filename | string | The path to a potential file or directory.

取数据路径

Returns the application data directory(could be the same as getUserDirectory)

path=取数据路径()

path | string | The path of the application data directory.

遍历目录

Returns a table with the names of files and subdirectories in the specified path.The table is not sorted in any way;the order is undefined.
If the path passed to the function exists in the game and the save directory,it will list the files and directories from both places.

items=遍历目录(dir)

items | table | A sequence with the names of all files and subdirectories as strings.

dir | string | The directory.

取写入路径

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.

取写入路径(name)

name | string | The identity that is used as write directory.

取最后修改时间

Gets the last modification time of a file.

modtime,errormsg=取最后修改时间(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.

取绝对路径

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= 取绝对路径(filepath)

realdir | string | The platform-specific full path of the directory containing the filepath.

filepath | string | The filepath to get the directory of.

取保存路径

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= 取保存路径()

path | string | The absolute path to the save directory.

取数据尺寸

Gets the size in bytes of a file.

size, errormsg= 取数据尺寸(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.

取当前路径

Returns the path of the user's directory.

path=取当前路径()

path | string | The path of the user's directory.

取运行路径

Gets the current working directory.

path= 取运行路径()

path | string | The current working directory.

是否目录

Check whether something is a directory.

is_dir= 是否目录(path)

is_dir | boolean | True if there is a directory with the specified name. False otherwise.

path | string | The path to a potential directory.

是否文件

Check whether something is a file.

is_file= 是否文件(path)

is_file | boolean | True if there is a file with the specified name. False otherwise.

path | string | The path to a potential file.

迭代文本行

Iterate over the lines in a file.

iterator= 迭代文本行(name)

iterator | function | A function that iterates over all the lines in the file.

name | string | The name (and path) of the file.

创建文件

Creates a new File object. It needs to be opened before it can be accessed.

file, errorstr= 创建文件(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.

创建文件数据

Creates a new FileData object.

data= 创建文件数据(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.

读入数据

Read the contents of a file.

contents, size= 读入数据(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.

删除文件

Removes a file or directory.

ok= 删除文件(name)

ok | boolean | True if the file/directory was removed, false otherwise.

name | string | The file or directory to remove.

置写入路径

Sets the write directory for your game. Note that you can only set the name of the folder to store your files in, not the location.

置写入路径(name, appendToPath)

name | string | The new identity that will be used as write directory.
appendToPath(false) | boolean | Whether the identity directory will be searched when reading a filepath before or after the game's source directory and any currently mounted archives.

写到文件

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置写入路径or by setting the identity field in系统配置.

success=写到文件(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: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 拖放文件 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()

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 置写入路径 or by setting the identity field in 系统配置.

ok= File:open(mode)

ok | 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)

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:getExtension

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.

base64

The data is base64-encoded.

FileMode

r

Open a file for read.

w

Open a file for write.

a

Open a file for append.

c

Do not open a file(represents a closed file.)

图形渲染love.graphics

画圆弧

Draws an arc.

画圆弧(mode,x,y,radius,angle1,angle2,segments)

mode | DrawMode | How to draw the arc.
x | number | The position of the center along x-axis.
y | number | The position of the center along y-axis.
radius | number | Radius of the arc.
angle1 | number | The angle at which the arc begins.
angle2 | number | The angle at which the arc terminates.
segments(10) | number | The number of segments used for drawing the arc.

画圆圈

Draws a 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(max(radius,10)) | number | The number of segments used for drawing the circle.

清屏

Note that the scissor area bounds the cleared region.

清屏()

清屏(r,g,b,a)

r | 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.

清屏(color,...)

color | table | A table in the form of{r,g,b,a}containing the color to clear the first active Canvas to.
... | table | Additional tables for each active Canvas.

抛弃对象

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抛弃对象rather than calling清屏or doing nothing may improve performance on mobile devices.
On some desktop systems this function may do nothing.

抛弃对象(discardcolor,discardstencil)

discardcolor(true) | boolean | Whether to discard the texture(s)of the active Canvas(es)(the contents of the screen if no Canvas is active).
discardstencil(true) | boolean | Whether to discard the contents of the stencil buffer of the screen/active Canvas.

抛弃对象(discardcolors,discardstencil)

discardcolors | table | An array containing boolean values indicating whether to discard the texture of each active Canvas,when multiple simultaneous Canvases are active.
discardstencil(true) | boolean | Whether to discard the contents of the stencil buffer of the screen/active Canvas.

绘制

Draws objects on screen.Drawable objects are loaded images,but may be other kinds of Drawable objects,such as a ParticleSystem.
In addition to simple drawing,this function can rotate and scale the object at the same time,as well as offset the image(for example,to center the image at the chosen coordinates).
绘制anchors from the top left corner by default.
You can specify a negative value for sx or sy to flip the drawable horizontally or vertically.
The pivotal point is(x,y)on the screen and(ox,oy)in the internal coordinate system of the drawable object,before rotation and scaling.The object is scaled by(sx,sy),then rotated by r around the pivotal point.
The origin offset values are most often used to shift the images up and left by half of its height and width,so that(effectively)the specified x and y coordinates are where the center of the image will end up.

绘制(drawable,x,y,r,sx,sy,ox,oy,kx,ky)

drawable | Drawable | A drawable object.
x(0) | number | The position to draw the object(x-axis).
y(0) | number | The position to draw the object(y-axis).
r(0) | number | Orientation(radians).
sx(1) | number | Scale factor(x-axis).Can be negative.
sy(sx) | number | Scale factor(y-axis).Can be negative.
ox(0) | number | Origin offset(x-axis).(A value of 20 would effectively move your drawable object 20 pixels to the left.)
oy(0) | number | Origin offset(y-axis).(A value of 20 would effectively move your drawable object 20 pixels up.)
kx(0) | number | Shearing factor(x-axis).
ky(0) | number | Shearing factor(y-axis).

绘制(texture,quad,x,y,r,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(0) | number | The position to draw the object(x-axis).
y(0) | number | The position to draw the object(y-axis).
r(0) | number | Orientation(radians).
sx(1) | number | Scale factor(x-axis).Can be negative.
sy(sx) | number | Scale factor(y-axis).Can be negative.
ox(0) | number | Origin offset(x-axis).
oy(0) | number | Origin offset(y-axis)
kx(0) | number | Shearing factor(x-axis).
ky(0) | number | Shearing factor(y-axis).

画椭圆

Draws an ellipse.

画椭圆(mode,x,y,radiusx,radiusy)

mode | DrawMode | How to draw the ellipse.
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.)

画椭圆(mode,x,y,radiusx,radiusy,segments)

mode | DrawMode | How to draw the ellipse.
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.)
segments | number | The number of segments used for drawing the ellipse.

取背景色

Gets the current background color.

r,g,b,a=取背景色()

r | number | The red component(0-255).
g | number | The green component(0-255).
b | number | The blue component(0-255).
a | number | The alpha component(0-255).

取混合模式

Gets the blending mode.

mode=取混合模式()

mode | BlendMode | The current blend mode.

取画布

Gets the current target Canvas.

canvas=取画布()

canvas | Canvas | The Canvas set by setCanvas.Returns nil if drawing to the real screen.

取画布格式

Gets the available Canvas formats,and whether each is supported.

formats=取画布格式()

formats | table | A table containing CanvasFormats as keys,and a boolean indicating whether the format is supported as values.Not all systems support all formats.

取颜色

Gets the current color.

r,g,b,a=取颜色()

r | number | The red component(0-255).
g | number | The red component(0-255).
b | number | The blue component(0-255).
a | number | The alpha component(0-255).

取颜色遮罩

Gets the active color components used when drawing.Normally all 4 components are active unless置颜色遮罩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清屏and Canvas:clear as well.

r,g,b,a=取颜色遮罩()

r | boolean | Whether the red color component is active when rendering.
g | 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.

取图像压缩格式

Gets the available compressed image formats,and whether each is supported.

formats=取图像压缩格式()

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.

取过滤器

Returns the default scaling filters used with Images,Canvases,and Fonts.

min,mag,anisotropy=取过滤器()

min | FilterMode | Filter mode used when scaling the image down.
mag | FilterMode | Filter mode used when scaling the image up.
anisotropy | number | Maximum amount of Anisotropic Filtering used.

图形取宽高

Gets the width and height of the window.

width,height=图形取宽高()

width | number | The width of the window.
height | number | The height of the window.

取字体

Gets the current Font object.

font=取字体()

font | Font | The current Font,or nil if none is set.

love.graphics.getFullscreenModes

Gets a list of supported fullscreen modes.

modes=love.graphics.getFullscreenModes()

modes | table | A table of width/height pairs.(Note that this may not be in order.)

图形取高

Gets the height of the window.

height=图形取高()

height | number | The height of the window.

取线条连接风格

Gets the line join style.

join=取线条连接风格()

join | LineJoin | The LineJoin style.

取线条风格

Gets the line style.

style=取线条风格()

style | LineStyle | The current line style.

取线条宽

Gets the current line width.

width=取线条宽()

width | number | The current line width.

取点尺寸

Gets the point size.

size=取点尺寸()

size | number | The current point size.

取显示信息

Gets information about the system's video card and drivers.

name, version, vendor, device= 取显示信息()

name | string | The name of the renderer, e.g. "OpenGL" or "OpenGL ES".
version | string | The version of the renderer with some extra driver-dependent version info, e.g. "2.1 INTEL-8.10.44".
vendor | string | The name of the graphics card vendor, e.g. "Intel Inc".
device | string | The name of the graphics card, e.g. "Intel HD Graphics 3000 OpenGL Engine".

取剪切区域

Gets the current scissor box.

x, y, width, height= 取剪切区域()

x | number | The x component of the top-left point of the box.
y | number | The y component of the top-left point of the box.
width | number | The width of the box.
height | number | The height of the box.

取着色器

Returns the current Shader. Returns nil if none is set.

shader= 取着色器()

shader | Shader | The current Shader.

取引擎状态

Gets performance-related rendering statistics.

drawcalls, canvasswitches, texturememory, images, canvases, fonts= 取引擎状态()

drawcalls | number | The number of draw calls made so far during the current frame. This includes all internal draw calls – for example, drawing smooth lines takes two draw calls.
canvasswitches | number | The number of times the active Canvas has been switched so far during the current frame. This includes all internal canvas switches – for example, calling Canvas:clear if the Canvas isn't active will trigger two canvas switches.
texturememory | number | The estimated total size in bytes of video memory used by all loaded Images,Canvases,and Fonts.
images | number | The number of Image objects currently loaded.
canvases | number | The number of Canvas objects currently loaded.
fonts | number | The number of Font objects currently loaded.

love.graphics.getStencilTest

Gets whether stencil testing is enabled.
When stencil testing is enabled,the geometry of everything that is drawn will be clipped/stencilled out based on whether it intersects with what has been previously drawn to the stencil buffer.
Each Canvas has its own stencil buffer.

enabled,inverted=love.graphics.getStencilTest()

enabled | boolean | Whether stencil testing is enabled.
inverted | boolean | Whether the stencil test is inverted or not.

图形是否支持

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=图形是否支持()

features | table | A table containing GraphicsFeature keys,and boolean values indicating whether each feature is supported.

系统取特征极值

Gets the system-dependent maximum values for love.graphics features.

limits=系统取特征极值()

limits | table | A table containing GraphicsLimit keys,and number values.

图形取宽

Gets the width of the window.

width=图形取宽()

width | number | The width of the window.

通用碰撞

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剪切区域.
The scissor limits the drawing area to a specified rectangle.This affects all graphics calls,including清屏.
The dimensions of the scissor is unaffected by graphical transformations(translate,scale,...).

通用碰撞(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 corner 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.

是否伽马修正

Gets whether gamma-correct rendering is supported and enabled.It can be enabled by setting t.gammacorrect=true in系统配置.
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=是否伽马修正()

gammacorrect | boolean | True if gamma-correct rendering is supported and was enabled in系统配置,false otherwise.

取线框模式

Gets whether wireframe mode is used when drawing.

wireframe=取线框模式()

wireframe | boolean | True if wireframe lines are used when drawing,false if it's not.

画线

Draws lines between points.

画线(x1, y1, x2, y2, ...)

x1 | number | The position of first point on the x-axis.
y1 | 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.
... | number | You can continue passing point positions to draw a polyline.

画线(points)

points | table | A table of point positions.

创建画布

Creates a new Canvas object for offscreen rendering.
Antialiased Canvases have slightly higher system requirements than normal Canvases. Additionally, the supported maximum number of FSAA samples varies depending on the system. Use love.graphics.getSystemLimit to check.
If the number of FSAA 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= 创建画布(width, height, texture_type, fsaa)

canvas | Canvas | A new Canvas object.

width(window width) | number | The width of the Canvas.
height(window height) | number | The height of the Canvas.
texture_type("normal") | TextureFormat | The desired texture mode of the Canvas.
fsaa(0) | number | The desired number of antialiasing samples used when drawing to the Canvas.

创建字体

Creates a new Font.

font= 创建字体(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= 创建字体(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= 创建字体(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= 创建字体(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.

创建图像

Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image.

image= 创建图像(filename)

image | Image | An Image object which can be drawn on screen.

filename | string | The filepath to the image file.

image= 创建图像(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 窗口置信息 is called.

image= 创建图像(compressedImageData)

image | Image | An Image object which can be drawn on screen.

compressedImageData | CompressedImageData | A CompressedImageData object. The Image will use this CompressedImageData to reload itself when 窗口置信息 is called.

image= 创建图像(filename, flags)

image | Image | An Image object which can be drawn on screen.

filename | string | The filepath to the image file (or a FileData or ImageData or CompressedImageData object).
flags | table | A table containing the following fields:

flags.linear(false) | boolean | True if the image's pixels should be interpreted as being linear RGB rather than sRGB-encoded,if gamma-correct rendering is enabled.Has no effect otherwise.
flags.mipmaps(false) | boolean or table | If true,mipmaps for the image will be automatically generated(or taken from the images's file if possible, if the image originated from a CompressedImageData). If this value is a table, it should contain a list of other filenames of images of the same format that have progressively half-sized dimensions, all the way down to 1x1. Those images will be used as this Image's mipmap levels.

创建图像字体

Creates a new Font by loading a specifically formatted image.There can be up to 256 glyphs.
In versions prior to 0.9.0,LOVE expects ISO 8859-1 encoding for the glyphs string.

font=创建图像字体(filename,glyphs)

font | Font | A Font object which can be used to draw text on screen.

filename | string | The filepath to the image file.
glyphs | string | A string of the characters in the image in order from left to right.

font=创建图像字体(image,glyphs)

font | Font | A Font object which can be used to draw text on screen.

image | Image | The Image object to create the font from.
glyphs | string | A string of the characters in the image in order from left to right.

font=创建图像字体(filename,glyphs,extraspacing)

font | Font | A Font object which can be used to draw text on screen.

filename | string | The filepath to the image file.
glyphs | string | A string of the characters in the image in order from left to right.
extraspacing | number | Additional spacing(positive or negative)to apply to each glyph in the Font.

创建网格

Creates a new Mesh.
Use Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it's drawn.

mesh= 创建网格(vertices, mode, usage)

mesh | Mesh | The new Mesh.

vertices | table | The table filled with vertex information tables for each vertex as follows:

vertices.[1] | number | The position of the vertex on the x-axis.
vertices.[2] | number | The position of the vertex on the y-axis.
vertices.[3](0) | 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.)
vertices.[4](0) | 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.)
vertices.[5](255) | number | The red component of the vertex color.
vertices.[6](255) | number | The green component of the vertex color.
vertices.[7](255) | number | The blue component of the vertex color.
vertices.[8](255) | number | The alpha component of the vertex color.
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=创建网格(vertexcount,mode,usage)

mesh | Mesh | The new Mesh.

vertexcount | number | The total number of vertices the Mesh will use.Each vertex is initialized to{0,0,0,0,255,255,255,255}.
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= 创建网格(vertexformat, vertices, mode, usage)

mesh | Mesh | The new Mesh.

vertexformat | table | A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex.

vertexformat.attribute | table | A table containing the attribute's name,it's data type, and the number of components in the attribute, in the form of {name, datatype, components}.
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.attributecomponent | number | The first component of the first vertex attribute in the 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=创建网格(vertexformat,vertexcount,mode,usage)

mesh | Mesh | The new Mesh.

vertexformat | table | A table in the form of{attribute,...}.Each attribute is a table which specifies a custom vertex attribute used for each vertex.

vertexformat.attribute | table | A table containing the attribute's name, it's data type,and the number of components in the attribute,in the form of{name,datatype,components}.
vertexformat.... | table | Additional vertex attribute format tables.
vertexcount | number | The total number of vertices the Mesh will use.
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.

创建粒子

Creates a new ParticleSystem.

system= 创建粒子(texture, buffer)

system | ParticleSystem | A new ParticleSystem.

texture | Texture | The Image or Canvas to use.
buffer | number | The max number of particles at the same time.

创建四边形

Creates a new Quad.
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= 创建四边形(x, y, width, height, sw, sh)

quad | Quad | The new Quad.

x | number | The top-left position along the x-axis.
y | number | The top-left position along the y-axis.
width | number | The width of the Quad.
height | number | The height of the Quad.
sw | number | The reference width, the width of the Image.
sh | number | The reference height, the height of the Image.

创建截图

Creates a screenshot and returns the image data.

screenshot= 创建截图()

screenshot | ImageData | The image data of the screenshot.

创建着色器

Creates a 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= 创建着色器(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= 创建着色器(pixelcode, vertexcode)

shader | Shader | A Shader object for use in drawing operations.

pixelcode | string | The pixel shader code, or a filename pointing to a file with the code.
vertexcode | string | The vertex shader code, or a filename pointing to a file with the code.

创建精灵组

Creates a new SpriteBatch object.

spriteBatch= 创建精灵组(image, maxsprites)

spriteBatch | SpriteBatch | The new SpriteBatch.

image | Image | The Image to use for the sprites.
maxsprites(1000) | number | The maximum number of sprites that the SpriteBatch can contain at any given time.

spriteBatch= 创建精灵组(image, maxsprites, usage)

spriteBatch | SpriteBatch | The new SpriteBatch.

image | Image | The Image to use for the sprites.
maxsprites(1000) | number | The maximum number of sprites that the SpriteBatch can contain at any given time.
usage("dynamic") | SpriteBatchUsage | The expected usage of the SpriteBatch. The specified usage mode affects the SpriteBatch's memory usage and performance.

spriteBatch=创建精灵组(texture,maxsprites,usage)

spriteBatch | SpriteBatch | The new SpriteBatch.

texture | Texture | The Image or Canvas to use for the sprites.
maxsprites(1000) | number | The max number of sprites.
usage("dynamic") | SpriteBatchUsage | The expected usage of the SpriteBatch.The specified usage mode affects the SpriteBatch's memory usage and performance.

创建图像文字

Creates a new Font.

text= 创建图像文字(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.

创建视频

Creates a new drawable Video. Currently only Ogg Theora video files are supported.

video= 创建视频(filename, loadaudio)

video | Video | A new 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=创建视频(Video,loadaudio)

video | Video | A new Video.

Video | Video | 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.

坐标重置

Resets the current coordinate transformation.
This function is always used to reverse any previous calls to 坐标旋转, 坐标缩放, 坐标剪切 or 坐标切换. It returns the current transformation state to its defaults.

坐标重置()

画点

Draws one or more points.

画点(x, y, ...)

x | number | The position of the first point on the x-axis.
y | number | The position of the first point on the y-axis.
... | number | The x and y coordinates of additional points.

画点(points)

points | table | A table containing multiple point positions, in the form of {x, y, ...}.

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.

画点(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, r, 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, r, g, 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, r, g, b, a}. The color components are optional.

画多边形

Draw a polygon.
Following the mode arg, this function can accept multiple numeric args or a single table of numeric args. In either case the args 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.

画多边形(mode,...)

mode | DrawMode | How to draw the polygon.
... | number | The vertices of the polygon.

画多边形(mode,vertices)

mode | DrawMode | How to draw the polygon.
vertices | table | The vertices of the polygon as a table.

坐标恢复

Pops the current coordinate transformation from the transformation stack.
This function is always used to reverse a previous push operation.It returns the current transformation state to what it was before the last preceding push.For an example,see the description of坐标保存.

坐标恢复()

画文本

Draws text on screen.If no Font is set,one will be created and set(once)if needed.
When using translation and scaling functions while drawing text,this function assumes the scale occurs first.If you don't script with this in mind, the text won't be in the right position,or possibly even on screen.
画文本stops at the first''(null)character.This can bite you if you are appending keystrokes to form your string,as some of those are multi-byte unicode characters which will likely contain null bytes.

画文本(text,x,y,r,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(0) | number | Orientation(radians).
sx(1) | number | Scale factor(x-axis).
sy(sx) | number | Scale factor(y-axis).
ox(0) | number | Origin offset(x-axis).
oy(0) | number | Origin offset(y-axis).
kx(0) | number | Shear factor(x-axis).
ky(0) | number | Shear factor(y-axis).

画文本(coloredtext,x,y,angle,sx,sy,ox,oy,kx,ky)

coloredtext | table | A table containing colors and strings to add to the object,in the form of{color1,string1,color2,string2,...}.

coloredtext.color1 | table | 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}.
coloredtext.string1 | string | A string of text which has a color specified by the previous color.
coloredtext.color2 | table | 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}.
coloredtext.string2 | string | A string of text which has a color specified by the previous color.
coloredtext.... | tables and strings | Additional colors and 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.
angle(0) | 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.
oy(0) | number | Origin offset on the y-axis.
kx(0) | number | Shearing/skew factor on the x-axis.
ky(0) | number | Shearing/skew factor on the y-axis.

画格式文本

绘制格式化文本，具有自动换行和对齐方式。
See additional notes in画文本.

画格式文本(text,x,y,limit,align,r,sx,sy,ox,oy,kx,ky)

text | string | A text string.
x | number | The position on the x-axis.
y | number | The position on the y-axis.
limit | number | Wrap the line after this many horizontal pixels.
align("left") | AlignMode | The alignment.
r(0) | number | Orientation(radians).
sx(1) | number | Scale factor(x-axis).
sy(sx) | number | Scale factor(y-axis).
ox(0) | number | Origin offset(x-axis).
oy(0) | number | Origin offset(y-axis).
kx(0) | number | Shear factor(x-axis).
ky(0) | number | Shear factor(y-axis).

画格式文本(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{color1,string1,color2,string2,...}.

coloredtext.color1 | table | 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}.
coloredtext.string1 | string | A string of text which has a color specified by the previous color.
coloredtext.color2 | table | 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}.
coloredtext.string2 | string | A string of text which has a color specified by the previous color.
coloredtext.... | tables and strings | Additional colors and 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.
wraplimit | 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(0) | 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.
oy(0) | number | Origin offset on the y-axis.
kx(0) | number | Shearing/skew factor on the x-axis.
ky(0) | number | Shearing/skew factor on the y-axis.

画矩形

Draws a 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.

画矩形(mode,x,y,width,height,rx,ry,segments)

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 half the rectangle's width.
ry(rx) | 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.

坐标保存

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.

坐标保存()

坐标保存(stack)

stack | StackType | The type of stack to push(e.g.just transformation state,or all love.graphics state).

坐标旋转

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画面显示exits.

坐标旋转(angle)

angle | number | The amount to rotate the coordinate system in radians.

坐标缩放

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画面显示exits.

坐标缩放(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.

坐标恢复

Pops the current coordinate transformation from the transformation stack.
This function is always used to reverse a previous push operation.It returns the current transformation state to what it was before the last preceding push.For an example,see the description of坐标保存.

坐标恢复()

置背景色

Sets the background color.

置背景色(r,g,b,a)

r | number | The red component(0-255).
g | number | The green component(0-255).
b | number | The blue component(0-255).
a(255) | number | The alpha component(0-255).

置背景色(rgba)

rgba | table | A numerical indexed table with the red,green and blue values as numbers.Alpha is 255 if it is not in the table

置混合模式

Sets the blending mode.

置混合模式(mode)

mode | BlendMode | The blend mode to use.

置混合模式(mode,alphamode)

mode | BlendMode | The blend mode to use.
alphamode("alphamultiply") | BlendAlphaMode | What to do with the alpha of drawn objects when blending.

置画布

Sets the render target to one or more Canvases.All drawing operations until the next置画布call will be redirected to the specified canvases and not shown on the screen.
All canvas args must have the same widths and heights and the same texture type.Normally the same thing will be drawn on each canvas,but that can be changed if a pixel shader is used with the"effects"function instead of the regular effect.
Not all computers support Canvases,and not all computers which support Canvases will support multiple render targets.Use love.graphics.isSupported to check.
nWhen called without args,the render target is reset to the screen.

置画布()

置画布(canvas,...)

canvas | Canvas | A render target.
... | Canvas | Additional render targets.

置颜色

Sets the color used for drawing.

置颜色(red,green,blue,alpha)

red | number | The amount of red.
green | number | The amount of green.
blue | number | 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.

置颜色(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.

置颜色遮罩

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 args.

置颜色遮罩()

置颜色遮罩(red,green,blue,alpha)

red | boolean | Render red component.
green | boolean | Render green component.
blue | boolean | Render blue component.
alpha | boolean | Render alpha component.

置过滤器

Sets the default scaling filters used with Images,Canvases,and Fonts.
This function does not apply retroactively to loaded images.

置过滤器(min,mag,anisotropy)

min | FilterMode | 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.

置字体

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 创建字体 in the loading stage and then passed to this function in the drawing stage.

置字体(font)

font | Font | The Font object to use.

置线条连接风格

Sets the line join style.

置线条连接风格(join)

join | LineJoin | The LineJoin to use.

置线条风格

Sets the line style.

置线条风格(style)

style | LineStyle | The LineStyle to use.

置线条宽

Sets the line width.

置线条宽(width)

width | number | The width of the line.

置点尺寸

Sets the point size.

置点尺寸(size)

size | number | The new point size.

剪切区域

Sets or disables scissor.
The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including 清屏.

剪切区域(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.

剪切区域()

置着色器

Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next 置着色器 will be drawn using the Shader object specified.
Disables the shaders when called without args.

置着色器()

置着色器(shader)

shader | Shader | The new shader.

置测试模板

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 args of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via 置模板.
Each Canvas has its own per-pixel stencil values.

置测试模板(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.

置测试模板()

置线框模式

Sets whether wireframe lines will be used when drawing.
Wireframe mode should only be used for debugging. The lines drawn with it enabled do not behave like regular love.graphics lines: their widths don't scale with the coordinate transformations or with置线条宽,and they don't use the smooth LineStyle.

置线框模式(enable)

enable | boolean | True to enable wireframe mode when drawing, false to disable it.

坐标剪切

Shears the coordinate system.

坐标剪切(kx, ky)

kx | number | The shear factor on the x-axis.
ky | number | The shear factor on the y-axis.

置模板

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 - 置测试模板 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].

置模板(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("replace") | StencilAction | How to modify any stencil values of pixels that are touched by 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(false) | boolean | True to preserve old stencil values of pixels,false to re-set every pixel's stencil value to 0 before executing the stencil function. 清屏 will also re-set all stencil values.

坐标切换

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 清屏 is called (which is called automatically before 画面显示 in the default love.run function), or a 坐标恢复 reverts to a previous coordinate system state.
Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating.

坐标切换(dx, dy)

dx | number | The translation relative to the x-axis.
dy | number | The translation relative to the y-axis.

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 | FilterMode | 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.

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 arg to 创建画布 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 | WrapMode | Horizontal wrapping mode of the Canvas.
vertical | WrapMode | Vertical wrapping mode of the Canvas.

Canvas:isActive

Gets whether the graphics module is able to be used.If it is not active,love.graphics function and method calls will not work correctly and may cause the program to crash.The graphics module is inactive if a window is not open,or if the app is in the background on iOS.Typically the app's execution will be automatically paused by the system, in the latter case.

active= Canvas:isActive()

active | boolean | Whether the graphics module is active and able to be used.

Canvas:newImageData

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.
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(horizontal) | WrapMode | Vertical wrapping mode of the Canvas.

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 | FilterMode | 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.

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.

Font:getWrap

Gets formatting information for text,given a wrap limit.
This function accounts for newlines correctly(i.e.'\n').

width,wrappedtext=Font:getWrap(text,wraplimit)

width | number | The maximum width of the wrapped text.
wrappedtext | table | A table 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:hasGlyph

Gets whether the font can render a particular character.

hasglyph=Font:hasGlyph(character)

hasglyph | boolean | Whether the font can render the glyph represented by the character.

character | string | A unicode character.

hasglyph=Font:hasGlyph(codepoint)

hasglyph | boolean | Whether the font can render the glyph represented by the codepoint number.

codepoint | number | A unicode codepoint number.

Font:setFallbacks

Sets other Fonts to use if this Font doesn't have a specific character. When that happens, the glyph from the first fallback Font to have the character will be used, instead of a blank box or other 'no character' symbol being used.

Font:setFallbacks(fallbackfont1, ...)

fallbackfont1 | Font | The first fallback Font to use.
... | Font | Additionall fallback Fonts.

Font:setFilter

Sets the filter mode for a font.

Font:setFilter(min, mag, anisotropy)

min | FilterMode | How to scale a font down.
mag(min) | FilterMode | 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: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.

Mesh:getDrawRange

Gets the range of vertices used when drawing the Mesh.
If the Mesh's draw range has not been set previously 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.
... | 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.

x,y,u,v,r,g,b,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.
r | number | The red component of the vertex's color.
g | number | The green component of the vertex's color.
b | number | The blue component of the vertex's color.
a | 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创建网格have position as their first attribute,texture coordinates as their second attribute,and color as their third attribute.

value1,value2,...=Mesh:getVertexAttribute(vertexindex,attributeindex)

value1 | number | The value of the first component of the attribute.
value2 | number | The value of the second component of the attribute.
... | number | Any additional vertex attribute components.

vertexindex | number | The index of the the vertex to be modified.
attributeindex | number | The index of the attribute within the vertex to be modified.

Mesh:getVertexCount

Returns the total number of vertices in the Mesh.

num=Mesh:getVertexCount()

num | number | The total number of vertices in this Mesh.

Mesh:getVertexFormat

Gets the vertex format that the Mesh was created with.

format=Mesh:getVertexFormat()

format | table | The vertex format of the Mesh,which is a table containing tables for each vertex attribute the Mesh was created with,in the form of{attribute,...}.

format.attribute | table | A table containing the attribute's name, it's data type,and the number of components in the attribute,in the form of{name,datatype,components}.
format.... | table | Additional vertex attributes in the Mesh.

Mesh:getVertexMap

Gets the vertex map for the Mesh.The vertex map describes the order in which the vertices are used when the Mesh is drawn.The vertices,vertex map,and mesh draw mode work together to determine what exactly is displayed on the screen.
If no vertex map has been set previously via Mesh:setVertexMap,then this function will return nil.

vertex_map=Mesh:getVertexMap()

vertex_map | table | A table containing a list of vertex indices used when drawing.

Mesh:isAttributeEnabled

Gets whether a specific vertex attribute in the Mesh is enabled.Vertex data from disabled attributes is not used when drawing the Mesh.

enabled=Mesh:isAttributeEnabled(name)

enabled | boolean | Whether the vertex attribute is used when drawing this Mesh.

name | string | The name of the vertex attribute to enable or disable.

Mesh:setAttributeEnabled

Enables or disables a specific vertex attribute in the Mesh.Vertex data from disabled attributes is not used when drawing the Mesh.

Mesh:setAttributeEnabled(name,enable)

name | string | The name of the vertex attribute to enable or disable.
enable | boolean | Whether the vertex attribute is used when drawing this Mesh.

Mesh:setDrawMode

Sets the mode used when drawing the Mesh.

Mesh:setDrawMode(mode)

mode | MeshDrawMode | The mode to use when drawing the Mesh.

Mesh:setDrawRange

Restricts the drawn vertices of the Mesh to a subset of the total.
If a vertex map is used with the Mesh,this method will set a subset of the values in the vertex map array to use,instead of a subset of the total vertices in the Mesh.
For example,if Mesh:setVertexMap(1,2,3,1,3,4)and Mesh:setDrawRange(4,6)are called,vertices 1,3,and 4 will be drawn.

Mesh:setDrawRange(min,max)

min | number | The index of the first vertex to use when drawing,or the index of the first value in the vertex map to use if one is set for this Mesh.
max | number | The index of the last vertex to use when drawing,or the index of the last value in the vertex map to use if one is set for this Mesh.

Mesh:setDrawRange()

Mesh:setTexture

Sets the texture(Image or Canvas)used when drawing the Mesh.
When called without an arg disables the texture.Untextured meshes have a white color by default.

Mesh:setTexture()

Mesh:setTexture(texture)

texture | Texture | The Image or Canvas to texture the Mesh with when drawing.

Mesh:setVertex

Sets the properties of a vertex in the Mesh.

Mesh:setVertex(index,attributecomponent,...)

index | number | The index of the the vertex you want to modify.
attributecomponent | number | The first component of the first vertex attribute in the specified vertex.
... | number | Additional components of all vertex attributes in the specified vertex.

Mesh:setVertex(index,vertex)

index | number | The index of the the vertex you want to modify.
vertex | table | A table with vertex information,in the form of{attributecomponent,...}.

vertex.attributecomponent | number | The first component of the first vertex attribute in the specified vertex.
vertex.... | number | Additional components of all vertex attributes in the specified vertex.

Mesh:setVertex(index,x,y,u,v,r,g,b,a)

index | number | The index of the the vertex you want to modify.
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.
r(255) | number | The red component of the vertex's color.
g(255) | number | The green component of the vertex's color.
b(255) | number | The blue component of the vertex's color.
a(255) | number | The alpha component of the vertex's color.

Mesh:setVertex(index,vertex)

index | number | The index of the the vertex you want to modify.
vertex | table | A table with vertex information.

vertex.[1] | number | The position of the vertex on the x-axis.
vertex.[2] | number | The position of the vertex on the y-axis.
vertex.[3] | number | The horizontal component of the texture coordinate.
vertex.[4] | number | The vertical component of the texture coordinate.
vertex.[5](255) | number | The red component of the vertex's color.
vertex.[6](255) | number | The green component of the vertex's color.
vertex.[7](255) | number | The blue component of the vertex's color.
vertex.[8](255) | number | The alpha component of the vertex's color.

Mesh:setVertexAttribute

Sets the properties of a specific attribute within a vertex in the Mesh.
Meshes without a custom vertex format specified in创建网格have position as their first attribute,texture coordinates as their second attribute,and color as their third attribute.

Mesh:setVertexAttribute(vertexindex,attributeindex,value1,value2,...)

vertexindex | number | The index of the the vertex to be modified.
attributeindex | number | The index of the attribute within the vertex to be modified.
value1 | number | The value of the first component of the attribute.
value2 | number | The value of the second component of the attribute.
... | number | Any additional vertex attribute components.

Mesh:setVertexColors

Sets if the per-vertex colors are used when rendering instead of the constant color(constant color being置颜色or SpriteBatch:setColor)
The per-vertex colors are automatically enabled by default when making a new Mesh or when doing Mesh:setVertex,but only if at least one vertex color is not the default(255,255,255,255).

Mesh:setVertexColors(on)

on | boolean | True to use per-vertex coloring.

Mesh:setVertexMap

Sets the vertex map for a Mesh.The vertex map describes the order in which the vertices are used when the Mesh is drawn.
The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters or duplicating vertices.It is especially useful when combined with different Mesh draw modes.

Mesh:setVertexMap(vertex_map)

vertex_map | table | A table containing a list of vertex indices to use when drawing.Values must be in the range of[1,Mesh:getVertexCount()].

Mesh:setVertexMap(vi1,vi2,vi3)

vi1 | number | The index of the first vertex to use when drawing.Must be in the range of[1,Mesh:getVertexCount()].
vi2 | number | The index of the second vertex to use when drawing.
vi3 | number | The index of the third vertex to use when drawing.

Mesh:setVertices

Replaces all vertices in the Mesh with new ones.

Mesh:setVertices(vertices,startvertex)

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.attributecomponent | number | The first component of the first vertex attribute in the vertex.
vertices.... | number | Additional components of all vertex attributes in the vertex.
startvertex(1) | number | The index of the first vertex to replace.

Mesh:setVertices(vertices)

vertices | table | The table filled with vertex information tables for each vertex as follows:

vertices.[1] | number | The position of the vertex on the x-axis.
vertices.[2] | number | The position of the vertex on the y-axis.
vertices.[3] | number | The horizontal component of the texture coordinate.Texture coordinates are normally in the range of[0,1],but can be greater or less(see WrapMode).
vertices.[4] | number | The vertical component of the texture coordinate.Texture coordinates are normally in the range of[0,1],but can be greater or less(see WrapMode).
vertices.[5](255) | number | The red color component.
vertices.[6](255) | number | The green color component.
vertices.[7](255) | number | The blue color component.
vertices.[8](255) | number | The alpha color component.

Image:getData

Gets the original ImageData used to create the Image.
All Images keep a reference to the Data that was used to create the Image.The Data is used to refresh the Image when窗口置信息or Image:refresh is called.

data=Image:getData()

data | ImageData | The original ImageData used to create the Image,if the image is not compressed.

Image:getDimensions

Gets the width and height of the Image.

width,height=Image:getDimensions()

width | number | The width of the Image,in pixels.
height | number | The height of the Image,in pixels.

Image:getFilter

Gets the filter mode for an image.

min,mag=Image:getFilter()

min | FilterMode | Filter mode used when minifying the image.
mag | FilterMode | Filter mode used when magnifying the image.

Image:getFlags

Gets the flags used when the image was created.

flags=Image:getFlags()

flags | table | A table with ImageFlag keys.

Image:getHeight

Gets the height of the Image.

height=Image:getHeight()

height | number | The height of the Image,in pixels.

Image:getMipmapFilter

Gets the mipmap filter mode for an Image.

mode,sharpness=Image:getMipmapFilter()

mode | FilterMode | The filter mode used in between mipmap levels.nil if mipmap filtering is not enabled.
sharpness | number | Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.

Image:getWidth

Gets the width of the Image.

width=Image:getWidth()

width | number | The width of the Image,in pixels.

Image:getWrap

Gets the wrapping properties of an Image.
This function returns the currently set horizontal and vertical wrapping modes for the image.

horizontal,vertical=Image:getWrap()

horizontal | WrapMode | Horizontal wrapping mode of the image.
vertical | WrapMode | Vertical wrapping mode of the image.

Image:refresh

Reloads the Image's contents from the ImageData used to create the image.

Image:refresh()

Image:refresh(x, y, width, height)

x | number | The x-axis of the top-left corner of the area within the Image to reload.
y | number | The y-axis of the top-left corner of the area within the Image to reload.
width | number | The width of the area within the Image to reload.
height | number | The height of the area within the Image to reload.

Image:setFilter

Sets the filter mode for an image.

Image:setFilter(min, mag)

min | FilterMode | How to scale an image down.
mag(min) | FilterMode | How to scale an image up.

Image:setMipmapFilter

Sets the mipmap filter mode for an Image.
Mipmapping is useful when drawing an image at a reduced scale. It can improve performance and reduce aliasing issues.
In 0.10.0 and newer, the Image must be created with the mipmaps flag enabled for the mipmap filter to have any effect.

Image:setMipmapFilter(filtermode, sharpness)

filtermode | FilterMode | The filter mode to use in between mipmap levels. "nearest" will often give better performance.
sharpness(0) | number | A positive sharpness value makes the image use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.

Image:setMipmapFilter()

Image:setWrap

Sets the wrapping properties of an Image.
This function sets the way an Image is repeated when it is drawn with a Quad that is larger than the image's extent.An image may be clamped or set to repeat in both horizontal and vertical directions.Clamped images appear only once,but repeated ones repeat as many times as there is room in the Quad.
If you use a Quad that is larger than the image extent and do not use repeated tiling,there may be an unwanted visual effect of the image stretching all the way to fill the Quad.If this is the case,setting Image:getWrap("repeat","repeat")for all the images to be repeated,and using Quad of appropriate size will result in the best visual appearance.

Image:setWrap(horizontal,vertical)

horizontal | WrapMode | Horizontal wrapping mode of the image.
vertical(horizontal) | WrapMode | Vertical wrapping mode of the image.

ParticleSystem:clone

Creates an identical copy of the ParticleSystem in the stopped state.
Cloned ParticleSystem inherit all the set-able state of the original ParticleSystem,but they are initialized stopped.

particlesystem=ParticleSystem:clone()

particlesystem | ParticleSystem | The new identical copy of this ParticleSystem.

ParticleSystem:emit

Emits a burst of particles from the particle emitter.

ParticleSystem:emit(numparticles)

numparticles | number | The amount of particles to emit.The number of emitted particles will be truncated if the particle system's max buffer size is reached.

ParticleSystem:getCount

Gets the amount of particles that are currently in the system.

count= ParticleSystem:getCount()

count | number | The current number of live particles.

ParticleSystem:getAreaSpread

Gets the area-based spawn parameters for the particles.

distribution, dx, dy= ParticleSystem:getAreaSpread()

distribution | AreaSpreadDistribution | The type of distribution for new particles.
dx | number | The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.
dy | number | The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.

ParticleSystem:getBufferSize

Gets the size of the buffer (the max allowed amount of particles in the system).

buffer= ParticleSystem:getBufferSize()

buffer | number | The buffer size.

ParticleSystem:getColors

Gets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle's lifetime.Color modulation needs to be activated for this function to have any effect.
args are passed in groups of four,representing the components of the desired RGBA value.At least one color must be specified.A maximum of eight may be used.

r1,g1,b1,a1,r2,g2,b2,a2,...=ParticleSystem:getColors()

r1 | number | First color,red component(0-255).
g1 | number | First color,green component(0-255).
b1 | number | First color,blue component(0-255).
a1 | number | First color,alpha component(0-255).
r2 | number | Second color,red component(0-255).
g2 | number | Second color,green component(0-255).
b2 | number | Second color,blue component(0-255).
a2 | number | Second color,alpha component(0-255).
... | number | Etc.

ParticleSystem:getDirection

Gets the direction the particles will be emitted in.

direction=ParticleSystem:getDirection()

direction | number | The direction of the particles(in radians).

ParticleSystem:getEmissionRate

Gets the amount of particles emitted per second.

rate=ParticleSystem:getEmissionRate()

rate | number | The amount of particles per second.

ParticleSystem:getInsertMode

Gets the mode to use when the ParticleSystem adds new particles.

mode=ParticleSystem:getInsertMode()

mode | ParticleInsertMode | The mode to use when the ParticleSystem adds new particles.

ParticleSystem:getLinearAcceleration

Gets the linear acceleration(acceleration along the x and y axes)for particles.
Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax.

xmin,ymin,xmax,ymax=ParticleSystem:getLinearAcceleration()

xmin | number | The minimum acceleration along the x axis.
ymin | number | The minimum acceleration along the y axis.
xmax | number | The maximum acceleration along the x axis.
ymax | number | The maximum acceleration along the y axis.

ParticleSystem:getLinearDamping

Gets the amount of linear damping(constant deceleration)for particles.

min,max=ParticleSystem:getLinearDamping()

min | number | The minimum amount of linear damping applied to particles.
max | number | The maximum amount of linear damping applied to particles.

ParticleSystem:getEmitterLifetime

Gets how long the particle system should emit particles(if-1 then it emits particles forever).

life=ParticleSystem:getEmitterLifetime()

life | number | The lifetime of the emitter(in seconds).

ParticleSystem:getOffset

Get the offget position which the particle sprite is rotated around.If this function is not used,the particles rotate around their center.

x,y=ParticleSystem:getOffset()

x | number | The x coordinate of the rotation offget.
y | number | The y coordinate of the rotation offget.

ParticleSystem:getParticleLifetime

Gets the life of the particles.

min,max=ParticleSystem:getParticleLifetime()

min | number | The minimum life of the particles(seconds).
max(min) | number | The maximum life of the particles(seconds).

ParticleSystem:getPosition

Gets the position of the emitter.

x,y=ParticleSystem:getPosition()

x | number | Position along x-axis.
y | number | Position along y-axis.

ParticleSystem:getRadialAcceleration

Get the radial acceleration(away from the emitter).

min,max=ParticleSystem:getRadialAcceleration()

min | number | The minimum acceleration.
max(min) | number | The maximum acceleration.

ParticleSystem:getRotation

Gets the rotation of the image upon particle creation(in radians).

min,max=ParticleSystem:getRotation()

min | number | The minimum initial angle(radians).
max(min) | number | The maximum initial angle(radians).

ParticleSystem:getSizes

Gets a series of sizes by which to scale a particle sprite.1.0 is normal size.The particle system will interpolate between each size evenly over the particle's lifetime.
At least one size must be specified. A maximum of eight may be used.

size1, size2, ...= ParticleSystem:getSizes()

size1 | number | The first size.
size2 | number | The second size.
... | number | Etc.

ParticleSystem:getSizeVariation

Gets the degree of variation (0 meaning no variation and 1 meaning full variation between start and end).

variation= ParticleSystem:getSizeVariation()

variation | number | The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).

ParticleSystem:getSpeed

Gets the speed of the particles.

min, max= ParticleSystem:getSpeed()

min | number | The minimum linear speed of the particles.
max(min) | number | The maximum linear speed of the particles.

ParticleSystem:getSpin

Gets the spin of the sprite.

min, max= ParticleSystem:getSpin()

min | number | The minimum spin (radians per second).
max(min) | number | The maximum spin (radians per second).

ParticleSystem:getSpinVariation

Gets the degree of variation (0 meaning no variation and 1 meaning full variation between start and end).

variation= ParticleSystem:getSpinVariation()

variation | number | The degree of variation (0 meaning no variation and 1 meaning full variation between start and end).

ParticleSystem:getSpread

Gets the amount of spread for the system.

spread= ParticleSystem:getSpread()

spread | number | The amount of spread (radians).

ParticleSystem:getTexture

Gets the Image or Canvas which is to be emitted.

texture= ParticleSystem:getTexture()

texture | Texture | An Image or Canvas to use for the particle.

ParticleSystem:getTangentialAcceleration

Gets the tangential acceleration (acceleration perpendicular to the particle's direction).

min,max=ParticleSystem:getTangentialAcceleration()

min | number | The minimum acceleration.
max(min) | number | The maximum acceleration.

ParticleSystem:hasRelativeRotation

Gets whether particle angles and rotations are relative to their velocities.If enabled,particles are aligned to the angle of their velocities and rotate relative to that angle.

enabled=ParticleSystem:hasRelativeRotation()

enabled | boolean | True if relative particle rotation is enabled,false if it's disabled.

ParticleSystem:isActive

Checks whether the particle system is actively emitting particles.

active= ParticleSystem:isActive()

active | boolean | True if system is active, false otherwise.

ParticleSystem:isPaused

Checks whether the particle system is paused.

paused= ParticleSystem:isPaused()

paused | boolean | True if system is paused, false otherwise.

ParticleSystem:isStopped

Checks whether the particle system is stopped.

stopped= ParticleSystem:isStopped()

stopped | boolean | True if system is stopped, false otherwise.

ParticleSystem:moveTo

Moves the position of the emitter. This results in smoother particle spawning behaviour than if ParticleSystem:setPosition is used every frame.

ParticleSystem:moveTo(x, y)

x | number | Position along x-axis.
y | number | Position along y-axis.

ParticleSystem:pause

Pauses the particle emitter.

ParticleSystem:pause()

ParticleSystem:reset

Resets the particle emitter, removing any existing particles and resetting the lifetime counter.

ParticleSystem:reset()

ParticleSystem:setAreaSpread

Sets area-based spawn parameters for the particles. Newly created particles will spawn in an area around the emitter based on the parameters to this function.

ParticleSystem:setAreaSpread(distribution, dx, dy)

distribution | AreaSpreadDistribution | The type of distribution for new particles.
dx | number | The maximum spawn distance from the emitter along the x-axis for uniform distribution, or the standard deviation along the x-axis for normal distribution.
dy | number | The maximum spawn distance from the emitter along the y-axis for uniform distribution, or the standard deviation along the y-axis for normal distribution.

ParticleSystem:setBufferSize

Sets the size of the buffer (the max allowed amount of particles in the system).

ParticleSystem:setBufferSize(buffer)

buffer | number | The buffer size.

ParticleSystem:setColors

Sets a series of colors to apply to the particle sprite. The particle system will interpolate between each color evenly over the particle's lifetime.Color modulation needs to be activated for this function to have any effect.
args are passed in groups of four,representing the components of the desired RGBA value.At least one color must be specified.A maximum of eight may be used.

ParticleSystem:setColors(r1,g1,b1,a1,r2,g2,b2,a2,...)

r1 | number | First color,red component(0-255).
g1 | number | First color,green component(0-255).
b1 | number | First color,blue component(0-255).
a1 | number | First color,alpha component(0-255).
r2 | number | Second color,red component(0-255).
g2 | number | Second color,green component(0-255).
b2 | number | Second color,blue component(0-255).
a2 | number | Second color,alpha component(0-255).
... | number | Etc.

ParticleSystem:setDirection

Sets the direction the particles will be emitted in.

ParticleSystem:setDirection(direction)

direction | number | The direction of the particles(in radians).

ParticleSystem:setEmissionRate

Sets the amount of particles emitted per second.

ParticleSystem:setEmissionRate(rate)

rate | number | The amount of particles per second.

ParticleSystem:setEmitterLifetime

Sets how long the particle system should emit particles(if-1 then it emits particles forever).

ParticleSystem:setEmitterLifetime(life)

life | number | The lifetime of the emitter(in seconds).

ParticleSystem:setInsertMode

Sets the mode to use when the ParticleSystem adds new particles.

ParticleSystem:setInsertMode(mode)

mode | ParticleInsertMode | The mode to use when the ParticleSystem adds new particles.

ParticleSystem:setLinearAcceleration

Sets the linear acceleration(acceleration along the x and y axes)for particles.
Every particle created will accelerate along the x and y axes between xmin,ymin and xmax,ymax.

ParticleSystem:setLinearAcceleration(xmin,ymin,xmax,ymax)

xmin | number | The minimum acceleration along the x axis.
ymin(0) | number | The minimum acceleration along the y axis.
xmax(xmin) | number | The maximum acceleration along the x axis.
ymax(ymax) | number | The maximum acceleration along the y axis.

ParticleSystem:setLinearDamping

Sets the amount of linear damping(constant deceleration)for particles.

ParticleSystem:setLinearDamping(min,max)

min | number | The minimum amount of linear damping applied to particles.
max | number | The maximum amount of linear damping applied to particles.

ParticleSystem:setOffset

Set the offset position which the particle sprite is rotated around.If this function is not used,the particles rotate around their center.

ParticleSystem:setOffset(x,y)

x | number | The x coordinate of the rotation offset.
y | number | The y coordinate of the rotation offset.

ParticleSystem:setParticleLifetime

Sets the life of the particles.

ParticleSystem:setParticleLifetime(min,max)

min | number | The minimum life of the particles(seconds).
max(min) | number | The maximum life of the particles(seconds).

ParticleSystem:setPosition

Sets the position of the emitter.

ParticleSystem:setPosition(x,y)

x | number | Position along x-axis.
y | number | Position along y-axis.

ParticleSystem:setQuads

Sets a series of Quads to use for the particle sprites.Particles will choose a Quad from the list based on the particle's current lifetime, allowing for the use of animated sprite sheets with ParticleSystems.

ParticleSystem:setQuads(quad1, quad2)

quad1 | Quad | The first Quad to use.
quad2 | Quad | The second Quad to use.

ParticleSystem:setRadialAcceleration

Set the radial acceleration (away from the emitter).

ParticleSystem:setRadialAcceleration(min, max)

min | number | The minimum acceleration.
max(min) | number | The maximum acceleration.

ParticleSystem:setRelativeRotation

Sets whether particle angles and rotations are relative to their velocities. If enabled, particles are aligned to the angle of their velocities and rotate relative to that angle.

ParticleSystem:setRelativeRotation(enable)

enable | boolean | True to enable relative particle rotation, false to disable it.

ParticleSystem:setRotation

Sets the rotation of the image upon particle creation (in radians).

ParticleSystem:setRotation(min, max)

min | number | The minimum initial angle (radians).
max(min) | number | The maximum initial angle (radians).

ParticleSystem:setSizes

Sets a series of sizes by which to scale a particle sprite. 1.0 is normal size. The particle system will interpolate between each size evenly over the particle's lifetime.
At least one size must be specified.A maximum of eight may be used.

ParticleSystem:setSizes(size1,size2,...)

size1 | number | The first size.
size2 | number | The second size.
... | number | Etc.

ParticleSystem:setSizeVariation

Sets the degree of variation(0 meaning no variation and 1 meaning full variation between start and end).

ParticleSystem:setSizeVariation(variation)

variation | number | The degree of variation(0 meaning no variation and 1 meaning full variation between start and end).

ParticleSystem:setSpeed

Sets the speed of the particles.

ParticleSystem:setSpeed(min,max)

min | number | The minimum linear speed of the particles.
max(min) | number | The maximum linear speed of the particles.

ParticleSystem:setSpin

Sets the spin of the sprite.

ParticleSystem:setSpin(min,max)

min | number | The minimum spin(radians per second).
max(min) | number | The maximum spin(radians per second).

ParticleSystem:setSpinVariation

Sets the degree of variation(0 meaning no variation and 1 meaning full variation between start and end).

ParticleSystem:setSpinVariation(variation)

variation | number | The degree of variation(0 meaning no variation and 1 meaning full variation between start and end).

ParticleSystem:setSpread

Sets the amount of spread for the system.

ParticleSystem:setSpread(spread)

spread | number | The amount of spread(radians).

ParticleSystem:setTexture

Sets the Image or Canvas which is to be emitted.

ParticleSystem:setTexture(texture)

texture | Texture | An Image or Canvas to use for the particle.

ParticleSystem:setTangentialAcceleration

Sets the tangential acceleration(acceleration perpendicular to the particle's direction).

ParticleSystem:setTangentialAcceleration(min, max)

min | number | The minimum acceleration.
max(min) | number | The maximum acceleration.

ParticleSystem:start

Starts the particle emitter.

ParticleSystem:start()

ParticleSystem:stop

Stops the particle emitter, resetting the lifetime counter.

ParticleSystem:stop()

ParticleSystem:update

Updates the particle system; moving, creating and killing particles.

ParticleSystem:update(dt)

dt | number | The time (seconds) since last frame.

Quad:getViewport

Gets the current viewport of this Quad.

x, y, w, h= Quad:getViewport()

x | number | The top-left corner along the x-axis.
y | number | The top-right corner along the y-axis.
w | number | The width of the viewport.
h | number | The height of the viewport.

Quad:setViewport

Sets the texture coordinates according to a viewport.

x, y, w, h= Quad:setViewport()

x | number | The top-left corner along the x-axis.
y | number | The top-right corner along the y-axis.
w | number | The width of the viewport.
h | number | The height of the viewport.

Shader:getExternVariable

Gets information about an 'extern' ('uniform') variable in the shader.

type, components, arrayelements= Shader:getExternVariable(name)

type | ShaderVariableType | The base type of the variable.
components | number | The number of components in the variable (e.g. 2 for a vec2 or mat2.)
arrayelements | number | The number of elements in the array if the variable is an array, or 1 if not.

name | string | The name of the extern variable.

Shader:getWarnings

Returns any warning and error messages from compiling the shader code. This can be used for debugging your shaders if there's anything the graphics hardware doesn't like.

warnings= Shader:getWarnings()

warnings | string | Warning messages (if any).

Shader:send

Sends one or more values to a special (extern) variable inside the shader.

Shader:send(name, number, ...)

name | string | Name of the number to send to the pixel effect.
number | number | Number to send to the pixel effect.
... | number | Additional numbers to send in case the extern is an array.

Shader:send(name, vector, ...)

name | string | Name of the vector to send to the shader.
vector | table | Numbers to send to the extern as a vector. The number of elements in the table determines the type of the vector (e.g. two numbers -> vec2). At least two and at most four numbers can be used.
... | table | Additional vectors to send in case the extern is an array. All vectors need to be of the same size (e.g. only vec3's)

Shader:send(name,matrix,...)

name | string | Name of the matrix to send to the shader.
matrix | table | 2x2,3x3,or 4x4 matrix to send to the extern.Using table form:{{a,b,c,d},{e,f,g,h},...}
... | table | Additional matrices of the same type as matrix to store in the extern array.

Shader:send(name,image,...)

name | string | Name of the Image to send to the shader.
image | Image | Image to send to the extern.
... | Image | Additional images in case the extern is an array.

Shader:send(name,canvas,...)

name | string | Name of the Canvas to send to the shader.
canvas | Canvas | Canvas to send to the extern.The shader extern type is Image.
... | Canvas | Additional canvases to send to the extern array.

Shader:send(name,boolean,...)

name | string | Name of the boolean to send to the shader.
boolean | boolean | Boolean to send to store in the extern.
... | boolean | Additional booleans to send in case the extern is an array.

Shader:sendColor

Sends one or more colors to a special(extern/uniform)vec3 or vec4 variable inside the shader.The color components must be in the range of[0,255],unlike Shader:send.The colors are gamma-corrected if global gamma-correction is enabled.

Shader:sendColor(name,color,...)

name | string | The name of the color extern variable to send to in the shader.
color | table | A table with red,green,blue,and optional alpha color components in the range of[0,255]to send to the extern as a vector.
... | table | Additional colors to send in case the extern is an array.All colors need to be of the same size(e.g.only vec3's).

SpriteBatch:add

Add a sprite to the batch.

id= SpriteBatch:add(x, y, r, sx, sy, ox, oy, kx, ky)

id | number | An identifier for the added sprite.

x | number | The position to draw the object (x-axis).
y | number | The position to draw the object (y-axis).
r(0) | number | Orientation (radians).
sx(1) | number | Scale factor (x-axis).
sy(sx) | number | Scale factor (y-axis).
ox(0) | number | Origin offset (x-axis).
oy(0) | number | Origin offset (y-axis).
kx(0) | number | Shear factor (x-axis).
ky(0) | number | Shear factor (y-axis).

id= SpriteBatch:add(quad, x, y, r, sx, sy, ox, oy, kx, ky)

id | number | An identifier for the added sprite.

quad | Quad | The Quad to add.
x | number | The position to draw the object (x-axis).
y | number | The position to draw the object (y-axis).
r(0) | number | Orientation (radians).
sx(1) | number | Scale factor (x-axis).
sy(sx) | number | Scale factor (y-axis).
ox(0) | number | Origin offset (x-axis).
oy(0) | number | Origin offset (y-axis).
kx(0) | number | Shear factor (x-axis).
ky(0) | number | Shear factor (y-axis).

SpriteBatch:attachAttribute

Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. This can be combined with a Shader to augment a SpriteBatch with per-vertex or additional per-sprite information instead of just having per-sprite colors.
Each sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can be multiplied by 4 to determine the first vertex in a specific sprite.

SpriteBatch:attachAttribute(name, mesh)

name | string | The name of the vertex attribute to attach.
mesh | Mesh | The Mesh to get the vertex attribute from.

SpriteBatch:clear

Removes all sprites from the buffer.

SpriteBatch:clear()

SpriteBatch:flush

Immediately sends all new and modified sprite data in the batch to the graphics card.

SpriteBatch:flush()

SpriteBatch:getBufferSize

Gets the maximum number of sprites the SpriteBatch can hold.

size= SpriteBatch:getBufferSize()

size | number | The maximum number of sprites the batch can hold.

SpriteBatch:getColor

Gets the color that will be used for the next add and set operations.
If no color has been set with SpriteBatch:setColor or the current SpriteBatch color has been cleared, this method will return nil.

SpriteBatch:getColor()

SpriteBatch:getColor(r, g, b, a)

r | number | The red component (0-255).
g | number | The green component (0-255).
b | number | The blue component (0-255).
a | number | The alpha component (0-255).

SpriteBatch:getCount

Gets the amount of sprites currently in the SpriteBatch.

count= SpriteBatch:getCount()

count | number | The amount of sprites currently in the batch.

SpriteBatch:getTexture

Returns the Image or Canvas used by the SpriteBatch.

texture= SpriteBatch:getTexture()

texture | Texture | The Image or Canvas for the sprites.

SpriteBatch:set

Changes a sprite in the batch. This requires the identifier returned by add and addq.

SpriteBatch:set(id, x, y, r, sx, sy, ox, oy, kx, ky)

id | number | The identifier of the sprite that will be changed.
x | number | The position to draw the object (x-axis).
y | number | The position to draw the object (y-axis).
r(0) | number | Orientation (radians).
sx(1) | number | Scale factor (x-axis).
sy(sx) | number | Scale factor (y-axis).
ox(0) | number | Origin offset (x-axis).
oy(0) | number | Origin offset (y-axis).
kx(0) | number | Shear factor (x-axis).
ky(0) | number | Shear factor (y-axis).

SpriteBatch:set(id, quad, x, y, r, sx, sy, ox, oy, kx, ky)

id | number | The identifier of the sprite that will be changed.
quad | Quad | The quad used on the image of the batch.
x | number | The position to draw the object (x-axis).
y | number | The position to draw the object (y-axis).
r(0) | number | Orientation (radians).
sx(1) | number | Scale factor (x-axis).
sy(sx) | number | Scale factor (y-axis).
ox(0) | number | Origin offset (x-axis).
oy(0) | number | Origin offset (y-axis).
kx(0) | number | Shear factor (x-axis).
ky(0) | number | Shear factor (y-axis).

SpriteBatch:setBufferSize

Sets the maximum number of sprites the SpriteBatch can hold. Existing sprites in the batch (up to the new maximum) will not be cleared when this function is called.

SpriteBatch:setBufferSize(size)

size | number | The new maximum number of sprites the batch can hold.

SpriteBatch:setColor

Sets the color that will be used for the next add and set operations. Calling the function without args will clear the color.
The global color set with 置颜色 will not work on the SpriteBatch if any of the sprites has its own color.

SpriteBatch:setColor(r, g, b, a)

r | number | The amount of red.
g | number | The amount of green.
b | number | The amount of blue.
a(255) | number | The amount of alpha.

SpriteBatch:setColor()

SpriteBatch:setTexture

Replaces the Image or Canvas used for the sprites.

SpriteBatch:setTexture(texture)

texture | Texture | The new Image or Canvas to use for the sprites.

Text:add

Adds additional colored text to the Text object at the specified position.

index= Text:add(textstring, x, y, angle, sx, sy, ox, oy, kx, ky)

index | number | An index number that can be used with Text:getWidth or Text:getHeight.

textstring | string | The text to add to the object.
x | number | The position of the new text on the x-axis.
y | number | The position of the new text on the y-axis.
angle(0) | number | The orientation of the new text 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.
oy(0) | number | Origin offset on the y-axis.
kx(0) | number | Shearing / skew factor on the x-axis.
ky(0) | number | Shearing / skew factor on the y-axis.

index= Text:add(coloredtext, x, y, angle, sx, sy, ox, oy, kx, ky)

index | number | An index number that can be used with Text:getWidth or Text:getHeight.

coloredtext | table | A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.

coloredtext.color1 | table | 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}.
coloredtext.string1 | string | A string of text which has a color specified by the previous color.
coloredtext.color2 | table | 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}.
coloredtext.string2 | string | A string of text which has a color specified by the previous color.
coloredtext.... | tables and strings | Additional colors and 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.
angle(0) | number | The orientation of the new text 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.
oy(0) | number | Origin offset on the y-axis.
kx(0) | number | Shearing / skew factor on the x-axis.
ky(0) | number | Shearing / skew factor on the y-axis.

Text:addf

Adds additional formatted / colored text to the Text object at the specified position.

index= Text:addf(textstring, wraplimit, align, x, y, angle, sx, sy, ox, oy, kx, ky)

index | number | An index number that can be used with Text:getWidth or Text:getHeight.

textstring | string | The text to add to the object.
wraplimit | 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.
x | number | The position of the new text on the x-axis.
y | number | The position of the new text on the y-axis.
angle(0) | 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.
oy(0) | number | Origin offset on the y-axis.
kx(0) | number | Shearing / skew factor on the x-axis.
ky(0) | number | Shearing / skew factor on the y-axis.

index= Text:addf(coloredtext, wraplimit, align, x, y, angle, sx, sy, ox, oy, kx, ky)

index | number | An index number that can be used with Text:getWidth or Text:getHeight.

coloredtext | table | A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.

coloredtext.color1 | table | 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}.
coloredtext.string1 | string | A string of text which has a color specified by the previous color.
coloredtext.color2 | table | 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}.
coloredtext.string2 | string | A string of text which has a color specified by the previous color.
coloredtext.... | tables and strings | Additional colors and strings.
wraplimit | 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.
x | number | The position of the new text on the x-axis.
y | number | The position of the new text on the y-axis.
angle(0) | 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.
oy(0) | number | Origin offset on the y-axis.
kx(0) | number | Shearing / skew factor on the x-axis.
ky(0) | number | Shearing / skew factor on the y-axis.

Text:clear

Clears the contents of the Text object.

Text:clear()

Text:getFont

Gets the Font used with the Text object.

font= Text:getFont()

font | Font | The font used with this Text object.

Text:getHeight

Gets the height of the text in pixels.

height= Text:getHeight()

height | number | The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned.

height= Text:getHeight(index)

height | number | The height of the sub-string (before scaling and other transformations).

index | number | An index number returned by Text:add or Text:addf.

Text:getWidth

Gets the width of the text in pixels.

width= Text:getWidth()

width | number | The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.

width= Text:getWidth(index)

width | number | The width of the sub-string (before scaling and other transformations).

index | number | An index number returned by Text:add or Text:addf.

Text:set

Replaces the contents of the Text object with a new unformatted string.

Text:set(textstring)

textstring | string | The new string of text to use.

Text:set(coloredtext)

coloredtext | table | A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.

coloredtext.color1 | table | 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}.
coloredtext.string1 | string | A string of text which has a color specified by the previous color.
coloredtext.color2 | table | 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}.
coloredtext.string2 | string | A string of text which has a color specified by the previous color.
coloredtext.... | tables and strings | Additional colors and strings.

Text:setf

Replaces the contents of the Text object with a new formatted string.

Text:setf(textstring, wraplimit, align)

textstring | string | The new string of text to use.
wraplimit | number | The maximum width in pixels of the text before it gets automatically wrapped to a new line.
align("left") | AlignMode | The alignment of the text.

Text:setf(coloredtext, wraplimit, align)

coloredtext | table | A table containing colors and strings to use as the new text, in the form of { color1, string1, color2, string2, ... }.

coloredtext.color1 | table | 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}.
coloredtext.string1 | string | A string of text which has a color specified by the previous color.
coloredtext.color2 | table | 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}.
coloredtext.string2 | string | A string of text which has a color specified by the previous color.
coloredtext.... | tables and strings | Additional colors and strings.
wraplimit | number | The maximum width in pixels of the text before it gets automatically wrapped to a new line.
align("left") | AlignMode | The alignment of the text.

Text:setFont

Replaces the Font used with the text.

Text:setFont(font)

font | Font | The new font to use with this Text object.

AlignMode

center

Align text center.

left

Align text left.

right

Align text right.

AreaSpreadDistribution

uniform

Uniform distribution.

normal

Normal(gaussian)distribution.

none

No distribution-area spread is disabled.

BlendAlphaMode

alphamultiply

The RGB values of what's drawn are multiplied by the alpha values of those colors during blending. This is the default alpha mode.

premultiplied

The RGB values of what's drawn are not multiplied by the alpha values of those colors during blending.For most blend modes to work correctly with this alpha mode,the colors of a drawn object need to have had their RGB values multiplied by their alpha values at some point previously("premultiplied alpha").

BlendMode

alpha

Alpha blending(normal).The alpha of what's drawn determines its opacity.

replace

The colors of what's drawn completely replace what was on the screen,with no additional blending.

screen

"Screen"blending.

add

The pixel colors of what's drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.

subtract

The pixel colors of what's drawn are subtracted from the pixel colors already on the screen.The alpha of the screen is not modified.

multiply

The pixel colors of what's drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" BlendAlphaMode is used.

CanvasFormat

normal

The default Canvas format - usually an alias for the rgba8 format, or the srgb format if gamma-correct rendering is enabled in LOVE 0.10.0 and newer.

hdr

A format suitable for high dynamic range content - an alias for the rgba16f format, normally.

rgba8

8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders).

rgba4

4 bits per channel (16 bpp) RGBA.

rgb5a1

RGB with 5 bits each, and a 1-bit alpha channel (16 bpp).

rgb565

RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.

rgb10a2

RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp).

rgba16f

Floating point RGBA with 16 bits per channel (64 bpp). Color values can range from [-65504, +65504].

rgba32f

Floating point RGBA with 32 bits per channel (128 bpp).

rg11b10f

Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp). There is no alpha channel. Color values can range from [0, +65024].

srgb

The same as rgba8, but the Canvas is interpreted as being in the sRGB color space. Everything drawn to the Canvas will be converted from linear RGB to sRGB. When the Canvas is drawn (or used in a shader), it will be decoded from sRGB to linear RGB. This reduces color banding when doing gamma-correct rendering, since sRGB encoding has more precision than linear RGB for darker colors.

r8

Single-channel (red component) format (8 bpp).

rg8

Two channels (red and green components) with 8 bits per channel (16 bpp).

r16f

Floating point single-channel format (16 bpp). Color values can range from [-65504, +65504].

rg16f

Floating point two-channel format with 16 bits per channel (32 bpp). Color values can range from [-65504, +65504].

r32f

Floating point single-channel format (32 bpp).

rg32f

Floating point two-channel format with 32 bits per channel (64 bpp).

CompareMode

equal

The stencil value of the pixel must be equal to the supplied value.

notequal

The stencil value of the pixel must not be equal to the supplied value.

less

The stencil value of the pixel must be less than the supplied value.

lequal

The stencil value of the pixel must be less than or equal to the supplied value.

gequal

The stencil value of the pixel must be greater than or equal to the supplied value.

greater

The stencil value of the pixel must be greater than the supplied value.

DrawMode

fill

Draw filled shape.

line

Draw outlined shape.

FilterMode

linear

Scale image with linear interpolation.

nearest

Scale image with nearest neighbor interpolation.

GraphicsFeature

clampzero

Whether the "clampzero" WrapMode is supported.

multicanvasformats

Whether multiple Canvases with different formats can be used in the same 置画布 call.

GraphicsLimit

pointsize

The maximum size of points.

texturesize

The maximum width or height of Images and Canvases.

multicanvas

The maximum number of simultaneously active canvases (via 置画布).

canvasmsaa

The maximum number of antialiasing samples for a Canvas.

LineJoin

miter

Miter style.

bevel

Bevel style.

none

None style.

LineStyle

rough

Draw rough lines.

smooth

Draw smooth lines.

MeshDrawMode

fan

The vertices create a "fan" shape with the first vertex acting as the hub point. Can be easily used to draw simple convex polygons.

strip

The vertices create a series of connected triangles using vertices 1, 2, 3, then 3, 2, 4 (note the order), then 3, 4, 5 and so on.

triangles

The vertices create unconnected triangles.

points

The vertices are drawn as unconnected points (see 置点尺寸.)

ParticleInsertMode

top

Particles are inserted at the top of the ParticleSystem's list of particles.

bottom

Particles are inserted at the bottom of the ParticleSystem's list of particles.

random

Particles are inserted at random positions in the ParticleSystem's list of particles.

PointStyle

rough

Draw rough points.

smooth

Draw smooth points.

SpriteBatchUsage

dynamic

The object's data will change repeatedly during its lifetime.

static

The object will not be modified after initial sprites or vertices are added.

stream

The object data will always change between draws.

StackType

transform

The transformation stack (坐标切换, 坐标旋转, etc.)

all

All love.graphics state, including transform state.

StencilAction

replace

The stencil value of a pixel will be replaced by the value specified in 置模板, if any object touches the pixel.

increment

The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If the stencil value reaches 255 it will stay at 255.

decrement

The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value reaches 0 it will stay at 0.

incrementwrap

The stencil value of a pixel will be incremented by 1 for each object that touches the pixel. If a stencil value of 255 is incremented it will be set to 0.

decrementwrap

The stencil value of a pixel will be decremented by 1 for each object that touches the pixel. If the stencil value of 0 is decremented it will be set to 255.

invert

The stencil value of a pixel will be bitwise-inverted for each object that touches the pixel. If a stencil value of 0 is inverted it will become 255.

TextureFormat

normal

The default texture format: 8 bits per channel (32 bpp) RGBA.

hdr

Only usable in Canvases. The HDR texture format: floating point 16 bits per channel (64 bpp) RGBA.

srgb

The same as normal, but the texture is interpreted as being in the sRGB color space. It will be decoded from sRGB to linear RGB when drawn or sampled from in a shader. For Canvases, this will also convert everything drawn to the Canvas from linear RGB to sRGB.

WrapMode

clamp

How the image wraps inside a Quad with a larger quad size than image size. This also affects how Meshes with texture coordinates which are outside the range of [0, 1] are drawn, and the color returned by the Texel Shader function when using it to sample from texture coordinates outside of the range of [0, 1].

repeat

Repeat the image. Fills the whole available extent.

mirroredrepeat

Repeat the texture, flipping it each time it repeats. May produce better visual results than the repeat mode when the texture doesn't seamlessly tile.

clampzero

Clamp the texture.Fills the area outside the texture's normal range with transparent black (or opaque black for textures with no alpha channel.)

图片操作 love.image

创建图像数据

Create a new ImageData object.

imageData= 创建图像数据(width, height)

imageData | ImageData | The new ImageData object.

width | number | The width of the ImageData.
height | number | The height of the ImageData.

imageData= 创建图像数据(filename)

imageData | ImageData | The new ImageData object.

filename | string | The filename of the image file.

imageData= 创建图像数据(file)

imageData | ImageData | The new ImageData object.

file | File | A File pointing to an image.

imageData= 创建图像数据(data)

imageData | ImageData | The new ImageData object.

data | Data | The encoded data to decode into image data.

ImageData:encode

Encodes the ImageData and optionally writes it to the save directory.

filedata=ImageData:encode(format,filename)

filedata | FileData | The encoded image as a new FileData object.

format | ImageFormat | The format to encode the image as.
filename(nil) | string | The filename to write the file to.If nil,no file will be written but the FileData will still be returned.

ImageData:getDimensions

Gets the width and height of the ImageData.

width,height=ImageData:getDimensions()

width | number | The width of the ImageData.
height | number | The height of the ImageData.

ImageData:getHeight

Gets the height of the ImageData.

height=ImageData:getHeight()

height | number | The height of the ImageData.

ImageData:getPixel

Gets the pixel at the specified position.
Valid x and y values start at 0 and go up to image width and height minus 1.

r,g,b,a=ImageData:getPixel(x,y)

r | number | The red component(0-255).
g | number | The green component(0-255).
b | number | The blue component(0-255).
a | number | The alpha component(0-255).

x | number | The position of the pixel on the x-axis.
y | number | The position of the pixel on the y-axis.

ImageData:getWidth

Gets the width of the ImageData.

width=ImageData:getWidth()

width | number | The width of the ImageData.

ImageData:mapPixel

Transform an image by applying a function to every pixel.
This function is a higher order function.It takes another function as a parameter,and calls it once for each pixel in the ImageData.
The function parameter is called with six parameters for each pixel in turn.The parameters are numbers that represent the x and y coordinates of the pixel and its red,green,blue and alpha values.The function parameter can return up to four number values,which become the new r,g,b and a values of the pixel.If the function returns fewer values,the remaining components are set to 0.

ImageData:mapPixel(pixelFunction)

pixelFunction | function | Function parameter to apply to every pixel.

ImageData:paste

Paste into ImageData from another source ImageData.

ImageData:paste(source,dx,dy,sx,sy,sw,sh)

source | ImageData | Source ImageData from which to copy.
dx | number | Destination top-left position on x-axis.
dy | number | Destination top-left position on y-axis.
sx | number | Source top-left position on x-axis.
sy | number | Source top-left position on y-axis.
sw | number | Source width.
sh | number | Source height.

ImageData:setPixel

Sets the color of a pixel.
Valid x and y values start at 0 and go up to image width and height minus 1.

ImageData:setPixel(x,y,r,g,b,a)

x | number | The position of the pixel on the x-axis.
y | number | The position of the pixel on the y-axis.
r | number | The red component(0-255).
g | number | The green component(0-255).
b | number | The blue component(0-255).
a | number | The alpha component(0-255).

ImageFormat

tga

Targa image format.

png

PNG image format.

手柄操作love.joystick

取手柄数量

Gets the number of connected joysticks.

joystickcount=取手柄数量()

joystickcount | number | The number of connected joysticks.

取手柄对象

Gets a list of connected Joysticks.

joysticks=取手柄对象()

joysticks | table | The list of currently connected Joysticks.

读入游戏板配置

Loads a gamepad mappings string or file created with保存游戏板配置.

读入游戏板配置(filename)

filename | string | The filename to load the mappings string from.

读入游戏板配置(mappings)

mappings | string | The mappings string to load.

保存游戏板配置

Saves the virtual gamepad mappings of all Joysticks that are recognized as gamepads and have either been recently used or their gamepad bindings have been modified.

mappings=保存游戏板配置(filename)

mappings | string | The mappings string that was written to the file.

filename | string | The filename to save the mappings string to.

mappings=保存游戏板配置()

mappings | string | The mappings string.

置游戏板配置

Binds a virtual gamepad input to a button,axis or hat for all Joysticks of a certain type.For example,if this function is used with a GUID returned by a Dualshock 3 controller in OS X,the binding will affect Joystick:getGamepadAxis and Joystick:isGamepadDown for all Dualshock 3 controllers used with the game when run in OS X.
LOVE includes built-in gamepad bindings for many common controllers.This function lets you change the bindings or add new ones for types of Joysticks which aren't recognized as gamepads by default.
The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout.

success= 置游戏板配置(guid, button, inputtype, inputindex, hatdirection)

success | boolean | Whether the virtual gamepad button was successfully bound.

guid | string | The OS-dependent GUID for the type of Joystick the binding will affect.
button | GamepadButton | The virtual gamepad button to bind.
inputtype | JoystickInputType | The type of input to bind the virtual gamepad button to.
inputindex | number | The index of the axis, button, or hat to bind the virtual gamepad button to.
hatdirection | JoystickHat | The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise.

success= 置游戏板配置(guid, button, inputtype, inputindex, hatdirection)

success | boolean | Whether the virtual gamepad button was successfully bound.

guid | string | The OS-dependent GUID for the type of Joystick the binding will affect.
button | GamepadButton | The virtual gamepad axis to bind.
inputtype | JoystickInputType | The type of input to bind the virtual gamepad axis to.
inputindex | number | The index of the axis, button, or hat to bind the virtual gamepad axis to.
hatdirection | JoystickHat | The direction of the hat, if the virtual gamepad axis will be bound to a hat. nil otherwise.

Joystick:getAxes

Gets the direction of each axis.

axisDir1, axisDir2, axisDirN= Joystick:getAxes()

axisDir1 | number | Direction of axis1.
axisDir2 | number | Direction of axis2.
axisDirN | number | Direction of axisN.

Joystick:getAxis

Gets the direction of an axis.

direction= Joystick:getAxis(axis)

direction | number | Current value of the axis.

axis | number | The index of the axis to be checked.

Joystick:getAxisCount

Gets the number of axes on the joystick.

axes= Joystick:getAxisCount()

axes | number | The number of axes available.

Joystick:getButtonCount

Gets the number of buttons on the joystick.

buttons= Joystick:getButtonCount()

buttons | number | The number of buttons available.

Joystick:getGUID

Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent.

guid= Joystick:getGUID()

guid | string | The Joystick type's OS-dependent unique identifier.

Joystick:getGamepadAxis

Gets the direction of a virtual gamepad axis.If the Joystick isn't recognized as a gamepad or isn't connected,this function will always return 0.

direction=Joystick:getGamepadAxis(axis)

direction | number | Current value of the axis.

axis | GamepadAxis | The virtual axis to be checked.

Joystick:getGamepadMapping

Gets the button,axis or hat that a virtual gamepad input is bound to.

inputtype,inputindex,hatdirection=Joystick:getGamepadMapping(axis)

inputtype | JoystickInputType | The type of input the virtual gamepad axis is bound to.
inputindex | number | The index of the Joystick's button, axis or hat that the virtual gamepad axis is bound to.
hatdirection | JoystickHat | The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise.

axis | GamepadAxis | The virtual gamepad axis to get the binding for.

inputtype, inputindex, hatdirection= Joystick:getGamepadMapping(button)

inputtype | JoystickInputType | The type of input the virtual gamepad button is bound to.
inputindex | number | The index of the Joystick's button,axis or hat that the virtual gamepad button is bound to.
hatdirection | JoystickHat | The direction of the hat,if the virtual gamepad button is bound to a hat.nil otherwise.

button | GamepadAxis | The virtual gamepad button to get the binding for.

Joystick:getHat

Gets the direction of a hat.

direction=Joystick:getHat(hat)

direction | JoystickHat | The direction the hat is pushed.

hat | number | The index of the hat to be checked.

Joystick:getHatCount

Gets the number of hats on the joystick.

hats=Joystick:getHatCount()

hats | number | How many hats the joystick has.

Joystick:getID

Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it will change when the game is re-launched.

id, instanceid= Joystick:getID()

id | number | The Joystick's unique identifier.Remains the same as long as the game is running.
instanceid | number | Unique instance identifier.Changes every time the Joystick is reconnected.nil if the Joystick is not connected.

Joystick:getName

Gets the name of the joystick.

name=Joystick:getName()

name | string | The name of the joystick.

Joystick:getVibration

Gets the current vibration motor strengths on a Joystick with rumble support.

left,right=Joystick:getVibration()

left | number | Current strength of the left vibration motor on the Joystick.
right | number | Current strength of the right vibration motor on the Joystick.

Joystick:isConnected

Gets whether the Joystick is connected.

connected=Joystick:isConnected()

connected | boolean | True if the Joystick is currently connected,false otherwise.

Joystick:isDown

Checks if a button on the Joystick is pressed.

anyDown=Joystick:isDown(...)

anyDown | boolean | True if any supplied button is down,false if not.

... | number | The index of a button to check.

Joystick:isGamepad

Gets whether the Joystick is recognized as a gamepad.If this is the case,the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis and related functions.
LOVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with 置游戏板配置.

isgamepad= Joystick:isGamepad()

isgamepad | boolean | True if the Joystick is recognized as a gamepad, false otherwise.

Joystick:isGamepadDown

Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected,then this function will always return false.

anyDown=Joystick:isGamepadDown(...)

anyDown | boolean | True if any supplied button is down,false if not.

... | GamepadButton | The gamepad button to check.

Joystick:isVibrationSupported

Gets whether the Joystick supports vibration.

supported=Joystick:isVibrationSupported()

supported | boolean | True if rumble/force feedback vibration is supported on this Joystick,false if not.

Joystick:setVibration

Sets the vibration motor speeds on a Joystick with rumble support.

success=Joystick:setVibration(left,right)

success | boolean | True if the vibration was successfully applied,false if not.

left | number | Strength of the left vibration motor on the Joystick.Must be in the range of[0,1].
right | number | Strength of the right vibration motor on the Joystick.Must be in the range of[0,1].

success=Joystick:setVibration()

success | boolean | True if the vibration was successfully disabled,false if not.

success=Joystick:setVibration(left,right,duration)

success | boolean | True if the vibration was successfully applied,false if not.

left | number | Strength of the left vibration motor on the Joystick.Must be in the range of[0,1].
right | number | Strength of the right vibration motor on the Joystick.Must be in the range of[0,1].
duration | number | The duration of the vibration in seconds.A negative value means infinite duration.

GamepadAxis

leftx

The x-axis of the left thumbstick.

lefty

The y-axis of the left thumbstick.

rightx

The x-axis of the right thumbstick.

righty

The y-axis of the right thumbstick.

triggerleft

Left analog trigger.

triggerright

Right analog trigger.

GamepadButton

a

Bottom face button(A).

b

Right face button(B).

x

Left face button(X).

y

Top face button(Y).

back

Back button.

guide

Guide button.

start

Start button.

leftstick

Left stick click button.

rightstick

Right stick click button.

leftshoulder

Left bumper.

rightshoulder

Right bumper.

dpup

D-pad up.

dpdown

D-pad down.

dpleft

D-pad left.

dpright

D-pad right.

JoystickHat

c

Centered

d

Down

l

Left

ld

Left+Down

lu

Left+Up

r

Right

rd

Right+Down

ru

Right+Up

u

Up

JoystickInputType

axis

Analog axis.

button

Button.

hat

8-direction hat value.

键盘操作love.keyboard

取键码从扫描码

Gets the key corresponding to the given hardware scancode.
Unlike key constants,Scancodes are keyboard layout-independent.For example the scancode"w"will be generated if the key in the same place as the"w"key on an American keyboard is pressed,no matter what the key is labelled or what the user's operating system settings are.
Scancodes are useful for creating default controls that have the same physical locations on on all systems.

key= 取键码从扫描码(scancode)

key | KeyConstant | The key corresponding to the given scancode, or "unknown" if the scancode doesn't map to a KeyConstant on the current system.

scancode | Scancode | The scancode to get the key from.

取扫描码从键码

Gets the hardware scancode corresponding to the given key.
Unlike key constants,Scancodes are keyboard layout-independent.For example the scancode"w"will be generated if the key in the same place as the"w"key on an American keyboard is pressed,no matter what the key is labelled or what the user's operating system settings are.
Scancodes are useful for creating default controls that have the same physical locations on on all systems.

scancode= 取扫描码从键码(key)

scancode | Scancode | The scancode corresponding to the given key, or "unknown" if the given key has no known physical representation on the current system.

key | KeyConstant | The key to get the scancode from.

是否启用重复按键

Gets whether key repeat is enabled.

enabled= 是否启用重复按键()

enabled | boolean | Whether key repeat is enabled.

是否启用文本输出

Gets whether text input events are enabled.

enabled= 是否启用文本输出()

enabled | boolean | Whether text input events are enabled.

键盘是否按下

Checks whether a certain key is down. Not to be confused with 键盘按下 or 键盘放开.

down= 键盘是否按下(key)

down | boolean | True if the key is down, false if not.

key | KeyConstant | The key to check.

anyDown= 键盘是否按下(key, ...)

anyDown | boolean | True if any supplied key is down, false if not.

key | KeyConstant | A key to check.
... | KeyConstant | Additional keys to check.

扫描码是否按下

Checks whether the specified Scancodes are pressed. Not to be confused with 键盘按下 or 键盘放开.
Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode "w" is used if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.

down=扫描码是否按下(scancode,...)

down | boolean | True if any supplied Scancode is down,false if not.

scancode | Scancode | A Scancode to check.
... | Scancode | Additional Scancodes to check.

启用重复按键

Enables or disables key repeat.It is disabled by default.
The interval between repeats depends on the user's system settings.

启用重复按键(enable)

enable | boolean | Whether repeat keypress events should be enabled when a key is held down.

启用文本输入

Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android.

启用文本输入(enable)

enable | boolean | Whether text input events should be enabled.

KeyConstant

a

The A key

b

The B key

c

The C key

d

The D key

e

The E key

f

The F key

g

The G key

h

The H key

i

The I key

j

The J key

k

The K key

l

The L key

m

The M key

n

The N key

o

The O key

p

The P key

q

The Q key

r

The R key

s

The S key

t

The T key

u

The U key

v

The V key

w

The W key

x

The X key

y

The Y key

z

The Z key

0

The zero key

1

The one key

2

The two key

3

The three key

4

The four key

5

The five key

6

The six key

7

The seven key

8

The eight key

9

The nine key

space

Space key

!

Exclamation mark key

"

Double quote key

#

Hash key

$

Dollar key

&

Ampersand key

'

Single quote key

(

Left parenthesis key

)

Right parenthesis key

*

Asterisk key

+

Plus key

,

Comma key

-

Hyphen-minus key

.

Full stop key

/

Slash key

:

Colon key

;

Semicolon key

<

Less-than key

=

Equal key

>

Greater-than key

?

Question mark key

@

At sign key

?

Question mark key

[

Left square bracket key

\

Backslash key

]

Right square bracket key

^

Caret key

_

Underscore key

`

Grave accent key

kp0

The numpad zero key

kp1

The numpad one key

kp2

The numpad two key

kp3

The numpad three key

kp4

The numpad four key

kp5

The numpad five key

kp6

The numpad six key

kp7

The numpad seven key

kp8

The numpad eight key

kp9

The numpad nine key

kp.

The numpad decimal point key

kp/

The numpad division key

kp*

The numpad multiplication key

kp-

The numpad substraction key

kp+

The numpad addition key

kpenter

The numpad enter key

kp=

The numpad equals key

up

Up cursor key

down

Down cursor key

right

Right cursor key

left

Left cursor key

home

Home key

end

End key

pageup

Page up key

pagedown

Page down key

insert

Insert key

backspace

Backspace key

tab

Tab key

clear

Clear key

return

Return key

delete

Delete key

f1

The 1st function key

f2

The 2nd function key

f3

The 3rd function key

f4

The 4th function key

f5

The 5th function key

f6

The 6th function key

f7

The 7th function key

f8

The 8th function key

f9

The 9th function key

f10

The 10th function key

f11

The 11th function key

f12

The 12th function key

f13

The 13th function key

f14

The 14th function key

f15

The 15th function key

numlock

Num-lock key

capslock

Caps-lock key

scrollock

Scroll-lock key

rshift

Right shift key

lshift

Left shift key

rctrl

Right control key

lctrl

Left control key

ralt

Right alt key

lalt

Left alt key

rmeta

Right meta key

lmeta

Left meta key

lsuper

Left super key

rsuper

Right super key

mode

Mode key

compose

Compose key

pause

Pause key

escape

Escape key

help

Help key

print

Print key

sysreq

System request key

break

Break key

menu

Menu key

power

Power key

euro

Euro(€)key

undo

Undo key

www

WWW key

mail

Mail key

calculator

Calculator key

appsearch

Application search key

apphome

Application home key

appback

Application back key

appforward

Application forward key

apprefresh

Application refresh key

appbookmarks

Application bookmarks key

Scancode

a

The'A'key.

b

The'B'key.

c

The'C'key.

d

The'D'key.

e

The'E'key.

f

The'F'key.

g

The'G'key.

h

The'H'key.

i

The'I'key.

j

The'J'key.

k

The'K'key.

l

The'L'key.

m

The'M'key.

n

The'N'key.

o

The'O'key.

p

The'P'key.

q

The'Q'key.

r

The'R'key.

s

The'S'key.

t

The'T'key.

u

The'U'key.

v

The'V'key.

w

The'W'key.

x

The'X'key.

y

The'Y'key.

z

The'Z'key.

1

The'1'key.

2

The'2'key.

3

The'3'key.

4

The'4'key.

5

The'5'key.

6

The'6'key.

7

The'7'key.

8

The'8'key.

9

The'9'key.

0

The'0'key.

return

The'return'/'enter'key.

escape

The'escape'key.

backspace

The'backspace'key.

tab

The'tab'key.

space

The spacebar.

-

The minus key.

=

The equals key.

[

The left-bracket key.

]

The right-bracket key.

\

The backslash key.

nonus#

The non-U.S.hash scancode.

;

The semicolon key.

'

The apostrophe key.

`

The back-tick / grave key.

,

The comma key.

.

The period key.

/

The forward-slash key.

capslock

The capslock key.

f1

The F1 key.

f2

The F2 key.

f3

The F3 key.

f4

The F4 key.

f5

The F5 key.

f6

The F6 key.

f7

The F7 key.

f8

The F8 key.

f9

The F9 key.

f10

The F10 key.

f11

The F11 key.

f12

The F12 key.

f13

The F13 key.

f14

The F14 key.

f15

The F15 key.

f16

The F16 key.

f17

The F17 key.

f18

The F18 key.

f19

The F19 key.

f20

The F20 key.

f21

The F21 key.

f22

The F22 key.

f23

The F23 key.

f24

The F24 key.

lctrl

The left control key.

lshift

The left shift key.

lalt

The left alt / option key.

lgui

The left GUI (command / windows / super) key.

rctrl

The right control key.

rshift

The right shift key.

ralt

The right alt / option key.

rgui

The right GUI (command / windows / super) key.

printscreen

The printscreen key.

scrolllock

The scroll-lock key.

pause

The pause key.

insert

The insert key.

home

The home key.

numlock

The numlock / clear key.

pageup

The page-up key.

delete

The forward-delete key.

end

The end key.

pagedown

The page-down key.

right

The right-arrow key.

left

The left-arrow key.

down

The down-arrow key.

up

The up-arrow key.

nonusbackslash

The non-U.S. backslash scancode.

application

The application key. Windows contextual menu, compose key.

execute

The 'execute' key.

help

The 'help' key.

menu

The 'menu' key.

select

The 'select' key.

stop

The 'stop' key.

again

The 'again' key.

undo

The 'undo' key.

cut

The 'cut' key.

copy

The 'copy' key.

paste

The 'paste' key.

find

The 'find' key.

kp/

The keypad forward-slash key.

kp*

The keypad '*' key.

kp-

The keypad minus key.

kp+

The keypad plus key.

kp=

The keypad equals key.

kpenter

The keypad enter key.

kp1

The keypad '1' key.

kp2

The keypad '2' key.

kp3

The keypad '3' key.

kp4

The keypad '4' key.

kp5

The keypad '5' key.

kp6

The keypad '6' key.

kp7

The keypad '7' key.

kp8

The keypad '8' key.

kp9

The keypad '9' key.

kp0

The keypad '0' key.

kp.

The keypad period key.

international1

The 1st international key. Used on Asian keyboards.

international2

The 2nd international key.

international3

The 3rd international key. Yen.

international4

The 4th international key.

international5

The 5th international key.

international6

The 6th international key.

international7

The 7th international key.

international8

The 8th international key.

international9

The 9th international key.

lang1

Hangul/English toggle scancode.

lang2

Hanja conversion scancode.

lang3

Katakana scancode.

lang4

Hiragana scancode.

lang5

Zenkaku/Hankaku scancode.

mute

The mute key.

volumeup

The volume up key.

volumedown

The volume down key.

audionext

The audio next track key.

audioprev

The audio previous track key.

audiostop

The audio stop key.

audioplay

The audio play key.

audiomute

The audio mute key.

mediaselect

The media select key.

www

The 'WWW' key.

mail

The Mail key.

calculator

The calculator key.

computer

The 'computer' key.

acsearch

The AC Search key.

achome

The AC Home key.

acback

The AC Back key.

acforward

The AC Forward key.

acstop

Th AC Stop key.

acrefresh

The AC Refresh key.

acbookmarks

The AC Bookmarks key.

power

The system power scancode.

brightnessdown

The brightness-down scancode.

brightnessup

The brightness-up scancode.

displayswitch

The display switch scancode.

kbdillumtoggle

The keyboard illumination toggle scancode.

kbdillumdown

The keyboard illumination down scancode.

kbdillumup

The keyboard illumination up scancode.

eject

The eject scancode.

sleep

The system sleep scancode.

alterase

The alt-erase key.

sysreq

The sysreq key.

cancel

The 'cancel' key.

clear

The 'clear' key.

prior

The 'prior' key.

return2

The 'return2' key.

separator

The 'separator' key.

out

The 'out' key.

oper

The 'oper' key.

clearagain

The 'clearagain' key.

crsel

The 'crsel' key.

exsel

The 'exsel' key.

kp00

The keypad 00 key.

kp000

The keypad 000 key.

thsousandsseparator

The thousands-separator key.

decimalseparator

The decimal separator key.

currencyunit

The currency unit key.

currencysubunit

The currency sub-unit key.

app1

The 'app1' scancode.

app2

The 'app2' scancode.

unknown

An unknown key.

数学计算 love.math

空间伽马到线性

Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LOVE doesn't handle conversions automatically.

lr,lg,lb=空间伽马到线性(r,g,b)

lr | number | The red channel of the converted color in linear RGB space.
lg | number | The green channel of the converted color in linear RGB space.
lb | number | The blue channel of the converted color in linear RGB space.

r | number | The red channel of the sRGB color to convert.
g | number | The green channel of the sRGB color to convert.
b | number | The blue channel of the sRGB color to convert.

lr,lg,lb=空间伽马到线性(color)

lr | number | The red channel of the converted color in linear RGB space.
lg | number | The green channel of the converted color in linear RGB space.
lb | number | The blue channel of the converted color in linear RGB space.

color | table | An array with the red,green,and blue channels of the sRGB color to convert.

lc=空间伽马到线性(c)

lc | number | The value of the color channel in linear RGB space.

c | number | The value of a color channel in sRGB space to convert.

置随机数种子

Gets the seed of the random number generator.
The state is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53.

low,high=置随机数种子()

low | number | Integer number representing the lower 32 bits of the random number generator's 64 bit state value.
high | number | Integer number representing the higher 32 bits of the random number generator's 64 bit state value.

置随机状态

Gets the current state of the random number generator.This returns an opaque implementation-dependent string which is only useful for later use with RandomGenerator:setState.
This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number.
The value of the state string does not depend on the current operating system.

state= 置随机状态()

state | string | The current state of the RandomGenerator object, represented as a string.

是否凸边

Checks whether a polygon is convex.
PolygonShapes in love.physics, some forms of Mesh, and polygons drawn with 画多边形 must be simple convex polygons.

convex= 是否凸边(vertices)

convex | boolean | Whether the given polygon is convex.

vertices | table | The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.

convex= 是否凸边(x1, y1, x2, y2, x3, y3, ...)

convex | boolean | Whether the given polygon is convex.

x1 | number | The position of the first vertex of the polygon on the x-axis.
y1 | number | The position of the first vertex of the polygon on the y-axis.
x2 | number | The position of the second vertex of the polygon on the x-axis.
y2 | number | The position of the second vertex of the polygon on the y-axis.
x3 | number | The position of the third vertex of the polygon on the x-axis.
y3 | number | The position of the third vertex of the polygon on the y-axis.
... | number | Additional vertices.

空间线性到伽马

Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing.
In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-converted. Colors calculated using math are often in the linear RGB space.

cr, cg, cb= 空间线性到伽马(lr, lg, lb)

cr | number | The red channel of the converted color in gamma sRGB space.
cg | number | The green channel of the converted color in gamma sRGB space.
cb | number | The blue channel of the converted color in gamma sRGB space.

lr | number | The red channel of the linear RGB color to convert.
lg | number | The green channel of the linear RGB color to convert.
lb | number | The blue channel of the linear RGB color to convert.

cr, cg, cb= 空间线性到伽马(color)

cr | number | The red channel of the converted color in gamma sRGB space.
cg | number | The green channel of the converted color in gamma sRGB space.
cb | number | The blue channel of the converted color in gamma sRGB space.

color | table | An array with the red, green, and blue channels of the linear RGB color to convert.

c= 空间线性到伽马(lc)

c | number | The value of the color channel in gamma sRGB space.

lc | number | The value of a color channel in linear RGB space to convert.

创建贝塞尔曲线

Creates a new BezierCurve object.
The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc.

curve= 创建贝塞尔曲线(vertices)

curve | BezierCurve | A Bézier curve object.

vertices | table | The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.

curve= 创建贝塞尔曲线(x1, y1, x2, y2, x3, y3, ...)

curve | BezierCurve | A Bézier curve object.

x1 | number | The position of the first vertex of the control polygon on the x-axis.
y1 | number | The position of the first vertex of the control polygon on the y-axis.
x2 | number | The position of the second vertex of the control polygon on the x-axis.
y2 | number | The position of the second vertex of the control polygon on the y-axis.
x3 | number | The position of the third vertex of the control polygon on the x-axis.
y3 | number | The position of the third vertex of the control polygon on the y-axis.
... | number | Additional vertices.

创建随机数生成器

Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions.

rng=创建随机数生成器()

rng | RandomGenerator | A Random Number Generator object.

rng=创建随机数生成器(low, high)

rng | RandomGenerator | A Random Number Generator object.

low | number | The lower 32 bits of the state number to use for this instance of the object.
high(0) | number | The higher 32 bits of the state number to use for this instance of the object.

rng=创建随机数生成器(seed)

rng | RandomGenerator | A Random Number Generator object.

seed | string | A state of a RandomGenerator object returned by RandomGenerator:getState.

置噪声

Generates a Simplex or Perlin noise value in 1-4 dimensions.
Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation.
There are many webpages which discuss Perlin and Simplex noise in detail.

value= 置噪声(x)

value | number | The noise value in the range of [0, 1].

x | number | The number used to generate the noise value.

value= 置噪声(x, y)

value | number | The noise value in the range of [0, 1].

x | number | The first value of the 2-dimensional vector used to generate the noise value.
y | number | The second value of the 2-dimensional vector used to generate the noise value.

value= 置噪声(x, y, z)

value | number | The noise value in the range of [0, 1].

x | number | The first value of the 3-dimensional vector used to generate the noise value.
y | number | The second value of the 3-dimensional vector used to generate the noise value.
z | number | The third value of the 3-dimensional vector used to generate the noise value.

value= 置噪声(x, y, z, w)

value | number | The noise value in the range of [0, 1].

x | number | The first value of the 4-dimensional vector used to generate the noise value.
y | number | The second value of the 4-dimensional vector used to generate the noise value.
z | number | The third value of the 4-dimensional vector used to generate the noise value.
w | number | The fourth value of the 4-dimensional vector used to generate the noise value.

取随机数

Generates a pseudo-random number in a platform independent manner.

number= 取随机数()

number | number | The pseudo-random number.

number= 取随机数(max)

number | number | The pseudo-random integer number.

max | number | The maximum possible value it should return.

number= 取随机数(min, max)

number | number | The pseudo-random integer number.

min | number | The minimum possible value it should return.
max | number | The maximum possible value it should return.

取伪随机数

Get a normally distributed pseudo random number.

number= 取伪随机数(stddev, mean)

number | number | Normally distributed random number with variance (stddev)2 and the specified mean.

stddev(1) | number | Standard deviation of the distribution.
mean(0) | number | The mean of the distribution.

置随机数种子

Sets the seed of the random number generator using the specified integer number.

置随机数种子(seed)

seed | number | The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53].

置随机数种子(low, high)

low | number | The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1].
high(0) | number | The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1].

置随机状态

Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with RandomGenerator:setState.
This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state,whereas getSeed gets the previously set seed number.
The value of the state string does not depend on the current operating system.

置随机状态(state)

state | string | The current state of the RandomGenerator object,represented as a string.

分解三角形

Triangulate a simple polygon.

triangles=分解三角形(polygon)

triangles | table | List of triangles the polygon is composed of,in the form of{{x1,y1,x2,y2,x3,y3},{x1,y1,x2,y2,x3,y3},...}.

polygon | table | Polygon to triangulate.Must not intersect itself.

triangles=分解三角形(x1,y1,x2,y2,x3,y3,...)

triangles | table | List of triangles the polygon is composed of,in the form of{{x1,y1,x2,y2,x3,y3},{x1,y1,x2,y2,x3,y3},...}.

x1 | number | The position of the first vertex of the polygon on the x-axis.
y1 | number | The position of the first vertex of the polygon on the y-axis.
x2 | number | The position of the second vertex of the polygon on the x-axis.
y2 | number | The position of the second vertex of the polygon on the y-axis.
x3 | number | The position of the third vertex of the polygon on the x-axis.
y3 | number | The position of the third vertex of the polygon on the y-axis.
... | number | Additional vertices.

BezierCurve:evalulate

Evaluate Bézier curve at parameter t.The parameter must be between 0 and 1(inclusive).
This function can be used to move objects along paths or tween parameters.However it should not be used to render the curve,see BezierCurve:render for that purpose.

x,y=BezierCurve:evalulate(t)

x | number | x coordinate of the curve at parameter t.
y | number | y coordinate of the curve at parameter t.

t | number | Where to evaluate the curve.

BezierCurve:getControlPoint

Get coordinates of the i-th control point.Indices start with 1.

x,y=BezierCurve:getControlPoint(i)

x | number | Position of the control point along the x axis.
y | number | Position of the control point along the y axis.

i | number | Index of the control point.

BezierCurve:getControlPointCount

Get the number of control points in the Bézier curve.

count=BezierCurve:getControlPointCount()

count | number | The number of control points.

BezierCurve:getDegree

Get degree of the Bézier curve.The degree is equal to number-of-control-points-1.

degree=BezierCurve:getDegree()

degree | number | Degree of the Bézier curve.

BezierCurve:getDerivative

Get the derivative of the Bézier curve.
This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t.

derivative=BezierCurve:getDerivative()

derivative | BezierCurve | The derivative curve.

BezierCurve:getSegment

Gets a BezierCurve that corresponds to the specified segment of this BezierCurve.

curve=BezierCurve:getSegment(startpoint,endpoint)

curve | BezierCurve | A BezierCurve that corresponds to the specified segment.

startpoint | number | The starting point along the curve.Must be between 0 and 1.
endpoint | number | The end of the segment.Must be between 0 and 1.

BezierCurve:insertControlPoint

Insert control point after the i-th control point.Indices start with 1.Negative indices wrap around:-1 is the last control point,-2 the one before the last,etc.

BezierCurve:insertControlPoint(x,y,i)

x | number | Position of the control point along the x axis.
y | number | Position of the control point along the y axis.
i(-1) | number | Index of the control point.

BezierCurve:removeControlPoint

Removes the specified control point.

BezierCurve:removeControlPoint(index)

index | number | The index of the control point to remove.

BezierCurve:render

Get a list of coordinates to be used with画线.
This function samples the Bézier curve using recursive subdivision.You can control the recursion depth using the depth parameter.
If you are just interested to know the position on the curve given a parameter,use BezierCurve:evalulate.

coordinates=BezierCurve:render(depth)

coordinates | table | List of x,y-coordinate pairs of points on the curve.

depth(5) | number | Number of recursive subdivision steps.

BezierCurve:renderSegment

Get a list of coordinates on a specific part of the curve,to be used with画线.
This function samples the Bézier curve using recursive subdivision.You can control the recursion depth using the depth parameter.
If you are just need to know the position on the curve given a parameter,use BezierCurve:evaluate.

coordinates=BezierCurve:renderSegment(startpoint,endpoint,depth)

coordinates | table | List of x,y-coordinate pairs of points on the curve.

startpoint | number | The starting point along the curve.Must be between 0 and 1.
endpoint | number | The end of the segment to render.Must be between 0 and 1.
depth(5) | number | Number of recursive subdivision steps.

BezierCurve:rotate

Rotate the Bézier curve by an angle.

BezierCurve:rotate(angle,ox,oy)

angle | number | Rotation angle in radians.
ox(0) | number | X coordinate of the rotation center.
oy(0) | number | Y coordinate of the rotation center.

BezierCurve:scale

Scale the Bézier curve by a factor.

BezierCurve:scale(s,ox,oy)

s | number | Scale factor.
ox(0) | number | X coordinate of the scaling center.
oy(0) | number | Y coordinate of the scaling center.

BezierCurve:setControlPoint

Set coordinates of the i-th control point.Indices start with 1.

BezierCurve:setControlPoint(i,ox,oy)

i | number | Index of the control point.
ox | number | Position of the control point along the x axis.
oy | number | Position of the control point along the y axis.

BezierCurve:translate

Move the Bézier curve by an offset.

BezierCurve:translate(dx,dy)

dx | number | Offset along the x axis.
dy | number | Offset along the y axis.

RandomGenerator:getSeed

Gets the state of the random number generator.
The state is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53.

low,high=RandomGenerator:getSeed()

low | number | Integer number representing the lower 32 bits of the random number generator's 64 bit state value.
high | number | Integer number representing the higher 32 bits of the random number generator's 64 bit state value.

RandomGenerator:getState

Gets the current state of the random number generator.This returns an opaque implementation-dependent string which is only useful for later use with RandomGenerator:setState.
This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number.
The value of the state string does not depend on the current operating system.

state= RandomGenerator:getState()

state | string | The current state of the RandomGenerator object, represented as a string.

RandomGenerator:random

Generates a pseudo-random number in a platform independent manner.

number= RandomGenerator:random()

number | number | The pseudo random number.

number= RandomGenerator:random(max)

number | number | The pseudo-random integer number.

max | number | The maximum possible value it should return.

number= RandomGenerator:random(min, max)

number | number | The pseudo-random integer number.

min | number | The minimum possible value it should return.
max | number | The maximum possible value it should return.

RandomGenerator:randomNormal

Get a normally distributed pseudo random number.

number= RandomGenerator:randomNormal(stddev, mean)

number | number | Normally distributed random number with variance (stddev)2 and the specified mean.

stddev(1) | number | Standard deviation of the distribution.
mean(0) | number | The mean of the distribution.

RandomGenerator:setSeed

Sets the seed of the random number generator using the specified integer number.

RandomGenerator:setSeed(seed)

seed | number | The integer number with which you want to seed the randomization. Must be within the range of [1, 2^53].

RandomGenerator:setSeed(low, high)

low | number | The lower 32 bits of the state value. Must be within the range of [0, 2^32 - 1].
high(0) | number | The higher 32 bits of the state value. Must be within the range of [0, 2^32 - 1].

RandomGenerator:setState

Sets the current state of the random number generator. The value used as an arg for this function is an opaque implementation-dependent string and should only originate from a previous call to RandomGenerator:getState.
This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state,whereas setSeed gives it a new seed value.
The effect of the state string does not depend on the current operating system.

RandomGenerator:setState(state)

state | string | The new state of the RandomGenerator object,represented as a string.This should originate from a previous call to RandomGenerator:getState.

鼠标操作love.mouse

取当前光标

Gets the current Cursor.

cursor=取当前光标()

cursor | Cursor | The current cursor,or nil if no cursor is set.

鼠标取位置

Returns the current position of the mouse.

x,y=鼠标取位置()

x | number | The position of the mouse along the x-axis.
y | number | The position of the mouse along the y-axis.

取系统光标

Gets a Cursor object representing a system-native hardware cursor.
Hardware cursors are framerate-independent and work the same way as normal operating system cursors.Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates.

cursor= 取系统光标(ctype)

cursor | Cursor | The Cursor object representing the system cursor type.

ctype | CursorType | The type of system cursor to get.

鼠标取横坐标

Returns the current x position of the mouse.

x= 鼠标取横坐标()

x | number | The position of the mouse along the x-axis.

鼠标取纵坐标

Returns the current y position of the mouse.

y= 鼠标取纵坐标()

y | number | The position of the mouse along the y-axis.

鼠标是否按下

Checks whether a certain mouse button is down. This function does not detect mousewheel scrolling.

down= 鼠标是否按下(button, ...)

down | boolean | True if the specified button is down.

button | number | The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button, etc.
... | number | Additional button numbers to check.

鼠标是否抓取

Checks if the mouse is grabbed.

grabbed= 鼠标是否抓取()

grabbed | boolean | True if the cursor is grabbed, false if it is not.

鼠标是否可视

Checks if the cursor is visible.

visible= 鼠标是否可视()

窗口可视状态 | boolean | True if the cursor to visible, false if the cursor is hidden.

创建光标

Creates a new hardware Cursor object from an image file or ImageData.
Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates,hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates,even at low frameratesn
The hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is.For example,the normal arrow pointer normally has its hot spot at the top left of the image,but a crosshair cursor might have it in the middle.

cursor=创建光标(imageData,hotx,hoty)

cursor | Cursor | The new Cursor object.

imageData | ImageData | The ImageData to use for the the new Cursor.
hotx(0) | number | The x-coordinate in the ImageData of the cursor's hot spot.
hoty(0) | number | The y-coordinate in the ImageData of the cursor's hot spot.

cursor=创建光标(filepath,hotx,hoty)

cursor | Cursor | The new Cursor object.

filepath | string | Path to the image to use for the new Cursor.
hotx(0) | number | The x-coordinate in the ImageData of the cursor's hot spot.
hoty(0) | number | The y-coordinate in the ImageData of the cursor's hot spot.

cursor=创建光标(fileData,hotx,hoty)

cursor | Cursor | The new Cursor object.

fileData | FileData | Data representing the image to use for the new Cursor.
hotx(0) | number | The x-coordinate in the ImageData of the cursor's hot spot.
hoty(0) | number | The y-coordinate in the ImageData of the cursor's hot spot.

鼠标置光标

Sets the current mouse cursor.
Resets the current mouse cursor to the default when called without args.

鼠标置光标()

鼠标置光标(cursor)

cursor | Cursor | The Cursor object to use as the current mouse cursor.

鼠标置抓取

Grabs the mouse and confines it to the window.

鼠标置抓取(grab)

grab | boolean | True to confine the mouse,false to let it leave the window.

鼠标置位置

Sets the position of the mouse.

鼠标置位置(x,y)

x | number | The new position of the mouse along the x-axis.
y | number | The new position of the mouse along the y-axis.

鼠标置可视

Sets the visibility of the cursor.

鼠标置可视(visible)

窗口可视状态 | boolean | True to set the cursor to visible,false to hide the cursor.

鼠标置横坐标

Sets the current X position of the mouse.

鼠标置横坐标(x)

x | number | The new position of the mouse along the x-axis.

鼠标置纵坐标

Sets the current Y position of the mouse.

鼠标置纵坐标(y)

y | number | The new position of the mouse along the y-axis.

Cursor:getType

Gets the type of the Cursor.

cursortype=Cursor:getType()

cursortype | CursorType | The type of the Cursor.

CursorType

image

The cursor is using a custom image.

arrow

An arrow pointer.

ibeam

An I-beam,normally used when mousing over editable or selectable text.

wait

Wait graphic.

waitarrow

Small wait cursor with an arrow pointer.

crosshair

Crosshair symbol.

sizenwse

Double arrow pointing to the top-left and bottom-right.

sizenesw

Double arrow pointing to the top-right and bottom-left.

sizewe

Double arrow pointing left and right.

sizens

Double arrow pointing up and down.

sizeall

Four-pointed arrow pointing up,down,left,and right.

no

Slashed circle or crossbones.

hand

Hand symbol.

物理引擎love.physics

取固件距离

Returns the two closest points between two fixtures and their distance.

distance,x1,y1,x2,y2=取固件距离(fixture1,fixture2)

distance | number | The distance of the two points.
x1 | number | The x-coordinate of the first point.
y1 | number | The y-coordinate of the first point.
x2 | number | The x-coordinate of the second point.
y2 | number | The y-coordinate of the second point.

fixture1 | Fixture | The first fixture.
fixture2 | Fixture | The second fixture.

取物理世界单位

Get the scale of the world.
The world scale is the number of pixels per meter.Try to keep your shape sizes less than 10 times this scale.
This is important because the physics in Box2D is tuned to work well for objects of size 0.1m up to 10m.All physics coordinates are divided by this number for the physics calculations.

scale=取物理世界单位()

scale | number | The size of 1 meter in pixels.

newBody

Creates a new body.
There are three types of bodies.Static bodies do not move,have a infinite mass,and can be used for level boundaries.Dynamic bodies are the main actors in the simulation,they collide with everything.Kinematic bodies do not react to forces and only collide with dynamic bodies.
The mass of the body gets calculated when a Fixture is attached or removed,but can be changed at any time with Body:setMass or Body:resetMassData.

body=newBody(world,x,y,type)

body | Body | A new body.

world | World | The world to create the body in.
x(0) | number | The x position of the body.
y(0) | number | The y position of the body.
type("static") | BodyType | The type of the body.

newChainShape

Creates a new ChainShape.

shape=newChainShape(loop,x1,y1,x2,y2,...)

shape | ChainShape | The new shape.

loop | boolean | If the chain should loop back to the first point.
x1 | number | The x position of the first point.
y1 | number | The y position of the first point.
x2 | number | The x position of the second point.
y2 | number | The y position of the second point.
... | number | Additional point positions.

shape=newChainShape(loop,points)

shape | ChainShape | The new shape.

loop | boolean | If the chain should loop back to the first point.
points | table | A list of points to construct the ChainShape,in the form of{x1,y1,x2,y2,...}.

newCircleShape

Creates a new CircleShape.

shape=newCircleShape(radius)

shape | CircleShape | The new shape.

radius | number | The radius of the circle.

shape=newCircleShape(x,y,radius)

shape | CircleShape | The new shape.

x | number | The x offset of the circle.
y | number | The y offset of the circle.
radius | number | The radius of the circle.

newDistanceJoint

Create a distance joint between two bodies.
This joint constrains the distance between two points on two bodies to be constant.These two points are specified in world coordinates and the two bodies are assumed to be in place when this joint is created.The first anchor point is connected to the first body and the second to the second body,and the points define the length of the distance joint.

joint=newDistanceJoint(body1,body2,x1,y1,x2,y2,collideConnected)

joint | DistanceJoint | The new distance joint.

body1 | Body | The first body to attach to the joint.
body2 | Body | The second body to attach to the joint.
x1 | number | The x position of the first anchor point.
y1 | number | The y position of the first anchor point.
x2 | number | The x position of the second anchor point.
y2 | number | The y position of the second anchor point.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

newEdgeShape

Creates a edge shape.

shape=newEdgeShape(x1,y1,x2,y2)

shape | EdgeShape | The new shape.

x1 | number | The x position of the first point.
y1 | number | The y position of the first point.
x2 | number | The x position of the second point.
y2 | number | The y position of the second point.

newFixture

Creates and attaches a Fixture to a body.

fixture=newFixture(body,shape,density)

fixture | Fixture | The new fixture.

body | Body | The body which gets the fixture attached.
shape | Shape | The shape of the fixture.
density(1) | number | The density of the fixture.

newFrictionJoint

Create a friction joint between two bodies.A FrictionJoint applies friction to a body.

joint=newFrictionJoint(body1,body2,x,y,collideConnected)

joint | FrictionJoint | The new FrictionJoint.

body1 | Body | The first body to attach to the joint.
body2 | Body | The second body to attach to the joint.
x | number | The x position of the anchor point.
y | number | The y position of the anchor point.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with eachother.

newGearJoint

Create a gear joint connecting two joints.
The gear joint connects two joints that must be either prismatic or revolute joints.Using this joint requires that the joints it uses connect their respective bodies to the ground and have the ground as the first body.When destroying the bodies and joints you must make sure you destroy the gear joint before the other joints.
The gear joint has a ratio the determines how the angular or distance values of the connected joints relate to each other.The formula coordinate1+ratio*coordinate2 always has a constant value that is set when the gear joint is created.

joint=newGearJoint(joint1,joint2,ratio,collideConnected)

joint | Joint | The new gear joint.

joint1 | Joint | The first joint to connect with a gear joint.
joint2 | Joint | The second joint to connect with a gear joint.
ratio(1) | number | The gear ratio.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

newMouseJoint

Create a joint between a body and the mouse.
This joint actually connects the body to a fixed point in the world.To make it follow the mouse,the fixed point must be updated every timestep(example below).
The advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine.

joint=newMouseJoint(body,x,y)

joint | Joint | The new mouse joint.

body | Body | The body to attach to the mouse.
x | number | The x position of the connecting point.
y | number | The y position of the connecting point.

newPolygonShape

Creates a new PolygonShape.
This shape can have 8 vertices at most,and must form a convex shape.

shape=newPolygonShape(x1,y1,x2,y2,...)

shape | PolygonShape | A new PolygonShape.

x1 | number | The position of first point on the x-axis.
y1 | 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.
... | number | You can continue passing more point positions to create the PolygonShape.

shape=newPolygonShape(vertices)

shape | PolygonShape | A new PolygonShape.

vertices | table | A list of vertices to construct the polygon,in the form of{x1,y1,x2,y2,x3,y3,...}.

newPrismaticJoint

Create a prismatic joints between two bodies.
A prismatic joint constrains two bodies to move relatively to each other on a specified axis.It does not allow for relative rotation.Its definition and operation are similar to a revolute joint,but with translation and force substituted for angle and torque.

joint=newPrismaticJoint(body1,body2,x,y,ax,ay,collideConnected)

joint | PrismaticJoint | The new prismatic joint.

body1 | Body | The first body to connect with a prismatic joint.
body2 | Body | The second body to connect with a prismatic joint.
x | number | The x coordinate of the anchor point.
y | number | The y coordinate of the anchor point.
ax | number | The x coordinate of the axis unit vector.
ay | number | The y coordinate of the axis unit vector.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

joint=newPrismaticJoint(body1,body2,x1,y1,x2,y2,ax,ay,collideConnected)

joint | PrismaticJoint | The new prismatic joint.

body1 | Body | The first body to connect with a prismatic joint.
body2 | Body | The second body to connect with a prismatic joint.
x1 | number | The x coordinate of the first anchor point.
y1 | number | The y coordinate of the first anchor point.
x2 | number | The x coordinate of the second anchor point.
y2 | number | The y coordinate of the second anchor point.
ax | number | The x coordinate of the axis unit vector.
ay | number | The y coordinate of the axis unit vector.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

newPulleyJoint

Create a pulley joint to join two bodies to each other and the ground.
The pulley joint simulates a pulley with an optional block and tackle.If the ratio parameter has a value different from one,then the simulated rope extends faster on one side than the other.In a pulley joint the total length of the simulated rope is the constant length1+ratio*length2,which is set when the pulley joint is created.
Pulley joints can behave unpredictably if one side is fully extended.It is recommended that the method setMaxLengths be used to constrain the maximum lengths each side can attain.

joint=newPulleyJoint(body1,body2,gx1,gy1,gx2,gy2,x1,y1,x2,y2,ratio,collideConnected)

joint | Joint | The new pulley joint.

body1 | Body | The first body to connect with a pulley joint.
body2 | Body | The second body to connect with a pulley joint.
gx1 | number | The x coordinate of the first body's ground anchor.
gy1 | number | The y coordinate of the first body's ground anchor.
gx2 | number | The x coordinate of the second body's ground anchor.
gy2 | number | The y coordinate of the second body's ground anchor.
x1 | number | The x coordinate of the pulley joint anchor in the first body.
y1 | number | The y coordinate of the pulley joint anchor in the first body.
x2 | number | The x coordinate of the pulley joint anchor in the second body.
y2 | number | The y coordinate of the pulley joint anchor in the second body.
ratio(1) | number | The joint ratio.
collideConnected(true) | boolean | Specifies whether the two bodies should collide with each other.

newRectangleShape

Shorthand for creating rectangluar PolygonShapes.
By default,the local origin is located at the center of the rectangle as opposed to the top left for graphics.

shape=newRectangleShape(width,height)

shape | PolygonShape | A new PolygonShape.

width | number | The width of the rectangle.
height | number | The height of the rectangle.

shape=newRectangleShape(x,y,width,height,angle)

shape | PolygonShape | A new PolygonShape.

x | number | The offset along the x-axis.
y | number | The offset along the y-axis.
width | number | The width of the rectangle.
height | number | The height of the rectangle.
angle(0) | number | The initial angle of the rectangle.

newRevoluteJoint

Creates a pivot joint between two bodies.
This joint connects two bodies to a point around which they can pivot.

joint=newRevoluteJoint(body1,body2,x,y,collideConnected)

joint | Joint | The new revolute joint.

body1 | Body | The first body to connect with a Revolute Joint.
body2 | Body | The second body to connect with a Revolute Joint.
x | number | The x position of the connecting point.
y | number | The y position of the connecting point.
collideConnected | number | Specifies whether the two bodies should collide with each other.

love.physics.newRopeJoint

Create a joint between two bodies.Its only function is enforcing a max distance between these bodies.

joint=love.physics.newRopeJoint(body1,body2,x1,y1,x2,y2,maxLength,collideConnected)

joint | RopeJoint | The new RopeJoint.

body1 | Body | The first body to attach to the joint.
body2 | Body | The second body to attach to the joint.
x1 | number | The x position of the first anchor point.
y1 | number | The y position of the first anchor point.
x2 | number | The x position of the second anchor point.
y2 | number | The y position of the second anchor point.
maxLength | number | The maximum distance for the bodies.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

newWeldJoint

Create a friction joint between two bodies.A WeldJoint essentially glues two bodies together.

joint=newWeldJoint(body1,body2,x,y,collideConnected)

joint | WeldJoint | The new WeldJoint.

body1 | Body | The first body to attach to the joint.
body2 | Body | The second body to attach to the joint.
x | number | The x position of the anchor point.
y | number | The y position of the anchor point.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

newWheelJoint

Creates a wheel joint.

joint=newWheelJoint(body1,body2,x,y,ax,ay,collideConnected)

joint | WheelJoint | The new WheelJoint.

body1 | Body | The first body.
body2 | Body | The second body.
x | number | The x position of the anchor point.
y | number | The y position of the anchor point.
ax | number | The x position of the axis unit vector.
ay | number | The y position of the axis unit vector.
collideConnected(false) | boolean | Specifies whether the two bodies should collide with each other.

newWorld

Creates a new World.

world=newWorld(xg,yg,sleep)

world | World | A brave new World.

xg(0) | number | The x component of gravity.
yg(0) | number | The y component of gravity.
sleep(true) | boolean | Whether the bodies in this world are allowed to sleep.

置物理世界单位

Sets the pixels to meter scale factor.
All coordinates in the physics module are divided by this number and converted to meters,and it creates a convenient way to draw the objects directly to the screen without the need for graphics transformations.
It is recommended to create shapes no larger than 10 times the scale.This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters.The default meter scale is 30.
置物理世界单位does not apply retroactively to created objects.Created objects retain their meter coordinates but the scale factor will affect their pixel coordinates.

置物理世界单位(scale)

scale | number | The scale factor as an integer.

Body:applyAngularImpulse

Applies an angular impulse to a body.This makes a single,instantaneous addition to the body momentum.
A body with with a larger mass will react less.The reaction does not depend on the timestep,and is equivalent to applying a force continuously for 1 second.Impulses are best used to give a single push to a body.For a continuous push to a body it is better to use Body:applyForce.

Body:applyAngularImpulse(impulse)

impulse | number | The impulse in kilogram-square meter per second.

Body:applyForce

Apply force to a Body.
A force pushes a body in a direction.A body with with a larger mass will react less.The reaction also depends on how long a force is applied:since the force acts continuously over the entire timestep,a short timestep will only push the body for a short time.Thus forces are best used for many timesteps to give a continuous push to a body(like gravity).For a single push that is independent of timestep,it is better to use Body:applyLinearImpulse.
If the position to apply the force is not given,it will act on the center of mass of the body.The part of the force not directed towards the center of mass will cause the body to spin(and depends on the rotational inertia).
Note that the force components and position must be given in world coordinates.

Body:applyForce(fx,fy)

fx | number | The x component of force to apply to the center of mass.
fy | number | The y component of force to apply to the center of mass.

Body:applyForce(fx,fy,x,y)

fx | number | The x component of force to apply.
fy | number | The y component of force to apply.
x | number | The x position to apply the force.
y | number | The y position to apply the force.

Body:applyLinearImpulse

Applies an impulse to a body.This makes a single,instantaneous addition to the body momentum.
An impulse pushes a body in a direction.A body with with a larger mass will react less.The reaction does not depend on the timestep,and is equivalent to applying a force continuously for 1 second.Impulses are best used to give a single push to a body.For a continuous push to a body it is better to use Body:applyForce.
If the position to apply the impulse is not given,it will act on the center of mass of the body.The part of the impulse not directed towards the center of mass will cause the body to spin(and depends on the rotational inertia).
Note that the impulse components and position must be given in world coordinates.

Body:applyLinearImpulse(ix,iy)

ix | number | The x component of the impulse applied to the center of mass.
iy | number | The y component of the impulse applied to the center of mass.

Body:applyLinearImpulse(ix,iy,x,y)

ix | number | The x component of the impulse.
iy | number | The y component of the impulse.
x | number | The x position to apply the impulse.
y | number | The y position to apply the impulse.

Body:applyTorque

Apply torque to a body.
Torque is like a force that will change the angular velocity(spin)of a body.The effect will depend on the rotational inertia a body has.

Body:applyTorque(torque)

torque | number | The torque to apply.

Body:destroy

Explicitly destroys the Body.When you don't have time to wait for garbage collection, this function may be used to free the object immediately, but note that an error will occur if you attempt to use the object after calling this function.

Body:destroy()

Body:getAngle

Get the angle of the body.
The angle is measured in radians. If you need to transform it to degrees, use math.deg.
A value of 0 radians will mean "looking to the right". Although radians increase counter-clockwise, the y-axis points down so it becomes clockwise from our point of view.

angle= Body:getAngle()

angle | number | The angle in radians.

Body:getAngularDamping

Gets the Angular damping of the Body
The angular damping is the rate of decrease of the angular velocity over time: A spinning body with no damping and no external forces will continue spinning indefinitely. A spinning body with damping will gradually stop spinning.
Damping is not the same as friction - they can be modelled together. However, only damping is provided by Box2D (and LOVE).
Damping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity meaning full damping. Normally you will use a damping value between 0 and 0.1.

damping= Body:getAngularDamping()

damping | number | The value of the angular damping.

Body:getAngularVelocity

Get the angular velocity of the Body.
The angular velocity is the rate of change of angle over time.
It is changed in World:update by applying torques, off centre forces/impulses, and angular damping. It can be set directly with Body:setAngularVelocity.
If you need the rate of change of position over time, use Body:getLinearVelocity.

w= Body:getAngularVelocity()

w | number | The angular velocity in radians/second.

Body:getContactList

Gets a list of all Contacts attached to the Body.

contacts= Body:getContactList()

contacts | table | A list with all contacts associated with the Body.

Body:getFixtureList

Returns a table with all fixtures.

fixtures= Body:getFixtureList()

fixtures | table | A sequence with all fixtures.

Body:getGravityScale

Returns the gravity scale factor.

scale= Body:getGravityScale()

scale | number | The gravity scale factor.

Body:getInertia

Gets the rotational inertia of the body.
The rotational inertia is how hard is it to make the body spin. It is set with the 4th arg to Body:setMass, or automatically with Body:setMassFromShapes.

inertia= Body:getInertia()

inertia | number | The rotational inertial of the body.

Body:getJointList

Returns a table containing the Joints attached to this Body.

joints= Body:getJointList()

joints | table | A sequence with the Joints attached to the Body.

Body:getLinearDamping

Gets the linear damping of the Body.
The linear damping is the rate of decrease of the linear velocity over time. A moving body with no damping and no external forces will continue moving indefinitely, as is the case in space. A moving body with damping will gradually stop moving.
Damping is not the same as friction - they can be modelled together. However, only damping is provided by Box2D (and LOVE).

damping= Body:getLinearDamping()

damping | number | The value of the linear damping.

Body:getLinearVelocity

Gets the linear velocity of the Body from its center of mass.
The linear velocity is the rate of change of position over time.
If you need the rate of change of angle over time, use Body:getAngularVelocity. If you need to get the linear velocity of a point different from the center of mass:
Body:getLinearVelocityFromLocalPoint allows you to specify the point in local coordinates.
Body:getLinearVelocityFromWorldPoint allows you to specify the point in world coordinates.

x, y= Body:getLinearVelocity()

x | number | The x component of the velocity vector.
y | number | The y component of the velocity vector.

Body:getLinearVelocityFromLocalPoint

Get the linear velocity of a point on the body.
The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.
The point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates.

vx, vy= Body:getLinearVelocityFromLocalPoint(x, y)

vx | number | The x component of velocity at point (x,y).
vy | number | The y component of velocity at point (x,y).

x | number | The x position to measure velocity.
y | number | The y position to measure velocity.

Body:getLinearVelocityFromWorldPoint

Get the linear velocity of a point on the body.
The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.
The point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates.

vx, vy= Body:getLinearVelocityFromWorldPoint(x, y)

vx | number | The x component of velocity at point (x,y).
vy | number | The y component of velocity at point (x,y).

x | number | The x position to measure velocity.
y | number | The y position to measure velocity.

Body:getLocalCenter

Get the center of mass position in local coordinates.
Use Body:getWorldCenter to get the center of mass in world coordinates.

x, y= Body:getLocalCenter()

x | number | The x coordinate of the center of mass.
y | number | The y coordinate of the center of mass.

Body:getLocalPoint

Transform a point from world coordinates to local coordinates.

local_x, local_y= Body:getLocalPoint(world_x, world_y)

local_x | number | The x position in local coordinates.
local_y | number | The y position in local coordinates.

world_x | number | The x position in world coordinates.
world_y | number | The y position in world coordinates.

Body:getLocalVector

Transform a vector from world coordinates to local coordinates.

local_x, local_y= Body:getLocalVector(world_x, world_y)

local_x | number | The vector x component in local coordinates.
local_y | number | The vector y component in local coordinates.

world_x | number | The vector x component in world coordinates.
world_y | number | The vector y component in world coordinates.

Body:getMass

Get the mass of the body.

mass= Body:getMass()

mass | number | The mass of the body (in kilograms).

Body:getMassData

Returns the mass, its center, and the rotational inertia.

x, y, mass, inertia= Body:getMassData()

x | number | The x position of the center of mass.
y | number | The y position of the center of mass.
mass | number | The mass of the body.
inertia | number | The rotational inertia.

Body:getPosition

Get the position of the body.
Note that this may not be the center of mass of the body.

x, y= Body:getPosition()

x | number | The x position.
y | number | The y position.

Body:getType

Returns the type of the body.

type= Body:getType()

type | BodyType | The body type.

Body:getUserData

Returns the Lua value associated with this Body.
Use this function in one thread only.

value= Body:getUserData()

value | value | The Lua value associated with the Body.

Body:getWorld

Gets the World the body lives in.

world= Body:getWorld()

world | World | The world the body lives in.

Body:getWorldCenter

Get the center of mass position in world coordinates.
Use Body:getLocalCenter to get the center of mass in local coordinates.

x, y= Body:getWorldCenter()

x | number | The x coordinate of the center of mass.
y | number | The y coordinate of the center of mass.

Body:getWorldPoint

Transform a point from local coordinates to world coordinates.

world_x, world_y= Body:getWorldPoint(local_x, local_y)

world_x | number | The x position in world coordinates.
world_y | number | The y position in world coordinates.

local_x | number | The x position in local coordinates.
local_y | number | The y position in local coordinates.

Body:getWorldPoints

Transforms multiple points from local coordinates to world coordinates.

x1, y1, x2, y2, ...= Body:getWorldPoints(x1, y1, x2, y2, ...)

x1 | number | The transformed x position of the first point.
y1 | number | The transformed y position of the first point.
x2 | number | The transformed x position of the second point.
y2 | number | The transformed y position of the second point.
... | number | The transformed x and y positions of additional points.

x1 | number | The x position of the first point.
y1 | number | The y position of the first point.
x2 | number | The x position of the second point.
y2 | number | The y position of the second point.
... | number | More x and y points.

Body:getWorldVector

Transform a vector from local coordinates to world coordinates.

world_x, world_y= Body:getWorldVector(local_x, local_y)

world_x | number | The vector x component in world coordinates.
world_y | number | The vector y component in world coordinates.

local_x | number | The vector x component in local coordinates.
local_y | number | The vector y component in local coordinates.

Body:getX

Get the x position of the body in world coordinates.

x= Body:getX()

x | number | The x position in world coordinates.

Body:getY

Get the y position of the body in world coordinates.

y= Body:getY()

y | number | The y position in world coordinates.

Body:isActive

Returns whether the body is actively used in the simulation.

status= Body:isActive()

status | boolean | True if the body is active or false if not.

Body:isAwake

Returns the sleep status of the body.

status= Body:isAwake()

status | boolean | True if the body is awake or false if not.

Body:isBullet

Get the bullet status of a body.
There are two methods to check for body collisions:
at their location when the world is updated (default)
using continuous collision detection (CCD)
The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.
Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.

status= Body:isBullet()

status | boolean | The bullet status of the body.

Body:isDestroyed

Gets whether the Body is destroyed. Destroyed bodies cannot be used.

destroyed= Body:isDestroyed()

destroyed | boolean | Whether the Body is destroyed.

Body:isFixedRotation

Returns whether the body rotation is locked.

fixed= Body:isFixedRotation()

fixed | boolean | True if the body's rotation is locked or false if not.

Body:isSleepingAllowed

Returns the sleeping behaviour of the body.

status=Body:isSleepingAllowed()

status | boolean | True if the body is allowed to sleep or false if not.

Body:resetMassData

Resets the mass of the body by recalculating it from the mass properties of the fixtures.

Body:resetMassData()

Body:setActive

Sets whether the body is active in the world.
An inactive body does not take part in the simulation.It will not move or cause any collisions.

Body:setActive(active)

active | boolean | If the body is active or not.

Body:setAngle

Set the angle of the body.
The angle is measured in radians.If you need to transform it from degrees,use math.rad.
A value of 0 radians will mean"looking to the right"..Although radians increase counter-clockwise,the y-axis points down so it becomes clockwise from our point of view.
It is possible to cause a collision with another body by changing its angle.

Body:setAngle(angle)

angle | number | The angle in radians.

Body:setAngularDamping

Sets the angular damping of a Body.
See Body:getAngularDamping for a definition of angular damping.
Angular damping can take any value from 0 to infinity.It is recommended to stay between 0 and 0.1,though.Other values will look unrealistic.

Body:setAngularDamping(damping)

damping | number | The new angular damping.

Body:setAngularVelocity

Sets the angular velocity of a Body.
The angular velocity is the rate of change of angle over time.
This function will not accumulate anything;any impulses previously applied since the last call to World:update will be lost.

Body:setAngularVelocity(w)

w | number | The new angular velocity,in radians per second

Body:setAwake

Wakes the body up or puts it to sleep.

Body:setAwake(awake)

awake | boolean | The body sleep status.

Body:setBullet

Set the bullet status of a body.
There are two methods to check for body collisions:
at their location when the world is updated(default)
using continuous collision detection(CCD)
The default method is efficient,but a body moving very quickly may sometimes jump over another body without producing a collision.A body that is set as a bullet will use CCD.This is less efficient,but is guaranteed not to jump when moving quickly.
Note that static bodies(with zero mass)always use CCD,so your walls will not let a fast moving body pass through even if it is not a bullet.

Body:setBullet(status)

status | boolean | The bullet status of the body.

Body:setFixedRotation

Set whether a body has fixed rotation.
Bodies with fixed rotation don't vary the speed at which they rotate.

Body:setFixedRotation(fixed)

fixed | boolean | Whether the body should have fixed rotation.

Body:setGravityScale

Sets a new gravity scale factor for the body.

Body:setGravityScale(scale)

scale | number | The new gravity scale factor.

Body:setInertia

Set the inertia of a body.
This value can also be set by the fourth arg of Body:setMass.

Body:setInertia(inertia)

inertia | number | The new moment of inertia, in kilograms per meter squared.

Body:setLinearDamping

Sets the linear damping of a Body
See Body:getLinearDamping for a definition of linear damping.
Linear damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will make the objects look "floaty".

Body:setLinearDamping(ld)

ld | number | The new linear damping.

Body:setLinearVelocity

Sets a new linear velocity for the Body.
This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost.

Body:setLinearVelocity(x, y)

x | number | The x component of the velocity vector.
y | number | The y component of the velocity vector.

Body:setMass

Sets the mass in kilograms.

Body:setMass(mass)

mass | number | The mass, in kilograms.

Body:setMassData

Overrides the calculated mass data.

Body:setMassData(x, y, mass, inertia)

x | number | The x component of the center of mass in local coordinates.
y | number | The y component of the center of mass in local coordinates.
mass | number | The mass, in kilograms.
inertia | number | The rotational inertia, in kilograms per squared meter.

Body:setPosition

Set the position of the body.
Note that this may not be the center of mass of the body.

Body:setPosition(x, y)

x | number | The x position.
y | number | The y position.

Body:setSleepingAllowed

Sets the sleeping behaviour of the body.

Body:setSleepingAllowed(allowed)

allowed | boolean | True if the body is allowed to sleep or false if not.

Body:setType

Sets a new body type.

Body:setType(type)

type | BodyType | The new type.

Body:setUserData

Associates a Lua value with the Body.
To delete the reference, explicitly pass nil.
Use this function in one thread only.

Body:setUserData(value)

value | value | The Lua value to associate with the Body.

Body:setX

Set the x position of the body.

Body:setX(x)

x | number | The x position.

Body:setY

Set the y position of the body.

Body:setY(y)

y | number | The y position.

ChainShape:getChildEdge

Returns a child of the shape as an EdgeShape.

EdgeShape= ChainShape:getChildEdge(index)

EdgeShape | number | The child as an EdgeShape.

index | number | The index of the child.

ChainShape:getPoint

Returns a point of the shape.

x, y= ChainShape:getPoint(index)

x | number | The x-coordinate of the point.
y | number | The y-coordinate of the point.

index | number | The index of the point to return.

ChainShape:getPoints

Returns all points of the shape.

x1, y1, x2, y2, ...= ChainShape:getPoints()

x1 | number | The x-coordinate of the first point.
y1 | number | The y-coordinate of the first point.
x2 | number | The x-coordinate of the second point.
y2 | number | The y-coordinate of the second point.
... | number | Additional x and y values.

ChainShape:getVertexCount

Returns the number of vertices the shape has.

count= ChainShape:getVertexCount()

count | number | The number of vertices.

ChainShape:setNextVertex

Sets a vertex that establishes a connection to the next shape.
This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.

ChainShape:setNextVertex(x, y)

x | number | The x component of the vertex.
y | number | The y component of the vertex.

ChainShape:setPreviousVertex

Sets a vertex that establishes a connection to the previous shape.
This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.

ChainShape:setPreviousVertex(x, y)

x | number | The x component of the vertex.
y | number | The y component of the vertex.

CircleShape:getPoint

Gets the center point of the circle shape.

x, y= CircleShape:getPoint()

x | number | The x-component of the center point of the circle.
y | number | The y-component of the center point of the circle.

CircleShape:getRadius

Gets the radius of the circle shape.

radius= CircleShape:getRadius()

radius | number | The radius of the circle.

CircleShape:setPoint

Sets the location of the center of the circle shape.

CircleShape:setPoint(x, y)

x | number | The x-component of the new center point of the circle.
y | number | The y-component of the new center point of the circle.

CircleShape:setRadius

Sets the radius of the circle.

CircleShape:setRadius(radius)

radius | number | The radius of the circle.

Contact:getFixtures

Gets the two Fixtures that hold the shapes that are in contact.

fixtureA, fixtureB= Contact:getFixtures()

fixtureA | Fixture | The first Fixture.
fixtureB | Fixture | The second Fixture.

Contact:getFriction

Get the friction between two shapes that are in contact.

friction= Contact:getFriction()

friction | number | The friction of the contact.

Contact:getNormal

Get the normal vector between two shapes that are in contact.
This function returns the coordinates of a unit vector that points from the first shape to the second.

nx, ny= Contact:getNormal()

nx | number | The x component of the normal vector.
ny | number | The y component of the normal vector.

Contact:getPositions

Returns the contact points of the two colliding fixtures. There can be one or two points.

x1, y1, x2, y2= Contact:getPositions()

x1 | number | The x coordinate of the first contact point.
y1 | number | The y coordinate of the first contact point.
x2 | number | The x coordinate of the second contact point.
y2 | number | The y coordinate of the second contact point.

Contact:getRestitution

Get the restitution between two shapes that are in contact.

restitution= Contact:getRestitution()

restitution | number | The restitution between the two shapes.

Contact:isEnabled

Returns whether the contact is enabled. The collision will be ignored if a contact gets disabled in the post solve callback.

enabled= Contact:isEnabled()

enabled | boolean | True if enabled, false otherwise.

Contact:isTouching

Returns whether the two colliding fixtures are touching each other.

touching= Contact:isTouching()

touching | boolean | True if they touch or false if not.

Contact:resetFriction

Resets the contact friction to the mixture value of both fixtures.

Contact:resetFriction()

Contact:resetRestitution

Resets the contact restitution to the mixture value of both fixtures.

Contact:resetRestitution()

Contact:setEnabled

Enables or disables the contact.

Contact:setEnabled(enabled)

enabled | boolean | True to enable or false to disable.

Contact:setFriction

Sets the contact friction.

Contact:setFriction(friction)

friction | number | The contact friction.

Contact:setRestitution

Sets the contact restitution.

Contact:setRestitution(restitution)

restitution | number | The contact restitution.

EdgeShape:getPoints

Returns the local coordinates of the edge points.

x1, y1, x2, y2= EdgeShape:getPoints()

x1 | number | The x component of the first vertex.
y1 | number | The y component of the first vertex.
x2 | number | The x component of the second vertex.
y2 | number | The y component of the second vertex.

DistanceJoint:getDampingRatio

Gets the damping ratio.

ratio= DistanceJoint:getDampingRatio()

ratio | number | The damping ratio.

DistanceJoint:getFrequency

Gets the response speed.

Hz= DistanceJoint:getFrequency()

Hz | number | The response speed.

DistanceJoint:getLength

Gets the equilibrium distance between the two Bodies.

l= DistanceJoint:getLength()

l | number | The length between the two Bodies.

DistanceJoint:setDampingRatio

Sets the damping ratio.

DistanceJoint:setDampingRatio(ratio)

ratio | number | The damping ratio.

DistanceJoint:setFrequency

Sets the response speed.

DistanceJoint:setFrequency(Hz)

Hz | number | The response speed.

DistanceJoint:setLength

Sets the equilibrium distance between the two Bodies.

DistanceJoint:setLength(l)

l | number | The length between the two Bodies.

Fixture:destroy

Destroys the fixture

Fixture:destroy()

Fixture:getBody

Returns the body to which the fixture is attached.

body= Fixture:getBody()

body | Body | The parent body.

Fixture:getBoundingBox

Returns the points of the fixture bounding box. In case the fixture has multiple children a 1-based index can be specified. For example, a fixture will have multiple children with a chain shape.

topLeftX, topLeftY, bottomRightX, bottomRightY= Fixture:getBoundingBox(index)

topLeftX | number | The x position of the top-left point.
topLeftY | number | The y position of the top-left point.
bottomRightX | number | The x position of the bottom-right point.
bottomRightY | number | The y position of the bottom-right point.

index(1) | number | A bounding box of the fixture.

Fixture:getCategory

Returns the categories the fixture belongs to.

category1, category2, ...= Fixture:getCategory()

category1 | number | The first category.
category2 | number | The second category.
... | number | Additional categories.

Fixture:getDensity

Returns the density of the fixture.

density= Fixture:getDensity()

density | number | The fixture density in kilograms per square meter.

Fixture:getFilterData

Returns the filter data of the fixture. Categories and masks are encoded as the bits of a 16-bit integer.

categories, mask, group= Fixture:getFilterData()

categories | number | The categories as an integer from 0 to 65535.
mask | number | The mask as an integer from 0 to 65535.
group | number | The group as an integer from -32768 to 32767.

Fixture:getFriction

Returns the friction of the fixture.

friction= Fixture:getFriction()

friction | number | The fixture friction.

Fixture:getGroupIndex

Returns the group the fixture belongs to. Fixtures with the same group will always collide if the group is positive or never collide if it's negative.The group zero means no group.
The groups range from-32768 to 32767.

group=Fixture:getGroupIndex()

group | number | The group of the fixture.

Fixture:getMask

Returns the category mask of the fixture.

mask1,mask2,...=Fixture:getMask()

mask1 | number | The first category selected by the mask.
mask2 | number | The second category selected by the mask.
... | number | Additional categories selected by the mask.

Fixture:getMassData

Returns the mass,its center and the rotational inertia.

x,y,mass,inertia=Fixture:getMassData()

x | number | The x position of the center of mass.
y | number | The y position of the center of mass.
mass | number | The mass of the fixture.
inertia | number | The rotational inertia.

Fixture:getRestitution

Returns the restitution of the fixture.

restitution=Fixture:getRestitution()

restitution | number | The fixture restitution.

Fixture:getShape

Returns the shape of the fixture.This shape is a reference to the actual data used in the simulation.It's possible to change its values between timesteps.
Do not call any functions on this shape after the parent fixture has been destroyed. This shape will point to an invalid memory address and likely cause crashes if you interact further with it.

shape= Fixture:getShape()

shape | Shape | The fixture's shape.

Fixture:getUserData

Returns the Lua value associated with this fixture.
Use this function in one thread only.

value=Fixture:getUserData()

value | mixed | The Lua value associated with the fixture.

Fixture:isDestroyed

Gets whether the Fixture is destroyed.Destroyed fixtures cannot be used.

destroyed=Fixture:isDestroyed()

destroyed | boolean | Whether the Fixture is destroyed.

Fixture:isSensor

Returns whether the fixture is a sensor.

sensor=Fixture:isSensor()

sensor | boolean | If the fixture is a sensor.

Fixture:rayCast

Casts a ray against the shape of the fixture and returns the surface normal vector and the line position where the ray hit.If the ray missed the shape,nil will be returned.
The ray starts on the first point of the input line and goes towards the second point of the line.The fourth arg is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape,such as a ChainShape,will be ray casted.For ChainShapes,the index of 1 is the first edge on the chain.Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent,you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx,hity=x1+(x2-x1)*fraction,y1+(y2-y1)*fraction

x,y,fraction=Fixture:rayCast(x1,y1,x2,y1,maxFraction,childIndex)

x | number | The x position where the ray intersects with the shape.
y | number | The y position where the ray intersects with the shape.
fraction | number | The position on the input vector where the intersection happened as a number from 0 to 1.

x1 | number | The x position of the ray starting point.
y1 | number | The y position of the ray starting point.
x2 | number | The x position of the ray end point.
y1 | number | The y position of the ray end point.
maxFraction | number | The maximum distance the ray is going to travel as a number from 0 to 1.
childIndex(1) | number | The index of the child the ray gets cast against.

Fixture:setCategory

Sets the categories the fixture belongs to.There can be up to 16 categories represented as a number from 1 to 16.

Fixture:setCategory(category1,category2,...)

category1 | number | The first category.
category2 | number | The second category.
... | number | Additional categories.

Fixture:setDensity

Sets the density of the fixture.Call Body:resetMassData if this needs to take effect immediately.

Fixture:setDensity(density)

density | number | The fixture density in kilograms per square meter.

Fixture:setFilterData

Sets the filter data of the fixture.
Groups,categories,and mask can be used to define the collision behaviour of the fixture.
If two fixtures are in the same group they either always collide if the group is positive,or never collide if it's negative. Is the group zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case.If they do have each others categories selected,the return value of the custom contact filter will be used.They always collide if none was set.
There can be up to 16 categories.Categories and masks are encoded as the bits of a 16-bit integer.

Fixture:setFilterData(categories,mask,group)

categories | number | The categories as an integer from 0 to 65535.
mask | number | The mask as an integer from 0 to 65535.
group | number | The group as an integer from-32768 to 32767.

Fixture:setFriction

Sets the friction of the fixture.

Fixture:setFriction(friction)

friction | number | The fixture friction.

Fixture:setGroupIndex

Sets the group the fixture belongs to.Fixtures with the same group will always collide if the group is positive or never collide if it's negative. The group zero means no group.
The groups range from -32768 to 32767.

Fixture:setGroupIndex(group)

group | number | The group as an integer from -32768 to 32767.

Fixture:setMask

Sets the category mask of the fixture. There can be up to 16 categories represented as a number from 1 to 16.
This fixture will collide with the fixtures that are in the selected categories if the other fixture also has a category of this fixture selected.

Fixture:setMask(mask1, mask2, ...)

mask1 | number | The first category.
mask2 | number | The second category.
... | number | Additional categories.

Fixture:setRestitution

Sets the restitution of the fixture.

Fixture:setRestitution(restitution)

restitution | number | The fixture restitution.

Fixture:setSensor

Sets whether the fixture should act as a sensor.
Sensor do not produce collisions responses, but the begin and end callbacks will still be called for this fixture.

Fixture:setSensor(sensor)

sensor | boolean | The sensor status.

Fixture:setUserData

Associates a Lua value with the fixture.
Use this function in one thread only.

Fixture:setUserData(value)

value | mixed | The Lua value associated with the fixture.

Fixture:testPoint

Checks if a point is inside the shape of the fixture.

isInside= Fixture:testPoint(x, y)

isInside | boolean | True if the point is inside or false if it is outside.

x | number | The x position of the point.
y | number | The y position of the point.

FrictionJoint:getMaxForce

Gets the maximum friction force in Newtons.

force= FrictionJoint:getMaxForce()

force | number | Maximum force in Newtons.

FrictionJoint:getMaxTorque

Gets the maximum friction torque in Newton-meters.

torque= FrictionJoint:getMaxTorque()

torque | number | Maximum torque in Newton-meters.

FrictionJoint:setMaxForce

Sets the maximum friction force in Newtons.

FrictionJoint:setMaxForce(maxForce)

maxForce | number | Max force in Newtons.

FrictionJoint:setMaxTorque

Sets the maximum friction torque in Newton-meters.

FrictionJoint:setMaxTorque(torque)

torque | number | Maximum torque in Newton-meters.

GearJoint:getJoints

Get the Joints connected by this GearJoint.

joint1, joint2= GearJoint:getJoints()

joint1 | Joint | The first connected Joint.
joint2 | Joint | The second connected Joint.

GearJoint:getRatio

Get the ratio of a gear joint.

ratio= GearJoint:getRatio()

ratio | number | The ratio of the joint.

GearJoint:setRatio

Set the ratio of a gear joint.

GearJoint:setRatio(ratio)

ratio | number | The new ratio of the joint.

Joint:destroy

Explicitly destroys the Joint. When you don't have time to wait for garbage collection,this function may be used to free the object immediately,but note that an error will occur if you attempt to use the object after calling this function.

Joint:destroy()

Joint:getAnchors

Get the anchor points of the joint.

x1,y1,x2,y2=Joint:getAnchors()

x1 | number | The x component of the anchor on Body 1.
y1 | number | The y component of the anchor on Body 1.
x2 | number | The x component of the anchor on Body 2.
y2 | number | The y component of the anchor on Body 2.

Joint:getBodies

Gets the bodies that the Joint is attached to.

bodyA,bodyB=Joint:getBodies()

bodyA | Body | The first Body.
bodyB | Body | The second Body.

Joint:getCollideConnected

Gets whether the connected Bodies collide.

c=Joint:getCollideConnected()

c | boolean | True if they collide,false otherwise.

Joint:getReactionForce

Gets the reaction force on Body 2 at the joint anchor.

x,y=Joint:getReactionForce()

x | number | The x component of the force.
y | number | The y component of the force.

Joint:getReactionTorque

Returns the reaction torque on the second body.

torque=Joint:getReactionTorque(invdt)

torque | number | The reaction torque on the second body.

invdt | number | How long the force applies.Usually the inverse time step or 1/dt.

Joint:getType

Gets an string representing the type.

type=Joint:getType()

type | JointType | A string with the name of the Joint type.

Joint:getUserData

Returns the Lua value associated with this Joint.

value=Joint:getUserData()

value | mixed | The Lua value associated with the Joint.

Joint:isDestroyed

Gets whether the Joint is destroyed.Destroyed joints cannot be used.

destroyed=Joint:isDestroyed()

destroyed | boolean | Whether the Joint is destroyed.

Joint:setCollideConnected

Sets whether the connected Bodies should collide with eachother.

Joint:setCollideConnected(collide)

collide | boolean | True for the Bodies to collide,false otherwise.

Joint:setUserData

Associates a Lua value with the Joint.
To delete the reference,explicitly pass nil.

Joint:setUserData(value)

value | mixed | The Lua value to associate with the Joint.

MouseJoint:getDampingRatio

Returns the damping ratio.

ratio=MouseJoint:getDampingRatio()

ratio | number | The new damping ratio.

MouseJoint:getFrequency

Returns the frequency.

freq=MouseJoint:getFrequency()

freq | number | The frequency in hertz.

MouseJoint:getMaxForce

Gets the highest allowed force.

f=MouseJoint:getMaxForce()

f | number | The max allowed force.

MouseJoint:getTarget

Gets the target point.

x,y=MouseJoint:getTarget()

x | number | The x component of the target.
y | number | The x component of the target.

MouseJoint:setDampingRatio

Sets a new damping ratio.

MouseJoint:setDampingRatio(ratio)

ratio | number | The new damping ratio.

MouseJoint:setFrequency

Sets a new frequency.

MouseJoint:setFrequency(freq)

freq | number | The new frequency in hertz.

MouseJoint:setMaxForce

Sets the highest allowed force.

MouseJoint:setMaxForce(f)

f | number | The max allowed force.

MouseJoint:setTarget

Sets the target point.

MouseJoint:setTarget(x,y)

x | number | The x component of the target.
y | number | The y component of the target.

PolygonShape:getPoints

Get the local coordinates of the polygon's vertices.
This function has a variable number of return values. It can be used in a nested fashion with 画多边形.
This function may have up to 16 return values, since it returns two values for each vertex in the polygon. In other words, it can return the coordinates of up to 8 points.

x1, y1, x2, y2, ...= PolygonShape:getPoints()

x1 | number | The x component of the first vertex.
y1 | number | The y component of the first vertex.
x2 | number | The x component of the second vertex.
y2 | number | The y component of the second vertex.
... | number | Additional x and y values.

PrismaticJoint:setLimitsEnabled

Enables or disables the limits of the joint.

PrismaticJoint:setLimitsEnabled(enable)

enable | boolean | True to enable, false to disable.

PrismaticJoint:setMotorEnabled

Starts or stops the joint motor.

PrismaticJoint:setMotorEnabled(enable)

enable | boolean | True to enable, false to disable.

PrismaticJoint:getJointSpeed

Get the current joint angle speed.

s= PrismaticJoint:getJointSpeed()

s | number | Joint angle speed in meters/second.

PrismaticJoint:getJointTranslation

Get the current joint translation.

t= PrismaticJoint:getJointTranslation()

t | number | Joint translation, usually in meters.

PrismaticJoint:getLimits

Gets the joint limits.

lower, upper= PrismaticJoint:getLimits()

lower | number | The lower limit, usually in meters.
upper | number | The upper limit, usually in meters.

PrismaticJoint:getLowerLimit

Gets the lower limit.

lower= PrismaticJoint:getLowerLimit()

lower | number | The lower limit, usually in meters.

PrismaticJoint:getMaxMotorForce

Gets the maximum motor force.

f= PrismaticJoint:getMaxMotorForce()

f | number | The maximum motor force, usually in N.

PrismaticJoint:getMotorForce

Get the current motor force.

f= PrismaticJoint:getMotorForce()

f | number | The current motor force, usually in N.

PrismaticJoint:getMotorSpeed

Gets the motor speed.

s= PrismaticJoint:getMotorSpeed()

s | number | The motor speed, usually in meters per second.

PrismaticJoint:getUpperLimit

Gets the upper limit.

upper= PrismaticJoint:getUpperLimit()

upper | number | The upper limit, usually in meters.

PrismaticJoint:hasLimitsEnabled

Checks whether the limits are enabled.

enabled= PrismaticJoint:hasLimitsEnabled()

enabled | boolean | True if enabled, false otherwise.

PrismaticJoint:isMotorEnabled

Checks whether the motor is enabled.

enabled= PrismaticJoint:isMotorEnabled()

enabled | boolean | True if enabled, false if disabled.

PrismaticJoint:setLimits

Sets the limits.

PrismaticJoint:setLimits(lower, upper)

lower | number | The lower limit, usually in meters.
upper | number | The upper limit, usually in meters.

PrismaticJoint:setLowerLimit

Sets the lower limit.

PrismaticJoint:setLowerLimit(lower)

lower | number | The lower limit, usually in meters.

PrismaticJoint:setMaxMotorForce

Set the maximum motor force.

PrismaticJoint:setMaxMotorForce(f)

f | number | The maximum motor force, usually in N.

PrismaticJoint:setMotorSpeed

Sets the motor speed.

PrismaticJoint:setMotorSpeed(s)

s | number | The motor speed, usually in meters per second.

PrismaticJoint:setUpperLimit

Sets the upper limit.

PrismaticJoint:setUpperLimit(upper)

upper | number | The upper limit, usually in meters.

PulleyJoint:getConstant

Get the total length of the rope.

length= PulleyJoint:getConstant()

length | number | The length of the rope in the joint.

PulleyJoint:getGroundAnchors

Get the ground anchor positions in world coordinates.

a1x, a1y, a2x, a2y= PulleyJoint:getGroundAnchors()

a1x | number | The x coordinate of the first anchor.
a1y | number | The y coordinate of the first anchor.
a2x | number | The x coordinate of the second anchor.
a2y | number | The y coordinate of the second anchor.

PulleyJoint:getLengthA

Get the current length of the rope segment attached to the first body.

length= PulleyJoint:getLengthA()

length | number | The length of the rope segment.

PulleyJoint:getLengthB

Get the current length of the rope segment attached to the second body.

length= PulleyJoint:getLengthB()

length | number | The length of the rope segment.

PulleyJoint:getMaxLengths

Get the maximum lengths of the rope segments.

len1, len2= PulleyJoint:getMaxLengths()

len1 | number | The maximum length of the first rope segment.
len2 | number | The maximum length of the second rope segment.

PulleyJoint:getRatio

Get the pulley ratio.

ratio= PulleyJoint:getRatio()

ratio | number | The pulley ratio of the joint.

PulleyJoint:setConstant

Set the total length of the rope.
Setting a new length for the rope updates the maximum length values of the joint.

PulleyJoint:setConstant(length)

length | number | The new length of the rope in the joint.

PulleyJoint:setMaxLengths

Set the maximum lengths of the rope segments.
The physics module also imposes maximum values for the rope segments. If the parameters exceed these values, the maximum values are set instead of the requested values.

PulleyJoint:setMaxLengths(max1, max2)

max1 | number | The new maximum length of the first segment.
max2 | number | The new maximum length of the second segment.

PulleyJoint:setRatio

Set the pulley ratio.

PulleyJoint:setRatio(ratio)

ratio | number | The new pulley ratio of the joint.

RevoluteJoint:setLimitsEnabled

Enables or disables the joint limits.

RevoluteJoint:setLimitsEnabled(enable)

enable | boolean | True to enable, false to disable.

RevoluteJoint:setMotorEnabled

Starts or stops the joint motor.

RevoluteJoint:setMotorEnabled(enable)

enable | boolean | True to enable, false to disable.

RevoluteJoint:getJointAngle

Get the current joint angle.

angle= RevoluteJoint:getJointAngle()

angle | number | The joint angle in radians.

RevoluteJoint:getJointSpeed

Get the current joint angle speed.

s= RevoluteJoint:getJointSpeed()

s | number | Joint angle speed in radians/second.

RevoluteJoint:getLimits

Gets the joint limits.

lower, upper= RevoluteJoint:getLimits()

lower | number | The lower limit, in radians.
upper | number | The upper limit, in radians.

RevoluteJoint:getLowerLimit

Gets the lower limit.

lower= RevoluteJoint:getLowerLimit()

lower | number | The lower limit, in radians.

RevoluteJoint:getMaxMotorTorque

Gets the maximum motor force.

f= RevoluteJoint:getMaxMotorTorque()

f | number | The maximum motor force, in Nm.

RevoluteJoint:getMotorSpeed

Gets the motor speed.

s= RevoluteJoint:getMotorSpeed()

s | number | The motor speed, radians per second.

RevoluteJoint:getMotorTorque

Get the current motor force.

f= RevoluteJoint:getMotorTorque()

f | number | The current motor force, in Nm.

RevoluteJoint:getUpperLimit

Gets the upper limit.

upper= RevoluteJoint:getUpperLimit()

upper | number | The upper limit, in radians.

RevoluteJoint:hasLimitsEnabled

Checks whether limits are enabled.

enabled= RevoluteJoint:hasLimitsEnabled()

enabled | boolean | True if enabled, false otherwise.

RevoluteJoint:isMotorEnabled

Checks whether the motor is enabled.

enabled= RevoluteJoint:isMotorEnabled()

enabled | boolean | True if enabled, false if disabled.

RevoluteJoint:setLimits

Sets the limits.

RevoluteJoint:setLimits(lower, upper)

lower | number | The lower limit, in radians.
upper | number | The upper limit, in radians.

RevoluteJoint:setLowerLimit

Sets the lower limit.

RevoluteJoint:setLowerLimit(lower)

lower | number | The lower limit, in radians.

RevoluteJoint:setMaxMotorTorque

Set the maximum motor force.

RevoluteJoint:setMaxMotorTorque(f)

f | number | The maximum motor force, in Nm.

RevoluteJoint:setMotorSpeed

Sets the motor speed.

RevoluteJoint:setMotorSpeed(s)

s | number | The motor speed, radians per second.

RevoluteJoint:setUpperLimit

Sets the upper limit.

RevoluteJoint:setUpperLimit(upper)

upper | number | The upper limit, in radians.

RopeJoint:getMaxLength

Gets the maximum length of a RopeJoint.

maxLength= RopeJoint:getMaxLength()

maxLength | number | The maximum length of the RopeJoint.

Shape:computeAABB

Returns the points of the bounding box for the transformed shape.

topLeftX, topLeftY, bottomRightX, bottomRightY= Shape:computeAABB(tx, ty, tr, childIndex)

topLeftX | number | The x position of the top-left point.
topLeftY | number | The y position of the top-left point.
bottomRightX | number | The x position of the bottom-right point.
bottomRightY | number | The y position of the bottom-right point.

tx | number | The translation of the shape on the x-axis.
ty | number | The translation of the shape on the y-axis.
tr | number | The shape rotation.
childIndex(1) | number | The index of the child to compute the bounding box of.

Shape:computeMass

Computes the mass properties for the shape with the specified density.

x, y, mass, inertia= Shape:computeMass(density)

x | number | The x postition of the center of mass.
y | number | The y postition of the center of mass.
mass | number | The mass of the shape.
inertia | number | The rotational inertia.

density | number | The shape density.

Shape:getChildCount

Returns the number of children the shape has.

count= Shape:getChildCount()

count | number | The number of children.

Shape:getRadius

Gets the radius of the shape.

radius= Shape:getRadius()

radius | number | The radius of the shape.

Shape:getType

Gets a string representing the Shape. This function can be useful for conditional debug drawing.

type= Shape:getType()

type | ShapeType | The type of the Shape.

Shape:rayCast

Casts a ray against the shape and returns the surface normal vector and the line position where the ray hit. If the ray missed the shape, nil will be returned. The Shape can be transformed to get it into the desired position.
The ray starts on the first point of the input line and goes towards the second point of the line. The fourth arg is the maximum distance the ray is going to travel as a scale factor of the input line length.
The childIndex parameter is used to specify which child of a parent shape, such as a ChainShape, will be ray casted. For ChainShapes, the index of 1 is the first edge on the chain. Ray casting a parent shape will only test the child specified so if you want to test every shape of the parent, you must loop through all of its children.
The world position of the impact can be calculated by multiplying the line vector with the third return value and adding it to the line starting point.
hitx, hity= x1 + (x2 - x1) * fraction, y1 + (y2 - y1) * fraction

xn, yn, fraction= Shape:rayCast(x1, y1, x2, y2, maxFraction, tx, ty, tr, childIndex)

xn | number | The x component of the normal vector of the edge where the ray hit the shape.
yn | number | The y component of the normal vector of the edge where the ray hit the shape.
fraction | number | The position on the input line where the intersection happened as a factor of the line length.

x1 | number | The x position of the input line starting point.
y1 | number | The y position of the input line starting point.
x2 | number | The x position of the input line end point.
y2 | number | The y position of the input line end point.
maxFraction | number | Ray length parameter.
tx | number | The translation of the shape on the x-axis.
ty | number | The translation of the shape on the y-axis.
tr | number | The shape rotation.
childIndex(1) | number | The index of the child the ray gets cast against.

Shape:testPoint

Checks whether a point lies inside the shape. This is particularly useful for mouse interaction with the shapes. By looping through all shapes and testing the mouse position with this function, we can find which shapes the mouse touches.

hit= Shape:testPoint(x, y)

hit | boolean | True if inside, false if outside

x | number | The x component of the point.
y | number | The y component of the point.

WeldJoint:getDampingRatio

Returns the damping ratio of the joint.

ratio= WeldJoint:getDampingRatio()

ratio | number | The damping ratio.

WeldJoint:getFrequency

Returns the frequency.

freq= WeldJoint:getFrequency()

freq | number | The frequency in hertz.

WeldJoint:setDampingRatio

The new damping ratio.

WeldJoint:setDampingRatio(ratio)

ratio | number | The new damping ratio.

WeldJoint:setFrequency

Sets a new frequency.

WeldJoint:setFrequency(freq)

freq | number | The new frequency in hertz.

WheelJoint:getJointSpeed

Returns the current joint translation speed.

speed= WheelJoint:getJointSpeed()

speed | number | The translation speed of the joint in meters per second.

WheelJoint:getJointTranslation

Returns the current joint translation.

position= WheelJoint:getJointTranslation()

position | number | The translation of the joint in meters.

WheelJoint:getLimits

Gets the joint limits.

lower, upper= WheelJoint:getLimits()

lower | number | The lower limit, usually in meters.
upper | number | The upper limit, usually in meters.

WheelJoint:getMaxMotorTorque

Returns the maximum motor torque.

maxTorque= WheelJoint:getMaxMotorTorque()

maxTorque | number | The maximum torque of the joint motor in newton meters.

WheelJoint:getMotorSpeed

Returns the speed of the motor.

speed= WheelJoint:getMotorSpeed()

speed | number | The speed of the joint motor in radians per second.

WheelJoint:getMotorTorque

Returns the current torque on the motor.

torque= WheelJoint:getMotorTorque(invdt)

torque | number | The torque on the motor in newton meters.

invdt | number | How long the force applies. Usually the inverse time step or 1/dt.

WheelJoint:getSpringDampingRatio

Returns the damping ratio.

ratio= WheelJoint:getSpringDampingRatio()

ratio | number | The damping ratio.

WheelJoint:getSpringFrequency

Returns the spring frequency.

freq= WheelJoint:getSpringFrequency()

freq | number | The frequency in hertz.

WheelJoint:setMaxMotorTorque

Sets a new maximum motor torque.

WheelJoint:setMaxMotorTorque(maxTorque)

maxTorque | number | The new maximum torque for the joint motor in newton meters.

WheelJoint:setMotorEnabled

Starts and stops the joint motor.

WheelJoint:setMotorEnabled(enable)

enable | boolean | True turns the motor on and false turns it off.

WheelJoint:setMotorSpeed

Sets a new speed for the motor.

WheelJoint:setMotorSpeed(speed)

speed | number | The new speed for the joint motor in radians per second.

WheelJoint:setSpringDampingRatio

Sets a new damping ratio.

WheelJoint:setSpringDampingRatio(ratio)

ratio | number | The new damping ratio.

WheelJoint:setSpringFrequency

Sets a new spring frequency.

WheelJoint:setSpringFrequency(freq)

freq | number | The new frequency in hertz.

World:destroy

Destroys the world, taking all bodies, joints, fixtures and their shapes with it.
An error will occur if you attempt to use any of the destroyed objects after calling this function.

World:destroy()

World:getBodyCount

Get the number of bodies in the world.

n= World:getBodyCount()

n | number | The number of bodies in the world.

World:getBodyList

Returns a table with all bodies.

bodies= World:getBodyList()

bodies | table | A sequence with all bodies.

World:getCallbacks

Returns functions for the callbacks during the world update.

beginContact, endContact, preSolve, postSolve= World:getCallbacks()

beginContact | function | Gets called when two fixtures begin to overlap.
endContact | function | Gets called when two fixtures cease to overlap.
preSolve | function | Gets called before a collision gets resolved.
postSolve | function | Gets called after the collision has been resolved.

World:getContactCount

Returns the number of contacts in the world.

n= World:getContactCount()

n | number | The number of contacts in the world.

World:getContactFilter

Returns the function for collision filtering.

contactFilter= World:getContactFilter()

contactFilter | function | The function that handles the contact filtering.

World:getContactList

Returns a table with all contacts.

contacts= World:getContactList()

contacts | table | A sequence with all contacts.

World:getGravity

Get the gravity of the world.

x, y= World:getGravity()

x | number | The x component of gravity.
y | number | The y component of gravity.

World:getJointCount

Get the number of joints in the world.

n= World:getJointCount()

n | number | The number of joints in the world.

World:getJointList

Returns a table with all joints.

joints= World:getJointList()

joints | table | A sequence with all joints.

World:isDestroyed

Gets whether the World is destroyed. Destroyed worlds cannot be used.

destroyed= World:isDestroyed()

destroyed | boolean | Whether the World is destroyed.

World:isLocked

Returns if the world is updating its state.
This will return true inside the callbacks from World:setCallbacks.

locked= World:isLocked()

locked | boolean | Will be true if the world is in the process of updating its state.

World:isSleepingAllowed

Returns the sleep behaviour of the world.

allowSleep= World:isSleepingAllowed()

allowSleep | boolean | True if the bodies are allowed to sleep or false if not.

World:queryBoundingBox

Calls a function for each fixture inside the specified area.

World:queryBoundingBox(topLeftX, topLeftY, bottomRightX, bottomRightY, callback)

topLeftX | number | The x position of the top-left point.
topLeftY | number | The y position of the top-left point.
bottomRightX | number | The x position of the bottom-right point.
bottomRightY | number | The y position of the bottom-right point.
callback | function | This function gets passed one arg, the fixture, and should return a boolean. The search will continue if it is true or stop if it is false.

World:rayCast

Casts a ray and calls a function with the fixtures that intersect it. You cannot make any assumptions about the order of the callbacks.
Each time the function gets called, 6 args get passed to it. The first is the fixture intersecting the ray. The second and third are the coordinates of the intersection point. The fourth and fifth is the surface normal vector of the shape edge. The sixth arg is the position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value).
The ray can be controlled with the return value. A positive value sets a new ray length where 1 is the default value. A value of 0 terminates the ray. If the callback function returns -1, the intersection gets ignored as if it didn't happen.
There is a bug in 0.8.0 where the normal vector passed to the callback function gets scaled by取物理世界单位.

World:rayCast(x1,y1,x2,y2,callback)

x1 | number | The x position of the starting point of the ray.
y1 | number | The y position of the starting point of the ray.
x2 | number | The x position of the end point of the ray.
y2 | number | The y position of the end point of the ray.
callback | function | This function gets six args and should return a number.

World:setCallbacks

Sets functions for the collision callbacks during the world update.
Four Lua functions can be given as args.The value nil removes a function.
When called,each function will be passed three args.The first two args are the colliding fixtures and the third arg is the Contact between them.The PostSolve callback additionally gets the normal and tangent impulse for each contact point.

World:setCallbacks(beginContact,endContact,preSolve,postSolve)

beginContact | function | Gets called when two fixtures begin to overlap.
endContact | function | Gets called when two fixtures cease to overlap.
preSolve | function | Gets called before a collision gets resolved.
postSolve | function | Gets called after the collision has been resolved.

World:setContactFilter

Sets a function for collision filtering.
If the group and category filtering doesn't generate a collision decision, this function gets called with the two fixtures as args. The function should return a boolean value where true means the fixtures will collide and false means they will pass through each other.

World:setContactFilter(filter)

filter | function | The function handling the contact filtering.

World:setGravity

Set the gravity of the world.

World:setGravity(x, y)

x | number | The x component of gravity.
y | number | The y component of gravity.

World:setSleepingAllowed

Set the sleep behaviour of the world.
A sleeping body is much more efficient to simulate than when awake.
If sleeping is allowed, any body that has come to rest will sleep.

World:setSleepingAllowed(allowSleep)

allowSleep | boolean | True if the bodies are allowed to sleep or false if not.

World:translateOrigin

Translates the World's origin.Useful in large worlds where floating point precision issues become noticeable at far distances from the origin.

World:translateOrigin(x,y)

x | number | The x component of the new origin with respect to the old origin.
y | number | The y component of the new origin with respect to the old origin.

World:update

Update the state of the world.

World:update(dt)

dt | number | The time(in seconds)to advance the physics simulation.

BodyType

static

Static bodies do not move.

dynamic

Dynamic bodies collide with all bodies.

kinematic

Kinematic bodies only collide with dynamic bodies.

JointType

distance

A DistanceJoint.

gear

A GearJoint.

mouse

A MouseJoint.

prismatic

A PrismaticJoint.

pulley

A PulleyJoint.

revolute

A RevoluteJoint.

friction

A FrictionJoint.

weld

A WeldJoint.

rope

A RopeJoint.

ShapeType

circle

The Shape is a CircleShape.

polygon

The Shape is a PolygonShape.

edge

The Shape is a EdgeShape.

chain

The Shape is a ChainShape.

音频操作love.sound

创建解码器

Attempts to find a decoder for the encoded sound data in the specified file.

decoder=创建解码器(file,buffer)

decoder | Decoder | A new Decoder object.

file | File | The file with encoded sound data.
buffer(2048) | number | The size of each decoded chunk,in bytes.

decoder=创建解码器(filename,buffer)

decoder | Decoder | A new Decoder object.

filename | string | The filename of the file with encoded sound data.
buffer(2048) | number | The size of each decoded chunk,in bytes.

创建声音数据

Creates new SoundData from a file.It's also possible to create SoundData with a custom sample rate, channel and bit depth.
The sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way.

soundData= 创建声音数据(filename)

soundData | SoundData | A new SoundData object.

filename | string | The filename of the file to load.

soundData= 创建声音数据(file)

soundData | SoundData | A new SoundData object.

file | File | A File pointing to an audio file.

soundData= 创建声音数据(data)

soundData | SoundData | A new SoundData object.

data | Data | The encoded data to decode into audio.

soundData= 创建声音数据(samples, rate, bits, channels)

soundData | SoundData | A new SoundData object.

samples | number | Total number of samples.
rate(44100) | number | Number of samples per second
bits(16) | number | Bits per sample (8 or 16).
channels(2) | number | Either 1 for mono or 2 for stereo.

Decoder:getBitDepth

Returns the number of bits per sample.

bitDepth= Decoder:getBitDepth()

bitDepth | number | Either 8 or 16.

Decoder:getChannels

Returns the number of channels in the stream.

channels= Decoder:getChannels()

channels | number | 1 for mono, 2 for stereo.

Decoder:getDuration

Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all.

duration= Decoder:getDuration()

duration | number | The duration of the sound file in seconds, or -1 if it cannot be determined.

Decoder:getSampleRate

Returns the sample rate of the Decoder.

rate= Decoder:getSampleRate()

rate | number | Number of samples per second.

SoundData:getBitDepth

Returns the number of bits per sample.

bits= SoundData:getBitDepth()

bits | number | Either 8 or 16.

SoundData:getChannels

Returns the number of channels in the stream.

channels= SoundData:getChannels()

channels | number | 1 for mono, 2 for stereo.

SoundData:getDuration

Returns the number of channels in the stream.

duration= SoundData:getDuration()

duration | number | The duration of the sound data in seconds.

SoundData:getSample

Gets the sample at the specified position.

sample= SoundData:getSample(i)

sample | number | The normalized sample (range -1.0 to 1.0).

i | number | The position of the sample (0 means first sample).

SoundData:getSampleCount

Returns the sample count of the SoundData.

count= SoundData:getSampleCount()

count | number | Total number of samples.

SoundData:getSampleRate

Returns the sample rate of the SoundData.

rate= SoundData:getSampleRate()

rate | number | Number of samples per second.

SoundData:setSample

Sets the sample at the specified position.

SoundData:setSample(i, sample)

i | number | The position of the sample (0 means first sample).
sample | number | A normalized sample (range -1.0 to 1.0).

系统操作 love.system

取剪辑板

Gets text from the clipboard.

text= 取剪辑板()

text | string | The text currently held in the system's clipboard.

CurrentOs

The current operating system."OS X","Windows","Linux","Android"or"iOS".

取电池状态

Gets information about the system's power supply.

state, percent, seconds= 取电池状态()

state | PowerState | The basic state of the power supply.
percent | number | Percentage of battery life left, between 0 and 100. nil if the value can't be determined or there's no battery.
seconds | number | Seconds of battery life left. nil if the value can't be determined or there's no battery.

取处理器核心数

Gets the number of CPU cores in the system.
The number includes the threads reported if technologies such as Intel's Hyper-threading are enabled.For example,on a 4-core CPU with Hyper-threading,this function will return 8.

cores=取处理器核心数()

cores | number | Gets the number of CPU cores in the system.

打开网址

Opens a URL with the user's web or file browser.

success= 打开网址(url)

success | boolean | Whether the URL was opened successfully.

url | string | The URL to open. Must be formatted as a proper URL. To open a file or folder, "file://" must be prepended to the path.

置剪辑板

Puts text in the clipboard.

置剪辑板(text)

text | string | The new text to hold in the system's clipboard.

手机振动

Causes the device to vibrate,if possible.Currently this will only work on Android and iOS devices that have a built-in vibration motor.

手机振动(seconds)

seconds(0.5) | number | The duration to vibrate for.If called on an iOS device,it will always vibrate for 0.5 seconds due to limitations in the iOS system APIs.

PowerState

unknown

Cannot determine power status.

battery

Not plugged in,running on a battery.

nobattery

Plugged in,no battery available.

charging

Plugged in,charging battery.

charged

Plugged in,battery is fully charged.

线程操作love.thread

取通道

Creates or retrieves a named thread channel.

channel=取通道(name)

channel | Channel | A named channel object which can be further manipulated.

name | string | The name of the channel you want to create or retrieve.

创建通道

Create a new unnamed thread channel.
One use for them is to pass new unnamed channels to other threads via Channel:push

channel=创建通道()

channel | Channel | A unnamed channel object which can be further manipulated.

创建线程

Creates a new Thread from a File or Data object.

thread=创建线程(filename)

thread | Thread | A new Thread that has yet to be started.

filename | string | The name of the Lua File to use as source.

thread=创建线程(fileData)

thread | Thread | A new Thread that has yet to be started.

fileData | FileData | The FileData containing the Lua code to use as the source.

thread=创建线程(codestring)

thread | Thread | A new Thread that has yet to be started.

codestring | string | A string containing the Lua code to use as the source.It needs to either be at least 1024 characters long,or contain at least one newline.

Thread:getError

Retrieves the error string from the thread if it produced an error.

message=Thread:getError()

message | string | The error message.

Thread:start

Starts the thread.
Threads can be restarted after they have completed their execution.

Thread:start()

Thread:start(arg1,arg2,...)

arg1 | value | A string,number,boolean,LOVE object,or simple table.
arg2 | value | A string,number,boolean,LOVE object,or simple table.
... | value | You can continue passing values to the thread.

Thread:wait

Wait for a thread to finish.This call will block until the thread finishes.

Thread:wait()

Thread:isRunning

Returns whether the thread is currently running.
Threads which are not running can be(re)started with Thread:start.

running=Thread:isRunning()

running | boolean | True if the thread is running,false otherwise.

Channel:clear

Clears all the messages in the Channel queue.

Channel:clear()

Channel:demand

Retrieves the value of a Channel message and removes it from the message queue.
The value of the message can be a boolean,string,number,LOVE userdata,or a simple flat table.It waits until a message is in the queue then returns the message value.

value=Channel:demand()

value | value | The contents of the message.

Channel:getCount

Retrieves the number of messages in the thread Channel queue.

count=Channel:getCount()

count | number | The number of messages in the queue.

Channel:peek

Retrieves the value of a Channel message,but leaves it in the queue.
The value of the message can be a boolean,string,number or a LOVE userdata.It returns nil if there's no message in the queue.

value= Channel:peek()

value | value | The contents of the message.

Channel:performAtomic

Executes the specified function atomically with respect to this Channel.
Calling multiple methods in a row on the same Channel is often useful. However if multiple Threads are calling this Channel's methods at the same time,the different calls on each Thread might end up interleaved(e.g.one or more of the second thread's calls may happen in between the first thread's calls.)
This method avoids that issue by making sure the Thread calling the method has exclusive access to the Channel until the specified function has returned.

ret1,...=Channel:performAtomic(func,arg1,...)

ret1 | any | The first return value of the given function(if any.)
... | any | Any other return values.

func | function | The function to call,the form of function(channel,arg1,arg2,...)end.The Channel is passed as the first arg to the function when it is called.
arg1 | any | Additional args that the given function will receive when it is called.
... | any | Additional args that the given function will receive when it is called.

Channel:pop

Retrieves the value of a Channel message and removes it from the message queue.
The value of the message can be a boolean,string,number,LOVE userdata,or a simple flat table.It returns nil if there are no messages in the queue.

value=Channel:pop()

value | value | The contents of the message.

Channel:push

Send a message to the thread Channel.
The value of the message can be a boolean,string,number,LOVE userdata,or a simple flat table.Foreign userdata(Lua's files, LuaSocket, ENet, ...), functions, and tables inside tables are not supported.

Channel:push(value)

value | value | The contents of the message.

Channel:supply

Send a message to the thread Channel and wait for a thread to accept it.
The value of the message can be a boolean, string, number, LOVE userdata, or a simple flat table. Foreign userdata (Lua's files,LuaSocket,ENet,...),functions,and tables inside tables are not supported.

Channel:supply(value)

value | value | The contents of the message.

时间计算love.timer

取平均帧耗时

Returns the average delta time(seconds per frame)over the last second.

delta=取平均帧耗时()

delta | number | The average delta time over the last second.

取最后帧时间

Returns the time between the last two frames.

dt=取最后帧时间()

dt | number | The time passed(in seconds).

取帧率

Returns the current frames per second.

fps=取帧率()

fps | number | The current FPS.

取运行时间

Returns the value of a timer with an unspecified starting time.This function should only be used to calculate differences between points in time,as the starting time of the timer is unknown.

time=取运行时间()

time | number | The time in seconds.

延时

Sleeps the program for the specified amount of time.

延时(s)

s | number | Seconds to sleep for.

触屏操作love.touch

取触屏位置

Gets the current position of the specified touch-press,in pixels.

x,y=取触屏位置(id)

x | number | The position along the x-axis of the touch-press inside the window,in pixels.
y | number | The position along the y-axis of the touch-press inside the window,in pixels.

id | light userdata | The identifier of the touch-press.Use取活动触屏,触屏按下,or触屏移动to obtain touch id values.

取按下触屏

Gets the current pressure of the specified touch-press.

pressure=取按下触屏(id)

pressure | number | The pressure of the touch-press.Most touch screens aren't pressure sensitive, in which case the pressure will be 1.

id | light userdata | The identifier of the touch-press. Use 取活动触屏, 触屏按下, or 触屏移动 to obtain touch id values.

取活动触屏

Gets a list of all active touch-presses.

touches= 取活动触屏()

touches | table | A list of active touch-press id values, which can be used with 取触屏位置.

视频操作 love.video

窗口操作love.window

取窗口密度

Converts a number from pixels to density-independent units.
The pixel density inside the window might be greater(or smaller)than the"size"of the window.For example on a retina screen in Mac OS X with the highdpi window flag enabled,the window may take up the same physical size as an 800x600 window,but the area inside the window uses 1600x1200 pixels.取窗口密度(1600)would return 800 in that case.
This function converts coordinates from pixels to the size users are expecting them to display at onscreen.窗口置密度does the opposite.The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS.The flag currently does nothing on Windows and Linux,and on Android it is effectively always enabled.
Most LOVE functions return values and expect args in terms of pixels rather than density-independent units.

value=取窗口密度(pixelvalue)

value | number | The converted number,in density-independent units.

pixelvalue | number | A number in pixels to convert to density-independent units.

x,y=取窗口密度(px,py)

x | number | The converted x-axis value of the coordinate,in density-independent units.
y | number | The converted y-axis value of the coordinate,in density-independent units.

px | number | The x-axis value of a coordinate in pixels.
py | number | The y-axis value of a coordinate in pixels.

取显示器名

Gets the name of a display.

name=取显示器名(displayindex)

name | string | The name of the specified display.

displayindex | number | The index of the display to get the name of.

是否全屏

Gets whether the window is fullscreen.

fullscreen,fstype=是否全屏()

fullscreen | boolean | True if the window is fullscreen,false otherwise.
fstype | FullscreenType | The type of fullscreen mode used.

是否全屏Modes

Gets a list of supported fullscreen modes.

modes=是否全屏Modes(display)

modes | table | A table of width/height pairs.(Note that this may not be in order.)

display(1) | number | The index of the display,if multiple monitors are available.

取窗口信息

Returns the current display mode.

width,height,flags=取窗口信息()

width | number | Window width.
height | number | Window height.
flags | table | Table containing the window properties.

flags.fullscreen | boolean | Fullscreen(true),or windowed(false).
flags.fullscreentype | FullscreenType | The type of fullscreen mode used.
flags.vsync | boolean | True if the graphics framerate is synchronized with the monitor's refresh rate, false otherwise.
flags.msaa | number | The number of antialiasing samples used (0 if MSAA is disabled).
flags.resizable | boolean | True if the window is resizable in windowed mode, false otherwise.
flags.borderless | boolean | True if the window is borderless in windowed mode, false otherwise.
flags.centered | boolean | True if the window is centered in windowed mode, false otherwise.
flags.display | number | The index of the display the window is currently in, if multiple monitors are available.
flags.minwidth | number | The minimum width of the window, if it's resizable.
flags.minheight | number | The minimum height of the window,if it's resizable.
flags.highdpi | boolean | True if high-dpi mode should be used on Retina displays in OS X and iOS. Does nothing on non-Retina displays. Added in 0.9.1.
flags.refreshrate | number | The refresh rate of the screen's current display mode,in Hz.May be 0 if the value can't be determined.
flags.x | number | The x-coordinate of the window's position in its current display.
flags.y | number | The y-coordinate of the window's position in its current display.

取窗口缩放

Gets the DPI scale factor associated with the window.
The pixel density inside the window might be greater (or smaller) than the "size" of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. 取窗口缩放() would return 2.0 in that case.
The 取窗口密度 and 窗口置密度 functions can also be used to convert between units.
The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.

scale= 取窗口缩放()

scale | number | The pixel scale factor associated with the window.

取窗口位置

Gets the position of the window on the screen.
The window position is in the coordinate space of the display it is currently in.

x, y, display= 取窗口位置()

x | number | The x-coordinate of the window's position.
y | number | The y-coordinate of the window's position.
display | number | The index of the display that the window is in.

取窗口标题

Gets the window title.

title= 取窗口标题()

title | string | The current window title.

是否有焦点

Checks if the game window has keyboard focus.

focus= 是否有焦点()

窗口获得焦点 | boolean | True if the window has the focus or false if not.

是否有鼠标

Checks if the game window has mouse focus.

focus= 是否有鼠标()

窗口获得焦点 | boolean | True if the window has mouse focus or false if not.

取显示器睡眠

Gets whether the display is allowed to sleep while the program is running.
Display sleep is disabled by default. Some types of input (e.g. joystick button presses) might not prevent the display from sleeping, if display sleep is allowed.

enabled= 取显示器睡眠()

enabled | boolean | True if system display sleep is enabled / allowed, false otherwise.

是否可视

Checks if the game window is visible.
The window is considered visible if it's not minimized and the program isn't hidden.

visible= 是否可视()

窗口可视状态 | boolean | True if the window is visible or false if not.

最大化

Makes the window as large as possible.
This function has no effect if the window isn't resizable,since it essentially programmatically presses the window's "maximize" button.

最大化()

最小化

Minimizes the window to the system's task bar/dock.

最小化()

激活

Causes the window to request the attention of the user if it is not in the foreground.
In Windows the taskbar icon will flash,and in OS X the dock icon will bounce.

激活(continuous)

continuous(false) | boolean | Whether to continuously request attention until the window becomes active,or to do it only once.

置显示器睡眠

Sets whether the display is allowed to sleep while the program is running.
Display sleep is disabled by default.Some types of input(e.g.joystick button presses)might not prevent the display from sleeping,if display sleep is allowed.

置显示器睡眠(enable)

enable | boolean | True to enable system display sleep,false to disable it.

置全屏

Enters or exits fullscreen.The display to use when entering fullscreen is chosen based on which display the window is currently in,if multiple monitors are connected.
If fullscreen mode is entered and the window size doesn't match one of the monitor's display modes(in normal fullscreen mode)or the window size doesn't match the desktop size (in 'desktop' fullscreen mode), the window will be resized appropriately. The window will revert back to its original size again when fullscreen mode is exited using this function.

success= 置全屏(fullscreen)

success | boolean | True if successful, false otherwise.

fullscreen | boolean | Whether to enter or exit fullscreen mode.

success= 置全屏(fullscreen, fstype)

success | boolean | True if successful, false otherwise.

fullscreen | boolean | Whether to enter or exit fullscreen mode.
fstype | FullscreenType | The type of fullscreen mode to use.

窗口置信息

Sets the display mode and properties of the window.
If width or height is 0, setMode will use the width and height of the desktop.
Changing the display mode may have side effects: for example, canvases will be cleared and values sent to shaders with Shader:send will be erased. Make sure to save the contents of canvases beforehand or re-draw to them afterward if you need to.

success= 窗口置信息(width, height, flags)

success | boolean | True if successful, false otherwise.

width | number | Display width.
height | number | Display height.
flags | table | The flags table with the options:

flags.fullscreen(false) | boolean | Fullscreen (true), or windowed (false).
flags.fullscreentype("desktop") | FullscreenType | The type of fullscreen to use.
flags.vsync(true) | boolean | True if LOVE should wait for vsync, false otherwise.
flags.msaa(0) | number | The number of antialiasing samples.
flags.resizable(false) | boolean | True if the window should be resizable in windowed mode, false otherwise.
flags.borderless(false) | boolean | True if the window should be borderless in windowed mode, false otherwise.
flags.centered(true) | boolean | True if the window should be centered in windowed mode, false otherwise.
flags.display(1) | number | The index of the display to show the window in, if multiple monitors are available.
flags.minwidth(1) | number | The minimum width of the window, if it's resizable.Cannot be less than 1.
flags.minheight(1) | number | The minimum height of the window,if it's resizable. Cannot be less than 1.
flags.highdpi(false) | boolean | True if high-dpi mode should be used on Retina displays in OS X. Does nothing on non-Retina displays.
flags.x(nil) | number | The x-coordinate of the window's position in the specified display.
flags.y(nil) | number | The y-coordinate of the window's position in the specified display.

窗口置位置

Sets the position of the window on the screen.
The window position is in the coordinate space of the specified display.

窗口置位置(x, y, display)

x | number | The x-coordinate of the window's position.
y | number | The y-coordinate of the window's position.
display | number | The index of the display that the new window position is relative to.

窗口置标题

Sets the window title.

窗口置标题(title)

title | string | The new window title.

信息框

Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons.

success= 信息框(title, message, type, attachtowindow)

success | boolean | Whether the message box was successfully displayed.

title | string | The title of the message box.
message | string | The text inside the message box.
type("info") | MessageBoxType | The type of the message box.
attachtowindow(true) | boolean | Whether the message box should be attached to the love window or free-floating.

pressedbutton= 信息框(title, message, buttonlist, type, attachtowindow)

pressedbutton | number | The index of the button pressed by the user. May be 0 if the message box dialog was closed without pressing a button.

title | string | The title of the message box.
message | string | The text inside the message box.
buttonlist | table | A table containing a list of button names to show. The table can also contain the fields enterbutton and escapebutton, which should be the index of the default button to use when the user presses 'enter' or 'escape',respectively.
type("info") | MessageBoxType | The type of the message box.
attachtowindow(true) | boolean | Whether the message box should be attached to the love window or free-floating.

窗口置密度

Converts a number from density-independent units to pixels.
The pixel density inside the window might be greater(or smaller)than the"size"of the window.For example on a retina screen in Mac OS X with the highdpi window flag enabled,the window may take up the same physical size as an 800x600 window,but the area inside the window uses 1600x1200 pixels.窗口置密度(800)would return 1600 in that case.
This is used to convert coordinates from the size users are expecting them to display at onscreen to pixels.取窗口密度does the opposite.The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS.The flag currently does nothing on Windows and Linux,and on Android it is effectively always enabled.
Most LOVE functions return values and expect args in terms of pixels rather than density-independent units.

pixelvalue=窗口置密度(value)

pixelvalue | number | The converted number,in pixels.

value | number | A number in density-independent units to convert to pixels.

px,py=窗口置密度(x,y)

px | number | The converted x-axis value of the coordinate,in pixels.
py | number | The converted y-axis value of the coordinate,in pixels.

x | number | The x-axis value of a coordinate in density-independent units to convert to pixels.
y | number | The y-axis value of a coordinate in density-independent units to convert to pixels.

FullscreenType

desktop

Sometimes known as borderless fullscreen windowed mode.A borderless screen-sized window is created which sits on top of all desktop UI elements.The window is automatically resized to match the dimensions of the desktop,and its size cannot be changed.

exclusive

Standard exclusive-fullscreen mode.Changes the display mode(actual resolution)of the monitor.

MessageBoxType

info

Informational dialog.

warning

Warning dialog.

error

Error dialog.