c - Unable to add fullscreen bitmap to Pebble due to window size -
i'm using pebble sdk 2 , running graphics problems.
i'm trying add full screen graphic dimensions 144 x 168, however, when do-- bottom gets clipped.
investigating further- root layer has dimensions of 144 x 152 rather 144 x 168 (pebble's fullscreen dimensions). set window full screen, before adding bitmap , calling window_stack_push
, status bar should not issue (although, dimensions of status bar supposedly fit space missing).
code below:
void handle_init(void) { s_main_window = window_create(); window_set_fullscreen(s_main_window, true); window_set_window_handlers(s_main_window, (windowhandlers) { .load = main_window_load, .unload = main_window_unload }); const bool animated = true; window_set_click_config_provider(s_main_window, click_config_provider); window_stack_push(s_main_window, animated); } static void main_window_load(window *window) { // create gbitmap, set created bitmaplayer s_background_bitmap = gbitmap_create_with_resource(resource_id_chill_bg5); s_background_layer = bitmap_layer_create(grect(0, 0, 144, 168)); bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap); layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_background_layer)); }
updated code:
static void breathe_window_load(window *window) { layer *window_layer = window_get_root_layer(window); // create gbitmap, set created bitmaplayer s_background_bitmap_3 = gbitmap_create_with_resource(resource_id_chill_bg6); s_background_layer_3 = bitmap_layer_create(grect(0, -16, 144, 168)); bitmap_layer_set_bitmap(s_background_layer_3, s_background_bitmap_3); layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_background_layer_3)); } static void breathe_window_unload(window *window) { gbitmap_destroy(s_background_bitmap_3); bitmap_layer_destroy(s_background_layer_3); animation_unschedule_all(); window_destroy(s_window_2); } static void up_click_handler(clickrecognizerref recognizer, void *context) { s_window_2 = window_create(); window_set_window_handlers(s_window_2, (windowhandlers) { .load = breathe_window_load, .unload = breathe_window_unload }); const bool animated = true; window_stack_push(s_window_2, animated); next_animation(); }
Comments
Post a Comment