[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegames/kpat
From:       Stephan Kulow <coolo () kde ! org>
Date:       2006-10-31 21:05:33
Message-ID: 1162328733.675750.15868.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 600792 by coolo:

let draw 3 work at least a bit - the animations look unnatural though


 M  +25 -2     klondike.cpp  
 M  +2 -3      pile.h  


--- trunk/KDE/kdegames/kpat/klondike.cpp #600791:600792
@@ -33,10 +33,33 @@
 {
 public:
     KlondikePile( int _index, int _draw, DealerScene* parent)
-        : Pile(_index, parent), m_draw( _draw ) {}
+        : Pile(_index, parent), m_draw( _draw )
+    {
+    }
 
     int draw() const { return m_draw; }
 
+    virtual QSizeF cardOffset( const Card *card ) const { return QSizeF( 0, 0 ); }
+    virtual void relayoutCards()
+    {
+        m_relayoutTimer->stop();
+        int car = m_cards.count();
+        QPointF p = pos();
+        qreal z = zValue();
+        for (CardList::Iterator it = m_cards.begin(); it != m_cards.end(); ++it)
+        {
+            //kDebug() << "car " << car << " " << p << endl;
+            ( *it )->setPos( p );
+            ( *it )->setZValue( z );
+            z = z+1;
+            if ( car > m_draw )
+            {
+                --car;
+            } else
+                p.rx() += + 0.125 * cardMap::self()->wantedCardWidth();
+        }
+    }
+
 private:
     int m_draw;
 };
@@ -61,7 +84,7 @@
     // Move the visual representation of the pile to the intended position
     // on the game board.
 
-    pile->setAddFlags(Pile::disallow);
+    pile->setAddFlags( Pile::disallow );
     pile->setRemoveFlags(Pile::Default);
 
     for( int i = 0; i < 7; i++ ) {
--- trunk/KDE/kdegames/kpat/pile.h #600791:600792
@@ -144,7 +144,7 @@
 public slots:
     virtual bool cardClicked(Card *c);
     virtual bool cardDblClicked(Card *c);
-    void relayoutCards();
+    virtual void relayoutCards();
 
 signals:
     void clicked(Card *c);
@@ -154,6 +154,7 @@
     int       removeFlags;
     int       addFlags;
     CardList  m_cards;
+    QTimer *m_relayoutTimer;
 
 private:
     static QSvgRenderer *_renderer;
@@ -173,8 +174,6 @@
     QSizeF m_reserved;
     QSizeF m_space;
 
-    QTimer *m_relayoutTimer;
-
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic