本文整理汇总了C++中CEntity::OnLoad方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntity::OnLoad方法的具体用法?C++ CEntity::OnLoad怎么用?C++ CEntity::OnLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntity
的用法示例。
在下文中一共展示了CEntity::OnLoad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadWarehouse
//----------------------------------------------------------------------------------
bool loadWarehouse(SDL_Renderer* ren)
{ //load seedling
CEntity* ent = new CSeedlingW;
if(ent->OnLoad("../tilesets/farmsheet.png", 82, 82, 1, ren) == false) {
return false;}
ent->Y = 0;
ent->X = TILE_SIZE*(3);
ent->AnimState = 11;
CEntity::EntityList.push_back(ent);
}
示例2: loadStable
//----------------------------------------------------------------------------------
bool loadStable(SDL_Renderer* ren, char* filename)
{
FILE* fp = fopen(filename,"r");
if(fp == NULL) printf("not farming");
int i=0,j=0; char ch;
while(fp && i<FARM_HEIGHT)
{
ch = fgetc(fp);
if(feof(fp)) break;
if(ch == '\n') {++i; j=0; continue;}
CPlant::farm[i][j] = ch-48;
++j;
}
fclose(fp);
for (i = FARM_i; i < FARM_HEIGHT+FARM_i; ++i)
{ for(j=FARM_j; j<FARM_WIDTH+FARM_j; ++j)
{
if(CPlant::farm[i-FARM_i][j-FARM_j] == 0) {printf("0"); continue;}
if(CPlant::farm[i-FARM_i][j-FARM_j] == 3) {printf("3"); continue;}
printf("%d",CPlant::farm[i-FARM_i][j-FARM_j]);
CEntity* ent = new CPlant;
if(ent->OnLoad("../tilesets/weedsheet.png", 82, 82, 8, ren) == 0) { printf("\nnot farming 2\n");
return false;
}
ent->Y = i*TILE_SIZE+TILE_SIZE/2 - ent->getCenter().second;
ent->X = j*TILE_SIZE+TILE_SIZE/2 - ent->getCenter().first;
CEntity::EntityList.push_back(ent);
}
printf("\n");
}
return true;
}