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 


Drawing rectangles using the Direct3DHook?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Jesuszilla
Newbie cheater
Reputation: 0

Joined: 29 Jul 2015
Posts: 11

PostPosted: Sun Feb 05, 2017 9:31 pm    Post subject: Drawing rectangles using the Direct3DHook? Reply with quote

So I recently found out about the Direct3DHook and its functions, but I only see things about loading from files.

I currently use a form and the canvas to draw hitboxes (would show a screen but I don't have enough posts to post URL's)


So I was wondering, is there a way to draw rectangles in Direct3D? Perhaps even convert a rectangle in the canvas to a texture to be used for a sprite?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Mon Feb 06, 2017 6:45 am    Post subject: Reply with quote

you can load from canvas, by assigning the rasterimage inherited class to a picture, and making a texture out of that picture, but there is currently no support for tranparent data in canvases so in the end it will look like a square with a rectange

only way right now for a rectangle is using some graphics software and make a transparent png with the rectange and load that (can be embedded inside the table so no need for seperate files)

if you mean acfual 3d triangles (e. g based on a vertexlist, then no, not currently implemented, but tbe d3dhook dll exports are easily hookable so you can always add an extension dll of yoir own)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Jesuszilla
Newbie cheater
Reputation: 0

Joined: 29 Jul 2015
Posts: 11

PostPosted: Mon Feb 06, 2017 10:28 am    Post subject: Reply with quote

Well I got something working by converting the canvas to a picture like you said, with transparency, too (just had to set the mask color to 0)! Only problem is the sprite I draw with the hitboxes doesn't change size from the original set of hitboxes I draw, meaning longer and taller ones get cut off. They also keep overlaying and creating a big mess on the screen.

Is there any way to clear what's been drawn by the D3D hook?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Mon Feb 06, 2017 10:39 am    Post subject: Reply with quote

sprites are not draw commands. They are object. So don't create sprites each time you draw, reuse them by assigning a new texture to them, or destroy when done with them

the z-order of the sprite determines if it'll be rendered on top of another sprite or not

to clear, destroy the spites or set them to invisible

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Jesuszilla
Newbie cheater
Reputation: 0

Joined: 29 Jul 2015
Posts: 11

PostPosted: Mon Feb 06, 2017 10:52 am    Post subject: Reply with quote

Thanks! I'll try this when I get home! I'll probably end up just replacing the sprite since that seems most efficient.

But since I'll probably need to do this sometime in the future, and forgive me for asking if this is basic Lua, but what is the destructor method called for these objects? I don't recall seeing it in the documentation; is it obj.destroy() or object.dispose(), etc.?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Mon Feb 06, 2017 11:11 am    Post subject: Reply with quote

obj.destroy()
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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