|
죄송합니다. 아직까지 질문의 요지를 잘 이해하지 못하였습니다.
MapColor를 TColor **Position 처럼 표현 하신다는 말씀은 무슨 말씀이신지요?
만약, 이차원 배열을 사용하시려면 쥬신님께서 먼저 올려주신 소스처럼
TColor **Position;
Position = new TColor*[rX];
for(int j = 0; j < rX; j++)
{
Position[j] = new TColor[rY];
}
위 사용하셨던 소스 그대로 재사용하시면 될 것 같습니다.
cuperido
쥬신 님이 쓰신 글 :
: TColor __fastcall CImageDraw::SelColor(int x, int y, int Index)
: {
:
: TColor Color;
: Color = clWhite;
: int nX = MaxPoint.x;
: int nY = MaxPoint.y;
: TColor* MapColor; //TColor** Position;이렇게 표현은 못하나요?
: TColor Position[100][100];
: MapColor = new TColor[x*nX+y];
:
: for(int i = 0; i< x+1; i++)
: {
: for(int j = 0; j< y+1; j++)
: {
: MapColor[i*nX+j] = Position[i][j];
: Position[x][y] = clLime;
: if(i%2==0)
: Position[i][j] = clLime;
: else
: Position[i][j] = clRed;
: if(j%2==0)
: Position[i][j] = clLime;
: else
: Position[i][j] = clRed;
: }
: }
: return Color;
: }
:
:
:
:
:
:
:
:
:
:
:
:
:
: : : : : : :
: : : : : : : TColor __fastcall CImageDraw::SelColor(int x, int y)//x, y는 map이미지의 좌표를 생각했습니다.
: : : : : : : {
: : : : : : : TColor Color = clWhite;
: : : : : : :
: : : : : : : int rX = 1+x;
: : : : : : : int rY = 1+y;
: : : : : : :
: : : : : : : TColor **Position;
: : : : : : : Position = new TColor*[rX];
: : : : : : : for(int j = 0; j < rX; j++)
: : : : : : : {
: : : : : : : Position[j] = new TColor[rY];
: : : : : : : }
: : : : : : :
: : : : : : : for(int i = 0; i<rX; i++)
: : : : : : : {
: : : : : : : for(int j = 0; j< rY; j++)
: : : : : : : {
: : : : : : : if(i%2 == 0)
: : : : : : : Position[i][j] = clRed;
: : : : : : : else
: : : : : : : Position[i][j] = clLime;
: : : : : : : if(j%2 != 0)
: : : : : : : Position[i][j] = clLime;
: : : : : : : else
: : : : : : : Position[i][j] = clRed;
: : : : : : : Color = Position[i][j];
: : : : : : : }
: : : : : : : }
: : : : : : :
: : : : : : : return Color;
: : : : : : : }
|