--===============1945757577== Content-Type: multipart/signed; boundary="nextPart1845174.txNxlt5HZy"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1845174.txNxlt5HZy Content-Type: multipart/mixed; boundary="Boundary-01=_0yA5HIp4RHOyGgG" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_0yA5HIp4RHOyGgG Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 21 March 2008, Ian Wadham wrote: > the X-server, for example. Also try exporting QT_FLUSH_PAINT > and observing how much of your view is being re-painted. the only unnecessary repaints i see is that on every pellet eaten not one i= s=20 the score repainted, but the number of lives and the level. really, only th= e=20 number next to the Score: label needs to be. so it's not a large area, but= =20 those repaints are completely unecessary. the attached patch fixes that, and also changes the ItemIndexMethod to NoIn= dex=20 in the scene which is more appropriate for non-static scenes. yes, i am feeling slightly bored and unmotivated today.. it is easter holid= ay=20 after all ;) > using QGraphicsView or KGameCanvas or QPainter direct? QGraphicsView =2D-=20 Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Trolltech --Boundary-01=_0yA5HIp4RHOyGgG Content-Type: text/x-diff; charset="us-ascii"; name="small_kapman_improvements.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="small_kapman_improvements.diff" Index: game.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- game.cpp (revision 786478) +++ game.cpp (working copy) @@ -240,7 +240,7 @@ // Cheat code to get one more life if (p_event->modifiers() =3D=3D Qt::AltModifier | Qt::ControlModifier |= Qt::ShiftModifier) { m_lives++; =2D emit(updatingInfos()); + emit(updatingInfos(LivesInfo)); } default: break; @@ -303,7 +303,7 @@ =20 void Game::kapmanDeath() { m_lives --; =2D emit(updatingInfos()); + emit(updatingInfos(LivesInfo)); emit(sDisableDisplayBonus()); =09 =09 @@ -358,7 +358,7 @@ }=09 =09 // Update view =2D emit(updatingInfos()); + emit(updatingInfos(ScoreInfo)); } =20 void Game::nextLevel() { @@ -369,7 +369,7 @@ // Increase the ghosts speed Ghost::increaseGhostsSpeed(0.05); // To update the score, level and lives labels =2D emit(updatingInfos()); + emit(updatingInfos(AllInfo)); // To reinit the maze items emit(leveled()); m_maze->resetNbElem(); Index: gamescene.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- gamescene.h (revision 786478) +++ gamescene.h (working copy) @@ -114,7 +114,7 @@ /** * Upadate the score and lives labels */ =2D void updateInfos(); + void updateInfos(Game::InformationTypes); }; =20 #endif Index: game.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- game.h (revision 786478) +++ game.h (working copy) @@ -85,6 +85,13 @@ =20 public: =20 + enum Information { NoInfo =3D 0, + ScoreInfo =3D 1, + LivesInfo =3D 2, + LevelInfo =3D 4, + AllInfo =3D ScoreInfo | LivesInfo | LevelInfo }; + Q_DECLARE_FLAGS(InformationTypes, Information); + /** * Creates a new Game instance */ @@ -264,7 +271,7 @@ /** * Signals to the scene to update the score and lives' labels */ =2D void updatingInfos(); + void updatingInfos(Game::InformationTypes types); =20 /** * Signal to the kapmanmainwindow to start a newgame when there isn't mo= re lives or when a level is finished Index: gamescene.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- gamescene.cpp (revision 786478) +++ gamescene.cpp (working copy) @@ -22,7 +22,8 @@ #include "bonus.h" =20 GameScene::GameScene(Game * p_game) : m_game(p_game) { =2D=09 + setItemIndexMethod(NoIndex); + // Create the 'PAUSE' label m_pauseLabel =3D new QGraphicsTextItem( ki18n("PAUSED").toString() ); m_pauseLabel->setFont( QFont("Helvetica", 35, QFont::Bold, false) ); @@ -112,7 +113,7 @@ m_levelLabel->setZValue(3); =20 // Init the score, lives and level labels =2D updateInfos(); + updateInfos(Game::AllInfo); =20 // Connect managePause signal to the scene connect(p_game, SIGNAL(managePause(bool)), this, SLOT(managePause(bool))); @@ -127,7 +128,8 @@ // Connect disableDisplayBonus signal to the scene connect(p_game, SIGNAL(sDisableDisplayBonus()), this, SLOT(killBonus())); // Connect the kapman to the "updateInfos()" slot =2D connect(p_game, SIGNAL(updatingInfos()), this, SLOT(updateInfos())); + connect(p_game, SIGNAL(updatingInfos(Game::InformationTypes)), this, + SLOT(updateInfos(Game::InformationTypes))); // Reinit the items on level completed connect(p_game, SIGNAL(leveled()), this, SLOT(initItems())); =20 @@ -155,18 +157,24 @@ delete[] m_elementItemList; } =20 =2Dvoid GameScene::updateInfos() { =2D QString lives("Lives : "); =2D lives +=3D QString::number((int)m_game->getLives()); =2D m_livesLabel->setPlainText(lives); +void GameScene::updateInfos(Game::InformationTypes info) { + if (info & Game::LivesInfo) { + QString lives("Lives : "); + lives +=3D QString::number((int)m_game->getLives()); + m_livesLabel->setPlainText(lives); + } =20 =2D QString score("Score : "); =2D score +=3D QString::number((double)m_game->getScore()); =2D m_scoreLabel->setPlainText(score); + if (info & Game::ScoreInfo) { + QString score("Score : "); + score +=3D QString::number((double)m_game->getScore()); + m_scoreLabel->setPlainText(score); + } =20 =2D QString level("Level : "); =2D level +=3D QString::number((int)m_game->getLevel()); =2D m_levelLabel->setPlainText(level); + if (info & Game::LevelInfo) { + QString level("Level : "); + level +=3D QString::number((int)m_game->getLevel()); + m_levelLabel->setPlainText(level); + } } =20 =20 --Boundary-01=_0yA5HIp4RHOyGgG-- --nextPart1845174.txNxlt5HZy Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQBH5Ay01rcusafx20MRAnC+AJ9cX0hIQtnvBsZxInJMNCEH8T7nvACggtoY 7rRruV5GDth7lbH66G/PKJ0= =prrK -----END PGP SIGNATURE----- --nextPart1845174.txNxlt5HZy-- --===============1945757577== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kde-games-devel mailing list kde-games-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-games-devel --===============1945757577==--