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 / Problem with text disappearing after the first time

Author
Message
bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 4th Dec 2010 04:50 Edited at: 4th Dec 2010 11:50
UPDATED

I have a simple menu at the starting point of the game and it displays text, an image and a rotating 3d object.

as soon as the 3d object is on the screen, the text disappears; would anyone be able to tell me why this is happening?

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2010 12:34 Edited at: 4th Dec 2010 13:00
Your repeat/until loop refreshes the screen each frame so your text is wiped. Just put the text commands inside the loop so they get re-written each frame.

Edit Something like this should work (which should run on its own):



Remove the draw to back and backdrop off commands if you want the text and sprite in front of the revolving object. You might need to turn the backdrop back (depends what else you are doing).
bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 5th Dec 2010 02:37
Many thanks for that

I need the 3d in the background for the actual game, so much appreciate the explanation of the backdrop and draw to back commands.

Would you know if there anywhere this kind of stuff is documented? It would be really handy to know the command sets available with an associated explanation without having to know they exist first.

Thanks again.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Dec 2010 11:59
Quote: "Would you know if there anywhere this kind of stuff is documented?"


I usually start with the Help files then when I'm stuck ask the forum - just like you did. Sometimes a bit of experimentation is all that's needed if the Help file is unclear.

If you're new to DBPro it's worth just browsing the Help file and playing with some of the commands. It's also worth looking at the Examples section of the Help files. Just go to DBP Help>Examples and scroll down to a topic of interest. Then click on the large icon image and the code will appear. You can then compile and run it in the usual way.

It's also worth looking at the tutorials available on the Newcomers board. There are also the "Hands On" books you can buy. I find the Forum is the best source though.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 5th Dec 2010 16:08
Everything GG said, with one note - the Hands On volume 1 is now available electronically, without the shipping charge! If want something to teach you the basics, it's great.

bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 6th Dec 2010 04:15 Edited at: 6th Dec 2010 11:30


Rule one: Don't make posts while having a bad day at work, or you end up with the one like that below...

Thanks for the replies. I have picked up the Hands On volume and it is very explanatory.

<whinge>

I guess what I was leaning towards was more definitive information on, for example, ordering of sprites, without having to search through the forums (which can be a long-winded exercise) or stumbling across the Set Sprite Priority. Another example would be that arrays start from 0 to the number given (which is slightly different to be C and BASIC) or the scope of functionality included in the debugger. The CLS command only seems to work with a colour given and does not remove 3d images; there is no reference point to go to for locating clearing of 3d emitters.

I think that Dark Basic doesn't do itself a lot of favours with the sparsity of the information. I only stumbled across the project options icons at the bottom of the browser the other day; would have been handy to know about up front.

It is meant to be a Pro package, but it could be much better.
</whinge>
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Dec 2010 11:44
Quote: "Rule one: Don't make posts while having a bad day at work, or you end up with the one like that below"


Rule two: Don't make posts after midnight.

I'm often guilty of that one.
GrumpyOne
18
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 6th Dec 2010 16:52
Rule three: avoid showing off...there's always someone who knows more than you. For example, I will give some advice...watch as everyone disagrees.

Text is one of the first things you run into with DBPro that you'll be disappointed with. On their own print and text commands aren't really suitable for use in a game.

If you want text to stay put on the screen I'd suggest contructing your text from character sprites. This can be a bit tricky but you'll find lots of posts on character sprite fonts.

The lazy programmers solution is to print your text to a bitmap, grab an image from the bitmap, and load the image into a sprite. Hey presto...the text stays put. The only problem with this is it is slow...you really don't want to update a lot of text like this every timestep or you'll have a noticeable slow down. Anyway the code below shows how to do it.



Actually this is a very useful bit of code....it can also be used to grab images of objects on your screen.


Best,
Mr Grumpy

GrumpyOne - the natural state of the programmer
bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 6th Dec 2010 22:53
Thanks; I have replaced most of the game text with images where I needed to do a glow effect and the like. Is is really just the score that is shown in text now.

I think there is an additional text DLL that utilises D3D for more efficient text handling that I will check into.

Appreciate the feedback.

Login to post a reply

Server time is: 2026-07-21 13:38:45
Your offset time is: 2026-07-21 13:38:45