mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Rotation is now set in the tilebank wrapper and applied when replacing a tile.
This commit is contained in:
parent
6c8ae2fafe
commit
1e9e492f0f
7 changed files with 28 additions and 5 deletions
|
@ -198,6 +198,7 @@ TileBank::TileBank()
|
|||
{
|
||||
m_pvt = new TileBankPvt();
|
||||
resetError();
|
||||
m_rotation = 0;
|
||||
}
|
||||
|
||||
TileBank::~TileBank()
|
||||
|
@ -378,6 +379,16 @@ bool TileBank::setTile( int tileset, int tile, const QString &name, const QVaria
|
|||
NL3D::CTileBorder border;
|
||||
m_pvt->buildBorder( pm, border );
|
||||
|
||||
if( ( type == TileConstants::TileTransition ) && ( channel == TileConstants::TileAlpha ) )
|
||||
{
|
||||
int rotBits = m_rotation;
|
||||
while( rotBits > 0 )
|
||||
{
|
||||
border.rotate();
|
||||
rotBits--;
|
||||
}
|
||||
}
|
||||
|
||||
QString msg;
|
||||
NL3D::CTileSet::TError error = m_pvt->checkTile( set, tile, type, border, channelToTBitmap( channel ), msg );
|
||||
|
||||
|
@ -387,7 +398,7 @@ bool TileBank::setTile( int tileset, int tile, const QString &name, const QVaria
|
|||
if( error == NL3D::CTileSet::addFirstA128128 )
|
||||
set->setBorder( channelToTBitmap( channel ), border );
|
||||
|
||||
m_pvt->setTile( set, tile, 0 /* rotation */, name, channelToTBitmap( channel ), type, border );
|
||||
m_pvt->setTile( set, tile, m_rotation, name, channelToTBitmap( channel ), type, border );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -618,6 +629,11 @@ QString TileBank::getTexturePath() const
|
|||
return m_pvt->m_bank.getAbsPath().c_str();
|
||||
}
|
||||
|
||||
void TileBank::setRotation( int rotation )
|
||||
{
|
||||
m_rotation = rotation;
|
||||
}
|
||||
|
||||
void TileBank::serial( NLMISC::IStream &f )
|
||||
{
|
||||
m_pvt->m_bank.serial( f );
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
void setTexturePath( const QString &path );
|
||||
QString getTexturePath() const;
|
||||
|
||||
void setRotation( int rotation );
|
||||
|
||||
void serial( NLMISC::IStream &f );
|
||||
|
||||
bool hasError() const{ return m_hasError; }
|
||||
|
@ -93,6 +95,7 @@ private:
|
|||
TileBankPvt *m_pvt;
|
||||
QString m_lastError;
|
||||
bool m_hasError;
|
||||
int m_rotation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -335,7 +335,7 @@ void TileEditorMainWindow::onZoomFactor(int level)
|
|||
|
||||
void TileEditorMainWindow::onRotate( int id )
|
||||
{
|
||||
TileItemNode::setAlphaRot( id * 90 );
|
||||
m_tileModel->setAlphaRot( id );
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onActionAddTile(bool triggered)
|
||||
|
|
|
@ -298,7 +298,6 @@ private:
|
|||
};
|
||||
|
||||
TileConstants::TTileChannel TileItemNode::s_displayChannel = TileConstants::TileDiffuse;
|
||||
int TileItemNode::s_alphaRot = 0;
|
||||
|
||||
TileItemNode::TileItemNode( TileConstants::TNodeTileType type, int tileId, Node *parent )
|
||||
{
|
||||
|
|
|
@ -117,7 +117,6 @@ public:
|
|||
|
||||
static void setDisplayChannel( TileConstants::TTileChannel channel ){ s_displayChannel = channel; }
|
||||
static TileConstants::TTileChannel displayChannel(){ return s_displayChannel; }
|
||||
static void setAlphaRot( int rot ){ s_alphaRot = rot; }
|
||||
|
||||
QVariant pixmap( TileConstants::TTileChannel channel ) const;
|
||||
|
||||
|
@ -126,7 +125,6 @@ private:
|
|||
QMap<TileConstants::TTileChannel, TileWidget*> m_tileWidget;
|
||||
|
||||
static TileConstants::TTileChannel s_displayChannel;
|
||||
static int s_alphaRot;
|
||||
|
||||
int m_id;
|
||||
|
||||
|
|
|
@ -472,6 +472,11 @@ QString TileModel::getTexturePath() const
|
|||
return m_tileBank->getTexturePath();
|
||||
}
|
||||
|
||||
void TileModel::setAlphaRot( int rotation )
|
||||
{
|
||||
m_tileBank->setRotation( rotation );
|
||||
}
|
||||
|
||||
QString TileModel::getLastError() const{
|
||||
return m_tileBank->getLastError();
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ public:
|
|||
void setTexturePath( const QString &path );
|
||||
QString getTexturePath() const;
|
||||
|
||||
void setAlphaRot( int rotation );
|
||||
|
||||
void serial( NLMISC::IStream &f );
|
||||
|
||||
QString getLastError() const;
|
||||
|
|
Loading…
Reference in a new issue