# Problems with a Function in Directx

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

## Recommended Posts

Hello, can anyone help me? the problem is that I don't know how to code the right DrawBitmap Function to display 3D tiles with Directx: Here goes the code: // 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 // The following function is fictitious // and is only meant as pseudocode. You // need to replace it with a real drawing // function in order for the code to work. // DrawBitmap(iTile, (x * tileWidth), (y * tileHeight)); //pseudo-code extracted from the book written by Todd Barron /*-----------------------------------------------------------------------------------*/ /* 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 } } I hope somebody can help me. Thanks in advance.

##### Share on other sites
First off, you'd probably be doing yourself a favor by asking a question such as this one in the DirectX forum.

Second...I would look into the ID3DXSprite functionality in the D3DX helper library, especially if you're inexperienced with Direct3D. Also I can't help but wonder why you'd be using Direct3D (I'm assuming you want to use Direct3D) for drawing bitmaps. There's certainly other easier-to-use libraries that can accomplish that same end-result.

##### Share on other sites
Quote:
 Original post by MJPFirst off, you'd probably be doing yourself a favor by asking a question such as this one in the DirectX forum. Second...I would look into the ID3DXSprite functionality in the D3DX helper library, especially if you're inexperienced with Direct3D. Also I can't help but wonder why you'd be using Direct3D (I'm assuming you want to use Direct3D) for drawing bitmaps. There's certainly other easier-to-use libraries that can accomplish that same end-result.

According to your words, I'll ask to a moderator if it could be to move this thread or the first post to the DirectX forum.
And of course, I want to use Direct3D (but I'm not sure because I'm new at DirectX programming) All what I want to do is to draw several lines or squares that after will be used as a terrain.

If anyone else can help me to code it, that'll be fine.

##### Share on other sites
Moved to the DirectX forum.

• 39
• 15
• 9
• 23
• 10