diff options
author | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-05-23 01:34:45 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-05-23 01:34:45 +0300 |
commit | 62cb944b85e5b44ac6238f78e9b9a854e8c02b0d (patch) | |
tree | 8e2f31453d6ef1a0356e5fd9ae24352900dee74e | |
parent | cea9518643d122d011c9201dd5ffd90972c6cc94 (diff) |
Some optimizations and new image
-rw-r--r-- | appinfo.json | 22 | ||||
-rw-r--r-- | resources/images/battery-charging.png | bin | 220 -> 0 bytes | |||
-rw-r--r-- | resources/images/battery_charging.png | bin | 0 -> 214 bytes | |||
-rw-r--r-- | resources/images/no-phone.png | bin | 221 -> 0 bytes | |||
-rw-r--r-- | resources/images/no_phone.png | bin | 0 -> 229 bytes | |||
-rw-r--r-- | resources/images/phone_battery.png | bin | 0 -> 212 bytes | |||
-rw-r--r-- | resources/images/phone_battery_unknown.png | bin | 0 -> 231 bytes | |||
-rw-r--r-- | resources/images/phone_icon.png | bin | 208 -> 0 bytes | |||
-rw-r--r-- | resources/images/watch_battery.png | bin | 0 -> 215 bytes | |||
-rw-r--r-- | resources/images/watch_icon.png | bin | 207 -> 0 bytes | |||
-rw-r--r-- | src/pebble-mario.c | 37 |
11 files changed, 36 insertions, 23 deletions
diff --git a/appinfo.json b/appinfo.json index 07641f9..9091189 100644 --- a/appinfo.json +++ b/appinfo.json @@ -15,26 +15,31 @@ "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", "type": "png" @@ -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 Binary files differdeleted file mode 100644 index 3350309..0000000 --- a/resources/images/battery-charging.png +++ /dev/null diff --git a/resources/images/battery_charging.png b/resources/images/battery_charging.png Binary files differnew file mode 100644 index 0000000..3c91e15 --- /dev/null +++ b/resources/images/battery_charging.png diff --git a/resources/images/no-phone.png b/resources/images/no-phone.png Binary files differdeleted file mode 100644 index 6f7feb1..0000000 --- a/resources/images/no-phone.png +++ /dev/null diff --git a/resources/images/no_phone.png b/resources/images/no_phone.png Binary files differnew file mode 100644 index 0000000..5feb1a8 --- /dev/null +++ b/resources/images/no_phone.png diff --git a/resources/images/phone_battery.png b/resources/images/phone_battery.png Binary files differnew file mode 100644 index 0000000..31f7300 --- /dev/null +++ b/resources/images/phone_battery.png diff --git a/resources/images/phone_battery_unknown.png b/resources/images/phone_battery_unknown.png Binary files differnew file mode 100644 index 0000000..84b71ae --- /dev/null +++ b/resources/images/phone_battery_unknown.png diff --git a/resources/images/phone_icon.png b/resources/images/phone_icon.png Binary files differdeleted file mode 100644 index f581294..0000000 --- a/resources/images/phone_icon.png +++ /dev/null diff --git a/resources/images/watch_battery.png b/resources/images/watch_battery.png Binary files differnew file mode 100644 index 0000000..bcdf0f9 --- /dev/null +++ b/resources/images/watch_battery.png diff --git a/resources/images/watch_icon.png b/resources/images/watch_icon.png Binary files differdeleted file mode 100644 index abb6fe2..0000000 --- a/resources/images/watch_icon.png +++ /dev/null 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); |