Archived

This topic is now archived and is closed to further replies.

SimDemon

"m_pDevice = pDevice" ... Causing access violation??

Recommended Posts

SimDemon    122
I have made a few posts already today, and I have another problem. I got the CD3DFont class working, but it won''t draw text. I made a function in my game''s font class like this:
  
void RR_Font::SetDevice(LPDIRECT3DDEVICE8 pDevice) 
{
    if (pDevice != NULL)      // Valid device

        m_pDevice = pDevice;      // Copy LPDIRECT3DDEVICE8 object

}
  
But when I run in debug mode, it says there''s an access violation on the line "m_pDevice = pDevice". The ''pDevice'' object is valid. What''s wrong here?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Generally this would happen if the "this" pointer is invalid; in other words, the object has not been properly contructed before your method is called.

Share this post


Link to post
Share on other sites
SimDemon    122
Ok, so it DOESN''T work. It worked once, I changed the instance of the RR_Font class from pFont to pMainFont, and it quit working.

Share this post


Link to post
Share on other sites