added Reward and Expiration to task list

moved text scroller into DeckMenu class since it is specific to DeckMenu and not GameStateDuel
added new util function "wordWrap"
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-03 00:15:12 +00:00
parent 685626128a
commit 4a3d7faf0a
8 changed files with 133 additions and 71 deletions
+10 -9
View File
@@ -5,18 +5,19 @@
#define _DeckMenu_H_
#include <string>
#include <JGui.h>
#include "WFont.h"
#include "hge/hgeparticle.h"
#include "DeckMetaData.h"
#include "TextScroller.h"
class DeckMenu:public JGuiController{
private:
protected:
int mHeight, mWidth, mX, mY;
int titleX, titleY, titleWidth;
int descX, descY, descHeight, descWidth;
int statsX, statsY, statsHeight, statsWidth;
int avatarX, avatarY;
int fontId;
std::string title;
@@ -26,23 +27,23 @@ class DeckMenu:public JGuiController{
float timeOpen;
static unsigned int refCount;
JQuad *background;
JTexture *backgroundTexture;
static WFont* titleFont;
static hgeParticleSystem* stars;
// This works only because of no multithreading
static PIXEL_TYPE jewelGraphics[9];
inline void MogrifyJewel();
public:
TextScroller * scroller;
bool autoTranslate;
DeckMenu(int id, JGuiListener* listener, int fontId, const char * _title = "");
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "");
~DeckMenu();
void Render();
void Update(float dt);
void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
void Close();
void updateScroller();
float selectionTargetY;
bool closed;
-2
View File
@@ -7,7 +7,6 @@
#include "DeckMenu.h"
#include "MTGDeck.h"
#include "GameObserver.h"
#include "TextScroller.h"
#define CHOOSE_OPPONENT 7
@@ -33,7 +32,6 @@ class GameStateDuel: public GameState, public JGuiListener
DeckMenu * deckmenu;
DeckMenu * opponentMenu;
SimpleMenu * menu;
TextScroller * scroller;
bool premadeDeck;
int OpponentsDeckid;
string musictrack;
+3 -1
View File
@@ -18,6 +18,8 @@ protected:
float mY;
float start;
int timer;
int minimumItems;
vector<string> strings;
unsigned int currentId;
int mRandom;
@@ -27,7 +29,7 @@ public:
void Add(string text);
void Reset();
void setRandom(int mode = 1);
TextScroller(int fontId, float x, float y, float width, float speed = 30, int scrollerType = 0);
TextScroller(int fontId, float x, float y, float width, float speed = 30, int scrollerType = 0, int _minimumItems = 2);
void Render();
void Update(float dt);
virtual ostream& toString(ostream& out) const;
+1
View File
@@ -41,6 +41,7 @@ string& rtrim(string &str);
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
std::vector<std::string> split(const std::string &s, char delim); //splits a string with "delim" and returns a vector of strings.
std::string wordWrap(std::string s, int width);
int loadRandValues(string s);