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 / Creating text as a sprite on the fly

Author
Message
Soyuz
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 28th Jun 2003 00:58
I am sure there's a pretty easy way to do this.

I'm creating a menu that's having an increasing number of buttons each of which basically consist of text on a coloured background. So instead of my current method of creating a bmp for each button, I'm wondering if there's an easy way to create a sprite button using the button text retrieved from a string array.

"on the fly" - just because I'd like to be able to update the string on the fly and have it create the necessary sprite button on demand.

Hope that makes sense to someone!

Also while I'm at it I'm wondering what the best method is to create a file load menu (saved level/game). Say I want to list to screen the releavant files stored in a specific diectorty. I don't want to just print a bunch of text - I'd like to make a nice fancy user freendly menu. So I'm considering if a similar approach to above would work where by I represent each file as a nice friendly button (sprite) to click on to load.

So to summarize - Is there a method to make a sprite from text stored in a string? - or similar more appropriate technique.
Bloodshot
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United Kingdom
Posted: 28th Jun 2003 01:47 Edited at: 28th Jun 2003 01:50
Here you go Soyuz. I've created it to give you some nice looking "Outlined" text, with just the Print command.
You can adapt the code to include your menu buttons too.


andrew11
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 28th Jun 2003 01:53 Edited at: 28th Jun 2003 01:55
Darn! I posted too late! Oh well.

First, you would need a blank image (no text) for the button. Then you would put text, get the image, paste the image over the blank one, and get the image again.

Here's an example:


"All programmers are playwrites and all computers are lousy actors" -Anon
Click Here!!!
Soyuz
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 28th Jun 2003 12:08
Thanks guys. Busy today but I'll give these a good road test later.

Login to post a reply

Server time is: 2026-07-17 23:54:25
Your offset time is: 2026-07-17 23:54:25