Difference between revisions of "love (简体中文)"
(→Third-party modules(第三方模块)) |
|||
Line 52: | Line 52: | ||
== Functions(方法) == | == Functions(方法) == | ||
− | {{#ask: [[Category:Functions]] [[parent::love]] [[Concept:Current]] | + | {{#ask: [[Category:Functions]] [[parent::love (简体中文)]] [[Concept:Current]] |
| headers=hide | | headers=hide | ||
| format=template | | format=template | ||
Line 64: | Line 64: | ||
== Types(类型) == | == Types(类型) == | ||
− | {{#ask: [[Category:Types]] [[parent::love]] [[Concept:Current]] | + | {{#ask: [[Category:Types]] [[parent::love (简体中文)]] [[Concept:Current]] |
| headers=hide | | headers=hide | ||
| format=template | | format=template | ||
Line 77: | Line 77: | ||
== Callbacks(回调) == | == Callbacks(回调) == | ||
=== General(通用) === | === General(通用) === | ||
− | {{#ask: [[Category:Callbacks]] [[Subcategory::General]] [[parent::love]] [[Concept:Current]] | + | {{#ask: [[Category:Callbacks]] [[Subcategory::General]] [[parent::love (简体中文)]] [[Concept:Current]] |
| headers=hide | | headers=hide | ||
| format=template | | format=template | ||
Line 89: | Line 89: | ||
=== Joystick(操作杆) === | === Joystick(操作杆) === | ||
− | {{#ask: [[Category:Callbacks]] [[Subcategory::Joystick]] [[parent::love]] [[Concept:Current]] | + | {{#ask: [[Category:Callbacks]] [[Subcategory::Joystick]] [[parent::love (简体中文)]] [[Concept:Current]] |
| headers=hide | | headers=hide | ||
| format=template | | format=template |
Revision as of 09:24, 14 April 2016
当你开始用LÖVE编写游戏时, 需要了解几个最重要的API回调函数: love.load仅执行一次,用于初始化加载你的游戏, love.update用于管理你的游戏每一帧的状态, love.draw用于渲染你的游戏到屏幕.
为了处理玩家输入的信息以及呈现一个全方面体验的游戏,很多交互将会重写额外的回调函数.
LÖVE提供了默认的空回调函数,你可以通过对应的回调函数名在你自己的代码里重写这些函数:
-- 初始化矩形的一些默认值.
function love.load()
x, y, w, h = 20, 20, 60, 20
end
-- 每一帧变大矩形的尺寸.
function love.update(dt)
w = w + 1
h = h + 1
end
-- 渲染颜色矩形.
function love.draw()
love.graphics.setColor(0, 100, 100)
love.graphics.rectangle("fill", x, y, w, h)
end
Contents
Modules(模块)
love.audio (简体中文) | 提供一个用来创建音效的接口. | ||
love.filesystem (简体中文) | Provides an interface to the user's filesystem. | ||
love.font (简体中文) | 有了这个就可以用字体啦. | 0.7.0 | |
love.graphics (简体中文) | 绘制图形图片,管理屏幕显示. | ||
love.image (简体中文) | 为图像数据提供接口 | ||
love.keyboard (简体中文) | Provides an interface to the user's keyboard. | ||
love.mouse (简体中文) | 提供鼠标接口的模块. | ||
love.physics (简体中文) | 能够真实地模拟2D刚体的物理性质。 | 0.4.0 | |
love.sound (简体中文) | This module is responsible for decoding sound files. | ||
love.thread (简体中文) | Allows you to work with threads. | 0.7.0 |
Third-party modules(第三方模块)
Functions(方法)
love.getVersion (简体中文) | 获取当前 LÖVE 版本号。 | 0.9.1 |
Types(类型)
Data (简体中文) | The superclass of all data. | ||
Object (简体中文) | The superclass of all LÖVE types. |
Callbacks(回调)
General(通用)
Config Files (简体中文) | Game configuration settings. |
Joystick(操作杆)
其他语言
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info