Browse files

Animated abort message.

Attempting to close the window also triggers abort.
  • Loading branch information...
1 parent 6996c32 commit e8d5f89de1b4f8e7ef97f495841c0ec8cc982991 @acaudwell committed Apr 10, 2012
Showing with 36 additions and 9 deletions.
  1. +1 −1 src/core
  2. +18 −6 src/gource.cpp
  3. +4 −1 src/gource.h
  4. +10 −1 src/gource_shell.cpp
  5. +3 −0 src/gource_shell.h
2 src/core
@@ -1 +1 @@
-Subproject commit 547c8cdc00e8f5f645ce655fec75fdfafa1388d0
+Subproject commit 760f2cec8cfbec79811533e761edce468d24a307
View
24 src/gource.cpp
@@ -134,6 +134,8 @@ Gource::Gource(FrameExporter* exporter) {
logmill = new RLogMill(logfile);
+ shutdown = false;
+
if(exporter!=0) setFrameExporter(exporter, gGourceSettings.output_framerate);
//if recording a video or in demo mode, or multiple repos, the slider is initially hidden
@@ -213,6 +215,10 @@ void Gource::reload() {
slider.resize();
}
+void Gource::quit() {
+ shutdown = true;
+}
+
void Gource::update(float t, float dt) {
float scaled_dt = std::min(dt, max_tick_rate);
@@ -631,7 +637,7 @@ void Gource::keyPress(SDL_KeyboardEvent *e) {
#endif
if (key_escape) {
- appFinished=true;
+ quit();
}
if(commitlog==0) return;
@@ -1443,14 +1449,19 @@ void Gource::changeColours() {
void Gource::logic(float t, float dt) {
+ if(shutdown && logmill->isFinished()) {
+ appFinished=true;
+ return;
+ }
+
if(message_timer>0.0f) message_timer -= dt;
if(splash>0.0f) splash -= dt;
//init log file
if(commitlog == 0) {
if(!logmill->isFinished()) return;
-
+
commitlog = logmill->getLog();
std::string error = logmill->getError();
@@ -1760,9 +1771,6 @@ void Gource::loadingScreen() {
glColor4f(1.0, 1.0, 1.0, 1.0);
- std::string loading_message("Reading Log...");
- int width = font.getWidth(loading_message);
-
const char* progress;
switch(int(runtime*3.0f)%4) {
@@ -1780,7 +1788,11 @@ void Gource::loadingScreen() {
break;
}
- font.print(display.width/2 - width/2, display.height/2 - 10, "Reading Log%s", progress);
+ const char* action = !shutdown ? "Reading Log" : "Aborting";
+
+ int width = font.getWidth(action);
+
+ font.print(display.width/2 - width/2, display.height/2 - 10, "%s%s", action, progress);
}
void Gource::drawBackground(float dt) {
View
5 src/gource.h
@@ -57,6 +57,7 @@ class Gource : public SDLApp {
FrameExporter* frameExporter;
RLogMill* logmill;
+ bool shutdown;
RCommitLog* commitlog;
PositionSlider slider;
@@ -191,7 +192,7 @@ class Gource : public SDLApp {
float message_timer;
void setMessage(const char* str, ...);
-
+
void reset();
RUser* addUser(const std::string& username);
@@ -276,6 +277,8 @@ class Gource : public SDLApp {
void unload();
void reload();
+ void quit();
+
void update(float t, float dt);
void keyPress(SDL_KeyboardEvent *e);
void mouseMove(SDL_MouseMotionEvent *e);
View
11 src/gource_shell.cpp
@@ -28,6 +28,8 @@ GourceShell::GourceShell(ConfFile* conf, FrameExporter* exporter) {
next = false;
+ shutdown = false;
+
gource = 0;
gource_settings = conf->getSections("gource")->begin();
@@ -99,7 +101,7 @@ void GourceShell::keyPress(SDL_KeyboardEvent *e) {
#endif
if (key_escape) {
- appFinished=true;
+ quit();
}
if(key_return) {
@@ -138,6 +140,11 @@ void GourceShell::mouseClick(SDL_MouseButtonEvent *e) {
if(gource!=0) gource->mouseClick(e);
}
+void GourceShell::quit() {
+ if(gource!=0) gource->quit();
+ shutdown=true;
+}
+
Gource* GourceShell::getNext() {
if(gource!=0) {
@@ -146,6 +153,8 @@ Gource* GourceShell::getNext() {
transition_interval = 1.0f;
}
+
+ if(shutdown) return 0;
if(gource_settings == conf->getSections("gource")->end()) {
return 0;
View
3 src/gource_shell.h
@@ -26,6 +26,7 @@ class GourceShell : public SDLApp {
Gource* gource;
+ bool shutdown;
bool next;
TextureResource* transition_texture;
@@ -47,6 +48,8 @@ class GourceShell : public SDLApp {
void toggleFullscreen();
+ void quit();
+
void keyPress(SDL_KeyboardEvent *e);
void mouseMove(SDL_MouseMotionEvent *e);
void mouseClick(SDL_MouseButtonEvent *e);

0 comments on commit e8d5f89

Please sign in to comment.