Difference between revisions of "User:Cyanox"

Line 1: Line 1:
 
Using this as personal SandBox mostly ;)
 
Using this as personal SandBox mostly ;)
  
{{newin|[[0.7.0]]|070|type=type}}
+
The primary responsibility for the love.graphics module is the drawing of lines, shapes, text, [[Image]]s and other [[Drawable]] objects onto the screen. Its secondary responsibilities include loading external files (including [[Image]]s and [[Font]]s) into memory, creating specialized objects (such as [[ParticleSystem]]s or [[Canvas]]es) and managing screen geometry.
A Thread is a chunk of code that can run in parallel with other threads.
 
  
If a Lua error occurs in the thread, a message with the name "error" gets pushed to its message pool. Retrieve the message with <tt>Thread:get('error')</tt>.
+
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.
== Constructors ==
+
 
{{#ask: [[Category:Functions]] [[Constructs::Thread]] [[Concept:Current]]
+
[[File:lovecoordsystem.png|The LÖVE coordinate system]]
 +
 
 +
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 ==
 +
{{#ask: [[Category:Types]] [[parent::love.graphics]] [[Concept:Current]]
 
| headers=hide
 
| headers=hide
| default=None.
 
| format=template
 
| template=CyaNoxTestingListThingy
 
| introtemplate=CyaNoxTestingListThingyIntro
 
| outrotemplate=CyaNoxTestingListThingyOutro
 
 
| ?Description
 
| ?Description
| ?PrettySince
 
| ?PrettyRemoved
 
 
}}
 
}}
 
== Functions ==
 
== Functions ==
{{#ask: [[Category:Functions]] [[parent::Thread||Object]] [[Concept:Current]]
+
=== Drawing ===
 +
{{#ask: [[Category:Functions]] [[parent::love.graphics]] [[Concept:Current]] [[Sub-Category::Drawing]]
 +
| headers=hide
 +
| limit=2000
 +
| ?Description
 +
}}
 +
=== Object Creation ===
 +
{{#ask: [[Category:Functions]] [[parent::love.graphics]] [[Concept:Current]] [[Sub-Category::Object Creation]]
 +
| headers=hide
 +
| limit=2000
 +
| ?Description
 +
}}
 +
=== Graphics State ===
 +
{{#ask: [[Category:Functions]] [[parent::love.graphics]] [[Concept:Current]] [[Sub-Category::State]]
 +
| headers=hide
 +
| limit=2000
 +
| ?Description
 +
}}
 +
=== Coordinate System ===
 +
{{#ask: [[Category:Functions]] [[parent::love.graphics]] [[Concept:Current]] [[Sub-Category::Coordinate System]]
 
| headers=hide
 
| headers=hide
| format=template
+
| limit=2000
| template=CyaNoxTestingListThingy
 
| introtemplate=CyaNoxTestingListThingyIntro
 
| outrotemplate=CyaNoxTestingListThingyOutro
 
 
| ?Description
 
| ?Description
| ?PrettySince
 
| ?PrettyRemoved
 
 
}}
 
}}
== Supertypes ==
+
=== Window ===
* [[parent::Object]]
+
{{#ask: [[Category:Functions]] [[parent::love.graphics]] [[Concept:Current]] [[Sub-Category::Window]]
 +
| headers=hide
 +
| limit=2000
 +
| ?Description
 +
}}
 +
== Enums ==
 +
{{#ask: [[Category:Enums]] [[parent::love.graphics]] [[Concept:Current]]
 +
| headers=hide
 +
| ?Description
 +
}}
 +
 
 +
{{#set:Description=Drawing of shapes and images, management of screen geometry.}}
 
== See Also ==
 
== See Also ==
* [[parent::love.thread]]
+
* [[parent::love]]
-- removed --
+
 
{{#set:Description=A Thread represents a thread.}}
 
 
== Other Languages ==
 
== Other Languages ==
-- removed --
 

Revision as of 20:11, 29 March 2013

Using this as personal SandBox mostly ;)

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

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

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

Drawing

love.graphics.arcDraws an arc.
love.graphics.circleDraws a circle.
love.graphics.clearClears the screen or active Canvas to the specified color.
love.graphics.discardDiscards the contents of the screen or active Canvas.
love.graphics.drawDraws objects on screen.
love.graphics.drawInstancedDraws many instances of a Mesh with a single draw call, using hardware geometry instancing.
love.graphics.drawLayerDraws a layer of an Array Texture.
love.graphics.drawqDraw a Quad with the specified Image on screen.
love.graphics.ellipseDraws an ellipse.
love.graphics.flushBatchImmediately renders any pending automatically batched draws.
love.graphics.lineDraws lines between points.
love.graphics.pointDraws a point.
love.graphics.pointsDraws one or more points.
love.graphics.polygonDraw a polygon.
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.quadDraws a quadrilateral shape.
love.graphics.rectangleDraws a rectangle.
love.graphics.stencilDraws geometry as a stencil.
love.graphics.triangleDraws a triangle.

Object Creation

love.graphics.captureScreenshotCreates a screenshot once the current frame is done.
love.graphics.newArrayImageCreates a new array Image.
love.graphics.newCanvasCreates a new Canvas.
love.graphics.newCubeImageCreates a new cubemap Image.
love.graphics.newFontCreates a new Font from a TrueType Font or BMFont file.
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.newVolumeImageCreates a new volume Image.
love.graphics.setNewFontCreates and sets a new Font.
love.graphics.validateShaderValidates shader code.

Graphics State

love.graphics.getBackgroundColorGets the current background color.
love.graphics.getBlendModeGets the blending mode.
love.graphics.getCanvasReturns the current target Canvas.
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.getDefaultFilterReturns the default scaling filters used with Images, Canvases, and Fonts.
love.graphics.getDefaultImageFilterReturns the default scaling filters.
love.graphics.getDepthModeGets the current depth test mode and whether writing to the depth buffer is enabled.
love.graphics.getFontGets the current Font object.
love.graphics.getFrontFaceWindingGets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing.
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.getMeshCullModeGets whether back-facing triangles in a Mesh are culled.
love.graphics.getPixelEffectReturns the current PixelEffect.
love.graphics.getPointSizeGets the point size.
love.graphics.getPointStyleGets the current point style.
love.graphics.getScissorGets the current scissor box.
love.graphics.getShaderGets the current Shader.
love.graphics.getStackDepthGets the current depth of the transform / state stack (the number of pushes without corresponding pops).
love.graphics.getStencilTestGets the current stencil test configuration.
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.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.resetResets the current graphics settings.
love.graphics.setBackgroundColorSets the background color.
love.graphics.setBlendModeSets the blending mode.
love.graphics.setCanvasCaptures drawing operations to a Canvas
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.setDepthModeConfigures depth testing and writing to the depth buffer.
love.graphics.setFontSet an already-loaded Font as the current font.
love.graphics.setFrontFaceWindingSets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing.
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.setMeshCullModeSets whether back-facing triangles in a Mesh are culled.
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.

Coordinate System

love.graphics.applyTransformApplies the given Transform object to the current coordinate transformation.
love.graphics.inverseTransformPointConverts the given 2D position from screen-space into global coordinates.
love.graphics.originResets the current coordinate transformation.
love.graphics.popPops the current coordinate transformation from the transformation stack.
love.graphics.pushCopies and pushes the current coordinate transformation to the transformation stack.
love.graphics.replaceTransformReplaces the current coordinate transformation with the given Transform object.
love.graphics.rotateRotates the coordinate system in two dimensions.
love.graphics.scaleScales the coordinate system in two dimensions.
love.graphics.shearShears the coordinate system.
love.graphics.transformPointConverts the given 2D position from global coordinates into screen-space.
love.graphics.translateTranslates the coordinate system in two dimensions.

Window

love.graphics.checkModeChecks if a display mode is supported.
love.graphics.getCaptionGets the window caption.
love.graphics.getDPIScaleGets the DPI scale factor of the window.
love.graphics.getDimensionsGets the width and height of the window.
love.graphics.getHeightGets the height in pixels of the window.
love.graphics.getModeReturns the current display mode.
love.graphics.getModesGets a list of supported fullscreen modes.
love.graphics.getPixelDimensionsGets the width and height in pixels of the window.
love.graphics.getPixelHeightGets the height in pixels of the window.
love.graphics.getPixelWidthGets the width in pixels of the window.
love.graphics.getWidthGets the width in pixels of the window.
love.graphics.hasFocusChecks if the game window has keyboard focus.
love.graphics.isCreatedChecks if the window has been created.
love.graphics.setCaptionSets the window caption.
love.graphics.setIconSet window icon.
love.graphics.setModeChanges the display mode.
love.graphics.toggleFullscreenToggles fullscreen.

Enums

AlignModeText alignment.
ArcTypeDifferent types of arcs that can be drawn.
AttributeDataTypeData types used in a Mesh's vertex format.
BlendAlphaModeDifferent ways alpha affects color blending.
BlendModeDifferent ways to do color blending.
BufferDataUsageUsage hints for SpriteBatches, Meshes, and GraphicsBuffers to optimize data storage and access.
CanvasFormatCanvas texture formats.
ColorModeControls how drawn images are affected by current color.
CompareModeDifferent types of stencil test and depth test comparisons.
CullModeHow Mesh geometry is culled when rendering.
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.
IndexDataTypeVertex map datatype.
LineJoinLine join style.
LineStyleThe styles in which lines are drawn.
MeshDrawModeHow a Mesh's vertices are used when drawing.
MipmapModeControls whether a Canvas has mipmaps, and its behaviour when it does.
PixelFormatPixel formats for Textures, ImageData, and CompressedImageData.
PointStyleHow points should be drawn.
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.
TextureTypeTypes of textures (2D, cubemap, etc.)
VertexAttributeStepThe frequency at which a vertex shader fetches the vertex attribute's data from the Mesh when it's drawn.
VertexWindingVertex winding.
WrapModeHow the image wraps inside a large Quad.


See Also

Other Languages