コード例 #1
0
static gboolean
animation_timeout (gpointer data)
{
    gboolean retval;

    GDK_THREADS_ENTER ();

    retval = do_animation (data);

    GDK_THREADS_LEAVE ();

    return retval;
}
コード例 #2
0
ファイル: main.c プロジェクト: PiwwowPants/Sonic-Level-Start
static void main_window_load(Window *window) {
	
	s_white_effect_offset.offset_x = 2;
	s_white_effect_offset.offset_y = 2;
	s_white_effect_offset.orig_color = GColorWhite;
	s_white_effect_offset.offset_color = GColorBlack;
	
	s_yellow_effect_offset.offset_x = 2;
	s_yellow_effect_offset.offset_y = 2;
	s_yellow_effect_offset.orig_color = GColorYellow;
	s_yellow_effect_offset.offset_color = GColorBlack;
	
	GRect bounds = window_get_bounds(window);
	
	window_set_background_color(window, GColorBlack);
	
	s_time_font = fonts_load_resource_font(RESOURCE_ID_GASLIGHT_30);
	s_large_font = fonts_load_resource_font(RESOURCE_ID_GASLIGHT_40);
	s_small_font = fonts_load_resource_font(RESOURCE_ID_VIPNAGOR_12);
	
	s_effect_layer = effect_layer_create(bounds);
	
	s_blue_layer = layer_create(GRect(0,-168,144,168));
	s_yellow_layer = layer_create(GRect(144,120,144,48));
	s_time_layer = layer_create(GRect(144,0,144,168));
	s_date_layer = layer_create(GRect(-144,0,144,168));
	
	s_red_parent = layer_create(GRect(-42,0,42,168));
	
	s_red_layer = bitmap_layer_create(GRect(0,0,42,168));
	
	s_time_label = text_layer_create(GRect(0,30,129,40));
	s_month_label = text_layer_create(GRect(0,60,64,40));
	s_day_label = text_layer_create(GRect(0,60,129,40));
	s_brand_label = text_layer_create(GRect(0,5,139,40));
	
	layer_set_update_proc(s_blue_layer, update_blue);
	layer_set_update_proc(s_yellow_layer, update_yellow);
	
	s_red_bitmap = gbitmap_create_with_resource(RESOURCE_ID_SONIC);
	
	bitmap_layer_set_bitmap(s_red_layer, s_red_bitmap);
	
	bitmap_layer_set_compositing_mode(s_red_layer, GCompOpSet);
	
	text_layer_set_colors(s_time_label, GColorWhite, GColorClear);
	text_layer_set_colors(s_month_label, GColorWhite, GColorClear);
	text_layer_set_colors(s_day_label, GColorYellow, GColorClear);
	text_layer_set_colors(s_brand_label, GColorBlack, GColorClear);
	
	text_layer_set_text_alignment(s_time_label, GTextAlignmentRight);
	text_layer_set_text_alignment(s_month_label, GTextAlignmentRight);
	text_layer_set_text_alignment(s_day_label, GTextAlignmentRight);
	text_layer_set_text_alignment(s_brand_label, GTextAlignmentRight);
	
	text_layer_set_font(s_time_label, s_time_font);
	text_layer_set_font(s_month_label, s_time_font);
	text_layer_set_font(s_day_label, s_large_font);
	text_layer_set_font(s_brand_label, s_small_font);
	
	text_layer_set_text(s_brand_label, "PEBBLE TIME");
	
	layer_add_to_window(s_blue_layer, window);
	layer_add_to_window(s_yellow_layer, window);
	
	layer_add_to_window(s_red_parent, window);
	
	bitmap_layer_add_to_layer(s_red_layer, s_red_parent);
	
	layer_add_to_window(s_time_layer, window);
	layer_add_to_window(s_date_layer, window);
	
	text_layer_add_to_layer(s_time_label, s_time_layer);
	text_layer_add_to_layer(s_month_label, s_date_layer);
	text_layer_add_to_layer(s_day_label, s_date_layer);
	text_layer_add_to_layer(s_brand_label, s_yellow_layer);
	
	effect_layer_add_effect(s_effect_layer, effect_shadow, &s_white_effect_offset);
	effect_layer_add_effect(s_effect_layer, effect_shadow, &s_yellow_effect_offset);
	
	layer_add_child(s_time_layer, effect_layer_get_layer(s_effect_layer));
	layer_add_child(s_date_layer, effect_layer_get_layer(s_effect_layer));
	
	do_animation();
	update_time();
}