Added max_dimension_use_zoom lua function to control whether an individual BitmapText uses the zoom in maxwidth calculations.
This commit is contained in:
@@ -2886,7 +2886,7 @@ ListHeaderP2S3Command=x,SCREEN_CENTER_X+270
|
||||
# ListHeaderCenterOnCommand is for the center element of the ListHeader.
|
||||
ListHeaderCenterOnCommand=x,SCREEN_CENTER_X;y,-6;zoom,0.7;shadowlength,1;ztest,true
|
||||
# These commands are shared by all the ListHeader parts.
|
||||
ListHeaderOnCommand=diffuse,color("#808080");shadowlength,0;zoom,0.75;maxwidth,130;
|
||||
ListHeaderOnCommand=diffuse,color("#808080");shadowlength,0;max_dimension_use_zoom,true;zoom,0.75;maxwidth,130;
|
||||
ListHeaderGainFocusCommand=diffuse,color("#808080");diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")
|
||||
ListHeaderLoseFocusCommand=diffuse,color("#808080");stopeffect
|
||||
#
|
||||
@@ -2902,7 +2902,7 @@ MappedToP2S1Command=x,SCREEN_CENTER_X+120
|
||||
MappedToP2S2Command=x,SCREEN_CENTER_X+195
|
||||
MappedToP2S3Command=x,SCREEN_CENTER_X+270
|
||||
# These commands are shared between all the elements.
|
||||
MappedToOnCommand=diffuse,color("#808080");shadowlength,0;zoom,0.75;maxwidth,130
|
||||
MappedToOnCommand=diffuse,color("#808080");shadowlength,0;zoom,0.75;max_dimension_use_zoom,true;maxwidth,130
|
||||
# WaitingCommand is executed when the player hits enter to set a key.
|
||||
MappedToWaitingCommand=diffuse,color("#FF8080");pulse;effectperiod,0.5;effectmagnitude,0.8,1.3,0
|
||||
# MappedInputCommand is executed after the player maps the key.
|
||||
|
||||
+22
-3
@@ -54,6 +54,7 @@ BitmapText::BitmapText()
|
||||
m_fMaxWidth = 0;
|
||||
m_fMaxHeight = 0;
|
||||
m_iVertSpacing = 0;
|
||||
m_MaxDimensionUsesZoom= false;
|
||||
m_bHasGlowAttribute = false;
|
||||
// We'd be better off not adding strokes to things we can't control
|
||||
// themewise (ScreenDebugOverlay for example). -Midiman
|
||||
@@ -492,6 +493,11 @@ void BitmapText::SetMaxHeight( float fMaxHeight )
|
||||
UpdateBaseZoom();
|
||||
}
|
||||
|
||||
void BitmapText::SetMaxDimUseZoom(bool use)
|
||||
{
|
||||
m_MaxDimensionUsesZoom= true;
|
||||
}
|
||||
|
||||
void BitmapText::SetUppercase( bool b )
|
||||
{
|
||||
m_bUppercase = b;
|
||||
@@ -524,7 +530,11 @@ void BitmapText::UpdateBaseZoom()
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
const float dimension= dimension_get() / dimension_zoom_get(); \
|
||||
float dimension= dimension_get(); \
|
||||
if(m_MaxDimensionUsesZoom) \
|
||||
{ \
|
||||
dimension/= dimension_zoom_get(); \
|
||||
} \
|
||||
if(dimension != 0) \
|
||||
{ \
|
||||
const float zoom= min(1, dimension_max / dimension); \
|
||||
@@ -853,8 +863,16 @@ class LunaBitmapText: public Luna<BitmapText>
|
||||
{
|
||||
public:
|
||||
static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; }
|
||||
static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; }
|
||||
static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; }
|
||||
#define MAX_DIMENSION(maxdimension, SetMaxDimension) \
|
||||
static int maxdimension( T* p, lua_State *L ) \
|
||||
{ p->SetMaxDimension(FArg(1)); return 0; }
|
||||
MAX_DIMENSION(maxwidth, SetMaxWidth);
|
||||
MAX_DIMENSION(maxheight, SetMaxHeight);
|
||||
#undef MAX_DIMENSION
|
||||
static int max_dimension_use_zoom(T* p, lua_State* L)
|
||||
{
|
||||
p->SetMaxDimUseZoom(lua_toboolean(L, 1));
|
||||
}
|
||||
static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; }
|
||||
static int settext( T* p, lua_State *L )
|
||||
{
|
||||
@@ -902,6 +920,7 @@ public:
|
||||
ADD_METHOD( wrapwidthpixels );
|
||||
ADD_METHOD( maxwidth );
|
||||
ADD_METHOD( maxheight );
|
||||
ADD_METHOD( max_dimension_use_zoom );
|
||||
ADD_METHOD( vertspacing );
|
||||
ADD_METHOD( settext );
|
||||
ADD_METHOD( rainbowscroll );
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void SetVertSpacing( int iSpacing );
|
||||
void SetMaxWidth( float fMaxWidth );
|
||||
void SetMaxHeight( float fMaxHeight );
|
||||
void SetMaxDimUseZoom(bool use);
|
||||
void SetWrapWidthPixels( int iWrapWidthPixels );
|
||||
void CropToWidth( int iWidthInSourcePixels );
|
||||
|
||||
@@ -77,6 +78,7 @@ protected:
|
||||
int m_iWrapWidthPixels; // -1 = no wrap
|
||||
float m_fMaxWidth; // 0 = no max
|
||||
float m_fMaxHeight; // 0 = no max
|
||||
bool m_MaxDimensionUsesZoom;
|
||||
bool m_bRainbowScroll;
|
||||
bool m_bJitter;
|
||||
bool m_bUsingDistortion;
|
||||
|
||||
Reference in New Issue
Block a user