love.graphics (Tiếng Việt)

Nhiệm vụ chính của module love.graphics là vẽ các đường nét, hình dạng, chữ, các Image (ảnh) cùng những đối tượng Drawable (vẽ được) khác lên mành hình. Nhiệm vụ thứ hai bao gồm việc nạp các file ngoài (các ImageFont) vào bộ nhớ, tạo ra các đối tượng riêng (như ParticleSystem hoặc Canvas) và quản lý những vị trí trên màn hình.

Hệ tọa độ của LÖVE có gốc đặt tại góc bên trái phía trên màn hình, tức là vị trí (0, 0). Trục x nằm ngang, hướng sang phải. Trục y thẳng đứng, hướng xuống dưới.

Hệ tọa độ trong LÖVE

Trong nhiều trường hợp, bạn vẽ lên các ảnh hoặc hình tính từ vị trí góc trên bên trái (Xem hình trên).

Nhiều hàm được dùng để thao tác trên hệ tọa độ đồ họa, chính là cách mà những tọa độ này tương ứng với màn hình. Bạn có thể thay đổi vị trí, co giãn, và thậm chí xoay hình theo cách này.


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

love.graphics.arc Draws an arc.
love.graphics.checkMode Checks if a display mode is supported.
love.graphics.circle Draws a circle.
love.graphics.clear Clears the screen to background color.
love.graphics.draw Draws objects on screen.
love.graphics.drawq Draw a Quad with the specified Image on screen.
love.graphics.getBackgroundColor Gets the current background color.
love.graphics.getBlendMode Gets the blending mode.
love.graphics.getCanvas Returns the current target Canvas.
love.graphics.getCaption Gets the window caption.
love.graphics.getColor Gets the current color.
love.graphics.getColorMask Gets the active color components used when drawing.
love.graphics.getColorMode Gets the color mode (which controls how images are affected by the current color).
love.graphics.getDefaultFilter Returns the default scaling filters used with Images, Canvases, and Fonts.
love.graphics.getDefaultImageFilter Returns the default scaling filters.
love.graphics.getDimensions Gets the width and height of the window.
love.graphics.getFont Gets the current Font object.
love.graphics.getHeight Gets the height in pixels of the window.
love.graphics.getLineJoin Gets the line join style.
love.graphics.getLineStipple Gets the current line stipple.
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.
love.graphics.getMaxPointSize Gets the max supported point size.
love.graphics.getMode Returns the current display mode.
love.graphics.getModes Gets a list of supported fullscreen modes.
love.graphics.getPixelEffect Returns the current PixelEffect.
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.
love.graphics.getScissor Gets the current scissor box.
love.graphics.getShader Gets the current Shader.
love.graphics.getSystemLimit Gets the system-dependent maximum value for a love.graphics feature.
love.graphics.getWidth Gets the width in pixels of the window.
love.graphics.hasFocus Checks if the game window has keyboard focus.
love.graphics.isCreated Checks if the display has been set.
love.graphics.isSupported Checks for the support of graphics related functions.
love.graphics.isWireframe Gets whether wireframe mode is used when drawing.
love.graphics.line Draws lines between points.
love.graphics.newCanvas Creates a new Canvas.
love.graphics.newFont Creates a new Font.
love.graphics.newFramebuffer Creates a new Framebuffer.
love.graphics.newImage Creates a new Image.
love.graphics.newImageFont Creates a new Font by loading a specifically formatted image.
love.graphics.newMesh Creates a new Mesh.
love.graphics.newParticleSystem Creates a new ParticleSystem.
love.graphics.newPixelEffect Creates a new PixelEffect.
love.graphics.newQuad Creates a new Quad.
love.graphics.newScreenshot Creates a screenshot and returns the ImageData.
love.graphics.newShader Creates a new Shader.
love.graphics.newSpriteBatch Creates a new SpriteBatch.
love.graphics.newStencil Creates a new stencil.
love.graphics.origin Resets the current coordinate transformation.
love.graphics.point Draws a point.
love.graphics.polygon Draw a polygon.
love.graphics.pop Pops the current coordinate transformation from the transformation stack.
love.graphics.present Displays the results of drawing operations on the screen.
love.graphics.print Draws text on screen. If no Font is set, one will be created and set (once) if needed.
love.graphics.printf Draws formatted text, with word wrap and alignment.
love.graphics.push Copies and pushes the current coordinate transformation to the transformation stack.
love.graphics.quad Draws a quadrilateral shape.
love.graphics.rectangle Draws a rectangle.
love.graphics.reset Resets the current graphics settings.
love.graphics.rotate Rotates the coordinate system in two dimensions.
love.graphics.scale Scales the coordinate system in two dimensions.
love.graphics.setBackgroundColor Sets the background color.
love.graphics.setBlendMode Sets the blending mode.
love.graphics.setCanvas Captures drawing operations to a Canvas
love.graphics.setCaption Sets the window caption.
love.graphics.setColor Sets the color used for drawing.
love.graphics.setColorMask Sets the color mask. Enables or disables specific color components when rendering.
love.graphics.setColorMode Sets the color mode (which controls how images are affected by the current color).
love.graphics.setDefaultFilter Sets the default scaling filters used with Images, Canvases, and Fonts.
love.graphics.setDefaultImageFilter Sets the default scaling filters.
love.graphics.setFont Set an already-loaded Font as the current font.
love.graphics.setIcon Set window icon.
love.graphics.setInvertedStencil Defines an inverted stencil.
love.graphics.setLine Sets the line width and style.
love.graphics.setLineJoin Sets the line join style.
love.graphics.setLineStipple Sets the line stipple pattern.
love.graphics.setLineStyle Sets the line style.
love.graphics.setLineWidth Sets the line width.
love.graphics.setMode Changes the display mode.
love.graphics.setNewFont Creates and sets a new Font.
love.graphics.setPixelEffect Routes drawing operations through a pixel shader.
love.graphics.setPoint Sets the point size and style.
love.graphics.setPointSize Sets the point size.
love.graphics.setPointStyle Sets the point style.
love.graphics.setRenderTarget Captures drawing operations to a Framebuffer
love.graphics.setScissor Sets or disables scissor.
love.graphics.setShader Routes drawing operations through a shader.
love.graphics.setStencil Defines or releases a stencil.
love.graphics.setWireframe Sets whether wireframe lines will be used when drawing.
love.graphics.shear Shears the coordinate system.
love.graphics.toggleFullscreen Toggles fullscreen.
love.graphics.translate Translates the coordinate system in two dimensions.
love.graphics.triangle Draws a triangle.

Enums

AlignMode Text alignment.
BlendMode Different ways you do alpha blending.
ColorMode Controls how drawn images are affected by current color.
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.
GraphicsLimit Types of system-dependent graphics limits.
LineJoin Line join style.
LineStyle The styles in which lines are drawn.
MeshDrawMode How a Mesh's vertices are used when drawing.
PointStyle How points should be drawn.
SpriteBatchUsage Usage hints for SpriteBatches.
TextureFormat Controls the canvas texture format.
WrapMode How the image wraps inside a large Quad.

See Also

Ngôn ngữ khác

Personal tools