| 63 | } |
| 64 | |
| 65 | static void drawMeter(SDL_Renderer* r, int x, int y, int w, int h, float level, uint8_t cr, uint8_t cg, uint8_t cb) |
| 66 | { |
| 67 | SDL_SetRenderDrawColor(r, 40, 40, 50, 255); |
| 68 | SDL_FRect bg = {static_cast<float>(x), static_cast<float>(y), static_cast<float>(w), static_cast<float>(h)}; |
| 69 | SDL_RenderFillRect(r, &bg); |
| 70 | float fill = (level > 1.0f) ? 1.0f : level; |
| 71 | int fw = static_cast<int>(fill * w); |
| 72 | if (fw > 0) |
| 73 | { |
| 74 | SDL_SetRenderDrawColor(r, cr, cg, cb, 255); |
| 75 | SDL_FRect bar = {static_cast<float>(x), static_cast<float>(y), static_cast<float>(fw), static_cast<float>(h)}; |
| 76 | SDL_RenderFillRect(r, &bar); |
| 77 | } |
| 78 | SDL_SetRenderDrawColor(r, 100, 100, 120, 255); |
| 79 | SDL_FRect border = {static_cast<float>(x), static_cast<float>(y), static_cast<float>(w), static_cast<float>(h)}; |
| 80 | SDL_RenderRect(r, &border); |
| 81 | } |
| 82 | |
| 83 | static void drawPanel(SDL_Renderer* r, int x, int y, int w, int h, const char* label, float level, bool active, |
| 84 | uint8_t cr, uint8_t cg, uint8_t cb, int packets) |