Split MFD into separate files
This commit is contained in:
parent
0326608b17
commit
dd66c31137
4 changed files with 43 additions and 29 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <hexagram/speedo.h>
|
#include <hexagram/speedo.h>
|
||||||
#include <hexagram/thermo.h>
|
#include <hexagram/thermo.h>
|
||||||
#include <hexagram/fuel.h>
|
#include <hexagram/fuel.h>
|
||||||
|
#include <hexagram/mfd.h>
|
||||||
|
|
||||||
typedef struct _hexagram_cluster_state {
|
typedef struct _hexagram_cluster_state {
|
||||||
double rpm, rps, temp, fuel;
|
double rpm, rps, temp, fuel;
|
||||||
|
@ -22,28 +23,6 @@ static hexagram_cluster_state state = {
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static void draw_mfd(cairo_t *cr,
|
|
||||||
double x,
|
|
||||||
double y,
|
|
||||||
double width,
|
|
||||||
double height) {
|
|
||||||
cairo_set_source_rgb(cr, 0.75, 0, 0);
|
|
||||||
cairo_move_to(cr, x, y);
|
|
||||||
cairo_line_to(cr, x + width, y);
|
|
||||||
cairo_line_to(cr, x + width, y + height);
|
|
||||||
cairo_line_to(cr, x, y + height);
|
|
||||||
cairo_line_to(cr, x, y);
|
|
||||||
cairo_fill(cr);
|
|
||||||
|
|
||||||
cairo_set_source_rgb(cr, 1, 1, 1);
|
|
||||||
cairo_move_to(cr, x, y);
|
|
||||||
cairo_line_to(cr, x + width, y);
|
|
||||||
cairo_line_to(cr, x + width, y + height);
|
|
||||||
cairo_line_to(cr, x, y + height);
|
|
||||||
cairo_line_to(cr, x, y);
|
|
||||||
cairo_stroke(cr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cluster_draw_bg(cairo_t *cr,
|
static void cluster_draw_bg(cairo_t *cr,
|
||||||
double width,
|
double width,
|
||||||
double height) {
|
double height) {
|
||||||
|
@ -76,11 +55,11 @@ static void cluster_draw_bg(cairo_t *cr,
|
||||||
height * 0.13,
|
height * 0.13,
|
||||||
0.125);
|
0.125);
|
||||||
|
|
||||||
draw_mfd(cr,
|
hexagram_mfd_draw(cr,
|
||||||
width * 0.42,
|
width * 0.42,
|
||||||
height * 0.1,
|
height * 0.1,
|
||||||
width * 0.16,
|
width * 0.16,
|
||||||
height * 0.5);
|
height * 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cluster_update(struct can_frame *frame) {
|
static void cluster_update(struct can_frame *frame) {
|
||||||
|
|
12
include/hexagram/mfd.h
Normal file
12
include/hexagram/mfd.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _HEXAGRAM_MFD_H
|
||||||
|
#define _HEXAGRAM_MFD_H
|
||||||
|
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
|
void hexagram_mfd_draw(cairo_t *cr,
|
||||||
|
double x,
|
||||||
|
double y,
|
||||||
|
double width,
|
||||||
|
double height);
|
||||||
|
|
||||||
|
#endif /* _HEXAGRAM_MFD_H */
|
|
@ -8,12 +8,12 @@ CFLAGS += -fPIC -I$(INCLUDE_PATH) $(shell pkg-config --cflags cairo x11)
|
||||||
LDFLAGS = $(shell pkg-config --libs cairo x11) -lXext
|
LDFLAGS = $(shell pkg-config --libs cairo x11) -lXext
|
||||||
|
|
||||||
HEADERS = dict.h hash.h can.h capture.h pcapng.h module.h window.h \
|
HEADERS = dict.h hash.h can.h capture.h pcapng.h module.h window.h \
|
||||||
gauge.h tacho.h speedo.h thermo.h fuel.h sim.h
|
gauge.h tacho.h speedo.h thermo.h fuel.h mfd.h sim.h
|
||||||
|
|
||||||
HEADERS_LOCAL = util.h
|
HEADERS_LOCAL = util.h
|
||||||
|
|
||||||
OBJS = dict.o hash.o can.o capture.o pcapng.o module.o window.o \
|
OBJS = dict.o hash.o can.o capture.o pcapng.o module.o window.o \
|
||||||
gauge.o tacho.o speedo.o thermo.o fuel.o sim.o
|
gauge.o tacho.o speedo.o thermo.o fuel.o mfd.o sim.o
|
||||||
|
|
||||||
VERSION_MAJOR = 0
|
VERSION_MAJOR = 0
|
||||||
VERSION_MINOR = 0.1
|
VERSION_MINOR = 0.1
|
||||||
|
|
23
src/mfd.c
Normal file
23
src/mfd.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#include <hexagram/mfd.h>
|
||||||
|
|
||||||
|
void hexagram_mfd_draw(cairo_t *cr,
|
||||||
|
double x,
|
||||||
|
double y,
|
||||||
|
double width,
|
||||||
|
double height) {
|
||||||
|
cairo_set_source_rgb(cr, 0.75, 0, 0);
|
||||||
|
cairo_move_to(cr, x, y);
|
||||||
|
cairo_line_to(cr, x + width, y);
|
||||||
|
cairo_line_to(cr, x + width, y + height);
|
||||||
|
cairo_line_to(cr, x, y + height);
|
||||||
|
cairo_line_to(cr, x, y);
|
||||||
|
cairo_fill(cr);
|
||||||
|
|
||||||
|
cairo_set_source_rgb(cr, 1, 1, 1);
|
||||||
|
cairo_move_to(cr, x, y);
|
||||||
|
cairo_line_to(cr, x + width, y);
|
||||||
|
cairo_line_to(cr, x + width, y + height);
|
||||||
|
cairo_line_to(cr, x, y + height);
|
||||||
|
cairo_line_to(cr, x, y);
|
||||||
|
cairo_stroke(cr);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue