From 62cb944b85e5b44ac6238f78e9b9a854e8c02b0d Mon Sep 17 00:00:00 2001 From: Alexey 'Cluster' Avdyukhin Date: Sat, 23 May 2015 01:34:45 +0300 Subject: Some optimizations and new image --- appinfo.json | 22 ++++++++++------- resources/images/battery-charging.png | Bin 220 -> 0 bytes resources/images/battery_charging.png | Bin 0 -> 214 bytes resources/images/no-phone.png | Bin 221 -> 0 bytes resources/images/no_phone.png | Bin 0 -> 229 bytes resources/images/phone_battery.png | Bin 0 -> 212 bytes resources/images/phone_battery_unknown.png | Bin 0 -> 231 bytes resources/images/phone_icon.png | Bin 208 -> 0 bytes resources/images/watch_battery.png | Bin 0 -> 215 bytes resources/images/watch_icon.png | Bin 207 -> 0 bytes src/pebble-mario.c | 37 ++++++++++++++++++----------- 11 files changed, 36 insertions(+), 23 deletions(-) delete mode 100644 resources/images/battery-charging.png create mode 100644 resources/images/battery_charging.png delete mode 100644 resources/images/no-phone.png create mode 100644 resources/images/no_phone.png create mode 100644 resources/images/phone_battery.png create mode 100644 resources/images/phone_battery_unknown.png delete mode 100644 resources/images/phone_icon.png create mode 100644 resources/images/watch_battery.png delete mode 100644 resources/images/watch_icon.png diff --git a/appinfo.json b/appinfo.json index 07641f9..9091189 100644 --- a/appinfo.json +++ b/appinfo.json @@ -15,25 +15,30 @@ "resources": { "media": [ { - "file": "images/no-phone.png", - "name": "IMAGE_NO_PHONE", + "file": "images/watch_battery.png", + "name": "IMAGE_WATCH_BATTERY", "type": "png" }, { - "file": "images/watch_icon.png", - "name": "IMAGE_WATCH_ICON", + "file": "images/phone_battery.png", + "name": "IMAGE_PHONE_BATTERY", "type": "png" }, { - "file": "images/phone_icon.png", - "name": "IMAGE_PHONE_ICON", + "file": "images/no_phone.png", + "name": "IMAGE_NO_PHONE", "type": "png" }, { - "file": "images/battery-charging.png", + "file": "images/battery_charging.png", "name": "IMAGE_BATTERY_CHARGING", "type": "png" }, + { + "file": "images/phone_battery_unknown.png", + "name": "IMAGE_PHONE_BATTERY_UNKNOWN", + "type": "png" + }, { "file": "images/mario_bg_night_color.png", "name": "IMAGE_BACKGROUND_NIGHT", @@ -96,8 +101,7 @@ "basalt" ], "uuid": "43caa750-2896-4f46-94dc-1adbd4bc1ff3", - "versionCode": 3, - "versionLabel": "3.0", + "versionLabel": "3.01", "watchapp": { "watchface": true } diff --git a/resources/images/battery-charging.png b/resources/images/battery-charging.png deleted file mode 100644 index 3350309..0000000 Binary files a/resources/images/battery-charging.png and /dev/null differ diff --git a/resources/images/battery_charging.png b/resources/images/battery_charging.png new file mode 100644 index 0000000..3c91e15 Binary files /dev/null and b/resources/images/battery_charging.png differ diff --git a/resources/images/no-phone.png b/resources/images/no-phone.png deleted file mode 100644 index 6f7feb1..0000000 Binary files a/resources/images/no-phone.png and /dev/null differ diff --git a/resources/images/no_phone.png b/resources/images/no_phone.png new file mode 100644 index 0000000..5feb1a8 Binary files /dev/null and b/resources/images/no_phone.png differ diff --git a/resources/images/phone_battery.png b/resources/images/phone_battery.png new file mode 100644 index 0000000..31f7300 Binary files /dev/null and b/resources/images/phone_battery.png differ diff --git a/resources/images/phone_battery_unknown.png b/resources/images/phone_battery_unknown.png new file mode 100644 index 0000000..84b71ae Binary files /dev/null and b/resources/images/phone_battery_unknown.png differ diff --git a/resources/images/phone_icon.png b/resources/images/phone_icon.png deleted file mode 100644 index f581294..0000000 Binary files a/resources/images/phone_icon.png and /dev/null differ diff --git a/resources/images/watch_battery.png b/resources/images/watch_battery.png new file mode 100644 index 0000000..bcdf0f9 Binary files /dev/null and b/resources/images/watch_battery.png differ diff --git a/resources/images/watch_icon.png b/resources/images/watch_icon.png deleted file mode 100644 index abb6fe2..0000000 Binary files a/resources/images/watch_icon.png and /dev/null differ diff --git a/src/pebble-mario.c b/src/pebble-mario.c index 4013afd..f973b9d 100644 --- a/src/pebble-mario.c +++ b/src/pebble-mario.c @@ -62,7 +62,8 @@ static GBitmap *mario_normal_bmp = NULL; static GBitmap *mario_jump_bmp = NULL; static GBitmap *block_bmp = NULL; static GBitmap *no_phone_bmp = NULL; -static GBitmap *phone_bmp = NULL; +static GBitmap *phone_battery_bmp = NULL; +static GBitmap *phone_battery_unknown_bmp = NULL; static GBitmap *watch_bmp = NULL; static GBitmap *battery_charging_bmp = NULL; static GBitmap *background_day_bmp = NULL; @@ -300,23 +301,29 @@ void phone_battery_update_callback(Layer *layer, GContext *ctx) #if PBL_COLOR graphics_context_set_compositing_mode(ctx, GCompOpSet); #else - graphics_context_set_compositing_mode(ctx, GCompOpAssign); + graphics_context_set_compositing_mode(ctx, GCompOpAssignInverted); #endif if (config_show_no_phone && !bluetooth_connection_service_peek()) { GRect image_rect = gbitmap_get_bounds(no_phone_bmp); graphics_draw_bitmap_in_rect(ctx, no_phone_bmp, image_rect); } - else if (phone_battery_level >= 0 && config_show_phone_battery) + else if (/*phone_battery_level >= 0 &&*/ config_show_phone_battery) { - GRect image_rect = gbitmap_get_bounds(phone_bmp); - graphics_draw_bitmap_in_rect(ctx, phone_bmp, image_rect); + if (phone_battery_level >= 0) + { + GRect image_rect = gbitmap_get_bounds(phone_battery_bmp); + graphics_draw_bitmap_in_rect(ctx, phone_battery_bmp, image_rect); #if PBL_COLOR - graphics_context_set_fill_color(ctx, GColorWhite); + graphics_context_set_fill_color(ctx, GColorWhite); #else - graphics_context_set_fill_color(ctx, GColorBlack); + graphics_context_set_fill_color(ctx, GColorBlack); #endif - graphics_fill_rect(ctx, GRect(9, 2, phone_battery_level, 5), 0, GCornerNone); + graphics_fill_rect(ctx, GRect(9, 2, phone_battery_level, 5), 0, GCornerNone); + } else { + GRect image_rect = gbitmap_get_bounds(phone_battery_unknown_bmp); + graphics_draw_bitmap_in_rect(ctx, phone_battery_unknown_bmp, image_rect); + } } } @@ -329,7 +336,7 @@ void battery_update_callback(Layer *layer, GContext *ctx) #if PBL_COLOR graphics_context_set_compositing_mode(ctx, GCompOpSet); #else - graphics_context_set_compositing_mode(ctx, GCompOpAssign); + graphics_context_set_compositing_mode(ctx, GCompOpAssignInverted); #endif if (!charge_state.is_charging) graphics_draw_bitmap_in_rect(ctx, watch_bmp, image_rect); @@ -403,8 +410,8 @@ void load_bitmaps() gbitmap_destroy(mario_jump_bmp); if (no_phone_bmp) gbitmap_destroy(no_phone_bmp); - if (phone_bmp) - gbitmap_destroy(phone_bmp); + if (phone_battery_bmp) + gbitmap_destroy(phone_battery_bmp); if (watch_bmp) gbitmap_destroy(watch_bmp); if (battery_charging_bmp) @@ -415,8 +422,9 @@ void load_bitmaps() mario_normal_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MARIO_NORMAL); mario_jump_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MARIO_JUMP); no_phone_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_NO_PHONE); - phone_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PHONE_ICON); - watch_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_WATCH_ICON); + phone_battery_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PHONE_BATTERY); + phone_battery_unknown_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PHONE_BATTERY_UNKNOWN); + watch_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_WATCH_BATTERY); battery_charging_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATTERY_CHARGING); block_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BLOCK); update_background(); @@ -582,7 +590,8 @@ void handle_deinit() gbitmap_destroy(mario_normal_bmp); gbitmap_destroy(mario_jump_bmp); gbitmap_destroy(no_phone_bmp); - gbitmap_destroy(phone_bmp); + gbitmap_destroy(phone_battery_bmp); + gbitmap_destroy(phone_battery_unknown_bmp); gbitmap_destroy(watch_bmp); gbitmap_destroy(battery_charging_bmp); gbitmap_destroy(block_bmp); -- cgit v1.2.3