Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2762ea60cb | |||
| 4476d73718 | |||
| f080ae27d7 | |||
| 9a5d839115 | |||
| 768026e3f9 | |||
| d4d191a2bb | |||
| 7f359f01b9 | |||
| 0a4c802685 |
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "neat_bar"]
|
||||||
|
path = neat_bar
|
||||||
|
url = https://git.wetfence.xyz/RandyTheSilly/neat_bar.git
|
||||||
@@ -50,20 +50,6 @@
|
|||||||
"spaceOptimization": "storage",
|
"spaceOptimization": "storage",
|
||||||
"type": "bitmap"
|
"type": "bitmap"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"file": "patch_bottom.png",
|
|
||||||
"memoryFormat": "Smallest",
|
|
||||||
"name": "PATCH_BOTTOM",
|
|
||||||
"spaceOptimization": "storage",
|
|
||||||
"type": "bitmap"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "patch_top.png",
|
|
||||||
"memoryFormat": "Smallest",
|
|
||||||
"name": "PATCH_TOP",
|
|
||||||
"spaceOptimization": "storage",
|
|
||||||
"type": "bitmap"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"file": "icon.png",
|
"file": "icon.png",
|
||||||
"memoryFormat": "Smallest",
|
"memoryFormat": "Smallest",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 87 B After Width: | Height: | Size: 69 B |
|
Before Width: | Height: | Size: 92 B After Width: | Height: | Size: 88 B |
|
After Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 91 B |
|
Before Width: | Height: | Size: 92 B |
|
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 126 B |
@@ -1,3 +1,4 @@
|
|||||||
|
#include "../../neat_bar/src/c/neat_bar.h"
|
||||||
#include <pebble.h>
|
#include <pebble.h>
|
||||||
|
|
||||||
#define COUNT_PKEY 1
|
#define COUNT_PKEY 1
|
||||||
@@ -10,23 +11,19 @@ static GBitmap *s_action_icon_plus;
|
|||||||
static GBitmap *s_action_icon_minus;
|
static GBitmap *s_action_icon_minus;
|
||||||
static GBitmap *s_action_icon_reset;
|
static GBitmap *s_action_icon_reset;
|
||||||
|
|
||||||
static ActionBarLayer *s_action_bar_layer;
|
static NeatBarLayer *s_neat_bar_layer;
|
||||||
static StatusBarLayer *s_status_bar_layer;
|
static StatusBarLayer *s_status_bar_layer;
|
||||||
|
|
||||||
static int s_count;
|
static int s_count;
|
||||||
|
|
||||||
#if PBL_RECT
|
#if PBL_ROUND
|
||||||
static GBitmap *s_legacy_actionbar_patch_bottom;
|
#define NEAT_BAR_WIDTH ACTION_BAR_WIDTH
|
||||||
static GBitmap *s_legacy_actionbar_patch_top;
|
#define TEXT_W_OFFSET (PBL_DISPLAY_HEIGHT >= 260 ? 34 : 40)
|
||||||
static BitmapLayer *s_patch_bottom_layer;
|
#define TEXT_Y_OFFSET 27
|
||||||
static BitmapLayer *s_patch_top_layer;
|
|
||||||
#if PBL_DISPLAY_WIDTH >= 200
|
|
||||||
static const GRect s_patch_bottom_grect = GRect(166, 222, 34, 6);
|
|
||||||
static const GRect s_patch_top_grect = GRect(166, 20, 34, 6);
|
|
||||||
#else
|
#else
|
||||||
static const GRect s_patch_bottom_grect = GRect(114, 163, 34, 5);
|
#define NEAT_BAR_WIDTH (PBL_DISPLAY_HEIGHT >= 228 ? ACTION_BAR_WIDTH - 6 : ACTION_BAR_WIDTH - 10)
|
||||||
static const GRect s_patch_top_grect = GRect(114, 15, 34, 6);
|
#define TEXT_W_OFFSET NEAT_BAR_WIDTH
|
||||||
#endif
|
#define TEXT_Y_OFFSET (PBL_DISPLAY_HEIGHT >= 228 ? 17 : 19)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
@@ -80,30 +77,31 @@ void click_config_provider(void *context) {
|
|||||||
void window_load(Window *window) {
|
void window_load(Window *window) {
|
||||||
Layer *window_layer = window_get_root_layer(window);
|
Layer *window_layer = window_get_root_layer(window);
|
||||||
|
|
||||||
s_action_bar_layer = action_bar_layer_create();
|
s_neat_bar_layer = neat_bar_layer_create();
|
||||||
action_bar_layer_set_click_config_provider(s_action_bar_layer, click_config_provider);
|
neat_bar_layer_set_click_config_provider(s_neat_bar_layer, click_config_provider);
|
||||||
action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_UP, s_action_icon_reset);
|
neat_bar_layer_set_icon(s_neat_bar_layer, BUTTON_ID_UP, s_action_icon_reset);
|
||||||
action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_SELECT, s_action_icon_plus);
|
neat_bar_layer_set_icon(s_neat_bar_layer, BUTTON_ID_SELECT, s_action_icon_plus);
|
||||||
action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_DOWN, s_action_icon_minus);
|
neat_bar_layer_set_icon(s_neat_bar_layer, BUTTON_ID_DOWN, s_action_icon_minus);
|
||||||
action_bar_layer_add_to_window(s_action_bar_layer, window);
|
|
||||||
|
|
||||||
#if PBL_RECT
|
#if PBL_RECT
|
||||||
s_patch_bottom_layer = bitmap_layer_create(s_patch_bottom_grect);
|
neat_bar_layer_set_bar_aa(s_neat_bar_layer, false);
|
||||||
bitmap_layer_set_bitmap(s_patch_bottom_layer, s_legacy_actionbar_patch_bottom);
|
neat_bar_layer_set_icons_x_offset(s_neat_bar_layer, 0);
|
||||||
bitmap_layer_set_background_color(s_patch_bottom_layer, GColorClear);
|
neat_bar_layer_set_rect_bar_corner_radius(s_neat_bar_layer, 3);
|
||||||
bitmap_layer_set_compositing_mode(s_patch_bottom_layer, GCompOpSet);
|
neat_bar_layer_set_bar_width(s_neat_bar_layer, NEAT_BAR_WIDTH);
|
||||||
layer_add_child(window_layer, bitmap_layer_get_layer(s_patch_bottom_layer));
|
#if PBL_DISPLAY_HEIGHT >= 228
|
||||||
s_patch_top_layer = bitmap_layer_create(s_patch_top_grect);
|
neat_bar_layer_set_bar_height(s_neat_bar_layer, PBL_DISPLAY_HEIGHT - 28);
|
||||||
bitmap_layer_set_bitmap(s_patch_top_layer, s_legacy_actionbar_patch_top);
|
neat_bar_layer_set_bar_y_offset(s_neat_bar_layer, 24);
|
||||||
bitmap_layer_set_background_color(s_patch_top_layer, GColorClear);
|
neat_bar_layer_set_icons_y_offset(s_neat_bar_layer, 10);
|
||||||
bitmap_layer_set_compositing_mode(s_patch_top_layer, GCompOpSet);
|
#else
|
||||||
layer_add_child(window_layer, bitmap_layer_get_layer(s_patch_top_layer));
|
neat_bar_layer_set_bar_height(s_neat_bar_layer, PBL_DISPLAY_HEIGHT - 22);
|
||||||
|
neat_bar_layer_set_bar_y_offset(s_neat_bar_layer, 19);
|
||||||
|
neat_bar_layer_set_icons_y_offset(s_neat_bar_layer, 8);
|
||||||
|
neat_bar_layer_set_icons_spread(s_neat_bar_layer, 48);
|
||||||
|
neat_bar_layer_set_animations_move_distance(s_neat_bar_layer, 2);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
neat_bar_layer_add_to_window(s_neat_bar_layer, window);
|
||||||
|
|
||||||
GRect bounds = layer_get_frame(window_layer);
|
s_text_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - TEXT_Y_OFFSET, PBL_DISPLAY_WIDTH - TEXT_W_OFFSET, PBL_DISPLAY_HEIGHT));
|
||||||
const int16_t width = layer_get_frame(window_layer).size.w - ACTION_BAR_WIDTH;
|
|
||||||
|
|
||||||
s_text_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - 27, width, bounds.size.h));
|
|
||||||
text_layer_set_font(s_text_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
|
text_layer_set_font(s_text_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
|
||||||
text_layer_set_background_color(s_text_layer, GColorClear);
|
text_layer_set_background_color(s_text_layer, GColorClear);
|
||||||
update();
|
update();
|
||||||
@@ -117,21 +115,13 @@ void window_load(Window *window) {
|
|||||||
void window_unload(Window *window) {
|
void window_unload(Window *window) {
|
||||||
status_bar_layer_destroy(s_status_bar_layer);
|
status_bar_layer_destroy(s_status_bar_layer);
|
||||||
text_layer_destroy(s_text_layer);
|
text_layer_destroy(s_text_layer);
|
||||||
#if PBL_RECT
|
neat_bar_layer_destroy(s_neat_bar_layer);
|
||||||
bitmap_layer_destroy(s_patch_top_layer);
|
|
||||||
bitmap_layer_destroy(s_patch_bottom_layer);
|
|
||||||
#endif
|
|
||||||
action_bar_layer_destroy(s_action_bar_layer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
s_action_icon_plus = gbitmap_create_with_resource(RESOURCE_ID_PLUS);
|
s_action_icon_plus = gbitmap_create_with_resource(RESOURCE_ID_PLUS);
|
||||||
s_action_icon_minus = gbitmap_create_with_resource(RESOURCE_ID_MINUS);
|
s_action_icon_minus = gbitmap_create_with_resource(RESOURCE_ID_MINUS);
|
||||||
s_action_icon_reset = gbitmap_create_with_resource(RESOURCE_ID_RESET);
|
s_action_icon_reset = gbitmap_create_with_resource(RESOURCE_ID_RESET);
|
||||||
#if PBL_RECT
|
|
||||||
s_legacy_actionbar_patch_bottom = gbitmap_create_with_resource(RESOURCE_ID_PATCH_BOTTOM);
|
|
||||||
s_legacy_actionbar_patch_top = gbitmap_create_with_resource(RESOURCE_ID_PATCH_TOP);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s_window = window_create();
|
s_window = window_create();
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ def build(ctx):
|
|||||||
ctx.env = ctx.all_envs[platform]
|
ctx.env = ctx.all_envs[platform]
|
||||||
ctx.set_group(ctx.env.PLATFORM_NAME)
|
ctx.set_group(ctx.env.PLATFORM_NAME)
|
||||||
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
|
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
|
||||||
ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app')
|
ctx.pbl_build(source=ctx.path.ant_glob(['src/c/**/*.c', 'neat_bar/src/c/**/*.c']), target=app_elf, bin_type='app')
|
||||||
|
|
||||||
if build_worker:
|
if build_worker:
|
||||||
worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
|
worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
|
||||||
|
|||||||