Difference between revisions of "Texture"
m (Text replacement - "<source" to "<syntaxhighlight") |
|||
Line 9: | Line 9: | ||
=== Example === | === Example === | ||
− | < | + | <syntaxhighlight lang="lua"> |
-- TEXTURE REPEAT | -- TEXTURE REPEAT | ||
wall = Shape.new() | wall = Shape.new() |
Revision as of 14:31, 13 July 2023
Supported platforms:
Available since: Gideros 2011.6
Inherits from: TextureBase
Description
The Texture class lets you work with textures in an application. The Texture class lets you create a new Texture object to load from an image file and display in scene tree.
Example
<syntaxhighlight lang="lua"> -- TEXTURE REPEAT wall = Shape.new() local texture = Texture.new("gfx/enemy01.png", true, {wrap = Texture.REPEAT}) -- put your image.png wall:setFillStyle(Shape.TEXTURE, texture) wall:beginPath() wall:moveTo(0,0) wall:lineTo(150, 0) wall:lineTo(150, 150) wall:lineTo(0, 150) wall:closePath() wall:endPath() wall:setAnchorPoint(0.5, 0.5) wall:setPosition(128, 128) stage:addChild(wall) </source>
MethodsTexture.loadAsync asynchronously loads a texture from a file |
EventsConstantsTexture.CLAMP doesn't repeat the texture |