Sprite problem
Heres my error:
error C2660: 'ID3DXSprite::Begin' : function does not take 0 arguments
err according to MSDN:
ID3DXSprite::Begin
Prepares a device for drawing sprites.
HRESULT Begin(
DWORD Flags
);
Parameters
Flags
[in] Combination of zero or more flags that describe sprite rendering options.
What am I doing wrong? :)
Si
ID3DXSprite::Begin() takes one parameter, you're trying to call it, passing 0 parameters - E.g: pSprite->Begin();
Edit: If you want to pass 0 flags to it, you need to pass 0 for the dwFlags parameter.
Edit: If you want to pass 0 flags to it, you need to pass 0 for the dwFlags parameter.
I'm too lazy to look up the actual default flag, but typically passing it a value of 0 signifies 'no flags'. Try that.
That works, but doesn't explain why my sprite is not rendering.
Heres may class:
I can't see why this isn't working. It seems identical to many other tutorials I have seen.
Any advice welcome.
Si
Heres may class:
//-----------------------------------------------------------------------------// File: cBillboard.cpp//-----------------------------------------------------------------------------#include "..\\hub.h"//-----------------------------------------------------------------------------// The cBillboard class constructor//-----------------------------------------------------------------------------cBillboard::cBillboard( char* filename, D3DXVECTOR3 pos, D3DCOLOR key ){ m_texture = NULL; m_sprite = NULL; m_alpha = 255; HRESULT hr = D3DXCreateTextureFromFileEx(g_device, filename, 0, 0, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, key, NULL, NULL, &m_texture ); //HRESULT hr = D3DXCreateTextureFromFile(g_device, filename, &m_texture ); if ( FAILED(hr) ) { g_log->SIM( "Missing cBillBoard Texture %s\n", filename ); return; } D3DXCreateSprite( g_device, &m_sprite ); m_pos = pos; g_log->SIM( "cBillBoard - loaded %s\n", filename );}//-----------------------------------------------------------------------------// The cBillboard class destructor//-----------------------------------------------------------------------------cBillboard::~cBillboard(){ SAFE_RELEASE( m_texture ); SAFE_RELEASE( m_sprite );}//-----------------------------------------------------------------------------// Render//-----------------------------------------------------------------------------void cBillboard::Render( int index, float alpha, bool billboard, bool changeStates, bool moving ){ D3DXMATRIX view, world; D3DXMatrixIdentity( &world ); g_device->GetTransform( D3DTS_VIEW, &view ); m_sprite->SetWorldViewLH( &world, &view );// m_sprite->Begin( D3DXSPRITE_DONOTMODIFY_RENDERSTATE | D3DXSPRITE_ALPHABLEND ); m_sprite->Begin(0); m_sprite->Draw( m_texture, NULL, NULL, &m_pos, 0xFFFFFFFF );//D3DCOLOR_ARGB(int(m_alpha * 255.0f), 255, 255, 255) ); m_sprite->End();}
I can't see why this isn't working. It seems identical to many other tutorials I have seen.
Any advice welcome.
Si
Make sure your render calls are between the DirectX device Begin() and End() calls. IE:
Device->Begin();
Sprite->Begin(0);
// Stuff
Sprite->End();
Device->End();
Device->Present();
... or something like that ... this is off the top of my head. Good luck.
Device->Begin();
Sprite->Begin(0);
// Stuff
Sprite->End();
Device->End();
Device->Present();
... or something like that ... this is off the top of my head. Good luck.
Try commenting out the matrix transformations. I believe the sprite interface takes care of setting that up for you when you pass in position, center, etc, for parameters.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement