您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ text_layer_set_text_alignment函数代码示例

51自学网 2021-06-03 08:47:10
  C++
这篇教程C++ text_layer_set_text_alignment函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中text_layer_set_text_alignment函数的典型用法代码示例。如果您正苦于以下问题:C++ text_layer_set_text_alignment函数的具体用法?C++ text_layer_set_text_alignment怎么用?C++ text_layer_set_text_alignment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了text_layer_set_text_alignment函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: handle_init

void handle_init(void) {  my_window = window_create();	Layer *window_layer = window_get_root_layer(my_window);	GRect bounds = layer_get_bounds(window_layer);  time_layer = text_layer_create(bounds);	// Size date layer 5/12 of display	bounds.size.h = (bounds.size.h * 7) / 12;	bounds.origin.y = bounds.size.h;	bounds.size.h = (bounds.size.h * 5) / 7;	date_layer = text_layer_create(bounds);		// Configure layers	text_layer_set_background_color(time_layer, GColorBlack);	text_layer_set_text_color(time_layer, GColorWhite);	text_layer_set_font(time_layer,fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49));	text_layer_set_text_alignment(time_layer, GTextAlignmentRight);		text_layer_set_background_color(date_layer, GColorBlack);	text_layer_set_text_color(date_layer, GColorWhite);	text_layer_set_font(date_layer,fonts_get_system_font(FONT_KEY_GOTHIC_28));	text_layer_set_text_alignment(date_layer, GTextAlignmentRight);		// Add layers to window	layer_add_child(window_layer, text_layer_get_layer(time_layer));	layer_add_child(window_layer, text_layer_get_layer(date_layer));	  window_stack_push(my_window, true);		// Respond to taps	accel_tap_service_subscribe(tap_handler);		// Update window on load and every minute	tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);	update_time();}
开发者ID:wistonia,项目名称:RightHand,代码行数:36,


示例2: weather_layer_set_temperature

void weather_layer_set_temperature(WeatherLayer* weather_layer, int16_t t) {	memcpy(weather_layer->temp_str, itoa(t), 4);	int degree_pos = strlen(weather_layer->temp_str);		if (strlen(weather_layer->temp_str) == 1 || 		(strlen(weather_layer->temp_str) == 2 && weather_layer->temp_str[0] != '1')) {	  // Don't move temperature if between 0-9° or 20°-99°	  text_layer_set_font(&weather_layer->temp_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_TEMP_42)));	  text_layer_set_text_alignment(&weather_layer->temp_layer, GTextAlignmentCenter);	  memcpy(&weather_layer->temp_str[degree_pos], "°", 3);	} else if (strlen(weather_layer->temp_str) == 2 && weather_layer->temp_str[0] == '1') {	  // Move temperature slightly to the left if between 10°-19°	  text_layer_set_font(&weather_layer->temp_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_TEMP_42)));	  text_layer_set_text_alignment(&weather_layer->temp_layer, GTextAlignmentLeft);	  memcpy(&weather_layer->temp_str[degree_pos], "°", 3); 	} else if (strlen(weather_layer->temp_str) > 2) { 	  // Shrink font size if above 99° or below -9°	  text_layer_set_font(&weather_layer->temp_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_TEMP_42)));	  text_layer_set_text_alignment(&weather_layer->temp_layer, GTextAlignmentCenter);	  memcpy(&weather_layer->temp_str[degree_pos], "°", 3);	}		text_layer_set_text(&weather_layer->temp_layer, weather_layer->temp_str);}
开发者ID:msmitherdc,项目名称:Warhol_Weather,代码行数:24,


示例3: init_stroke_layers

// initialize app state based on i_current_stroke.static void init_stroke_layers() {  StrokeData *stroke_data = &s_stroke_datas[i_current_stroke];  text_layer_destroy(intro_up_help);  text_layer_destroy(intro_select_help);  text_layer_destroy(intro_down_help);  stroke_image_layer = bitmap_layer_create(GRect(0, 10, 120, 50));  stroke_name_layer = text_layer_create(GRect(0, 65, 120, 30));  stroke_count_layer = text_layer_create(GRect(0, 105, 120, 30));  bitmap_layer_set_bitmap(stroke_image_layer, stroke_data->bitmap);  bitmap_layer_set_alignment(stroke_image_layer, GAlignCenter);  text_layer_set_text_alignment(stroke_name_layer, GTextAlignmentCenter);  text_layer_set_font(stroke_name_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));    text_layer_set_text_alignment(stroke_count_layer, GTextAlignmentCenter);  text_layer_set_font(stroke_count_layer, fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK));  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(stroke_image_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(stroke_name_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(stroke_count_layer));}
开发者ID:cameronwilby,项目名称:swim-counter,代码行数:25,


示例4: main_window_load

static void main_window_load(Window *window) {	// Prepare window properties	Layer *window_layer = window_get_root_layer(window);  GRect window_bounds = layer_get_bounds(window_layer);		// First create the FH logo	s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_FHJOANNEUM_LOGO);	s_background_layer = bitmap_layer_create(GRect(5, 5, 134, 47));	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));		// Create a text layer for time including font	s_time_layer = text_layer_create(GRect(0, 52, window_bounds.size.w, 50));	text_layer_set_background_color(s_time_layer, GColorBlack);	text_layer_set_text_color(s_time_layer, GColorClear);	s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_42));	text_layer_set_font(s_time_layer, s_time_font);	text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));	// Create a text layer for the lecture including font	s_schedule_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_18));	s_schedule_layer = text_layer_create(GRect(5, 107, window_bounds.size.w-10, window_bounds.size.h - 102));	text_layer_set_background_color(s_schedule_layer, GColorClear);	text_layer_set_text_color(s_schedule_layer, GColorBlack);	text_layer_set_font(s_schedule_layer, s_schedule_font);	text_layer_set_text_alignment(s_schedule_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_schedule_layer));	text_layer_set_text(s_schedule_layer, "Loading...");		// Begin by updating the time.	update_time();		// Load data from storage	update_schedule_from_storage();}
开发者ID:moopat,项目名称:pebbly-joanneum,代码行数:36,


示例5: splash_window_load

// splash windowstatic void splash_window_load(Window *window){  app_timer_register(1000, (AppTimerCallback) timer_callback, NULL);  splash_layer = text_layer_create(GRect(0, 55, 144, 50));  text_layer_set_background_color(splash_layer, GColorClear);  text_layer_set_text_color(splash_layer, GColorBlack);  text_layer_set_text(splash_layer, "News");    // Improve the layout to be more like a watchface  text_layer_set_font(splash_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));  text_layer_set_text_alignment(splash_layer, GTextAlignmentCenter);    // Add it as a child layer to the Window's root layer  layer_add_child(window_get_root_layer(window), text_layer_get_layer(splash_layer));}
开发者ID:kyleliangus,项目名称:KeySpeedRead,代码行数:16,


示例6: createPopup

static void createPopup() { Layer *window_layer = window_get_root_layer(window); resp_y_layer = text_layer_create(GRect(0,0,144,168));       text_layer_set_text_color(resp_y_layer, GColorClear);       text_layer_set_background_color(resp_y_layer, GColorClear);       text_layer_set_font(resp_y_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));       text_layer_set_text_alignment(resp_y_layer, GTextAlignmentCenter);       layer_add_child(window_layer, text_layer_get_layer(resp_y_layer));// printing promp message to watchface text_layer_set_text(resp_y_layer, "     UP->YES                                           Exchange            Contact?                              DOWN->NO");  }
开发者ID:ginocorrales,项目名称:shake,代码行数:15,


示例7: main_window_load

static void main_window_load(Window *window) {  APP_LOG(APP_LOG_LEVEL_DEBUG, "window load");  // Create time TextLayer  s_time_layer = text_layer_create(GRect(0, 55, 144, 50));  text_layer_set_background_color(s_time_layer, GColorClear);  text_layer_set_text_color(s_time_layer, GColorBlack);  // Improve the layout to be more like a watchface  text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);  // Add it as a child layer to the Window's root layer  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));}
开发者ID:MartialElch,项目名称:ExamplePebbleSimpleDigitalWatchface,代码行数:15,


示例8: select_long_click_handler

void select_long_click_handler(ClickRecognizerRef recognizer, void *context) {  //scroll_layer_create(history_scroll, GRect(0, 0, 144, 168));  history_scroll = scroll_layer_create GRect(0,0,144,168);  scroll_layer_set_click_config_onto_window(history_scroll, my_window);  history_text = text_layer_create(GRect(0, 0, WIDTH, MAX_HEIGHT));  sugar_data_retrieve(size);  text_layer_set_background_color(history_text, GColorClear);  text_layer_set_text_color(history_text, GColorBlack);  text_layer_set_text_alignment(history_text, GTextAlignmentLeft);  scroll_layer_set_click_config_onto_window(history_scroll, my_window);      scroll_layer_add_child(history_scroll, text_layer_get_layer(history_text));  layer_add_child(window_get_root_layer(my_window), scroll_layer_get_layer(history_scroll));}
开发者ID:stevmoli,项目名称:Diabetes-Journal,代码行数:15,


示例9: main_window_load

// Load Main Window Layerstatic void main_window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_bounds(window_layer);    //bitmap  //-- Create GBitmap  //    s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_SAMPLE_BACKGROUND);  //-- Create BitmapLayer to display the GBitmap  //    s_background_layer = bitmap_layer_create(bounds);  //-- Set the bitmap onto the layer and add to the window  //    bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);  //    layer_add_child(window_layer, bitmap_layer_get_layer(s_background_layer));    //background  //Create Canvas Layer  s_canvas = layer_create(bounds);  layer_set_update_proc(s_canvas, layer_update_proc);  layer_add_child(window_layer, s_canvas);  //time  // Create the TextLayer with specific bounds  // Set text box position and size  s_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(45, 52), bounds.size.w, 85));  // Create GFont and set variable  s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_HIGHERUP_REG_80));  // Improve the layout to be more like a watchface  text_layer_set_background_color(s_time_layer, GColorClear);  text_layer_set_text_color(s_time_layer, TIMECOLOR);  text_layer_set_font(s_time_layer, s_time_font);  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);  // Add it as a child layer to the Window's root layer  layer_add_child(window_layer, text_layer_get_layer(s_time_layer));    //--  // [UNUSED] -- information layer  //    s_weather_layer = text_layer_create(  //      GRect(0, PBL_IF_ROUND_ELSE(125, 120), bounds.size.w, 25));  // Style the text  //    text_layer_set_background_color(s_weather_layer, GColorClear);  //    text_layer_set_text_color(s_weather_layer, GColorBlack);  //    text_layer_set_text_alignment(s_weather_layer, GTextAlignmentCenter);  //    text_layer_set_text(s_weather_layer, "Loading...");  // Create second custom font, apply it and add to Window  //    s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_DBJ_REGULAR_20));  //    text_layer_set_font(s_weather_layer, s_weather_font);  //    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer));  }
开发者ID:lofgren007,项目名称:pebble_time_r,代码行数:49,


示例10: initialise_ui

static void initialise_ui(void) {  s_window = window_create();  window_set_background_color(s_window, GColorBlack);  #ifndef PBL_SDK_3    window_set_fullscreen(s_window, true);  #endif    s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);  s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);  // StationLayer  StationLayer = text_layer_create(GRect(0, 10, 144, 20));  text_layer_set_background_color(StationLayer, GColorClear);  text_layer_set_text_color(StationLayer, GColorWhite);  text_layer_set_text(StationLayer, "Robert Street Station");  text_layer_set_text_alignment(StationLayer, GTextAlignmentCenter);  text_layer_set_font(StationLayer, s_res_gothic_18_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)StationLayer);    // EastLabelLayer  EastLabelLayer = text_layer_create(GRect(2, 36, 15, 28));  text_layer_set_background_color(EastLabelLayer, GColorClear);  text_layer_set_text_color(EastLabelLayer, GColorWhite);  text_layer_set_text(EastLabelLayer, "E:");  text_layer_set_font(EastLabelLayer, s_res_gothic_24_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)EastLabelLayer);    // EastLayer  EastLayer = text_layer_create(GRect(20, 36, 120, 28));  text_layer_set_background_color(EastLayer, GColorClear);  text_layer_set_text_color(EastLayer, GColorWhite);  text_layer_set_font(EastLayer, s_res_gothic_24_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)EastLayer);    // WestLayer  WestLayer = text_layer_create(GRect(20, 64, 123, 28));  text_layer_set_background_color(WestLayer, GColorClear);  text_layer_set_text_color(WestLayer, GColorWhite);  text_layer_set_font(WestLayer, s_res_gothic_24_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)WestLayer);    // WestLabelLayer  WestLabelLayer = text_layer_create(GRect(2, 64, 15, 28));  text_layer_set_background_color(WestLabelLayer, GColorClear);  text_layer_set_text_color(WestLabelLayer, GColorWhite);  text_layer_set_text(WestLabelLayer, "W:");  text_layer_set_font(WestLabelLayer, s_res_gothic_24_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)WestLabelLayer);}
开发者ID:jeffjet24,项目名称:MetroTransit,代码行数:48,


示例11: initialise_ui

static void initialise_ui(void) {  s_main_window = window_create();  #ifdef PBL_COLOR    window_set_background_color(s_main_window, GColorCeleste);  #endif  // Loading fonts  s_res_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24);  // Initialising labels  s_textlayer_label_nearby_hotties = text_layer_create(GRect(5, 5, 134 - ACTION_BAR_WIDTH, 158));  text_layer_set_text(s_textlayer_label_nearby_hotties, "Checking for hotties in your area. Please wait...");  text_layer_set_text_alignment(s_textlayer_label_nearby_hotties, GTextAlignmentLeft);  text_layer_set_font(s_textlayer_label_nearby_hotties, s_res_gothic_24);  layer_add_child(window_get_root_layer(s_main_window), (Layer *)s_textlayer_label_nearby_hotties);}
开发者ID:joseph-roque,项目名称:htn-hottie,代码行数:16,


示例12: handle_init

void handle_init(AppContextRef ctx) {  (void)ctx;  myContext = ctx;  window_init(&window, "Timer");  window_stack_push(&window, true /* Animated */);  text_layer_init(&textLayer, window.layer.frame);  text_layer_set_font(&textLayer, fonts_get_system_font(FONT_KEY_GOTHAM_42_BOLD));  text_layer_set_text_alignment(&textLayer, GTextAlignmentCenter);  layer_add_child(&window.layer, &textLayer.layer);  // Start in the SET state  enter_set_state();}
开发者ID:mstahl,项目名称:pebble_projects,代码行数:16,


示例13: time_load

void time_load( const Window *window_ptr, const GPoint point ){  Time_layer = text_layer_create( GRect( point.x, point.y, 144 - point.x, 34 ) );  text_layer_set_background_color( Time_layer, GColorClear );#ifdef PBL_COLOR  text_layer_set_text_color( Time_layer, GColorBlack );#else  text_layer_set_text_color( Time_layer, GColorBlack );#endif  Time_font = fonts_load_custom_font( resource_get_handle( RESOURCE_ID_FONT_DIGITAL_32 ) );//  text_layer_set_font( Time_layer, fonts_get_system_font( FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM ) );  text_layer_set_font( Time_layer, Time_font );  layer_add_child( window_get_root_layer( window_ptr ), text_layer_get_layer( Time_layer ) );//  text_layer_set_text_alignment( Time_layer, GTextAlignmentLeft );  text_layer_set_text_alignment( Time_layer, GTextAlignmentCenter );}
开发者ID:sanadan,项目名称:Hachune,代码行数:16,


示例14: handle_init

void handle_init(AppContextRef ctx) {  (void)ctx;  window_init(&window, "Logging Demo");  text_layer_init(&text, GRect(0, 0, 144, 150));  text_layer_set_text_color(&text, GColorBlack);  text_layer_set_font(&text, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));  text_layer_set_text_alignment(&text, GTextAlignmentCenter);  text_layer_set_text(&text, "Press the select button to try out different clicks and watch your Bluetooth logs");  layer_add_child(&window.layer, &text.layer);  window_set_click_config_provider(&window, (ClickConfigProvider) config_provider);  window_stack_push(&window, true /* Animated */);}
开发者ID:343max,项目名称:pebblekit,代码行数:16,


示例15: init

 // defining init and deinitvoid init() {  // creating the text layer in the init   window = window_create();   text_layer = text_layer_create(GRect(0, 0, 144, 40));   text_layer_set_text(text_layer, "Pebble");   // horizontal alignment   // See https://developer.getpebble.com/docs/c/User_Interface/Layers/TextLayer/#text_layer_set_text_alignment   text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);   // vertical alignment   // See https://forums.getpebble.com/discussion/12492/vertical-text-alignment   // not implemented yet     layer_add_child(window_get_root_layer(window),                   text_layer_get_layer(text_layer));   window_stack_push(window, true);}
开发者ID:tcpiplab,项目名称:hellopebble,代码行数:17,


示例16: init

static void init(void) {  window = window_create();  window_stack_push(window, true /* Animated */);  window_set_background_color(window, GColorBlack);  text_time_layer = text_layer_create(UPPER_TO_RECT);  text_layer_set_text_color(text_time_layer, GColorWhite);  text_layer_set_background_color(text_time_layer, GColorClear);  text_layer_set_text_alignment(text_time_layer, GTextAlignmentCenter);  text_layer_set_font(text_time_layer,      fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_CONDENSED_SUBSET_40)));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(text_time_layer));  init_animations();  tick_timer_service_subscribe(MINUTE_UNIT, &handle_minute_tick);}
开发者ID:43403901,项目名称:pebble-sdk-examples,代码行数:16,


示例17: main_window_load

static void main_window_load(Window *window) {  // Create time TextLayer  //s_time_layer = text_layer_create(GRect(0, 120, 144, 30));  s_time_layer = text_layer_create(GRect(0, 69, 144, 30));  text_layer_set_background_color(s_time_layer, GColorBlack);  text_layer_set_text_color(s_time_layer, GColorClear);    // Improve the layout to be more like a watchface  text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);  // Add it as a child layer to the Window's root layer  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));  update_time();}
开发者ID:XWolfOverride,项目名称:Timestamp,代码行数:16,


示例18: initializeYBattery

void initializeYBattery() {    // Create day TextLayer    s_battery_layer = text_layer_create(GRect(84, 88, 80, 30));    text_layer_set_background_color(s_battery_layer, GColorWhite);    text_layer_set_text_color(s_battery_layer, GColorBlack);    // Improve the day TextLayer layout    text_layer_set_font(s_battery_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));    text_layer_set_text_alignment(s_battery_layer, GTextAlignmentLeft);    // Get the current battery level    battery_handler(battery_state_service_peek());    // Subscribe to the Battery State Service    battery_state_service_subscribe(battery_handler);}
开发者ID:yari-mattei,项目名称:YWatchFace,代码行数:17,


示例19: init_clock

static void init_clock(Window *window) {  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_bounds(window_layer);  time_layer = text_layer_create(GRect(0, 20, bounds.size.w, bounds.size.h-100));  text_layer_set_text_alignment(time_layer, GTextAlignmentCenter);  text_layer_set_text_color(time_layer, GColorWhite);  text_layer_set_background_color(time_layer, GColorClear);  text_layer_set_font(time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_LIGHT));  time_t now = time(NULL);  struct tm *current_time = localtime(&now);  handle_second_tick(current_time, SECOND_UNIT);  tick_timer_service_subscribe(SECOND_UNIT, &handle_second_tick);  layer_add_child(window_get_root_layer(window), text_layer_get_layer(time_layer));}
开发者ID:imclab,项目名称:FindMeStarbucks,代码行数:17,


示例20: handle_init

// Handle the start-up of the appvoid handle_init(AppContextRef app_ctx) {    // Create our app's base window    window_init(&window, "Peanut Butter Jelly Time");    window_stack_push(&window, true);    window_set_background_color(&window, GColorBlack);    GFont font_date;    resource_init_current_app(&APP_RESOURCES);    font_date = fonts_get_system_font(FONT_KEY_GOTHIC_14);    // Set up a layer for the static watch face background    bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);    layer_add_child(&window.layer, &background_image_container.layer.layer);    // Set up a layer for the hour hand    rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_HAND_WHITE, RESOURCE_ID_IMAGE_HOUR_HAND_BLACK, &hour_hand_image_container);    rotbmp_pair_layer_set_src_ic(&hour_hand_image_container.layer, GPoint(33, 40));    layer_add_child(&window.layer, &hour_hand_image_container.layer.layer);    // Set up a layer for the minute hand    rotbmp_pair_init_container(RESOURCE_ID_IMAGE_MINUTE_HAND_WHITE, RESOURCE_ID_IMAGE_MINUTE_HAND_BLACK, &minute_hand_image_container);    rotbmp_pair_layer_set_src_ic(&minute_hand_image_container.layer, GPoint(16, 60));    layer_add_child(&window.layer, &minute_hand_image_container.layer.layer);    // Set up a layer for the date    text_layer_init(&text_date_layer, window.layer.frame);    text_layer_set_text_color(&text_date_layer, GColorWhite);    text_layer_set_background_color(&text_date_layer, GColorClear);    layer_set_frame(&text_date_layer.layer, GRect(8, 152, 144-8, 168-92));    text_layer_set_font(&text_date_layer, font_date);    text_layer_set_text_alignment(&text_date_layer,GTextAlignmentCenter);    layer_add_child(&window.layer, &text_date_layer.layer);    PblTm t;    get_time(&t);    update_watch(&t);    last_wday = -1;}
开发者ID:stvsan,项目名称:peanut-butter-jelly-time,代码行数:47,


示例21: make_text_layer

static TextLayer* make_text_layer(int x_inset, int y_inset, char *font_key) {  Layer *window_layer = window_get_root_layer(s_window);  GRect bounds = layer_get_bounds(window_layer);  TextLayer *this = text_layer_create(grect_inset(bounds,                                                GEdgeInsets(y_inset, 0, 0, x_inset)));  text_layer_set_text_alignment(this, GTextAlignmentCenter);  text_layer_set_text_color(this, GColorWhite);  text_layer_set_background_color(this, GColorClear);  text_layer_set_font(this, fonts_get_system_font(font_key));#if defined(PBL_ROUND)  text_layer_enable_screen_text_flow_and_paging(this, 5);#endif  return this;}
开发者ID:sprateek,项目名称:lazy-sloth,代码行数:17,


示例22: InitializeConfirmationWindow

void InitializeConfirmationWindow(Window *window, TextLayer *exitText, TextLayer *yesText, TextLayer *noText){	InitializeWindow(window, "Exit", true);	InitializeTextLayer(exitText, exitFrame, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));	text_layer_set_text(exitText, "Exit?");	text_layer_set_text_alignment(exitText, GTextAlignmentCenter);	layer_add_child(&window->layer, &exitText->layer);	InitializeTextLayer(yesText, yesFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));	text_layer_set_text(yesText, "Yes");	layer_add_child(&window->layer, &yesText->layer);	InitializeTextLayer(noText, noFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));	text_layer_set_text(noText, "No");	layer_add_child(&window->layer, &noText->layer);}
开发者ID:glebm,项目名称:MiniDungeon,代码行数:17,


示例23: out_failed_handler

void out_failed_handler(DictionaryIterator *failed, AppMessageResult reason, void *context) {   // outgoing message failed  APP_LOG(APP_LOG_LEVEL_WARNING, "/nMessage rejected by phone: %s %d", command, reason);  if (reason == APP_MSG_SEND_TIMEOUT) {    if (strncmp(command,"set",3) == 0) {      if (!hint_layer) {        Layer *window_layer = window_get_root_layer(window);        hint_layer = text_layer_create(hint_layer_size);        text_layer_set_font(hint_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));        text_layer_set_text_alignment(hint_layer, GTextAlignmentCenter);        layer_add_child(window_layer, text_layer_get_layer(hint_layer));      }      text_layer_set_text(hint_layer, "Cannot set target./nPlease restart the app.");      vibes_double_pulse();    };  }}
开发者ID:edmund-k,项目名称:pebble-geocachingpro-back,代码行数:17,


示例24: main_window_load

static void main_window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  header_layer = text_layer_create(GRect(0, 0, 144, 40));  text_layer_set_font(header_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));  text_layer_set_text_alignment(header_layer, GTextAlignmentCenter);  text_layer_set_text_color(header_layer, GColorBlack);  text_layer_set_background_color(header_layer, GColorClear);  text_layer_set_text(header_layer, "BariBucks");  layer_add_child(window_layer, text_layer_get_layer(header_layer));  main_menu_layer = menu_layer_create(GRect(0, 40, 144, 113));  menu_layer_set_callbacks(main_menu_layer, NULL, (MenuLayerCallbacks) {    .get_num_rows = menu_get_num_rows_callback,    .draw_row = menu_draw_row_callback,    .select_click = menu_select_callback, //the .(after the dot) is predefined  });
开发者ID:aliahm08,项目名称:baribucks,代码行数:17,


示例25: main_window_load

static void main_window_load(Window *window) {  // Create time TextLayer  s_time_layer = text_layer_create(GRect(0, 55, 144, 50));  text_layer_set_background_color(s_time_layer, GColorClear);  text_layer_set_text_color(s_time_layer, GColorBlack);  text_layer_set_text(s_time_layer, "00:00");  // Improve the layout to be more like a watchface  text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);  // Add it as a child layer to the Window's root layer  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));    // Make sure the time is displayed from the start  update_time();}
开发者ID:chunkiat82,项目名称:tomorrow-watch,代码行数:17,


示例26: set_up_time_text

static void set_up_time_text(Layer *window_layer, GRect bounds) {  // screen resolution (classic) 144×168  s_time_layer = text_layer_create(    GRect(      0,                         // x from left      5,                         // y from top      bounds.size.w,             // width      30                         // height    )  );  text_layer_set_background_color(s_time_layer, GColorClear);  text_layer_set_text_color(s_time_layer, GColorBlack);  text_layer_set_text(s_time_layer, "00:00");  text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK));  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);  layer_add_child(window_layer, text_layer_get_layer(s_time_layer));}
开发者ID:ronny,项目名称:traino,代码行数:17,


示例27: initialise_ui

static void initialise_ui(void) {  s_window = window_create();  window_set_background_color(s_window, GColorBlack);  IF_A(window_set_fullscreen(s_window, true));    s_res_img_standby = gbitmap_create_with_resource(RESOURCE_ID_IMG_STANDBY);  s_res_img_settings = gbitmap_create_with_resource(RESOURCE_ID_IMG_SETTINGS);  s_res_roboto_bold_subset_49 = fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49);  s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);  // action_layer  action_layer = action_bar_layer_create();  action_bar_layer_add_to_window(action_layer, s_window);  action_bar_layer_set_background_color(action_layer, GColorWhite);  action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_standby);  action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_settings);  layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(124, 0, 20, 168));  IF_B(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-5, 0, 30, 168)));  layer_add_child(window_get_root_layer(s_window), (Layer *)action_layer);    // clockbg_layer  clockbg_layer = text_layer_create(GRect(0, 60, 144, 50));  text_layer_set_background_color(clockbg_layer, GColorBlack);  text_layer_set_text_color(clockbg_layer, GColorClear);  text_layer_set_text(clockbg_layer, "    ");  layer_add_child(window_get_root_layer(s_window), (Layer *)clockbg_layer);    // clock_layer  clock_layer = text_layer_create(GRect(0, 52, 144, 65));  text_layer_set_background_color(clock_layer, GColorClear);  text_layer_set_text_color(clock_layer, GColorWhite);  text_layer_set_text(clock_layer, "23:55");  text_layer_set_text_alignment(clock_layer, GTextAlignmentCenter);  text_layer_set_font(clock_layer, s_res_roboto_bold_subset_49);  layer_add_child(window_get_root_layer(s_window), (Layer *)clock_layer);    // onoff_layer  onoff_layer = text_layer_create(GRect(2, 2, 119, 56));  layer_set_update_proc(text_layer_get_layer(onoff_layer), draw_onoff);   layer_add_child(window_get_root_layer(s_window), (Layer *)onoff_layer);    // info_layer  info_layer = text_layer_create(GRect(2, 110, 119, 56));  layer_set_update_proc(text_layer_get_layer(info_layer), draw_info);   layer_add_child(window_get_root_layer(s_window), (Layer *)info_layer);}
开发者ID:thisishappenin,项目名称:GentleWake,代码行数:45,


示例28: main_window_load

static void main_window_load(Window *window) {    // Create GBitmap, then set to created BitmapLayer    s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_fatface_15));    // Create temperature Layer    s_weather_layer = text_layer_create(GRect(4, 20, 136,150 ));    text_layer_set_font(s_weather_layer, s_time_font);    text_layer_set_background_color(s_weather_layer, GColorWhite);    text_layer_set_text_color(s_weather_layer, GColorBlack);    text_layer_set_text_alignment(s_weather_layer, GTextAlignmentCenter);    text_layer_set_text(s_weather_layer, "Click for insult");    // Create time TextLayer    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer));    //time layer}
开发者ID:zlex7,项目名称:comebackking,代码行数:18,


示例29: window_load

static void window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_bounds(window_layer);  image = gbitmap_create_with_data(data_image);  image_layer = bitmap_layer_create(bounds);  bitmap_layer_set_bitmap(image_layer, image);  bitmap_layer_set_alignment(image_layer, GAlignCenter);  layer_add_child(window_layer, bitmap_layer_get_layer(image_layer));  text_layer = text_layer_create(GRect(0, bounds.size.h - 16, bounds.size.w, 16));  text_layer_set_text(text_layer, "Welcome to PayFace $)");  text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));  text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);  text_layer_set_background_color(text_layer, GColorClear);  layer_add_child(window_layer, text_layer_get_layer(text_layer));}
开发者ID:PayFace,项目名称:PebbleApp,代码行数:18,


示例30: show_loading_icon

// Show loading screenstatic void show_loading_icon(void) {  Layer *window_layer = window_get_root_layer(s_window);  GRect bounds = layer_get_frame(window_layer);  loading_icon_layer = bitmap_layer_create(GRect(0, 0, bounds.size.w, bounds.size.h));  bitmap_layer_set_background_color(loading_icon_layer, GColorBlack);  layer_add_child(window_layer, bitmap_layer_get_layer(loading_icon_layer));  text_layer = text_layer_create(GRect(0, 60, bounds.size.w, 30));  text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);  text_layer_set_overflow_mode(text_layer, GTextOverflowModeWordWrap);  text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));  text_layer_set_background_color(text_layer, GColorBlack);  text_layer_set_text_color(text_layer, GColorWhite);  text_layer_set_text(text_layer, "Loading...");  layer_add_child(window_layer, text_layer_get_layer(text_layer));}
开发者ID:sjmatta,项目名称:disney-world-for-pebble,代码行数:19,



注:本文中的text_layer_set_text_alignment函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ text_to_cstring函数代码示例
C++ text_layer_set_font函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。