color storage

社区服务
高级搜索
猴岛论坛CSGO反恐精英CS作弊器交流讨论color storage
发帖 回复
正序阅读 最近浏览的帖子最近浏览的版块
0个回复

color storage

楼层直达
作弊辅导员_h

ZxID:1019634

等级: 元老
定做作弊器
举报 只看楼主 使用道具 楼主   发表于: 2007-07-03 0

cpp==============================

CColorList::CColorList()
{
   colorStorage.clear();
   
   loadColors();
}

CColorList::~CColorList()
{
   colorStorage.clear();
}

void CColorList::loadColors(void)
{
   addColor("default",255,255,255,255);
   addColor("esp_ct",40,80,255,255);
   addColor("esp_t",205,100,60,255);
   addColor("cross",255,255,255,255);
   addColor("con_back",0,0,0,90);
   addColor("con_border",255,255,255,150);
   addColor("con_text",255,255,255,255);
   addColor("nicered",255,40,40,255);
   addColor("rand1");
   addColor("rand2");
   addColor("rand3");
   addColor("rand4");
}

void CColorList::addColor(char *szName)
{
   for(int i = 0; i < (int)colorStorage.size(); i++)
      if(!strcmp(colorStorage.szName,szName))
         return;

   static srand(GetTickCount());
   
   int iRed = rand() % 0xFF;
   int iGreen = rand() % 0xFF;
   int iBlue = rand() % 0xFF;
   int iAlpha = rand() % 0xFF;
   
   colorEntry tmpColor =
   {
      szName,
      iRed,
      iGreen,
      iBlue,
      iAlpha,
      iRed / 255.0f,
      iGreen / 255.0f,
      iBlue / 255.0f,
      iAlpha / 255.0f
   };

   colorStorage.push_back(tmpColor);
}

void CColorList::addColor(char *szName, int iRed, int iGreen, int iBlue, int iAlpha)
{
   for(int i = 0; i < (int)colorStorage.size(); i++)
      if(!strcmp(colorStorage.szName,szName))
         return;

   colorEntry tmpColor =
   {
      szName,
      iRed,
      iGreen,
      iBlue,
      iAlpha,
      iRed / 255.0f,
      iGreen / 255.0f,
      iBlue / 255.0f,
      iAlpha / 255.0f
   };

   colorStorage.push_back(tmpColor);
}

void CColorList::randomizeColor(char *szName)
{
   for(int i = 0; i < (int)colorStorage.size(); i++)
   {
      if(!strcmp(colorStorage.szName,szName))
      {
         static srand(GetTickCount());
         
         colorStorage.iRed = rand() % 0xFF;
         colorStorage.iGreen = rand() % 0xFF;
         colorStorage.iBlue = rand() % 0xFF;
         colorStorage.iAlpha = rand() % 0xFF;

         colorStorage.fRed = colorStorage.iRed / 255.0f;
         colorStorage.fGreen = colorStorage.iGreen / 255.0f;
         colorStorage.fBlue = colorStorage.iBlue / 255.0f;
         colorStorage.fAlpha = colorStorage.iAlpha / 255.0f;
      }

      else return;
   }
}

void CColorList::toGreyscale(char *szName)
{
   for(int i = 0; i < (int)colorStorage.size(); i++)
   {
      if(!strcmp(colorStorage.szName,szName))
      {
         int theAverage = (colorStorage.iRed + colorStorage.iGreen + colorStorage.iBlue) / 3;

         colorStorage.iRed = theAverage;
         colorStorage.iGreen = theAverage;
         colorStorage.iBlue = theAverage;

         colorStorage.fRed = theAverage / 255.0f;
         colorStorage.fGreen = theAverage / 255.0f;
         colorStorage.fBlue = theAverage / 255.0f;
      }
   }
}

void CColorList::saveColors(char *szFile)
{
   for(int i = 0; i < (int)colorStorage.size(); i++)
   {
      char buf[256];

      sprintf(buf,"%s %i %i %i %.2f %.2f %.2f\n",
         colorStorage.szName,
         colorStorage.iRed,
         colorStorage.iGreen,
         colorStorage.iBlue,
         colorStorage.fRed,
         colorStorage.fGreen,
         colorStorage.fBlue);

      FILE *colorFile = fopen(szFile,"a+");
      
      if(colorFile != NULL)
      {
         fputs(buf,colorFile);
         fclose(colorFile);
      }
   }
}

colorEntry *CColorList::getColorByName(char *szName)
{
   for(int i = 0; i < (int)colorStorage.size(); i++)
   {
      if(!strcmp(colorStorage.szName,szName))
         return &colorStorage;
   }

   return &colorStorage[0];
}

colorEntry *CColorList::getColorByIndex(int colorIndex)
{
   if(colorIndex > (int)colorStorage.size() || colorIndex < 0) return &colorStorage[0];
   
   return &colorStorage[colorIndex];
}

colorEntry *CColorList::getRandomColor(void)
{
   static srand(GetTickCount());
   
   int randIndex = rand() % (int)colorStorage.size();

   return &colorStorage[randIndex];
}


========================================================

.h=================================================================

typedef struct
{
   char *szName;
   int iRed;
   int iGreen;
   int iBlue;
   int iAlpha;
   float fRed;
   float fGreen;
   float fBlue;
   float fAlpha;

} colorEntry;

class CColorList
{   
public:
   
   CColorList::CColorList(void);
   CColorList::~CColorList(void);
   
   void loadColors(void);
   void addColor(char *szName);
   void addColor(char *szName, int colorRed, int colorGreen, int colorBlue, int colorAlpha);
   void randomizeColor(char *szName);
   void toGreyscale(char *szName);
   void saveColors(char *szFile);

   colorEntry *getColorByName(char *szName);
   colorEntry *getColorByIndex(int colorIndex);
   colorEntry *getRandomColor(void);

private:

   std::vector<colorEntry> colorStorage;
};

extern CColorList colorManager;

密码被盗,请联系cscheat取回
« 返回列表
发帖 回复