love.graphics

来源:互联网 发布:最大公约数 方法 知乎 编辑:程序博客网 时间:2024/06/05 23:41
2017年4月1日23:53:10更新

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 Canvases) and managing screen geometry.

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.

The LÖVE coordinate system

默认在左上角开始绘制

Many of the functions are used to manipulate the graphics coordinate system, which is essentially the way coordinates are mapped to the display. You can change the position, scale, and even rotation in this way.


类型

Canvas屏幕渲染目标。Added since 0.8.0 Drawable所有可以绘制的父类  FontDefines the shape of characters than can be drawn onto the screen.  FramebufferOff-screen render target.Added since 0.7.0Removed in 0.8.0ImageDrawable image type.  MeshA 2D polygon mesh used for drawing arbitrary textured shapes.Added since 0.9.0 ParticleSystemUsed to create cool effects, like fire.  PixelEffectPixel shader effect.Added since 0.8.0Removed in 0.9.0QuadA quadrilateral with texture coordinate information.  ShaderShader effect.Added since 0.9.0 SpriteBatchStore image positions in a buffer, and draw it in one call.  Text可绘制文本Added since 0.10.0 TextureSuperclass for drawable objects which represent a texture.Added since 0.9.1 Video可绘制视频。Added since 0.10.0 

函数

Drawing

love.graphics.arc绘制弧形Added since 0.8.0 love.graphics.circle绘制一个圆  love.graphics.clearClears the screen to background color.  love.graphics.discardDiscards the contents of the screen or active Canvas.Added since 0.10.0 love.graphics.draw在屏幕上绘制对象。  love.graphics.drawqDraw a Quad with the specified Image on screen. Removed in 0.9.0love.graphics.ellipse绘制椭圆Added since 0.10.0 love.graphics.line画点之间的线。  love.graphics.point绘制一个点 Removed in 0.10.0love.graphics.points绘制一个或多个点。Added since 0.10.0 love.graphics.polygon绘制多边形Added since 0.4.0 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.quad画一个四边形。 Removed in 0.9.0love.graphics.rectangle绘制矩形Added since 0.3.2 love.graphics.stencil绘制几何作为一个模板Added since 0.10.0 love.graphics.triangle绘制三角形 Removed in 0.9.0

Object Creation

love.graphics.newCanvasCreates a new Canvas.Added since 0.8.0 love.graphics.newFontCreates a new Font.  love.graphics.newFramebufferCreates a new Framebuffer.Added since 0.7.0Removed in 0.8.0love.graphics.newImageCreates a new Image.  love.graphics.newImageFontCreates a new Font by loading a specifically formatted image.Added since 0.2.0 love.graphics.newMeshCreates a new Mesh.Added since 0.9.0 love.graphics.newParticleSystemCreates a new ParticleSystem.  love.graphics.newPixelEffectCreates a new PixelEffect.Added since 0.8.0Removed in 0.9.0love.graphics.newQuadCreates a new Quad.  love.graphics.newScreenshotCreates a screenshot and returns the ImageData.  love.graphics.newShaderCreates a new Shader.Added since 0.9.0 love.graphics.newSpriteBatchCreates a new SpriteBatch.  love.graphics.newStencilCreates a new stencil.Added since 0.8.0Removed in 0.9.0love.graphics.newTextCreates a new drawable Text object.Added since 0.10.0 love.graphics.newVideoCreates a new Video.Added since 0.10.0 love.graphics.setNewFontCreates and sets a new Font.Added since 0.8.0 

Graphics State

love.graphics.getBackgroundColorGets the current background color.  love.graphics.getBlendModeGets the blending mode.Added since 0.2.0 love.graphics.getCanvasReturns the current target Canvas.Added since 0.8.0 love.graphics.getCanvasFormatsGets the available Canvas formats, and whether each is supported.Added since 0.9.2 love.graphics.getColorGets the current color.  love.graphics.getColorMaskGets the active color components used when drawing.Added since 0.9.0 love.graphics.getColorModeGets the color mode (which controls how images are affected by the current color).Added since 0.2.0Removed in 0.9.0love.graphics.getCompressedImageFormatsGets the available compressed image formats, and whether each is supported.Added since 0.9.2 love.graphics.getDefaultFilterReturns the default scaling filters used with Images, Canvases, and Fonts.Added since 0.9.0 love.graphics.getDefaultImageFilterReturns the default scaling filters.Added since 0.8.0Removed in 0.9.0love.graphics.getFontGets the current Font object.Added since 0.9.0 love.graphics.getLineJoinGets the line join style.  love.graphics.getLineStippleGets the current line stipple. Removed in 0.8.0love.graphics.getLineStyleGets the line style.Added since 0.3.2 love.graphics.getLineWidthGets the current line width.Added since 0.3.2 love.graphics.getMaxImageSizeGets the max supported width or height of Images and Canvases.Added since 0.9.0Removed in 0.10.0love.graphics.getMaxPointSizeGets the max supported point size. Removed in 0.10.0love.graphics.getPixelEffectReturns the current PixelEffect.Added since 0.8.0Removed in 0.9.0love.graphics.getPointSizeGets the point size.  love.graphics.getPointStyleGets the current point style. Removed in 0.10.0love.graphics.getRendererInfoGets information about the system's video card and drivers.Added since 0.9.0
0 0
原创粉丝点击