MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / drawMeter

Function drawMeter

apps/tools/Tools/commands/VonCommand.cpp:65–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65static 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
83static 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)

Callers 1

drawPanelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected