Sprite:setWorldAlign

From GiderosMobile

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)