Esempio n. 1
0
//
// 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 );
}
Esempio n. 2
0
//
// 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);
    window_set_fullscreen(&window, true);
    resource_init_current_app(&APP_RESOURCES);
    
    window_set_click_config_provider(&window, (ClickConfigProvider) config_provider);
    
    //
    // Initialize the bitmap linking arrays to link nowhere.
    //
    for(int i=0;i<_totalImages;i++)
    {
        _targetImage[i]=-1;
        _nextImage[i]=-1;
        _prevImage[i]=-1;
    }
    
    //
    //Slide group setup
    //
    //id is incremented for each resourceID we set.
    //remember to set the 4 array sizes to to number of images up in the global declarations.
    //
    
    int id=0; //start with ID 0.
    
    _bmpResourceID[id] = RESOURCE_ID_NAV_IMAGE_001;
        _targetImage[id] = id+7; //Fandom                   //fandom is 7 slides forward. select should take us there.
        _prevImage[id] = id+4;                              //for slide 0, up button should jump four slides forward to wrap menu.
        bmp_init_container( _bmpResourceID[id], &_image0);  //assign to _image0 so that inital screendraw can happen.
    _bmpResourceID[++id] = RESOURCE_ID_NAV_IMAGE_002;
        _targetImage[id] = id+15; //fantasy                 //fantasy is currently 13 slides forward. select should take us there.
    _bmpResourceID[++id] = RESOURCE_ID_NAV_IMAGE_003;
        _targetImage[id] = id+11; //family                   //alas, these offsets are somewhat fragile.
    _bmpResourceID[++id] = RESOURCE_ID_NAV_IMAGE_004;
        _targetImage[id] = id+18; //mockups
    _bmpResourceID[++id] = RESOURCE_ID_NAV_IMAGE_005;
        _targetImage[id] = id+1;  //help
        _nextImage[id] = id-4;                              //for slide 4, down button should jump four slides backward to wrap menu.

    //Help Group
    _bmpResourceID[++id] = RESOURCE_ID_HELP_IMAGE_001;
        _prevImage[id] = id+1;
    _bmpResourceID[++id] = RESOURCE_ID_HELP_IMAGE_002;
        _nextImage[id] = id-1;

    //Fandom Group
    _bmpResourceID[++id] = RESOURCE_ID_FANDOM_IMAGE_001;
        _prevImage[id] = id+5;
    _bmpResourceID[++id] = RESOURCE_ID_FANDOM_IMAGE_002;
    _bmpResourceID[++id] = RESOURCE_ID_FANDOM_IMAGE_003;
    _bmpResourceID[++id] = RESOURCE_ID_FANDOM_IMAGE_004;
    _bmpResourceID[++id] = RESOURCE_ID_FANDOM_IMAGE_005;
    _bmpResourceID[++id] = RESOURCE_ID_FANDOM_IMAGE_006;
        _nextImage[id] = id-5;
    
    //Family Group
    _bmpResourceID[++id] = RESOURCE_ID_FAMILY_IMAGE_001;
        _prevImage[id] = id+2;
    _bmpResourceID[++id] = RESOURCE_ID_FAMILY_IMAGE_002;
    _bmpResourceID[++id] = RESOURCE_ID_FAMILY_IMAGE_003;
        _nextImage[id] = id-2;
 
    //Fantasy Group
    _bmpResourceID[++id] = RESOURCE_ID_FANTASY_IMAGE_001;
        _prevImage[id] = id+4;
    _bmpResourceID[++id] = RESOURCE_ID_FANTASY_IMAGE_002;
    _bmpResourceID[++id] = RESOURCE_ID_FANTASY_IMAGE_003;
    _bmpResourceID[++id] = RESOURCE_ID_FANTASY_IMAGE_004;
    _bmpResourceID[++id] = RESOURCE_ID_FANTASY_IMAGE_005;
        _nextImage[id] = id-4;

    //Mockups Group
    _bmpResourceID[++id] = RESOURCE_ID_MOCKUP_IMAGE_001;
    _prevImage[id] = id+4;
    _bmpResourceID[++id] = RESOURCE_ID_MOCKUP_IMAGE_002;
    _bmpResourceID[++id] = RESOURCE_ID_MOCKUP_IMAGE_003;
    _bmpResourceID[++id] = RESOURCE_ID_MOCKUP_IMAGE_004;
    _bmpResourceID[++id] = RESOURCE_ID_MOCKUP_IMAGE_005;
    _nextImage[id] = id-4;

    //
    //Slide group setup end
    //
    
    
    //
    // create the bitmap layer at the back
    //
    bitmap_layer_init( &_currentPicture, GRect(0,0, 144, 168) );
    layer_add_child( &window.layer, &_currentPicture.layer );
    
    ScreenChange(0); // do initial screen draw.
    
    //
    // set the font we are using for time display.
    //
    GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
    GFont font2 = fonts_get_system_font(FONT_KEY_GOTHIC_18);
    
    //fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21));
    
    //
    // create the text layers
    //
    setupTextLayer( &_currentDate, &window, 0, 168-23, 144, 23, font2, GColorWhite, GColorBlack, GTextAlignmentRight);
    setupTextLayer( &_currentTime, &window, 0, 168-28, 144, 28, font, GColorWhite, GColorClear, GTextAlignmentLeft);
    
    layer_set_hidden(&_currentTime.layer, _hidingTime);
    layer_set_hidden(&_currentDate.layer, _hidingTime);
}