Views
love.graphics (简体中文)
The primary responsibility for the love.graphics module is the drawing of lines, shapes, text, Images and other Drawable objects onto the screen. Its secondary responsibilities include loading external files (including Images and Fonts) into memory, creating specialized objects (such as ParticleSystems or Framebuffers) and managing screen geometry.
love.graphics模块的主要功能是绘制图像(文字、形状、线、图片Image、其他Drawable)到屏幕上。次要功能是将外部文件(图片Image、字体Font)加载到内存中。建立专门的对象进行管理(比如ParticleSystem、Framebuffer)。
LÖVE's coordinate system is rooted in the upper-left corner of the screen, which is at location (0, 0). The x axis is horizontal: larger values are further to the right. The y axis is vertical: larger values are further towards the bottom.
LÖVE的坐标系统如下图所示,以左上角为原点,横向延伸为X轴,纵向延伸为Y轴。
In many cases, you draw images or shapes in terms of their upper-left corner (See the picture above).
在许多情况下,你绘制的图片和图形都是以它们的左上角为起点。 (如上图)
Many of the functions are used to manipulate the graphics coordinate system, which is essentially the the way coordinates are mapped to the display. You can change the position, scale, and even rotation in this way.
我们提供许多函数来用于操作“图形坐标系统”,坐标系统是图像显示的本质。通过操作坐标,你可以改变位置、大小、甚至旋转。
Types
Canvas | Off-screen render target. |
Drawable | Superclass for all things that can be drawn on screen. |
Font | Defines the shape of characters than can be drawn onto the screen. |
Framebuffer | Off-screen render target. |
Image | Drawable image type. |
Mesh | A 2D polygon mesh used for drawing arbitrary textured shapes. |
ParticleSystem | Used to create cool effects, like fire. |
PixelEffect | Pixel shader effect. |
Quad | A quadrilateral with texture coordinate information. |
Shader | Shader effect. |
SpriteBatch | Store image positions in a buffer, and draw it in one call. |
Texture | Superclass for drawable objects which represent a texture. |
Functions
Drawing
love.graphics.arc (简体中文) | Draws an arc.绘制一段弧. | 0.8.0 | |
love.graphics.checkMode (简体中文) | Checks if a display mode is supported.检查是否支持这种显示模式. | ||
love.graphics.circle (简体中文) | Draws a circle.绘制一个圆形. | ||
love.graphics.draw (简体中文) | Draws objects on screen.在屏幕上绘制物件。 | ||
love.graphics.printf (简体中文) | Draws text on screen. If no Font is set, one will be created and set (once) if needed.绘制格式化过的文本,可折行显示、对齐。 |
Object Creation
love.graphics.newCanvas | 创建一个新的画布 |
love.graphics.newFont | 加载一个新的字体 |
love.graphics.newFramebuffer | 创建一个新的帧缓冲区 |
love.graphics.newImage | 加载一个新的图像 |
love.graphics.newImageFont | 通过加载一个特定格式的图像创建一个新的字体 |
love.graphics.newParticleSystem | 创建一个新的粒子系统.好帅的哦! |
love.graphics.newPixelEffect | 创建一个新的PixelEffect,像素影响力?囧 |
love.graphics.newQuad | 创建一个新的批发小图~ |
love.graphics.newScreenshot | 创建一个截图并返回数据,好东东. |
love.graphics.newSpriteBatch | 创建一个新的精灵组.╮(╯_╰)╭不懂 |
love.graphics.newStencil | 创建一个新的模板 |
love.graphics.setNewFont | 创建并设置一个新的字体 |
Graphics State
love.graphics.getBackgroundColor | Gets the current background color. | ||
love.graphics.getBlendMode | Gets the blending mode. | 0.2.0 | |
love.graphics.getCanvas | Returns the current target Canvas. | 0.8.0 | |
love.graphics.getColor | Gets the current color. | ||
love.graphics.getColorMask | Gets the active color components used when drawing. | 0.9.0 | |
love.graphics.getColorMode | Gets the color mode (which controls how images are affected by the current color). | 0.2.0 | 0.9.0 |
love.graphics.getDefaultFilter | Returns the default scaling filters used with Images, Canvases, and Fonts. | 0.9.0 | |
love.graphics.getDefaultImageFilter | Returns the default scaling filters. | 0.8.0 | 0.9.0 |
love.graphics.getFont | Gets the current Font object. | ||
love.graphics.getLineJoin | Gets the line join style. | ||
love.graphics.getLineStipple | Gets the current line stipple. | 0.8.0 | |
love.graphics.getLineStyle | Gets the line style. | ||
love.graphics.getLineWidth | Gets the current line width. | ||
love.graphics.getMaxImageSize | Gets the max supported width or height of Images and Canvases. | 0.9.0 | |
love.graphics.getMaxPointSize | Gets the max supported point size. | ||
love.graphics.getPixelEffect | Returns the current PixelEffect. | 0.8.0 | 0.9.0 |
love.graphics.getPointSize | Gets the point size. | ||
love.graphics.getPointStyle | Gets the current point style. | ||
love.graphics.getRendererInfo | Gets information about the system's video card and drivers. | 0.9.0 | |
love.graphics.getScissor | Gets the current scissor box. | 0.4.0 | |
love.graphics.getShader | Gets the current Shader. | 0.9.0 | |
love.graphics.getSystemLimit | Gets the system-dependent maximum value for a love.graphics feature. | 0.9.1 | |
love.graphics.isSupported | Checks for the support of graphics related functions. | 0.8.0 | |
love.graphics.isWireframe | Gets whether wireframe mode is used when drawing. | 0.9.1 | |
love.graphics.reset | Resets the current graphics settings. | ||
love.graphics.setBackgroundColor | Sets the background color. | ||
love.graphics.setBlendMode | Sets the blending mode. | 0.2.0 | |
love.graphics.setCanvas | Captures drawing operations to a Canvas | 0.8.0 | |
love.graphics.setColor | Sets the color used for drawing. | ||
love.graphics.setColorMask | Sets the color mask. Enables or disables specific color components when rendering. | 0.9.0 | |
love.graphics.setColorMode | Sets the color mode (which controls how images are affected by the current color). | 0.2.0 | 0.9.0 |
love.graphics.setDefaultFilter | Sets the default scaling filters used with Images, Canvases, and Fonts. | 0.9.0 | |
love.graphics.setDefaultImageFilter | Sets the default scaling filters. | 0.8.0 | 0.9.0 |
love.graphics.setFont | Set an already-loaded Font as the current font. | ||
love.graphics.setInvertedStencil | Defines an inverted stencil. | 0.8.0 | |
love.graphics.setLine | Sets the line width and style. | 0.9.0 | |
love.graphics.setLineJoin | Sets the line join style. | ||
love.graphics.setLineStipple | Sets the line stipple pattern. | 0.8.0 | |
love.graphics.setLineStyle | Sets the line style. | ||
love.graphics.setLineWidth | Sets the line width. | ||
love.graphics.setPixelEffect | Routes drawing operations through a pixel shader. | 0.8.0 | 0.9.0 |
love.graphics.setPoint | Sets the point size and style. | 0.9.0 | |
love.graphics.setPointSize | Sets the point size. | ||
love.graphics.setPointStyle | Sets the point style. | ||
love.graphics.setRenderTarget | Captures drawing operations to a Framebuffer | 0.7.0 | 0.8.0 |
love.graphics.setScissor | Sets or disables scissor. | 0.4.0 | |
love.graphics.setShader | Routes drawing operations through a shader. | 0.9.0 | |
love.graphics.setStencil | Defines or releases a stencil. | 0.8.0 | |
love.graphics.setWireframe | Sets whether wireframe lines will be used when drawing. | 0.9.1 |
Coordinate System
love.graphics.origin | Resets the current coordinate transformation. | 0.9.0 | |
love.graphics.pop | Pops the current coordinate transformation from the transformation stack. | ||
love.graphics.push | Copies and pushes the current coordinate transformation to the transformation stack. | ||
love.graphics.rotate | Rotates the coordinate system in two dimensions. | ||
love.graphics.scale | Scales the coordinate system in two dimensions. | ||
love.graphics.shear | Shears the coordinate system. | 0.8.0 | |
love.graphics.translate | Translates the coordinate system in two dimensions. |
Window
love.graphics.checkMode | Checks if a display mode is supported. | 0.9.0 | |
love.graphics.getCaption | Gets the window caption. | 0.9.0 | |
love.graphics.getDimensions | Gets the width and height of the window. | 0.9.0 | |
love.graphics.getHeight | Gets the height in pixels of the window. | 0.2.1 | |
love.graphics.getMode | Returns the current display mode. | 0.8.0 | 0.9.0 |
love.graphics.getModes | Gets a list of supported fullscreen modes. | 0.9.0 | |
love.graphics.getWidth | Gets the width in pixels of the window. | 0.2.1 | |
love.graphics.hasFocus | Checks if the game window has keyboard focus. | 0.8.0 | 0.9.0 |
love.graphics.isCreated | Checks if the display has been set. | 0.9.0 | |
love.graphics.setCaption | Sets the window caption. | 0.9.0 | |
love.graphics.setIcon | Set window icon. | 0.7.0 | 0.9.0 |
love.graphics.setMode | Changes the display mode. | 0.9.0 | |
love.graphics.toggleFullscreen | Toggles fullscreen. | 0.9.0 |
Enums
AlignMode | Text alignment. | ||
BlendMode | Different ways you do alpha blending. | 0.2.0 | |
ColorMode | Controls how drawn images are affected by current color. | 0.2.0 | 0.9.0 |
DrawMode | Controls whether shapes are drawn as an outline, or filled. | ||
FilterMode | How the image is filtered when scaling. | ||
GraphicsFeature | Graphics features that can be checked for with love.graphics.isSupported. | 0.8.0 | |
GraphicsLimit | Types of system-dependent graphics limits. | 0.9.1 | |
LineJoin | Line join style. | ||
LineStyle | The styles in which lines are drawn. | ||
MeshDrawMode | How a Mesh's vertices are used when drawing. | 0.9.0 | |
PointStyle | How points should be drawn. | ||
SpriteBatchUsage | Usage hints for SpriteBatches. | 0.8.0 | |
TextureFormat | Controls the canvas texture format. | 0.9.0 | |
WrapMode | How the image wraps inside a large Quad. |
See Also
Other Languages
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