Pass a handle to a function
codeguru forum,
Visual C++ 2010
This is all very new to me.
I'm using SFML with Visual C++ and need to pass a handle to
a function. I've tried to find this on the web with no luck.
The handle happens to be a sprite defined as:
sf::Sprite Numbers(MyNumbers);
Now I want to pass "Numbers" to a function.
-
-
getFrame(Numbers);
-
-
???? getFrame(??????)
{
Numbers.SetSubRect(sf::IntRect(0,0,63,63));
return ????
}
How do I do this?
Thanks for any reply.
jerryd
Re: Pass a handle to a function
Quote:
Originally Posted by
jerry_d
I'm using SFML with Visual C++ and need to pass a handle to
a function.
Whatever framework you use you have to use types provided by the framework.
Quote:
I've tried to find this on the web with no luck.
In case the framework's on-line documentation is not enough, you always may inspect samples the framework site provides.
Quote:
???? getFrame(??????)
{
Numbers.SetSubRect(sf::IntRect(0,0,63,63));
return ????
}
Considering this snippet, it seems to me you need to get back to your C++ lessons covering functions and data types.
Code:
RETURN_TYPE getFrame(PARAMETER_TYPE parameterVariable)
{
Numbers.SetSubRect(sf::IntRect(0,0,63,63));
return returnValue;
}
One of the very basic programming skills is ability to read code/documentation and deduce data types to be used as function parameters and return values, as well as design safe data type casts/transformations for passing data to and from the function if required. Without the skill you're not able to move forward.