forked from sam-itt/sofis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fishbone-gauge.h
63 lines (52 loc) · 1.79 KB
/
fishbone-gauge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* SPDX-FileCopyrightText: 2021 Samuel Cuella <samuel.cuella@gmail.com>
*
* This file is part of SoFIS - an open source EFIS
*
* SPDX-License-Identifier: GPL-2.0-only
*/
#ifndef FISHBONE_GAUGE_H
#define FISHBONE_GAUGE_H
#include "sfv-gauge.h"
#include "generic-layer.h"
#include "generic-ruler.h"
typedef struct{
/* Ruler offset within the gauge
* Cursor base being at y = 0
* Simple ints would have done but the blitting
* functions need SDL_Rects
*/
SDL_Rect cursor_rect;
}FishboneGaugeState;
typedef struct{
SfvGauge super;
float value;
GenericRuler ruler;
Uint32 color;
/* TODO: Generate cursors otf, and support
* 2 cursors, one of each side of the scale.
* */
GenericLayer *cursor;
ColorZone *zones;
uint8_t nzones;
/* Ruler offset within the gauge
* Cursor base being at y = 0
* Simple ints would have done but the blitting
* functions need SDL_Rects
*/
SDL_Rect ruler_rect;
FishboneGaugeState state;
}FishboneGauge;
FishboneGauge *fishbone_gauge_new(bool marked,
PCF_Font *font, SDL_Color color,
float from, float to, float step,
int bar_max_w, int bar_max_h,
int nzones, ColorZone *zones);
FishboneGauge *fishbone_gauge_init(FishboneGauge *self,
bool marked,
PCF_Font *font, SDL_Color color,
float from, float to, float step,
int bar_max_w, int bar_max_h,
int nzone, ColorZone *zones);
bool fishbone_gauge_set_value(FishboneGauge *self, float value, bool animated);
#endif /* FISHBONE_GAUGE_H */