Difference between revisions of "Texture"

From GiderosMobile
(removed language stuff)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
 
 
<!-- GIDEROSOBJ:Texture -->
 
<!-- GIDEROSOBJ:Texture -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
+
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/TextureBase|TextureBase]]<br/>
+
'''Inherits from:''' [[TextureBase]]<br/>
  
=== <translate>Description</translate> ===
+
=== Description ===
The [[Special:MyLanguage/Texture|Texture]] class lets you work with textures in an application. The [[Special:MyLanguage/Texture|Texture]] class lets you create a new [[Special:MyLanguage/Texture|Texture]] object to load from an image file and display in scene tree.
+
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.
  
=== <translate>Example</translate> ===
+
=== Example ===
 
<source lang="lua">
 
<source lang="lua">
 
-- TEXTURE REPEAT
 
-- TEXTURE REPEAT
Line 29: Line 28:
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/Texture.new|Texture.new]] ''creates a new Texture object from a file''<br/><!-- GIDEROSMTD:Texture.new(filename,filtering,options) creates a new Texture object from a file -->
+
[[Texture.new]] ''creates a new Texture object from a file''<br/><!--GIDEROSMTD:Texture.new(filename,filtering,options) creates a new Texture object from a file-->
[[Special:MyLanguage/Texture.new|Texture.new]] ''creates a new Texture object from a pixel array''<br/><!-- GIDEROSMTD:Texture.new(pixels,width,height,filtering,options) creates a new Texture object from a pixel array -->
+
[[Texture.new]] ''creates a new Texture object from a pixel array''<br/><!--GIDEROSMTD:Texture.new(pixels,width,height,filtering,options) creates a new Texture object from a pixel array-->
  
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
  
=== <translate>Events</translate> ===
+
=== Events ===
=== <translate>Constants</translate> ===
+
=== Constants ===
[[Special:MyLanguage/Texture.CLAMP|Texture.CLAMP]] ''Don't repeat the texture'' <br/><!-- GIDEROSCST:Texture.CLAMP Don't repeat the texture -->
+
[[Texture.CLAMP]] ''doesn't repeat the texture''<br/><!--GIDEROSCST:Texture.CLAMP doesn't repeat the texture-->
[[Special:MyLanguage/Texture.REPEAT|Texture.REPEAT]] ''Repeat the texture'' <br/><!-- GIDEROSCST:Texture.REPEAT Repeat the texture-->
+
[[Texture.REPEAT]] ''repeats the texture''<br/><!--GIDEROSCST:Texture.REPEAT repeats the texture-->
 
|}
 
|}
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Revision as of 20:14, 11 June 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 doesn't repeat the texture
Texture.REPEAT repeats the texture