-
May 5th, 2013, 11:30 PM
#1
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
-
May 6th, 2013, 03:04 AM
#2
Re: Pass a handle to a function
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.
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.
???? 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.
Last edited by Igor Vartanov; May 6th, 2013 at 03:06 AM.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|