Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualMedo3337

Posted 07 January 2013 - 01:08 AM

I'm looking for a way to center a "cross hair" sprite.

 

I tried the following but I see that the sprite is not centered in the screen and it's scaled as well:

 

D3DXVECTOR2 position(WINDOW_WIDTH/2, WINDOW_HEIGHT/2);
D3DXVECTOR2 scale(1.0f, 1.0f);
D3DXMatrixTransformation2D(&matrix, NULL, NULL, &scale, NULL, NULL, &position);
sprites[i]->sprite->Draw(sprite->texture, NULL, NULL, NULL, color);

 

I even tried: position = position - textureSizeInPixels;

 

I am looking for a way to make the sprite appear in the center with exactly the same size as the texture.

 


#1Medo3337

Posted 07 January 2013 - 01:08 AM

I'm looking for a way to center a "cross hair" sprite.

 

I tried the following but I see that the sprite is not centered in the screen and it's scaled as well:

 

D3DXVECTOR2 position(WINDOW_WIDTH/2, WINDOW_HEIGHT/2);
D3DXVECTOR2 scale(1.0f, 1.0f);
D3DXMatrixTransformation2D(&matrix, NULL, NULL, &scale, NULL, NULL, &position);
sprites[i]->sprite->Draw(sprite->texture, NULL, NULL, NULL, color);

 

I even tried: position = position - textureSizeInPixels;

 

I am looking for a way to make the sprite appear in the center with exactly the same size as the texture.

 


PARTNERS