fnColFnt.zip - 0.34MB (http://www.zshare.net/download/6213221040322427/)
Please, if you can use the forums to store your projects, do so..
that zdshare place messes up my browser.....so much junk built into that site.
What happened ?
Maybe we should install something like the showroom for code-snippets.
Besides: this function may interest beginners, its nothing for advanced programmers.
Dont need to add anything...
Just click Additional Options... at the bottom of your message.
See look i can attach a picture:
[attachment deleted by admin]
I made a small improvement.
SETTRANSPARENCY RGB(255, 255, 255)
LOADFONT "font.png", 1
SETFONT 1
SETTRANSPARENCY RGB(255, 0, 128)
PRINTCOLOR("Red text", 0, 0, RGB(255, 0, 0))
SHOWSCREEN
MOUSEWAIT
FUNCTION PRINTCOLOR: output$, x, y, color
LOCAL tx, ty
GETFONTSIZE tx, ty
LOCAL tw = LEN(output$) * tx
GRABSPRITE 0, x, y, tw, ty
DRAWRECT x, y, tw, ty, color
PRINT output$, x, y
GRABSPRITE 1, x, y, tw, ty
DRAWSPRITE 0, x, y
DRAWSPRITE 1, x, y
ENDFUNCTION
@9940 :
have you even tested that function?
It does the opposite of color a font...it colors the background...
..also you cant use PRINT as the beginning of a function name.
Quote
It does the opposite of color a font...it colors the background...
You used a wrong font img, try this
(http://img6.imageshack.us/img6/8480/fonttzm.png)
Quote
..also you cant use PRINT as the beginning of a function name.
Rename it to COLORPRINT and add PRINTCOLOR to Gernot's bug list ;)
Do no use CAPITAL_ONLY_COMMANDS. They're mine :P
Ok i couldnt get yours to work with the glbasic fonts so i whipped up my own rendition.
However, instead of drawrect etc...try poly vectors...theyre prettier.
here is my version of what you made, you can use standard glbasic fonts with it...
i dont know what good it is...probably good for just making text images.
[attachment deleted by admin]
Are you talking about the speed?
There is a little problem in your func.
FUNCTION PRINCOOR: output$, x, y, color
[some code]
LOADFONT "smalfont.png",0
SETFONT 0
[some code]
ENDFUNCTION
This func. call LOADFONT every time is used which is a big waste of time
There is a reason why the background is pink: the default background of the sprites is pink and so there is no need to call every time SETTRANSPARENCY. Only if you use other sprite.
Benchmark for COLORPRINT (up to 30 strings on my pc)
However with PRINT you can write more than 1500 strings without suffering slowdowns...
Depends on what you have to write =D
[attachment deleted by admin]
using polyvector for coloured fonts might be slightly faster. Grabsprite or createscreen are quite expensive.
Also, instead of GRABSPRITE try CREATESCREEN. It *might* be faster.
The func. with CREATESCREEN is more slowly than GRABSPRITE and the sprites created with CREATESCREEN hasn't transparency.