Files
wagic/projects/mtg/include/GameState.h
techdragon.nguyen@gmail.com a2179017d4 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)
2012-01-26 13:53:03 +00:00

96 lines
2.7 KiB
C++

#ifndef _GAME_STATE_H_
#define _GAME_STATE_H_
#define FADING_SPEED 350.0f
class JGE;
#include <JSoundSystem.h>
#include <string>
#include <vector>
#include <iostream>
#include "DeckMetaData.h"
#include "DeckMenu.h"
using namespace std;
enum ENUM_GAME_STATE
{
GAME_STATE_NONE = -1,
GAME_STATE_MENU = 1,
GAME_STATE_DUEL = 2,
GAME_STATE_DECK_VIEWER = 3,
GAME_STATE_SHOP = 4,
GAME_STATE_OPTIONS = 5,
GAME_STATE_AWARDS = 6,
GAME_STATE_STORY = 7,
GAME_STATE_TRANSITION = 8,
GAME_STATE_MAX = 9,
};
enum ENUM_GS_TRANSITION
{
TRANSITION_FADE = 0,
TRANSITION_FADE_IN = 1,
MAX_TRANSITION
};
class GameApp;
class SimpleMenu;
class Player;
class GameState
{
protected:
GameApp* mParent;
JGE* mEngine;
string mStringID;
public:
GameState(GameApp* parent, string id);
virtual ~GameState(){}
virtual void Create(){}
virtual void Destroy(){}
virtual void Start(){}
virtual void End(){}
virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0)
{
}
virtual void Update(float dt) = 0;
virtual void Render() = 0;
string getStringID() {return mStringID;};
// deck manipulation methods
// 2010/09/15:
// this was originally one method to do everything. That has been split up into two distinct
// methods since the original was building a menu and returning a value. The first
// creates the vector containing the deck information. The second will render that information
// it makes it easier to manipulate the deck information menus.
// generate the Deck Meta Data and build the menu items of the menu given
static vector<DeckMetaData *> fillDeckMenu(SimpleMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL);
// generate the Deck Meta Data and build the menu items of the menu given
// Will display up to maxDecks if maxDecks is non 0,all decks in path otherwise
static vector<DeckMetaData *> fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
// build a vector of decks with the information passsed in.
static vector<DeckMetaData *> BuildDeckList(const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
// build menu items based on the vector<DeckMetaData *>
static void renderDeckMenu(SimpleMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
// build menu items based on the vector<DeckMetaData *>
static void renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
};
bool sortByName(DeckMetaData * d1, DeckMetaData * d2);
#endif