String::strFormat is now String::formatBuffer.

String::strFormated is now String::format.
Added Actions::ResizeBorderRadius and implemented Border Radius CSS transition.
Renamed BackgroundCorners for BorderRadius.
Renamed ForegroundCorners for ForgroundRadius.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-01-09 01:13:57 -03:00
parent b16f4b8421
commit 6b05bae813
20 changed files with 178 additions and 63 deletions

View File

@@ -71,8 +71,8 @@ Tooltip {
borderWidth: 2dp;
borderColor: #66666666;
backgroundColor: #33FF3333;
backgroundCorners: 12;
transition: scale 0.25s, rotation 0.25s 0.25s, borderColor 0.25s, backgroundColor 0.25s;
borderRadius: 12;
transition: scale 0.25s, rotation 0.25s 0.25s, borderColor 0.25s, backgroundColor 0.25s, borderRadius 0.25s;
}
#tpad:hover {
@@ -80,7 +80,7 @@ Tooltip {
rotation: -3;
backgroundColor: #FF333333;
borderColor: #99999999;
backgroundCorners: 12;
borderRadius: 4;
}
#tpad2 {
@@ -95,6 +95,7 @@ Tooltip {
layout_marginLeft: 8dp;
padding: 28dp;
opacity: 1;
borderRadius: 24;
backgroundColor: #656;
}

View File

@@ -46,7 +46,7 @@
</vbox>
</hbox>
<hbox id="test_2" layout_width="match_parent" layout_height="match_parent">
<TextView layout_width="match_parent" layout_height="match_parent" text="Hello World!" gravity="center" background="#333" textSize="24dp" backgroundCorners="128" />
<TextView layout_width="match_parent" layout_height="match_parent" text="Hello World!" gravity="center" background="#333" textSize="24dp" borderRadius="128" />
</hbox>
<Tab name="Padding Test" owns="test_1" />

View File

@@ -57,7 +57,7 @@
</vbox>
</hbox>
<hbox id="test_2" layout_width="match_parent" layout_height="match_parent">
<TextView layout_width="match_parent" layout_height="match_parent" text="Hello World!" gravity="center" background="#333" textSize="24dp" backgroundCorners="128" />
<TextView layout_width="match_parent" layout_height="match_parent" text="Hello World!" gravity="center" background="#333" textSize="24dp" borderRadius="128" />
</hbox>
<Tab name="Padding Test" owns="test_1" />

View File

@@ -173,7 +173,7 @@ class EE_API String {
}
/** Returning a std::string from a formated string */
static std::string strFormated( const char* format, ... )
static std::string format( const char* format, ... )
#ifdef __GNUC__
/* This attribute is nice: it even works through gettext invokation. For
example, gcc will complain that StrFormat(_("%s"), 42) is ill-formed. */
@@ -182,7 +182,7 @@ class EE_API String {
;
/** Format a char buffer */
static void strFormat( char * Buffer, int BufferSize, const char * format, ... );
static void formatBuffer( char * Buffer, int BufferSize, const char * format, ... );
/** @brief Construct from an UTF-8 string to UTF-32 according
** @param utf8String UTF-8 string to convert

View File

@@ -19,6 +19,7 @@
#include <eepp/scene/actions/resize.hpp>
#include <eepp/scene/actions/resizewidth.hpp>
#include <eepp/scene/actions/resizeheight.hpp>
#include <eepp/scene/actions/resizeborderradius.hpp>
#endif

View File

@@ -0,0 +1,28 @@
#ifndef EE_SCENE_RESIZEBORDERRADIUS_HPP
#define EE_SCENE_RESIZEBORDERRADIUS_HPP
#include <eepp/scene/action.hpp>
#include <eepp/scene/actions/actioninterpolation1d.hpp>
namespace EE { namespace Scene { namespace Actions {
class EE_API ResizeBorderRadius : public ActionInterpolation1d {
public:
static ResizeBorderRadius * New( const Float& start, const Float& end, const Time& duration, const Ease::Interpolation& type = Ease::Linear );
Action * clone() const override;
Action * reverse() const override;
protected:
ResizeBorderRadius();
ResizeBorderRadius( const Float & start, const Float & end, const Time & duration, const Ease::Interpolation & type );
void onStart() override;
void onUpdate( const Time& time ) override;
};
}}}
#endif

View File

@@ -105,9 +105,13 @@ class EE_API UINode : public Node {
Color getBackgroundColor();
UINode * setBackgroundCorners( const Uint32 & state, const unsigned int& corners );
UINode * setBorderRadius( const Uint32 & state, const unsigned int& corners );
UINode * setBackgroundCorners( const unsigned int& corners );
UINode * setBorderRadius( const unsigned int& corners );
Uint32 getBorderRadius( const Uint32& state );
Uint32 getBorderRadius();
UISkin * setForegroundFillEnabled( bool enabled );
@@ -123,9 +127,9 @@ class EE_API UINode : public Node {
Color getForegroundColor();
UINode * setForegroundCorners( const Uint32 & state, const unsigned int& corners );
UINode * setForegroundRadius( const Uint32 & state, const unsigned int& corners );
UINode * setForegroundCorners( const unsigned int& corners );
UINode * setForegroundRadius( const unsigned int& corners );
RectangleDrawable * setBorderEnabled( bool enabled );

View File

@@ -219,6 +219,7 @@
../../include/eepp/scene/actions/move.hpp
../../include/eepp/scene/actions/paddingtransition.hpp
../../include/eepp/scene/actions/resize.hpp
../../include/eepp/scene/actions/resizeborderradius.hpp
../../include/eepp/scene/actions/resizeheight.hpp
../../include/eepp/scene/actions/resizewidth.hpp
../../include/eepp/scene/actions/rotate.hpp
@@ -645,6 +646,7 @@
../../src/eepp/scene/actions/move.cpp
../../src/eepp/scene/actions/paddingtransition.cpp
../../src/eepp/scene/actions/resize.cpp
../../src/eepp/scene/actions/resizeborderradius.cpp
../../src/eepp/scene/actions/resizeheight.cpp
../../src/eepp/scene/actions/resizewidth.cpp
../../src/eepp/scene/actions/rotate.cpp

View File

@@ -220,7 +220,7 @@ void String::insertChar( String& str, const unsigned int& pos, const Uint32& tch
str.insert( str.begin() + pos, tchar );
}
void String::strFormat( char * Buffer, int BufferSize, const char * format, ... ) {
void String::formatBuffer( char * Buffer, int BufferSize, const char * format, ... ) {
va_list args;
va_start( args, format );
#ifdef EE_COMPILER_MSVC
@@ -231,7 +231,7 @@ void String::strFormat( char * Buffer, int BufferSize, const char * format, ...
va_end( args );
}
std::string String::strFormated( const char * format, ... ) {
std::string String::format( const char * format, ... ) {
int n, size = 256;
std::string tstr( size, '\0' );

View File

@@ -16,7 +16,7 @@ Uint32 Version::getVersionNum() {
std::string Version::getVersionName() {
Version ver = getVersion();
return String::strFormated( "eepp version %d.%d.%d", ver.major, ver.minor, ver.patch );
return String::format( "eepp version %d.%d.%d", ver.major, ver.minor, ver.patch );
}
std::string Version::getCodename() {

View File

@@ -40,7 +40,7 @@ void RectangleDrawable::draw() {
draw( mPosition );
}
void RectangleDrawable::draw(const Vector2f & position) {
void RectangleDrawable::draw(const Vector2f &) {
draw( mPosition, mSize );
}

View File

@@ -120,7 +120,7 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
// Test if name starts with 0 - 1
for ( i = 0; i < 2; i++ ) {
search = String::strFormated( "%s%d%s", name.c_str(), i, realext.c_str() );
search = String::format( "%s%d%s", name.c_str(), i, realext.c_str() );
if ( NULL == SearchInTextureAtlas )
tTextureRegion = getTextureRegionByName( search );
@@ -137,7 +137,7 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
// in case that name doesn't start with 0 - 1, we test with 00 - 01
if ( 0 == t ) {
for ( i = 0; i < 2; i++ ) {
search = String::strFormated( "%s%02d%s", name.c_str(), i, realext.c_str() );
search = String::format( "%s%02d%s", name.c_str(), i, realext.c_str() );
if ( NULL == SearchInTextureAtlas )
tTextureRegion = getTextureRegionByName( search );
@@ -154,7 +154,7 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
// in case that name doesn't start with 00 - 01, we test with 000 - 001
if ( 0 == t ) {
for ( i = 0; i < 2; i++ ) {
search = String::strFormated( "%s%03d%s", name.c_str(), i, realext.c_str() );
search = String::format( "%s%03d%s", name.c_str(), i, realext.c_str() );
if ( NULL == SearchInTextureAtlas )
tTextureRegion = getTextureRegionByName( search );
@@ -170,7 +170,7 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
if ( 0 == t ) {
for ( i = 0; i < 2; i++ ) {
search = String::strFormated( "%s%04d%s", name.c_str(), i, realext.c_str() );
search = String::format( "%s%04d%s", name.c_str(), i, realext.c_str() );
if ( NULL == SearchInTextureAtlas )
tTextureRegion = getTextureRegionByName( search );
@@ -186,7 +186,7 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
if ( 0 == t ) {
for ( i = 0; i < 2; i++ ) {
search = String::strFormated( "%s%05d%s", name.c_str(), i, realext.c_str() );
search = String::format( "%s%05d%s", name.c_str(), i, realext.c_str() );
if ( NULL == SearchInTextureAtlas )
tTextureRegion = getTextureRegionByName( search );
@@ -202,7 +202,7 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
if ( 0 == t ) {
for ( i = 0; i < 2; i++ ) {
search = String::strFormated( "%s%06d%s", name.c_str(), i, realext.c_str() );
search = String::format( "%s%06d%s", name.c_str(), i, realext.c_str() );
if ( NULL == SearchInTextureAtlas )
tTextureRegion = getTextureRegionByName( search );
@@ -224,12 +224,12 @@ std::vector<TextureRegion*> TextureAtlasManager::getTextureRegionsByPattern( con
if ( 0 != t ) {
do {
switch ( t ) {
case 1: search = String::strFormated( "%s%d%s", name.c_str(), c, realext.c_str() ); break;
case 2: search = String::strFormated( "%s%02d%s", name.c_str(), c, realext.c_str() ); break;
case 3: search = String::strFormated( "%s%03d%s", name.c_str(), c, realext.c_str() ); break;
case 4: search = String::strFormated( "%s%04d%s", name.c_str(), c, realext.c_str() ); break;
case 5: search = String::strFormated( "%s%05d%s", name.c_str(), c, realext.c_str() ); break;
case 6: search = String::strFormated( "%s%06d%s", name.c_str(), c, realext.c_str() ); break;
case 1: search = String::format( "%s%d%s", name.c_str(), c, realext.c_str() ); break;
case 2: search = String::format( "%s%02d%s", name.c_str(), c, realext.c_str() ); break;
case 3: search = String::format( "%s%03d%s", name.c_str(), c, realext.c_str() ); break;
case 4: search = String::format( "%s%04d%s", name.c_str(), c, realext.c_str() ); break;
case 5: search = String::format( "%s%05d%s", name.c_str(), c, realext.c_str() ); break;
case 6: search = String::format( "%s%06d%s", name.c_str(), c, realext.c_str() ); break;
default: found = false;
}

View File

@@ -120,7 +120,7 @@ void TileMap::createEmptyTile() {
//! I create a texture representing an empty tile to render instead of rendering with primitives because is a lot faster, at least with NVIDIA GPUs.
TextureFactory * TF = TextureFactory::instance();
std::string tileName( String::strFormated( "maptile-%dx%d-%ul", mTileSize.getWidth(), mTileSize.getHeight(), mGridLinesColor.getValue() ) );
std::string tileName( String::format( "maptile-%dx%d-%ul", mTileSize.getWidth(), mTileSize.getHeight(), mGridLinesColor.getValue() ) );
Texture * Tex = TF->getByName( tileName );

View File

@@ -0,0 +1,43 @@
#include <eepp/scene/actions/resizeborderradius.hpp>
#include <eepp/scene/node.hpp>
#include <eepp/ui/uiwidget.hpp>
using namespace EE::UI;
namespace EE { namespace Scene { namespace Actions {
ResizeBorderRadius * ResizeBorderRadius::New( const Float & start, const Float & end, const Time& duration, const Ease::Interpolation& type ) {
return eeNew( ResizeBorderRadius, ( start, end, duration, type ) );
}
ResizeBorderRadius::ResizeBorderRadius()
{}
ResizeBorderRadius::ResizeBorderRadius( const Float & start, const Float & end, const Time& duration, const Ease::Interpolation& type ) {
mInterpolation.clear().add( start, duration ).add( end ).setType( type );
}
void ResizeBorderRadius::onStart() {
onUpdate( Time::Zero );
}
void ResizeBorderRadius::onUpdate( const Time& ) {
if ( NULL != mNode && mNode->isWidget() ) {
UIWidget * widget = static_cast<UIWidget*>( mNode );
widget->setBorderRadius( widget->getStyleState(), mInterpolation.getPosition() );
}
}
Action * ResizeBorderRadius::clone() const {
ResizeBorderRadius * action = eeNew( ResizeBorderRadius, () );
action->setInterpolation( mInterpolation );
return action;
}
Action * ResizeBorderRadius::reverse() const {
ResizeBorderRadius * action = eeNew( ResizeBorderRadius, () );
action->setInterpolation( Interpolation1d( mInterpolation.getReversePoints() ) );
return action;
}
}}}

View File

@@ -308,14 +308,14 @@ bool IniFile::setValue ( std::string const keyname, std::string const valuename,
bool IniFile::setValueI ( std::string const keyname, std::string const valuename, int const value, bool create ) {
char svalue[MAX_VALUEDATA];
String::strFormat( svalue, MAX_VALUEDATA, "%d", value );
String::formatBuffer( svalue, MAX_VALUEDATA, "%d", value );
return setValue ( keyname, valuename, svalue, create );
}
bool IniFile::setValueF ( std::string const keyname, std::string const valuename, double const value, bool create ) {
char svalue[MAX_VALUEDATA];
String::strFormat ( svalue, MAX_VALUEDATA, "%f", value );
String::formatBuffer ( svalue, MAX_VALUEDATA, "%f", value );
return setValue ( keyname, valuename, svalue, create );
}
@@ -354,7 +354,7 @@ std::string IniFile::getValue ( std::string const keyname, std::string const val
int IniFile::getValueI ( std::string const keyname, std::string const valuename, int const defValue ) const {
char svalue[MAX_VALUEDATA];
String::strFormat ( svalue, MAX_VALUEDATA, "%d", defValue );
String::formatBuffer ( svalue, MAX_VALUEDATA, "%d", defValue );
return atoi ( getValue ( keyname, valuename, svalue ).c_str() );
}
@@ -367,7 +367,7 @@ bool IniFile::getValueB(const std::string keyname, const std::string valuename,
double IniFile::getValueF ( std::string const keyname, std::string const valuename, double const defValue ) const {
char svalue[MAX_VALUEDATA];
String::strFormat ( svalue, MAX_VALUEDATA, "%f", defValue );
String::formatBuffer ( svalue, MAX_VALUEDATA, "%f", defValue );
return atof ( getValue ( keyname, valuename, svalue ).c_str() );
}

View File

@@ -235,7 +235,7 @@ void UINode::drawDebugData() {
UIWidget * me = static_cast<UIWidget*>( this );
if ( NULL != getEventDispatcher() && getEventDispatcher()->getOverControl() == this ) {
String text( String::strFormated( "X: %2.4f Y: %2.4f\nW: %2.4f H: %2.4f", mDpPos.x, mDpPos.y, mDpSize.x, mDpSize.y ) );
String text( String::format( "X: %2.4f Y: %2.4f\nW: %2.4f H: %2.4f", mDpPos.x, mDpPos.y, mDpSize.x, mDpSize.y ) );
if ( !mId.empty() ) {
text = "ID: " + mId + "\n" + text;
@@ -432,7 +432,7 @@ UINode * UINode::setBackgroundColor( const Color& color ) {
return setBackgroundColor( UIState::StateFlagNormal, color );
}
UINode * UINode::setBackgroundCorners( const Uint32 & state, const unsigned int& corners ) {
UINode * UINode::setBorderRadius( const Uint32 & state, const unsigned int& corners ) {
UISkin * background = setBackgroundFillEnabled( true );
Drawable * stateDrawable = background->getStateDrawable( state );
@@ -452,8 +452,28 @@ UINode * UINode::setBackgroundCorners( const Uint32 & state, const unsigned int&
return this;
}
UINode * UINode::setBackgroundCorners( const unsigned int& corners ) {
return setBackgroundCorners( UIState::StateFlagNormal, corners );
Uint32 UINode::getBorderRadius( const Uint32& state ) {
if ( NULL != mBackgroundState && NULL != mBackgroundState->getSkin() ) {
Drawable * stateDrawable = mBackgroundState->getSkin()->getStateDrawable( state );
if ( NULL != stateDrawable ) {
if ( stateDrawable->getDrawableType() == Drawable::RECTANGLE ) {
RectangleDrawable * rectangleDrawable = static_cast<RectangleDrawable*>( stateDrawable );
return rectangleDrawable->getCorners();
}
}
}
return 0;
}
Uint32 UINode::getBorderRadius() {
return getBorderRadius( UIState::StateFlagNormal );
}
UINode * UINode::setBorderRadius( const unsigned int& corners ) {
return setBorderRadius( UIState::StateFlagNormal, corners );
}
UISkin * UINode::setForegroundFillEnabled( bool enabled ) {
@@ -506,7 +526,7 @@ UINode * UINode::setForegroundColor( const Color& color ) {
return setForegroundColor( UIState::StateFlagNormal, color );
}
UINode * UINode::setForegroundCorners( const Uint32& state, const unsigned int& corners ) {
UINode * UINode::setForegroundRadius( const Uint32& state, const unsigned int& corners ) {
UISkin * foreground = setForegroundFillEnabled( true );
Drawable * stateDrawable = foreground->getStateDrawable( state );
@@ -526,8 +546,8 @@ UINode * UINode::setForegroundCorners( const Uint32& state, const unsigned int&
return this;
}
UINode * UINode::setForegroundCorners( const unsigned int& corners ) {
return setForegroundCorners( UIState::StateFlagNormal, corners );
UINode * UINode::setForegroundRadius( const unsigned int& corners ) {
return setForegroundRadius( UIState::StateFlagNormal, corners );
}
RectangleDrawable * UINode::setBorderEnabled( bool enabled ) {

View File

@@ -608,7 +608,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) {
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%.2f", mDpSize.getWidth() ) );
SAVE_NORMAL_STATE_ATTR( String::format( "%.2f", mDpSize.getWidth() ) );
Action * action = Actions::MoveCoordinate::New( getPosition().x, newX, transitionInfo.duration, transitionInfo.timingFunction, Actions::MoveCoordinate::CoordinateX );
@@ -628,7 +628,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) {
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%.2f", mDpSize.getWidth() ) );
SAVE_NORMAL_STATE_ATTR( String::format( "%.2f", mDpSize.getWidth() ) );
Action * action = Actions::MoveCoordinate::New( getPosition().y, newY, transitionInfo.duration, transitionInfo.timingFunction, Actions::MoveCoordinate::CoordinateY );
@@ -648,7 +648,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) {
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%.2f", mDpSize.getWidth() ) );
SAVE_NORMAL_STATE_ATTR( String::format( "%.2f", mDpSize.getWidth() ) );
Action * action = Actions::ResizeWidth::New( getSize().getWidth(), newWidth, transitionInfo.duration, transitionInfo.timingFunction );
@@ -668,7 +668,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) {
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%.2f", mDpSize.getHeight() ) );
SAVE_NORMAL_STATE_ATTR( String::format( "%.2f", mDpSize.getHeight() ) );
Action * action = Actions::ResizeHeight::New( getSize().getHeight(), newHeight, transitionInfo.duration, transitionInfo.timingFunction );
@@ -732,8 +732,8 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
} else {
setForegroundColor( state, color );
}
} else if ( "foregroundcorners" == name ) {
setForegroundCorners( state, attribute.asUint() );
} else if ( "foregroundradius" == name ) {
setForegroundRadius( state, attribute.asUint() );
} else if ( "bordercolor" == name ) {
Color color = attribute.asColor();
@@ -754,8 +754,24 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
}
} else if ( "borderwidth" == name ) {
setBorderWidth( attribute.asDpDimensionI("1") );
} else if ( "bordercorners" == name || "backgroundcorners" == name ) {
setBackgroundCorners( state, attribute.asUint() );
} else if ( "borderradius" == name || "backgroundcorners" == name ) {
Uint32 borderRadius = attribute.asUint();
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) {
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) );
Uint32 start( getBorderRadius( getStylePreviousState() ) );
SAVE_NORMAL_STATE_ATTR( String::format( "%d", start ) );
Action * action = Actions::ResizeBorderRadius::New( start, borderRadius, transitionInfo.duration, transitionInfo.timingFunction );
if ( Time::Zero != transitionInfo.delay )
action = Actions::Sequence::New( Actions::Delay::New( transitionInfo.delay ), action );
runAction( action );
} else {
setBorderRadius( state, attribute.asUint() );
}
} else if ( "visible" == name ) {
setVisible( attribute.asBool() );
} else if ( "enabled" == name ) {
@@ -864,15 +880,15 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
NodeAttribute oldAttribute = mStyle->getAttribute( UIState::StateFlagNormal, attribute.getName() );
if ( oldAttribute.isEmpty() && mStyle->getPreviousState() == UIState::StateFlagNormal ) {
if ( "layout_margin" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%d %d %d %d", mLayoutMargin.Left, mLayoutMargin.Top, mLayoutMargin.Right, mLayoutMargin.Bottom ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d %d %d %d", mLayoutMargin.Left, mLayoutMargin.Top, mLayoutMargin.Right, mLayoutMargin.Bottom ) ) );
else if ( "layout_marginleft" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%d", mLayoutMargin.Left ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Left ) ) );
else if ( "layout_marginright" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%d", mLayoutMargin.Right ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Right ) ) );
else if ( "layout_margintop" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%d", mLayoutMargin.Top ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Top ) ) );
else if ( "layout_marginbottom" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%d", mLayoutMargin.Bottom ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Bottom ) ) );
}
if ( Time::Zero != transitionInfo.delay )
@@ -977,7 +993,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
Float newRotation( mStyle->getAttribute( state, attribute.getName() ).asFloat() );
Action * action = Actions::Rotate::New( mRotation, newRotation, transitionInfo.duration, transitionInfo.timingFunction );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%2.f", mRotation ) )
SAVE_NORMAL_STATE_ATTR( String::format( "%2.f", mRotation ) )
if ( Time::Zero != transitionInfo.delay )
action = Actions::Sequence::New( Actions::Delay::New( transitionInfo.delay ), action );
@@ -992,7 +1008,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
Vector2f newScale( mStyle->getAttribute( state, attribute.getName() ).asVector2f() );
Action * action = Actions::Scale::New( mScale, newScale, transitionInfo.duration, transitionInfo.timingFunction );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%2.f, %2.f", mScale.x, mScale.y ) )
SAVE_NORMAL_STATE_ATTR( String::format( "%2.f, %2.f", mScale.x, mScale.y ) )
if ( Time::Zero != transitionInfo.delay )
action = Actions::Sequence::New( Actions::Delay::New( transitionInfo.delay ), action );
@@ -1028,15 +1044,15 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
NodeAttribute oldAttribute = mStyle->getAttribute( UIState::StateFlagNormal, attribute.getName() );
if ( oldAttribute.isEmpty() && mStyle->getPreviousState() == UIState::StateFlagNormal ) {
if ( "padding" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%2.f %2.f %2.f %2.f", mPadding.Left, mPadding.Top, mPadding.Right, mPadding.Bottom ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f %2.f %2.f %2.f", mPadding.Left, mPadding.Top, mPadding.Right, mPadding.Bottom ) ) );
else if ( "paddingleft" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%2.f", mPadding.Left ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Left ) ) );
else if ( "paddingright" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%2.f", mPadding.Right ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Right ) ) );
else if ( "paddingtop" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%2.f", mPadding.Top ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Top ) ) );
else if ( "paddingbottom" == name )
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::strFormated( "%2.f", mPadding.Bottom ) ) );
mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Bottom ) ) );
}
if ( Time::Zero != transitionInfo.delay )
@@ -1053,7 +1069,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) );
Action * action = Actions::Fade::New( mAlpha, alpha, transitionInfo.duration, transitionInfo.timingFunction );
SAVE_NORMAL_STATE_ATTR( String::strFormated( "%2.f", mAlpha ) )
SAVE_NORMAL_STATE_ATTR( String::format( "%2.f", mAlpha ) )
if ( Time::Zero != transitionInfo.delay )
action = Actions::Sequence::New( Actions::Delay::New( transitionInfo.delay ), action );

View File

@@ -259,7 +259,7 @@ std::string WindowSDL::getVersion() {
SDL_GetVersion( &ver );
return String::strFormated( "SDL %d.%d.%d", ver.major, ver.minor, ver.patch );
return String::format( "SDL %d.%d.%d", ver.major, ver.minor, ver.patch );
}
void WindowSDL::createPlatform() {

View File

@@ -266,7 +266,7 @@ bool Window::takeScreenshot(std::string filepath, const Image::SaveType & Format
Ext = "." + Image::saveTypeToExtension( Format );
while ( !find && FileNum < 10000 ) {
TmpPath = String::strFormated( "%s%05d%s", filepath.c_str(), FileNum, Ext.c_str() );
TmpPath = String::format( "%s%05d%s", filepath.c_str(), FileNum, Ext.c_str() );
FileNum++;

View File

@@ -1663,7 +1663,7 @@ void EETest::render() {
if ( Sys::getTicks() - lasttick >= 50 ) {
lasttick = Sys::getTicks();
#ifdef EE_DEBUG
mInfo = String::strFormated( "EE - FPS: %d Frame Time: %4.2f\nMouse X: %d Mouse Y: %d\nTexture Memory Usage: %s\nApp Memory Usage: %s\nApp Peak Memory Usage: %s",
mInfo = String::format( "EE - FPS: %d Frame Time: %4.2f\nMouse X: %d Mouse Y: %d\nTexture Memory Usage: %s\nApp Memory Usage: %s\nApp Peak Memory Usage: %s",
mWindow->getFPS(),
et.asMilliseconds(),
(Int32)Mouse.x,