Files
wagic/projects/mtg/include/Navigator.h
wrenczes@gmail.com 5a1e8e6ffe More reorganization work around CardSelector and the singleton pattern. Broke the source for the singleton into its own separate source file, to keep things clean. Also broke apart a circular header dependency: CardSelector defines and uses a SelectorZone, which is a member inside of CardView. CardView in turn is used heavily by CardSelector. Instead SelectorZone is now defined within CardView (where it's set & controlled anyway).
I've also added my current work on the zone navigation system (class Navigator) - it's currently turned off for now (the override for this is inside of CardSelectorSingleton's Instance() call, simply comment out the NEW CardSelector and uncomment out the NEW Navigator line.)  It's functional, but I want to do more testing before considering wiring it into the game options or something similar.  (Also, note that it currently doesn't support the mouse functionality added by DJardin.)

Lastly, there's a bug crash fix in ActionStack that I tripped across while testing - basically, an illegal index value would have us walk off the bounds of a vector.
2010-10-31 07:50:53 +00:00

61 lines
1.2 KiB
C++

#ifndef NAVIGATOR_H
#define NAVIGATOR_H
#include "JTypes.h"
#include "CardSelector.h"
#include "DuelLayers.h"
#include <map>
#include <vector>
// private class only used by Navigator, see implementation file
class CardZone;
class Navigator : public CardSelectorBase
{
public:
Navigator(DuelLayers* inDuelLayers);
virtual ~Navigator();
// Inherited functions from GuiLayer
bool CheckUserInput(JButton inKey);
bool CheckUserInput(int x, int y);
void Update(float dt);
void Render();
//Limitor operations
void PushLimitor();
void PopLimitor();
void Limit(LimitorFunctor<PlayGuiObject>* inLimitor, CardView::SelectorZone inZone);
virtual void Add(PlayGuiObject*);
virtual void Remove(PlayGuiObject*);
virtual void Push() {}
virtual void Pop() {}
protected:
PlayGuiObject* GetCurrentCard();
/**
** Helper function that translates a card type into an internal zone ID (used as the index for the card zone map)
*/
int CardToCardZone(PlayGuiObject* card);
void HandleKeyStroke(JButton inKey);
private:
std::map<int, CardZone*> mCardZones;
CardZone* mCurrentZone;
Pos mDrawPosition;
DuelLayers* mDuelLayers;
bool mLimitorEnabled;
std::stack<CardZone*> mCurrentZoneStack;
};
#endif //NAVIGATOR_H