#include "common.h"

// Attributes tab
void DrawTabAttributes(int cX, int cY, int *attributes, int selected_attr, bool edit_mode)
{
    DrawText("ATTRIBUTES",cX,cY,22,C_GOLD_L);
    HDivider(cX,cY+28,640);
    for(int i=0;i<ATTRIBUTES_COUNT;i++){
        int y=cY+40+i*48;
        bool sel=(i==selected_attr&&edit_mode);
        Panel((Rectangle){(float)cX,(float)y,460.f,40.f},sel?C_PANEL3:C_PANEL2,sel?C_GOLD:C_BORDER);
        if(sel) DrawRectangle(cX,y,4,40,C_GOLD);
        DrawText(attributes_names[i],cX+16,y+11,17,sel?C_GOLD_L:C_TEXT);
        char vs[16]; snprintf(vs,sizeof(vs),"%d",attributes[i]);
        DrawText(vs,cX+460-MeasureText(vs,20)-18,y+10,20,
                 attributes[i]>0?C_GREEN_L:attributes[i]<0?C_RED_L:C_MUTED);
        float bp=fmaxf(0.f,fminf(1.f,attributes[i]/100.f));
        ProgBar((Rectangle){(float)(cX+480),(float)(y+12),140.f,8.f},bp,C_GOLD);
    }
}
