반응형
- xxd 리눅스 명령어을 활용하여 리소스 파일을 임베드한다.
- 윈도즈에서 사용하려면 git bash 등을 활용한다.
$ xxd -i Sansation.ttf > Sansation.ttf.h
$ cat Sansation.ttf.h
unsigned char Sansation_ttf[] = {
0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x04, 0x00, 0x10,
... ...
0x01, 0x02, 0x00, 0x00
};
unsigned int Sansation_ttf_len = 28912;
- Sansation_ttf 는 byte(char) array
- Sansation_ttf_len 는 array 길이
// font
sf::Font mFont;
if (!mFont.loadFromMemory( Sansation_ttf, Sansation_ttf_len ))
{
// Handle loading error
}
// texture
sf::Texture mTexture;
sf::IntRect eagleRect( 0, 0, 48, 64 );
if (!mTexture.loadFromMemory( Eagle_png, Eagle_png_len, eagleRect ))
{
// Handle loading error
}
728x90
반응형