最近在研究Buratillo这个游戏时,看了一下SDL_ttf这个开源库的相关资料。% C, j1 Z( J* q. n8 t+ N
发现很多字符串输出函数,如下所列。; ?. }1 F6 I8 W8 K4 I+ O: f' s$ r
5 z4 z0 K3 k3 x0 Z$ WSolid 5 c: x; ?% \4 I0 v5 |
TTF_RenderText_Solid - Draw LATIN1 text in solid mode $ f+ R8 k8 p/ C0 t( D
TTF_RenderUTF8_Solid - Draw UTF8 text in solid mode 7 y3 I; ?: u0 a" q4 S
TTF_RenderUNICODE_Solid - Draw UNICODE text in solid mode 6 J0 O" O: M9 z* o0 g: W
TTF_RenderGlyph_Solid - Draw a UNICODE glyph in solid mode ( w3 Q9 r- J/ n0 V3 L: l
" Y$ e% h+ R0 h2 ZShaded
( m1 F! V" ]4 i; B* eTTF_RenderText_Shaded - Draw LATIN1 text in shaded mode
7 M5 h- A. R7 d* i8 OTTF_RenderUTF8_Shaded - Draw UTF8 text in shaded mode
+ h) S3 p7 d/ L, C4 C5 w% A1 QTTF_RenderUNICODE_Shaded - Draw UNICODE text in shaded mode 4 X' [ p8 _& x3 }5 l- @1 O0 m9 C
TTF_RenderGlyph_Shaded - Draw a UNICODE glyph in shaded mode
% u- ^) R z, m& e% B6 `! }* F
1 s8 Y" N& J* y3 q; HBlended
# x& J& t' y5 y! eTTF_RenderText_Blended - Draw LATIN1 text in blended mode 4 a3 t$ w% g; b( S$ \+ P' o/ k0 D9 Z
TTF_RenderUTF8_Blended - Draw UTF8 text in blended mode 0 i, q) ?0 p) q; M1 r+ \& {
TTF_RenderUNICODE_Blended - Draw UNICODE text in blended mode
3 G2 z, L6 X e6 }" FTTF_RenderGlyph_Blended - Draw a UNICODE glyph in blended mode
; ]* z# z H8 V1 g% b5 P1 F0 C* l+ S3 M* a8 k* g/ ?2 I+ _' A
具体资料可以参考这里0 U. y E& ?2 z% V
http://sdl.beuc.net/sdl.wiki/SDL_ttf_Functions_Render6 M6 r" e/ ~0 ^" |' _6 ?% p
# p0 `/ o* u4 X这些函数的参数基本都是相同的,都会传入一个字符串。( l' j: Z3 C) k7 \7 G
比如这个$ k/ Q7 z6 X3 S1 m
SDL_Surface *TTF_RenderUNICODE_Solid(TTF_Font *font, const Uint16 *text, SDL_Color fg);( ]+ e6 z. {- x, v* v8 y- e
. Y) G3 O- x. J8 Q
由于这个库是开源的,我们只要找到相同版本的库,修改游戏所使用的那个函数的代码,0 O. Y! M+ i) @
把英文字符串替换为中文的,应该就可以实现汉化了。 |