mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
NinePatch fix.
--HG-- branch : dev-css-refactor
This commit is contained in:
@@ -112,15 +112,25 @@ TextureRegion * NinePatch::getTextureRegion( const int& side ) {
|
||||
}
|
||||
|
||||
void NinePatch::createFromTexture(const Uint32 & TexId, int left, int top, int right, int bottom) {
|
||||
mDrawable[ Left ] = TextureRegion::New( TexId, Rect( 0, top, left, mSize.getHeight() - bottom ) );
|
||||
mDrawable[ Right ] = TextureRegion::New( TexId, Rect( mSize.getWidth() - right, top, mSize.getWidth(), mSize.getHeight() - bottom ) );
|
||||
mDrawable[ Down ] = TextureRegion::New( TexId, Rect( left, mSize.getHeight() - bottom, mSize.getWidth() - right, mSize.getHeight() ) );
|
||||
mDrawable[ Up ] = TextureRegion::New( TexId, Rect( left, 0, mSize.getWidth() - right, top ) );
|
||||
mDrawable[ UpLeft ] = TextureRegion::New( TexId, Rect( 0, 0, left, top ) );
|
||||
mDrawable[ UpRight] = TextureRegion::New( TexId, Rect( mSize.getWidth() - right, 0, mSize.getWidth(), top ) );
|
||||
mDrawable[ DownLeft] = TextureRegion::New( TexId, Rect( 0, mSize.getHeight() - bottom, left, mSize.getHeight() ) );
|
||||
mDrawable[ DownRight ] = TextureRegion::New( TexId, Rect( mSize.getWidth() - right, mSize.getHeight() - bottom, mSize.getWidth(), mSize.getHeight() ) );
|
||||
mDrawable[ Center ] = TextureRegion::New( TexId, Rect( left, top, mSize.getWidth() - right, mSize.getHeight() - bottom ) );
|
||||
Rect r;
|
||||
r = Rect( 0, top, left, mSize.getHeight() - bottom );
|
||||
mDrawable[ Left ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( mSize.getWidth() - right, top, mSize.getWidth(), mSize.getHeight() - bottom );
|
||||
mDrawable[ Right ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( left, mSize.getHeight() - bottom, mSize.getWidth() - right, mSize.getHeight() );
|
||||
mDrawable[ Down ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( left, 0, mSize.getWidth() - right, top );
|
||||
mDrawable[ Up ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( 0, 0, left, top );
|
||||
mDrawable[ UpLeft ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( mSize.getWidth() - right, 0, mSize.getWidth(), top );
|
||||
mDrawable[ UpRight] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( 0, mSize.getHeight() - bottom, left, mSize.getHeight() );
|
||||
mDrawable[ DownLeft] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( mSize.getWidth() - right, mSize.getHeight() - bottom, mSize.getWidth(), mSize.getHeight() );
|
||||
mDrawable[ DownRight ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
r = Rect( left, top, mSize.getWidth() - right, mSize.getHeight() - bottom );
|
||||
mDrawable[ Center ] = TextureRegion::New( TexId, r, r.getSize().asFloat() );
|
||||
|
||||
mRect = Rect( left, top, right, bottom );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user