[gameprogrammer] Re: ID3DXSprite translation problem

it sounds like your project matrix is not what it should be for the
operation you are trying to do

On Sun, Jun 1, 2008 at 4:34 AM, Roman Hwang <hwang.roman@xxxxxxxxx> wrote:
> Hello.
>
> I am trying to make simple GUI through ID3DXSprite. And I faced a problem
> with sprite's posiition.
> I made a button and I wanted to click it by handling WM_LBUTTONDOWN.
>
> When I am trying to draw a sprite in x=60, y=200, the sprite's position is
> different. It is about 59, 190.
> But in 0, 0 everything is ok.
>
> Maybe somebody had the same problem.
>
> Here is the code.
>
> D3DXMATRIX res;
> D3DXVECTOR2 scale(1.0f, 1.0f);
> D3DXVECTOR2 translate(0, 200);
> D3DXMatrixTransformation2D(&res, NULL, 0.0, &scale, NULL, 0.0f, &translate);
> sprite->SetTransform(&res);
> if (!upPressed)
> {
> sprite->Draw(texture, NULL, NULL, NULL, D3DCOLOR_ARGB(255, 255, 255, 255));
> }
> else
> {
> sprite->Draw(texturePressed, NULL, NULL, NULL, D3DCOLOR_ARGB(255, 255, 255,
> 255));
> }
>
> Best regards,
> Hwang Roman
>
>
>

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: