File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,20 @@ class Wrapper
5555 operator T*()
5656 { return GetWrapped (); }
5757
58+ template <class U >
59+ static U *_obj (CPointer *pPtr)
60+ {
61+ if (!pPtr->IsValid ())
62+ return NULL ;
63+
64+ return Wrap<U>((T *)pPtr->m_ulAddr );
65+ }
66+
67+ template <class U >
68+ static CPointer *_ptr (U *pSelf)
69+ {
70+ return new CPointer ((unsigned long )pSelf->GetWrapped ());
71+ }
5872private:
5973 T* m_pWrapped;
6074};
Original file line number Diff line number Diff line change @@ -303,4 +303,22 @@ void export_physics_object(scope _physics)
303303 " output_debug_info" ,
304304 &IPhysicsObjectWrapper::OutputDebugInfo
305305 );
306+
307+
308+ // Add memory tools...
309+ // TODO: Add a macro to wrap these.
310+ PhysicsObject.def (
311+ GET_OBJ_NAME,
312+ &IPhysicsObjectWrapper::_obj<IPhysicsObjectWrapper>,
313+ manage_new_object_policy ()
314+ );
315+
316+ PhysicsObject.def (
317+ GET_PTR_NAME,
318+ &IPhysicsObjectWrapper::_ptr<IPhysicsObjectWrapper>,
319+ manage_new_object_policy ()
320+ );
321+
322+ PhysicsObject.attr (GET_SIZE_NAME) = sizeof (IPhysicsObject);
323+ STORE_CLASS (IPhysicsObject, " PhysicsObject" )
306324}
You can’t perform that action at this time.
0 commit comments