Previously, alignment had to be implemented by each actor, so it was

only ever supported by Sprite and BitmapText.  Handle it globally, using
m_size.  This way, an actor only needs to set m_size to support alignment.

This means alignment can be set for non-drawing ActorFrames, if a size
is set explicitly.  This allows stretching from the border of a frame
without playing games with extra nested frames.  "setsize,100,100;valign,4;zoomx,.5"

This adds an extra matrix multiply.  This will only happen for actors
actually set to non-centered alignment, which is the exception.

BitmapText still overrides this behavior a bit.  Alignment for text
does two things: changes the alignment of the bounding box vs. the
X/Y position (the generic behavior), and changes the alignment of
the text within the bounding box.
This commit is contained in:
Glenn Maynard
2007-03-01 04:29:05 +00:00
parent be4efcd0c2
commit c371d9f26b
5 changed files with 34 additions and 32 deletions
+4 -8
View File
@@ -83,15 +83,11 @@ void ActorMultiTexture::DrawPrimitives()
{
Actor::SetGlobalRenderStates(); // set Actor-specified render states
RageVector2 center = m_size;
center.x *= m_fHorizAlign * -0.5f;
center.y *= m_fVertAlign * -0.5f;
RectF quadVerticies;
quadVerticies.left = center.x - m_size.x/2.0f;
quadVerticies.right = center.x + m_size.x/2.0f;
quadVerticies.top = center.y - m_size.y/2.0f;
quadVerticies.bottom = center.y + m_size.y/2.0f;
quadVerticies.left = -m_size.x/2.0f;
quadVerticies.right = +m_size.x/2.0f;
quadVerticies.top = -m_size.y/2.0f;
quadVerticies.bottom = +m_size.y/2.0f;
DISPLAY->ClearAllTextures();
for( size_t i = 0; i < m_aTextureUnits.size(); ++i )