Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/pebble-mario.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Dzyubenko <shadone@gmail.com>2014-01-14 02:08:34 +0400
committerDenis Dzyubenko <shadone@gmail.com>2014-01-14 02:08:34 +0400
commitfb39cf98cedb8b6a6b51349d19908eef2c295876 (patch)
treea370ba65621aaf6a4e2185c8647ad0ee6bd455bc
parent364cbf54f2530d7215839c5ed0bee018f95b6ae0 (diff)
Added demo mode
-rw-r--r--src/pebble-mario.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/pebble-mario.c b/src/pebble-mario.c
index 4febfa6..f0ad8ed 100644
--- a/src/pebble-mario.c
+++ b/src/pebble-mario.c
@@ -21,6 +21,7 @@
#include <time.h>
// #define INVERSED_COLORS
+#define DEMO // display fake time. Good for taking screenshots of the watchface.
Window *window;
@@ -82,6 +83,10 @@ PropertyAnimation *minute_animation_slide_in;
# define BackgroundColor GColorBlack
#endif
+#if defined(DEMO)
+static int demo_advance_time = 0;
+#endif
+
void handle_tick(struct tm *tick_time, TimeUnits units_changed);
void draw_block(GContext *ctx, GRect rect, uint8_t width)
@@ -253,7 +258,12 @@ void handle_init()
ground_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_GROUND_INVERSED);
#endif
- tick_timer_service_subscribe(MINUTE_UNIT, handle_tick);
+#if defined(DEMO)
+ #define MARIO_TIME_UNIT SECOND_UNIT
+#else
+ #define MARIO_TIME_UNIT MINUTE_UNIT
+#endif
+ tick_timer_service_subscribe(MARIO_TIME_UNIT, handle_tick);
}
void handle_deinit()
@@ -432,6 +442,20 @@ void handle_tick(struct tm *tick_time, TimeUnits units_changed)
animation_set_curve((Animation *)minute_animation_slide_away, AnimationCurveLinear);
}
+#if defined(DEMO)
+ strncpy(date_text, "Sat, May 19", sizeof(date_text)-1);
+ date_text[sizeof(date_text)-1] = '\0';
+
+ hour_text[0] = '9';
+ hour_text[1] = '\0';
+ minute_text[0] = '4';
+ minute_text[1] = '1';
+ minute_text[2] = '\0';
+ if (demo_advance_time) {
+ minute_text[1] = '2';
+ }
+ demo_advance_time ^= 1;
+#else
char *hour_format;
if (clock_is_24h_style()) {
hour_format = "%H";
@@ -448,6 +472,7 @@ void handle_tick(struct tm *tick_time, TimeUnits units_changed)
strftime(minute_text, sizeof(minute_text), minute_format, tick_time);
strftime(date_text, sizeof(date_text), "%a, %b %d", tick_time);
+#endif
animation_schedule((Animation *)mario_animation_beg);
animation_schedule((Animation *)block_animation_beg);