mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Minor changes.
--HG-- branch : dev
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.0 KiB |
@@ -57,6 +57,10 @@ class EE_API UISkin {
|
||||
virtual UISkin * clone() = 0;
|
||||
|
||||
const Uint32& getType() const;
|
||||
|
||||
virtual Sizei getBorderSize( const Uint32 & state ) = 0;
|
||||
|
||||
virtual Sizei getBorderSize();
|
||||
protected:
|
||||
friend class UIControl;
|
||||
friend class UISkinState;
|
||||
|
||||
@@ -42,10 +42,13 @@ class EE_API UISkinComplex : public UISkin {
|
||||
virtual UISkin * clone();
|
||||
|
||||
Sizei getSize( const Uint32& state );
|
||||
|
||||
Sizei getBorderSize( const Uint32 &state );
|
||||
protected:
|
||||
SubTexture * mSubTexture[ UISkinState::StateCount ][ SideCount ];
|
||||
ColorA mTempColor;
|
||||
Sizei mSize[ UISkinState::StateCount ];
|
||||
Sizei mBorderSize[ UISkinState::StateCount ];
|
||||
|
||||
void cacheSize();
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ class EE_API UISkinSimple : public UISkin {
|
||||
virtual UISkin * clone();
|
||||
|
||||
Sizei getSize( const Uint32& state );
|
||||
|
||||
Sizei getBorderSize( const Uint32 & state );
|
||||
protected:
|
||||
SubTexture * mSubTexture[ UISkinState::StateCount ];
|
||||
ColorA mTempColor;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIMenuItem *UIMenuItem::New() {
|
||||
UIMenuItem * UIMenuItem::New() {
|
||||
return eeNew( UIMenuItem, () );
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,9 @@ void UIPushButton::onSizeChange() {
|
||||
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) ) {
|
||||
Int32 txtW = NULL != mTextBox ? PixelDensity::pxToDpI( mTextBox->getTextCache()->getTextWidth() ) : 0;
|
||||
Int32 minSize = txtW + ( NULL != mIcon ? mIcon->getSize().getWidth() : 0 ) + getSkinSize().getWidth();
|
||||
Int32 minSize = txtW + ( NULL != mIcon ? mIcon->getSize().getWidth() : 0 )
|
||||
+ mStyleConfig.IconHorizontalMargin + mTextBox->getPadding().Left + mTextBox->getPadding().Right +
|
||||
( NULL != getSkin() ? getSkin()->getBorderSize().getWidth() : 0 );
|
||||
|
||||
if ( minSize > mSize.getWidth() ) {
|
||||
setInternalWidth( minSize );
|
||||
|
||||
@@ -82,6 +82,10 @@ const Uint32& UISkin::getType() const {
|
||||
return mType;
|
||||
}
|
||||
|
||||
Sizei UISkin::getBorderSize() {
|
||||
return getBorderSize( UISkinState::StateNormal );
|
||||
}
|
||||
|
||||
bool UISkin::getColorDefault( const Uint32& State ) {
|
||||
return BitOp::readBitKey( &mColorDefault, State );
|
||||
}
|
||||
|
||||
@@ -217,10 +217,14 @@ Sizei UISkinComplex::getSize( const Uint32 & state ) {
|
||||
return mSize[ state ];
|
||||
}
|
||||
|
||||
Sizei UISkinComplex::getBorderSize(const Uint32 & state) {
|
||||
return mBorderSize[ state ];
|
||||
}
|
||||
|
||||
void UISkinComplex::cacheSize() {
|
||||
for ( Int32 state = UISkinState::StateNormal; state < UISkinState::StateCount; state++ ) {
|
||||
Int32 w = 0;
|
||||
Int32 h = 0;
|
||||
Int32 w = 0, bw = 0;
|
||||
Int32 h = 0, bh = 0;
|
||||
|
||||
SubTexture * tSubTexture = mSubTexture[ state ][ Center ];
|
||||
|
||||
@@ -233,27 +237,32 @@ void UISkinComplex::cacheSize() {
|
||||
|
||||
if ( NULL != tSubTexture ) {
|
||||
h += tSubTexture->getDpSize().y;
|
||||
bh += tSubTexture->getDpSize().y;
|
||||
}
|
||||
|
||||
tSubTexture = mSubTexture[ state ][ Down ];
|
||||
|
||||
if ( NULL != tSubTexture ) {
|
||||
h += tSubTexture->getDpSize().y;
|
||||
bh += tSubTexture->getDpSize().y;
|
||||
}
|
||||
|
||||
tSubTexture = mSubTexture[ state ][ Left ];
|
||||
|
||||
if ( NULL != tSubTexture ) {
|
||||
w += tSubTexture->getDpSize().x;
|
||||
bw += tSubTexture->getDpSize().x;
|
||||
}
|
||||
|
||||
tSubTexture = mSubTexture[ state ][ Right ];
|
||||
|
||||
if ( NULL != tSubTexture ) {
|
||||
w += tSubTexture->getDpSize().x;
|
||||
bw += tSubTexture->getDpSize().x;
|
||||
}
|
||||
|
||||
mSize[ state ] = Sizei( w, h );
|
||||
mBorderSize[ state ] = Sizei( bw, bh );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,4 +84,8 @@ Sizei UISkinSimple::getSize( const Uint32 & state ) {
|
||||
return Sizei();
|
||||
}
|
||||
|
||||
Sizei UISkinSimple::getBorderSize( const Uint32 & state ) {
|
||||
return Sizei();
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -246,7 +246,7 @@ void EETest::onShowMenu( const UIEvent * Event ) {
|
||||
if ( Menu->show() ) {
|
||||
Vector2i Pos = Vector2i( (Int32)PB->getPolygon()[0].x, (Int32)PB->getPolygon()[0].y - 2 );
|
||||
UIMenu::fixMenuPos( Pos , Menu );
|
||||
Menu->setPosition( Pos );
|
||||
Menu->setPosition( Sizei( (Float)Pos.x / PixelDensity::getPixelDensity(), (Float)Pos.y / PixelDensity::getPixelDensity() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,17 +475,23 @@ void EETest::createUI() {
|
||||
|
||||
Texture * butTex = TF->getTexture( TF->load( MyPath + "sprites/button-te_normal.png" ) );
|
||||
|
||||
SG->Add( butTex->getId(), "button-te_normal" );
|
||||
SG->Add( TF->load( MyPath + "sprites/button-te_mdown.png" ), "button-te_mdown" );
|
||||
SG->add( butTex->getId(), "button-te_normal" );
|
||||
SG->add( TF->load( MyPath + "sprites/button-te_mdown.png" ), "button-te_mdown" );
|
||||
|
||||
UISkinSimple nSkin( "button-te" );
|
||||
Sizei screenSize = UIManager::instance()->getMainControl()->getSize();
|
||||
|
||||
mShowMenu = UIPushButton::New();
|
||||
mShowMenu->setSize( butText->getSize() )->setPosition( mWindow->getWidth() - butTex->getWidth() - 20, mWindow->getHeight() - butTex->getHeight() - 10 );
|
||||
mShowMenu->setSkin( nSkin );
|
||||
|
||||
Sizei skinSize = mShowMenu->getSkinSize();
|
||||
|
||||
mShowMenu->setSize( mShowMenu->getSkinSize() )
|
||||
->setPosition( screenSize.getWidth() - skinSize.getWidth() - 20,
|
||||
screenSize.getHeight() - skinSize.getHeight() - 10 );
|
||||
mShowMenu->setText( "Show Menu" );
|
||||
mShowMenu->setAnchors( UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM );
|
||||
mShowMenu->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &EETest::OnShowMenu ) );
|
||||
mShowMenu->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &EETest::onShowMenu ) );
|
||||
#endif
|
||||
|
||||
C = reinterpret_cast<UIControlAnim*> ( C->getParent() );
|
||||
@@ -1931,7 +1937,7 @@ void EETest::physicsUpdate() {
|
||||
InputFinger * Finger = KM->getFingerIndex(i);
|
||||
mMousePoint[i] = cVectNew( Finger->x, Finger->y );
|
||||
cVect newPoint = tovect( cpvlerp( tocpv( mMousePoint_last[i] ), tocpv( mMousePoint[i] ), 0.25 ) );
|
||||
mMouseBody[i]->setPosition( newPoint );
|
||||
mMouseBody[i]->setPos( newPoint );
|
||||
mMouseBody[i]->setVel( ( newPoint - mMousePoint_last[i] ) * (cpFloat)mWindow->getFPS() );
|
||||
mMousePoint_last[i] = newPoint;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user