void DrawLabel(const struct zzLabel* label) { short state = GetControlState(label); DrawBackground(&label->ctrl, state); DrawBoundary(&label->ctrl, state); if(label->link) { PutString(GetXPositoinText(&label->ctrl, label->link) + 1, GetYPositoinText(&label->ctrl, label->link) + 1, label->ctrl.font, label->link, label->ctrl.color, label->ctrl.bgColor, &label->ctrl.rect, FLG_TEXT); } }
void DrawControl(const struct zzControl* ctrl) { short state = GetControlState(ctrl); if(state == -1) return; switch ( ctrl->type ) { case BUTTON: DrawButton((struct zzButton*) ctrl); break; case LABEL: DrawLabel((struct zzLabel*) ctrl); break; case TEXTFIELD: DrawTextField((struct zzTextField*) ctrl); break; default: break; } }
void DrawTextField(const struct zzTextField* textField) { unsigned short state = GetControlState(textField); DrawBackground(&textField->ctrl,state); DrawBoundary(&textField->ctrl, state); if(textField->link) { PutString(GetXPositoinText(&textField->ctrl, textField->link) + 1, GetYPositoinText(&textField->ctrl, textField->link) + 1, textField->ctrl.font, textField->link, textField->ctrl.color, textField->ctrl.bgColor, &textField->ctrl.rect, FLG_TEXT); } }
void DrawButton(const struct zzButton* button) { short state = GetControlState(button); struct rectangle rect; DrawBackground(&button->ctrl, state); DrawBoundary(&button->ctrl, state); if(button->link) { PutString(GetXPositoinText(&button->ctrl,button->link) + ((state & STATE_CLICKED) && (state & STATE_FOCUSED)), GetYPositoinText(&button->ctrl,button->link) + ((state & STATE_CLICKED) && (state & STATE_FOCUSED)), button->ctrl.font, button->link, (button->ctrl.style & STYLE_TRANSPARENT) ? button->ctrl.color + (state & STATE_FOCUSED) : 0, button->ctrl.color, &button->ctrl.rect, FLG_TEXT); } }
// Returns >0 if [control] is active on any input devices currently being used API_INLINE int32 GetControlState(Enums::PlayerControl control) { return GetControlState(SettingsGetDevice(control), SettingsGetType(control), SettingsGetIndex(control), SettingsGetDirection(control)); }