Also fixed the project includes so that we don't need to always use the indirect include path, ie: #include "../include/foo.h" -> #include "foo.h" I'm don't know much about make files - if I busted the linux build, mea culpa, but I think we're okay on that front too. For future reference, here's the most straightforward link on the topic of adding pch support to make files: http://www.mercs-eng.com/~hulud/index.php?2008/06/13/6-writing-a-good-makefile-for-a-c-project
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#include "PrecompiledHeader.h"
|
|
|
|
#include <JRenderer.h>
|
|
#include <JGui.h>
|
|
#include "GameApp.h"
|
|
#include "GameStateTransitions.h"
|
|
#include "MTGDeck.h"
|
|
#include "Translate.h"
|
|
#include "OptionItem.h"
|
|
#include "GameOptions.h"
|
|
|
|
TransitionBase::TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration): GameState(parent){
|
|
from = _from;
|
|
to = _to;
|
|
mDuration = duration;
|
|
bAnimationOnly = false;
|
|
}
|
|
TransitionBase::~TransitionBase(){
|
|
if(!bAnimationOnly){
|
|
if(from)
|
|
from->End();
|
|
}
|
|
}
|
|
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;
|
|
};
|
|
|
|
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;
|
|
};
|