Results 1 to 2 of 2

Thread: Center Alignment of Text

  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default Center Alignment of Text

    I noticed the TextRender and TextBoxRender components support an "alignment" variable, but it doesn't seem to work. Is that TBD? Any hints on getting multiline centered text beyond hard-spacing it in the string?

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,389

    Default

    Well - how it works I believe is the text wrapping is applied, then the centering is applied to the overall rectangle that the resulting text is.

    So you can center the block of text, but you can't have each line be centered independently.

    Code:
    //from TextRenderComponent's Init:
    m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();
    The "alignment" var they use is the parent entity's, not at the component level, so to see it work make sure you set it for the containing entity itself.

    An optional helper function exists to do it:

    Code:
    SetAlignmentEntity(pSomeEntity, ALIGNMENT_CENTER);
    Seth A. Robinson
    Robinson Technologies

Similar Threads

  1. Center alignment and renderer...
    By speeder in forum Novashell Game Creation System
    Replies: 0
    Last Post: 05-09-2010, 04:24 AM
  2. Alignment affects Update()!
    By speeder in forum Novashell Game Creation System
    Replies: 7
    Last Post: 04-20-2010, 10:52 PM
  3. How to : Delete/Close a Window and Center a Window ?
    By Fr3DBr in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 08-24-2009, 02:55 AM
  4. gui/bar.lua alignment
    By illspirit in forum Novashell Game Creation System
    Replies: 5
    Last Post: 07-03-2008, 01:56 AM
  5. New Day text
    By File Sponge in forum Funeral Quest
    Replies: 0
    Last Post: 10-16-2005, 11:13 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •