diff --git a/.gitignore b/.gitignore index 92968f0..6bb6ab0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ build -.lock-waf_linux2_build +.lock-waf_*_build diff --git a/appinfo.json b/appinfo.json index 1bc3137..96de659 100644 --- a/appinfo.json +++ b/appinfo.json @@ -1,8 +1,4 @@ { - "appKeys": {}, - "capabilities": [ - "" - ], "companyName": "metakirby5@gmail.com", "longName": "Pok\u00e9tch+", "projectType": "native", @@ -42,7 +38,7 @@ "type": "font" }, { - "file": "images/Pikachu (bottom).png", + "file": "images/pika.png", "name": "IMAGE_PIKA_BG", "type": "png" } @@ -50,11 +46,6 @@ }, "sdkVersion": "3", "shortName": "Pok\u00e9tch+", - "targetPlatforms": [ - "aplite", - "basalt", - "chalk" - ], "uuid": "003eec80-ab22-4cab-b44b-263f524e3a63", "versionLabel": "3.0", "watchapp": { diff --git a/resources/HM-Poktch-Digital/Export Data b/resources/HM-Poktch-Digital/Export Data deleted file mode 100644 index 40afc73..0000000 --- a/resources/HM-Poktch-Digital/Export Data +++ /dev/null @@ -1 +0,0 @@ -{"48":[252,252,204,204,204,204,204,204,204,204,252,252,0,0,0,0],"49":[12,12,12,12,12,12,12,12,12,12,12,12,0,0,0,0],"50":[252,252,192,192,192,252,252,12,12,12,252,252,0,0,0,0],"51":[252,252,192,192,192,252,252,192,192,192,252,252,0,0,0,0],"52":[204,204,204,204,204,252,252,192,192,192,192,192,0,0,0,0],"53":[252,252,12,12,12,252,252,192,192,192,252,252,0,0,0,0],"54":[252,252,12,12,12,252,252,204,204,204,252,252,0,0,0,0],"55":[252,252,204,204,204,204,192,192,192,192,192,192,0,0,0,0],"56":[252,252,204,204,204,252,252,204,204,204,252,252,0,0,0,0],"57":[252,252,204,204,204,252,252,192,192,192,252,252,0,0,0,0],"58":[0,0,0,12,12,0,0,12,12,0,0,0,0,0,0,0],"name":"HMPoketchDigital","copy":"Inferno986return","letterspace":"64"} diff --git a/resources/HM-Poktch-Digital/HMPoketchDigital.ttf b/resources/HM-Poktch-Digital/HMPoketchDigital.ttf deleted file mode 100644 index 7f9471c..0000000 Binary files a/resources/HM-Poktch-Digital/HMPoketchDigital.ttf and /dev/null differ diff --git a/resources/HM-Poktch-Digital/OFL b/resources/HM-Poktch-Digital/OFL deleted file mode 100644 index 1456c18..0000000 --- a/resources/HM-Poktch-Digital/OFL +++ /dev/null @@ -1,97 +0,0 @@ -Copyright (c) , (), -with Reserved Font Name . -Copyright (c) , (), -with Reserved Font Name . -Copyright (c) , (). - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/resources/HM-Poktch-Digital/Readme b/resources/HM-Poktch-Digital/Readme deleted file mode 100644 index 8d05e31..0000000 --- a/resources/HM-Poktch-Digital/Readme +++ /dev/null @@ -1,5 +0,0 @@ --- HM Poketch Digital README -- - -HM Poketch Digital is a font based upon the typeface used to represent the numbers on the Poketch digital clock in Pokemon Diamond/Pearl/Platinum. - -Export data is included so feel free to go to Pentacom and tweak this font to your liking, proving you stick to the OFL license. diff --git a/resources/images/Pikachu (bottom).png b/resources/images/pika.png similarity index 100% rename from resources/images/Pikachu (bottom).png rename to resources/images/pika.png diff --git a/resources/Pikachu (bottom).png b/resources/images/pika_line.png similarity index 100% rename from resources/Pikachu (bottom).png rename to resources/images/pika_line.png diff --git a/src/main.c b/src/main.c index 0d294c5..5923bc6 100644 --- a/src/main.c +++ b/src/main.c @@ -12,11 +12,11 @@ // Colors #ifdef PBL_COLOR #define PALETTE_SIZE 2 - #define COLOR_FG(day) (day ? GColorDarkGreen : GColorScreaminGreen) - #define COLOR_BG(day) (day ? GColorScreaminGreen : GColorDarkGreen) + #define COLOR_FG(day) ((day) ? GColorDarkGreen : GColorScreaminGreen) + #define COLOR_BG(day) ((day) ? GColorScreaminGreen : GColorDarkGreen) #else - #define COLOR_FG(day) (day ? GColorBlack : GColorWhite) - #define COLOR_BG(day) (day ? GColorWhite : GColorBlack) + #define COLOR_FG(day) ((day) ? GColorBlack : GColorWhite) + #define COLOR_BG(day) ((day) ? GColorWhite : GColorBlack) #endif #define FMT_TIME(mil) (mil ? "%H:%M" : "%I:%M") @@ -73,10 +73,10 @@ static bool showDate = true; // === Helper methods === static void colorize(BitmapLayer *layer, bool day) { - + #ifdef PBL_COLOR // The colors we're replacing - + GColor colors_to_replace[PALETTE_SIZE], replace_with_colors[PALETTE_SIZE]; @@ -99,27 +99,27 @@ static void colorize(BitmapLayer *layer, bool day) { } static void update_secdate(struct tm *tick_time) { - + static char date_buf[FMT_DATE_LEN]; static char sec_buf[FMT_SEC_LEN]; - + // Update the buffer if (showDate) strftime(date_buf, FMT_DATE_LEN, FMT_DATE, tick_time); else strftime(sec_buf, FMT_SEC_LEN, FMT_SEC, tick_time); - + // Set the buffer text_layer_set_text(s_secdate_layer, showDate ? date_buf : sec_buf); layer_mark_dirty(text_layer_get_layer(s_secdate_layer)); } static void show_seconds(void *data) { - + // Get time time_t temp = time(NULL); struct tm *tick_time = localtime(&temp); - + // Show seconds showDate = false; update_secdate(tick_time); @@ -128,7 +128,7 @@ static void show_seconds(void *data) { // === Handlers === static void tick_handler(struct tm *tick_time, TimeUnits units_changed) { - + // === Time === if (units_changed & MINUTE_UNIT) { static char time_buf[FMT_TIME_LEN]; @@ -137,21 +137,21 @@ static void tick_handler(struct tm *tick_time, TimeUnits units_changed) { text_layer_set_text(s_time_layer, time_buf); layer_mark_dirty(text_layer_get_layer(s_time_layer)); } - + // == Secs/date == update_secdate(tick_time); - + // === Day/night color inversion === static bool day = true; static bool nextDay = true; static bool changed = true; - + if (units_changed & HOUR_UNIT) { // Did we go day->night or night->day nextDay = tick_time->tm_hour >= HR_DAY && tick_time->tm_hour < HR_NIGHT; changed = firstUpdate || (day ^ nextDay); day = nextDay; - + if (changed) { colorize(s_pika_layer, day); colorize(s_bang_layer, day); @@ -166,17 +166,17 @@ static void tick_handler(struct tm *tick_time, TimeUnits units_changed) { } static void acc_handler(AccelAxisType axis, int32_t direction) { - + static AppTimer *timer_secdate = NULL; - + // Get time time_t temp = time(NULL); struct tm *tick_time = localtime(&temp); - + // Show date showDate = true; update_secdate(tick_time); - + // === Reschedule seconds showing === // If timer exists, try rescheduling if (!(timer_secdate && app_timer_reschedule(timer_secdate, TIMEOUT_SECDATE))) @@ -185,36 +185,36 @@ static void acc_handler(AccelAxisType axis, int32_t direction) { } static void bt_handler(bool connected) { - + // Vibrate if (!firstUpdate) connected ? vibes_short_pulse() : vibes_double_pulse(); - + // Set BT indicator layer_set_hidden(bitmap_layer_get_layer(s_bang_layer), connected); } static void bat_handler(BatteryChargeState charge) { - + // Set charge indicator layer_set_hidden(bitmap_layer_get_layer(s_chg_layer), !charge.is_plugged); - + // Set battery bar layer_set_bounds(bitmap_layer_get_layer(s_bat_layer), BOUND_BAT(charge.charge_percent)); } // === Setup === - + static void main_window_load(Window *window) { - + s_root_layer = window_get_root_layer(window); - + // Pikachu BG s_pika_layer = bitmap_layer_create(RECT_PIKA); s_pika = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PIKA_BG); bitmap_layer_set_bitmap(s_pika_layer, s_pika); layer_add_child(s_root_layer, bitmap_layer_get_layer(s_pika_layer)); - + // Time s_time_layer = text_layer_create(RECT_TIME); s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_POKETCH_DIGITAL_70)); @@ -222,7 +222,7 @@ static void main_window_load(Window *window) { text_layer_set_background_color(s_time_layer, GColorClear); text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter); layer_add_child(s_root_layer, text_layer_get_layer(s_time_layer)); - + // Secs/date s_secdate_layer = text_layer_create(RECT_SECDATE); s_secdate_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_POKETCH_DIGITAL_30)); @@ -230,14 +230,14 @@ static void main_window_load(Window *window) { text_layer_set_background_color(s_secdate_layer, GColorClear); text_layer_set_text_alignment(s_secdate_layer, GTextAlignmentCenter); layer_add_child(s_root_layer, text_layer_get_layer(s_secdate_layer)); - + // Bluetooth s_bang_layer = bitmap_layer_create(RECT_BANG); s_bang = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BANG); bitmap_layer_set_bitmap(s_bang_layer, s_bang); layer_insert_above_sibling(bitmap_layer_get_layer(s_bang_layer), bitmap_layer_get_layer(s_pika_layer)); - + // Battery s_bat_layer = bitmap_layer_create(RECT_BAT); s_bat = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BAT); @@ -245,30 +245,30 @@ static void main_window_load(Window *window) { layer_set_clips(bitmap_layer_get_layer(s_bat_layer), true); // enable clipping layer_insert_above_sibling(bitmap_layer_get_layer(s_bat_layer), bitmap_layer_get_layer(s_pika_layer)); - + // Charging s_chg_layer = bitmap_layer_create(RECT_CHG); s_chg = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_CHG); bitmap_layer_set_bitmap(s_chg_layer, s_chg); layer_insert_above_sibling(bitmap_layer_get_layer(s_chg_layer), bitmap_layer_get_layer(s_pika_layer)); - + // === Initial update === - + // Get current time time_t temp = time(NULL); struct tm *tick_time = localtime(&temp); - + // Initial handler runs tick_handler(tick_time, TICK_UNIT); bt_handler(bluetooth_connection_service_peek()); bat_handler(battery_state_service_peek()); - + firstUpdate = false; } static void main_window_unload(Window *window) { - + // Pikachu BG bitmap_layer_destroy(s_pika_layer); gbitmap_destroy(s_pika); @@ -276,7 +276,7 @@ static void main_window_unload(Window *window) { // Time text_layer_destroy(s_time_layer); fonts_unload_custom_font(s_time_font); - + // Secs/date text_layer_destroy(s_secdate_layer); fonts_unload_custom_font(s_secdate_font); @@ -284,24 +284,24 @@ static void main_window_unload(Window *window) { // Bluetooth bitmap_layer_destroy(s_bang_layer); gbitmap_destroy(s_bang); - + // Battery bitmap_layer_destroy(s_bat_layer); gbitmap_destroy(s_bat); - + // Charging bitmap_layer_destroy(s_chg_layer); gbitmap_destroy(s_chg); } static void init() { - + // Register services tick_timer_service_subscribe(TICK_UNIT, tick_handler); // accel_tap_service_subscribe(acc_handler); bluetooth_connection_service_subscribe(bt_handler); battery_state_service_subscribe(bat_handler); - + s_main_window = window_create(); window_set_window_handlers(s_main_window, (WindowHandlers) { @@ -315,7 +315,7 @@ static void init() { static void deinit() { window_destroy(s_main_window); - + // Unregister services tick_timer_service_unsubscribe(); // accel_tap_service_unsubscribe();