| 2020 | } |
| 2021 | |
| 2022 | void GUI_DrawProgressbar(uint16 current, uint16 max) |
| 2023 | { |
| 2024 | static uint16 l_info[11] = { 293, 52, 24, 7, 1, 0, 0, 0, 4, 5, 8 }; |
| 2025 | |
| 2026 | uint16 width; |
| 2027 | uint16 height; |
| 2028 | uint16 colour; |
| 2029 | |
| 2030 | l_info[7] = max; |
| 2031 | l_info[6] = current; |
| 2032 | |
| 2033 | if (current > max) current = max; |
| 2034 | if (max < 1) max = 1; |
| 2035 | |
| 2036 | width = l_info[2]; |
| 2037 | height = l_info[3]; |
| 2038 | |
| 2039 | /* 0 = Horizontal, 1 = Vertial */ |
| 2040 | if (l_info[5] == 0) { |
| 2041 | width = current * width / max; |
| 2042 | if (width < 1) width = 1; |
| 2043 | } else { |
| 2044 | height = current * height / max; |
| 2045 | if (height < 1) height = 1; |
| 2046 | } |
| 2047 | |
| 2048 | colour = l_info[8]; |
| 2049 | if (current <= max / 2) colour = l_info[9]; |
| 2050 | if (current <= max / 4) colour = l_info[10]; |
| 2051 | |
| 2052 | if (current != 0 && width == 0) width = 1; |
| 2053 | if (current != 0 && height == 0) height = 1; |
| 2054 | |
| 2055 | if (height != 0) { |
| 2056 | GUI_DrawBorder(l_info[0] - 1, l_info[1] - 1, l_info[2] + 2, l_info[3] + 2, 1, true); |
| 2057 | } |
| 2058 | |
| 2059 | if (width != 0) { |
| 2060 | GUI_DrawFilledRectangle(l_info[0], l_info[1] + l_info[3] - height, l_info[0] + width - 1, l_info[1] + l_info[3] - 1, (uint8)colour); |
| 2061 | } |
| 2062 | } |
| 2063 | |
| 2064 | /** |
| 2065 | * Draw the interface (borders etc etc) and radar on the screen. |
no test coverage detected