|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
− | {{newin|[[0.9.0]]|090|type=type}}
| |
− | A polygonal shape with texture coordinate information.
| |
| | | |
− | Geometries can be used to select part of a texture to draw. In this way, one large [http://en.wikipedia.org/wiki/Texture_atlas texture atlas] can be loaded, and then split up into sub-images.
| |
− |
| |
− | Geometries replace the old [[Quad]] type completely since they can do the same and more.
| |
− |
| |
− | == Constructors ==
| |
− | {{#ask: [[Category:Functions]] [[Constructs::Geometry]]
| |
− | | headers=hide
| |
− | | default=None.
| |
− | | format=template
| |
− | | template=ListingFields
| |
− | | introtemplate=ListingIntro
| |
− | | outrotemplate=ListingOutro
| |
− | | ?Description
| |
− | | ?PrettySince
| |
− | | ?PrettyRemoved
| |
− | }}
| |
− | == Functions ==
| |
− | {{#ask: [[Category:Functions]] [[parent::Geometry||Object]]
| |
− | | headers=hide
| |
− | | format=template
| |
− | | template=ListingFields
| |
− | | introtemplate=ListingIntro
| |
− | | outrotemplate=ListingOutro
| |
− | | ?Description
| |
− | | ?PrettySince
| |
− | | ?PrettyRemoved
| |
− | }}
| |
− | == Enums ==
| |
− | {{#ask: [[Category:Enums]] [[parent::Geometry||Object]]
| |
− | | headers=hide
| |
− | | format=template
| |
− | | template=ListingFields
| |
− | | introtemplate=ListingIntro
| |
− | | outrotemplate=ListingOutro
| |
− | | ?Description
| |
− | | ?PrettySince
| |
− | | ?PrettyRemoved
| |
− | }}
| |
− | == Supertypes ==
| |
− | * [[parent::Object]]
| |
− |
| |
− | == Examples ==
| |
− | === Emulate 0.8.0's [[Quad:setViewport]] ===
| |
− | <source lang="lua">
| |
− | -- Quad:setViewport doesn't exist in 0.9.0+, but we can still create a function which does the same thing.
| |
− | -- The original image's width and height are needed as well, unlike with 0.8.0's Quad:setViewport.
| |
− | function setQuadViewport(geometry, x, y, w, h, sw, sh)
| |
− | geometry:setVertex(1, 0, 0, x/sw, y/sh)
| |
− | geometry:setVertex(2, 0, h, x/sw, (y+h)/sh)
| |
− | geometry:setVertex(3, w, h, (x+w)/sw, (y+h)/sh)
| |
− | geometry:setVertex(4, w, 0, (x+w)/sw, y/sh)
| |
− | end
| |
− |
| |
− | setQuadViewport(myGeometry, 0, 0, 32, 32, myImage:getDimensions())
| |
− | </source>
| |
− |
| |
− | == See Also ==
| |
− | * [[parent::love.graphics]]
| |
− | * [[love.graphics.draw]]
| |
− |
| |
− | [[Category:Types]]
| |
− | {{#set:Description=A polygonal shape with texture coordinate information.}}
| |
− | == Other Languages ==
| |
− | {{i18n|Geometry}}
| |
− |
| |
− | --@todo: add [[Concept:Current]] to stuffs when done adding stuffs.
| |