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 / text on top of sprites?

Author
Message
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 13th Aug 2007 22:31
Could some one kindly tell me how to get text on top of sprites..

I tried the sprite show then text, and also text then sprite in my code. Seems they are both on the same layer and the sprite is always on top.
psx
17
Years of Service
User Offline
Joined: 16th Apr 2007
Location:
Posted: 14th Aug 2007 10:10
I'm not sure, but there is a command in core section -
dbDrawSpritesLast(). Try it.
psx
17
Years of Service
User Offline
Joined: 16th Apr 2007
Location:
Posted: 14th Aug 2007 10:18
No, sorry, you should try dbDrawSpritesFirst(), to draw sprites, and then your text
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 14th Aug 2007 14:35 Edited at: 14th Aug 2007 14:49
No that seem to put them behind 3d..

I need 3d->sprites -> text. Or better yet 3d -> sprites -> 3d(2) - text. But no such luck.



I also don't see the difference in dbDrawToFront and dbDrawSpritesLast. They both see to do the same thing, just worded different.

dbDrawSpritesFirst coudl be for sprites, and dbDrawToFront does both not sure.
psx
17
Years of Service
User Offline
Joined: 16th Apr 2007
Location:
Posted: 14th Aug 2007 23:19
Hey here is a decision.
If you prepare your text on the sprite, you can then set
sprites drawing priority with command avaiable.
So what you think. Is this it.
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 15th Aug 2007 14:43
Not sure I follow.

"prepare your text on the sprite," like in the image? that wont work if its dynamic text. Is that what you mean?
psx
17
Years of Service
User Offline
Joined: 16th Apr 2007
Location:
Posted: 16th Aug 2007 08:51
that will work
in every pass:
First make bitmap;
then print your DYNAMIC text on it;
Use GetImage to that bitmap;
Update your Text_Sprite with this new image;
And Sync;

This is it. Well, I dont see another way.
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 16th Aug 2007 14:37
This is the part i'm missing?

First make bitmap;
then print your DYNAMIC text on it;

If I could do that I would not need to do the rest? Simply I cant put text on top of a sprite. Unless there is a make bmp that I dont know of?
James Bondo
18
Years of Service
User Offline
Joined: 12th Nov 2006
Location: Denmark
Posted: 16th Aug 2007 17:17 Edited at: 16th Aug 2007 17:19
There is a Make Bitmap command.
This will create a bitmat that only exists in memory. Paste your image to this bitmap, print the text on the bitmap, get image from the bitmap and use that for the sprite.

Using Dark GDK.NET
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 17th Aug 2007 15:25 Edited at: 17th Aug 2007 15:26
This is a neat thought. Problem is when I do the dbCreateBitmap draw the image and then draw the text it goes behind the image once again. I then thought maybe i could put the text on another bitmap and swap depths. Guess that was wishful thinking. No such command.
James Bondo
18
Years of Service
User Offline
Joined: 12th Nov 2006
Location: Denmark
Posted: 17th Aug 2007 15:49
Okay... i dont know what it is that your are dong, but if you paste an image, print some text, get image again and the text is underneath the first image, your certainly doing it wrong.

I know this is DGDK.NET in C#, but it works and it uses the exact method i just described. Its not efficient, and im sure some of those DBPro sharks could make it more efficient Just an example i quickly threw together.


This code makes a texture with the text "Image1".
Then every single loop, i create a new bitmap, paste the first image, print the FPS as text on the bitmap reget as new image and uses that as texture.
I dont see why this should work differently for a sprite.

Using Dark GDK.NET
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 17th Aug 2007 17:07 Edited at: 20th Aug 2007 18:08
Yes its not to hard to convert over but the trouble I have is here..


unless I can draw my image to the screen using another method other them sprites, I'm sunk. I guess i could use poly planes and textures buts that just silly... Or maybe drawing the sprite putting it in an image, then the txt in img2. then some how putting them both in one image, then on the sprite.

Actually I possibly could just load my spite as in image instead and try that.


Your basic idea was correct



this does just as you suggest puts text on top of an image and then in to a sprite, but you cant put text on top of sprites. The reason I needed this is images allow transparency of the color black. I need the translucent info in the png to show and only sprites offer that. If I load an image in to a sprite I get it, if I load the image and use dbPasteImage and dbGetImage, it discards this info. So again I'm looking for a way to put text on top of a sprite.
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 22nd Sep 2007 03:22 Edited at: 22nd Sep 2007 03:30
There is a simpler way .

# 1. using " dbSprite " to create a sprite.
# 2. using " dbHideSprite " to hide the sprite be created before.
# 3. using " dbPasteSprite " to draw the sprite in the loop before drawing text ,so that ,the text will be on the top of the sprite .( If you do not hide the sprite in step #2 ,the sprite will be drawn twice.)

unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 22nd Sep 2007 05:58
Really now? Going to test this one, thx man...

Login to post a reply

Server time is: 2024-11-19 16:29:18
Your offset time is: 2024-11-19 16:29:18