@ 16. 1 ~ 17. 1/게임프로그래밍의 정석

(챕터 06) 문자를 출력하는 방법

namoeye 2014. 3. 2. 22:25

drawString(0,0,"HAHA") 라는 함수로 문자가 출력이 된다면..

drawString(int x, int y, const char* str)

{

int dstX=x;

int dstY=y;

const int cWidth=8;

const int cHeight=16;

for(unsigned int i=0;str[i]!='\n';++i){
  int srcX=getImagePositionX(src[i]);

  int srcY=getImagePositionY(src[i]);

  mFontImage->draw(dstX, dstY, srcX, srcY, cWidth, cHeight);

  dstX+=cWidth;

}

}

이런식의 코드가 될것이라고...

문제는 getImagePostion()함수의 내용이다.