Difference between revisions of "Texture"
From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
-- TEXTURE REPEAT | -- TEXTURE REPEAT | ||
wall = Shape.new() | wall = Shape.new() | ||
− | local texture = Texture.new("gfx/enemy01.png", true, {wrap = | + | local texture = Texture.new("gfx/enemy01.png", true, {wrap = TextureBase.REPEAT}) -- put your image.png |
wall:setFillStyle(Shape.TEXTURE, texture) | wall:setFillStyle(Shape.TEXTURE, texture) | ||
wall:beginPath() | wall:beginPath() | ||
Line 24: | Line 24: | ||
wall:setPosition(128, 128) | wall:setPosition(128, 128) | ||
stage:addChild(wall) | stage:addChild(wall) | ||
− | </ | + | </syntaxhighlight> |
{|- | {|- | ||
Line 37: | Line 37: | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
− | |||
− | |||
|} | |} | ||
{{GIDEROS IMPORTANT LINKS}} | {{GIDEROS IMPORTANT LINKS}} |
Latest revision as of 14:34, 20 July 2024
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
-- TEXTURE REPEAT
wall = Shape.new()
local texture = Texture.new("gfx/enemy01.png", true, {wrap = TextureBase.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)
MethodsTexture.loadAsync asynchronously loads a texture from a file |
EventsConstants |