Difference between revisions of "Sprite:setWorldAlign"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> '''Class:''' Sprite<br/> === Description === Instructs Gideros to align the Sprite position on a screen pixel. This i...")
 
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Available since:''' Gideros 2011.6<br/>
+
'''Available since:''' Gideros 2022.6<br/>
 
'''Class:''' [[Sprite]]<br/>
 
'''Class:''' [[Sprite]]<br/>
  

Latest revision as of 20:17, 18 October 2025

Available since: Gideros 2022.6
Class: Sprite

Description

Instructs Gideros to align the Sprite position on a screen pixel. This is useful for Textfields since it makes the text look more sharp.

Sprite:setWorldAlign(align)

Parameters

align: (bool) whether or not the sprite should be aligned

Example

local tf = TextField.new(nil, "hello Gideros!")
local tf2 = TextField.new(nil, "hello Gideros 2025!")
tf2:setTextColor(0x0000ff)
-- scale
tf:setScale(2)
tf2:setScale(2)
-- position
tf:setPosition(1*32, 1*32)
tf2:setPosition(1.5*32, 1.5*32)
-- order
stage:addChildrenAt ( { tf, tf2, } )

tf2:setWorldAlign(true)