コード例 #1
0
ファイル: main.c プロジェクト: ShaBP/91DubPro
static void update_hours(struct tm *tick_time) {

  /* removed hourly vibe (and it's setting)
  if(appStarted && settings.HourlyVibe) {
    //vibe!
    vibes_short_pulse();
  }
  */
  
  unsigned short display_hour = get_display_hour(tick_time->tm_hour);

  set_container_image(&time_digits_images[0], time_digits_layers[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(10, 84));
  set_container_image(&time_digits_images[1], time_digits_layers[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(40, 84));

  if (!clock_is_24h_style()) {
    if (tick_time->tm_hour >= 12) {
      set_container_image(&time_format_image, time_format_layer, RESOURCE_ID_IMAGE_PM_MODE, GPoint(17, 68));
      layer_set_hidden(bitmap_layer_get_layer(time_format_layer), false);
    } 
    else {
      layer_set_hidden(bitmap_layer_get_layer(time_format_layer), true);
    }
    
    if (display_hour/10 == 0) {
      layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), true);
    }
    else {
      layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), false);
    }

  }
}
コード例 #2
0
ファイル: text.c プロジェクト: mereed/pebbleface-mixup
static void set_container_image(GBitmap **bmp_image, BitmapLayer *bmp_layer, const int resource_id, GPoint origin) {
  GBitmap *old_image = *bmp_image;
  *bmp_image = gbitmap_create_with_resource(resource_id);
  GRect frame = (GRect) {
    .origin = origin,
    .size = (*bmp_image)->bounds.size
  };
  bitmap_layer_set_bitmap(bmp_layer, *bmp_image);
  layer_set_frame(bitmap_layer_get_layer(bmp_layer), frame);
  gbitmap_destroy(old_image);
}

static void update_hours(struct tm *tick_time) {

  if(appStarted && hourlyvibe) {
    //vibe!
    vibes_short_pulse();
  }
}

static void update_minutes(struct tm *tick_time) {
	
  set_container_image(&time_digits_images[2], time_digits_layers[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[tick_time->tm_min/10], GPoint(6, 6));
  set_container_image(&time_digits_images[3], time_digits_layers[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[tick_time->tm_min%10], GPoint(75, 6));
}
コード例 #3
0
void update_display(PblTm *current_time) {

  unsigned short display_hour = get_display_hour(current_time->tm_hour);

  set_container_image(&time_digits_images[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(49, 151));
  set_container_image(&time_digits_images[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(61, 151));

  set_container_image(&time_digits_images[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min/10], GPoint(76, 151));
  set_container_image(&time_digits_images[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min%10], GPoint(87, 151));

/*
  if (!clock_is_24h_style()) {
    if (current_time->tm_hour >= 12) {
      set_container_image(&time_format_image, RESOURCE_ID_IMAGE_PM_MODE, GPoint(17, 68));
    } else {
      set_container_image(&time_format_image, RESOURCE_ID_IMAGE_AM_MODE, GPoint(17, 68));
    }

    if (display_hour/10 == 0) {
      layer_remove_from_parent(&time_digits_images[0].layer.layer);
      bmp_deinit_container(&time_digits_images[0]);
    }
  }
*/
}
コード例 #4
0
void success(int32_t cookie, int http_status, DictionaryIterator* received, void* context) {
	
	if(cookie != WEATHER_HTTP_COOKIE) return;
	
	Tuple* icon_tuple = dict_find(received, WEATHER_KEY_ICON);
	if(icon_tuple) {
		int icon = icon_tuple->value->int8;
		if(icon >= 0 && icon < 10) {
			set_container_image(&weather_images[0], WEATHER_IMAGE_RESOURCE_IDS[icon], GPoint(12, 5));  // ---------- Weather Image
		} else {
			set_container_image(&weather_images[0], WEATHER_IMAGE_RESOURCE_IDS[10], GPoint(12, 5));
		}
	}
	
	Tuple* temperature_tuple = dict_find(received, WEATHER_KEY_TEMPERATURE);
	if(temperature_tuple) {
		
		static char temp_text[5];
		memcpy(temp_text, itoa(temperature_tuple->value->int16), 4);
		int degree_pos = strlen(temp_text);
		memcpy(&temp_text[degree_pos], "°", 3);
		text_layer_set_text(&text_temperature_layer, temp_text);
		temperature_set = true;
	}
	
	link_monitor_handle_success(&data);
	//display_counters(&calls_layer, data, 1);
	//display_counters(&sms_layer, data, 2);
}
コード例 #5
0
ファイル: fifty_nine_dub.c プロジェクト: kodek/Fifty-Nine-Dub
static void set_container_image(GBitmap **bmp_image, BitmapLayer *bmp_layer, const int resource_id, GPoint origin) {
  GBitmap *old_image = *bmp_image;

  *bmp_image = gbitmap_create_with_resource(resource_id);
  GRect frame = (GRect) {
    .origin = origin,
    .size = (*bmp_image)->bounds.size
  };
  bitmap_layer_set_bitmap(bmp_layer, *bmp_image);
  layer_set_frame(bitmap_layer_get_layer(bmp_layer), frame);

  if (old_image != NULL) {
  	gbitmap_destroy(old_image);
  }
}


static unsigned short get_display_hour(unsigned short hour) {
  if (clock_is_24h_style()) {
    return hour;
  }

  unsigned short display_hour = hour % 12;

  // Converts "0" to "12"
  return display_hour ? display_hour : 12;
}

static void update_seconds (int seconds_after_minute) {
  set_container_image(&seconds_digits_images[0], seconds_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[seconds_after_minute/10], GPoint(111, 71));
  set_container_image(&seconds_digits_images[1], seconds_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[seconds_after_minute%10], GPoint(123, 71));
}
コード例 #6
0
static void update_hours(struct tm *tick_time) {

	if (appStarted && hourlyvibe) {
    //vibe!
    vibes_short_pulse();
	}
	
  unsigned short display_hour = get_display_hour(tick_time->tm_hour);

  set_container_image(&normal_time_digits_images[0], normal_time_digits_layers[0], NORMAL_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(0, 40));
  set_container_image(&normal_time_digits_images[1], normal_time_digits_layers[1], NORMAL_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(34, 40));

	
	if (!clock_is_24h_style()) {
	
	if (display_hour/10 == 0) {		
		 	layer_set_hidden(bitmap_layer_get_layer(normal_time_digits_layers[0]), true); 
		  } else  if (flip == 0) {
		    layer_set_hidden(bitmap_layer_get_layer(normal_time_digits_layers[0]), false);
            	}
	}		
	
				 static char ampm_text[] = "am";

		     if (!clock_is_24h_style()) {


		strftime(ampm_text, sizeof(ampm_text), "%P", tick_time);
        text_layer_set_text(layer_ampm_text, ampm_text);
			 }
}
コード例 #7
0
static void update_days(struct tm *tick_time) {
  set_container_image(&month_image, month_layer, MONTH_IMAGE_RESOURCE_IDS[tick_time->tm_mon], GPoint(34, 60));

  set_container_image(&day_name_image, day_name_layer, DAY_NAME_IMAGE_RESOURCE_IDS[tick_time->tm_wday], GPoint( 7, 60));
  set_container_image(&date_digits_images[0], date_digits_layers[0], TINY_IMAGE_RESOURCE_IDS[tick_time->tm_mday/10], GPoint(7, 30));
  set_container_image(&date_digits_images[1], date_digits_layers[1], TINY_IMAGE_RESOURCE_IDS[tick_time->tm_mday%10], GPoint(7, 5));
}
コード例 #8
0
ファイル: main.c プロジェクト: n3v3r001/n3v3rsbigone
static void update_hours(struct tm *tick_time) {

  if(appStarted && hourlyvibe) {
    //vibe!
    vibes_short_pulse();
  }
  
  unsigned short display_hour = get_display_hour(tick_time->tm_hour);

  set_container_image(&time_digits_images[0], time_digits_layers[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(0, 14)); //n3v3r original 5-> je zahl nun 4 breiter
  set_container_image(&time_digits_images[1], time_digits_layers[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(32, 14)); //n3v3r original 33

  if (!clock_is_24h_style()) {
    if (tick_time->tm_hour >= 12) {
      set_container_image(&time_format_image, time_format_layer, RESOURCE_ID_IMAGE_PM_MODE, GPoint(60, 2));
      layer_set_hidden(bitmap_layer_get_layer(time_format_layer), false);
    } 
    else {
      layer_set_hidden(bitmap_layer_get_layer(time_format_layer), true);
    }
    
    if (display_hour/10 == 0) {
      layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), true);
    }
    else {
      layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), false);
    }

  }
}
コード例 #9
0
ファイル: fifty_nine_dub.c プロジェクト: kodek/Fifty-Nine-Dub
static void update_time (struct tm *current_time) {
  unsigned short display_hour = get_display_hour(current_time->tm_hour);

  int yPos = 70;
  // TODO: Remove leading zero?
  set_container_image(&time_digits_images[0], time_digits_layers[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(18, yPos));
  set_container_image(&time_digits_images[1], time_digits_layers[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(38, yPos));

  set_container_image(&time_digits_images[2], time_digits_layers[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min/10], GPoint(65, yPos));
  set_container_image(&time_digits_images[3], time_digits_layers[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min%10], GPoint(85, yPos));

  if (!clock_is_24h_style()) {
    if (current_time->tm_hour >= 12) {
      layer_set_hidden(bitmap_layer_get_layer(time_format_layer), false);
      set_container_image(&time_format_image, time_format_layer, RESOURCE_ID_IMAGE_PM_MODE, GPoint(7, 75));
    } else {
      layer_set_hidden(bitmap_layer_get_layer(time_format_layer), true);
    }

    if (display_hour/10 == 0) {
    	layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), true);
    } else {
    	layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), false);
    }
  }
}
コード例 #10
0
ファイル: fifty_nine_dub.c プロジェクト: kodek/Fifty-Nine-Dub
static void update_date (int day_of_month, int days_since_sunday) {
	set_container_image(&day_name_image, day_name_layer, DAY_NAME_IMAGE_RESOURCE_IDS[days_since_sunday], GPoint(33, 126));

  // TODO: Remove leading zero?
  set_container_image(&date_digits_images[0], date_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[day_of_month/10], GPoint(46, 37));
  set_container_image(&date_digits_images[1], date_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[day_of_month%10], GPoint(59, 37));

}
コード例 #11
0
static void handle_second_tick(struct tm* current_time, TimeUnits units_changed) {
	//Display Seconds
	set_container_image(&time_digits_images[4], time_digits_layers[4], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_sec/10], GPoint(107, 90));
	set_container_image(&time_digits_images[5], time_digits_layers[5], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_sec%10], GPoint(120, 90));

	//Update status of the battery
	handle_battery(battery_state_service_peek());

	//If a minute has passed update rest of items
	if(current_time->tm_sec == 0)
		update_display(current_time);
}
コード例 #12
0
static void update_display(struct tm *current_time) {
  set_container_image(&s_day_name_bitmap, s_day_name_layer, DAY_NAME_IMAGE_RESOURCE_IDS[current_time->tm_wday], GPoint(69, 61));
  set_container_image(&s_date_digits[0], s_date_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_mday / 10], GPoint(108, 61));
  set_container_image(&s_date_digits[1], s_date_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_mday % 10], GPoint(121, 61));

  unsigned short display_hour = get_display_hour(current_time->tm_hour);
  set_container_image(&s_time_digits[0], s_time_digits_layers[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour / 10], GPoint(10, 84));
  set_container_image(&s_time_digits[1], s_time_digits_layers[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour % 10], GPoint(40, 84));

  set_container_image(&s_time_digits[2], s_time_digits_layers[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min / 10], GPoint(77, 84));
  set_container_image(&s_time_digits[3], s_time_digits_layers[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min % 10], GPoint(105, 84));

  if (!clock_is_24h_style()) {
    if (current_time->tm_hour >= 12) {
    	layer_set_hidden(bitmap_layer_get_layer(s_time_format_layer), false);
      set_container_image(&s_time_format_bitmap, s_time_format_layer, RESOURCE_ID_IMAGE_PM_MODE, GPoint(17, 68));
    } else {
    	layer_set_hidden(bitmap_layer_get_layer(s_time_format_layer), true);
    }

    if (display_hour / 10 == 0) {
    	layer_set_hidden(bitmap_layer_get_layer(s_time_digits_layers[0]), true);
    } else {
    	layer_set_hidden(bitmap_layer_get_layer(s_time_digits_layers[0]), false);
    }
  }
}
コード例 #13
0
ファイル: fifty_nine_dub.c プロジェクト: kodek/Fifty-Nine-Dub
static void update_month (int months_since_january) {
  int month_value = months_since_january + 1;
  int month_digit_ten = month_value/10;
  int month_digit_one = month_value%10;

  if (month_digit_ten == 0) {
    layer_set_hidden(bitmap_layer_get_layer(month_digits_layers[0]), true);
  } else {
	layer_set_hidden(bitmap_layer_get_layer(month_digits_layers[0]), false);
  }
  set_container_image(&month_digits_images[0], month_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[month_digit_ten], GPoint(14, 37));
  set_container_image(&month_digits_images[1], month_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[month_digit_one], GPoint(27, 37));

}
コード例 #14
0
ファイル: ninety_one_dub.c プロジェクト: 343max/pebblekit
void update_display(PblTm *current_time) {
  // TODO: Only update changed values?

  set_container_image(&day_name_image, DAY_NAME_IMAGE_RESOURCE_IDS[current_time->tm_wday], GPoint(69, 61));

  // TODO: Remove leading zero?
  set_container_image(&date_digits_images[0], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_mday/10], GPoint(108, 61));
  set_container_image(&date_digits_images[1], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_mday%10], GPoint(121, 61));


  unsigned short display_hour = get_display_hour(current_time->tm_hour);

  // TODO: Remove leading zero?
  set_container_image(&time_digits_images[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(10, 84));
  set_container_image(&time_digits_images[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(40, 84));

  set_container_image(&time_digits_images[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min/10], GPoint(77, 84));
  set_container_image(&time_digits_images[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min%10], GPoint(105, 84));

  if (!clock_is_24h_style()) {
    if (current_time->tm_hour >= 12) {
      set_container_image(&time_format_image, RESOURCE_ID_IMAGE_PM_MODE, GPoint(17, 68));
    } else {
      layer_remove_from_parent(&time_format_image.layer.layer);
      bmp_deinit_container(&time_format_image);
    }

    if (display_hour/10 == 0) {
      layer_remove_from_parent(&time_digits_images[0].layer.layer);
      bmp_deinit_container(&time_digits_images[0]);
    }
  }

}
コード例 #15
0
ファイル: chunk.c プロジェクト: vekexasia/Chunk-Weather-v2.0
static void update_battery(BatteryChargeState charge_state) {
  uint8_t batteryPercent;
  uint8_t img;

  batteryPercent = charge_state.charge_percent;
  
  if(batteryPercent>=90) {
     img = 0;
  }
  else if(batteryPercent>=80) {
     img = 1;
  }
  else if(batteryPercent>=60) {
     img = 2;
  }
  else if(batteryPercent>=40) {
     img = 3;
  }
  else if(batteryPercent>=20) {
     img = 4;
  }
  else {
     img = 5;
  }
  //APP_LOG(APP_LOG_LEVEL_DEBUG, "BATTERY %d %d", batteryPercent, img);
  set_container_image(&battery_image, battery_image_layer, BATTERY_ICONS[img], GPoint(50, 82));
}
コード例 #16
0
static void handle_battery(BatteryChargeState charge_state) {
	if(charge_state.is_charging){
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[0]), true);
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[1]), true);
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[2]), true);
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[3]), true);
		layer_set_hidden(bitmap_layer_get_layer(battery_layer), false);
	}
	else{
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[1]), false);
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[2]), false);
		layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[3]), false);
		layer_set_hidden(bitmap_layer_get_layer(battery_layer), true);
		//Display Battery Level
		if(charge_state.charge_percent == 100){
			layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[0]), false);
			set_container_image(&battery_digits_images[0], battery_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[1], GPoint(2, 2));
			set_container_image(&battery_digits_images[1], battery_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[0], GPoint(15, 2));
			set_container_image(&battery_digits_images[2], battery_digits_layers[2], DATENUM_IMAGE_RESOURCE_IDS[0], GPoint(28, 2));	
			set_container_image(&battery_digits_images[3], battery_digits_layers[3], RESOURCE_ID_IMAGE_PERCENT, GPoint(41, 2));
		}
		else
		{
			layer_set_hidden(bitmap_layer_get_layer(battery_digits_layers[0]), true);
			set_container_image(&battery_digits_images[1], battery_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[charge_state.charge_percent/10], GPoint(2, 2));
			set_container_image(&battery_digits_images[2], battery_digits_layers[2], DATENUM_IMAGE_RESOURCE_IDS[charge_state.charge_percent%10], GPoint(15, 2));	
			set_container_image(&battery_digits_images[3], battery_digits_layers[3], RESOURCE_ID_IMAGE_PERCENT, GPoint(28, 2));
		}
	}
}
コード例 #17
0
ファイル: fifty_nine_dub.c プロジェクト: kodek/Fifty-Nine-Dub
static void update_year (int years_since_1900) {
  int display_year = years_since_1900 + 1900;
  int year_digit_thousand = display_year/1000;
  display_year -= 1000 * year_digit_thousand;

  int year_digit_hundred = display_year / 100;
  display_year -= 100 * year_digit_hundred;

  int year_digit_ten = display_year / 10;
  display_year -= 10 * year_digit_ten;

  int year_digit_one = display_year;
  set_container_image(&year_digits_images[0], year_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[year_digit_thousand], GPoint(87, 37));
  set_container_image(&year_digits_images[1], year_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[year_digit_hundred], GPoint(99, 37));
  set_container_image(&year_digits_images[2], year_digits_layers[2], DATENUM_IMAGE_RESOURCE_IDS[year_digit_ten], GPoint(111, 37));
  set_container_image(&year_digits_images[3], year_digits_layers[3], DATENUM_IMAGE_RESOURCE_IDS[year_digit_one], GPoint(123, 37));

}
コード例 #18
0
ファイル: main.c プロジェクト: jsternfield/pebbleface-taller
static void handle_tick(struct tm *tick_time, TimeUnits units_changed)
{
    if (units_changed & DAY_UNIT)
    {
        // Get the day and convert text uppercase
        strftime(mDayText, mDayTextSize, "%a %m/%d", tick_time);
        for (int i = 0; mDayText[i] != 0; i++)
        {
            if (mDayText[i] >= 'a' && mDayText[i] <= 'z')
            {
                mDayText[i] -= 0x20;
            }
        }
    }

    if (units_changed & HOUR_UNIT)
    {
        unsigned short display_hour = get_display_hour(tick_time->tm_hour);

        GPoint hourPoint = mBigHour ? GPoint(DIGIT_X1, DIGIT_Y) : GPoint(DIGIT_X1_S-SCREEN_W2-BHOFFSET, DIGIT_Y);;
        set_container_image(&time_digits_images[0], time_digits_layers[0], display_hour/10, hourPoint, mBigHour);
        hourPoint.x = mBigHour ? DIGIT_X2 : DIGIT_X2_S-SCREEN_W2-BHOFFSET;
        set_container_image(&time_digits_images[1], time_digits_layers[1], display_hour%10, hourPoint, mBigHour);

        if (!clock_is_24h_style())
        {
            if (display_hour / 10 == 0)
            {
                layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), true);
            }
            else
            {
                layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), false);
            }
        }
    }
    if (units_changed & MINUTE_UNIT)
    {
        GPoint minutePoint = mBigHour ? GPoint(DIGIT_X1_S, DIGIT_Y) : GPoint(SCREEN_W2+DIGIT_X1-BHOFFSET, DIGIT_Y);
        set_container_image(&time_digits_images[2], time_digits_layers[2], tick_time->tm_min/10, minutePoint, !mBigHour);
        minutePoint.x = mBigHour ? DIGIT_X2_S : SCREEN_W2+DIGIT_X2-BHOFFSET;
        set_container_image(&time_digits_images[3], time_digits_layers[3], tick_time->tm_min%10, minutePoint, !mBigHour);
    }	
}
コード例 #19
0
static void update_hours(struct tm *tick_time) {
	
   if (appStarted && hourlyvibe) {
    //vibe!
    vibes_short_pulse();
  } 
   unsigned short display_hour = get_display_hour(tick_time->tm_hour);

  set_container_image(&time_digits_images[0], time_digits_layers[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(56, 130));
  set_container_image(&time_digits_images[1], time_digits_layers[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(56, 93));
	
  if (!clock_is_24h_style() ) { 
   if (display_hour/10 == 0) {
      layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), true);
    }
    else {
      layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), false);
    }
  }
}
コード例 #20
0
ファイル: diagonal.c プロジェクト: dotar/Pebble-Diagonal
void update_display(PblTm *current_time) {

	
	unsigned short display_hour = get_display_hour(current_time->tm_hour);

  // TODO: Remove leading zero?

  set_container_image(&time_digits_images[0], IMAGE_RESOURCE_IDS[display_hour/10],         GPoint(-5, 91));
  set_container_image(&time_digits_images[1], IMAGE_RESOURCE_IDS[display_hour%10],         GPoint(18, 68));
  set_container_image(&time_colon_image,      RESOURCE_ID_IMAGE_COLON,                     GPoint(40,42));
  set_container_image(&time_digits_images[2], IMAGE_RESOURCE_IDS[current_time->tm_min/10], GPoint(54, 34));
  set_container_image(&time_digits_images[3], IMAGE_RESOURCE_IDS[current_time->tm_min%10], GPoint(77, 11));
	
  if (!clock_is_24h_style()) {
    if (display_hour/10 == 0) {
      layer_remove_from_parent(&time_digits_images[0].layer.layer);
      rotbmp_deinit_container(&time_digits_images[0]);
    }
  }

}
コード例 #21
0
ファイル: illusion.c プロジェクト: GOROman/illusion
void set_time(unsigned short display_hour, unsigned short display_min) {
  // hours
  set_container_image(
    &time_digits_images[0],
    RESOURCE_ID_NUMERAL[display_hour/10],
    GPoint(XS[0], YS[0]));
  set_container_image(
    &time_digits_images[1],
    RESOURCE_ID_NUMERAL[display_hour%10],
    GPoint(XS[1], YS[0]));

  // minutes
  set_container_image(
    &time_digits_images[2],
    RESOURCE_ID_NUMERAL[display_min/10],
    GPoint(XS[0], YS[1]));
  set_container_image(
    &time_digits_images[3],
    RESOURCE_ID_NUMERAL[display_min%10],
    GPoint(XS[1], YS[1]));
}
コード例 #22
0
void failed(int32_t cookie, int http_status, void* context) {
	
	if((cookie == 0 || cookie == WEATHER_HTTP_COOKIE) && !temperature_set) {
		set_container_image(&weather_images[0], WEATHER_IMAGE_RESOURCE_IDS[10], GPoint(12, 5));
		text_layer_set_text(&text_temperature_layer, "---°");
	}
	
	//link_monitor_handle_failure(http_status);
	
	//Re-request the location and subsequently weather on next minute tick
	//located = false;
}
コード例 #23
0
ファイル: grey_test1_0.c プロジェクト: xretsim/grey_test_new
void handle_init(AppContextRef ctx) {
    (void)ctx;
    _storedctx = ctx;

    window_init(&_window, "Window Name");
    window_stack_push(&_window, true /* Animated */);
    window_set_fullscreen(&_window, true);

    resource_init_current_app(&APP_RESOURCES);
    
     window_set_click_config_provider(&_window, (ClickConfigProvider) main_config_provider);
    
    set_container_image(&_greyBmp[1], RESOURCE_ID_GIRLB_1, GPoint(0,0), &_window.layer);
    layer_set_hidden(&_greyBmp[1].layer.layer, true);

    set_container_image(&_greyBmp[2], RESOURCE_ID_GIRLB_2, GPoint(0,0), &_window.layer);
    layer_set_hidden(&_greyBmp[2].layer.layer, true);

    set_container_image(&_greyBmp[0], RESOURCE_ID_GIRLB_BASE, GPoint(0,0), &_window.layer);
    
    //_timer_handle = app_timer_send_event(ctx, _base_interval /* milliseconds */, 0);
}
コード例 #24
0
ファイル: main.c プロジェクト: ShaBP/91DubPro
/*
static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
  switch (key) {
    case BLINK_KEY:
      settings.Blink = new_tuple->value->uint8;
      tick_timer_service_unsubscribe();
      if(settings.Blink) {
        tick_timer_service_subscribe(SECOND_UNIT, handle_tick);
      }
      else {
        tick_timer_service_subscribe(MINUTE_UNIT, handle_tick);
      }
      break;
    case INVERT_KEY:
      settings.Invert = new_tuple->value->uint8;
      change_background();
      break;
    case BLUETOOTHVIBE_KEY:
      settings.BluetoothVibe = new_tuple->value->uint8;
      break;      
    case HOURLYVIBE_KEY:
      settings.HourlyVibe = new_tuple->value->uint8;
      break;
    case BRANDING_MASK_KEY:
      settings.BrandingMask = new_tuple->value->uint8;
      layer_set_hidden(bitmap_layer_get_layer(branding_mask_layer), !settings.BrandingMask);
      break;
  }
}
*/
static void set_container_image(GBitmap **bmp_image, BitmapLayer *bmp_layer, const int resource_id, GPoint origin) {
  GBitmap *old_image = *bmp_image;
  *bmp_image = gbitmap_create_with_resource(resource_id);
  GRect frame = (GRect) {
    .origin = origin,
    .size = (*bmp_image)->bounds.size
  };
  bitmap_layer_set_bitmap(bmp_layer, *bmp_image);
  layer_set_frame(bitmap_layer_get_layer(bmp_layer), frame);
  if (old_image != NULL) {
	gbitmap_destroy(old_image);
	old_image = NULL;
  }
}

static void update_battery(BatteryChargeState charge_state) {

  batteryPercent = charge_state.charge_percent;

  if(batteryPercent==100) {
	change_battery_icon(false);
	layer_set_hidden(bitmap_layer_get_layer(battery_layer), false);
    for (int i = 0; i < TOTAL_BATTERY_PERCENT_DIGITS; ++i) {
      layer_set_hidden(bitmap_layer_get_layer(battery_percent_layers[i]), true);
    }  
    return;
  }

  layer_set_hidden(bitmap_layer_get_layer(battery_layer), charge_state.is_charging);
  change_battery_icon(charge_state.is_charging);
    
  for (int i = 0; i < TOTAL_BATTERY_PERCENT_DIGITS; ++i) {
    layer_set_hidden(bitmap_layer_get_layer(battery_percent_layers[i]), false);
  }  
  set_container_image(&battery_percent_image[0], battery_percent_layers[0], TINY_IMAGE_RESOURCE_IDS[charge_state.charge_percent/10], GPoint(89, 43));
  set_container_image(&battery_percent_image[1], battery_percent_layers[1], TINY_IMAGE_RESOURCE_IDS[charge_state.charge_percent%10], GPoint(95, 43));
  set_container_image(&battery_percent_image[2], battery_percent_layers[2], TINY_IMAGE_RESOURCE_IDS[10], GPoint(101, 43));
 
}
コード例 #25
0
ファイル: rorschach.c プロジェクト: trevorpgit/Rorschach
void update_display(PblTm *current_time) {
  unsigned short display_hour = get_display_hour(current_time->tm_hour);

  int h1 = display_hour/10;
  set_container_image(&time_digits_images[0], NUMBER_IMAGE_RESOURCE_IDS[h1][0],NUMBER_IMAGE_RESOURCE_IDS[h1][1], GPoint(73 + offset[h1][0], 32 + offset[h1][1]), h1, 1);
  set_container_image(&mirror_time_digits_images[0], MIRROR_NUMBER_IMAGE_RESOURCE_IDS[h1][0],MIRROR_NUMBER_IMAGE_RESOURCE_IDS[h1][1], GPoint(42 + moffset[h1][0], 32 + moffset[h1][1]), h1, 2);

  int h2 = display_hour%10;
  set_container_image(&time_digits_images[1], NUMBER_IMAGE_RESOURCE_IDS[h2][0],NUMBER_IMAGE_RESOURCE_IDS[h2][1], GPoint(104 + offset[h2][0], 32 + offset[h2][1]), h2, 2);
  set_container_image(&mirror_time_digits_images[1], MIRROR_NUMBER_IMAGE_RESOURCE_IDS[h2][0],MIRROR_NUMBER_IMAGE_RESOURCE_IDS[h2][1], GPoint(11 + moffset[h2][0], 32 + moffset[h2][1]), h2, 1);

  int m1 = current_time->tm_min/10;
  set_container_image(&time_digits_images[2], NUMBER_IMAGE_RESOURCE_IDS[m1][0],NUMBER_IMAGE_RESOURCE_IDS[m1][1], GPoint(11 + offset[m1][0], 85 + offset[m1][1]), m1, 1);
  set_container_image(&mirror_time_digits_images[2], MIRROR_NUMBER_IMAGE_RESOURCE_IDS[m1][0],MIRROR_NUMBER_IMAGE_RESOURCE_IDS[m1][1], GPoint(104 + moffset[m1][0], 85 + moffset[m1][1]), m1, 2);

  int m2 = current_time->tm_min%10;
  set_container_image(&time_digits_images[3], NUMBER_IMAGE_RESOURCE_IDS[m2][0],NUMBER_IMAGE_RESOURCE_IDS[m2][1], GPoint(42 + offset[m2][0], 85 + offset[m2][1]), m2, 2);
  set_container_image(&mirror_time_digits_images[3], MIRROR_NUMBER_IMAGE_RESOURCE_IDS[m2][0],MIRROR_NUMBER_IMAGE_RESOURCE_IDS[m2][1], GPoint(73 + moffset[m2][0], 85 + moffset[m2][1]), m2, 1);
}
コード例 #26
0
ファイル: LCARS.c プロジェクト: KhasMek/LCARS
void update_display(PblTm *current_time) {
    // TODO: Only update changed values?
    
    set_container_image(&day_name_image, DAY_NAME_IMAGE_RESOURCE_IDS[current_time->tm_wday], GPoint(79, 3));
    
    // TODO: Remove leading zero?
    set_container_image(&date_digits_images[0], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_mday/10], GPoint(111, 3));
    set_container_image(&date_digits_images[1], DATENUM_IMAGE_RESOURCE_IDS[current_time->tm_mday%10], GPoint(118, 3));
    
    
    unsigned short display_hour = get_display_hour(current_time->tm_hour);
    
    // TODO: Remove leading zero?
    set_container_image(&time_digits_images[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10], GPoint(38, 30));
    set_container_image(&time_digits_images[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10], GPoint(62, 30));
    
    set_container_image(&time_digits_images[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min/10], GPoint(86, 30));
    set_container_image(&time_digits_images[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min%10], GPoint(110, 30));
    
    unsigned int unix_time;
    /* Convert time to seconds since epoch. */
    unix_time = ((0-TIME_ZONE_OFFSET)*3600) + /* time zone offset */
    + current_time->tm_sec /* start with seconds */
    + current_time->tm_min*60 /* add minutes */
    + current_time->tm_hour*3600 /* add hours */
    + current_time->tm_yday*86400 /* add days */
    + (current_time->tm_year-70)*31536000 /* add years since 1970 */
    + ((current_time->tm_year-69)/4)*86400 /* add a day after leap years, starting in 1973 */
    - ((current_time->tm_year-1)/100)*86400 /* remove a leap day every 100 years, starting in 2001 */
    + ((current_time->tm_year+299)/400)*86400; /* add a leap day back every 400 years, starting in 2001*/
    
    /* Draw each digit in the correct location. */
    for(int i=0; i<TOTAL_DIGITS; i++) {
        
        /* int digit_colum = i % TOTAL_COLUMNS; */
        int denominator = my_pow(10,i); /* The loop starts at the most significant digit and goes down from there. */
        int digit_value = (int)unix_time/(1000000000 / denominator); /* This gives the value for the current digit. (Casting should give us the floor of the value.) */
        unix_time = unix_time % (1000000000 / denominator); /* This subtracts the value for the current digit so that it doesn't interfere with the next iteration of the loop. */
        set_container_image(&digits[i], BLOCK_NUMBER[digit_value], GPoint(40 + (i * 9), 90)); /* Now we set this digit. */
    }
    
    
}
コード例 #27
0
void update_display(PblTm *current_time) {
    unsigned int unix_time;
    /* Convert time to seconds since epoch. */
    unix_time = ((0-TIME_ZONE_OFFSET)*3600) + /* time zone offset */ 
              + current_time->tm_sec /* start with seconds */
              + current_time->tm_min*60 /* add minutes */
              + current_time->tm_hour*3600 /* add hours */
              + current_time->tm_yday*86400 /* add days */
              + (current_time->tm_year-70)*31536000 /* add years since 1970 */
              + ((current_time->tm_year-69)/4)*86400 /* add a day after leap years, starting in 1973 */
              - ((current_time->tm_year-1)/100)*86400 /* remove a leap day every 100 years, starting in 2001 */
              + ((current_time->tm_year+299)/400)*86400; /* add a leap day back every 400 years, starting in 2001*/

    /* Draw each digit in the correct location. */
    for(int i=0; i<TOTAL_DIGITS; i++) {
        int digit_row = (int)(i / TOTAL_COLUMNS);
        int digit_column = (i > (TOTAL_DIGITS - 3)) ? (3 - (TOTAL_DIGITS - i)) : (i % TOTAL_COLUMNS); /* This centers the bottom row digits. Use the next line to have them left aligned. */
        /* int digit_colum = i % TOTAL_COLUMNS; */
        int denominator = my_pow(10,i); /* The loop starts at the most significant digit and goes down from there. */
        int digit_value = (int)unix_time/(1000000000 / denominator); /* This gives the value for the current digit. (Casting should give us the floor of the value.) */
        unix_time = unix_time % (1000000000 / denominator); /* This subtracts the value for the current digit so that it doesn't interfere with the next iteration of the loop. */
        set_container_image(&digits[i], BLOCK_NUMBER[digit_value], ROW[digit_row], COLUMN[digit_column]); /* Now we set this digit. */
    }
}
コード例 #28
0
ファイル: main.c プロジェクト: n3v3r001/n3v3rsbigone
static void update_minutes(struct tm *tick_time) {
  set_container_image(&time_digits_images[2], time_digits_layers[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[tick_time->tm_min/10], GPoint(85, 14)); //n3v3r original 87
  set_container_image(&time_digits_images[3], time_digits_layers[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[tick_time->tm_min%10], GPoint(117, 14)); //n3v3r original 115
}
コード例 #29
0
ファイル: main.c プロジェクト: n3v3r001/n3v3rsbigone
static void update_days(struct tm *tick_time) {
  set_container_image(&day_name_image, day_name_layer, DAY_NAME_IMAGE_RESOURCE_IDS[tick_time->tm_wday], GPoint(68, 15)); //n3v3r default 66
  set_container_image(&date_digits_images[0], date_digits_layers[0], DATENUM_IMAGE_RESOURCE_IDS[tick_time->tm_mday/10], GPoint(68,145)); //n3v3r default 66
  set_container_image(&date_digits_images[1], date_digits_layers[1], DATENUM_IMAGE_RESOURCE_IDS[tick_time->tm_mday%10], GPoint(68, 155)); //n3v3r default 66
}
コード例 #30
0
ファイル: 91_Dub.c プロジェクト: TCChat/91-DUB-2.0-Weather
static void update_display(struct tm *current_time, TimeUnits units_changed){
  if(blink == 0){
    if(current_time->tm_sec % 2 == 0){
      layer_set_hidden(bitmap_layer_get_layer(dots_layer), false);
    } else {
      layer_set_hidden(bitmap_layer_get_layer(dots_layer), true);
    }
  }
	
  if(battery_state_service_peek().is_charging){
    if(current_time->tm_sec % 2 == 0){
      layer_set_hidden(bitmap_layer_get_layer(meter_bar_layer), false);
      is_hidden = false;
    } else {
      layer_set_hidden(bitmap_layer_get_layer(meter_bar_layer), true);
      is_hidden = true;
      }
  } else {
    if(is_hidden){
      layer_set_hidden(bitmap_layer_get_layer(meter_bar_layer), false);
      is_hidden = false;
    }
  }

  if (units_changed & MINUTE_UNIT) {
    set_container_image(&time_digits_images[2], time_digits_layers[2], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min/10]);
    set_container_image(&time_digits_images[3], time_digits_layers[3], BIG_DIGIT_IMAGE_RESOURCE_IDS[current_time->tm_min%10]);
	  
    if (units_changed & HOUR_UNIT) {
      // TODO implement hourly display changes
      unsigned short display_hour = get_display_hour(current_time->tm_hour);
	
      set_container_image(&time_digits_images[0], time_digits_layers[0], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour/10]);
      set_container_image(&time_digits_images[1], time_digits_layers[1], BIG_DIGIT_IMAGE_RESOURCE_IDS[display_hour%10]);
			
      if(display_hour < 10 && zeroes == 0) {
        layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), true);
      } else {
	    layer_set_hidden(bitmap_layer_get_layer(time_digits_layers[0]), false);
      }
		
	  if(!clock_is_24h_style()){
		  strftime(text_buffer, sizeof(text_buffer), "%p", current_time);
		  text_layer_set_text(time_format_layer, text_buffer);
	  }	else {
		  text_layer_set_text(time_format_layer, "24H");
	  }

		if (units_changed & DAY_UNIT) {
			char *formating0 = "%b";
			char *formating1 = "%e";
			if(date == 0){
				formating0 ="%b";
				if(zeroes == 0){
					formating1 = "%e";
				} else {
					formating1 = "%d";
				}
			} else {
				if(zeroes == 0){
					formating0 = "%e";
				} else {
					formating0 = "%d";
				}
				formating1 = "%b";
			}

			strftime(text_buffer0, sizeof(text_buffer0), formating0, current_time);
			text_layer_set_text(date_layer[0], text_buffer0);
			strftime(text_buffer1, sizeof(text_buffer1), formating1, current_time);
			text_layer_set_text(date_layer[1], text_buffer1);

			GRect frame = (GRect){{0, 15}, {15, 2}};
			if(square == 1){
				frame = (GRect){{0, 3}, {15, 13}};
			}

			int offset[] = {0, 16, 33, 48, 67, 82, 94};
			int width[] = {15, 17, 14, 19, 14, 12, 15};

			frame.origin.x = offset[current_time->tm_wday];
			frame.size.w = width[current_time->tm_wday];
			if(square == 0){
				frame.origin.x = frame.origin.x + 1;
				frame.size.w = frame.size.w - 2;
			}
			layer_set_frame(inverter_layer_get_layer(day_inv_layer), frame);

			if(units_changed & MONTH_UNIT){
				//Showing of month name is already solved during the day show
			}
		}
    }
  }
}