本文整理汇总了C++中resource_init_current_app函数的典型用法代码示例。如果您正苦于以下问题:C++ resource_init_current_app函数的具体用法?C++ resource_init_current_app怎么用?C++ resource_init_current_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resource_init_current_app函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_init
void handle_init(AppContextRef ctx) {
// Create the main window and push it in fullscreen mode
window_init(&window, "Window Name");
window_stack_push(&window, true /* Animated */);
window_set_fullscreen(&window, true);
// Initialize ressources and load the background image
resource_init_current_app(&APP_RESOURCES);
bmp_init_container(RESOURCE_ID_BACKGROUND_IMAGE, &background_image);
layer_add_child(&window.layer, &background_image.layer.layer);
// Create a text field to display the time until the next pass
text_layer_init(&nextpass_text_layer, GRect(0, 126, 144, 34));
text_layer_set_font(&nextpass_text_layer, fonts_get_system_font(FONT_KEY_BITHAM_34_MEDIUM_NUMBERS));
text_layer_set_text_alignment(&nextpass_text_layer, GTextAlignmentCenter);
text_layer_set_background_color(&nextpass_text_layer, GColorClear);
layer_add_child(window_get_root_layer(&window), (Layer*)&time_text_layer);
// Create a text field to display the current time
text_layer_init(&time_text_layer, GRect(37, 0, 70, 24));
text_layer_set_font(&time_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
text_layer_set_text_alignment(&time_text_layer, GTextAlignmentCenter);
text_layer_set_background_color(&time_text_layer, GColorClear);
layer_add_child(window_get_root_layer(&window), (Layer*)&nextpass_text_layer);
// Add background and both text fields to the window
// Start an HTTP Request
start_http_request();
}
示例2: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Plain Watch");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
layer_init(&hour_display_layer, window.layer.frame);
hour_display_layer.update_proc = &hour_display_layer_update_callback;
layer_add_child(&window.layer, &hour_display_layer);
gpath_init(&hour_hand_outline_path, &HOUR_HAND_OUTLINE_PATH_POINTS);
gpath_move_to(&hour_hand_outline_path, grect_center_point(&hour_display_layer.frame));
gpath_init(&hour_hand_path, &HOUR_HAND_PATH_POINTS);
gpath_move_to(&hour_hand_path, grect_center_point(&hour_display_layer.frame));
layer_init(&minute_display_layer, window.layer.frame);
minute_display_layer.update_proc = &minute_display_layer_update_callback;
layer_add_child(&window.layer, &minute_display_layer);
gpath_init(&minute_hand_outline_path, &MINUTE_HAND_OUTLINE_PATH_POINTS);
gpath_move_to(&minute_hand_outline_path, grect_center_point(&minute_display_layer.frame));
gpath_init(&minute_hand_path, &MINUTE_HAND_PATH_POINTS);
gpath_move_to(&minute_hand_path, grect_center_point(&minute_display_layer.frame));
}
示例3: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Main");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
frame_animation_init(&gif_animation, &window.layer, GPoint(0,0), RESOURCE_ID_FRAME_1, 12, false, true);
timer_handle = app_timer_send_event(ctx, 100, 1);
text_layer_init(&text_time_layer, GRect(0, 5, 144, 30));
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_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
layer_add_child(&window.layer, &text_time_layer.layer);
text_layer_init(&date_layer, GRect(0, 130, 144, 30));
text_layer_set_text_color(&date_layer, GColorWhite);
text_layer_set_background_color(&date_layer, GColorClear);
text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter);
text_layer_set_font(&date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
layer_add_child(&window.layer, &date_layer.layer);
}
示例4: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
app_ctx = ctx;
window_init(&window, "Vibe");
window_stack_push(&window, true /* Animated */);
power = 3;
on = false;
resource_init_current_app(&APP_RESOURCES);
layer_init(&controls_layer, GRect(124, 3, 20, 146));
controls_layer.update_proc = &controls_update_callback;
layer_add_child(&window.layer, &controls_layer);
layer_init(&bars_layer, GRect(22, 22, 85, 115));
bars_layer.update_proc = &bars_update_callback;
layer_add_child(&window.layer, &bars_layer);
bmp_init_container(RESOURCE_ID_IMAGE_CONTROLS, &controls);
bmp_init_container(RESOURCE_ID_IMAGE_BAR_ON, &bar_on);
bmp_init_container(RESOURCE_ID_IMAGE_BAR_OFF, &bar_off);
window_set_click_config_provider(&window, (ClickConfigProvider) click_config_provider);
}
示例5: handle_init
static void
handle_init(
AppContextRef ctx
)
{
(void) ctx;
window_init(&window, "Main");
window_stack_push(&window, true);
window_set_background_color(&window, GColorBlack);
// resource_init_current_app(&RESOURCES);
resource_init_current_app(&APP_RESOURCES);
int y = 15;
int h = 30;
font_small = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_22));
font_thin = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_28));
font_thick = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_30));
// Stack top to bottom. Note that the hour can take up
// two rows at midnight.
text_layer(&m_small_word, GRect(4, y + 3*h+2, 144, h+8), font_small);
text_layer(&m_word, GRect(4, y + 3*h, 144, h+8), font_thin);
text_layer(&hour_word, GRect(4, y + 2*h-2, 144, 2*h+8), font_thick);
text_layer(&rel_small_word, GRect(4, y + 1*h+2, 144, h+8), font_small);
text_layer(&rel_word, GRect(4, y + 1*h, 144, h+8), font_thin);
text_layer(&min_word, GRect(4, y + 0*h, 144, h+8), font_thin);
}
示例6: handle_init
void handle_init(AppContextRef ctx) {
window_init(&window, "Simplicity");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
layer_init(&time_layer, GRect(0, 12, 144, 168-68));
layer_add_child(&window.layer, &time_layer);
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, 0, 144-8, 168-68));
text_layer_set_font(&text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
layer_add_child(&time_layer, &text_date_layer.layer);
text_layer_init(&text_time_layer, window.layer.frame);
text_layer_set_text_color(&text_time_layer, GColorWhite);
text_layer_set_background_color(&text_time_layer, GColorClear);
layer_set_frame(&text_time_layer.layer, GRect(7, 24, 144-7, 168-92));
text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49)));
layer_add_child(&time_layer, &text_time_layer.layer);
layer_init(&line_layer, window.layer.frame);
line_layer.update_proc = &line_layer_update_callback;
layer_add_child(&time_layer, &line_layer);
layer_init(&car_layer, GRect(0, 90, 144, 168-90));
layer_add_child(&window.layer, &car_layer);
text_layer_init(&text_rated_layer, window.layer.frame);
text_layer_set_text_color(&text_rated_layer, GColorWhite);
text_layer_set_background_color(&text_rated_layer, GColorClear);
layer_set_frame(&text_rated_layer.layer, GRect(8, 0, 144-8, 168-68));
text_layer_set_font(&text_rated_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
layer_add_child(&car_layer, &text_rated_layer.layer);
text_layer_init(&text_state_layer, window.layer.frame);
text_layer_set_text_color(&text_state_layer, GColorWhite);
text_layer_set_background_color(&text_state_layer, GColorClear);
layer_set_frame(&text_state_layer.layer, GRect(8, 20, 144-8, 168-68));
text_layer_set_font(&text_state_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
layer_add_child(&car_layer, &text_state_layer.layer);
layer_init(&battery_layer, GRect(72, 10, 144-70, 10));
battery_layer.update_proc = &battery_layer_update_callback;
layer_add_child(&car_layer, &battery_layer);
Tuplet initial_values[] = {
TupletInteger(TESLA_RATED_REMAIN_KEY, (uint16_t) 148),
TupletCString(TESLA_STATE_STRING_KEY, "Charging"),
TupletInteger(TESLA_BATTERY_PERCENT_KEY, (uint8_t) 72),
};
app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
sync_tuple_changed_callback, sync_error_callback, NULL);
}
示例7: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
firstblood = true;
window_init(&window, "Clock_Window");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
fontHour = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLDITALIC_35));
fontUhr = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_LIGHTITALIC_30));
fontMinutes = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_ITALIC_33));
fontDate = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_ITALIC_13));
memset(row_1_buffer,0,20);
memset(row_3_buffer,0,20);
memset(row_4_buffer,0,20);
memset(row_5_buffer,0,20);
text_layer_init(&row_2, window.layer.frame);
text_layer_init(&row_3, window.layer.frame);
text_layer_init(&row_4, window.layer.frame);
text_layer_init(&row_5, window.layer.frame);
text_layer_init(&row_3b, window.layer.frame);
text_layer_init(&row_4b, window.layer.frame);
text_layer_init(&row_5b, window.layer.frame);
text_layer_init(&row_1, window.layer.frame);
text_layer_init(&row_1b, window.layer.frame);
get_time(&t);
}
示例8: handle_init
void handle_init(AppContextRef ctx) {
Layer *rootLayer;
int i;
window_init(&window, "Minimalist");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
clock12 = !clock_is_24h_style();
resource_init_current_app(&APP_RESOURCES);
for (i=0; i<NUM_IMAGES; i++) {
heap_bitmap_init(&digitBmp[i], digitId[i]);
#if WHITE_BACKGROUND
bmpNegative(&digitBmp[i].bmp);
#endif
}
rootLayer = window_get_root_layer(&window);
layer_init(&layer, GRect(0,0,SCREENW,SCREENH));
layer_set_update_proc(&layer, &update_display);
layer_add_child(rootLayer, &layer);
handle_tick(ctx, NULL);
//layer_mark_dirty(&layer);
}
示例9: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Orbit");
window_stack_push(&window, false /* Not Animated */);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&RESOURCES);
bmp_init_container(RESOURCE_ID_IMAGE_FACE, &faceImage);
layer_add_child(&window.layer, &faceImage.layer.layer);
rotbmp_pair_init_container(RESOURCE_ID_IMAGE_MINUTE_PLANET_WHITE, RESOURCE_ID_IMAGE_MINUTE_PLANET_BLACK, &minuteImage);
layer_add_child(&window.layer, &minuteImage.layer.layer);
rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_PLANET_WHITE, RESOURCE_ID_IMAGE_HOUR_PLANET_BLACK, &hourImage);
layer_add_child(&window.layer, &hourImage.layer.layer);
text_layer_init(&minuteText, GRect(0,0,0,0));
text_layer_set_text_color(&minuteText, GColorWhite);
text_layer_set_background_color(&minuteText, GColorClear);
text_layer_set_text_alignment(&minuteText, GTextAlignmentCenter);
text_layer_set_font(&minuteText, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_14)));
layer_add_child(&window.layer, &minuteText.layer);
text_layer_init(&hourText, GRect(0,0,0,0));
text_layer_set_text_color(&hourText, GColorWhite);
text_layer_set_background_color(&hourText, GColorClear);
text_layer_set_text_alignment(&hourText, GTextAlignmentCenter);
text_layer_set_font(&hourText, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_22)));
layer_add_child(&window.layer, &hourText.layer);
update_rings();
}
示例10: handle_init
// Handle the start-up of the app
void handle_init(AppContextRef app_ctx) {
// Create our app's base window
window_init(&window, "Silly Walk");
window_stack_push(&window, true);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
// 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);
PblTm t;
get_time(&t);
update_watch(&t);
}
示例11: handle_init
void handle_init(AppContextRef ctx) {
memset(&background_image, 0, sizeof(background_image));
memset(&day_name_image, 0, sizeof(day_name_image));
memset(&date_digits_images, 0, sizeof(date_digits_images));
memset(&time_digits_images, 0, sizeof(time_digits_images));
memset(&digits, 0, sizeof(digits));
memset(&display_layer, 0, sizeof(display_layer));
window_init(&window, "LCAR");
window_stack_push(&window, true /* Animated */);
resource_init_current_app(&APP_RESOURCES);
bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image);
layer_init(&display_layer, GRect(43, 110, 82, 35));
display_layer.update_proc = &display_layer_update_callback;
layer_add_child(&window.layer, &background_image.layer.layer);
layer_add_child(&window.layer, &background_image.layer.layer);
layer_add_child(&window.layer,&display_layer);
// Avoids a blank screen on watch start.
PblTm tick_time;
get_time(&tick_time);
update_display(&tick_time);
}
示例12: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Bar Graph");
window_stack_push(&window, true /* Animated */);
resource_init_current_app(&APP_RESOURCES);
bmp_init_container(RESOURCE_ID_IMAGE_FACE, &faceImage);
layer_add_child(&window.layer, &faceImage.layer.layer);
layer_init(&hourLayer, window.layer.frame);
hourLayer.update_proc = &update_hour;
layer_add_child(&window.layer, &hourLayer);
layer_init(&minLayer, window.layer.frame);
minLayer.update_proc = &update_minute;
layer_add_child(&window.layer, &minLayer);
text_layer_init(&dateText, GRect(0,138,144,30));
text_layer_set_text_color(&dateText, GColorWhite);
text_layer_set_background_color(&dateText, GColorClear);
text_layer_set_text_alignment(&dateText, GTextAlignmentCenter);
text_layer_set_font(&dateText, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_22)));
layer_add_child(&window.layer, &dateText.layer);
update_date();
}
示例13: handle_init
static void handle_init(AppContextRef ctx) {
(void) ctx;
window_init(&s_data.window, "Clock_Window");
const bool animated = true;
window_stack_push(&s_data.window, animated);
window_set_background_color(&s_data.window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
//GFont gotham = fonts_get_system_font(FONT_KEY_DROID_SERIF_28_BOLD);
GFont fontPlain = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SANSATION_LIGHT_42));
GFont fontBold = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SANSATION_BOLD_42));
text_layer_init(&s_data.label, GRect(0, 0, s_data.window.layer.frame.size.w, 100));
text_layer_init(&s_data.label2, GRect(0, 37, s_data.window.layer.frame.size.w, s_data.window.layer.frame.size.h - 37));
text_layer_set_background_color(&s_data.label, GColorClear);
text_layer_set_background_color(&s_data.label2, GColorClear);
text_layer_set_text_color(&s_data.label, GColorWhite);
text_layer_set_text_color(&s_data.label2, GColorWhite);
text_layer_set_font(&s_data.label, fontBold);
text_layer_set_font(&s_data.label2, fontPlain);
layer_add_child(&s_data.window.layer, &s_data.label.layer);
layer_add_child(&s_data.window.layer, &s_data.label2.layer);
PblTm t;
get_time(&t);
update_time(&t);
}
示例14: handle_init
//
// sets up the display
//
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Simplicity");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
resource_init_current_app(&APP_RESOURCES);
//
// Load the bitmaps
//
bmp_init_container( RESOURCE_ID_IMAGE_PIC1, &_pic1 );
bmp_init_container( RESOURCE_ID_IMAGE_PIC2, &_pic2 );
bmp_init_container( RESOURCE_ID_IMAGE_PIC3, &_pic3 );
//
// create the bitmap layer at the back
//
bitmap_layer_init( &_currentPicture, GRect(0,0, 144, 168) );
layer_add_child( &window.layer, &_currentPicture.layer );
//
// load the font we are using
//
GFont font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21));
//
// create the text layers
//
setupTextLayer( &_currentDate, &window, 2, 168-21, 144-4, 21, font );
setupTextLayer( &_currentTime, &window, 2, 168-42, 144-4, 21, font );
}
示例15: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Hebrew Text");
window_stack_push(&window, true /* Animated */);
window_set_background_color(&window, GColorBlack);
// If you neglect to call this, all `resource_get_handle()` requests
// will return NULL.
resource_init_current_app(&RESOURCES);
font42 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SIMPLE_42));
font36 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SIMPLE_36));
font28 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SIMPLE_28));
text_layer_init(&timeLayer, GRect(0, 0, window.layer.frame.size.w, window.layer.frame.size.h));
text_layer_set_text_color(&timeLayer, GColorWhite);
text_layer_set_text_alignment(&timeLayer, GTextAlignmentRight);
text_layer_set_background_color(&timeLayer, GColorClear);
handle_minute_tick(ctx, NULL);
layer_add_child(&window.layer, &timeLayer.layer);
}