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

CanvasOff-screen render target.
DrawableSuperclass for all things that can be drawn on screen.
FontDefines the shape of characters than can be drawn onto the screen.
FramebufferOff-screen render target.
ImageDrawable image type.
MeshA 2D polygon mesh used for drawing arbitrary textured shapes.
ParticleSystemUsed to create cool effects, like fire.
PixelEffectPixel shader effect.
QuadA quadrilateral with texture coordinate information.
ShaderShader effect.
SpriteBatchStore image positions in a buffer, and draw it in one call.
TextDrawable text.
TextureSuperclass for drawable objects which represent a texture.
VideoA drawable video.

Functions

love.graphics.arcDraws an arc.
love.graphics.checkModeChecks if a display mode is supported.
love.graphics.circleDraws a circle.
love.graphics.clearClears the screen to background color.
love.graphics.discardDiscards the contents of the screen or active Canvas.
love.graphics.drawDraws objects on screen.
love.graphics.drawqDraw a Quad with the specified Image on screen.
love.graphics.ellipseDraws an ellipse.
love.graphics.getBackgroundColorGets the current background color.
love.graphics.getBlendModeGets the blending mode.
love.graphics.getCanvasReturns the current target Canvas.
love.graphics.getCanvasFormatsGets the available Canvas formats, and whether each is supported.
love.graphics.getCaptionGets the window caption.
love.graphics.getColorGets the current color.
love.graphics.getColorMaskGets the active color components used when drawing.
love.graphics.getColorModeGets the color mode (which controls how images are affected by the current color).
love.graphics.getCompressedImageFormatsGets the available compressed image formats, and whether each is supported.
love.graphics.getDefaultFilterReturns the default scaling filters used with Images, Canvases, and Fonts.
love.graphics.getDefaultImageFilterReturns the default scaling filters.
love.graphics.getDimensionsGets the width and height of the window.
love.graphics.getFontGets the current Font object.
love.graphics.getHeightGets the height in pixels of the window.
love.graphics.getLineJoinGets the line join style.
love.graphics.getLineStippleGets the current line stipple.
love.graphics.getLineStyleGets the line style.
love.graphics.getLineWidthGets the current line width.
love.graphics.getMaxImageSizeGets the max supported width or height of Images and Canvases.
love.graphics.getMaxPointSizeGets the max supported point size.
love.graphics.getModeReturns the current display mode.
love.graphics.getModesGets a list of supported fullscreen modes.
love.graphics.getPixelEffectReturns the current PixelEffect.
love.graphics.getPointSizeGets the point size.
love.graphics.getPointStyleGets the current point style.
love.graphics.getRendererInfoGets information about the system's video card and drivers.
love.graphics.getScissorGets the current scissor box.
love.graphics.getShaderGets the current Shader.
love.graphics.getStatsGets performance-related rendering statistics.
love.graphics.getStencilTestGets the current stencil test configuration.
love.graphics.getSupportedGets the optional graphics features and whether they're supported.
love.graphics.getSystemLimitGets the system-dependent maximum value for a love.graphics feature.
love.graphics.getSystemLimitsGets the system-dependent maximum values for love.graphics features.
love.graphics.getWidthGets the width in pixels of the window.
love.graphics.hasFocusChecks if the game window has keyboard focus.
love.graphics.intersectScissorSets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor.
love.graphics.isActiveGets whether the graphics module is able to be used.
love.graphics.isCreatedChecks if the window has been created.
love.graphics.isGammaCorrectGets whether gamma-correct rendering is enabled.
love.graphics.isSupportedChecks for the support of graphics related functions.
love.graphics.isWireframeGets whether wireframe mode is used when drawing.
love.graphics.lineDraws lines between points.
love.graphics.newCanvasCreates a new Canvas.
love.graphics.newFontCreates a new Font.
love.graphics.newFramebufferCreates a new Framebuffer.
love.graphics.newImageCreates a new Image.
love.graphics.newImageFontCreates a new Font by loading a specifically formatted image.
love.graphics.newMeshCreates a new Mesh.
love.graphics.newParticleSystemCreates a new ParticleSystem.
love.graphics.newPixelEffectCreates a new PixelEffect.
love.graphics.newQuadCreates a new Quad.
love.graphics.newScreenshotCreates a screenshot and returns the ImageData.
love.graphics.newShaderCreates a new Shader.
love.graphics.newSpriteBatchCreates a new SpriteBatch.
love.graphics.newStencilCreates a new stencil.
love.graphics.newTextCreates a new drawable Text object.
love.graphics.newVideoCreates a new Video.
love.graphics.originResets the current coordinate transformation.
love.graphics.pointDraws a point.
love.graphics.pointsDraws one or more points.
love.graphics.polygonDraw a polygon.
love.graphics.popPops the current coordinate transformation from the transformation stack.
love.graphics.presentDisplays the results of drawing operations on the screen.
love.graphics.printDraws text on screen. If no Font is set, one will be created and set (once) if needed.
love.graphics.printfDraws formatted text, with word wrap and alignment.
love.graphics.pushCopies and pushes the current coordinate transformation to the transformation stack.
love.graphics.quadDraws a quadrilateral shape.
love.graphics.rectangleDraws a rectangle.
love.graphics.resetResets the current graphics settings.
love.graphics.rotateRotates the coordinate system in two dimensions.
love.graphics.scaleScales the coordinate system in two dimensions.
love.graphics.setBackgroundColorSets the background color.
love.graphics.setBlendModeSets the blending mode.
love.graphics.setCanvasCaptures drawing operations to a Canvas
love.graphics.setCaptionSets the window caption.
love.graphics.setColorSets the color used for drawing.
love.graphics.setColorMaskSets the color mask. Enables or disables specific color components when rendering.
love.graphics.setColorModeSets the color mode (which controls how images are affected by the current color).
love.graphics.setDefaultFilterSets the default scaling filters used with Images, Canvases, and Fonts.
love.graphics.setDefaultImageFilterSets the default scaling filters.
love.graphics.setFontSet an already-loaded Font as the current font.
love.graphics.setIconSet window icon.
love.graphics.setInvertedStencilDefines an inverted stencil.
love.graphics.setLineSets the line width and style.
love.graphics.setLineJoinSets the line join style.
love.graphics.setLineStippleSets the line stipple pattern.
love.graphics.setLineStyleSets the line style.
love.graphics.setLineWidthSets the line width.
love.graphics.setModeChanges the display mode.
love.graphics.setNewFontCreates and sets a new Font.
love.graphics.setPixelEffectRoutes drawing operations through a pixel shader.
love.graphics.setPointSets the point size and style.
love.graphics.setPointSizeSets the point size.
love.graphics.setPointStyleSets the point style.
love.graphics.setRenderTargetCaptures drawing operations to a Framebuffer
love.graphics.setScissorSets or disables scissor.
love.graphics.setShaderRoutes drawing operations through a shader.
love.graphics.setStencilDefines or releases a stencil.
love.graphics.setStencilTestConfigures or disables stencil testing.
love.graphics.setWireframeSets whether wireframe lines will be used when drawing.
love.graphics.shearShears the coordinate system.
love.graphics.stencilDraws geometry as a stencil.
love.graphics.toggleFullscreenToggles fullscreen.
love.graphics.translateTranslates the coordinate system in two dimensions.
love.graphics.triangleDraws a triangle.

Enums

AlignModeText alignment.
ArcTypeDifferent types of arcs that can be drawn.
BlendAlphaModeDifferent ways alpha affects color blending.
BlendModeDifferent ways to do color blending.
CanvasFormatCanvas texture formats.
ColorModeControls how drawn images are affected by current color.
CompareModeDifferent types of stencil test comparisons.
DrawModeControls whether shapes are drawn as an outline, or filled.
FilterModeHow the image is filtered when scaling.
GraphicsFeatureGraphics features that can be checked for with love.graphics.getSupported.
GraphicsLimitTypes of system-dependent graphics limits.
LineJoinLine join style.
LineStyleThe styles in which lines are drawn.
MeshDrawModeHow a Mesh's vertices are used when drawing.
PointStyleHow points should be drawn.
SpriteBatchUsageUsage hints for SpriteBatches and Meshes.
StackTypeGraphics state stack types used with love.graphics.push.
StencilActionHow a stencil function modifies the stencil values of pixels it touches.
TextureFormatControls the canvas texture format.
WrapModeHow the image wraps inside a large Quad.

See Also

Ngôn ngữ khác