Add E/F icons
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
# Civic-Segments
|
# Civic-Segments
|
||||||
|
|
||||||
PT2/PR2 watchface clone of the beautiful 8th gen Honda Civic digital speedometer segmented display.
|
PT2/PR2 watchface clone of the beautiful 8th gen Honda Civic driver display assembly.
|
||||||
|
|||||||
@@ -32,6 +32,20 @@
|
|||||||
],
|
],
|
||||||
"resources": {
|
"resources": {
|
||||||
"media": [
|
"media": [
|
||||||
|
{
|
||||||
|
"file": "E.png",
|
||||||
|
"memoryFormat": "Smallest",
|
||||||
|
"name": "E",
|
||||||
|
"spaceOptimization": "storage",
|
||||||
|
"type": "bitmap"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "F.png",
|
||||||
|
"memoryFormat": "Smallest",
|
||||||
|
"name": "F",
|
||||||
|
"spaceOptimization": "storage",
|
||||||
|
"type": "bitmap"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"file": "0.png",
|
"file": "0.png",
|
||||||
"memoryFormat": "Smallest",
|
"memoryFormat": "Smallest",
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 112 B |
Binary file not shown.
|
After Width: | Height: | Size: 107 B |
+29
-10
@@ -1,10 +1,13 @@
|
|||||||
#include "palette_manip.h"
|
#include "palette_manip.h"
|
||||||
|
#include "src/resource_ids.auto.h"
|
||||||
#include <pebble.h>
|
#include <pebble.h>
|
||||||
|
|
||||||
// window statics
|
// window statics
|
||||||
static Window *s_main_window;
|
static Window *s_main_window;
|
||||||
static BitmapLayer *s_time_mg_layers[4];
|
static BitmapLayer *s_time_mg_layers[4];
|
||||||
static BitmapLayer *s_time_fg_layers[4];
|
static BitmapLayer *s_time_fg_layers[4];
|
||||||
|
static BitmapLayer *s_e_layer;
|
||||||
|
static BitmapLayer *s_f_layer;
|
||||||
static const uint8_t s_x_r = (PBL_DISPLAY_WIDTH / 2) + 2;
|
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;
|
static const uint8_t s_x_l = (s_x_r - 2 * (69 / 2)) - 5;
|
||||||
#if PBL_DISPLAY_HEIGHT == 260
|
#if PBL_DISPLAY_HEIGHT == 260
|
||||||
@@ -16,17 +19,16 @@ static const GRect s_time_grects[4] = {GRect(s_x_l, 2, 69, 110), GRect(s_x_r, 2,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// persist statics&defines
|
// persist statics&defines
|
||||||
static GColor8 s_led_color;
|
#define storage_key_show_time_mg 0
|
||||||
static GColor8 s_bg_color;
|
#define storage_key_led_color 1
|
||||||
static GColor8 s_mg_color;
|
#define storage_key_bg_color 2
|
||||||
static GColor8 s_fg_color;
|
#define storage_key_mg_color 3
|
||||||
#define storage_key_led_color 0
|
#define storage_key_fg_color 4
|
||||||
#define storage_key_bg_color 1
|
|
||||||
#define storage_key_mg_color 2
|
|
||||||
#define storage_key_fg_color 3
|
|
||||||
|
|
||||||
// font
|
// bitmaps
|
||||||
static GBitmap *s_font_bitmaps[10];
|
static GBitmap *s_font_bitmaps[10];
|
||||||
|
static GBitmap *s_e_icon;
|
||||||
|
static GBitmap *s_f_icon;
|
||||||
|
|
||||||
static void main_window_load() {
|
static void main_window_load() {
|
||||||
Layer *window_layer = window_get_root_layer(s_main_window);
|
Layer *window_layer = window_get_root_layer(s_main_window);
|
||||||
@@ -51,18 +53,31 @@ static void main_window_load() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s_e_layer = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH - 23, PBL_DISPLAY_HEIGHT - 17, 17, 15));
|
||||||
|
s_f_layer = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH - 23, 2, 17, 13));
|
||||||
|
bitmap_layer_set_bitmap(s_e_layer, s_e_icon);
|
||||||
|
bitmap_layer_set_bitmap(s_f_layer, s_f_icon);
|
||||||
|
bitmap_layer_set_compositing_mode(s_e_layer, GCompOpSet);
|
||||||
|
bitmap_layer_set_compositing_mode(s_f_layer, GCompOpSet);
|
||||||
|
|
||||||
if (persist_exists(storage_key_fg_color)) {
|
if (persist_exists(storage_key_fg_color)) {
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_font_bitmaps[i], NULL);
|
replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_font_bitmaps[i], NULL);
|
||||||
}
|
}
|
||||||
|
replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_e_icon, NULL);
|
||||||
|
replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_e_icon, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
layer_add_child(window_layer, bitmap_layer_get_layer(s_time_fg_layers[i]));
|
layer_add_child(window_layer, bitmap_layer_get_layer(s_time_fg_layers[i]));
|
||||||
}
|
}
|
||||||
|
layer_add_child(window_layer, bitmap_layer_get_layer(s_e_layer));
|
||||||
|
layer_add_child(window_layer, bitmap_layer_get_layer(s_f_layer));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_window_unload() {
|
static void main_window_unload() {
|
||||||
|
bitmap_layer_destroy(s_f_layer);
|
||||||
|
bitmap_layer_destroy(s_e_layer);
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
if (s_time_mg_layers[i]) {
|
if (s_time_mg_layers[i]) {
|
||||||
bitmap_layer_destroy(s_time_mg_layers[i]);
|
bitmap_layer_destroy(s_time_mg_layers[i]);
|
||||||
@@ -111,7 +126,7 @@ static void soft_reload(bool first_load) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void init() {
|
static void init() {
|
||||||
// initialize font array
|
// load bitmaps
|
||||||
s_font_bitmaps[0] = gbitmap_create_with_resource(RESOURCE_ID_0);
|
s_font_bitmaps[0] = gbitmap_create_with_resource(RESOURCE_ID_0);
|
||||||
s_font_bitmaps[1] = gbitmap_create_with_resource(RESOURCE_ID_1);
|
s_font_bitmaps[1] = gbitmap_create_with_resource(RESOURCE_ID_1);
|
||||||
s_font_bitmaps[2] = gbitmap_create_with_resource(RESOURCE_ID_2);
|
s_font_bitmaps[2] = gbitmap_create_with_resource(RESOURCE_ID_2);
|
||||||
@@ -122,6 +137,8 @@ static void init() {
|
|||||||
s_font_bitmaps[7] = gbitmap_create_with_resource(RESOURCE_ID_7);
|
s_font_bitmaps[7] = gbitmap_create_with_resource(RESOURCE_ID_7);
|
||||||
s_font_bitmaps[8] = gbitmap_create_with_resource(RESOURCE_ID_8);
|
s_font_bitmaps[8] = gbitmap_create_with_resource(RESOURCE_ID_8);
|
||||||
s_font_bitmaps[9] = gbitmap_create_with_resource(RESOURCE_ID_9);
|
s_font_bitmaps[9] = gbitmap_create_with_resource(RESOURCE_ID_9);
|
||||||
|
s_e_icon = gbitmap_create_with_resource(RESOURCE_ID_E);
|
||||||
|
s_f_icon = gbitmap_create_with_resource(RESOURCE_ID_F);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
s_time_fg_layers[i] = bitmap_layer_create(s_time_grects[i]);
|
s_time_fg_layers[i] = bitmap_layer_create(s_time_grects[i]);
|
||||||
@@ -135,6 +152,8 @@ static void init() {
|
|||||||
|
|
||||||
static void deinit() {
|
static void deinit() {
|
||||||
tick_timer_service_unsubscribe();
|
tick_timer_service_unsubscribe();
|
||||||
|
gbitmap_destroy(s_f_icon);
|
||||||
|
gbitmap_destroy(s_e_icon);
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
bitmap_layer_destroy(s_time_fg_layers[i]);
|
bitmap_layer_destroy(s_time_fg_layers[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user