PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PocketFrog: draw text on surface?

Hi!

I'm trying to display a text on a surface object; what i need is something like ExtTextOut or similar..

Do you have a place where i can learn (tutorial, example or simple manual, i can't find on the pocketfrog one!!)

I found a exttextout method in pocketfrog, but i can't figure how it works.

Thanks for your time.
Well, it looks like i didn't search very well until today; finally i found a tutorial about it ;)

With google, first link using "pocketfrog exttextout" as search keys.
You can also use DrawVGAText after setting the target to your surface (SetRenderTarget()) or using CreateRasterizer.
Glad you found my tutorial and I hope it helped. The whole point of my tutorials is to save other people from having to do all the figuring out themselves making it quicker to get on and use PocketFrog :)
Sorry Conan, i didn't know you was the same Conan of the article.

Thanks again for your tutorials :)
I use gersens's bitmap font class, because it's times faster than VGAText.
Have you measured the difference? Just curious...
fast_rx wrote:Have you measured the difference? Just curious...


Sorry for misleading guys - it seems to me that I've run wrong tests before.

I've done one rough test on A620(200mhz mode), both tests run at pretty the same framerate.

And I remembered why I thought that VGAText is slow- for some reason "supersample" runs on a low framrate(entrance screen).
Attachments:
VGAFont.gif
GersensFont.gif
If you are writing a game with text which will appear on screen every frame during the action then I agree that Thomas's (aka Gersen) fonts will be faster. Using GDI text allows lots of variations so I use then for menus and stuff which is more static.
I wrote the DrawVGAText function, as well as supersample...

Thwt function is slower because it calls SetPixel (or whatever it is, I forget) for every pixel in the characters. Without question it's going to be slower most of the time by some degree. Although, as compared to GDI I'd bet the difference isn't sever 99% of the time... looks like your difference was 2FPS... I'd be willing to bet that if you put the same amount of text on the screen with DrawVGAText as with gersen's function you wouldn't drop below 27FPS anyway. 2FPS might be a big enough different for you to worry about though.

That being said, I am able to fill a screen with a background image, then put text over the entire thing with a random color in each pixel and still pull 30FPS on an old Casio E-125, so clearly it isn't THAT bad :) In fact, all of my games released to date use that function with no ill effect... Invasion: Trivia is coded to run at 30FPS, I think K&G; Arcade is 24FPS.

Supersample was hardcoded to I believe 30FPS because that's the speed I wanted it to run at... I wanted it to be a known rate so if you tried it on a device and saw something less you'd know something was up with that particular device.
Thanks for your info, Frank. And about my screenshots - they do not provide accurate framerate, just some rounding sorry(just to show you the test in action) :)
No problem :)

Keep in mind one of the benefits of DrawVGAText is that it makes some effects extremely easy... Since you have the source, it's trivial to do things like per-pixel coloring or fake raster bars through the text, or text dissolves, or (one of the coolest) animations based on altered character data...

Basically, if you ever did any coding on the C64 or in DOS days you will probably appreciate this function... your font data is just like the font data you used to be able to manipulate in all sorts of crazy ways.

Also, since it's always a known font size, sometimes it can make things easier because you can always simply determine how much space your text will take up.

Certainly it's not perfect for every case, and when I added it to PF I did so with the idea that (a) there was no built-in text drawing functionality at that point so ANYTHING was better! and (b) it enables some cool effects that otherwise wouldn't be possible or would be more difficult.
It would be great to see some of these effects in action maybe in some supreme sample with PocketFrog 0_9_x! :wink:
I haven't looked at your code yet and maybe missed some of it's great functionality, just because I haven't any chance to see it in action )))

And really thanks for adding this to PF )
That's actually what supersample was supposed to be... maybe I'll find some time and throw together some new screens in that... might be fun to try and duplicate some of my old C64 demos :)

You are more than welcome in any case :)