Created
May 30, 2013 11:24
-
-
Save Katharine/5677221 to your computer and use it in GitHub Desktop.
This code will crash your watch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pebble_os.h" | |
#include "pebble_app.h" | |
#include "pebble_fonts.h" | |
#define MY_UUID { 0xF7, 0x58, 0xEF, 0x93, 0x27, 0xBB, 0x4F, 0x0E, 0x93, 0x9A, 0x8F, 0x6A, 0xF1, 0x6F, 0x0A, 0x63 } | |
PBL_APP_INFO(MY_UUID, | |
"Animation Crash", "Your Company", | |
1, 0, /* App version */ | |
DEFAULT_MENU_ICON, | |
APP_INFO_STANDARD_APP); | |
Window window; | |
TextLayer layer; | |
PropertyAnimation anim; | |
void handle_init(AppContextRef ctx) { | |
window_init(&window, "Window Name"); | |
window_stack_push(&window, true /* Animated */); | |
text_layer_init(&layer, GRect(10, 10, 100, 40)); | |
text_layer_set_text(&layer, "Animated layer"); | |
layer_add_child(window_get_root_layer(&window), (Layer*)&layer); | |
property_animation_init_layer_frame(&anim, (Layer*)&layer, &GRect(10, 10, 100, 40), &GRect(10, 100, 100, 40)); | |
animation_set_duration(&anim.animation, 2000); | |
animation_schedule(&anim.animation); | |
animation_schedule(&anim.animation); // This line crashes. | |
} | |
void pbl_main(void *params) { | |
PebbleAppHandlers handlers = { | |
.init_handler = &handle_init | |
}; | |
app_event_loop(params, &handlers); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment