i made the function that is fully working(as much as i know)
that i was looked some time ago.
anyway it needs some other code then only the function:
Function is fully working!!
the function:
function textimg(str as string,x as integer,y as integer,size as integer,font as string,color as dword,priority as integer,imgcolkey as dword,centerflag as integer,imgnum as integer,sprnum as integer)
create bitmap 1,200,100
set text size size
set text font font
ink color,color
box 0,0,text width(str),text height(str),imgcolkey,imgcolkey,imgcolkey,imgcolkey
text 0,0,str
get image imgnum,0,0,text width(str),text height(str),1
delete bitmap 1
sprite sprnum,x,y,imgnum
if centerflag=1 then offset sprite sprnum,sprite width(sprnum)/2,sprite height(sprnum)/2
set sprite priority sprnum,priority
endfunction
parameters:
1.str is the string u want to show.
2.x is the x coord where u want the text.
3.y is the y coord where u want the text.
4.size is the size of the text.
5.font is the font of the text.
6.color is the text color(fill with rgb(..,..,..)).
7.priority is the sprite priority of the text.
8.imgcolkey is the color rgb value for transperncy(the same that used with the "set image colorkey" command, just with rgb(..,..,..).
9.centerflag is if u want to offset the text and to put on the middle of the x y text(set to 1) or from the left upper side of the text(set to 0).
10.imgnum is the image number the text will be on.
11.sprnum is the sprite number the text will be on.
here how it works:
set image colorkey 255,0,255
sync on
do
cls
textimg("hello",mousex(),mousey(),30,"Times New Roman",rgb(255,255,255),2,rgb(255,0,255),1,3,3)
sync
loop
function textimg(str as string,x as integer,y as integer,size as integer,font as string,color as dword,priority as integer,imgcolkey as dword,centerflag as integer,imgnum as integer,sprnum as integer)
create bitmap 1,200,100
set text size size
set text font font
ink color,color
box 0,0,text width(str),text height(str),imgcolkey,imgcolkey,imgcolkey,imgcolkey
text 0,0,str
get image imgnum,0,0,text width(str),text height(str),1
delete bitmap 1
sprite sprnum,x,y,imgnum
if centerflag=1 then offset sprite sprnum,sprite width(sprnum)/2,sprite height(sprnum)/2
set sprite priority sprnum,priority
endfunction
Thanks for Xenocythe who made understand how to make it to work.
lol?! xD