stvrbbns Posted March 5, 2016 Share Posted March 5, 2016 I am trying to make a menu screen with a centered title, some centered column headers, some right-aligned row labels, and some left-aligned row notes. relevant examples:Basics 06 Render TextText Bounds relevant documentation:Phaser.Text This seems like it ought to be trivial, but none of my text alignment is working - it's all "left" all the time. I've tried declaring a non-left alignment (e.g. align:'center') on a style object before creating the text and I've tried assigning alignment to the text object immediately after creating it. Both of these methods appear to work trivially in the "Basics 06 Render Text" example. If I instead use anchor (e.g. .anchor.setTo(0.5,0.5) ), then that works. ----- My problem was that I hadn't understood the text.align vs. boundsAlign and had missed a crucial comment in the documentation about text.align: "Does not affect single lines of text.". text.align only aligns the text within the area that the text is actually rendered in. A single line of text is already taking up 100% of the width and height of the rendered text area, so it is already "aligned" in all possible ways (i.e. it can't be moved left, right, up, or down without changing which area it is being rendered in). boundsAlign aligns a rendering of text within a set of bounds - but these bounds must be set. Link to comment Share on other sites More sharing options...
Recommended Posts