ryusten
Neophyte
8 Posts |
Posted - Jun 13 2005 : 3:43:51 PM
|
I've been using VB now for about 5 years and have become rather proficient with it. I even took the plunge and learned .NET over the past 3 months. I miss the old IDE but I cant say I dislike the new code. Anyways, on to my question.
I'm trying to mimic the board game Risk as a DirectX9 & VB program. This is simply so I can learn DirectX9 to teach myself something new. So yesterday I played around with drawing sprites/bitmaps using DirectDraw and so far that makes sense. But when it comes to drawing the game map for the board game Risk, I'm stumped. I assume it would involve a polygon & texture for each region on the board. If this is true, could anyone share some links to related resources to make this easier for me? I'm a total graphics n00b so some of the concepts for rendering still escape me. |
|
Threshold
Squire
USA
44 Posts |
Posted - Jun 13 2005 : 3:59:20 PM
|
Assuming DirectDraw in DX9 is like it was in DX7, rendering a "polygon with texture" is pretty much impossible. However, if you go to hybrid or even completely to Direct3D (DirectXGraphics in DX8), then you can do that pretty easily.
An alternative would be to simply pre-draw your map and just draw it like a plain old bitmap.
|
Life is short. They say "don't waste it, have fun." They're right, don't waste it...but DO redefine "fun." |
|
|
ryusten
Neophyte
8 Posts |
Posted - Jun 13 2005 : 4:01:58 PM
|
I had thought of that Threshold, but being the graphics n00b, how do I do boundary checks for each region on the board? if you can tell me that, I'd be happy to do a a single *large* bitmap rendering. |
|
|
dxgame
Knave
USA
73 Posts |
Posted - Jun 13 2005 : 4:45:53 PM
|
Well, one of the most easiest to understand concepts would be to just define each "region" as a sprite inside a texture resource and then draw all of these "regions" on screen like a puzzle piecing them together in their correct location on screen. Then to be able to click on each region you could define simple "box" collision areas inside each region, probably several to a region, or you could do a poly based collision routine but placing several smaller boxes inside each region might be easier to get something up and running quickly. |
|
|
ryusten
Neophyte
8 Posts |
Posted - Jun 13 2005 : 4:52:00 PM
|
I follow ya Dxgame. Just one question then. How do I make sprites in odd dimensions? I thought they all had to be powers of 2 or rectangle/square shaped. How would I do something shaped like a banana then? As far as I know that would involve a polygon (in which case I'd be using Direct3D instead of DirectDraw) and making polygon's flat is an interesting experience (or so I've read). |
|
|
dxgame
Knave
USA
73 Posts |
Posted - Jun 13 2005 : 7:20:49 PM
|
Hello ryusten,
I don't code in Dx9 sorry. ;( If Dx9 follows Direct Draw 7 a bit, then you should be able to set up a texture (surface?) and this is where the power of 2 would come into play. Create your textures in 256x256 or 512x512, etc. And then store multiple sprites inside the texture. Finally you should be able to "blit" from anywhere inside the texture. You would need to keep track of the rect cordinates for each "sprite" section inside the texture. In DirectX8 we draw the sprites using triangles, but with DX7 we used the standard Blt routines. I hope this gives you some ideas. ;) |
|
|
ryusten
Neophyte
8 Posts |
Posted - Jun 13 2005 : 8:51:13 PM
|
what is Blit and how do I use it? :) *goes searching on google*
|
|
|
ryusten
Neophyte
8 Posts |
Posted - Jun 14 2005 : 02:37:07 AM
|
ok, make a clipping rectangle for each area that can be clicked on by the mouse. Wow....um, thats gonna be alot of them. heh, oh well. |
|
|
dxgame
Knave
USA
73 Posts |
Posted - Jun 14 2005 : 1:14:12 PM
|
Well, there are certainly plenty of different ways to do this. Rectangle checking is the easiest to "grasp" from a programming point of view. But then there's also, poly areas, tile maps, byte arrays corresponding to pixel cordinates, (each byte in the array represents a pixel which represents which region you're on), etc,etc. ;) |
|
|