Difference between revisions of "Bitmap.new"

From GiderosMobile
(mostly formatting :-) and removed language)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Creates a new '''Bitmap''' object using a '''[[Texture]]'''.
 
Creates a new '''Bitmap''' object using a '''[[Texture]]'''.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
Bitmap.new(texture)
 
Bitmap.new(texture)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===
Line 20: Line 20:
 
=== Description ===
 
=== Description ===
 
Creates a new '''Bitmap''' object using a '''[[TextureRegion]]'''.
 
Creates a new '''Bitmap''' object using a '''[[TextureRegion]]'''.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
Bitmap.new(textureRegion)
 
Bitmap.new(textureRegion)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===
Line 28: Line 28:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local texture = Texture.new("image.png")
 
local texture = Texture.new("image.png")
 
local region = TextureRegion.new(texture, 0, 0, 100, 50)
 
local region = TextureRegion.new(texture, 0, 0, 100, 50)
Line 36: Line 36:
 
stage:addChild(bitmap1)
 
stage:addChild(bitmap1)
 
stage:addChild(bitmap2)
 
stage:addChild(bitmap2)
</source>
+
</syntaxhighlight>
  
 
{{Bitmap}}
 
{{Bitmap}}

Latest revision as of 14:27, 13 July 2023

Available since: Gideros 2011.6
Class: Bitmap

Description

Creates a new Bitmap object using a Texture.

Bitmap.new(texture)

Parameters

texture: (texture) the bitmap texture



Available since: Gideros 2012.8.2
Class: Bitmap

Description

Creates a new Bitmap object using a TextureRegion.

Bitmap.new(textureRegion)

Parameters

textureRegion: (textureRegion) the bitmap texture region

Example

local texture = Texture.new("image.png")
local region = TextureRegion.new(texture, 0, 0, 100, 50)

local bitmap1 = Bitmap.new(texture)
local bitmap2 = Bitmap.new(region)
stage:addChild(bitmap1)
stage:addChild(bitmap2)