summaryrefslogtreecommitdiffstats
path: root/kfouleggs/piece.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /kfouleggs/piece.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kfouleggs/piece.h')
-rw-r--r--kfouleggs/piece.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/kfouleggs/piece.h b/kfouleggs/piece.h
new file mode 100644
index 00000000..ba90e902
--- /dev/null
+++ b/kfouleggs/piece.h
@@ -0,0 +1,50 @@
+#ifndef PIECE_H
+#define PIECE_H
+
+#include "base/piece.h"
+
+
+class FEPieceInfo : public GPieceInfo
+{
+ public:
+ FEPieceInfo() {}
+
+ virtual uint nbBlocks() const { return NB_BLOCKS; }
+ virtual uint nbForms() const { return 1; }
+ virtual uint nbTypes() const
+ { return NB_NORM_BLOCK_TYPES * NB_NORM_BLOCK_TYPES; }
+
+ virtual const int *i(uint, uint rot) const { return FORM.i[rot]; }
+ virtual const int *j(uint, uint rot) const { return FORM.j[rot]; }
+ virtual uint value(uint type, uint n) const
+ { return (n%2 ? type/4 : type%4); }
+ virtual uint form(uint) const { return 0; }
+ virtual uint nbConfigurations(uint type) const
+ { return ((type%4)==(type/4) ? 2 : 4);}
+
+ virtual uint nbNormalBlockTypes() const { return NB_NORM_BLOCK_TYPES; }
+ virtual uint nbGarbageBlockTypes() const { return 1; }
+ virtual uint nbBlockModes() const { return NB_BLOCK_MODES; }
+
+ virtual uint nbColors() const { return NB_NORM_BLOCK_TYPES + 1; }
+ virtual QString colorLabel(uint i) const;
+ virtual QColor defaultColor(uint i) const;
+
+ private:
+ void draw(QPixmap *, uint blockType, uint blockMode, bool lighted) const;
+ void setMask(QPixmap *, uint blockMode) const;
+
+ enum { NB_BLOCKS = 2,
+ NB_NORM_BLOCK_TYPES = 4,
+ NB_BLOCK_MODES = 1+4+6+4+1 }; // all possible connections
+
+ struct Form {
+ int i[4][NB_BLOCKS];
+ int j[4][NB_BLOCKS];
+ };
+ static const Form FORM;
+
+ static const char *DEFAULT_COLORS[NB_NORM_BLOCK_TYPES + 1];
+};
+
+#endif