🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

will pointers make a return

Started by
0 comments, last by WitchLord 16 years, 2 months ago
Witchlord, I had read a note on the Angelscript site that pointers may be making a return. In my situation, its purely an interface issue as I wouldn't need Angelscript itself to actually allocate or free pointers. For instance the interface of my native code follows a scheme like the following where CreateSphere and CreateCube actually take care of allocating a new Entity instance and RemoveEntity actually takes care of deallocating it. Entity* Scene::CreateSphere(); Entity* Scene::CreateCube(); bool Scene::RemoveEntity( Entity* ); Once an entity is created, you can invoke its methods in the native code via the -> operator. For example: 'entity->BindTexture( Texture* )' Since Angelscript obviously has no conception of the -> operator, I have to make a simple translation layer for any class like my entity class. A translation for entity bind texture might be: bool Entity_BindTexture( Entity* e, Texture* t){ return e->BindTexture(t); } This would have an Angelscript prototype of: Entity_BindTexture( PtrEntity, PtrTexture ) where PtrEntity and PtrTexture are just int enumerations pretending to be pointers in a language that doesn't do pointers (essentially acting as integer handles). This works fine and the translation layer is a lot simpler than it might be in other scripting languages. However, if you had support for the -> operator in Angelscript, I would not need a translation layer at all between my native code and my Angelscript code. I hope what I am describing makes sense.
Advertisement
I want to add support for pointers in AngelScript again (as an optional feature, of course) but it may take a while yet. There are so many other things I want to add too.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement