Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ D3D9 Question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
The0neThe0nly
Expert Cheater
Reputation: 0

Joined: 08 Dec 2009
Posts: 119
Location: In a box

PostPosted: Sat Sep 20, 2014 7:52 pm    Post subject: C++ D3D9 Question Reply with quote

How would I draw text in my game if I have only hooked EndScene and Reset (presumably with the DrawTextA method of ID3DXFont)?

I've tried doing this myself, but I keep crashing and getting a white screen even with font->Release() being used.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue Sep 23, 2014 11:55 pm    Post subject: Reply with quote

You need to check and make sure your pointers to your font object are valid before you try to access them.

Inside of EndScene you will be creating the object if it does not exist. Afterward you will draw with it as long as it is valid.

Inside of Reset, you will be recreating it if it exists already only.

Pseudo:
Code:
EndScene()
{
    if (!lpFont)
    {
        // Create your font here..
    }
    else
    {
        // Draw with your font here...
    }
}

Reset()
{
    if (lpFont)
    {
        lpFont->ReleaseResources(); // or whatever cleanup calls your font object uses..
    }

    device->Reset(); // call the original reset..

    if (lpFont)
    {
        lpFont->InitializeResources(); // or whatever initialize calls your font object uses.
    }
}

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites