static void load_sequence() {
  // Free old data
  if(s_sequence) {
    gbitmap_sequence_destroy(s_sequence);
    s_sequence = NULL;
  }
  if(s_bitmap) {
    gbitmap_destroy(s_bitmap);
    s_bitmap = NULL;
  }    

  // Create 
  if(shinyAlly)
  {
    s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_ALLY_POKEMON_SHINY);
  }
  else
  {
    s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_ALLY_POKEMON);
  }
  
  // Create GBitmap
  s_bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(s_sequence), GBitmapFormat8Bit);

  // Begin animation
  app_timer_register(1, timer_handler, NULL);
}
Esempio n. 2
0
static void initialise_ui(void) {
  s_window = window_create();
//#ifdef PBL_PLATFORM_APLITE
//  window_set_fullscreen(s_window, false);
//#endif
  Layer *window_layer = window_get_root_layer(s_window);
  
  s_res_droid_serif_28_bold = fonts_get_system_font(FONT_KEY_DROID_SERIF_28_BOLD);
  // s_textlayer_1

#ifdef PBL_ROUND
  s_textlayer_1 = text_layer_create(GRect(0, 52, 180, 37));
#else
  s_textlayer_1 = text_layer_create(GRect(0, 32, 144, 37));
#endif
  text_layer_set_text(s_textlayer_1, "rss-news");
  text_layer_set_text_alignment(s_textlayer_1, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_1, s_res_droid_serif_28_bold);
  layer_add_child(window_layer, (Layer *)s_textlayer_1);

  s_res_gothic_14 = fonts_get_system_font(FONT_KEY_GOTHIC_14);
#ifdef PBL_ROUND
  s_textlayer_2 = text_layer_create(GRect(0, 95, 180, 27));
#else
  s_textlayer_2 = text_layer_create(GRect(0, 95, 144, 27));
#endif
  text_layer_set_text(s_textlayer_2, "Currently unavailable");
  text_layer_set_text_alignment(s_textlayer_2, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_2, s_res_gothic_14);
  layer_add_child(window_layer, (Layer *)s_textlayer_2);
  hide_no_con_error();
  
#ifndef PBL_PLATFORM_APLITE
#ifdef PBL_ROUND
  s_bitmap_layer = bitmap_layer_create(GRect(57, 92, 64, 64));
#else
  s_bitmap_layer = bitmap_layer_create(GRect(37, 72, 64, 64));
#endif
  layer_add_child(window_layer, bitmap_layer_get_layer(s_bitmap_layer));

  // Create sequence
  s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_LOADING_ANIMATION);
  // Create GBitmap
  s_bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(s_sequence), GBitmapFormat8Bit);
  // Begin animation
  app_timer_register(1, timer_handler, NULL);

  // Set up the status bar last to ensure it is on top of other Layers
  s_status_bar = status_bar_layer_create();
  layer_add_child(window_layer, status_bar_layer_get_layer(s_status_bar));
#else
  s_textlayer_loading = text_layer_create(GRect(0, 95, 144, 27));
  text_layer_set_text(s_textlayer_loading, "Loading...");
  text_layer_set_text_alignment(s_textlayer_loading, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_loading, s_res_gothic_14);
  layer_add_child(window_layer, (Layer *)s_textlayer_loading);
#endif
}
Esempio n. 3
0
static void load_sequence() {
  if(s_sequence) {
    gbitmap_sequence_destroy(s_sequence);
    s_sequence = NULL;
  }
  if(s_bitmap) {
    gbitmap_destroy(s_bitmap);
    s_bitmap = NULL;
  }

  s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_ANIMATION);
  s_bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(s_sequence), GBitmapFormat8Bit);

  app_timer_register(1, timer_handler, NULL);
}
static void load_e_sequence() {   
  // Free old data
  if(e_sequence) {
    gbitmap_sequence_destroy(e_sequence);
    e_sequence = NULL;
  }
  if(e_bitmap) {
    gbitmap_destroy(e_bitmap);
    e_bitmap = NULL;
  }

  // Create 
  e_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_ENEMY_POKEMON);

  // Create GBitmap
  e_bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(e_sequence), GBitmapFormat8Bit);

  // Begin animation
  app_timer_register(1, e_timer_handler, NULL);
}
Esempio n. 5
0
  s_res_droid_serif_28_bold = fonts_get_system_font(FONT_KEY_GOTHIC_14);
  
#ifndef PBL_PLATFORM_APLITE
  // Set up the status bar last to ensure it is on top of other Layers
  s_status_bar = status_bar_layer_create();
  layer_add_child(window_layer, status_bar_layer_get_layer(s_status_bar));

#ifdef PBL_ROUND
  s_bitmap_layer = bitmap_layer_create(GRect(57, 52, 64, 64));
