• Advertisement
Sign in to follow this  

Tween script values from C++

This topic is 1576 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

Hi,

 

I would like to tween script values (or script properties) via a C++ tween module.

But I don't know how to do this.

In c++ it's quite easy, I just keep an int* or a float* and update values through these pointers but with angelscript float and int are value types and if I understand the documentation, I can't get any pointer to value types (and then I cannot modify them from my c++ code)

It seems I might use the flag asEP_ALLOW_UNSAFE_REFERENCES  but I prefer a safier solution if possible.

Do you have any idea  how to do this?

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

I'm not familiar with the term 'tween'. What does it mean?

 

Use of asEP_ALLOW_UNSAFE_REFERENCES will allow you to pass primitives to functions with &inout (i.e. a reference to the actual variable so it can be both read and modified by the function). Despite being unsafe, it is no more unsafe than passing primitives by reference or pointer to a function in C++. If you don't care about sandboxing the script environment and trust your script writers to have at least a little bit of good sense when writing the scripts, then you should be perfectly fine with asEP_ALLOW_UNSAFE_REFERENCES.

 

Without asEP_ALLOW_UNSAFE_REFERENCES you will have to pass the primitive values in two args, one for input and another for output, e.g.:

 

void foo(int inValue, int &out outValue)
{
  outValue = inValue * 2;
}

 

The &out in AngelScript translates to either a & or * in C++, but know that the value referred to in the argument will be uninitialized as it is meant for output only.

Share this post


Link to post
Share on other sites

Thx for the rapid answer.

 

I'm currently trying to work with a reference class containing the float that will be updated by my c++ code, and it seems to work.

 

Concerning your question , I'm french so I'm not sure about the exact meaning of "tween" ;-) but for me it's an interpolation. And I consider a "tweener" as an interpolation system with special effects.

Here are some links :

 

http://libclaw.sourceforge.net/tweeners.html      

http://itween.pixelplacement.com/index.php

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement