diff options
author | Dan Long <dan@dansl.net> | 2013-04-16 11:36:55 +0400 |
---|---|---|
committer | Dan Long <dan@dansl.net> | 2013-04-16 11:36:55 +0400 |
commit | fedb74e035951a83f69df4fda89a82c3c7784448 (patch) | |
tree | 3633531b3b571907340fa6f0e9f1b9f96359dce2 | |
parent | ee1b8bfb92f1f1a7108f41e5b199d94a0b1d4704 (diff) |
Added versions without Seconds hand
18 files changed, 286 insertions, 0 deletions
diff --git a/reference3.png b/reference3.png Binary files differnew file mode 100644 index 0000000..1fc550e --- /dev/null +++ b/reference3.png diff --git a/reference4.png b/reference4.png Binary files differnew file mode 100644 index 0000000..3968a92 --- /dev/null +++ b/reference4.png diff --git a/silly_walk_no_seconds/resources/src/images/background.png b/silly_walk_no_seconds/resources/src/images/background.png Binary files differnew file mode 100644 index 0000000..1219eff --- /dev/null +++ b/silly_walk_no_seconds/resources/src/images/background.png diff --git a/silly_walk_no_seconds/resources/src/images/hour_hand.png b/silly_walk_no_seconds/resources/src/images/hour_hand.png Binary files differnew file mode 100644 index 0000000..342889a --- /dev/null +++ b/silly_walk_no_seconds/resources/src/images/hour_hand.png diff --git a/silly_walk_no_seconds/resources/src/images/icon.png b/silly_walk_no_seconds/resources/src/images/icon.png Binary files differnew file mode 100644 index 0000000..a34703d --- /dev/null +++ b/silly_walk_no_seconds/resources/src/images/icon.png diff --git a/silly_walk_no_seconds/resources/src/images/minute_hand.png b/silly_walk_no_seconds/resources/src/images/minute_hand.png Binary files differnew file mode 100644 index 0000000..6a35022 --- /dev/null +++ b/silly_walk_no_seconds/resources/src/images/minute_hand.png diff --git a/silly_walk_no_seconds/resources/src/images/seconds_hand.png b/silly_walk_no_seconds/resources/src/images/seconds_hand.png Binary files differnew file mode 100644 index 0000000..2c66619 --- /dev/null +++ b/silly_walk_no_seconds/resources/src/images/seconds_hand.png diff --git a/silly_walk_no_seconds/resources/src/resource_map.json b/silly_walk_no_seconds/resources/src/resource_map.json new file mode 100644 index 0000000..4e9fe55 --- /dev/null +++ b/silly_walk_no_seconds/resources/src/resource_map.json @@ -0,0 +1,39 @@ +{ + "friendlyVersion": "dev_0.0", + "versionDefName": "APP_RESOURCES", + + "media": [ + + { + "type": "png", + "defName": "IMAGE_MENU_ICON", + "file": "images/icon.png" + }, + + { + "type": "png", + "defName": "IMAGE_BACKGROUND", + "file": "images/background.png" + }, + + { + "type": "png-trans", + "defName": "IMAGE_HOUR_HAND", + "file": "images/hour_hand.png" + }, + + { + "type": "png-trans", + "defName": "IMAGE_MINUTE_HAND", + "file": "images/minute_hand.png" + }, + + { + "type": "png-trans", + "defName": "IMAGE_SECOND_HAND", + "file": "images/seconds_hand.png" + } + + ] +} + diff --git a/silly_walk_no_seconds/silly_walk_no_seconds.pbw b/silly_walk_no_seconds/silly_walk_no_seconds.pbw Binary files differnew file mode 100644 index 0000000..662e07d --- /dev/null +++ b/silly_walk_no_seconds/silly_walk_no_seconds.pbw diff --git a/silly_walk_no_seconds/src/silly_walk_no_seconds.c b/silly_walk_no_seconds/src/silly_walk_no_seconds.c new file mode 100644 index 0000000..c462df5 --- /dev/null +++ b/silly_walk_no_seconds/src/silly_walk_no_seconds.c @@ -0,0 +1,104 @@ +#include "pebble_os.h" +#include "pebble_app.h" +#include "pebble_fonts.h" + + +#define MY_UUID { 0x9B, 0x5E, 0x69, 0x04, 0xCA, 0xAD, 0x4E, 0xFA, 0xB7, 0x19, 0x82, 0x10, 0x6B, 0x65, 0x47, 0x79 } + +PBL_APP_INFO(MY_UUID, + "Silly Walk - No Seconds", "Dansl", + 1, 0, /* App version */ + RESOURCE_ID_IMAGE_MENU_ICON, + APP_INFO_WATCH_FACE); + +Window window; + +BmpContainer background_image_container; + +RotBmpPairContainer hour_hand_image_container; +RotBmpPairContainer minute_hand_image_container; +RotBmpPairContainer second_hand_image_container; + +void update_watch(PblTm* t){ + + //rotbmp_pair_layer_set_angle(&hour_hand_image_container.layer, ((t->tm_hour % 12) * 30) + (t->tm_min/2)); + hour_hand_image_container.layer.white_layer.rotation = TRIG_MAX_ANGLE * (((t->tm_hour % 12) * 30) + (t->tm_min/2)) / 360; + hour_hand_image_container.layer.black_layer.rotation = TRIG_MAX_ANGLE * (((t->tm_hour % 12) * 30) + (t->tm_min/2)) / 360; + hour_hand_image_container.layer.layer.frame.origin.x = (144/2) - (hour_hand_image_container.layer.layer.frame.size.w/2); + hour_hand_image_container.layer.layer.frame.origin.y = (168/2) - (hour_hand_image_container.layer.layer.frame.size.h/2); + layer_mark_dirty(&hour_hand_image_container.layer.layer); + + //rotbmp_pair_layer_set_angle(&minute_hand_image_container.layer, t->tm_min * 6); + minute_hand_image_container.layer.white_layer.rotation = TRIG_MAX_ANGLE * (t->tm_min * 6) / 360; + minute_hand_image_container.layer.black_layer.rotation = TRIG_MAX_ANGLE * (t->tm_min * 6) / 360; + minute_hand_image_container.layer.layer.frame.origin.x = (144/2) - (minute_hand_image_container.layer.layer.frame.size.w/2); + minute_hand_image_container.layer.layer.frame.origin.y = (168/2) - (minute_hand_image_container.layer.layer.frame.size.h/2); + layer_mark_dirty(&minute_hand_image_container.layer.layer); + +} + +// Called once per second +void handle_minute_tick(AppContextRef ctx, PebbleTickEvent *t) { + update_watch(t->tick_time); +} + + +// Handle the start-up of the app +void handle_init(AppContextRef app_ctx) { + + // Create our app's base window + window_init(&window, "Silly Walk"); + window_stack_push(&window, true); + window_set_background_color(&window, GColorBlack); + + resource_init_current_app(&APP_RESOURCES); + + // Set up a layer for the static watch face background + bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container); + layer_add_child(&window.layer, &background_image_container.layer.layer); + + + // Set up a layer for the hour hand + rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_HAND_WHITE, RESOURCE_ID_IMAGE_HOUR_HAND_BLACK, &hour_hand_image_container); + rotbmp_pair_layer_set_src_ic(&hour_hand_image_container.layer, GPoint(33, 40)); + layer_add_child(&window.layer, &hour_hand_image_container.layer.layer); + + + // Set up a layer for the minute hand + rotbmp_pair_init_container(RESOURCE_ID_IMAGE_MINUTE_HAND_WHITE, RESOURCE_ID_IMAGE_MINUTE_HAND_BLACK, &minute_hand_image_container); + rotbmp_pair_layer_set_src_ic(&minute_hand_image_container.layer, GPoint(16, 60)); + layer_add_child(&window.layer, &minute_hand_image_container.layer.layer); + + + PblTm t; + get_time(&t); + update_watch(&t); + +} + +void handle_deinit(AppContextRef ctx) { + + bmp_deinit_container(&background_image_container); + rotbmp_pair_deinit_container(&hour_hand_image_container); + rotbmp_pair_deinit_container(&minute_hand_image_container); + rotbmp_pair_deinit_container(&second_hand_image_container); +} + + +// The main event/run loop for our app +void pbl_main(void *params) { + PebbleAppHandlers handlers = { + + // Handle app start + .init_handler = &handle_init, + .deinit_handler = &handle_deinit, + + // Handle time updates + .tick_info = { + .tick_handler = &handle_minute_tick, + .tick_units = MINUTE_UNIT + } + + }; + app_event_loop(params, &handlers); +}
\ No newline at end of file diff --git a/silly_walk_simple_no_seconds/resources/src/images/background.png b/silly_walk_simple_no_seconds/resources/src/images/background.png Binary files differnew file mode 100644 index 0000000..6e726bc --- /dev/null +++ b/silly_walk_simple_no_seconds/resources/src/images/background.png diff --git a/silly_walk_simple_no_seconds/resources/src/images/hour_hand.png b/silly_walk_simple_no_seconds/resources/src/images/hour_hand.png Binary files differnew file mode 100644 index 0000000..342889a --- /dev/null +++ b/silly_walk_simple_no_seconds/resources/src/images/hour_hand.png diff --git a/silly_walk_simple_no_seconds/resources/src/images/icon.png b/silly_walk_simple_no_seconds/resources/src/images/icon.png Binary files differnew file mode 100644 index 0000000..a34703d --- /dev/null +++ b/silly_walk_simple_no_seconds/resources/src/images/icon.png diff --git a/silly_walk_simple_no_seconds/resources/src/images/minute_hand.png b/silly_walk_simple_no_seconds/resources/src/images/minute_hand.png Binary files differnew file mode 100644 index 0000000..6a35022 --- /dev/null +++ b/silly_walk_simple_no_seconds/resources/src/images/minute_hand.png diff --git a/silly_walk_simple_no_seconds/resources/src/images/seconds_hand.png b/silly_walk_simple_no_seconds/resources/src/images/seconds_hand.png Binary files differnew file mode 100644 index 0000000..2c66619 --- /dev/null +++ b/silly_walk_simple_no_seconds/resources/src/images/seconds_hand.png diff --git a/silly_walk_simple_no_seconds/resources/src/resource_map.json b/silly_walk_simple_no_seconds/resources/src/resource_map.json new file mode 100644 index 0000000..4e9fe55 --- /dev/null +++ b/silly_walk_simple_no_seconds/resources/src/resource_map.json @@ -0,0 +1,39 @@ +{ + "friendlyVersion": "dev_0.0", + "versionDefName": "APP_RESOURCES", + + "media": [ + + { + "type": "png", + "defName": "IMAGE_MENU_ICON", + "file": "images/icon.png" + }, + + { + "type": "png", + "defName": "IMAGE_BACKGROUND", + "file": "images/background.png" + }, + + { + "type": "png-trans", + "defName": "IMAGE_HOUR_HAND", + "file": "images/hour_hand.png" + }, + + { + "type": "png-trans", + "defName": "IMAGE_MINUTE_HAND", + "file": "images/minute_hand.png" + }, + + { + "type": "png-trans", + "defName": "IMAGE_SECOND_HAND", + "file": "images/seconds_hand.png" + } + + ] +} + diff --git a/silly_walk_simple_no_seconds/silly_walk_simple_no_seconds.pbw b/silly_walk_simple_no_seconds/silly_walk_simple_no_seconds.pbw Binary files differnew file mode 100644 index 0000000..2713d89 --- /dev/null +++ b/silly_walk_simple_no_seconds/silly_walk_simple_no_seconds.pbw diff --git a/silly_walk_simple_no_seconds/src/silly_walk_simple_no_seconds.c b/silly_walk_simple_no_seconds/src/silly_walk_simple_no_seconds.c new file mode 100644 index 0000000..f173df7 --- /dev/null +++ b/silly_walk_simple_no_seconds/src/silly_walk_simple_no_seconds.c @@ -0,0 +1,104 @@ +#include "pebble_os.h" +#include "pebble_app.h" +#include "pebble_fonts.h" + + +#define MY_UUID { 0xC2, 0x01, 0x53, 0xB1, 0xD7, 0xBD, 0x47, 0xCC, 0x90, 0xD6, 0x02, 0x2B, 0x51, 0xBA, 0x7B, 0x89 } + +PBL_APP_INFO(MY_UUID, + "Silly Walk Simple - No Seconds", "Dansl", + 1, 0, /* App version */ + RESOURCE_ID_IMAGE_MENU_ICON, + APP_INFO_WATCH_FACE); + +Window window; + +BmpContainer background_image_container; + +RotBmpPairContainer hour_hand_image_container; +RotBmpPairContainer minute_hand_image_container; +RotBmpPairContainer second_hand_image_container; + +void update_watch(PblTm* t){ + + //rotbmp_pair_layer_set_angle(&hour_hand_image_container.layer, ((t->tm_hour % 12) * 30) + (t->tm_min/2)); + hour_hand_image_container.layer.white_layer.rotation = TRIG_MAX_ANGLE * (((t->tm_hour % 12) * 30) + (t->tm_min/2)) / 360; + hour_hand_image_container.layer.black_layer.rotation = TRIG_MAX_ANGLE * (((t->tm_hour % 12) * 30) + (t->tm_min/2)) / 360; + hour_hand_image_container.layer.layer.frame.origin.x = (144/2) - (hour_hand_image_container.layer.layer.frame.size.w/2); + hour_hand_image_container.layer.layer.frame.origin.y = (168/2) - (hour_hand_image_container.layer.layer.frame.size.h/2); + layer_mark_dirty(&hour_hand_image_container.layer.layer); + + //rotbmp_pair_layer_set_angle(&minute_hand_image_container.layer, t->tm_min * 6); + minute_hand_image_container.layer.white_layer.rotation = TRIG_MAX_ANGLE * (t->tm_min * 6) / 360; + minute_hand_image_container.layer.black_layer.rotation = TRIG_MAX_ANGLE * (t->tm_min * 6) / 360; + minute_hand_image_container.layer.layer.frame.origin.x = (144/2) - (minute_hand_image_container.layer.layer.frame.size.w/2); + minute_hand_image_container.layer.layer.frame.origin.y = (168/2) - (minute_hand_image_container.layer.layer.frame.size.h/2); + layer_mark_dirty(&minute_hand_image_container.layer.layer); + +} + +// Called once per second +void handle_minute_tick(AppContextRef ctx, PebbleTickEvent *t) { + update_watch(t->tick_time); +} + + +// Handle the start-up of the app +void handle_init(AppContextRef app_ctx) { + + // Create our app's base window + window_init(&window, "Silly Walk"); + window_stack_push(&window, true); + window_set_background_color(&window, GColorBlack); + + resource_init_current_app(&APP_RESOURCES); + + // Set up a layer for the static watch face background + bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container); + layer_add_child(&window.layer, &background_image_container.layer.layer); + + + // Set up a layer for the hour hand + rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_HAND_WHITE, RESOURCE_ID_IMAGE_HOUR_HAND_BLACK, &hour_hand_image_container); + rotbmp_pair_layer_set_src_ic(&hour_hand_image_container.layer, GPoint(33, 40)); + layer_add_child(&window.layer, &hour_hand_image_container.layer.layer); + + + // Set up a layer for the minute hand + rotbmp_pair_init_container(RESOURCE_ID_IMAGE_MINUTE_HAND_WHITE, RESOURCE_ID_IMAGE_MINUTE_HAND_BLACK, &minute_hand_image_container); + rotbmp_pair_layer_set_src_ic(&minute_hand_image_container.layer, GPoint(16, 60)); + layer_add_child(&window.layer, &minute_hand_image_container.layer.layer); + + + PblTm t; + get_time(&t); + update_watch(&t); + +} + +void handle_deinit(AppContextRef ctx) { + + bmp_deinit_container(&background_image_container); + rotbmp_pair_deinit_container(&hour_hand_image_container); + rotbmp_pair_deinit_container(&minute_hand_image_container); + rotbmp_pair_deinit_container(&second_hand_image_container); +} + + +// The main event/run loop for our app +void pbl_main(void *params) { + PebbleAppHandlers handlers = { + + // Handle app start + .init_handler = &handle_init, + .deinit_handler = &handle_deinit, + + // Handle time updates + .tick_info = { + .tick_handler = &handle_minute_tick, + .tick_units = MINUTE_UNIT + } + + }; + app_event_loop(params, &handlers); +}
\ No newline at end of file |