Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

Transferring methods to global namespace

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Ardor   Members   

122
Like
0Likes
Like

Posted 02 July 2004 - 08:16 PM

Hi, I'm using angelscript in a system with several subsystems, one of them is often used in the scripts. I set a reference to it by using RegisterGlobalProperty(), and it works. However, is there a way to set the subsystems methods global in the scripts? See this example:
subsystem.initQueues();
subsystem.startQueue(0);
for (int i=0;i<subsystem.batchCount();i++)
{
}
.....
I would like to get rid of all these "subsystem."-statements, since they are quite redundant. However, the only way I found to accomplish this is to write proxy functions. So, a way to bind a C++ method to an angelscript function would be nice. Shouldnt be too hard if I specify the pointer of the C++ instance. Is this possible with Angelscript? Or is it an upcoming feature in 0.8?

#2 Andreas Jonsson   Moderators   

4629
Like
0Likes
Like

Posted 03 July 2004 - 09:39 AM

I can't think of any reasonable way to register an object method as global function unless the method is static. If you want to get rid of the object, then the best approach is to write simple proxy functions. Or design the subsystem to work with static method pointers already from the beginning.



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




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.