-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSplashscreenRenderer.cpp
49 lines (38 loc) · 1.1 KB
/
SplashscreenRenderer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Author: mikedebo@gmail.com (Michael DiBernardo)
// Copyright Michael DiBernardo 2006
// Implementation of class SplashscreenRenderer and related constructs.
#include "SplashscreenRenderer.h"
#include "ColorSpec.h"
#include "Config.h"
#include "Timer.h"
#include "Utils2D.h"
#include "os.h"
static const long kMillisecondsToWait = 2 * 1000;
SplashscreenRenderer::SplashscreenRenderer()
: TexturedScreenRenderer(Config::SPLASHSCREEN_IMAGE), pauser_(new Timer()), switch_(false) {
disable();
}
SplashscreenRenderer::~SplashscreenRenderer() {
delete pauser_;
}
NextAction SplashscreenRenderer::renderOverBackground() {
glPushMatrix();
if (!pauser_->running()) pauser_->start();
if (pauser_->getTimeInMilliseconds() > kMillisecondsToWait) {
glTranslatef(1000, 1000, 0);
Utils2D::drawString("Press any key.");
enable();
}
glPopMatrix();
if (switch_) {
return RA_TITLE_TO_FADE;
} else {
return RA_REDISPLAY;
}
}
void SplashscreenRenderer::onKeyDown(unsigned char key, int x, int y) {
switch_ = true;
}
bool SplashscreenRenderer::shouldKeysRepeat() const {
return false;
}