Difference between revisions of "Texture"

(Constants)
(Constants)
 
Line 37: Line 37:
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
 
=== <translate>Constants</translate> ===
 
=== <translate>Constants</translate> ===
[[Special:MyLanguage/Texture.CLAMP|Texture.CLAMP]]<br/><!-- GIDEROSCST:Texture.CLAMP Don't repeat the texture -->
+
[[Special:MyLanguage/Texture.CLAMP|Texture.CLAMP]] ''Don't repeat the texture'' <br/><!-- GIDEROSCST:Texture.CLAMP Don't repeat the texture -->
[[Special:MyLanguage/Texture.REPEAT|Texture.REPEAT]]<br/><!-- GIDEROSCST:Texture.REPEAT Repeat the texture-->
+
[[Special:MyLanguage/Texture.REPEAT|Texture.REPEAT]] ''Repeat the texture'' <br/><!-- GIDEROSCST:Texture.REPEAT Repeat the texture-->
 
|}
 
|}
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 18:18, 7 January 2021


Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
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 = 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)

Methods

Texture.new creates a new Texture object from a file
Texture.new creates a new Texture object from a pixel array

Events

Constants

Texture.CLAMP Don't repeat the texture
Texture.REPEAT Repeat the texture