示例#1
0
文件: ball.cpp 项目: alasin/kbounce
KBounceBall::KBounceBall( KBounceRenderer* renderer, KBounceBoard* board )
: KGameRenderedItem(renderer,"", board ), m_renderer( renderer ), m_board( board ),
    m_soundDelay( 0 ), m_size( QSize( 16, 16 ) ), m_framesNum( 0 ), m_xPos( 0 ), m_yPos( 0 ) 
{
	setSpriteKey("ball");
	resetPixmaps();
	m_nextBoundingRect.setSize( QSizeF( BALL_RELATIVE_SIZE, BALL_RELATIVE_SIZE ) );
}
Explodable::Explodable(const QString& mainSvg, const QString& explosionSvg,
		qreal relativeWidth, qreal relativeHeight, KGameRenderer *renderer,
		BomberBoard *board) :
	KGameRenderedItem(renderer, mainSvg), m_board(board), m_mainSvg(
			mainSvg), m_explosionSvg(explosionSvg)
{
	setRenderSize(QSize(32, 64));
	m_relativeWidth = relativeWidth;
	m_relativeHeight = relativeHeight;
	resetPixmaps();
	m_state = Moving;
	m_nextBoundingRect.setSize(QSizeF(m_relativeWidth, m_relativeHeight));
	setPos(m_board->mapPosition(QPointF(m_xPos, m_yPos)));
}