本文整理汇总了C++中resource_get_handle函数的典型用法代码示例。如果您正苦于以下问题:C++ resource_get_handle函数的具体用法?C++ resource_get_handle怎么用?C++ resource_get_handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resource_get_handle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: load_fonts
// define all the fonts used
static void load_fonts() {
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_NHL_VAN_64));
s_date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_NHL_VAN_28));
s_temperature_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_NHL_VAN_22));
s_battery_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_NHL_VAN_22));
s_colon_font = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD);
}
开发者ID:tammyd,项目名称:CanucksScoreboard,代码行数:8,代码来源:main.c
示例2: main_window_load
static void main_window_load(Window *window) {
// Create GFonts
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_48));
s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_20));
// Create GBitmap, then set to created BitmapLayer
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);
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));
// Create the weather TextLayer
s_weather_layer = text_layer_create(GRect(0, 130, 144, 25));
text_layer_set_background_color(s_weather_layer, GColorClear);
text_layer_set_text_color(s_weather_layer, GColorWhite);
text_layer_set_text_alignment(s_weather_layer, GTextAlignmentCenter);
text_layer_set_text(s_weather_layer, "Loading...");
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));
// Create the time TextLayer
s_time_layer = text_layer_create(GRect(5,52,139,50));
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_text_color(s_time_layer, GColorBlack);
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));
}
开发者ID:bencentra,项目名称:pebble-tutorial,代码行数:28,代码来源:main.c
示例3: window_load
static void window_load(Window *window) {
font24 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_24));
font18 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_18));
Layer *window_layer = window_get_root_layer(window);
// add the doge face
image = gbitmap_create_with_resource(RESOURCE_ID_DOGEFACE);
image_layer = bitmap_layer_create(GRect(8, 0, 132, 116));
bitmap_layer_set_bitmap(image_layer, image);
layer_add_child(window_layer, bitmap_layer_get_layer(image_layer));
text_time_layer = text_layer_create(GRect(12, 120, 132, 144));
text_layer_set_text_alignment(text_time_layer, GTextAlignmentCenter);
text_layer_set_text_color(text_time_layer, GColorBlack);
text_layer_set_background_color(text_time_layer, GColorClear);
text_layer_set_font(text_time_layer, font24);
layer_add_child(window_layer, text_layer_get_layer(text_time_layer));
text_price_layer = text_layer_create(GRect(12, 146, 132, 167));
text_layer_set_text_alignment(text_price_layer, GTextAlignmentCenter);
text_layer_set_text_color(text_price_layer, GColorBlack);
text_layer_set_background_color(text_price_layer, GColorClear);
text_layer_set_font(text_price_layer, font18);
layer_add_child(window_layer, text_layer_get_layer(text_price_layer));
}
开发者ID:JerrySievert,项目名称:dogeface,代码行数:26,代码来源:dogeface.c
示例4: 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);
}
开发者ID:kost,项目名称:TextWatch-hr,代码行数:29,代码来源:TextWatch-hr.c
示例5: window_load
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
GRect bounds = layer_get_bounds(window_layer);
const GPoint center = grect_center_point(&bounds);
//Load bitmap image
background_layer = layer_create(bounds);
layer_set_update_proc(background_layer, background_layer_update);
layer_add_child(window_layer, background_layer);
custom_font_text = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_BOXY_TEXT_20));
custom_font_outline = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_BOXY_OUTLINE_20));
//Add analog hands
analog_init(my_window);
// Render layer ontop for cool transparency
render_layer = layer_create(bounds);
layer_set_update_proc(render_layer, render_layer_update);
layer_add_child(window_layer, render_layer);
//Force time update
time_t current_time = time(NULL);
struct tm *current_tm = localtime(¤t_time);
tick_handler(current_tm, MINUTE_UNIT | DAY_UNIT);
//Setup tick time handler
tick_timer_service_subscribe((MINUTE_UNIT), tick_handler);
}
开发者ID:jay3,项目名称:pebble_offscreen_rendering_text_demo,代码行数:29,代码来源:main.c
示例6: handle_init
void handle_init(void) {
window = window_create();
window_stack_push(window, true /* Animated */);
window_set_background_color(window, GColorBlack);
Layer *window_layer = window_get_root_layer(window);
text_date_layer = text_layer_create(GRect(8, 68, 144-8, 168-68));
text_layer_set_text_color(text_date_layer, GColorWhite);
text_layer_set_background_color(text_date_layer, GColorClear);
text_layer_set_font(text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
layer_add_child(window_layer, text_layer_get_layer(text_date_layer));
text_time_layer = text_layer_create(GRect(7, 92, 144-7, 168-92));
text_layer_set_text_color(text_time_layer, GColorWhite);
text_layer_set_background_color(text_time_layer, GColorClear);
text_layer_set_font(text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49)));
layer_add_child(window_layer, text_layer_get_layer(text_time_layer));
GRect line_frame = GRect(8, 97, 139, 2);
line_layer = layer_create(line_frame);
layer_set_update_proc(line_layer, line_layer_update_callback);
layer_add_child(window_layer, line_layer);
// Ensures time is displayed immediately (will break if NULL tick event accessed).
// (This is why it's a good idea to have a separate routine to do the update itself.)
time_t now = time(NULL);
struct tm *current_time = localtime(&now);
handle_minute_tick(current_time, MINUTE_UNIT);
tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick);
}
开发者ID:dewagter,项目名称:pebble-sdk-examples,代码行数:32,代码来源:simplicity.c
示例7: 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();
}
开发者ID:juliengrenier,项目名称:pebble,代码行数:34,代码来源:orbit.c
示例8: window_load
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
font49 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49));
font39 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_39));
font21 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21));
// create time layer - this is where time goes
text_time_layer = text_layer_create(GRect(8, 24, 144-7, 168-92));
text_layer_set_text_color(text_time_layer, GColorWhite);
text_layer_set_background_color(text_time_layer, GColorClear);
text_layer_set_font(text_time_layer, font49);
layer_add_child(window_layer, text_layer_get_layer(text_time_layer));
// create date layer - this is where the date goes
text_date_layer = text_layer_create(GRect(8, 0, 144-16, 24));
text_layer_set_text_alignment(text_date_layer, GTextAlignmentCenter);
text_layer_set_text_color(text_date_layer, GColorWhite);
text_layer_set_background_color(text_date_layer, GColorClear);
text_layer_set_font(text_date_layer, font21);
layer_add_child(window_layer, text_layer_get_layer(text_date_layer));
// create temperature layer - this is where the temperature goes
text_temp_layer = text_layer_create(GRect(80, 108, 144-80, 168-108));
text_layer_set_text_color(text_temp_layer, GColorWhite);
text_layer_set_background_color(text_temp_layer, GColorClear);
text_layer_set_font(text_temp_layer, font39);
layer_add_child(window_layer, text_layer_get_layer(text_temp_layer));
}
开发者ID:JerrySievert,项目名称:pebble-weather-watchface,代码行数:29,代码来源:weather-app.c
示例9: handle_init
void handle_init(AppContextRef ctx) {
(void)ctx;
window_init(&window, "Demo");
window_stack_push(&window, true /* Animated */);
resource_init_current_app(&FUZZYZEIT_RESOURCES);
custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_MPC_32));
custom_font2 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_MPBC_32));
window_set_background_color(&window, GColorBlack);
graphics_context_set_text_color(ctx, GColorWhite);
text_layer_init(&min_layer, GRect(4, 35, 144 /* width */, 50 /* height */));
text_layer_set_text_color(&min_layer, GColorWhite);
text_layer_set_text(&min_layer, "");
text_layer_set_font(&min_layer, custom_font);
text_layer_set_background_color(&min_layer, GColorClear);
layer_add_child(&window.layer, &min_layer.layer);
layer_mark_dirty(&min_layer.layer);
text_layer_init(&hour_layer, GRect(4, 80, 144 /* width */, 50 /* height */));
text_layer_set_text_color(&hour_layer, GColorWhite);
text_layer_set_text(&hour_layer, "");
text_layer_set_font(&hour_layer, custom_font2);
text_layer_set_background_color(&hour_layer, GColorClear);
layer_add_child(&window.layer, &hour_layer.layer);
layer_mark_dirty(&hour_layer.layer);
update_layer(ctx);
}
开发者ID:Clonebytes,项目名称:fuzzyZeit,代码行数:35,代码来源:fuzzyZeit.c
示例10: set_text_to_window
static void set_text_to_window() {
//Time TextLayer
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CRYSTAL_36));
s_time_layer = text_layer_create(GRect(5, 50, 130, 40));
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_text_color(s_time_layer, GColorWhite);
text_layer_set_text(s_time_layer, "00:00");
text_layer_set_font(s_time_layer, s_time_font);
text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
//Time TextLayer
s_timephase_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CRYSTAL_18));
timephase_layer = text_layer_create(GRect(85, 85, 30, 30));
text_layer_set_background_color(timephase_layer, GColorClear);
text_layer_set_text_color(timephase_layer, GColorWhite);
text_layer_set_text(timephase_layer, "00");
text_layer_set_font(timephase_layer, s_timephase_font);
text_layer_set_text_alignment(timephase_layer, GTextAlignmentCenter);
// Create current date TextLayer
s_date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CRYSTAL_18));
current_date_layer = text_layer_create(GRect(12, 133, 120, 30));
text_layer_set_background_color(current_date_layer, GColorClear);
text_layer_set_text_color(current_date_layer, GColorWhite);
text_layer_set_text(current_date_layer, "00.00 000");
text_layer_set_font(current_date_layer, s_date_font);
text_layer_set_text_alignment(current_date_layer, GTextAlignmentCenter);
}
开发者ID:MicroByter,项目名称:PebbleFaces,代码行数:29,代码来源:main.c
示例11: handle_init
void handle_init( void )
{
// Create the window, add it to the stack, and get its boundaries.
window = window_create();
window_stack_push( window, true );
GRect window_bounds = layer_get_bounds( window_get_root_layer(window) );
// Init the background image layer.
background_image = gbitmap_create_with_resource( RESOURCE_ID_IMAGE_BACKGROUND );
background_layer = bitmap_layer_create( window_bounds );
bitmap_layer_set_bitmap( background_layer, background_image );
layer_add_child( window_get_root_layer(window), bitmap_layer_get_layer(background_layer) );
// Init the text layer used to show the time.
time_layer = text_layer_create( GRect( 54, 1, 144, 168 ) );
text_layer_set_text_color( time_layer, GColorBlack );
text_layer_set_background_color( time_layer, GColorClear );
text_layer_set_font( time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CHICAGO_13)) );
layer_add_child( window_get_root_layer(window), text_layer_get_layer(time_layer) );
// Init the text layer used to show the date.
date_layer = text_layer_create( GRect( 9, 86, 144, 168 ) );
text_layer_set_text_color( date_layer, GColorBlack );
text_layer_set_background_color( date_layer, GColorClear );
text_layer_set_font( date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_GENEVA_12)) );
layer_add_child( window_get_root_layer(window), text_layer_get_layer(date_layer) );
// Avoid a blank screen on watch start.
time_t t = time( NULL );
struct tm *tick_time = localtime( &t );
update_display( tick_time );
// Request an update signal every minute.
tick_timer_service_subscribe( MINUTE_UNIT, handle_tick );
}
开发者ID:Raptor007,项目名称:Pebble-Watchfaces,代码行数:35,代码来源:iwatch_nosecs.c
示例12: main_window_load
static void main_window_load(Window *window) {
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_BACKGROUND_TEST);
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));
s_time_layer = text_layer_create(GRect(5, 55, 139, 50));
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_42));
init_text_layer(s_time_layer, s_time_font, GColorBlack, GColorClear, GTextAlignmentCenter);
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));
s_weather_layer = text_layer_create(GRect(5, 15, 139, 25));
s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_20));
init_text_layer(s_weather_layer, s_weather_font, GColorWhite, GColorClear, GTextAlignmentCenter);
text_layer_set_text(s_weather_layer, "Loading...");
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer));
s_wday_layer = text_layer_create(GRect(5, 115, 139, 25));
init_text_layer(s_wday_layer, s_weather_font, GColorWhite, GColorClear, GTextAlignmentCenter);
text_layer_set_text(s_wday_layer, "...");
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_wday_layer));
s_date_layer = text_layer_create(GRect(5, 143, 139, 25));
init_text_layer(s_date_layer, s_weather_font, GColorWhite, GColorClear, GTextAlignmentCenter);
text_layer_set_text(s_date_layer, "...");
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_date_layer));
update_time();
}
开发者ID:cy6erskunk,项目名称:pebble-face,代码行数:32,代码来源:main.c
示例13: main_window_load
static void main_window_load(Window *window) {
// Create Background Layer
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);
s_background_layer = bitmap_layer_create(GRect(0, 0, 144, 168));
bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);
// Create time Textlayer
s_time_layer = text_layer_create(GRect(5, 52, 139, 50));
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_text_color(s_time_layer, GColorWhite);
// Create trends TextLayer
s_trending_layer = text_layer_create(GRect(0, 110, 144, 25));
text_layer_set_background_color(s_trending_layer, GColorClear);
text_layer_set_text_color(s_trending_layer, GColorWhite);
text_layer_set_text(s_trending_layer, "Mewing...");
// Time Font
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ROBOTO_CONDENSED_BOLD_42));
text_layer_set_font(s_time_layer, s_time_font);
text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
// Trending Font
s_trending_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ROBOTO_CONDENSED_LT_20));
text_layer_set_font(s_trending_layer, s_trending_font);
text_layer_set_text_alignment(s_trending_layer, GTextAlignmentCenter);
//Add layers in order as child layers to the Window's root layer
layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_background_layer));
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_trending_layer));
}
开发者ID:jebrial,项目名称:woopface,代码行数:33,代码来源:main.c
示例14: window_load
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
// GRect bounds = layer_get_bounds(window_layer);
deco_layer = layer_create(GRect(0, 0, 144, 8));
layer_set_update_proc(deco_layer, deco_layer_onupdate);
arrow_image = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ARROW_24);
image_layer = bitmap_layer_create(GRect(12, 20, 24, 24));
bitmap_layer_set_bitmap(image_layer, arrow_image);
text_layer = text_layer_create(GRect(16, 113, 128, 24));
text_layer_set_background_color(text_layer, METRO_APP_BACK_COLOR);
text_layer_set_text_color(text_layer, METRO_APP_TEXT_COLOR);
text_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_OSWALD_LIGHT_18));
text_layer_set_font(text_layer, text_font);
time_layer = text_layer_create(GRect(16, 58, 128, 48));
text_layer_set_background_color(time_layer, METRO_APP_BACK_COLOR);
text_layer_set_text_color(time_layer, METRO_APP_TEXT_COLOR);
time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_OSWALD_REGULAR_48));
text_layer_set_font(time_layer, time_font);
layer_add_child(window_layer, deco_layer);
layer_add_child(window_layer, bitmap_layer_get_layer(image_layer));
layer_add_child(window_layer, text_layer_get_layer(text_layer));
layer_add_child(window_layer, text_layer_get_layer(time_layer));
}
开发者ID:rschiang,项目名称:pebble-metro,代码行数:30,代码来源:metro.c
示例15: 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);
}
开发者ID:banahogg,项目名称:TeslaPebble-Pebble,代码行数:60,代码来源:main.c
示例16: window_load
static void window_load(Window *window)
{
window_set_background_color(window, GColorBlack);
canvas = layer_create(GRect(0, 0, SCREEN_WIDTH , SCREEN_HEIGHT));
layer_set_update_proc(canvas, (LayerUpdateProc) render);
layer_add_child(window_get_root_layer(window), canvas);
mTimeFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TREBUCHET_40));
mTimeFontBold = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TREBUCHET_BOLD_40));
mSmallFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TREBUCHET_BOLD_24));
mTinyFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TREBUCHET_16));
// Init all text fields
const int mTwoDigitTextSize = sizeof("00:00 ");
mDayText = malloc(mTwoDigitTextSize);
mMonthText = malloc(mTwoDigitTextSize);
mYearText = malloc(mTwoDigitTextSize);
mHourText = malloc(mTwoDigitTextSize);
mMinuteText = malloc(mTwoDigitTextSize);
mSecondText = malloc(mTwoDigitTextSize);
// Set initial time so display isn't blank
struct tm* t;
time_t temp;
temp = time(NULL);
t = localtime(&temp);
set_time_display(t);
battery_handler(battery_state_service_peek());
}
开发者ID:jsternfield,项目名称:kingsglaive,代码行数:30,代码来源:main.c
示例17: init
static void init(void) {
window = window_create();
window_stack_push(window, true /* Animated */);
window_set_background_color(window, GColorBlack);
weather_data = malloc(sizeof(WeatherData));
init_network(weather_data);
font_date = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FUTURA_18));
font_time = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FUTURA_CONDENSED_53));
time_layer = text_layer_create(TIME_FRAME);
text_layer_set_text_color(time_layer, GColorWhite);
text_layer_set_background_color(time_layer, GColorClear);
text_layer_set_font(time_layer, font_time);
text_layer_set_text_alignment(time_layer, GTextAlignmentCenter);
layer_add_child(window_get_root_layer(window), text_layer_get_layer(time_layer));
date_layer = text_layer_create(DATE_FRAME);
text_layer_set_text_color(date_layer, GColorWhite);
text_layer_set_background_color(date_layer, GColorClear);
text_layer_set_font(date_layer, font_date);
text_layer_set_text_alignment(date_layer, GTextAlignmentCenter);
layer_add_child(window_get_root_layer(window), text_layer_get_layer(date_layer));
// Add weather layer
weather_layer = weather_layer_create(GRect(0, 90, 144, 80));
layer_add_child(window_get_root_layer(window), weather_layer);
// Update the screen right away
time_t now = time(NULL);
handle_tick(localtime(&now), SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT );
// And then every second
tick_timer_service_subscribe(SECOND_UNIT, handle_tick);
}
开发者ID:Demostrike,项目名称:futura-weather-sdk2.0,代码行数:35,代码来源:main.c
示例18: main_window_load
static void main_window_load(Window *window) {
// Create GBitmap, then set to created BitmapLayer
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_BACKGROUND);
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));
// Create temperature Layer
s_weather_layer = text_layer_create(GRect(15,130,144,25));
text_layer_set_background_color(s_weather_layer, GColorClear);
text_layer_set_text_color(s_weather_layer, GColorWhite);
text_layer_set_text_alignment(s_weather_layer, GTextAlignmentCenter);
text_layer_set_text(s_weather_layer, "Loading ...");
// Create time TextLayer
s_time_layer = text_layer_create(GRect(5, 59, 139, 50));
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_text_color(s_time_layer, GColorWhite);
// Create GFonts
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_APERCU_30));
s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_APERCU_15));
// Improve the layout to be more like a watchface
text_layer_set_font(s_time_layer, s_time_font);
text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
text_layer_set_font(s_weather_layer, s_weather_font);
// 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));
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer));
}
开发者ID:JAdshead,项目名称:basic-watch-face-pebble,代码行数:32,代码来源:BasicFace.c
示例19: init
static void init(void) {
pebbleLocale = setlocale(LC_ALL, "");
window = window_create();
window_set_background_color(window, GColorBlack);
window_stack_push(window, true);
rootLayer = window_get_root_layer(window);
srand(time(NULL));
layer = layer_create(GRect(0, 0, WIDTH, HEIGHT));
layer_set_update_proc(layer, updateScreen);
layer_add_child(rootLayer, layer);
fontHour = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_BORIS_47));
#if defined(SHOWDATE)
fontDate = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_BORIS_18));
#endif
setText();
initRects();
reset();
timer = app_timer_register(DELAY, timerCallback, NULL);
tick_timer_service_subscribe(MINUTE_UNIT, minuteChange);
accel_data_service_subscribe(0, NULL);
accel_tap_service_subscribe(tapHandler);
}
开发者ID:Jnmattern,项目名称:Snowy,代码行数:31,代码来源:Snowy.c
示例20: layer_create_with_data
WeatherLayer *weather_layer_create(GRect frame)
{
// Create a new layer with some extra space to save our custom Layer infos
WeatherLayer *weather_layer = layer_create_with_data(frame, sizeof(WeatherLayerData));
WeatherLayerData *wld = layer_get_data(weather_layer);
large_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FUTURA_40));
small_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FUTURA_35));
// Add background layer
wld->temp_layer_background = text_layer_create(GRect(0, 10, 144, 68));
text_layer_set_background_color(wld->temp_layer_background, GColorWhite);
layer_add_child(weather_layer, text_layer_get_layer(wld->temp_layer_background));
// Add temperature layer
wld->temp_layer = text_layer_create(GRect(70, 19, 72, 80));
text_layer_set_background_color(wld->temp_layer, GColorClear);
text_layer_set_text_alignment(wld->temp_layer, GTextAlignmentCenter);
text_layer_set_font(wld->temp_layer, large_font);
layer_add_child(weather_layer, text_layer_get_layer(wld->temp_layer));
// Add bitmap layer
wld->icon_layer = bitmap_layer_create(GRect(9, 13, 60, 60));
layer_add_child(weather_layer, bitmap_layer_get_layer(wld->icon_layer));
wld->icon = NULL;
return weather_layer;
}
开发者ID:Demostrike,项目名称:futura-weather-sdk2.0,代码行数:29,代码来源:weather_layer.c
注:本文中的resource_get_handle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论