Skip to content

Instantly share code, notes, and snippets.

@JaviSoto
Created April 17, 2013 16:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaviSoto/5405969 to your computer and use it in GitHub Desktop.
Save JaviSoto/5405969 to your computer and use it in GitHub Desktop.
My first Pebble Watchface
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#define MY_UUID { 0x57, 0xFF, 0x75, 0x31, 0x72, 0x97, 0x46, 0x0A, 0x86, 0x02, 0x6F, 0x6F, 0x79, 0xEA, 0x4E, 0xE4 }
PBL_APP_INFO(MY_UUID,
"Watchface", "Javier Soto",
1, 0, /* App version */
DEFAULT_MENU_ICON,
APP_INFO_WATCH_FACE);
static Window window;
static TextLayer textLayer;
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Stopwatch");
window_stack_push(&window, true /* Animated */);
Layer *root = window_get_root_layer(&window);
text_layer_init(&textLayer, window.layer.bounds);
text_layer_set_text(&textLayer, "Javi");
text_layer_set_background_color(&textLayer, GColorClear);
text_layer_set_font(&textLayer, fonts_get_system_font(FONT_KEY_GOTHAM_42_BOLD));
text_layer_set_text_alignment(&textLayer, GTextAlignmentCenter);
layer_add_child(root, (Layer *)&textLayer);
}
void pbl_main(void *params) {
PebbleAppHandlers handlers = {
.init_handler = &handle_init
};
app_event_loop(params, &handlers);
}
@JaviSoto
Copy link
Author

Photo:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment