Jump to content

Recommended Posts

Posted

Hi every body!

I'm actually trying to make a wrapper for Chipmunk Physics library, it's an OpenSource 2D rigide bodies physics library, and I have a problem:

There is a callback function passing a structure (cpVect), and I don't know if there is a trick to be able to use it.

Here is the declaration of the callback

;~ typedef void(*   cpSpaceNearestPointQueryFunc )(cpShape *shape, cpFloat distance, cpVect point, void *data)
;~      Nearest point query callback function type.

Thanks!

Posted (edited)

I think you'll need DllCallBackRegister but I'm not entirely sure.

Edit: I just read that DllCallBackRegister can't handle structs. Sorries.

Edited by LaCastiglione
  • Moderators
Posted

Did you try using a ptr and pulling the data out from that?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

No, didn't tried yet.

I will try this, and I had another idea, gonna tell you if it works:

Knowing that a cpVect structure is "double x; double y", I will try this:

;~ typedef void(*   cpSpaceNearestPointQueryFunc )(cpShape *shape, cpFloat distance, cpVect point, void *data)
DllCallbackRegister("none:cdecl", "ptr;double;double;double;int", "_Function")

gonna see!

PS: I have not tried yet cause I didn't wrapped enough functions yet to be able to run a test

Edited by matwachich

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...