Skip to content

Instantly share code, notes, and snippets.

@bani
Created February 16, 2016 01:23
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 bani/0a640fa3fd4964416a55 to your computer and use it in GitHub Desktop.
Save bani/0a640fa3fd4964416a55 to your computer and use it in GitHub Desktop.
Pebble watchface background image example code
static void set_background_gem(int color) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Updating background gem");
if (s_bitmap) gbitmap_destroy(s_bitmap);
switch(color) {
case 0:
s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_DIAMOND);
break;
case 1:
s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_DIAMONDAQUA);
break;
// (...)
default:
s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_DIAMOND);
}
bitmap_layer_set_bitmap(s_bitmap_layer, s_bitmap);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment