Files
wagic/projects/mtg/include/ShopItem.h
wagic.jeck 0a863bcbad Jeck - [JGE recompile needed] Shop cleanup, Interface enhancements.
Added basic transition system that works with GameApp's phases. Currently does a fade-out between elements, which works well in some places and not-so-well in others. We'll definitely want to think about where and where not to use it... they'd work a lot better if we could spawn a thread to handle loading the next state while transitioning.

Also cleaned up the shop a bit, so it uses ReadButton() instead of GetButtonClick()-- hence the slight change to JGE. Added a tiled image for the task board, which loads conservatively (I tried 128x128, but it didn't look as good).
2010-02-01 18:27:25 +00:00

94 lines
2.2 KiB
C++

#ifndef _SHOP_ITEM_H
#define _SHOP_ITEM_H
#include <JGui.h>
#include <JLBFont.h>
#include "SimpleMenu.h"
#include "MTGDeck.h"
#include "../include/PriceList.h"
#include "../include/PlayerData.h"
#include "../include/CardDisplay.h"
#include "../include/DeckDataWrapper.h"
#include <string>
using std::string;
class hgeDistortionMesh;
#define SHOP_BOOSTERS 3
class ShopItem:public JGuiObject{
private:
friend class ShopItems;
bool mHasFocus;
bool mRelease;
JLBFont *mFont;
string mText;
float xy[8];
JQuad * quad;
JQuad * thumb;
float mScale;
float mTargetScale;
hgeDistortionMesh* mesh;
void updateThumb();
public:
int nameCount;
int quantity;
MTGCard * card;
int price;
ShopItem(int id, JLBFont * font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw);
ShopItem(int id, JLBFont * font, char* text, JQuad * _quad, JQuad * _thumb,float _xy[], bool hasFocus, int _price);
~ShopItem();
int updateCount(DeckDataWrapper * ddw);
virtual void Render();
virtual void Update(float dt);
virtual void Entering();
virtual bool Leaving(u32 key);
virtual bool ButtonPressed();
const char * getText();
virtual ostream& toString(ostream& out) const;
};
class ShopItems:public JGuiController,public JGuiListener{
private:
PlayerData * playerdata;
PriceList * pricelist;
int mX, mY, mHeight;
JLBFont* mFont;
JTexture * mBgAATex;
JQuad * mBgAA;
MTGAllCards * collection;
SimpleMenu * dialog;
int showPriceDialog;
int setIds[SHOP_BOOSTERS];
MTGCardInstance * displayCards[100];
CardDisplay * display;
void safeDeleteDisplay();
DeckDataWrapper * myCollection;
int lightAlpha;
int alphaChange;
public:
bool showCardList;
ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]);
~ShopItems();
void Render();
virtual void Update(float dt);
void Add(int cardid);
void Add(char * text, JQuad * quad, JQuad * thumb,int _price);
void pricedialog(int id, int mode=1);
virtual void ButtonPressed(int controllerId, int controlId);
bool CheckUserInput(u32 key);
void savePriceList();
void saveAll();
static float _x1[],_y1[],_x2[],_y2[],_x3[],_y3[],_x4[],_y4[];
};
#endif