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.

2D All the way! / dbText, dbPasteSprite and dbSprite ordering

Author
Message
Iuzidal
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location:
Posted: 9th Jul 2009 01:38
I'm working on a tile based rpg in gdk. My map has 3 layers: terrain, objects and npcs. I draw the bottom terrain layer using dbPasteSprite for performance reasons. The other layers use unique sprites on top of that for characters, spell effects, items, etc. I'd like to have the GUI use dbText on top of this for a chat box, character sheet, shop menus, etc.

I use dbDrawSpritesLast to see the sprites on top of my pasted map layer, but this causes the dbText to vanish. Is there a way around this?
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Jul 2009 10:11
If it's anything like regular Darkbasic... sprites are always drawn last normally so they are always above any text or pasted images. Try hiding the sprites and pasting them instead before any text.

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Jul 2009 12:48
I'd use a sprite for the background too, with backsave disabled. Set the background sprite priority to 0 and all other sprites to 1 to get the correct ordering.

Then I'd use dbText to draw text normally on top of that (ie, not use dbDrawSpritesLast).

When the GDK is updated to 7.4 then you can use higher sprite priorities, but don't do it until then or else you'll find things will get slow.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 28th Jul 2009 23:18
If you paste sprites you can print text over the top no problems. if you use just sprite then they will always draw over the text. Annoying that there is no way to set the text to always overwrite sprites but hey ho. I am messing about with an editor that is using sprites at the moment. I have not worried too much about the text problem yet and plan to write a routine to make a sprite from the text and use that instead. It's a work around as although paste sprite works great using text, I need to be able to change priority dependant on the players position, as in walk behind a bush etc.

http://s6.bitefight.org/c.php?uid=103081
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 30th Jul 2009 15:50
In DGDK, use directx text, it is antialiased and whenever you draw it, it appears above things drawn below it (getting past the problem). And it is much much faster.


Your signature has been erased by a mod
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Aug 2009 19:05
I think it's nearly always best to paste sprites, you get all of your speed back.

Login to post a reply

Server time is: 2024-04-19 08:40:43
Your offset time is: 2024-04-19 08:40:43