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).
33 lines
866 B
C++
33 lines
866 B
C++
#ifndef _GAME_STATE_TRANSITIONS_H_
|
|
#define _GAME_STATE_TRANSITIONS_H_
|
|
|
|
#include <JGE.h>
|
|
#include <JGui.h>
|
|
#include "../include/GameState.h"
|
|
|
|
class TransitionBase: public GameState, public JGuiListener{
|
|
public:
|
|
TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration);
|
|
virtual void Start();
|
|
virtual void End();
|
|
|
|
virtual bool Finished() {return (mElapsed >= mDuration);};
|
|
virtual void Update(float dt);
|
|
virtual void Render() = 0;
|
|
virtual void ButtonPressed(int controllerId, int controlId);
|
|
|
|
float mElapsed;
|
|
float mDuration;
|
|
GameState* from;
|
|
GameState* to;
|
|
bool bAnimationOnly; //Does not call start or end on subordinates.
|
|
};
|
|
|
|
class TransitionFade: public TransitionBase {
|
|
public:
|
|
TransitionFade(GameApp* p, GameState* f, GameState* t, float dur, bool reversed);
|
|
virtual void Render();
|
|
bool mReversed;
|
|
};
|
|
|
|
#endif |