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 / Hide parts of graphics created by dbCircle, dbBox, etc..

Author
Message
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 20th Jul 2009 09:42 Edited at: 29th Jul 2009 23:35
Hi guys, I've run into a bit of a snag. I'm using dbCircle to draw..well..circles in my game. They are being used in a radar screen to show the orbit paths of planets, and are drawn ontop of a square created with dbBox. I was wondering if you could think of any way to hide the parts of the circle that end up outside of the box.

Here's an example of what I mean:


See how the rings are extending out of the window? I'd like to hide the extraneous bits somehow.

Thanks

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 20th Jul 2009 12:56 Edited at: 20th Jul 2009 12:56
Draw the circle yourself! The easy option is to use a sprite for the radar rings and then it's just a case of resizing the sprite and changing the UV for each vertex so it looks right. The other method is to essentially do what GDK does to draw the circle which I believe is to draw a wireframe hoop of an object, but it may be purely 2D, who knows.

Try looking at the source code for Cloggy's D3D DLL he made for DBPro, it's not written for GDK but you should be able to port most of the functionality without changing too much.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Jul 2009 17:05
this is in basic, but there a bit of code that shows how to draw part of an arc.

http://forum.thegamecreators.com/?m=forum_view&t=153805&b=6

Dark Physics makes any hot drink go cold.
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 21st Jul 2009 00:16 Edited at: 29th Jul 2009 23:35
Quote: "Draw the circle yourself!"

That's probably what I'll do, thanks

Quote: "The easy option is to use a sprite for the radar rings and then it's just a case of resizing the sprite and changing the UV for each vertex so it looks right."


I'm interested by this suggestion, I didn't know UV data was available when drawing sprites in DarkGDK?

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 21st Jul 2009 01:47
Yes, you can adjust the UV of sprites in GDK, dbSetSpriteTextureCoord() is the command you want.

If it ain't broke.... DONT FIX IT !!!
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 21st Jul 2009 02:10 Edited at: 29th Jul 2009 23:35
Interesting, I had no idea ^^.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 21st Jul 2009 19:44
The Dark Invaders demo uses UV to display bitmap fonts as sprites.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 23rd Jul 2009 10:25
Why not draw to a bitmap, then make a sprite out of the bitmap and put it on there?

Login to post a reply

Server time is: 2024-10-01 08:42:16
Your offset time is: 2024-10-01 08:42:16