]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud_scal.cxx
Merge commit 'refs/merge-requests/1552' of git@gitorious.org:fg/flightgear into next
[flightgear.git] / src / Cockpit / hud_scal.cxx
1
2 #include "hud.hxx"
3
4
5 //============== Top of instr_scale class memeber definitions ===============
6 //
7 // Notes:
8 // 1. instr_scales divide the specified location into half and then
9 //    the half opposite the read direction in half again. A bar is
10 //    then drawn along the second divider. Scale ticks are drawn
11 //    between the middle and quarter section lines (minor division
12 //    markers) or just over the middle line.
13 //
14 // 2.  This class was not intended to be instanciated. See moving_scale
15 //     and gauge_instr classes.
16 //============================================================================
17 instr_scale::instr_scale(
18         int      x,
19         int      y,
20         UINT     width,
21         UINT     height,
22         FLTFNPTR load_fn,
23         UINT     options,
24         float    show_range,
25         float    maxValue,
26         float    minValue,
27         float    disp_scale,
28         UINT     major_divs,
29         UINT     minor_divs,
30         UINT     rollover,
31         int      dp_showing,
32         bool     working) :
33     instr_item( x, y, width, height, load_fn, disp_scale, options, working),
34     range_shown  ( show_range ),
35     Maximum_value( maxValue   ),
36     Minimum_value( minValue   ),
37     Maj_div      ( major_divs ),
38     Min_div      ( minor_divs ),
39     Modulo       ( rollover   ),
40     signif_digits( dp_showing )
41 {
42     int temp;
43
44     scale_factor = (float)get_span() / range_shown;
45     if (show_range < 0)
46         range_shown = -range_shown;
47
48     temp = float_to_int(Maximum_value - Minimum_value) / 100;
49     if (range_shown < temp)
50         range_shown = temp;
51 }
52
53