diff options
| author | Japa | 2010-04-09 14:24:27 +0000 |
|---|---|---|
| committer | Japa | 2010-04-09 14:24:27 +0000 |
| commit | 114df922d3073bd296b38cf522997f520fb17850 (patch) | |
| tree | c4cf372825118c3663cd77e18c69a6c3b59d070f /ConditionalSprite.h | |
| parent | 81aefc8e03ff3f647494012e18bcdc8f33f4de42 (diff) | |
| download | stonesense-114df922d3073bd296b38cf522997f520fb17850.tar.gz stonesense-114df922d3073bd296b38cf522997f520fb17850.tar.bz2 stonesense-114df922d3073bd296b38cf522997f520fb17850.tar.xz | |
updated trunk to the new graphics engine, and the latest DFhack
Diffstat (limited to 'ConditionalSprite.h')
| -rw-r--r-- | ConditionalSprite.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/ConditionalSprite.h b/ConditionalSprite.h new file mode 100644 index 0000000..56ac1e1 --- /dev/null +++ b/ConditionalSprite.h @@ -0,0 +1,75 @@ +#pragma once
+
+#include "BlockCondition.h"
+
+// generic superclass
+class SpriteNode
+{
+ public:
+ SpriteNode(void){};
+ virtual ~SpriteNode(void){};
+
+ // this returns true if the sprite matched, and also adds
+ // sprites to the block as required
+ virtual bool BlockMatches(Block* b)=0;
+ // adds a child if appropriate (vestigial in some cases)
+ virtual void addChild(SpriteNode* child){};
+};
+
+// root nesting structure
+class RootBlock : public SpriteNode
+{
+ vector<SpriteNode*> children;
+
+ public:
+ RootBlock(void);
+ ~RootBlock(void);
+
+ bool BlockMatches(Block* b);
+ void addChild(SpriteNode* child);
+};
+
+// nesting conditional structure
+class SpriteBlock : public ConditionalNode, public SpriteNode
+{
+ BlockCondition* conditions;
+ vector<SpriteNode*> children;
+ SpriteNode* elsenode;
+
+ public:
+ SpriteBlock(void);
+ ~SpriteBlock(void);
+
+ bool BlockMatches(Block* b);
+ bool addCondition(BlockCondition* cond);
+ void addChild(SpriteNode* child);
+ void addElse(SpriteNode* child);
+};
+
+// rotational conditional structure
+class RotationBlock : public ConditionalNode, public SpriteNode
+{
+ vector<SpriteNode*> children;
+
+ public:
+ RotationBlock(void);
+ ~RotationBlock(void);
+
+ bool BlockMatches(Block* b);
+ bool addCondition(BlockCondition* cond);
+ void addChild(SpriteNode* child);
+};
+
+// display element
+class SpriteElement : public SpriteNode
+{
+private:
+
+public:
+ t_SpriteWithOffset sprite;
+
+ SpriteElement(void);
+ ~SpriteElement(void){};
+
+ bool BlockMatches(Block* b);
+};
|
