Jump to content
  • Advertisement
Sign in to follow this  

Using DirectX9 (Tiles) with C++

This topic is 3374 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First of all I have checked this http://www.gamedev.net/reference/list.asp?categoryid=44 But the ones that are about DirectX seems only to be using DirectDraw. I wonder if anyone know any articles, tutorials or books that teaches the reader how to create their own tileengine. I want to create (at first) a single player game that uses tiles. But as you might understand I do not find anything that is up to date that teach the reader to do this. I had help to make a similar thing in OpenGL but the coder doesn't know DirectX and I have no clue how to do this in DirectX. The type to tilebased game I want to do is similar to my opengl version. But I want to use DX9 with D3D. Here is a screenshot of the OpenGL version: http://data.fuskbugg.se/skalman01/testRender.jpg I checked the book "Advanced 2D Game Development" but it's index didn't show anything about "tile". I was going to buy the book but change my mind now. Anyone that can help me find what I am looking for? Hope this thread describe what I am looking for.

Share this post

Link to post
Share on other sites
How do you draw in OpenGL?
It should be possible to do it the same way in D3D9, just that you need to keep your vertices in an array, since you can't do immediate mode like glVertex3f(). Apart from that there's nothing special about a tile-engine, try the normal tutorials for D3D9 and it should be easy to draw quads as tiles. You can also use the sprite interface, but I would learn the basics first, it's basically the same thing but can be easier when drawing 2D sprites.
Tutorials and Samples for Direct3D 9

Share this post

Link to post
Share on other sites
Thanks for the reply. I ain't sure but I think this is what you meant.
void Render::texture(unsigned int x, unsigned int y, unsigned int id)
glBindTexture(GL_TEXTURE_2D, id);
x = x + 32 - twidth[id];
y = y + 32 - theight[id];

glTexCoord2f(0 , 0 );
glVertex2f (x , y );
glTexCoord2f(0 , 1 );
glVertex2f (x , y + theight[id]);
glTexCoord2f(1 , 1 );
glVertex2f (x + twidth[id], y + theight[id]);
glTexCoord2f(1 , 0 );
glVertex2f (x + twidth[id], y );

I will read the stuff you linked, thanks for the reply.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!