Files
wagic/projects/mtg/include/GameApp.h
wagic.the.homebrew e27cf56fa2 - Support for Zip Filesystem. It is now possible to zip the entire Res folder ("store" method preferred, zip so that the root of the zip has ai, player, etc...) in one single file for read only. Write access is done in another folder (hardcoded to be User/ for now, can be updated depending on platforms, etc...
-- zipFS has several limitations...
--- in a general way, seekg doesn't work... so getting a file's size needs to be done through JFileSystem.
--- getLine on files open with zipFS doesn't work so great. Not sure if it is a normal issue because files are open in binary or not... JFileSystem therefore offers a "readIntoString" function that needs to be used instead of the usual "getline" technique. However getLine can then be used on a stream connected to the string.

-- tested on Windows and PSP, I also made sure android still works, but haven't tested zip support on Android.
-- I tried to maintain backwards compatibility, but this might break on some platforms, if I broke some platforms and you can't find a way to fix them, please contact me and we'll figure something out
-- This removes wagic::ifstream. I didn't reimplement the securities that were involved in this, apologies for that. Might be useful to reimplement such securities in JFileSystem
-- I haven't tested options/profiles in a deep way, it is possible I broke that.
2011-08-21 09:04:59 +00:00

111 lines
2.1 KiB
C++

/*
* Wagic, The Homebrew ?! is licensed under the BSD license
* See LICENSE in the Folder's root
* http://wololo.net/wagic/
*/
#ifndef _GAMEAPP_H_
#define _GAMEAPP_H_
#include <JApp.h>
#include <JGE.h>
#include <JSprite.h>
#include <JLBFont.h>
#include <hge/hgeparticle.h>
#include "WResourceManager.h"
#include "GameState.h"
#include "MTGDeck.h"
#include "MTGCard.h"
#include "MTGGameZones.h"
#include "CardEffect.h"
#ifdef NETWORK_SUPPORT
#include "JNetwork.h"
#endif //NETWORK_SUPPORT
class Rules;
enum
{
PLAYER_TYPE_CPU = 0,
PLAYER_TYPE_HUMAN=1,
PLAYER_TYPE_TESTSUITE=2,
#ifdef NETWORK_SUPPORT
PLAYER_TYPE_REMOTE=3
#endif //NETWORK_SUPPORT
};
enum
{
GAME_TYPE_CLASSIC,
GAME_TYPE_MOMIR,
GAME_TYPE_RANDOM1,
GAME_TYPE_RANDOM2,
GAME_TYPE_STORY,
GAME_TYPE_DEMO,
GAME_TYPE_STONEHEWER,
GAME_TYPE_HERMIT,
#ifdef NETWORK_SUPPORT
GAME_TYPE_SLAVE,
#endif //NETWORK_SUPPORT
};
class MTGAllCards;
class TransitionBase;
class GameApp: public JApp
{
private:
#ifdef DEBUG
int nbUpdates;
float totalFPS;
#endif
bool mShowDebugInfo;
int mScreenShotCount;
GameState* mCurrentState;
GameState* mNextState;
GameState* mGameStates[GAME_STATE_MAX];
public:
int gameType;
Rules * rules;
CardEffect *effect;
#ifdef NETWORK_SUPPORT
JNetwork* mpNetwork;
#endif //NETWORK_SUPPORT
GameApp();
virtual ~GameApp();
virtual void Create();
virtual void Destroy();
virtual void Update();
virtual void Render();
virtual void Pause();
virtual void Resume();
virtual void OnScroll(int inXVelocity, int inYVelocity);
void LoadGameStates();
void SetNextState(int state);
void DoTransition(int trans, int tostate, float dur = -1, bool animonly = false);
void DoAnimation(int trans, float dur = -1);
static hgeParticleSystem * Particles[6];
static bool HasMusic;
static string systemError;
static JMusic* music;
static string currentMusicFile;
static void playMusic(string filename, bool loop = true);
static int players[2];
};
extern JQuadPtr manaIcons[7];
#endif