Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


- - - - -

Constructors


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
4 replies to this topic

#1 zeroprey   Members   -  Reputation: 122

Like
0Likes
Like

Posted 24 September 2004 - 10:47 AM

I just want to confirm, currently angelscript is unable to expose constructors with parameters, right? It would be nice to be able to do something like this: vec3 v(1,2,3); If you can do this, how? -Brian

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3451

Like
0Likes
Like

Posted 24 September 2004 - 11:53 AM

This is not yet possible. What you can do is to write factory functions that return an initialized object.

Although, you could also wait a little, as I have received a contribution from Andres Carrera that will add constructors with parameters. I still have to incorporate it and test it though, but I hope to have that done in at most a couple of weeks.


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

#3 zeroprey   Members   -  Reputation: 122

Like
0Likes
Like

Posted 24 September 2004 - 05:27 PM

Great! It's looking good.

#4 abrken   Members   -  Reputation: 130

Like
0Likes
Like

Posted 25 September 2004 - 08:35 PM

It's great to hear that angelscript is going to support constructors with parameters !

My actualy solution is to provide exposed global vars (mainly structures) that are used when angelscript call constructors.

1/ Registrer structure datatype
2/ Register global var of that type
3/ Register the class and its constructor

then in the script


void myFunc()
{
gConstParam.test = "the value";
gConstParam.second = 2;
MyClass theVar;
}


of course this is not perfect, since you have to define/register on struct/global var per class constructor that need data when constructor is called. But it works fine for now !




#5 Andreas Jonsson   Moderators   -  Reputation: 3451

Like
0Likes
Like

Posted 30 September 2004 - 02:41 PM

Constructors with parameters are now fully supported by 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




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.



PARTNERS