Hello, I was visiting some sites to find an answer for my question and it was impossible.
I hope you can help me because I'm stucked.

I want to draw several tiles that after will be used as a 3D terrain.. how can I do it? this is my actual code and I don't know how to implement the DrawBitmap function :

I started with the following code:

``````/*--------------------------------------------*/
/* Drawing the tiles with DirectX */

/*----------------------------------------------------------------------------------*/
/* Creating the grid */
/*----------------------------------------------------------------------------------*/
int x,y;
// Display from top to bottom
for(y = 0; y < 10; y++) {
// Display from left to right
for(x = 0; x < 10; x++) {
// Your display function here
DisplayTile(x, y); //Maybe it could work if I code right the DrawBitmap function
}
}``````

Here goes the DisplayTile function:

``````/* Displaying the Tiles */
/*------------------------------*/
// Global tile map array
int g_iTileMap[100]; // 10*10 = 100 spots needed

// Prototype tile display function
void vDisplayTile(int x, int y);

void vDisplayTile(int x, int y)
{
int iTile;
int tileWidth = 64;
int tileHeight = 64;
int mapWidth = 10;

//
// Calculate the value of the tile
// at the givenx&y coordinate.
//
iTile = g_iTileMap[(x + (y * mapWidth))];

// Display the bitmap on-screen
DrawBitmap(iTile, (x * tileWidth), (y * tileHeight)); //stucked here}``````

As you can see I only need to know how to code the DrawBitmap function using DirectX. It has to be in 3D and thinking that after I have to add some camera rotation to use it as a terrain.. Can anybody help me on it please? I really would appreciate.

I forgot to tell what am I using to develope it.. It's with Dev-C++ with Directx SDK.

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by StRoYeR

You're drawing a bitmap tile map, but you want 3D terrain? Are you trying to map textures to a 3D mesh? I'm not sure what you're after.

You're drawing a bitmap tile map, but you want 3D terrain? Are you trying to map textures to a 3D mesh? I'm not sure what you're after.

Yes I think.. my idea is first to render a 2D tile grid so then I can add in each tile a texture from an .X file. After doing that I pretend to add to the grid the possibility of changing the camera view. I want to do that because later will be easier if I want to develope a map editor for it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.