Jeck - [JGE recompile needed] Shop cleanup, Interface enhancements.

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).
This commit is contained in:
wagic.jeck
2010-02-01 18:27:25 +00:00
parent e999da6ef7
commit 0a863bcbad
21 changed files with 1619 additions and 1291 deletions

View File

@@ -0,0 +1,56 @@
#include "../include/config.h"
#include <JRenderer.h>
#include <JGui.h>
#include "../include/GameApp.h"
#include "../include/GameStateTransitions.h"
#include "../include/MTGDeck.h"
#include "../include/Translate.h"
#include "../include/OptionItem.h"
#include "../include/GameOptions.h"
#include "../include/DeckDataWrapper.h"
TransitionBase::TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration): GameState(parent){
from = _from;
to = _to;
mDuration = duration;
bAnimationOnly = false;
}
void TransitionBase::Update(float dt){
if(from && !Finished())
from->Update(dt);
mElapsed += dt;
}
void TransitionBase::ButtonPressed(int controllerId, int controlId){
if(!from) return;
JGuiListener * jgl = dynamic_cast<JGuiListener*>(from);
if(jgl)
jgl->ButtonPressed(controllerId,controlId);
}
void TransitionBase::Start() {
mElapsed = 0;
};
void TransitionBase::End() {
mElapsed = 0;
if(!bAnimationOnly){
if(from)
from->End();
}
};
void TransitionFade::Render(){
if(from)
from->Render();
float fade = 255*mElapsed/mDuration;
if(mReversed)
fade = 255 - fade;
JRenderer::GetInstance()->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,ARGB((int)fade,0,0,0));
}
TransitionFade::TransitionFade(GameApp* p, GameState* f, GameState* t, float dur, bool reversed):
TransitionBase(p, f,t,dur) {
mReversed = reversed;
};