2014-12-27 2 views
0

cocos2d-x 라이브러리에서 찾은 파일에는 FPS 이미지의 16 진수 형식 배열 인 ccFPSImage.c라는 파일이 있습니다. Cocos2D-x는 FPS를 표시하는 데 사용합니다.cocos2d-x에서 ccFPSImage.c 파일을 생성하는 방법

나는 그 파일을 어떻게 생성 할 수 있는지 알고 싶다.

unsigned char cc_fps_images_png[] = { 
    0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 
    0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x03, 0xe7, 0x00, 0x00, 0x00, 0x36, 
    0x08, 0x06, 0x00, 0x00, 0x00, 0xa5, 0x74, 0xe8, 0xab, 0x00, 0x00, 0x0a, 
    0x41, 0x69, 0x43, 0x43, 0x50, 0x49, 0x43, 0x43, 0x20, 0x50, 0x72, 0x6f, 
    0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x48, 0x0d, 0x9d, 0x96, 0x77, 0x54, 
    0x53, 0xd9, 0x16, 0x87, 0xcf, 0xbd, 0x37, 0xbd, 0xd0, 0x12, 0x22, 0x20, 
.... (There are a lot of hex values here, I just omit them here) 
} 

나는 .H 파일을 생성 ImageMagick이 도구를 사용하여,하지만이로드 될 때, 그냥보고 :

cocos2d: the file is not a dds file! 
cocos3d: the file is not a ktx file! 
Image WARNING: unsupport true color tga data pixel format. FILE: 
Fails: init fps_images 
cocos2d: the file is not a dds file! 
cocos3d: the file is not a ktx file! 
Image WARNING: unsupport true color tga data pixel format. FILE: 
Fails: init fps_images 
cocos2d: the file is not a dds file! 
cocos3d: the file is not a ktx file! 
Image WARNING: unsupport true color tga data pixel format. FILE: 
Fails: init fps_images 

내가 사용

파일의 내용은 다음과 같이이다 다음 명령을 사용하여 .h 파일을 생성하십시오.

convert fps.png h:->fps.h 

유효한 ccFPSImage.c 파일 이자형?

감사합니다.

+0

"data/file to .h"변환기가 작업을 수행 할 수 있습니다. – LearnCocos2D

+0

@ LearnCocos2D 예를 들어 주시겠습니까? MacOSX를 사용하고 있습니다. – zilongshanren

+1

https://www.google.de/search?q=file+to+.h+converter&ie=UTF-8&oe=UTF-8&hl=en&client=safari#hl=en&q=file+to+c+header+converter – LearnCocos2D

답변

0

지금까지 ImageMagick의 "h : file.h 파일 변환"은 GIF 또는 PPM 이미지가 포함 된 헤더 파일을 만듭니다.

ImageMagick 버전 6.9.1-10은 예상 한 파일을 생성하는 새로운 "-define h : format = PNG"옵션을 지원합니다.

convert fps.png -define h:format=PNG -define png:exclude-chunks=all h:fps.h 

(이하 "-define PNG : 제외-덩어리가 모든 ="날짜를 수정/원치 않는 보조 PNG 덩어리가 생성 포함 등을 생략하는 변환의 원인이됩니다)

JPEG 출력도 지원됩니다 를 통해 "- 정의 h : 형식 = JPG".

관련 문제