[gameprogrammer] Re: ID3DXSprite translation problem
- From: "Roman Hwang" <hwang.roman@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Sun, 1 Jun 2008 21:00:18 +0300
Here is my projection matrix construction:
D3DXMatrixPerspectiveFovLH(&proj, D3DX_PI * 0.25, WIDTH/HEIGHT, 1.0f,
1000.0f);
On 6/1/08, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:
>
> 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
>
>
>
- Follow-Ups:
- [gameprogrammer] Re: ID3DXSprite translation problem
- From: Alan Wolfe
- References:
- [gameprogrammer] ID3DXSprite translation problem
- From: Roman Hwang
- [gameprogrammer] Re: ID3DXSprite translation problem
- From: Alan Wolfe
Other related posts:
- » [gameprogrammer] ID3DXSprite translation problem
- » [gameprogrammer] Re: ID3DXSprite translation problem
- » [gameprogrammer] Re: ID3DXSprite translation problem
- » [gameprogrammer] Re: ID3DXSprite translation problem
- [gameprogrammer] Re: ID3DXSprite translation problem
- From: Alan Wolfe
- [gameprogrammer] ID3DXSprite translation problem
- From: Roman Hwang
- [gameprogrammer] Re: ID3DXSprite translation problem
- From: Alan Wolfe