Some fixes.

--HG--
branch : dev
This commit is contained in:
Martí­n Lucas Golini
2017-02-27 04:14:21 -03:00
parent 7638f09aeb
commit 2048415772
8 changed files with 59 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -29,6 +29,8 @@ class EE_API UIProgressBar : public UIComplexControl {
UIProgressBar( const UIProgressBar::CreateParams& Params );
UIProgressBar();
virtual ~UIProgressBar();
virtual Uint32 getType() const;
@@ -55,9 +57,9 @@ class EE_API UIProgressBar : public UIComplexControl {
const bool& getVerticalExpand() const;
void setFillerMargin( const Rectf& margin );
void setFillerPadding( const Rectf& margin );
const Rectf& getFillerMargin() const;
const Rectf& getFillerPadding() const;
void setDisplayPercent( const bool& displayPercent );
@@ -68,7 +70,7 @@ class EE_API UIProgressBar : public UIComplexControl {
protected:
bool mVerticalExpand;
Vector2f mSpeed;
Rectf mFillerMargin;
Rectf mFillerPadding;
bool mDisplayPercent;
Float mProgress;

View File

@@ -368,15 +368,21 @@ bool TextureAtlasLoader::updateTextureAtlas( std::string TextureAtlasPath, std::
Int32 x, y, c;
Int32 NeedUpdate = 0;
EE_PIXEL_DENSITY pixelDensity = PD_MDPI;
FileSystem::dirPathAddSlashAtEnd( ImagesPath );
Uint32 z;
Uint32 totalSubTextures = 0;
for ( z = 0; z < mTempAtlass.size(); z++ )
for ( z = 0; z < mTempAtlass.size(); z++ ) {
totalSubTextures += mTempAtlass[z].Texture.SubTextureCount;
if ( mTempAtlass[z].Texture.SubTextureCount > 0 ) {
pixelDensity = (EE_PIXEL_DENSITY)mTempAtlass[z].SubTextures[0].PixelDensity;
}
}
Uint32 totalImages = 0;
std::vector<std::string> PathFiles = FileSystem::filesGetInPath( ImagesPath );
@@ -434,7 +440,7 @@ bool TextureAtlasLoader::updateTextureAtlas( std::string TextureAtlasPath, std::
std::string tapath( FileSystem::fileRemoveExtension( TextureAtlasPath ) + "." + Image::saveTypeToExtension( mTexGrHdr.Format ) );
if ( 2 == NeedUpdate ) {
TexturePacker tp( mTexGrHdr.Width, mTexGrHdr.Height, PD_MDPI, 0 != ( mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_POW_OF_TWO ), mTexGrHdr.PixelBorder, mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_ALLOW_FLIPPING );
TexturePacker tp( mTexGrHdr.Width, mTexGrHdr.Height, pixelDensity, 0 != ( mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_POW_OF_TWO ), mTexGrHdr.PixelBorder, mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_ALLOW_FLIPPING );
tp.addTexturesPath( ImagesPath );

View File

@@ -6,7 +6,7 @@ UIProgressBar::UIProgressBar( const UIProgressBar::CreateParams& Params ) :
UIComplexControl( Params ),
mVerticalExpand( Params.VerticalExpand ),
mSpeed( Params.MovementSpeed ),
mFillerMargin( Params.FillerMargin ),
mFillerPadding( Params.FillerMargin ),
mDisplayPercent( Params.DisplayPercent ),
mProgress( 0.f ),
mTotalSteps( 100.f ),
@@ -26,6 +26,28 @@ UIProgressBar::UIProgressBar( const UIProgressBar::CreateParams& Params ) :
applyDefaultTheme();
}
UIProgressBar::UIProgressBar() :
UIComplexControl(),
mVerticalExpand( true ),
mSpeed( 64.f, 0.f ),
mFillerPadding(),
mDisplayPercent( false ),
mProgress( 0.f ),
mTotalSteps( 100.f ),
mParallax( NULL )
{
setFlags( UI_AUTO_PADDING | UI_AUTO_SIZE );
mTextBox = eeNew( UITextBox, () );
mTextBox->setHorizontalAlign( UI_HALIGN_CENTER );
mTextBox->setParent( this );
mTextBox->setEnabled( false );
updateTextBox();
applyDefaultTheme();
}
UIProgressBar::~UIProgressBar() {
eeSAFE_DELETE( mParallax );
}
@@ -45,7 +67,7 @@ void UIProgressBar::draw() {
ColorA C( mParallax->getColor() );
C.Alpha = (Uint8)mAlpha;
Rectf fillerMargin = PixelDensity::dpToPx( mFillerMargin );
Rectf fillerMargin = PixelDensity::dpToPx( mFillerPadding );
mParallax->setColor( C );
mParallax->setPosition( Vector2f( mScreenPos.x + fillerMargin.Left, mScreenPos.y + fillerMargin.Top ) );
@@ -76,9 +98,16 @@ void UIProgressBar::setTheme( UITheme * Theme ) {
if ( Height > mRealSize.getHeight() )
Height = mRealSize.getHeight();
Rectf fillerMargin = PixelDensity::dpToPx( mFillerMargin );
if ( mFlags & UI_AUTO_PADDING ) {
Float meH = (Float)getSkinSize().getHeight();
Float otH = (Float)tSkin->getSize().getHeight();
Float res = Math::roundUp( ( meH - otH ) * 0.5f );
mFillerPadding = Rectf( res, res, res, res );
}
mParallax = eeNew( ScrollParallax, ( tSubTexture, Vector2f( mScreenPos.x + fillerMargin.Left, mScreenPos.y + fillerMargin.Top ), Sizef( ( ( mRealSize.getWidth() - fillerMargin.Left - fillerMargin.Right ) * mProgress ) / mTotalSteps, Height - fillerMargin.Top - fillerMargin.Bottom ), mSpeed ) );
Rectf fillerPadding = PixelDensity::dpToPx( mFillerPadding );
mParallax = eeNew( ScrollParallax, ( tSubTexture, Vector2f( mScreenPos.x + fillerPadding.Left, mScreenPos.y + fillerPadding.Top ), Sizef( ( ( mRealSize.getWidth() - fillerPadding.Left - fillerPadding.Right ) * mProgress ) / mTotalSteps, Height - fillerPadding.Top - fillerPadding.Bottom ), mSpeed ) );
}
}
}
@@ -101,9 +130,9 @@ void UIProgressBar::onSizeChange() {
if ( Height > mRealSize.getHeight() )
Height = mRealSize.getHeight();
Rectf fillerMargin = PixelDensity::dpToPx( mFillerMargin );
Rectf fillerPadding = PixelDensity::dpToPx( mFillerPadding );
mParallax->setSize( Sizef( ( ( mRealSize.getWidth() - fillerMargin.Left - fillerMargin.Right ) * mProgress ) / mTotalSteps, Height - fillerMargin.Top - fillerMargin.Bottom ) );
mParallax->setSize( Sizef( ( ( mRealSize.getWidth() - fillerPadding.Left - fillerPadding.Right ) * mProgress ) / mTotalSteps, Height - fillerPadding.Top - fillerPadding.Bottom ) );
}
updateTextBox();
@@ -135,7 +164,7 @@ void UIProgressBar::setMovementSpeed( const Vector2f& Speed ) {
mSpeed = Speed;
if ( NULL != mParallax )
mParallax->setSpeed( mSpeed );
mParallax->setSpeed( PixelDensity::dpToPx( mSpeed ) );
}
const Vector2f& UIProgressBar::getMovementSpeed() const {
@@ -154,15 +183,15 @@ const bool& UIProgressBar::getVerticalExpand() const {
return mVerticalExpand;
}
void UIProgressBar::setFillerMargin( const Rectf& margin ) {
mFillerMargin = margin;
void UIProgressBar::setFillerPadding( const Rectf& margin ) {
mFillerPadding = margin;
onPositionChange();
onSizeChange();
}
const Rectf& UIProgressBar::getFillerMargin() const {
return mFillerMargin;
const Rectf& UIProgressBar::getFillerPadding() const {
return mFillerPadding;
}
void UIProgressBar::setDisplayPercent( const bool& DisplayPercent ) {

View File

@@ -638,8 +638,13 @@ void EETest::createNewUI() {
listBox->setPosition( 50, 360 )->setSize( 200, 160 );
listBox->addListBoxItems( str );
UIProgressBar * progressBar = eeNew( UIProgressBar, () );
progressBar->setPosition( 50, 540 )->setSize( 200, 26 );
progressBar->setProgress( 60.f );
progressBar->setDisplayPercent( true );
UISprite * sprite = eeNew( UISprite, () );
sprite->setPosition( 50, 540 );
sprite->setPosition( 50, 600 );
sprite->setSprite( &SP );
UIScrollBar * scrollBar = eeNew( UIScrollBar, () );