justin-espedal / polydes

Collection of open source Stencyl extensions.
MIT License
8 stars 4 forks source link

Centered Text (Horizontal) #56

Open CoryAlexMartin opened 9 years ago

CoryAlexMartin commented 9 years ago

Centered text. Toggled with a tag.

Options for recalculating the center position every character, based on the currently drawn line and calculating the center position at the start of the line.

justin-espedal commented 9 years ago

Copying from the google doc.

Ideas: You could just completely integrate this one over other extensions, program info for each tag found in the dialog. For example, keep a record of the “face” tag, if at any point a face is shown throughout a page, that whole page will need to have the alignment begin at the extra scripts preference for new msg x. If a glyph tag is found, add the width of whatever bitmap it’s tied to, plus the padding. If a <bc> <clear> <end> etc is found, of course, that page would be finished.

Calculate the dialog beforehand, allow for aligning vertically and horizontally, new page, align everything properly (fonts, etc.), calculate face box, yadayada…

Use whatever properties are set when calculation starts as the basis, then calculate for these additional commands as they show up.

<glyph IMAGE> (get width of image being used)
<face IMAGE> (reduce message width by amount set in face prefs)
<showattr [ATTR]> (get value of attribute, add width of that text to calculation)
<typefont FONT> (change font used for calculations)

<bc> (marks end of page)
<clear> (marks end of page)
<close> (marks end of page)
<end> (marks end of page)
<dg DG> (marks end of page)

In general, if a dialog is going to CHANGE the message width/height/drawX/drawY, it needs to have a function for getting that info based on args.