Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4674338d65 | |||
| 1a496c3198 | |||
| 6b1f25f569 | |||
| 98838d5253 | |||
| db0ed68971 | |||
| f0402e9d45 | |||
| e568c5afea | |||
| 8acaefa42e | |||
| d10f5667a9 | |||
| cadf4f5783 |
10
package.json
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"author": "hilariouspig",
|
||||
"author": "RandyTheSilly",
|
||||
"dependencies": {},
|
||||
"keywords": [],
|
||||
"name": "maan-on-my-wrist-xl",
|
||||
@@ -712,6 +712,12 @@
|
||||
],
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/menu_icon.png",
|
||||
"name": "MENU_ICON",
|
||||
"menuIcon": true,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"characterRegex": "[:0-9]",
|
||||
"file": "fonts/RetroComputerTime.ttf",
|
||||
@@ -746,5 +752,5 @@
|
||||
"watchface": true
|
||||
}
|
||||
},
|
||||
"version": "1.0.0"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 485 B |
BIN
resources/images/menu_icon.png
Normal file
|
After Width: | Height: | Size: 146 B |
38
src/c/main.c
@@ -69,7 +69,8 @@ static GRect s_date_grect_b;
|
||||
static GRect s_bt_grect_b;
|
||||
|
||||
// declare animation templates
|
||||
static uint8_t s_animation_duration = 255;
|
||||
static const uint8_t s_animation_duration = 255;
|
||||
static bool s_first_tick_occurred = false;
|
||||
static Animation *s_head_raise_template;
|
||||
static Animation *s_head_out_template;
|
||||
static Animation *s_head_in_template;
|
||||
@@ -128,8 +129,6 @@ static void destroy_animation_handler(Animation *animation, bool finished, void
|
||||
animation_destroy(animation);
|
||||
}
|
||||
|
||||
static bool first_minute_update = true;
|
||||
|
||||
static void update_minute_1() {
|
||||
// get a tm structure
|
||||
time_t temp = time(NULL);
|
||||
@@ -163,7 +162,7 @@ static void update_minute_1() {
|
||||
//// calculate new positions
|
||||
s_date_grect_b = GRect(s_ones_offset[ones], s_date_pos_y, s_date_bt_width, s_date_height);
|
||||
s_bt_grect_b = GRect(s_bt_pos_x - s_ones_offset[ones], s_bt_pos_y, s_date_bt_width, s_bt_height);
|
||||
if (!first_minute_update) {
|
||||
if (s_first_tick_occurred) { // no need to animate before first tick, as positions are set in init() without animating
|
||||
//// configure animations
|
||||
////// date
|
||||
PropertyAnimation *date_center_prop = property_animation_create_layer_frame(text_layer_get_layer(s_date_layer), &s_date_grect_a, &s_date_grect_b);
|
||||
@@ -186,7 +185,6 @@ static void update_minute_1() {
|
||||
s_date_grect_a = s_date_grect_b;
|
||||
s_bt_grect_a = s_bt_grect_b;
|
||||
}
|
||||
first_minute_update = false;
|
||||
|
||||
// DEBUG memory usage layer
|
||||
// static char s_memory_buffer[32];
|
||||
@@ -225,11 +223,6 @@ static void update_minute_30_out_handler(Animation *animation, bool finished, vo
|
||||
bitmap_layer_set_bitmap(s_guy_head_layer, s_head);
|
||||
}
|
||||
|
||||
static void update_minute_30() {
|
||||
update_minute_1();
|
||||
schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler);
|
||||
}
|
||||
|
||||
static void update_minute_60_out_handler(Animation *animation, bool finished, void *context) {
|
||||
// destroy and reassign
|
||||
gbitmap_destroy(s_head);
|
||||
@@ -247,18 +240,17 @@ static void update_minute_60_out_handler(Animation *animation, bool finished, vo
|
||||
bitmap_layer_set_bitmap(s_guy_butt_layer, s_butt);
|
||||
}
|
||||
|
||||
static void update_minute_60() {
|
||||
static void minute_handler(struct tm *tick_time, TimeUnits units_changed) {
|
||||
update_minute_1();
|
||||
schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler);
|
||||
if (!s_first_tick_occurred) {
|
||||
s_first_tick_occurred = true;
|
||||
return; // do not animate part swaps on first tick
|
||||
}
|
||||
|
||||
static void minute_handler(struct tm *tick_time, TimeUnits units_changed) {
|
||||
if (tick_time->tm_min % 60 == 0) {
|
||||
update_minute_60();
|
||||
schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler);
|
||||
} else if (tick_time->tm_min % 30 == 0) {
|
||||
update_minute_30();
|
||||
} else {
|
||||
update_minute_1();
|
||||
schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,13 +345,13 @@ static void bluetooth_callback(bool connected) {
|
||||
// DEBUG buttons
|
||||
// static void up_single_click_handler(ClickRecognizerRef recognizer, void *context) {
|
||||
// Window *window = (Window *)context;
|
||||
// update_minute_60();
|
||||
// schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler);
|
||||
//}
|
||||
|
||||
// DEBUG buttons
|
||||
// static void down_single_click_handler(ClickRecognizerRef recognizer, void *context) {
|
||||
// Window *window = (Window *)context;
|
||||
// update_minute_30();
|
||||
// schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler);
|
||||
//}
|
||||
|
||||
// DEBUG buttons
|
||||
@@ -371,7 +363,13 @@ static void bluetooth_callback(bool connected) {
|
||||
// set up the app on launch (don't put app logic in here);
|
||||
static void init() {
|
||||
// seed RNG
|
||||
srand(time(NULL));
|
||||
uint16_t seed_ms;
|
||||
time_t seed_time;
|
||||
time_ms(&seed_time, &seed_ms);
|
||||
srand((unsigned int)seed_time ^ seed_ms);
|
||||
rand();
|
||||
rand();
|
||||
rand(); // throw away first few values
|
||||
|
||||
// create main Window element and assign to pointer
|
||||
s_main_window = window_create();
|
||||
|
||||