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.

Dark GDK / Using dbText in a 2D program.

Author
Message
Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 28th Mar 2008 09:12
Greetings! I recently made my first game thanks to GDK (woohoo!) and am looking into adding text and eventually a menu/HUD system to it. However I can't get dbText to work. The code in question looks like this:



This doesn't display at all. I think it may be hidden behind the background and sprites, but if so, how can I change this? I also tried adding it after dbSync() and calling dbCLS() afterward and it didn't change anything. Do I need to set a font before dbText will work? I'm not sure why this isn't working. Thanks for your help!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Mar 2008 13:28
1: Try calling dbSync() TWICE followed by a dbWaitKey() or something along those lines to see it print.

Also remember if the 3d stuff is going - imparticularlly the backdrop is on - the screen gets cleared each go around... so you need to - or maybe should at least consider - writing the same stuff to the screen - to the same positions etc - each loop.

I've recently started putting GAME stuff above my sync, and print stuff below my sync - no reason - but keeps it together.

Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 29th Mar 2008 06:06
Figured it out: the text was being drawn to the background buffer before the background and sprites, so it was immediately overwritten. I wrote a little text handler that makes an image from a bitmap that you can write text to and displays it. It's not perfect, but it gives you an image of the text that can be displayed as a sprite. Just pass it a string and an image of that string will be saved as image number 90. Then you can use dbSprite() in your main loop to make it draw wherever you like.

Login to post a reply

Server time is: 2024-11-20 05:19:43
Your offset time is: 2024-11-20 05:19:43