Sign in to follow this  

A feature I'd like to see (and could really use)

This topic is 4356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I finished integrating Angelscript into my engine a few weeks ago (only took a week!), and while doing it I noticed a few features that I could have used and that would be helpful. One of them I also saw in a post a while back. It mentioned binding methods in a C++ class to Angelscript global functions. The initial response was that it could be done, but then it seemed like it was decided not to add it because there can always be multiple instances of that class. The exception to this was the main game engine class. It seemed like the workaround for this was to make a global pointer to the main engine, and have all functions that need to access the main engine's members use this pointer. I don't like this for three reasons. The first and most obvious is that you need to write a wrapper function for EVERY function you want to make global. Not a huge deal, but tedious nevertheless. The second reason is it prevents access to private functions, although one could argue that only public methods should be exposed. The third reason is that, in our case, we have to have multiple instances of our main engine class (don't ask). Each engine has it's own script engine, and therefore could be bound to global methods. My current work around is that I have an engine type in angelscript, but I really wish I could just make the functions global. For instance, if I wanted to make a bind function for my config files like the Quake engine has, every call to it would have to be prefixed with "engine." I'd like to keep it clean for people using the config files :)

Share this post


Link to post
Share on other sites
It could certainly be done. I'm not too fond of that solution myself, but it seems that quite a few would preferred it, so I may actually reconsider this and implement it anyway.

Right now my priority is on implementing script declared classes with inheritance, so I cannot say when it would be possible to do so however.

BTW, do you have a site for your project? If you want I can link to it on the AngelScript page.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Heh, originally I started this post as "features I'd like to see," with inheritance being the second one. After not remembering the other features I'd thought of, I just made it the first :)

My project is has no web site, as it's really more of an internal tool (by tool think Office, not Notepad). But it IS a professional product for a company, so be happy :)

Share this post


Link to post
Share on other sites

This topic is 4356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this