#include "common.h"

// Stats tab
void DrawTabStats(int cX, int cY, int *base_stats, int *gear_stats, int selected_stat, bool edit_mode)
{
    DrawText("BASE STATS",cX, cY,22,C_GOLD_L);
    DrawText("GEAR STATS",cX+360,cY,22,C_BLUE_L);
    HDivider(cX,cY+28,650);
    for(int i=0;i<STATS_COUNT;i++){
        int y=cY+38+i*30;
        bool sel=(i==selected_stat&&edit_mode);
        Color bg=i%2==0?C_PANEL2:C_PANEL;
        DrawRectangle(cX,y,340,26,bg);
        if(sel){
            DrawRectangleRoundedLinesEx((Rectangle){(float)cX,(float)y,340.f,26.f},0.08f,8,1.5f,C_GOLD);
            DrawRectangle(cX,y,3,26,C_GOLD);
        }
        DrawText(stats_names[i],cX+10,y+5,14,sel?C_GOLD_L:C_TEXT);
        Color vc=base_stats[i]>0?C_GREEN_L:base_stats[i]<0?C_RED_L:C_MUTED;
        DrawText(TextFormat("%d %s",base_stats[i],stats_units[i]),
                 cX+340-MeasureText(TextFormat("%d %s",base_stats[i],stats_units[i]),14)-10,y+5,14,vc);
        Color bg2=i%2==0?(Color){20,24,48,255}:C_PANEL;
        DrawRectangle(cX+360,y,290,26,bg2);
        DrawText(TextFormat("%d %s",gear_stats[i],stats_units[i]),cX+360+10,y+5,14,C_BLUE_L);
    }
}
