mirror of
https://github.com/alinanorakari/Pebble-Time-Watchface-Super-Simple.git
synced 2025-12-14 15:45:22 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 404536c3b7 | |||
| b48313dba4 | |||
| b8508ce0fd | |||
| f6d3c9c3f5 | |||
| e7c01919d4 | |||
| e3216b3352 | |||
| 2604a8d3ae | |||
| d0fa7bc990 | |||
| f032dc6488 | |||
| a27ed69547 | |||
| ff15d72028 | |||
| 5296df4453 | |||
| e1511925f8 | |||
| d93e38187a | |||
| 55d64b8f9c | |||
| c34c5e9b4c | |||
| c9d52de376 | |||
| 6d69c296d9 | |||
| f616ae6dd2 | |||
| 99e43e6502 | |||
| 99b0cdeee6 | |||
| aff6eaa6c0 |
32
.gitignore
vendored
Normal file
32
.gitignore
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
assets
|
||||||
|
config
|
||||||
|
bin
|
||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/osx
|
||||||
|
|
||||||
|
### OSX ###
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
@@ -1 +1 @@
|
|||||||
# Pebble-Time-Watchface---Super-Simple
|
# “Super Simple” watchface for Pebble Time Round and Pebble Time
|
||||||
12
appinfo.json
12
appinfo.json
@@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"appKeys": {},
|
"appKeys": {
|
||||||
|
"colorbg": 0,
|
||||||
|
"colorh": 2,
|
||||||
|
"colorm": 1,
|
||||||
|
"colorp": 3,
|
||||||
|
"colort": 6,
|
||||||
|
"shadows": 4,
|
||||||
|
"ticks": 5
|
||||||
|
},
|
||||||
"capabilities": [
|
"capabilities": [
|
||||||
"configurable"
|
"configurable"
|
||||||
],
|
],
|
||||||
@@ -16,7 +24,7 @@
|
|||||||
"chalk"
|
"chalk"
|
||||||
],
|
],
|
||||||
"uuid": "ceeae81b-6b50-43b6-8bbb-6d6f6eb62b69",
|
"uuid": "ceeae81b-6b50-43b6-8bbb-6d6f6eb62b69",
|
||||||
"versionLabel": "0.9",
|
"versionLabel": "1.3",
|
||||||
"watchapp": {
|
"watchapp": {
|
||||||
"watchface": true
|
"watchface": true
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/js/pebble-js-app.js
Normal file
29
src/js/pebble-js-app.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Pebble.addEventListener('ready', function() {
|
||||||
|
console.log('PebbleKit JS ready!');
|
||||||
|
});
|
||||||
|
|
||||||
|
Pebble.addEventListener('showConfiguration', function() {
|
||||||
|
var url='http://pebble.lastfuture.de/config/supersimple13/';
|
||||||
|
console.log('Showing configuration page: '+url);
|
||||||
|
Pebble.openURL(url);
|
||||||
|
});
|
||||||
|
|
||||||
|
Pebble.addEventListener('webviewclosed', function(e) {
|
||||||
|
var configData = JSON.parse(decodeURIComponent(e.response));
|
||||||
|
console.log('Configuration page returned: '+JSON.stringify(configData));
|
||||||
|
if (configData.colorbg) {
|
||||||
|
Pebble.sendAppMessage({
|
||||||
|
colorbg: parseInt(configData.colorbg, 16),
|
||||||
|
colorm: parseInt(configData.colorm, 16),
|
||||||
|
colorh: parseInt(configData.colorh, 16),
|
||||||
|
colorp: parseInt(configData.colorp, 16),
|
||||||
|
shadows: configData.shadows === true,
|
||||||
|
ticks: configData.ticks,
|
||||||
|
colort: parseInt(configData.colort, 16)
|
||||||
|
}, function() {
|
||||||
|
console.log('Send successful!');
|
||||||
|
}, function() {
|
||||||
|
console.log('Send failed!');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
205
src/main.c
205
src/main.c
@@ -1,21 +1,45 @@
|
|||||||
#include <pebble.h>
|
#include <pebble.h>
|
||||||
|
|
||||||
#define MINUTE_COLOR GColorWhite
|
#define KEY_BG_COLOR 0
|
||||||
#define HOUR_COLOR GColorRed
|
#define KEY_MINUTE_COLOR 1
|
||||||
#define PEG_COLOR GColorDarkGray
|
#define KEY_HOUR_COLOR 2
|
||||||
#define BG_COLOR GColorBlack
|
#define KEY_PEG_COLOR 3
|
||||||
|
#define KEY_SHADOWS 4
|
||||||
|
#define KEY_TICKS 5
|
||||||
|
#define KEY_TICK_COLOR 6
|
||||||
|
|
||||||
#define ANTIALIASING true
|
#define ANTIALIASING true
|
||||||
|
|
||||||
#define FINAL_RADIUS 88
|
#define FINAL_RADIUS 88
|
||||||
#define HAND_WIDTH 7
|
#define HAND_WIDTH 7
|
||||||
|
#define TICK_RADIUS 3
|
||||||
#define DOT_RADIUS HAND_WIDTH/4
|
#define DOT_RADIUS HAND_WIDTH/4
|
||||||
#define HAND_MARGIN_OUTER 10-(HAND_WIDTH/2)
|
#define HAND_MARGIN_OUTER 10-(HAND_WIDTH/2)
|
||||||
#define HAND_MARGIN_INNER 0
|
#define HAND_MARGIN_INNER 0
|
||||||
|
#define SHADOW_OFFSET 2
|
||||||
|
|
||||||
#define ANIMATION_DURATION 600
|
#define ANIMATION_DURATION 400
|
||||||
#define ANIMATION_DELAY 150
|
#define ANIMATION_DELAY 100
|
||||||
|
|
||||||
|
static uint8_t shadowtable[] = {192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, \
|
||||||
|
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, \
|
||||||
|
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, \
|
||||||
|
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, \
|
||||||
|
192,192,192,193,192,192,192,193,192,192,192,193,196,196,196,197, \
|
||||||
|
192,192,192,193,192,192,192,193,192,192,192,193,196,196,196,197, \
|
||||||
|
192,192,192,193,192,192,192,193,192,192,192,193,196,196,196,197, \
|
||||||
|
208,208,208,209,208,208,208,209,208,208,208,209,212,212,212,213, \
|
||||||
|
192,192,193,194,192,192,193,194,196,196,197,198,200,200,201,202, \
|
||||||
|
192,192,193,194,192,192,193,194,196,196,197,198,200,200,201,202, \
|
||||||
|
208,208,209,210,208,208,209,210,212,212,213,214,216,216,217,218, \
|
||||||
|
224,224,225,226,224,224,225,226,228,228,229,230,232,232,233,234, \
|
||||||
|
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, \
|
||||||
|
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, \
|
||||||
|
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, \
|
||||||
|
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255};
|
||||||
|
|
||||||
|
// alpha should only be 0b??111111 where ?? = 00 (full shade), 01 (much shade), 10 (some shade), 11 (none shade)
|
||||||
|
static uint8_t alpha = 0b10111111;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int hours;
|
int hours;
|
||||||
@@ -27,10 +51,63 @@ static Layer *s_canvas_layer;
|
|||||||
|
|
||||||
static GPoint s_center;
|
static GPoint s_center;
|
||||||
static Time s_last_time;
|
static Time s_last_time;
|
||||||
static int s_radius = 0;
|
static int s_radius = 0, ticks;
|
||||||
static bool s_animating = false;
|
static bool s_animating = false, shadows = true;
|
||||||
static float anim_offset;
|
static float anim_offset;
|
||||||
|
|
||||||
|
static GColor gcolorbg, gcolorm, gcolorh, gcolorp, gcolorshadow, gcolort;
|
||||||
|
|
||||||
|
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||||
|
Tuple *colorbg_t = dict_find(iter, KEY_BG_COLOR);
|
||||||
|
Tuple *colorm_t = dict_find(iter, KEY_MINUTE_COLOR);
|
||||||
|
Tuple *colorh_t = dict_find(iter, KEY_HOUR_COLOR);
|
||||||
|
Tuple *colorp_t = dict_find(iter, KEY_PEG_COLOR);
|
||||||
|
Tuple *shadows_t = dict_find(iter, KEY_SHADOWS);
|
||||||
|
Tuple *ticknum_t = dict_find(iter, KEY_TICKS);
|
||||||
|
Tuple *colort_t = dict_find(iter, KEY_TICK_COLOR);
|
||||||
|
|
||||||
|
if(colorbg_t) {
|
||||||
|
int colorbg = colorbg_t->value->int32;
|
||||||
|
persist_write_int(KEY_BG_COLOR, colorbg);
|
||||||
|
gcolorbg = GColorFromHEX(colorbg);
|
||||||
|
gcolorshadow = (GColor8) shadowtable[alpha & gcolorbg.argb];
|
||||||
|
}
|
||||||
|
if(colorm_t) {
|
||||||
|
int colorm = colorm_t->value->int32;
|
||||||
|
persist_write_int(KEY_MINUTE_COLOR, colorm);
|
||||||
|
gcolorm = GColorFromHEX(colorm);
|
||||||
|
}
|
||||||
|
if(colorh_t) {
|
||||||
|
int colorh = colorh_t->value->int32;
|
||||||
|
persist_write_int(KEY_HOUR_COLOR, colorh);
|
||||||
|
gcolorh = GColorFromHEX(colorh);
|
||||||
|
}
|
||||||
|
if(colorp_t) {
|
||||||
|
int colorp = colorp_t->value->int32;
|
||||||
|
persist_write_int(KEY_PEG_COLOR, colorp);
|
||||||
|
gcolorp = GColorFromHEX(colorp);
|
||||||
|
}
|
||||||
|
if(shadows_t && shadows_t->value->int32 > 0) {
|
||||||
|
persist_write_bool(KEY_SHADOWS, true);
|
||||||
|
shadows = true;
|
||||||
|
} else {
|
||||||
|
persist_write_bool(KEY_SHADOWS, false);
|
||||||
|
shadows = false;
|
||||||
|
}
|
||||||
|
if(ticknum_t) {
|
||||||
|
ticks = ticknum_t->value->uint8;
|
||||||
|
persist_write_int(KEY_TICKS, ticks);
|
||||||
|
}
|
||||||
|
if(colort_t) {
|
||||||
|
int colort = colort_t->value->int32;
|
||||||
|
persist_write_int(KEY_TICK_COLOR, colort);
|
||||||
|
gcolort = GColorFromHEX(colort);
|
||||||
|
}
|
||||||
|
if(s_canvas_layer) {
|
||||||
|
layer_mark_dirty(s_canvas_layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*************************** AnimationImplementation **************************/
|
/*************************** AnimationImplementation **************************/
|
||||||
|
|
||||||
static void animation_started(Animation *anim, void *context) {
|
static void animation_started(Animation *anim, void *context) {
|
||||||
@@ -60,9 +137,15 @@ static void animate(int duration, int delay, AnimationImplementation *implementa
|
|||||||
|
|
||||||
static void tick_handler(struct tm *tick_time, TimeUnits changed) {
|
static void tick_handler(struct tm *tick_time, TimeUnits changed) {
|
||||||
// Store time
|
// Store time
|
||||||
s_last_time.hours = tick_time->tm_hour;
|
// dummy time in emulator
|
||||||
s_last_time.hours -= (s_last_time.hours > 12) ? 12 : 0;
|
/*if (watch_info_get_model()==WATCH_INFO_MODEL_UNKNOWN) {
|
||||||
s_last_time.minutes = tick_time->tm_min;
|
s_last_time.hours = 10;
|
||||||
|
s_last_time.minutes = 8;
|
||||||
|
} else { */
|
||||||
|
s_last_time.hours = tick_time->tm_hour;
|
||||||
|
s_last_time.hours -= (s_last_time.hours > 12) ? 12 : 0;
|
||||||
|
s_last_time.minutes = tick_time->tm_min;
|
||||||
|
/* } */
|
||||||
|
|
||||||
// Redraw
|
// Redraw
|
||||||
if(s_canvas_layer) {
|
if(s_canvas_layer) {
|
||||||
@@ -71,13 +154,12 @@ static void tick_handler(struct tm *tick_time, TimeUnits changed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void update_proc(Layer *layer, GContext *ctx) {
|
static void update_proc(Layer *layer, GContext *ctx) {
|
||||||
// Color background?
|
|
||||||
GRect bounds = layer_get_bounds(layer);
|
GRect bounds = layer_get_bounds(layer);
|
||||||
graphics_context_set_fill_color(ctx, BG_COLOR);
|
graphics_context_set_fill_color(ctx, gcolorbg);
|
||||||
graphics_fill_rect(ctx, bounds, 0, GCornerNone);
|
graphics_fill_rect(ctx, bounds, 0, GCornerNone);
|
||||||
graphics_context_set_antialiased(ctx, ANTIALIASING);
|
graphics_context_set_antialiased(ctx, ANTIALIASING);
|
||||||
|
|
||||||
// Don't use current time while animating
|
// Use current time while animating
|
||||||
Time mode_time = s_last_time;
|
Time mode_time = s_last_time;
|
||||||
|
|
||||||
// Adjust for minutes through the hour
|
// Adjust for minutes through the hour
|
||||||
@@ -89,7 +171,6 @@ static void update_proc(Layer *layer, GContext *ctx) {
|
|||||||
minute_angle -= anim_offset;
|
minute_angle -= anim_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plot hands
|
|
||||||
GPoint minute_hand_outer = (GPoint) {
|
GPoint minute_hand_outer = (GPoint) {
|
||||||
.x = (int16_t)(sin_lookup(TRIG_MAX_ANGLE * mode_time.minutes / 60) * (int32_t)(s_radius - HAND_MARGIN_OUTER) / TRIG_MAX_RATIO) + s_center.x,
|
.x = (int16_t)(sin_lookup(TRIG_MAX_ANGLE * mode_time.minutes / 60) * (int32_t)(s_radius - HAND_MARGIN_OUTER) / TRIG_MAX_RATIO) + s_center.x,
|
||||||
.y = (int16_t)(-cos_lookup(TRIG_MAX_ANGLE * mode_time.minutes / 60) * (int32_t)(s_radius - HAND_MARGIN_OUTER) / TRIG_MAX_RATIO) + s_center.y,
|
.y = (int16_t)(-cos_lookup(TRIG_MAX_ANGLE * mode_time.minutes / 60) * (int32_t)(s_radius - HAND_MARGIN_OUTER) / TRIG_MAX_RATIO) + s_center.y,
|
||||||
@@ -106,20 +187,51 @@ static void update_proc(Layer *layer, GContext *ctx) {
|
|||||||
.x = (int16_t)(sin_lookup(hour_angle) * (int32_t)HAND_MARGIN_INNER / TRIG_MAX_RATIO) + s_center.x,
|
.x = (int16_t)(sin_lookup(hour_angle) * (int32_t)HAND_MARGIN_INNER / TRIG_MAX_RATIO) + s_center.x,
|
||||||
.y = (int16_t)(-cos_lookup(hour_angle) * (int32_t)HAND_MARGIN_INNER / TRIG_MAX_RATIO) + s_center.y,
|
.y = (int16_t)(-cos_lookup(hour_angle) * (int32_t)HAND_MARGIN_INNER / TRIG_MAX_RATIO) + s_center.y,
|
||||||
};
|
};
|
||||||
// Draw hands with positive length only
|
if (ticks > 0) {
|
||||||
|
graphics_context_set_fill_color(ctx, gcolort);
|
||||||
|
GRect insetbounds = GRect(2, 2, bounds.size.w-4, bounds.size.h-4);
|
||||||
|
GRect insetbounds12 = GRect(4, 4, bounds.size.w-8, bounds.size.h-8);
|
||||||
|
for(int i = 0; i < ticks; i++) {
|
||||||
|
int hour_angle = (i * 360) / ticks;
|
||||||
|
if (ticks == 12 && i%3!=0) {
|
||||||
|
GPoint pos = gpoint_from_polar(insetbounds12, GOvalScaleModeFitCircle , DEG_TO_TRIGANGLE(hour_angle));
|
||||||
|
graphics_fill_circle(ctx, pos, TICK_RADIUS/2);
|
||||||
|
} else {
|
||||||
|
GPoint pos = gpoint_from_polar(insetbounds, GOvalScaleModeFitCircle , DEG_TO_TRIGANGLE(hour_angle));
|
||||||
|
graphics_fill_circle(ctx, pos, TICK_RADIUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if((s_radius - HAND_MARGIN_OUTER) > HAND_MARGIN_INNER) {
|
if((s_radius - HAND_MARGIN_OUTER) > HAND_MARGIN_INNER) {
|
||||||
|
if(shadows) {
|
||||||
|
if(s_radius > 2 * HAND_MARGIN_OUTER) {
|
||||||
|
graphics_context_set_stroke_color(ctx, gcolorshadow);
|
||||||
|
graphics_context_set_stroke_width(ctx, HAND_WIDTH);
|
||||||
|
hour_hand_inner.y += SHADOW_OFFSET; hour_hand_outer.y += SHADOW_OFFSET;
|
||||||
|
graphics_draw_line(ctx, hour_hand_inner, hour_hand_outer);
|
||||||
|
hour_hand_inner.y -= SHADOW_OFFSET; hour_hand_outer.y -= SHADOW_OFFSET;
|
||||||
|
}
|
||||||
|
if(s_radius > HAND_MARGIN_OUTER) {
|
||||||
|
graphics_context_set_stroke_color(ctx, gcolorshadow);
|
||||||
|
graphics_context_set_stroke_width(ctx, HAND_WIDTH);
|
||||||
|
minute_hand_inner.y += SHADOW_OFFSET+1; minute_hand_outer.y += SHADOW_OFFSET+1;
|
||||||
|
graphics_draw_line(ctx, minute_hand_inner, minute_hand_outer);
|
||||||
|
minute_hand_inner.y -= SHADOW_OFFSET+1; minute_hand_outer.y -= SHADOW_OFFSET+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(s_radius > 2 * HAND_MARGIN_OUTER) {
|
if(s_radius > 2 * HAND_MARGIN_OUTER) {
|
||||||
graphics_context_set_stroke_color(ctx, HOUR_COLOR);
|
graphics_context_set_stroke_color(ctx, gcolorh);
|
||||||
graphics_context_set_stroke_width(ctx, HAND_WIDTH);
|
graphics_context_set_stroke_width(ctx, HAND_WIDTH);
|
||||||
graphics_draw_line(ctx, hour_hand_inner, hour_hand_outer);
|
graphics_draw_line(ctx, hour_hand_inner, hour_hand_outer);
|
||||||
}
|
}
|
||||||
if(s_radius > HAND_MARGIN_OUTER) {
|
if(s_radius > HAND_MARGIN_OUTER) {
|
||||||
graphics_context_set_stroke_color(ctx, MINUTE_COLOR);
|
graphics_context_set_stroke_color(ctx, gcolorm);
|
||||||
graphics_context_set_stroke_width(ctx, HAND_WIDTH);
|
graphics_context_set_stroke_width(ctx, HAND_WIDTH);
|
||||||
graphics_draw_line(ctx, minute_hand_inner, minute_hand_outer);
|
graphics_draw_line(ctx, minute_hand_inner, minute_hand_outer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
graphics_context_set_fill_color(ctx, PEG_COLOR);
|
graphics_context_set_fill_color(ctx, gcolorp);
|
||||||
graphics_fill_circle(ctx, s_center, DOT_RADIUS);
|
graphics_fill_circle(ctx, s_center, DOT_RADIUS);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -129,6 +241,48 @@ static void window_load(Window *window) {
|
|||||||
GRect window_bounds = layer_get_bounds(window_layer);
|
GRect window_bounds = layer_get_bounds(window_layer);
|
||||||
|
|
||||||
s_center = grect_center_point(&window_bounds);
|
s_center = grect_center_point(&window_bounds);
|
||||||
|
|
||||||
|
if (persist_exists(KEY_BG_COLOR)) {
|
||||||
|
int colorbg = persist_read_int(KEY_BG_COLOR);
|
||||||
|
gcolorbg = GColorFromHEX(colorbg);
|
||||||
|
} else {
|
||||||
|
gcolorbg = GColorBlack;
|
||||||
|
}
|
||||||
|
gcolorshadow = (GColor8) shadowtable[alpha & gcolorbg.argb];
|
||||||
|
if (persist_exists(KEY_MINUTE_COLOR)) {
|
||||||
|
int colorm = persist_read_int(KEY_MINUTE_COLOR);
|
||||||
|
gcolorm = GColorFromHEX(colorm);
|
||||||
|
} else {
|
||||||
|
gcolorm = GColorWhite;
|
||||||
|
}
|
||||||
|
if (persist_exists(KEY_HOUR_COLOR)) {
|
||||||
|
int colorh = persist_read_int(KEY_HOUR_COLOR);
|
||||||
|
gcolorh = GColorFromHEX(colorh);
|
||||||
|
} else {
|
||||||
|
gcolorh = GColorRed;
|
||||||
|
}
|
||||||
|
if (persist_exists(KEY_PEG_COLOR)) {
|
||||||
|
int colorp = persist_read_int(KEY_PEG_COLOR);
|
||||||
|
gcolorp = GColorFromHEX(colorp);
|
||||||
|
} else {
|
||||||
|
gcolorp = GColorDarkGray;
|
||||||
|
}
|
||||||
|
if (persist_exists(KEY_SHADOWS)) {
|
||||||
|
shadows = persist_read_bool(KEY_SHADOWS);
|
||||||
|
} else {
|
||||||
|
shadows = false;
|
||||||
|
}
|
||||||
|
if (persist_exists(KEY_TICKS)) {
|
||||||
|
ticks = persist_read_int(KEY_TICKS);
|
||||||
|
} else {
|
||||||
|
ticks = 0;
|
||||||
|
}
|
||||||
|
if (persist_exists(KEY_TICK_COLOR)) {
|
||||||
|
int colort = persist_read_int(KEY_TICK_COLOR);
|
||||||
|
gcolort = GColorFromHEX(colort);
|
||||||
|
} else {
|
||||||
|
gcolort = GColorWhite;
|
||||||
|
}
|
||||||
|
|
||||||
s_canvas_layer = layer_create(window_bounds);
|
s_canvas_layer = layer_create(window_bounds);
|
||||||
layer_set_update_proc(s_canvas_layer, update_proc);
|
layer_set_update_proc(s_canvas_layer, update_proc);
|
||||||
@@ -152,6 +306,11 @@ static void radius_update(Animation *anim, AnimationProgress dist_normalized) {
|
|||||||
|
|
||||||
static void init() {
|
static void init() {
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
|
// keep lit only in emulator
|
||||||
|
if (watch_info_get_model()==WATCH_INFO_MODEL_UNKNOWN) {
|
||||||
|
light_enable(true);
|
||||||
|
}
|
||||||
|
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm *time_now = localtime(&t);
|
struct tm *time_now = localtime(&t);
|
||||||
@@ -165,6 +324,9 @@ static void init() {
|
|||||||
window_stack_push(s_main_window, true);
|
window_stack_push(s_main_window, true);
|
||||||
|
|
||||||
tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);
|
tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);
|
||||||
|
|
||||||
|
app_message_register_inbox_received(inbox_received_handler);
|
||||||
|
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
|
||||||
|
|
||||||
// Prepare animations
|
// Prepare animations
|
||||||
AnimationImplementation radius_impl = {
|
AnimationImplementation radius_impl = {
|
||||||
@@ -183,4 +345,3 @@ int main() {
|
|||||||
deinit();
|
deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user