diff options
author | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-12-26 02:56:04 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-12-26 02:56:04 +0300 |
commit | 8ab676787229f38fc33243c13c450c7662d29c3c (patch) | |
tree | 6403972bd87917228cf9cd7c4415332126d61565 | |
parent | e4e880a3cec78261f11c19cc1c384a0815ea3c7f (diff) |
Luigi!
-rw-r--r-- | appinfo.json | 140 | ||||
-rw-r--r-- | resources/images/luigi-jump~bw.png | bin | 0 -> 345 bytes | |||
-rw-r--r-- | resources/images/luigi-jump~color.png | bin | 0 -> 610 bytes | |||
-rw-r--r-- | resources/images/luigi-normal~bw.png | bin | 0 -> 344 bytes | |||
-rw-r--r-- | resources/images/luigi-normal~color.png | bin | 0 -> 705 bytes | |||
-rw-r--r-- | src/js/pebble-js-app.js | 2 | ||||
-rw-r--r-- | src/pebble-mario.c | 50 |
7 files changed, 119 insertions, 73 deletions
diff --git a/appinfo.json b/appinfo.json index 70e9b68..a66dcb1 100644 --- a/appinfo.json +++ b/appinfo.json @@ -2,6 +2,7 @@ "appKeys": { "battery_request": 4, "config_background": 7, + "config_character": 15, "config_show_battery": 1, "config_show_no_phone": 0, "config_show_phone_battery": 6, @@ -23,144 +24,171 @@ "resources": { "media": [ { - "file": "images/watch_battery.png", - "name": "IMAGE_WATCH_BATTERY", - "type": "png" - }, - { - "file": "images/mario_bg_day.png", - "name": "IMAGE_BACKGROUND_DAY", - "targetPlatforms": [ - "aplite", - "basalt", - "chalk" - ], - "type": "png" - }, - { - "file": "images/mario_bg_night.png", - "name": "IMAGE_BACKGROUND_NIGHT", + "file": "images/luigi-jump.png", + "name": "IMAGE_LUIGI_JUMP", "targetPlatforms": [ "aplite", "basalt", "chalk" ], - "type": "png" + "type": "bitmap" }, { - "file": "images/mario_bg_underground.png", - "name": "IMAGE_BACKGROUND_UNDERGROUND", + "file": "images/luigi-normal.png", + "name": "IMAGE_LUIGI_NORMAL", + "storageFormat": "png", "targetPlatforms": [ "aplite", "basalt", "chalk" ], - "type": "png" + "type": "bitmap" }, { - "file": "images/mario_bg_castle.png", - "name": "IMAGE_BACKGROUND_CASTLE", + "file": "images/mario_bg_day.png", + "name": "IMAGE_BACKGROUND_DAY", "targetPlatforms": [ "aplite", "basalt", "chalk" ], - "type": "png" - }, - { - "file": "images/mario-jump-bw.png", - "name": "IMAGE_MARIO_JUMP", - "type": "png" - }, - { - "file": "images/mario-normal-bw.png", - "name": "IMAGE_MARIO_NORMAL", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_few_clouds_night.png", "name": "IMAGE_WEATHER_FEW_CLOUDS_NIGHT", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_rain_night.png", "name": "IMAGE_WEATHER_RAIN_NIGHT", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_clear_sky_night.png", "name": "IMAGE_WEATHER_CLEAR_SKY_NIGHT", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_unknown.png", "name": "IMAGE_WEATHER_UNKNOWN", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_thunderstorm.png", "name": "IMAGE_WEATHER_THUNDERSTORM", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_snow.png", "name": "IMAGE_WEATHER_SNOW", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_shower_rain.png", "name": "IMAGE_WEATHER_SHOWER_RAIN", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_scattered_clouds.png", "name": "IMAGE_WEATHER_SCATTERED_CLOUDS", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_rain_day.png", "name": "IMAGE_WEATHER_RAIN_DAY", - "type": "png" + "type": "bitmap" + }, + { + "file": "images/mario-jump-bw.png", + "name": "IMAGE_MARIO_JUMP", + "type": "bitmap" + }, + { + "file": "images/mario-normal-bw.png", + "name": "IMAGE_MARIO_NORMAL", + "type": "bitmap" + }, + { + "file": "images/menuicon.png", + "menuIcon": true, + "name": "IMAGE_MENU_ICON", + "type": "bitmap" + }, + { + "file": "images/mario_bg_underground.png", + "name": "IMAGE_BACKGROUND_UNDERGROUND", + "targetPlatforms": [ + "aplite", + "basalt", + "chalk" + ], + "type": "bitmap" + }, + { + "file": "images/mario_bg_castle.png", + "name": "IMAGE_BACKGROUND_CASTLE", + "targetPlatforms": [ + "aplite", + "basalt", + "chalk" + ], + "type": "bitmap" + }, + { + "file": "images/watch_battery.png", + "name": "IMAGE_WATCH_BATTERY", + "type": "bitmap" + }, + { + "file": "images/mario_bg_night.png", + "name": "IMAGE_BACKGROUND_NIGHT", + "targetPlatforms": [ + "aplite", + "basalt", + "chalk" + ], + "type": "bitmap" }, { "file": "images/weather_mist.png", "name": "IMAGE_WEATHER_MIST", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_few_clouds_day.png", "name": "IMAGE_WEATHER_FEW_CLOUDS_DAY", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_clear_sky_day.png", "name": "IMAGE_WEATHER_CLEAR_SKY_DAY", - "type": "png" + "type": "bitmap" }, { "file": "images/weather_broken_clouds.png", "name": "IMAGE_WEATHER_BROKEN_CLOUDS", - "type": "png" + "type": "bitmap" }, { "file": "images/phone_battery.png", "name": "IMAGE_PHONE_BATTERY", - "type": "png" + "type": "bitmap" }, { "file": "images/no_phone.png", "name": "IMAGE_NO_PHONE", - "type": "png" + "type": "bitmap" }, { "file": "images/battery_charging.png", "name": "IMAGE_BATTERY_CHARGING", - "type": "png" + "type": "bitmap" }, { "file": "images/phone_battery_unknown.png", "name": "IMAGE_PHONE_BATTERY_UNKNOWN", - "type": "png" + "type": "bitmap" }, { "characterRegex": "[,0-9A-Z]", @@ -171,19 +199,13 @@ { "file": "images/mario_block_48_bw.png", "name": "IMAGE_BLOCK", - "type": "png" + "type": "bitmap" }, { "characterRegex": "[0-9]", "file": "fonts/Gamegirl.ttf", "name": "FONT_GAMEGIRL_24", "type": "font" - }, - { - "file": "images/menuicon.png", - "menuIcon": true, - "name": "IMAGE_MENU_ICON", - "type": "png" } ] }, @@ -195,7 +217,7 @@ "chalk" ], "uuid": "43caa750-2896-4f46-94dc-1adbd4bc1ff3", - "versionLabel": "3.30", + "versionLabel": "3.31", "watchapp": { "watchface": true } diff --git a/resources/images/luigi-jump~bw.png b/resources/images/luigi-jump~bw.png Binary files differnew file mode 100644 index 0000000..8f34832 --- /dev/null +++ b/resources/images/luigi-jump~bw.png diff --git a/resources/images/luigi-jump~color.png b/resources/images/luigi-jump~color.png Binary files differnew file mode 100644 index 0000000..8cef150 --- /dev/null +++ b/resources/images/luigi-jump~color.png diff --git a/resources/images/luigi-normal~bw.png b/resources/images/luigi-normal~bw.png Binary files differnew file mode 100644 index 0000000..9153b66 --- /dev/null +++ b/resources/images/luigi-normal~bw.png diff --git a/resources/images/luigi-normal~color.png b/resources/images/luigi-normal~color.png Binary files differnew file mode 100644 index 0000000..b7ebc0c --- /dev/null +++ b/resources/images/luigi-normal~color.png diff --git a/src/js/pebble-js-app.js b/src/js/pebble-js-app.js index bcbdf66..0b0823e 100644 --- a/src/js/pebble-js-app.js +++ b/src/js/pebble-js-app.js @@ -84,7 +84,7 @@ Pebble.addEventListener("showConfiguration", function() { var watch = null; } var platform = "&platform=" + ((watch != null) ? watch.platform : "unknown"); - var config_version = "&v=2"; + var config_version = "&v=3"; console.log("Showing configuration"); Pebble.openURL("http://clusterrr.com/pebble_configs/mario_w.php" + cfg + platform + config_version); }); diff --git a/src/pebble-mario.c b/src/pebble-mario.c index f82474b..e9ec6ee 100644 --- a/src/pebble-mario.c +++ b/src/pebble-mario.c @@ -82,6 +82,7 @@ static bool config_show_battery = true; static bool config_show_phone_battery = false; static bool config_show_weather = true; static bool config_vibe = false; +static int config_character = 0; static int config_background = 0; static int phone_battery_level = -1; static bool config_vibe_hour = false; @@ -126,6 +127,12 @@ static char digits[10][15] = {{1,1,1,1,0,1,1,0,1,1,0,1,1,1,1},{0,0,1,0,0,1,0,0,1 #define MSG_WEATHER_REQUEST 12 #define ID_LEFT_INFO_MODE 13 #define MSG_VIBE_HOUR 14 +#define MSG_CHARACTER 15 +#ifdef DEMO + #define MARIO_TIME_UNIT SECOND_UNIT +#else + #define MARIO_TIME_UNIT MINUTE_UNIT +#endif void handle_tick(struct tm *tick_time, TimeUnits units_changed); @@ -162,6 +169,7 @@ static void request_all() static void request_all_on_start(void* data) { + tick_timer_service_subscribe(MARIO_TIME_UNIT, handle_tick); request_all(); } @@ -450,6 +458,25 @@ void handle_battery(BatteryChargeState charge_state) layer_mark_dirty(battery_layer); } +void update_character() +{ + if (mario_normal_bmp) + gbitmap_destroy(mario_normal_bmp); + if (mario_jump_bmp) + gbitmap_destroy(mario_jump_bmp); + switch (config_character) + { + case 1: + mario_normal_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_LUIGI_NORMAL); + mario_jump_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_LUIGI_JUMP); + break; + default: + mario_normal_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MARIO_NORMAL); + mario_jump_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MARIO_JUMP); + break; + } +} + void update_background() { if (background_day_bmp) @@ -498,10 +525,6 @@ void update_background() void load_bitmaps() { - if (mario_normal_bmp) - gbitmap_destroy(mario_normal_bmp); - if (mario_jump_bmp) - gbitmap_destroy(mario_jump_bmp); if (no_phone_bmp) gbitmap_destroy(no_phone_bmp); if (phone_battery_bmp) @@ -513,14 +536,13 @@ void load_bitmaps() if (block_bmp) gbitmap_destroy(block_bmp); - 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_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_character(); update_background(); } @@ -644,6 +666,13 @@ void in_received_handler(DictionaryIterator *received, void *context) { layer_mark_dirty(background_layer); persist_write_int(MSG_BACKGROUND, config_background); } + tuple = dict_find(received, MSG_CHARACTER); + if (tuple) { + config_character = tuple->value->int8; + update_character(); + layer_mark_dirty(mario_layer); + persist_write_int(MSG_CHARACTER, config_character); + } tuple = dict_find(received, MSG_BATTERY_ANSWER); if (tuple) { phone_battery_level = tuple->value->int8; @@ -691,6 +720,8 @@ void handle_init() weather_temperature = persist_read_int(MSG_WEATHER_TEMPERATURE); if (persist_exists(ID_LEFT_INFO_MODE)) left_info_mode = persist_read_int(ID_LEFT_INFO_MODE); + if (persist_exists(MSG_CHARACTER)) + config_character = persist_read_int(MSG_CHARACTER); app_message_register_inbox_received(in_received_handler); app_message_open(128, 64); @@ -760,13 +791,6 @@ void handle_init() window_stack_push(window, false); -#ifdef DEMO - #define MARIO_TIME_UNIT SECOND_UNIT -#else - #define MARIO_TIME_UNIT MINUTE_UNIT -#endif - - tick_timer_service_subscribe(MARIO_TIME_UNIT, handle_tick); bluetooth_connection_service_subscribe(bluetooth_connection_callback); battery_state_service_subscribe(handle_battery); if (config_show_weather && config_show_phone_battery) |