| 350 | } |
| 351 | |
| 352 | sp<Control> ControlGenerator::createAgentAssignmentControl(GameState &state, sp<Agent> agent) |
| 353 | { |
| 354 | const int controlLength = 200, controlHeight = 24, iconLength = 36; |
| 355 | |
| 356 | if (!singleton.initialised) |
| 357 | { |
| 358 | singleton.init(state); |
| 359 | } |
| 360 | |
| 361 | auto control = mksp<Control>(); |
| 362 | control->setData(agent); |
| 363 | control->Size = control->SelectionSize = {controlLength, controlHeight}; |
| 364 | control->Name = "AGENT_PORTRAIT"; |
| 365 | |
| 366 | auto icon = createAgentIcon(state, agent, UnitSelectionState::Unselected, false); |
| 367 | icon->Size = {iconLength, controlHeight}; |
| 368 | icon->setParent(control); |
| 369 | |
| 370 | auto nameLabel = control->createChild<Label>(agent->name, singleton.labelFont); |
| 371 | nameLabel->Size = {controlLength - iconLength, singleton.labelFont->getFontHeight()}; |
| 372 | nameLabel->Location = {iconLength, (control->Size.y - nameLabel->Size.y) / 2}; |
| 373 | |
| 374 | return control; |
| 375 | } |
| 376 | |
| 377 | sp<Control> ControlGenerator::createAgentIcon(GameState &state, sp<Agent> agent, |
| 378 | UnitSelectionState forcedSelectionState, |
nothing calls this directly
no test coverage detected