Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Bitmapped fonts, howto

Author
Message
Mulderman
20
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 30th Nov 2005 08:57
Hi.
I have seen games that are using bitmapped fonts. I mean there is a bitmap.bmp file in game folder and bitmap is just full of letters (all in one) and program/game grabs font/letter from there and pastes to screen and result is nice text. I know how this is made in C++ but how this can be done in DarkBASIC or DB Pro? Should i use sprites or "good old" PASTE IMAGE? I just need some algo how this can be done. And if anybody know any code snippets already about this then let me know. Also searched in forum but nothing about this.
Thx in advance.

uSER
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 30th Nov 2005 11:07
I've got various routine in the Code Database that allow easier grabbing of bitmapped fonts - if I remember correctly they just paste images. Sprites would be advisable for non-static displays.

Mulderman
20
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 30th Nov 2005 11:21
Can u tell me at least in what section of Code DataBase?
There is alot of snippets: bitmap, sprites etc, takes alot of time to find. Maybe u remember?

uSER
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 30th Nov 2005 11:45
Mulderman
20
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 30th Nov 2005 20:33
Some errors in DB Pro but i will check it out. Maybe should rewrite all coz other's code is hard to understand.
Thanks for this code.

uSER
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Nov 2005 21:15
http://forum.thegamecreators.com/?m=forum_view&t=53380&b=5

All the bitmap fonts you could wish for. And 3/4 of the way down, there is some sample code for using them.

Mulderman
20
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 1st Dec 2005 10:41 Edited at: 1st Dec 2005 10:55
Thanx, good example but EXE and also IDE displays error in DB Pro:
"Runtime error 502: Cannot grab image due to an illegal area at line 58"
It runs for 1 sec and then displays this msgbox.
Anybody knows whats the problem?

EDIT: first time i found edit button here, very useful!!
OK, i tried other image and now illegal line is at 55. its something wrong with bitmaps, also source is not commented, oh well, i'll start examining the code.

uSER
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 1st Dec 2005 12:47
It's better to just use paste image.

I wrote this in Classic for Saberdude a while back (I looked for the thread but couldn't find it):

Attachments

Login to view attachments
Mulderman
20
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 1st Dec 2005 13:48
wow, thanks alot Grog. At least clean source that works!!!
Thank you very much.

uSER
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 1st Dec 2005 19:29 Edited at: 1st Dec 2005 19:39
Np.

Edit: I should of added to that first message that it's better to make one long picture rather than the way that was done. Saberdude provided the font so I made the code work with that picture. If I did it from scratch I would of made the characters in a single line and in their proper order. So the code would shrink down to one for/next loop for getting all the characters.

Login to post a reply

Server time is: 2024-09-24 09:29:28
Your offset time is: 2024-09-24 09:29:28