Some organisational prep work before I start working on a new navigation method (ie replacement for CardSelector). The current design was to allocate a CardSelector and pass in its pointer to a variety of classes via their constructors. To simplify things, now we use a singleton style pattern with an Instance() function - this means that when I implement a new class to replace CardSelector, I only need to modify what's returned by the singleton callback - as long as the new pointer class supports the same function calls, it'll be a straight drop-in.

This commit is contained in:
wrenczes@gmail.com
2010-10-22 08:41:44 +00:00
parent 84004c7c7f
commit e2de03d987
13 changed files with 177 additions and 118 deletions

View File

@@ -35,10 +35,9 @@ class GuiHand : public GuiLayer
const MTGHand* hand;
JQuad *back;
vector<CardView*> cards;
CardSelector* cs;
public:
GuiHand(CardSelector* cs, MTGHand* hand);
GuiHand(MTGHand* hand);
~GuiHand();
void Update(float dt);
bool isInHand(CardView*);
@@ -49,7 +48,7 @@ class GuiHand : public GuiLayer
class GuiHandOpponent : public GuiHand
{
public:
GuiHandOpponent(CardSelector* cs, MTGHand* hand);
GuiHandOpponent(MTGHand* hand);
virtual void Render();
virtual int receiveEventPlus(WEvent* e);
virtual int receiveEventMinus(WEvent* e);
@@ -66,7 +65,7 @@ class GuiHandSelf : public GuiHand
Pos backpos;
public:
GuiHandSelf(CardSelector* cs, MTGHand* hand);
GuiHandSelf(MTGHand* hand);
~GuiHandSelf();
virtual int receiveEventPlus(WEvent* e);
virtual int receiveEventMinus(WEvent* e);