1
0
Fork 0

Merge pull request #14 from dperelman/feature/disable-animation-option

Add -noflip flag to disable flip effect.
master
Alexander Kovalenko 5 years ago committed by GitHub
commit 5da5b663c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,6 +40,7 @@ const int DEFAULT_HEIGHT = 768;
bool twentyfourh = true;
bool leadingzero = false;
bool fullscreen = false;
bool animate = true;
int past_h = -1, past_m = -1;
@ -223,6 +224,7 @@ void render_digits(SDL_Surface *surface, SDL_Rect *background, char digits[], ch
SDL_FreeSurface(scaled);
SDL_FreeSurface(bgcopy);
if(!animate) return;
// draw divider
rect.h = surface->h * 0.005;
rect.w = background->w;
@ -274,6 +276,11 @@ void render_clock(int maxsteps, int step) {
}
void render_animation() {
if(!animate) {
render_clock(20, 19);
return;
}
const int DURATION = 260;
int start_tick = SDL_GetTicks();
int end_tick = start_tick + DURATION;
@ -328,6 +335,7 @@ int main(int argc, char** argv ) {
printf("Usage: %s [OPTION...]\nOptions:\n", argv[0]);
printf(" -help\t\tDisplay this\n");
printf(" -root, -f\tFullscreen\n");
printf(" -noflip\t\tDisable the flip animation (change time in one frame)\n");
printf(" -ampm\t\tUse 12-hour clock format (AM/PM)\n");
printf(" -leadingzero\t\tAlways display hour with two digits\n");
printf(" -w\t\tCustom width\n");
@ -337,6 +345,8 @@ int main(int argc, char** argv ) {
return 0;
} else if(strcmp("-root", argv[i]) == 0 || strcmp("-f", argv[i]) == 0 || strcmp("--fullscreen", argv[i]) == 0) {
fullscreen = true;
} else if(strcmp("-noflip", argv[i]) == 0) {
animate = false;
} else if(strcmp("-ampm", argv[i]) == 0) {
twentyfourh = false;
} else if(strcmp("-leadingzero", argv[i]) == 0) {

Loading…
Cancel
Save