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.

DarkBASIC Professional Discussion / Text in 2D/3D Programs - Best method?

Author
Message
Veneticus
23
Years of Service
User Offline
Joined: 29th Jan 2003
Location:
Posted: 12th Nov 2003 06:23
What is the best method for printing text to the screen? Here's some ways to do it I've thought of, and some drawbacks:
1) Use the "text" commands in DBPro.
Problems: Changing fonts/size kills framerate - can't use different fonts/sizes on a single 3d screen. Also, you can't rely on the user's computer having the font you want.
2) Use a "bitmap" font, and cut/paste images from the font as needed.
Problems: Multiple sizes require multiple fonts. Changing the color of the font. Creating the fonts in the first place.
3) Create the word(s) you want as a bitmap. Load as a sprite, and set the sprite color as needed.
Problems: Not flexible for when you don't know the text in advance. Too many bitmaps.

So, what am I missing? What's the best way to have flexible text that has the following properties:
1) Can set the color
2) Can fill the screen with variable text
3) Can be multiple sizes on a single screen
4) Can be used for a single character up to a whole paragraph

Any thoughts?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Nov 2003 09:03
How about drawing your alphabet using the text command at the start of your program in the appropriate fonts and using GET IMAGE to grab them?

Then you can simply reserve a run of 256 image numbers for your first font, the next 256 for the next font etc, making a conversion from ascii->image number simple for when you are pasting the image to the screen.

Login to post a reply

Server time is: 2026-07-28 06:15:37
Your offset time is: 2026-07-28 06:15:37