Comments (9)
At this point I'm thinking either hxcpp manages pointers automatically, or if it doesn't maybe this will help: http://api.haxe.org/cpp/vm/Gc.html#setFinalizer
from haxebullet.
There's maybe other ways to do this, but this is the most obvious one to me:
#if js
typedef BTDiscreteDynamicsWorld = BtDiscreteDynamicsWorld;
#elseif cpp
typedef BTDiscreteDynamicsWorld = Pointer<BtDiscreteDynamicsWorld>;
#end
JS's create() and CPP's create() would both return a BTDiscreteDynamicsWorld, and in the user's classes fields would be defined as BTDiscreteDynamicsWorld too. Unless I'm overlooking something this would allow us to treat instances exactly the same in both targets, granted we're calling .value() first.
BTDiscreteDynamicsWorld instead of BtDiscreteDynamicsWorld is just an example, we would need a much more different typedef naming scheme to avoid confusion.
from haxebullet.
Even better:
typedef BulletDiscreteDynamicsWorld =
#if js
BtDiscreteDynamicsWorld;
#elseif cpp
Pointer<BtDiscreteDynamicsWorld>;
#end
from haxebullet.
Betterer?
typedef BulletDiscreteDynamicsWorld =
#if cpp
Pointer<
#end
BtDiscreteDynamicsWorld
#if cpp
>
#end
;
from haxebullet.
Hmm only way that stays fully compatible with FlashDevelop's autocomplete is
#if cpp
typedef BulletDiscreteDynamicsWorld = Pointer<BtDiscreteDynamicsWorld>;
#end
#if js
typedef BulletDiscreteDynamicsWorld = BtDiscreteDynamicsWorld;
#end
from haxebullet.
for (i in 0...9000) {ctrlc();ctrlv();};
Done! https://gist.github.com/Ohmnivore/081488802e5696746391
from haxebullet.
Hey,
Is it not the same like the thing already included?
https://github.com/luboslenco/haxebullet/blob/master/Sources/haxebullet/Bullet.hx#L1351
I went with 'Pointer' indication but it is easy to use your own typedefs as you do.
Ammo.js used to require calling destroy() too, but not sure if that is still the case. Ideally we get rid of that if possible:)
from haxebullet.
Oops. Didn't realize you had typedefs already.
I honestly have no idea what the .destroy() usage should be on cpp/js, i guess i'll figure it out when i find memory leaks.
from haxebullet.
Cleaning up, if someone needs to take care of .destroy() usage urgently feel free to open another issue.
from haxebullet.
Related Issues (14)
- Wrong path to bullet .h files generated HOT 3
- Need a little help with BtRigidBody plz HOT 2
- lime cpp target? HOT 7
- 'btRigidBody': no appropriate default constructor available HOT 4
- In the vehicle class not working of frictions HOT 1
- What Do We Need To Autogenerate Javascript Bindings? HOT 30
- [FR] Please include AllHitsRayResultCallback in haxelib HOT 8
- Readme test case HOT 1
- Collision callback HOT 2
- haxelib.json missing HOT 2
- error C2819: type 'btRigidBody' does not have an overloaded member 'operator ->' HOT 5
- calculateLocalInertia seems to have no effect HOT 5
- Crash on android HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haxebullet.