Extended Scroll() and OnScroll() to also take in magnitude as one of its parameters. magnitude is currently used in the deck editor to figure out how many cards to rotate around per swipe as function of velocity and the number of cards displayed on the screen.

fixed a compiler warning in SimplePopup in the constructor declaration
===DECK Editor changes ===
Added two touch buttons , one for "Sell Card", the other to switch between Deck and Collection.
changed swipe Left/Right to rotate card collection; removing the previous action which was to swap between deck/collection viewing

Note: GameStateDeckViewer isn't a JGuiController so can't leverage off the mButtons vector.  Thus, the buttons have to be handled by this class separately. (setButtonState, userPressedButton)
This commit is contained in:
techdragon.nguyen@gmail.com
2012-01-26 13:53:03 +00:00
parent dda048c616
commit a2179017d4
20 changed files with 159 additions and 75 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ public:
virtual void Pause();
virtual void Resume();
virtual void OnScroll(int inXVelocity, int inYVelocity);
virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0);
void LoadGameStates();
void SetNextState(int state);
+1 -1
View File
@@ -56,7 +56,7 @@ public:
virtual void Start(){}
virtual void End(){}
virtual void OnScroll(int inXVelocity, int inYVelocity)
virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0)
{
}
+1 -1
View File
@@ -35,7 +35,7 @@ public:
virtual void Update(float dt);
virtual void Render();
virtual void ButtonPressed(int controllerId, int controlId);
virtual void OnScroll(int inXVelocity, int inYVelocity);
virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0);
};
#endif
+8 -1
View File
@@ -17,6 +17,7 @@
#include "DeckStats.h"
#include "WDataSrc.h"
#include "WGui.h"
#include "InteractiveButton.h"
#define NO_USER_ACTIVITY_HELP_DELAY 10
#define NO_USER_ACTIVITY_SHOWCARD_DELAY 0.1
@@ -95,6 +96,8 @@ private:
int lastPos;
int lastTotal;
int mSelected;
InteractiveButton *toggleDeckButton, *sellCardButton;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
@@ -118,6 +121,10 @@ private:
void saveDeck(); //Saves the deck and additional necessary information
void saveAsAIDeck(string deckName); // saves deck as an AI Deck
int getCurrentPos();
void sellCard();
void setButtonState(bool state);
bool userPressedButton();
pair<float, float> cardsCoordinates[CARDS_DISPLAYED];
public:
@@ -143,7 +150,7 @@ public:
int loadDeck(int deckid);
void LoadDeckStatistics(int deckId);
void OnScroll(int inXVelocity, int inYVelocity);
void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0);
void buildEditorMenu();
virtual void ButtonPressed(int controllerId, int controlId);
+1 -1
View File
@@ -80,7 +80,7 @@ public:
virtual void Render();
void initRand(unsigned seed = 0);
void OnScroll(int inXVelocity, int inYVelocity);
void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0);
enum ENUM_DUEL_STATE_MENU_ITEM
{
+1 -1
View File
@@ -115,7 +115,7 @@ public:
virtual void Update(float dt);
virtual void Render();
virtual void ButtonPressed(int controllerId, int controlId);
virtual void OnScroll(int inXVelocity, int inYVelocity);
virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0);
static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[];
};
+4
View File
@@ -19,6 +19,10 @@ using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
const int kDismissButtonId = 10000;
const int kToggleDeckActionId = 10001;
const int kSellCardActionId = 10002;
class InteractiveButton: public SimpleButton
{
private:
+1 -1
View File
@@ -35,7 +35,7 @@ private:
public:
bool autoTranslate;
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL, int x = 364, int y = 235);
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL, float x = 364, float y = 235);
~SimplePopup(void);
void drawBoundingBox(float x, float y, float width, float height);
bool isClosed()