Skip to content

Instantly share code, notes, and snippets.

@sarfata
Created March 29, 2014 01:21
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 sarfata/9846519 to your computer and use it in GitHub Desktop.
Save sarfata/9846519 to your computer and use it in GitHub Desktop.
Pebble Videos - Introduction to Pebble Development
#include <pebble.h>
Window *window;
TextLayer *text_layer;
void handle_init(void) {
// Create a window and text layer
window = window_create();
text_layer = text_layer_create(GRect(0, 0, 144, 154));
// Set the text, font, and text alignment
text_layer_set_text(text_layer, "Hello World!");
text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);
// Add the text layer to the window
layer_add_child(window_get_root_layer(window), text_layer_get_layer(text_layer));
// Push the window
window_stack_push(window, true);
// App Logging!
APP_LOG(APP_LOG_LEVEL_DEBUG, "Hello World from the applogs!");
}
void handle_deinit(void) {
// Destroy the text layer
text_layer_destroy(text_layer);
// Destroy the window
window_destroy(window);
}
int main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment