Using DirectX9 (Tiles) with C++

Started by
1 comment, last by FrozenSnake 14 years, 9 months ago
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.
Advertisement
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
ID3DXSprite
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];	glBegin(GL_QUADS);			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              ); 	glEnd();}


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

This topic is closed to new replies.

Advertisement