#include "../../common/GameState.h"
#include "../../common/Upgrade.h"
#include "../../math/Vector.h"
+#include "../../graphics/ColorFade.h"
#include "../../graphics/Font.h"
#include "../../graphics/Frame.h"
using app::Input;
using common::GameState;
using common::Upgrade;
+using graphics::ColorFade;
using graphics::Font;
using graphics::Frame;
using math::Vector;
stalling = false;
}
if (cursor >= int(lines.size())) {
- Ctrl().PopState(); // pop self
+ timer.Clear();
+ ColorFade *fade = new ColorFade(this, 0, 650);
+ fade->SetLeadInTime(150);
+ fade->SetDoublePop();
+ Ctrl().PushState(fade);
}
}
const Font &font = *parent->Res().normalFont;
const Vector<int> lineBreak = Vector<int>(
0, font.CharHeight() * 5 / 4);
- const int start = cursor > 7 ? cursor - 8 : 0;
+ int start = cursor > 7 ? cursor - 8 : 0;
Vector<int> position = textPosition;
int end = cursor + 1;
position += lineBreak;
const int correction = timer.IterationElapsed();
if (correction > 0) {
- // ++start;
position.Y() -= lineBreak.Y() * correction / timer.TargetTime();
}
}
}
- if (end > int(lines.size())) end = lines.size();
+ if (end > int(lines.size())) {
+ end = lines.size();
+ }
+ if (start > int(lines.size()) - 9) {
+ start = lines.size() - 9;
+ }
for (int i = start; i < end; ++i) {
font.DrawString(lines[i].c_str(), screen, position);
: public app::State {
public:
- ColorFade(app::State *slave, Uint32 color, int duration, bool in = false, bool interactive = false);
+ ColorFade(
+ app::State *slave,
+ Uint32 color,
+ int duration,
+ bool in = false,
+ bool interactive = false);
virtual ~ColorFade() { }
public:
- void SetLeadInTime(int ms) { leadIn = ms; if (ms > 0) leadInDone = false; }
+ void SetLeadInTime(int ms) {
+ leadIn = ms;
+ if (ms > 0) leadInDone = false;
+ }
void SetLeadOutTime(int ms) { leadOut = ms; }
+ void SetDoublePop(bool b = true) { doublePop = b; }
public:
virtual void HandleEvents(const app::Input &);
bool fadeDone;
bool in;
bool interactive;
+ bool doublePop;
};