Advertisement

Signals in angelscript

Started by June 25, 2010 06:59 AM
1 comment, last by SiS-Shadowman 14 years, 4 months ago
Does anyone familiar with angelscript know if there is some way to introduce a signals mechanism that doesn't require subclassing some class, overwriting a method and then registering at the appropriate signal? Something as convenient as boost::signals would be awesome, though I'm not sure if it's currently possible , since funcptr doesn't seem to support class methods, or at least I didn't get it from the tutorials.
You're right, function pointers can only be used with global functions. At least for now.

How do you intend to use this? You probably do not need something as generic as boost::signals, however convenient it is. Maybe if you show us how you actually want to use it we can give you some ideas on how to best solve it with AngelScript.

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

Advertisement
Oops, I totally forgot about this thread.
I most likely need it in my entity system. One example is when adding a component
to an entity:

Entity@ e = entitySystem.createEntity();e.add(CameraComponent());


I think there are components that are required to know when they're attached to an entity and when they're detached, but not all of them. I would hate to make those methods part of the interface, because I don't want alot of empty functions in all my interfaces for events I might need. Therefore my wrapper classes (for script-implemented interfaces) simply check if those methods are implemented and call those methods, but do nothing if they are not.

This topic is closed to new replies.

Advertisement