|
|

楼主 |
发表于 2005-3-18 07:02:00
|
显示全部楼层
Re:Asphyre 引擎沟通专用主题
诶!
多谢大家啊!
努力学习,呵呵.
发我的显示汉字引擎!
正在研究怎么输入汉字!
function Draw(Image: TAsphyreImage; Xpos, Ypos, Pattern, Op: Integer; color: TColor4): Integer;
begin
Result := FDriver.PowerDraw.Device.TexMap(Image, pBounds4(Xpos, Ypos, Image.Width, Image.Height), color, tPattern(Pattern), Op);
end;
function draw_text(x,y:integer;text:string;color: TColor4):integer;
//中文字索引:全角
function china_font_index(str:string):integer;
begin
Result:=(ord(str[1])-129)*126+(ord(str[2])-129);
end;
//英文字索引:半角
function English_font_index(str:string):integer;
begin
Result:=ord(str[1])-32;
end;
var
len,i:integer;
begin
len:=0;
while len<>length(text) do
begin
i:=len+1;
if ord(text)>128 then
begin
draw(FDriver.china_font_index,x+len*6,y,china_font_index(COPY(text,i,2)),opSrcAlpha or opDiffuse,color);
len:=len+2;
end
else
begin
draw(FDriver.english_font_index,x+len*6,y,English_font_index(copy(text,i,1)),opSrcAlpha or opDiffuse,color);
len:=len+1;
end;
end;
Result:=len*one_char_size;
end;
可以显示不同颜色的汉字呵呵!
字库生成的那软件还是麻烦各位去我QQ或群里要!
因为实在是传不上来! |
|