[Horus] Slider with Martin's design
This commit is contained in:
@@ -9,5 +9,6 @@ add_custom_target(ttf_horus_fonts DEPENDS ttf_horus_tinsize ttf_horus_smlsize tt
|
|||||||
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5)
|
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5)
|
||||||
add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 5/6/5/8)
|
add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 5/6/5/8)
|
||||||
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
|
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
|
||||||
|
add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits)
|
||||||
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
|
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
|
||||||
add_dependencies(horus_bitmaps horus_alpha_bitmaps horus_masks horus_fonts)
|
add_dependencies(horus_bitmaps horus_alpha_bitmaps horus_masks horus_slider_masks horus_fonts)
|
||||||
|
|||||||
@@ -263,3 +263,24 @@ const uint8_t LBM_SLEEP[] __DMA = {
|
|||||||
const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = {
|
const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = {
|
||||||
#include "mask_shutdown_circle.lbm"
|
#include "mask_shutdown_circle.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_SLIDER_BAR_LEFT[] __DMA = {
|
||||||
|
#include "bar_left.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_SLIDER_BAR_RIGHT[] __DMA = {
|
||||||
|
#include "bar_right.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_SLIDER_POINT_OUT[] __DMA = {
|
||||||
|
#include "point_out.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_SLIDER_POINT_MID[] __DMA = {
|
||||||
|
#include "point_mid.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_SLIDER_POINT_IN[] __DMA = {
|
||||||
|
#include "point_in.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -135,3 +135,9 @@ extern const uint8_t LBM_CURVE_COORD_SHADOW[];
|
|||||||
extern const uint8_t LBM_SHUTDOWN[];
|
extern const uint8_t LBM_SHUTDOWN[];
|
||||||
extern const uint8_t LBM_SLEEP[];
|
extern const uint8_t LBM_SLEEP[];
|
||||||
extern const uint8_t LBM_SHUTDOWN_CIRCLE[];
|
extern const uint8_t LBM_SHUTDOWN_CIRCLE[];
|
||||||
|
extern const uint8_t LBM_SLIDER_BAR_LEFT[];
|
||||||
|
extern const uint8_t LBM_SLIDER_BAR_RIGHT[];
|
||||||
|
extern const uint8_t LBM_SLIDER_POINT_OUT[];
|
||||||
|
extern const uint8_t LBM_SLIDER_POINT_MID[];
|
||||||
|
extern const uint8_t LBM_SLIDER_POINT_IN[];
|
||||||
|
|
||||||
|
|||||||
@@ -253,14 +253,22 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e
|
|||||||
|
|
||||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
|
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
|
||||||
{
|
{
|
||||||
const int width = 50;
|
const int width = 100;
|
||||||
lcdDrawHorizontalLine(x, y+5, width, SOLID, TEXT_COLOR);
|
|
||||||
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) {
|
// The bar
|
||||||
lcdDrawSolidFilledRect(x+value*(width-5)/max, y, 5, 11, TEXT_INVERTED_BGCOLOR);
|
lcdDrawBitmapPattern(x, y + 10, LBM_SLIDER_BAR_LEFT, value <= 0 ? LINE_COLOR : TEXT_INVERTED_BGCOLOR);
|
||||||
}
|
int w = value * (width - 8) / max;
|
||||||
else {
|
if (value > 0)
|
||||||
lcdDrawSolidFilledRect(x+value*(width-5)/max, y, 5, 11, LINE_COLOR);
|
lcdDrawSolidFilledRect(x + 4, y + 10, w, 4, TEXT_INVERTED_BGCOLOR);
|
||||||
}
|
if (value < max)
|
||||||
|
lcdDrawSolidFilledRect(x + 4 + w, y + 10, width - 8 - w, 4, LINE_COLOR);
|
||||||
|
lcdDrawBitmapPattern(x + width - 4, y + 10, LBM_SLIDER_BAR_RIGHT, value >= max ? TEXT_INVERTED_BGCOLOR : LINE_COLOR);
|
||||||
|
|
||||||
|
// The point
|
||||||
|
lcdDrawBitmapPattern(x + w - 4, y + 5, LBM_SLIDER_POINT_OUT, TEXT_COLOR);
|
||||||
|
lcdDrawBitmapPattern(x + w - 4, y + 5, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR);
|
||||||
|
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE))
|
||||||
|
lcdDrawBitmapPattern(x + w - 4, y + 5, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GVARS)
|
#if defined(GVARS)
|
||||||
|
|||||||
Reference in New Issue
Block a user