* Add missing files.
This commit is contained in:
jean.chalard
2009-08-22 06:01:52 +00:00
parent 3349f974f1
commit b2f75d45e7
21 changed files with 1625 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#ifndef _CARDSELECTOR_H_
#define _CARDSELECTOR_H_
#include <vector>
#include "GuiLayers.h"
#include "DuelLayers.h"
#include "Pos.h"
using std::vector;
class PlayGuiObject;
class DuelLayers;
template <typename T>
struct LimitorFunctor
{
virtual bool select(T*) = 0;
virtual bool greyout(T*) = 0;
typedef T Target;
};
template <typename T=PlayGuiObject>
class ObjectSelector : public GuiLayer
{
protected:
vector<T*> cards;
T* active;
bool showBig;
DuelLayers* duel;
LimitorFunctor<T>* limitor;
Pos bigpos;
public:
ObjectSelector(DuelLayers*);
void Add(T*);
void Remove(T*);
bool CheckUserInput(u32 key);
void Update(float dt);
void Render();
void Limit(LimitorFunctor<T>* limitor);
typedef T Target;
};
typedef ObjectSelector<> CardSelector;
typedef LimitorFunctor<CardSelector::Target> Limitor;
#endif
+31
View File
@@ -0,0 +1,31 @@
#ifndef _GUIAVATARS_H_
#define _GUIAVATARS_H_
#include "GuiLayers.h"
#include "CardSelector.h"
class GuiAvatar;
class GuiGraveyard;
class GuiLibrary;
class GuiAvatars : public GuiLayer
{
protected:
GuiAvatar* self, *opponent;
GuiGraveyard* selfGraveyard, *opponentGraveyard;
GuiLibrary* selfLibrary, *opponentLibrary;
CardSelector* cs;
GuiAvatar* active;
public:
GuiAvatars(CardSelector*);
~GuiAvatars();
// virtual void Render();
void Update(float dt);
void Activate(PlayGuiObject* c);
void Deactivate(PlayGuiObject* c);
int receiveEventPlus(WEvent*);
int receiveEventMinus(WEvent*);
};
#endif // _GUIAVATARS_H_
+18
View File
@@ -0,0 +1,18 @@
#ifndef _GUIBACKGROUND_H_
#define _GUIBACKGROUND_H_
#include "GuiLayers.h"
#include "WEvent.h"
class GuiBackground : public GuiLayer
{
protected:
JQuad* quad;
public:
GuiBackground();
~GuiBackground();
virtual void Render();
};
#endif // _GUIBACKGROUND_H_
+26
View File
@@ -0,0 +1,26 @@
#ifndef _GUICOMBAT_H_
#define _GUICOMBAT_H_
#include <vector>
#include "WEvent.h"
#include "CardGui.h"
#include "MTGCardInstance.h"
class GuiCombat : public GuiLayer
{
protected:
CardSelector* cs;
vector<MTGCardInstance*> attackers;
public:
GuiCombat(CardSelector* cs);
~GuiCombat();
virtual void Update(float dt);
virtual void Render();
virtual bool CheckUserInput(u32 key);
virtual int receiveEventPlus(WEvent* e);
virtual int receiveEventMinus(WEvent* e);
};
#endif // _GUICOMBAT_H_
+20
View File
@@ -0,0 +1,20 @@
#ifndef _GUIFRAME_H_
#define _GUIFRAME_H_
#include "GuiLayers.h"
class GuiFrame : public GuiLayer
{
protected:
JQuad* wood;
JQuad* gold1, *gold2, *goldGlow;
float step;
public:
GuiFrame();
~GuiFrame();
virtual void Render();
void Update(float dt);
};
#endif // _GUIFRAME_H_
+77
View File
@@ -0,0 +1,77 @@
#ifndef _GUIHAND_H_
#define _GUIHAND_H_
#include "GuiLayers.h"
#include "WEvent.h"
#include "MTGGameZones.h"
#include "CardGui.h"
#include "GuiHand.h"
#include "CardSelector.h"
class GuiHand;
struct HandLimitor : public Limitor
{
GuiHand* hand;
virtual bool select(Target*);
virtual bool greyout(Target*);
HandLimitor(GuiHand* hand);
};
class GuiHand : public GuiLayer
{
public:
static const float ClosedRowX = 459;
static const float LeftRowX = 420;
static const float RightRowX = 460;
static const float OpenX = 394;
static const float ClosedX = 494;
protected:
const MTGHand* hand;
JQuad *back;
vector<CardView*> cards;
CardSelector* cs;
public:
GuiHand(CardSelector* cs, MTGHand* hand);
~GuiHand();
void Update(float dt);
friend class HandLimitor;
};
class GuiHandOpponent : public GuiHand
{
public:
GuiHandOpponent(CardSelector* cs, MTGHand* hand);
virtual void Render();
virtual int receiveEventPlus(WEvent* e);
virtual int receiveEventMinus(WEvent* e);
};
class GuiHandSelf : public GuiHand
{
protected:
enum
{
Open,
Closed
} state;
float backpos;
public:
GuiHandSelf(CardSelector* cs, MTGHand* hand);
virtual int receiveEventPlus(WEvent* e);
virtual int receiveEventMinus(WEvent* e);
bool CheckUserInput(u32 key);
virtual void Render();
float LeftBoundary();
HandLimitor* limitor;
};
#endif // _GUIHAND_H_
+44
View File
@@ -0,0 +1,44 @@
#include "string.h"
#include <vector>
#include <hge/hgeparticle.h>
#include "config.h"
#include "JGE.h"
#include "MTGDefinitions.h"
#include "GameApp.h"
#include "GuiLayers.h"
class ManaIcon : public Pos
{
static const float DESTX;
static const float DESTY;
hgeParticleSystem* particleSys;
JQuad* icon;
float zoomP1, zoomP2, zoomP3, zoomP4, zoomP5, zoomP6;
float xP1, xP2, xP3;
float yP1, yP2, yP3;
float tP1;
float f;
public:
enum { ALIVE, WITHERING, DROPPING, DEAD } mode;
int color;
void Render();
void Update(float dt);
void Wither();
void Drop();
ManaIcon(int color, float x, float y);
~ManaIcon();
};
class GuiMana : public GuiLayer
{
protected:
vector<ManaIcon*> manas;
public:
GuiMana();
virtual void Render();
virtual void Update(float dt);
virtual int receiveEventPlus(WEvent * e);
virtual int receiveEventMinus(WEvent * e);
};
+87
View File
@@ -0,0 +1,87 @@
#ifndef _GUIPLAY_H_
#define _GUIPLAY_H_
#include "GuiLayers.h"
#include "CardGui.h"
class GuiPlay : public GuiLayer
{
public:
static const float HORZWIDTH = 300.0f;
static const float VERTHEIGHT = 80.0f;
typedef vector<CardView*>::iterator iterator;
protected:
class CardStack {
protected:
float baseX, baseY;
float x, y;
public:
void reset(float x, float y);
void Enstack(CardView*);
void RenderSpell(MTGCardInstance*, iterator begin, iterator end, float x, float y);
};
class HorzStack : public CardStack {
protected:
const float maxWidth;
float maxHeight;
public:
HorzStack(float width = HORZWIDTH);
void reset(float x, float y);
void Render(CardView*, iterator begin, iterator end);
void Enstack(CardView*);
};
class VertStack : public CardStack {
protected:
float maxHeight;
public:
VertStack(float height = VERTHEIGHT);
void Enstack(CardView*);
inline float nextX();
};
class BattleField : public HorzStack {
static const float HEIGHT;
unsigned attackers;
unsigned blockers;
unsigned currentAttacker;
float height;
public:
void addAttacker(MTGCardInstance*);
void removeAttacker(MTGCardInstance*);
void reset(float x, float y);
BattleField(float width = HORZWIDTH);
void EnstackAttacker(CardView*);
void EnstackBlocker(CardView*);
void Update(float dt);
void Render();
};
class Lands : public HorzStack {};
class Creatures : public HorzStack {};
class Spells : public VertStack {};
protected:
GameObserver* game;
Creatures selfCreatures, opponentCreatures;
BattleField battleField;
Lands selfLands, opponentLands;
Spells selfSpells, opponentSpells;
CardSelector* cs;
iterator end_spells;
vector<CardView*> cards;
public:
GuiPlay(GameObserver*, CardSelector*);
~GuiPlay();
virtual void Render();
void Replace();
void Update(float dt);
virtual int receiveEventPlus(WEvent * e);
virtual int receiveEventMinus(WEvent * e);
};
#endif // _GUIPLAY_H_
+69
View File
@@ -0,0 +1,69 @@
#ifndef _GUISTATIC_H_
#define _GUISTATIC_H_
#include "Player.h"
#include "MTGGameZones.h"
#include "CardDisplay.h"
#include "CardGui.h"
#include "GuiAvatars.h"
class TransientCardView;
struct GuiStatic : public PlayGuiObject{
GuiAvatars* parent;
GuiStatic(float desiredHeight, float x, float y, bool hasFocus, GuiAvatars* parent);
virtual void Entering();
virtual bool Leaving(u32 key);
};
struct GuiAvatar : public GuiStatic{
typedef enum { TOP_LEFT, BOTTOM_RIGHT } Corner;
static const unsigned Width = 35;
static const unsigned Height = 50;
protected:
int avatarRed;
int currentLife;
Corner corner;
public:
Player * player;
virtual void Render();
GuiAvatar(float x, float y, bool hasFocus, Player * player, Corner corner, GuiAvatars* parent);
virtual ostream& toString(ostream& out) const;
};
struct GuiGameZone : public GuiStatic{
static const int Width = 20;
static const int Height = 25;
vector<TransientCardView*> cards;
public:
MTGGameZone * zone;
CardDisplay * cd;
int showCards;
virtual void Render();
virtual void Update(float dt);
GuiGameZone(float x, float y, bool hasFocus, MTGGameZone * zone, GuiAvatars* parent);
~GuiGameZone();
virtual void ButtonPressed(int controllerId, int controlId);
void toggleDisplay();
virtual ostream& toString(ostream& out) const;
};
class GuiGraveyard: public GuiGameZone{
public:
Player * player;
GuiGraveyard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
int receiveEventPlus(WEvent*);
int receiveEventMinus(WEvent*);
virtual ostream& toString(ostream& out) const;
};
class GuiLibrary: public GuiGameZone{
public:
Player * player;
GuiLibrary(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
virtual ostream& toString(ostream& out) const;
};
#endif // _GUISTATIC_H_
+11
View File
@@ -0,0 +1,11 @@
#ifndef _OSD_H_
#define _OSD_H_
class OSDLayer : public PlayGuiObjectController
{
virtual void Update(float dt);
virtual bool CheckUserInput(u32 key);
virtual void Render();
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef _POS_H_
#define _POS_H_
#include "JGE.h"
struct Pos {
float actX, actY, actZ, actT, actA;
float x, y, zoom, t, alpha;
Pos(float, float, float, float, float);
virtual void Update(float dt);
virtual void Render();
void Render(JQuad*);
};
#endif // _POS_H_