diff options
author | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-10-17 15:51:29 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com> | 2015-10-17 15:51:29 +0300 |
commit | e4e880a3cec78261f11c19cc1c384a0815ea3c7f (patch) | |
tree | 398bbdd91bc6648e35523837c7f88c755014e682 | |
parent | 0a6144f10edcda677403b905c86adf1b7b6b86c9 (diff) |
First request delay
-rw-r--r-- | appinfo.json | 65 | ||||
-rw-r--r-- | resources/images/mario_bg_castle.png (renamed from resources/images/mario_bg_castle_color.png) | bin | 119 -> 119 bytes | |||
-rw-r--r-- | resources/images/mario_bg_castle~basalt.png | bin | 0 -> 761 bytes | |||
-rw-r--r-- | resources/images/mario_bg_castle~chalk.png | bin | 0 -> 911 bytes | |||
-rw-r--r-- | resources/images/mario_bg_day~basalt.png | bin | 0 -> 4968 bytes | |||
-rw-r--r-- | resources/images/mario_bg_day~chalk.png | bin | 0 -> 2252 bytes | |||
-rw-r--r-- | resources/images/mario_bg_night.png (renamed from resources/images/mario_bg_night_color.png) | bin | 119 -> 119 bytes | |||
-rw-r--r-- | resources/images/mario_bg_night~basalt.png | bin | 0 -> 1637 bytes | |||
-rw-r--r-- | resources/images/mario_bg_night~chalk.png | bin | 0 -> 1833 bytes | |||
-rw-r--r-- | resources/images/mario_bg_underground.png (renamed from resources/images/mario_bg_underground_color.png) | bin | 119 -> 119 bytes | |||
-rw-r--r-- | resources/images/mario_bg_underground~basalt.png | bin | 0 -> 1041 bytes | |||
-rw-r--r-- | resources/images/mario_bg_underground~chalk.png | bin | 0 -> 1198 bytes | |||
-rw-r--r-- | src/js/pebble-js-app.js | 3 | ||||
-rw-r--r-- | src/pebble-mario.c | 49 |
14 files changed, 83 insertions, 34 deletions
diff --git a/appinfo.json b/appinfo.json index 0fae2e6..70e9b68 100644 --- a/appinfo.json +++ b/appinfo.json @@ -23,8 +23,48 @@ "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", + "targetPlatforms": [ + "aplite", + "basalt", + "chalk" + ], + "type": "png" + }, + { + "file": "images/mario_bg_underground.png", + "name": "IMAGE_BACKGROUND_UNDERGROUND", + "targetPlatforms": [ + "aplite", + "basalt", + "chalk" + ], + "type": "png" + }, + { + "file": "images/mario_bg_castle.png", + "name": "IMAGE_BACKGROUND_CASTLE", + "targetPlatforms": [ + "aplite", + "basalt", + "chalk" + ], "type": "png" }, { @@ -103,11 +143,6 @@ "type": "png" }, { - "file": "images/watch_battery.png", - "name": "IMAGE_WATCH_BATTERY", - "type": "png" - }, - { "file": "images/phone_battery.png", "name": "IMAGE_PHONE_BATTERY", "type": "png" @@ -128,21 +163,6 @@ "type": "png" }, { - "file": "images/mario_bg_night_color.png", - "name": "IMAGE_BACKGROUND_NIGHT", - "type": "png" - }, - { - "file": "images/mario_bg_underground_color.png", - "name": "IMAGE_BACKGROUND_UNDERGROUND", - "type": "png" - }, - { - "file": "images/mario_bg_castle_color.png", - "name": "IMAGE_BACKGROUND_CASTLE", - "type": "png" - }, - { "characterRegex": "[,0-9A-Z]", "file": "fonts/emulogic.ttf", "name": "FONT_EMULOGIC_8", @@ -171,10 +191,11 @@ "shortName": "Mario Time", "targetPlatforms": [ "aplite", - "basalt" + "basalt", + "chalk" ], "uuid": "43caa750-2896-4f46-94dc-1adbd4bc1ff3", - "versionLabel": "3.22", + "versionLabel": "3.30", "watchapp": { "watchface": true } diff --git a/resources/images/mario_bg_castle_color.png b/resources/images/mario_bg_castle.png Binary files differindex 818c71d..818c71d 100644 --- a/resources/images/mario_bg_castle_color.png +++ b/resources/images/mario_bg_castle.png diff --git a/resources/images/mario_bg_castle~basalt.png b/resources/images/mario_bg_castle~basalt.png Binary files differnew file mode 100644 index 0000000..cd33b3c --- /dev/null +++ b/resources/images/mario_bg_castle~basalt.png diff --git a/resources/images/mario_bg_castle~chalk.png b/resources/images/mario_bg_castle~chalk.png Binary files differnew file mode 100644 index 0000000..b4d0032 --- /dev/null +++ b/resources/images/mario_bg_castle~chalk.png diff --git a/resources/images/mario_bg_day~basalt.png b/resources/images/mario_bg_day~basalt.png Binary files differnew file mode 100644 index 0000000..499738a --- /dev/null +++ b/resources/images/mario_bg_day~basalt.png diff --git a/resources/images/mario_bg_day~chalk.png b/resources/images/mario_bg_day~chalk.png Binary files differnew file mode 100644 index 0000000..773af09 --- /dev/null +++ b/resources/images/mario_bg_day~chalk.png diff --git a/resources/images/mario_bg_night_color.png b/resources/images/mario_bg_night.png Binary files differindex 818c71d..818c71d 100644 --- a/resources/images/mario_bg_night_color.png +++ b/resources/images/mario_bg_night.png diff --git a/resources/images/mario_bg_night~basalt.png b/resources/images/mario_bg_night~basalt.png Binary files differnew file mode 100644 index 0000000..d7ee13c --- /dev/null +++ b/resources/images/mario_bg_night~basalt.png diff --git a/resources/images/mario_bg_night~chalk.png b/resources/images/mario_bg_night~chalk.png Binary files differnew file mode 100644 index 0000000..ee747c1 --- /dev/null +++ b/resources/images/mario_bg_night~chalk.png diff --git a/resources/images/mario_bg_underground_color.png b/resources/images/mario_bg_underground.png Binary files differindex 818c71d..818c71d 100644 --- a/resources/images/mario_bg_underground_color.png +++ b/resources/images/mario_bg_underground.png diff --git a/resources/images/mario_bg_underground~basalt.png b/resources/images/mario_bg_underground~basalt.png Binary files differnew file mode 100644 index 0000000..cbc61f2 --- /dev/null +++ b/resources/images/mario_bg_underground~basalt.png diff --git a/resources/images/mario_bg_underground~chalk.png b/resources/images/mario_bg_underground~chalk.png Binary files differnew file mode 100644 index 0000000..114169f --- /dev/null +++ b/resources/images/mario_bg_underground~chalk.png diff --git a/src/js/pebble-js-app.js b/src/js/pebble-js-app.js index 827bf6b..bcbdf66 100644 --- a/src/js/pebble-js-app.js +++ b/src/js/pebble-js-app.js @@ -9,6 +9,7 @@ var options = { "config_vibe_hour": false, "config_background": 0, }; +var weatherAPI = "5d949dcb47bf776e783aa63ed22d4f60"; var locationOptions = { "timeout": 60000, "maximumAge": 60000 * 30 }; @@ -17,7 +18,7 @@ function locationSuccess(pos) { console.log("Location: lat = "+coordinates.latitude+", lon = "+coordinates.longitude); console.log("Requesting weather..."); var req = new XMLHttpRequest(); - req.open('GET', "http://api.openweathermap.org/data/2.5/weather?lat="+coordinates.latitude+"&lon="+coordinates.longitude, true); + req.open('GET', "http://api.openweathermap.org/data/2.5/weather?lat="+coordinates.latitude+"&lon="+coordinates.longitude+"&APPID="+weatherAPI, true); req.onreadystatechange = function() { if (req.readyState == 4) { if(req.status == 200) { diff --git a/src/pebble-mario.c b/src/pebble-mario.c index 665469c..f82474b 100644 --- a/src/pebble-mario.c +++ b/src/pebble-mario.c @@ -160,6 +160,11 @@ static void request_all() } } +static void request_all_on_start(void* data) +{ + request_all(); +} + void time_update_callback(Layer *layer, GContext *ctx) { GRect layer_bounds = layer_get_bounds(layer); @@ -282,9 +287,15 @@ void ground_update_callback(Layer *layer, GContext *ctx) graphics_context_set_compositing_mode(ctx, GCompOpAssign); graphics_draw_bitmap_in_rect(ctx, background_day_bmp, layer_bounds); +#if !PBL_PLATFORM_CHALK layer_bounds.origin.y = 5; layer_bounds.origin.x = 31; -#if PBL_COLOR +#else + layer_bounds.origin.y = 13; + layer_bounds.origin.x = 31+18; +#endif + + #if PBL_COLOR graphics_context_set_text_color(ctx, GColorWhite); #else graphics_context_set_text_color(ctx, GColorBlack); @@ -683,24 +694,39 @@ void handle_init() app_message_register_inbox_received(in_received_handler); app_message_open(128, 64); - window = window_create(); - blocks_up_rect = GRect(22, -10, BLOCK_SIZE*2, BLOCK_SIZE + 4); +#if !PBL_PLATFORM_CHALK + int offset_x = 0; + int offset_y = 0; + int screen_size_x = 144; + int screen_size_y = 168; +#else + int offset_x = 18; + int offset_y = 6; + int screen_size_x = 180; + int screen_size_y = 180; +#endif + + blocks_up_rect = GRect(22+offset_x, -10, BLOCK_SIZE*2, BLOCK_SIZE + 4); #if PBL_COLOR - mario_down_rect = GRect(32 + 15, 168-GROUND_HEIGHT-76 + 28 + 10, 80, 80); - mario_up_rect = GRect(32 + 15, BLOCK_SIZE + 4 + 10, 80, 80); - blocks_down_rect = GRect(22, 25, BLOCK_SIZE*2, BLOCK_SIZE + 4); + mario_down_rect = GRect(32 + 15 + offset_x, 168-GROUND_HEIGHT-76 + 28 + 10 + offset_y, 80, 80); + mario_up_rect = GRect(32 + 15 + offset_x, BLOCK_SIZE + 4 + 10 + offset_y, 80, 80); + blocks_down_rect = GRect(22 + offset_x, 25 + offset_y, BLOCK_SIZE*2, BLOCK_SIZE + 4); #else mario_down_rect = GRect(32, 168-GROUND_HEIGHT-80 + 10, 80, 80); mario_up_rect = GRect(32, BLOCK_SIZE + 4, 80, 80); blocks_down_rect = GRect(22, 16, BLOCK_SIZE*2, BLOCK_SIZE + 4); #endif - background_rect = GRect(0, 0, 144, 168); - battery_rect = GRect(119, 5, 22, 9); + background_rect = GRect(0, 0, screen_size_x, screen_size_y); +#if !PBL_PLATFORM_CHALK phone_battery_rect = GRect(3, 3, 24, 13); - + battery_rect = GRect(119, 5, 22, 9); +#else + phone_battery_rect = GRect(3, 3+80, 24, 13); + battery_rect = GRect(119+36, 5+80, 22, 9); +#endif pixel_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_GAMEGIRL_24)); //pixel_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_EMULOGIC_24)); pixel_font_small = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_EMULOGIC_8)); @@ -746,7 +772,8 @@ void handle_init() if (config_show_weather && config_show_phone_battery) accel_tap_service_subscribe(accel_tap_handler); - request_all(); + app_timer_register(1000, request_all_on_start, NULL); + //request_all(); load_bitmaps(); load_weather_icon(); @@ -886,7 +913,7 @@ void block_up_animation_stopped(Animation *animation, void *data) } void handle_tick(struct tm *tick_time, TimeUnits units_changed) -{ +{ #ifdef DEMO if (tick_time->tm_sec % 15 != 0) return; #endif |