Skip to content

Instantly share code, notes, and snippets.

@jdoxey
Created October 3, 2014 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdoxey/fe3d2fe32e6735d8f828 to your computer and use it in GitHub Desktop.
Save jdoxey/fe3d2fe32e6735d8f828 to your computer and use it in GitHub Desktop.
#include <pebble.h>
static TextLayer *hello_text_layer;
static void message_received(DictionaryIterator *iterator, void *context) {
char *message = dict_find(iterator, 0)->value->cstring;
text_layer_set_text(hello_text_layer, message);
text_layer_set_font(hello_text_layer, fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49));
}
int main(void) {
app_message_register_inbox_received(message_received);
app_message_open(app_message_inbox_size_maximum(), 0);
Window *first_window = window_create();
hello_text_layer = text_layer_create(GRect(10, 10, 124, 148));
text_layer_set_text(hello_text_layer, "Loading...");
layer_add_child(window_get_root_layer(first_window), text_layer_get_layer(hello_text_layer));
window_stack_push(first_window, true);
app_event_loop();
text_layer_destroy(hello_text_layer);
window_destroy(first_window);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment