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

@@ -49,20 +49,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
finalRect.w = finalRect.w*scale;
finalRect.h = finalRect.h*scale;
// x0 = x0*scale;
// x1 = x1*scale;
// y0 = y0*scale;
// y1 = y1*scale;
// printf("finalRect x:%d, y:%d, w:%d, h:%d \n",finalRect.x,finalRect.y,finalRect.w,finalRect.h);
// destRect.x = destRect.x*scale;
// destRect.y = destRect.y*scale;
// destRect.w = destRect.w*scale;
// destRect.h = destRect.h*scale;
// colsRemainder = colsRemainder*scale;
// rowsRemainder = rowsRemainder*scale;
for (int i=0; i<9; i++)
{
switch(i)
@@ -72,7 +58,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.y = 0;
srcRect.w = x0;
srcRect.h = y0;
// printf("tile zero.w or x0: %d\n",x0);
destRect.w = srcRect.w;
destRect.h = srcRect.h;
break;
@@ -91,8 +76,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.h = y0;
destRect.w = srcRect.w;
destRect.h = srcRect.h;
// printf("srcRect.x: %d",srcRect.x);
// printf("UI9Slice #2 srcRect x:%d y:%d w:%d h:%d \n",srcRect.x,srcRect.y,srcRect.w,srcRect.h);
break;
case 3:
srcRect.x = 0;
@@ -150,14 +133,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.w = 0;
destRect.h = 0;
}
// These will be the same for each SDL_Rect except if there's a scaling int, which still needs to be implemented
// destRect.w = srcRect.w*scale;
// destRect.h = srcRect.h*scale;
// x0 = x0*scale;
// x1 = x1*scale;
// y0 = y0*scale;
// y1 = y1*scale;
// Calculate where and how many tiles to place
// We only need one instance of each of these in each corner or slices 0,2,6,8
@@ -184,9 +159,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.y = finalRect.y+(finalRect.h-srcRect.h*scale);
}
AddSlice(srcRect,destRect,scale);
// printf("Corner Slice\n");
// printf("srcRect x:%d, y:%d, w:%d, h:%d \n",srcRect.x,srcRect.y,srcRect.w,srcRect.h);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n\n",destRect.x,destRect.y,destRect.w,destRect.h);
}
// Slices 1,7 need to be repeated in a row
if (i==1||i==7)
@@ -198,9 +170,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.x = finalRect.x+(x0*scale+c*(x1*scale-x0*scale));
destRect.y = finalRect.y;
AddSlice(srcRect,destRect,scale);
// printf("Top Slice (1) \n");
// printf("srcRect x:%d, y:%d, w:%d, h:%d \n",srcRect.x,srcRect.y,srcRect.w,srcRect.h);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n\n",destRect.x,destRect.y,destRect.w,destRect.h);
}
if (colsRemainder>0){
destRect.x = finalRect.x+(x0*scale+cols*(x1*scale-x0*scale));
@@ -208,9 +177,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.w = colsRemainder;
destRect.w = colsRemainder;
AddSlice(srcRect,destRect,scale);
// printf("Top Slice (1) \n");
// printf("srcRect x:%d, y:%d, w:%d, h:%d \n",srcRect.x,srcRect.y,srcRect.w,srcRect.h);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n\n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
if (i==7)
@@ -220,7 +186,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.x = finalRect.x+(x0*scale+c*(x1*scale-x0*scale));
destRect.y = finalRect.y+(finalRect.h-(srcH-y1)*scale);
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
if (colsRemainder>0){
destRect.x = finalRect.x+(x0*scale+cols*(x1*scale-x0*scale));
@@ -228,7 +193,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.w = colsRemainder;
destRect.w = colsRemainder;
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
}
@@ -242,7 +206,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.x = finalRect.x;
destRect.y = finalRect.y+(y0*scale+r*(y1-y0)*scale);
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
if (rowsRemainder>0){
destRect.x = finalRect.x;
@@ -250,7 +213,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.h = rowsRemainder;
destRect.h = rowsRemainder;
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
if (i==5)
@@ -260,7 +222,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.x = finalRect.x+(finalRect.w-(srcW-x1)*scale);
destRect.y = finalRect.y+(y0*scale+r*(y1-y0)*scale);
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
if (rowsRemainder>0){
destRect.x = finalRect.x+(finalRect.w-(srcW-x1)*scale);
@@ -268,7 +229,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.h = rowsRemainder;
destRect.h = rowsRemainder;
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
}
@@ -284,7 +244,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.x = finalRect.x+(x0*scale+c*(x1-x0)*scale);
destRect.y = finalRect.y+(y0*scale+rowY*scale);
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
if (colsRemainder>0)
{
@@ -293,7 +252,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.w = colsRemainder;
destRect.w = colsRemainder;
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
if (rowsRemainder>0)
@@ -307,7 +265,6 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
srcRect.w = (srcW-x0-(srcW-x1));
destRect.w = (srcW-x0-(srcW-x1));
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
if(rowsRemainder>0&&colsRemainder>0)
@@ -319,15 +276,13 @@ void UINineSlice::MakeSlices(std::string texture, int srcW, int srcH, int x0, in
destRect.w = colsRemainder;
destRect.h = rowsRemainder;
AddSlice(srcRect,destRect,scale);
// printf("destRect x:%d, y:%d, w:%d, h:%d \n",destRect.x,destRect.y,destRect.w,destRect.h);
}
}
}
}
// Need to take in variables: (srcRect, desiredRect)
void UINineSlice::AddSlice(SDL_Rect srcRect, SDL_Rect destRect, int scale)
{
// printf("adding a 9slice element");
auto& slice(manager.addEntity());
SDL_Rect scaledRect = SDL_Rect();
scaledRect.x = destRect.x;