ID3DXSprite

Started by
4 comments, last by Sonal 18 years, 6 months ago
Hello, The sprite interface was totally chaged from august to october SDK releases. For some trying to adapt my program to the new SDK failed and i dont have any animation drawn on the screen. Can anyone give me a clue to what might be wrong. The interface apparently moved away from being 2D to being 3D and i not sure what i am suppose to do with it to draw just 2D images like before.
Advertisement
Here snip of the code:


creating the texture:
	D3DXIMAGE_INFO info; 	if( (result = D3DXGetImageInfoFromFile(name, &info)) != D3D_OK )		return result;	// allocate texture	result = 		D3DXCreateTextureFromFileEx( d3ddev, 		name, // file name		D3DX_DEFAULT, D3DX_DEFAULT, // get width and height from file		1, // Mip level		0, // usage 		D3DFMT_UNKNOWN, // format taken from file		D3DPOOL_DEFAULT, // default memory pool		D3DX_DEFAULT, D3DX_DEFAULT, // default filtering and mip filtering		D3DCOLOR_XRGB(255,0,255), // transparent color		&info, // info we just got		NULL, // no palete		&pD3DTexture_);	if(result != D3D_OK)	{		Release();		return result;	}	// allocate sprite	if( (result =D3DXCreateSprite( d3ddev, &pD3DXSprite_)) != D3D_OK )	{		Release();		return result;	}drawing cycle:if (d3ddev->BeginScene()){	d3ddev->SetViewport(&viewport);	d3ddev->ColorFill(backbuffer, NULL, D3DCOLOR_XRGB(100,100,100));        imageP->Begin();        imageP->Draw(x,y ...);        imageP->End()	d3ddev->EndScene();        d3ddev->Present(NULL, NULL, NULL, NULL);}and the image implementation:HRESULT Image::Begin(){	return pD3DXSprite_->Begin(D3DXSPRITE_ALPHABLEND);}HRESULT Image::End(){	return pD3DXSprite_->End();}HRESULT Image::Draw(double x, double y, double dir, int tileH, int tileV, double scale){	// calculate the corner from the center;	RECT tileRect;	// Texture being used is 64 by 64:	D3DXVECTOR2 center(static_cast<float>(sizeH_/2),static_cast<float>(sizeV_/2));	// Screen position of the sprite	D3DXVECTOR2 trans(static_cast<float>(x),static_cast<float>(y));	// scaling 	D3DXVECTOR2 scaling(static_cast<float>(scale),static_cast<float>(scale));	// Build our matrix to rotate, scale and position our sprite	D3DXMATRIX transformationMatrix;	// out, scaling centre, scaling rotation, scaling, rotation centre, rotation, translation	D3DXMatrixTransformation2D(&transformationMatrix,NULL,0.0,&scaling,&center,static_cast<float>(dir),&trans);	// tile	tileRect.top = sizeV_ * tileV;	tileRect.bottom = tileRect.top + sizeV_;	tileRect.left = sizeH_ * tileH;	tileRect.right = tileRect.left + sizeH_;		pD3DXSprite_->SetTransform(&transformationMatrix);	return pD3DXSprite_->Draw(pD3DTexture_, NULL, NULL, NULL, 0xFFFFFFFF); }



All i see on the screen is junk can anyone give me a hint to what i am doing wrong ?

[Edited by - Coder on October 11, 2005 3:21:26 PM]
wow didn't know they changed it... i wll look at the SDK when i get home

this is a bummer... what exactly was changed, and why?
Well from what i read at some other places the change happened during "Microsoft released the DX9 Summer Update" - so they disobayed their own rules and changed a released interface although COM forbide such changes.

BTW for some reason it works now - not sure what exactly changed lol /shrug.
Quote:Original post by Sonal
Hello,
The sprite interface was totally chaged from august to october SDK releases.
For some trying to adapt my program to the new SDK failed and i dont have any animation drawn on the screen.
Can anyone give me a clue to what might be wrong.

The interface apparently moved away from being 2D to being 3D and i not sure what i am suppose to do with it to draw just 2D images like before.


I'm not sure what changes you are talking about. As far as I can tell, nothing changed in the ID3DXSprite interface between the August and October releases. It hasn't "moved away from being 2D to being 3D."

Quote:Original post by Sonal
Well from what i read at some other places the change happened during "Microsoft released the DX9 Summer Update" - so they disobayed their own rules and changed a released interface although COM forbide such changes.


The DX9 Summer Update refers to the 2004 version of the SDK, not the August 2005 Update. In the August Update, they added new flags for the Begin method to allow depth sorting and texture sorting, but the interface didn't change.
hmm might have been some bugged installation then that caused me to get older version :( sorry for that heh

This topic is closed to new replies.

Advertisement