Sign in to follow this  

2D grid rendering problem

This topic is 2063 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

For some reason that i cant seem to figure out but in the last 2 col the texture is not coming out right. In the second to last col the texture is the next texture in the texturesheet and the last col there is just no texture showing up at all. Can't seem to figureout a fix or why thats happening .



CDirectX::GetInstance()->GetDevice()->Clear(0,0,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_ARGB(255,255,0,0),1.0f,0);
CDirectX::GetInstance()->GetDevice()->BeginScene();
CTextureManager::GetInstance()->BeginSprite();
for(int HeightTiles = 0; HeightTiles < NumTilesHeight; HeightTiles++)
{
for(int WidthTiles = 0; WidthTiles < NumTilesWidth; WidthTiles++)
{
D3DXVECTOR3* pos = new D3DXVECTOR3(0,0,0);
D3DCOLOR color = D3DCOLOR_ARGB(255,0,255,0);
pos->x = (float)WidthTiles * TILE_WIDTH;
pos->y = (float)HeightTiles * TILE_WIDTH;

RECT rTile;
rTile.bottom = 288;
rTile.left = 256;
rTile.right = 192;
rTile.top = 256;
CTextureManager::GetInstance()->Draw(CTextureManager::GetInstance()->GetTexture(FortressImages),rTile,pos,color);
}
}
CTextureManager::GetInstance()->EndSprite();
CDirectX::GetInstance()->GetDevice()->EndScene();
CDirectX::GetInstance()->GetDevice()->Present(NULL,NULL,NULL,NULL);

//////MAIN

while ( true )
{
world.RenderWorld(); <-Function with rendercode
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if ( msg.message == WM_QUIT )
{
break;
}
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}

Share this post


Link to post
Share on other sites

This topic is 2063 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this