mirror of
https://git.wetfence.xyz/RandyTheSilly/Civic-Segments.git
synced 2026-09-05 01:59:26 -04:00
Adjust radial bar width; do not load CHEF icons on Gabbro
This commit is contained in:
+16
-4
@@ -67,28 +67,40 @@
|
||||
"memoryFormat": "Smallest",
|
||||
"name": "E",
|
||||
"spaceOptimization": "storage",
|
||||
"type": "bitmap"
|
||||
"type": "bitmap",
|
||||
"targetPlatforms": [
|
||||
"emery"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "F.png",
|
||||
"memoryFormat": "Smallest",
|
||||
"name": "F",
|
||||
"spaceOptimization": "storage",
|
||||
"type": "bitmap"
|
||||
"type": "bitmap",
|
||||
"targetPlatforms": [
|
||||
"emery"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "C.png",
|
||||
"memoryFormat": "Smallest",
|
||||
"name": "C",
|
||||
"spaceOptimization": "storage",
|
||||
"type": "bitmap"
|
||||
"type": "bitmap",
|
||||
"targetPlatforms": [
|
||||
"emery"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "H.png",
|
||||
"memoryFormat": "Smallest",
|
||||
"name": "H",
|
||||
"spaceOptimization": "storage",
|
||||
"type": "bitmap"
|
||||
"type": "bitmap",
|
||||
"targetPlatforms": [
|
||||
"emery"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "0.png",
|
||||
|
||||
+46
-27
@@ -17,20 +17,20 @@ static Layer *s_fuel_mg_layer;
|
||||
static Layer *s_fuel_layer;
|
||||
static const uint8_t s_x_r = (PBL_DISPLAY_WIDTH / 2) + 2;
|
||||
static const uint8_t s_x_l = (s_x_r - 2 * (69 / 2)) - 5;
|
||||
#if PBL_DISPLAY_WIDTH == 200
|
||||
#if PBL_RECT
|
||||
static const GRect s_digit_grects[4] = {GRect(s_x_l, 2, 69, 110), GRect(s_x_r, 2, 69, 110), GRect(s_x_l, 116, 69, 110), GRect(s_x_r, 116, 69, 110)};
|
||||
#else
|
||||
static const GRect s_digit_grects[4] = {GRect(s_x_l, 18, 69, 110), GRect(s_x_r, 18, 69, 110), GRect(s_x_l, 132, 69, 110), GRect(s_x_r, 132, 69, 110)};
|
||||
#endif
|
||||
static const uint8_t s_temp_guage_x_pos = 6;
|
||||
static const uint16_t s_fuel_guage_x_pos = PBL_DISPLAY_WIDTH - 23;
|
||||
|
||||
// settings statics
|
||||
static ClaySettings settings;
|
||||
static GColor s_applied_digits_mg = GColorDarkGray;
|
||||
static GColor s_applied_digits_mg_mini = GColorDarkGray;
|
||||
#if PBL_RECT
|
||||
static GColor s_applied_e_f = GColorWhite;
|
||||
static GColor s_applied_c_h = GColorWhite;
|
||||
#endif
|
||||
static GColor s_applied_hour = GColorWhite;
|
||||
static GColor s_applied_minute = GColorWhite;
|
||||
static GColor s_applied_minute_mini = GColorWhite;
|
||||
@@ -41,10 +41,12 @@ static GBitmap *s_minute_bitmaps[10];
|
||||
static GBitmap *s_minute_bitmaps_mini[10];
|
||||
static GBitmap *s_digit_mg_super8;
|
||||
static GBitmap *s_digit_mg_super8_mini;
|
||||
#if PBL_RECT
|
||||
static GBitmap *s_c_icon;
|
||||
static GBitmap *s_h_icon;
|
||||
static GBitmap *s_e_icon;
|
||||
static GBitmap *s_f_icon;
|
||||
#endif
|
||||
|
||||
// tracking statics
|
||||
static bool s_peek_active = false;
|
||||
@@ -62,10 +64,13 @@ static int8_t s_temp_level;
|
||||
static const uint8_t s_bar_width = 17;
|
||||
static const uint8_t s_bar_height = 8;
|
||||
static const uint8_t s_bar_spacing = s_bar_height + 1;
|
||||
static const uint8_t s_temp_guage_x_pos = 6;
|
||||
static const uint16_t s_fuel_guage_x_pos = PBL_DISPLAY_WIDTH - 23;
|
||||
#else
|
||||
static const uint8_t s_bar_width = 24;
|
||||
static const uint8_t s_bar_width = 12;
|
||||
static const uint16_t s_bar_height = DEG_TO_TRIGANGLE(3);
|
||||
static const uint16_t s_bar_spacing = DEG_TO_TRIGANGLE(4); // height (3) + 1
|
||||
static const uint8_t s_bar_base_inset = 5;
|
||||
static const uint8_t s_bar_deg_range = 40;
|
||||
static const uint16_t s_bar_fuel_deg_top = 90 - s_bar_deg_range;
|
||||
static const uint16_t s_bar_fuel_deg_bottom = 90 + s_bar_deg_range;
|
||||
@@ -79,6 +84,7 @@ static const uint32_t s_digit_resource_ids[10] = {RESOURCE_ID_0, RESOURCE_ID_1,
|
||||
static const uint32_t s_digit_mini_resource_ids[10] = {RESOURCE_ID_0_M, RESOURCE_ID_1_M, RESOURCE_ID_2_M, RESOURCE_ID_3_M, RESOURCE_ID_4_M,
|
||||
RESOURCE_ID_5_M, RESOURCE_ID_6_M, RESOURCE_ID_7_M, RESOURCE_ID_8_M, RESOURCE_ID_9_M};
|
||||
|
||||
#if PBL_RECT
|
||||
static void toggle_fuel_warning_state(bool enable_warning, bool force) {
|
||||
if (!force && (enable_warning == s_fuel_is_warning)) {
|
||||
return;
|
||||
@@ -94,7 +100,11 @@ static void toggle_fuel_warning_state(bool enable_warning, bool force) {
|
||||
s_applied_e_f = dst;
|
||||
s_fuel_is_warning = enable_warning;
|
||||
}
|
||||
#else
|
||||
static void toggle_fuel_warning_state(bool enable_warning, bool force) {} // TODO
|
||||
#endif
|
||||
|
||||
#if PBL_RECT
|
||||
static void toggle_temp_warning_state(bool enable_warning, bool force) {
|
||||
if (!force && (enable_warning == s_temp_is_warning)) {
|
||||
return;
|
||||
@@ -110,6 +120,9 @@ static void toggle_temp_warning_state(bool enable_warning, bool force) {
|
||||
s_applied_c_h = dst;
|
||||
s_temp_is_warning = enable_warning;
|
||||
}
|
||||
#else
|
||||
static void toggle_temp_warning_state(bool enable_warning, bool force) {} // TODO
|
||||
#endif
|
||||
|
||||
static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) {
|
||||
if (applied->argb == new_color.argb)
|
||||
@@ -159,7 +172,7 @@ static void temp_update_proc(Layer *layer, GContext *ctx) {
|
||||
static const uint8_t half_gap = (s_bar_spacing - s_bar_height) / 2;
|
||||
int32_t bar_bottom = DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom) + half_gap;
|
||||
for (uint8_t i = 0; i < bar_count; ++i) {
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(7)), GOvalScaleModeFitCircle, s_bar_width - 2, bar_bottom, bar_bottom + s_bar_height);
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset + 2)), GOvalScaleModeFitCircle, s_bar_width - 2, bar_bottom, bar_bottom + s_bar_height);
|
||||
bar_bottom += s_bar_spacing;
|
||||
}
|
||||
}
|
||||
@@ -183,7 +196,7 @@ static void fuel_update_proc(Layer *layer, GContext *ctx) {
|
||||
static const uint8_t half_gap = (s_bar_spacing - s_bar_height) / 2;
|
||||
int32_t bar_bottom = DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom) - half_gap;
|
||||
for (uint8_t i = 0; i < s_batt_level; ++i) {
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(7)), GOvalScaleModeFitCircle, s_bar_width - 2, bar_bottom - s_bar_height, bar_bottom);
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset + 2)), GOvalScaleModeFitCircle, s_bar_width - 2, bar_bottom - s_bar_height, bar_bottom);
|
||||
bar_bottom -= s_bar_spacing;
|
||||
}
|
||||
}
|
||||
@@ -215,17 +228,17 @@ static void temp_fuel_mg_update_proc_helper(Layer *layer, GContext *ctx, bool is
|
||||
graphics_context_set_fill_color(ctx, settings.ColorBarsMG);
|
||||
graphics_context_set_antialiased(ctx, false);
|
||||
if (isFuel) {
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(5)), GOvalScaleModeFitCircle, s_bar_width + 2, DEG_TO_TRIGANGLE(s_bar_fuel_deg_top), DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom));
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset)), GOvalScaleModeFitCircle, s_bar_width + 2, DEG_TO_TRIGANGLE(s_bar_fuel_deg_top), DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom));
|
||||
// graphics_context_set_fill_color(ctx, settings.ColorBarsCool);
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(7)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_fuel_deg_top + 1), DEG_TO_TRIGANGLE(s_bar_fuel_deg_top + 2));
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset+2)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_fuel_deg_top + 1), DEG_TO_TRIGANGLE(s_bar_fuel_deg_top + 2));
|
||||
// graphics_context_set_fill_color(ctx, settings.ColorBarsHot);
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(7)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom - 2), DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom - 1));
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset+2)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom - 2), DEG_TO_TRIGANGLE(s_bar_fuel_deg_bottom - 1));
|
||||
} else {
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(5)), GOvalScaleModeFitCircle, s_bar_width + 2, DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom), DEG_TO_TRIGANGLE(s_bar_temp_deg_top));
|
||||
graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset)), GOvalScaleModeFitCircle, s_bar_width + 2, DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom), DEG_TO_TRIGANGLE(s_bar_temp_deg_top));
|
||||
// graphics_context_set_fill_color(ctx, settings.ColorBarsCool);
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(7)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom + 1), DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom + 2));
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset+2)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom + 1), DEG_TO_TRIGANGLE(s_bar_temp_deg_bottom + 2));
|
||||
// graphics_context_set_fill_color(ctx, settings.ColorBarsHot);
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(7)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_temp_deg_top - 2), DEG_TO_TRIGANGLE(s_bar_temp_deg_top - 1));
|
||||
// graphics_fill_radial(ctx, grect_inset(bounds, GEdgeInsets(s_bar_base_inset+2)), GOvalScaleModeFitCircle, s_bar_width - 2, DEG_TO_TRIGANGLE(s_bar_temp_deg_top - 2), DEG_TO_TRIGANGLE(s_bar_temp_deg_top - 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -563,16 +576,11 @@ static void apply_settings() {
|
||||
static void main_window_load() {
|
||||
s_window_layer = window_get_root_layer(s_main_window);
|
||||
|
||||
#if PBL_RECT
|
||||
s_temp_mg_layer = layer_create(GRect(s_temp_guage_x_pos - 1, 21, s_bar_width + 2, PBL_DISPLAY_HEIGHT - 43));
|
||||
s_fuel_mg_layer = layer_create(GRect(s_fuel_guage_x_pos - 1, 21, s_bar_width + 2, PBL_DISPLAY_HEIGHT - 43));
|
||||
#else
|
||||
s_temp_mg_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
||||
s_fuel_mg_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
||||
#endif
|
||||
layer_set_update_proc(s_temp_mg_layer, temp_mg_update_proc);
|
||||
layer_set_update_proc(s_fuel_mg_layer, fuel_mg_update_proc);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
layer_add_child(s_window_layer, bitmap_layer_get_layer(s_digit_fg_layers[i]));
|
||||
}
|
||||
|
||||
#if PBL_RECT
|
||||
s_c_layer = bitmap_layer_create(GRect(s_temp_guage_x_pos, PBL_DISPLAY_HEIGHT - 18, 17, 15));
|
||||
s_h_layer = bitmap_layer_create(GRect(s_temp_guage_x_pos, 3, 17, 14));
|
||||
s_e_layer = bitmap_layer_create(GRect(s_fuel_guage_x_pos, PBL_DISPLAY_HEIGHT - 18, 17, 15));
|
||||
@@ -585,20 +593,25 @@ static void main_window_load() {
|
||||
bitmap_layer_set_compositing_mode(s_h_layer, GCompOpSet);
|
||||
bitmap_layer_set_compositing_mode(s_e_layer, GCompOpSet);
|
||||
bitmap_layer_set_compositing_mode(s_f_layer, GCompOpSet);
|
||||
|
||||
apply_settings();
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
layer_add_child(s_window_layer, bitmap_layer_get_layer(s_digit_fg_layers[i]));
|
||||
}
|
||||
layer_add_child(s_window_layer, bitmap_layer_get_layer(s_c_layer));
|
||||
layer_add_child(s_window_layer, bitmap_layer_get_layer(s_h_layer));
|
||||
layer_add_child(s_window_layer, bitmap_layer_get_layer(s_e_layer));
|
||||
layer_add_child(s_window_layer, bitmap_layer_get_layer(s_f_layer));
|
||||
|
||||
s_temp_mg_layer = layer_create(GRect(s_temp_guage_x_pos - 1, 21, s_bar_width + 2, PBL_DISPLAY_HEIGHT - 43));
|
||||
s_fuel_mg_layer = layer_create(GRect(s_fuel_guage_x_pos - 1, 21, s_bar_width + 2, PBL_DISPLAY_HEIGHT - 43));
|
||||
#else
|
||||
s_temp_mg_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
||||
s_fuel_mg_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
||||
#endif
|
||||
layer_set_update_proc(s_temp_mg_layer, temp_mg_update_proc);
|
||||
layer_set_update_proc(s_fuel_mg_layer, fuel_mg_update_proc);
|
||||
layer_add_child(s_window_layer, s_temp_mg_layer);
|
||||
layer_add_child(s_window_layer, s_temp_layer);
|
||||
layer_add_child(s_window_layer, s_fuel_mg_layer);
|
||||
layer_add_child(s_window_layer, s_fuel_layer);
|
||||
|
||||
apply_settings();
|
||||
}
|
||||
|
||||
static void main_window_unload() {
|
||||
@@ -617,10 +630,12 @@ static void main_window_unload() {
|
||||
accel_tap_service_unsubscribe();
|
||||
layer_destroy(s_fuel_mg_layer);
|
||||
layer_destroy(s_temp_mg_layer);
|
||||
#if PBL_RECT
|
||||
bitmap_layer_destroy(s_f_layer);
|
||||
bitmap_layer_destroy(s_e_layer);
|
||||
bitmap_layer_destroy(s_h_layer);
|
||||
bitmap_layer_destroy(s_c_layer);
|
||||
#endif
|
||||
if (s_digit_mg_super8_mini) {
|
||||
gbitmap_destroy(s_digit_mg_super8_mini);
|
||||
}
|
||||
@@ -722,10 +737,12 @@ static void init() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
s_hour_bitmaps[i] = gbitmap_create_with_resource(s_digit_resource_ids[i]);
|
||||
}
|
||||
#if PBL_RECT
|
||||
s_c_icon = gbitmap_create_with_resource(RESOURCE_ID_C);
|
||||
s_h_icon = gbitmap_create_with_resource(RESOURCE_ID_H);
|
||||
s_e_icon = gbitmap_create_with_resource(RESOURCE_ID_E);
|
||||
s_f_icon = gbitmap_create_with_resource(RESOURCE_ID_F);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
s_digit_fg_layers[i] = bitmap_layer_create(s_digit_grects[i]);
|
||||
@@ -763,10 +780,12 @@ static void deinit() {
|
||||
tick_timer_service_unsubscribe();
|
||||
layer_destroy(s_fuel_layer);
|
||||
layer_destroy(s_temp_layer);
|
||||
#if PBL_RECT
|
||||
gbitmap_destroy(s_f_icon);
|
||||
gbitmap_destroy(s_e_icon);
|
||||
gbitmap_destroy(s_h_icon);
|
||||
gbitmap_destroy(s_c_icon);
|
||||
#endif
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
bitmap_layer_destroy(s_digit_fg_layers[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user