GithubHelp home page GithubHelp logo

Comments (9)

Ohmnivore avatar Ohmnivore commented on July 19, 2024

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.

Ohmnivore avatar Ohmnivore commented on July 19, 2024

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.

Ohmnivore avatar Ohmnivore commented on July 19, 2024

Even better:

typedef BulletDiscreteDynamicsWorld = 
#if js
BtDiscreteDynamicsWorld;
#elseif cpp
Pointer<BtDiscreteDynamicsWorld>;
#end

from haxebullet.

Ohmnivore avatar Ohmnivore commented on July 19, 2024

Betterer?

typedef BulletDiscreteDynamicsWorld = 
#if cpp
Pointer<
#end
BtDiscreteDynamicsWorld
#if cpp
>
#end
;

from haxebullet.

Ohmnivore avatar Ohmnivore commented on July 19, 2024

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.

Ohmnivore avatar Ohmnivore commented on July 19, 2024

for (i in 0...9000) {ctrlc();ctrlv();};

Done! https://gist.github.com/Ohmnivore/081488802e5696746391

from haxebullet.

luboslenco avatar luboslenco commented on July 19, 2024

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.

Ohmnivore avatar Ohmnivore commented on July 19, 2024

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.

luboslenco avatar luboslenco commented on July 19, 2024

Cleaning up, if someone needs to take care of .destroy() usage urgently feel free to open another issue.

from haxebullet.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.