#else
  s_bitmap_layer = bitmap_layer_create(GRect(37, 52, 64, 64));
#endif
  layer_insert_above_sibling(bitmap_layer_get_layer(s_bitmap_layer), (Layer *)s_menu_layer);

  // Create sequence
  s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_LOADING_ANIMATION);
  // Create GBitmap
  s_bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(s_sequence), GBitmapFormat8Bit);
  // Begin animation
  app_timer_register(1, timer_handler, NULL);
  hide_animation();
#else
  s_textlayer_2 = text_layer_create(GRect(0, 52, 144, 27));
  text_layer_set_text(s_textlayer_2, "Saving, please wait");
  text_layer_set_text_alignment(s_textlayer_2, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_2, s_res_droid_serif_28_bold);
  layer_insert_above_sibling((Layer *)s_textlayer_2, (Layer *)s_menu_layer);
  hide_animation();
#endif

#ifdef PBL_ROUND
/***Handle Window***/
static void main_window_load(Window *window) {
	//Get information about the window
	Layer *window_layer = window_get_root_layer(window);
	GRect bounds = layer_get_bounds(window_layer);
	
	//Use platform specific background image
	s_bitmap = gbitmap_create_with_resource(
		PBL_IF_BW_ELSE(RESOURCE_ID_IMAGE_BACKGROUND_BW, RESOURCE_ID_IMAGE_BACKGROUND_COLOR));
	s_bitmap_layer = bitmap_layer_create(GRect(0, 0, 144, 168)); //size of image
	bitmap_layer_set_compositing_mode(s_bitmap_layer, GCompOpSet);
	bitmap_layer_set_bitmap(s_bitmap_layer, s_bitmap);
	window_set_background_color(s_main_window, GColorBlack);
	layer_add_child(window_layer, bitmap_layer_get_layer(s_bitmap_layer));
	
	//Add custom font
	s_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_MONACO_14));	
		
	//Time layer
	s_time_layer = text_layer_create(GRect(5, 30, bounds.size.w, 40));
	text_layer_set_background_color(s_time_layer, GColorClear);
	text_layer_set_text_color(s_time_layer, GColorWhite);
	text_layer_set_font(s_time_layer, s_font);
	layer_add_child(window_layer, text_layer_get_layer(s_time_layer));
	
	//Battery layer
	s_battery_layer = text_layer_create(GRect(5, 70, bounds.size.w, 50));
	text_layer_set_background_color(s_battery_layer, GColorClear);
	text_layer_set_text_color(s_battery_layer, GColorWhite);
	text_layer_set_font(s_battery_layer, s_font);
	layer_add_child(window_layer, text_layer_get_layer(s_battery_layer));
	
	//Connection layer
	s_connection_layer = text_layer_create(GRect(5, 100, bounds.size.w, 20));
	text_layer_set_background_color(s_connection_layer, GColorClear);
	text_layer_set_text_color(s_connection_layer, GColorWhite);
	text_layer_set_font(s_connection_layer, s_font);
	handle_bluetooth(connection_service_peek_pebble_app_connection());
	layer_add_child(window_layer, text_layer_get_layer(s_connection_layer));
	
	//Other text layer
	s_text_layer = text_layer_create(GRect(5, 125, bounds.size.w, 20));
	text_layer_set_background_color(s_text_layer, GColorClear);
	text_layer_set_text_color(s_text_layer, GColorWhite);
	text_layer_set_font(s_text_layer, s_font);
	text_layer_set_text(s_text_layer, "root@PC:/$");
	layer_add_child(window_layer, text_layer_get_layer(s_text_layer));
	
	//Platform-specific cursor animation
	//Stationary cursor for Aplite
	#if defined (PBL_BW)
	s_bitmap_cursor = gbitmap_create_with_resource(RESOURCE_ID_STATIC_CURSOR);
	//Blinking cursor for Basalt
	#elif defined (PBL_COLOR)
	s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_BLINKING_CURSOR);
	GSize frame_size = gbitmap_sequence_get_bitmap_size(s_sequence);
	s_bitmap_cursor = gbitmap_create_blank(frame_size, GBitmapFormat8Bit);
	//Start the animation
	uint32_t first_delay_ms = 1000;
	app_timer_register(first_delay_ms, timer_handler, NULL);
	#endif
	
	s_bitmap_cursor_layer = bitmap_layer_create(GRect(90, 125, 10, 15));
	bitmap_layer_set_compositing_mode(s_bitmap_cursor_layer, GCompOpSet);
	bitmap_layer_set_bitmap(s_bitmap_cursor_layer, s_bitmap_cursor);
	layer_add_child(window_layer, bitmap_layer_get_layer(s_bitmap_cursor_layer));
}