Skip to content
21 changes: 18 additions & 3 deletions Apps/System/systemapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ static Window *s_about_window;
static Layer *s_aboutCanvas_layer;
static ScrollLayer *s_about_scroll;
static void about_update_proc(Layer *layer, GContext *nGContext);
static GBitmap *logo_color;
static GBitmap *rocket_color;
static GBitmap *logo_bw;
static GBitmap *rocket_color;

StatusBarLayer *status_bar;

Expand Down Expand Up @@ -184,6 +188,15 @@ static void about_window_load(Window *window)

layer_add_child(window_layer, scroll_layer_get_layer(s_about_scroll));
layer_add_child(window_layer, status_bar_layer_get_layer(status_bar));

#ifdef PBL_BW
logo_bw = gbitmap_create_with_resource(RESOURCE_ID_REBBLE_LOGO_BW);
//TODO: rocket_bw =
#else
logo_color = gbitmap_create_with_resource(RESOURCE_ID_REBBLE_LOGO_DARK);
rocket_color = gbitmap_create_with_resource(RESOURCE_ID_TO_MOON);
#endif

}

static void about_update_proc(Layer *layer, GContext *nGContext)
Expand All @@ -207,18 +220,20 @@ static void about_update_proc(Layer *layer, GContext *nGContext)
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, 0);

#ifdef PBL_BW
graphics_draw_bitmap_in_rect(nGContext, gbitmap_create_with_resource(RESOURCE_ID_REBBLE_LOGO_BW), GRect((bounds.size.w/2)-17, (bounds.size.h/2)-63, 34, 53));
graphics_draw_bitmap_in_rect(nGContext, logo_bw, GRect((bounds.size.w/2)-17, (bounds.size.h/2)-63, 34, 53));
//TODO: Get black and white rocket bitmap for Classic
//graphics_draw_bitmap_in_rect(nGContext, gbitmap_create_with_resource(RESOURCE_ID_TO_MOON_BW), GRect((bounds.size.w/2)-8, (bounds.size.h/2)+60, 19, 19));
#else
graphics_draw_bitmap_in_rect(nGContext, gbitmap_create_with_resource(RESOURCE_ID_REBBLE_LOGO_DARK), GRect((bounds.size.w/2)-17, (bounds.size.h/2)-63, 34, 53));
graphics_draw_bitmap_in_rect(nGContext, gbitmap_create_with_resource(RESOURCE_ID_TO_MOON), GRect((bounds.size.w/2)-8, (bounds.size.h/2)+60, 19, 19));
graphics_draw_bitmap_in_rect(nGContext, logo_color, GRect((bounds.size.w/2)-17, (bounds.size.h/2)-63, 34, 53));
graphics_draw_bitmap_in_rect(nGContext, rocket_color, GRect((bounds.size.w/2)-8, (bounds.size.h/2)+60, 19, 19));
#endif
}

static void about_window_unload(Window *window)
{
scroll_layer_destroy(s_about_scroll);
gbitmap_destroy(logo_color);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this only works on color, and breaks on B&W. Recommend just having 'logo' and 'rocket', and conditionally initializing them on B&W and color (and assigning them to NULL); then checking for NULL when you destroy. i.e.,

static GBitmap *logo;
...
logo = create(...);
...
if (logo)
   graphics_draw_bitmap_in_rect...
...
if (logo)
  gbitmap_destroy(logo);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, not sure why I didn't think of it. Implemented something similar I think will work, let me know if I need to revise.

gbitmap_destroy(rocket_color);
}

void systemapp_init(void)
Expand Down