ColliderComponent hidden prop

This commit is contained in:
2021-08-16 17:36:21 -04:00
parent 8713b76f83
commit 1e5beb5b88
11 changed files with 30 additions and 134 deletions

View File

@ -69,14 +69,10 @@ public:
{
spriteType = sType;
if(sType == spriteAnimation)
{
// std::string bogusPath = "src/config/credits.json";
// std::ifstream fin(bogusPath);
{
std::ifstream fin(json);
if(fin.is_open()){
// std::cout<<"file is open"<<std::endl;
} else {
std::cout<<"json file is NOT open"<<std::endl;
}
@ -84,7 +80,6 @@ public:
if(fin.fail()){
std::cout<<"json file open fail"<<std::endl;
} else{
// std::cout<<"json file open success"<<std::endl;
}
std::ifstream jsonText(json);
@ -94,35 +89,20 @@ public:
cJSON * animJson = cJSON_Parse(aJson.c_str());
cJSON * meta = cJSON_GetObjectItem(animJson, "meta");
cJSON * frameTags = cJSON_GetObjectItem(meta,"frameTags");
// printf("frameTags:\n%s\n",cJSON_Print(frameTags));
int tagsCount = cJSON_GetArraySize(frameTags);
// printf("number of tags: \n%d\n",tagsCount);
// cJSON * arrItem = cJSON_GetArrayItem(frameTags,0);
// cJSON * animItem = cJSON_GetArrayItem(frameTags, 0);
// printf("Animation item: \n%s\n",cJSON_Print(animItem));
// printf("arrItem: \n%s\n",cJSON_Print(arrItem));
for (int t = 0; t < tagsCount; t++)
{
// printf("Tag: \n%d\n",t);
// printf("tag number: \n%d\n",t);
cJSON * animItem = cJSON_GetArrayItem(frameTags,t);
// printf("Animation item: \n%s\n",cJSON_Print(animItem));
cJSON * nameJson = cJSON_GetObjectItem(animItem, "name");
const char * name = cJSON_Print(nameJson);
int fromFrame = cJSON_GetObjectItem(animItem, "from")->valueint;
int toFrame = cJSON_GetObjectItem(animItem, "to")->valueint;
Animation anim = Animation(fromFrame,toFrame,100);
animations.emplace(name, anim);
// printf("Adding animation named: %s fromFrame:%d toFrame:%d \n",name,fromFrame,toFrame);
Play(name);
}
// if(!animations.empty()){
// printf("animations found!\n");
// }else{
// printf("No animations\n");
// }
// Play("idle");
Animation idle = Animation(0,3,100);
animations.emplace("Idle", idle);
Animation walk = Animation(1,3,100);
@ -140,7 +120,6 @@ public:
{
spriteType = sType;
setTex(id);
// text = isText;
letter = fontLetter;
letterWidth = letterW;
letterHeight = letterH;