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

github.com/ClusterM/pebble-silly-walk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Long <dan@dansl.net>2013-04-16 08:33:17 +0400
committerDan Long <dan@dansl.net>2013-04-16 08:33:17 +0400
commit23c67a34bbecfe653f402c472b7572a5ff6dcbaa (patch)
tree04b6d1b74d9d67fc60be663a8aa144a6318f5fd5
parent98c14aec89c8adbc894c2ede82898e8dfcbccac1 (diff)
Silly Walk Simple
-rw-r--r--psd/silly_walk/background.psd (renamed from psd/background.psd)bin1199901 -> 1199901 bytes
-rw-r--r--psd/silly_walk/hour_hand.psd (renamed from psd/hour_hand.psd)bin32950 -> 32950 bytes
-rw-r--r--psd/silly_walk/icon.psd (renamed from psd/icon.psd)bin28589 -> 28589 bytes
-rw-r--r--psd/silly_walk/minute_hand.psd (renamed from psd/minute_hand.psd)bin36279 -> 36279 bytes
-rw-r--r--psd/silly_walk/seconds_hand.psd (renamed from psd/seconds_hand.psd)bin31484 -> 31484 bytes
-rw-r--r--psd/silly_walk_simple/background.psdbin0 -> 1172679 bytes
-rw-r--r--psd/silly_walk_simple/hour_hand.psdbin0 -> 32950 bytes
-rw-r--r--psd/silly_walk_simple/icon.psdbin0 -> 28589 bytes
-rw-r--r--psd/silly_walk_simple/minute_hand.psdbin0 -> 36279 bytes
-rw-r--r--psd/silly_walk_simple/seconds_hand.psdbin0 -> 31484 bytes
-rw-r--r--reference2.pngbin0 -> 1673 bytes
-rw-r--r--silly_walk_simple/resources/src/images/background.pngbin0 -> 1215 bytes
-rw-r--r--silly_walk_simple/resources/src/images/hour_hand.pngbin0 -> 1214 bytes
-rw-r--r--silly_walk_simple/resources/src/images/icon.pngbin0 -> 1089 bytes
-rw-r--r--silly_walk_simple/resources/src/images/minute_hand.pngbin0 -> 1212 bytes
-rw-r--r--silly_walk_simple/resources/src/images/seconds_hand.pngbin0 -> 1116 bytes
-rw-r--r--silly_walk_simple/resources/src/resource_map.json39
-rw-r--r--silly_walk_simple/silly_walk_simple.pbwbin0 -> 16029 bytes
-rw-r--r--silly_walk_simple/src/silly_walk_simple.c115
19 files changed, 154 insertions, 0 deletions
diff --git a/psd/background.psd b/psd/silly_walk/background.psd
index aa0b7a0..aa0b7a0 100644
--- a/psd/background.psd
+++ b/psd/silly_walk/background.psd
Binary files differ
diff --git a/psd/hour_hand.psd b/psd/silly_walk/hour_hand.psd
index cfc7fb3..cfc7fb3 100644
--- a/psd/hour_hand.psd
+++ b/psd/silly_walk/hour_hand.psd
Binary files differ
diff --git a/psd/icon.psd b/psd/silly_walk/icon.psd
index a8f0f81..a8f0f81 100644
--- a/psd/icon.psd
+++ b/psd/silly_walk/icon.psd
Binary files differ
diff --git a/psd/minute_hand.psd b/psd/silly_walk/minute_hand.psd
index 2ebc1f6..2ebc1f6 100644
--- a/psd/minute_hand.psd
+++ b/psd/silly_walk/minute_hand.psd
Binary files differ
diff --git a/psd/seconds_hand.psd b/psd/silly_walk/seconds_hand.psd
index a405194..a405194 100644
--- a/psd/seconds_hand.psd
+++ b/psd/silly_walk/seconds_hand.psd
Binary files differ
diff --git a/psd/silly_walk_simple/background.psd b/psd/silly_walk_simple/background.psd
new file mode 100644
index 0000000..8b11a20
--- /dev/null
+++ b/psd/silly_walk_simple/background.psd
Binary files differ
diff --git a/psd/silly_walk_simple/hour_hand.psd b/psd/silly_walk_simple/hour_hand.psd
new file mode 100644
index 0000000..cfc7fb3
--- /dev/null
+++ b/psd/silly_walk_simple/hour_hand.psd
Binary files differ
diff --git a/psd/silly_walk_simple/icon.psd b/psd/silly_walk_simple/icon.psd
new file mode 100644
index 0000000..a8f0f81
--- /dev/null
+++ b/psd/silly_walk_simple/icon.psd
Binary files differ
diff --git a/psd/silly_walk_simple/minute_hand.psd b/psd/silly_walk_simple/minute_hand.psd
new file mode 100644
index 0000000..2ebc1f6
--- /dev/null
+++ b/psd/silly_walk_simple/minute_hand.psd
Binary files differ
diff --git a/psd/silly_walk_simple/seconds_hand.psd b/psd/silly_walk_simple/seconds_hand.psd
new file mode 100644
index 0000000..a405194
--- /dev/null
+++ b/psd/silly_walk_simple/seconds_hand.psd
Binary files differ
diff --git a/reference2.png b/reference2.png
new file mode 100644
index 0000000..330f30d
--- /dev/null
+++ b/reference2.png
Binary files differ
diff --git a/silly_walk_simple/resources/src/images/background.png b/silly_walk_simple/resources/src/images/background.png
new file mode 100644
index 0000000..6e8025f
--- /dev/null
+++ b/silly_walk_simple/resources/src/images/background.png
Binary files differ
diff --git a/silly_walk_simple/resources/src/images/hour_hand.png b/silly_walk_simple/resources/src/images/hour_hand.png
new file mode 100644
index 0000000..342889a
--- /dev/null
+++ b/silly_walk_simple/resources/src/images/hour_hand.png
Binary files differ
diff --git a/silly_walk_simple/resources/src/images/icon.png b/silly_walk_simple/resources/src/images/icon.png
new file mode 100644
index 0000000..a34703d
--- /dev/null
+++ b/silly_walk_simple/resources/src/images/icon.png
Binary files differ
diff --git a/silly_walk_simple/resources/src/images/minute_hand.png b/silly_walk_simple/resources/src/images/minute_hand.png
new file mode 100644
index 0000000..6a35022
--- /dev/null
+++ b/silly_walk_simple/resources/src/images/minute_hand.png
Binary files differ
diff --git a/silly_walk_simple/resources/src/images/seconds_hand.png b/silly_walk_simple/resources/src/images/seconds_hand.png
new file mode 100644
index 0000000..2c66619
--- /dev/null
+++ b/silly_walk_simple/resources/src/images/seconds_hand.png
Binary files differ
diff --git a/silly_walk_simple/resources/src/resource_map.json b/silly_walk_simple/resources/src/resource_map.json
new file mode 100644
index 0000000..4e9fe55
--- /dev/null
+++ b/silly_walk_simple/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/silly_walk_simple.pbw b/silly_walk_simple/silly_walk_simple.pbw
new file mode 100644
index 0000000..49a1dad
--- /dev/null
+++ b/silly_walk_simple/silly_walk_simple.pbw
Binary files differ
diff --git a/silly_walk_simple/src/silly_walk_simple.c b/silly_walk_simple/src/silly_walk_simple.c
new file mode 100644
index 0000000..dbddc22
--- /dev/null
+++ b/silly_walk_simple/src/silly_walk_simple.c
@@ -0,0 +1,115 @@
+#include "pebble_os.h"
+#include "pebble_app.h"
+#include "pebble_fonts.h"
+
+
+#define MY_UUID { 0x08, 0x08, 0xBD, 0x57, 0x94, 0x61, 0x4D, 0xA5, 0x98, 0xF4, 0x61, 0x6D, 0xA2, 0x5E, 0x6B, 0xA8 }
+PBL_APP_INFO(MY_UUID,
+ "Silly Walk Simple", "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);
+
+ //rotbmp_pair_layer_set_angle(&second_hand_image_container.layer, t->tm_sec * 6);
+ second_hand_image_container.layer.white_layer.rotation = TRIG_MAX_ANGLE * (t->tm_sec * 6) / 360;
+ second_hand_image_container.layer.black_layer.rotation = TRIG_MAX_ANGLE * (t->tm_sec * 6) / 360;
+ second_hand_image_container.layer.layer.frame.origin.x = (144/2) - (second_hand_image_container.layer.layer.frame.size.w/2);
+ second_hand_image_container.layer.layer.frame.origin.y = (168/2) - (second_hand_image_container.layer.layer.frame.size.h/2);
+ layer_mark_dirty(&second_hand_image_container.layer.layer);
+}
+
+// Called once per second
+void handle_second_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 Simple");
+ 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_init_container(RESOURCE_ID_IMAGE_HOUR_HAND, &hour_hand_image_container);
+ 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);
+
+
+ // Set up a layer for the second hand
+ rotbmp_pair_init_container(RESOURCE_ID_IMAGE_SECOND_HAND_WHITE, RESOURCE_ID_IMAGE_SECOND_HAND_BLACK, &second_hand_image_container);
+ rotbmp_pair_layer_set_src_ic(&second_hand_image_container.layer, GPoint(7, 44));
+ layer_add_child(&window.layer, &second_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_second_tick,
+ .tick_units = SECOND_UNIT
+ }
+
+ };
+ app_event_loop(params, &handlers);
+} \ No newline at end of file