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

Function drawPanel

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

Source from the content-addressed store, hash-verified

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)
85{
86 SDL_SetRenderDrawColor(r, active ? static_cast<uint8_t>(50) : static_cast<uint8_t>(30),
87 active ? static_cast<uint8_t>(50) : static_cast<uint8_t>(30),
88 active ? static_cast<uint8_t>(65) : static_cast<uint8_t>(40), 255);
89 SDL_FRect panel = {static_cast<float>(x), static_cast<float>(y), static_cast<float>(w), static_cast<float>(h)};
90 SDL_RenderFillRect(r, &panel);
91 if (active)
92 {
93 SDL_SetRenderDrawColor(r, cr, cg, cb, 255);
94 SDL_FRect indicator = {static_cast<float>(x + 8), static_cast<float>(y + 8), 12.0f, 12.0f};
95 SDL_RenderFillRect(r, &indicator);
96 }
97 else
98 {
99 SDL_SetRenderDrawColor(r, 80, 80, 80, 255);
100 SDL_FRect indicator = {static_cast<float>(x + 8), static_cast<float>(y + 8), 12.0f, 12.0f};
101 SDL_RenderRect(r, &indicator);
102 }
103 drawMeter(r, x + 8, y + h - 28, w - 16, 20, level * 5.0f, cr, cg, cb);
104}
105
106static int ExecuteTest(int delayMs)
107{

Callers 1

ExecuteTestFunction · 0.85

Calls 1

drawMeterFunction · 0.85

Tested by

no test coverage detected