Difference between revisions of "Pixel.new"
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=== Description === | === Description === | ||
− | Creates a new | + | Creates a new Pixel sprite. |
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Pixel.new(color,alpha,width,height) | Pixel.new(color,alpha,width,height) | ||
Line 24: | Line 24: | ||
Constructor to create a Pixel with texture in letterbox mode. Every texture will be fitted into Pixel dimensions while preserving texture aspect ratio. | Constructor to create a Pixel with texture in letterbox mode. Every texture will be fitted into Pixel dimensions while preserving texture aspect ratio. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | Pixel.new(texture,width,height,texture_scale_x,texture_scale_y, | + | Pixel.new(texture,width,height,texture_scale_x,texture_scale_y,texture_ax,texture_ay) |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 31: | Line 31: | ||
'''width''': (number) width of the Pixel '''optional'''<br/> | '''width''': (number) width of the Pixel '''optional'''<br/> | ||
'''height''': (number) height of the Pixel '''optional'''<br/> | '''height''': (number) height of the Pixel '''optional'''<br/> | ||
− | '''texture_scale_x''': (number) horizontal scale | + | '''texture_scale_x''': (number) Pixel texture horizontal scale '''optional'''<br/> |
− | '''texture_scale_y''': (number) vertical scale | + | '''texture_scale_y''': (number) Pixel texture vertical scale '''optional'''<br/> |
− | ''' | + | '''texture_ax''': (number) Pixel texture horizontal anchor position (between 0 and 1) '''optional'''<br/> |
− | ''' | + | '''texture_ay''': (number) Pixel texture vertical anchor position (between 0 and 1) '''optional'''<br/> |
{{Pixel}} | {{Pixel}} |
Latest revision as of 02:15, 8 November 2023
Available since: Gideros 2016.06
Class: Pixel
Description
Creates a new Pixel sprite.
Pixel.new(color,alpha,width,height)
Parameters
color: (number) hex value representing color optional
alpha: (number) alpha value from 0 to 1 optional
width: (number) width of pixel optional
height: (number) height of pixel optional
Available since: Gideros 2016.10
Class: Pixel
Description
Constructor to create a Pixel with texture in letterbox mode. Every texture will be fitted into Pixel dimensions while preserving texture aspect ratio.
Pixel.new(texture,width,height,texture_scale_x,texture_scale_y,texture_ax,texture_ay)
Parameters
texture: (TextureBase or TextureRegion) texture to use for the pixel
width: (number) width of the Pixel optional
height: (number) height of the Pixel optional
texture_scale_x: (number) Pixel texture horizontal scale optional
texture_scale_y: (number) Pixel texture vertical scale optional
texture_ax: (number) Pixel texture horizontal anchor position (between 0 and 1) optional
texture_ay: (number) Pixel texture vertical anchor position (between 0 and 1) optional