<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: CallFunc with int parameter</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/721</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:10:16 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/721" rel="self" type="application/rss+xml" />

		<item>
			<title>Zammy on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-29100</link>
			<pubDate>Sun, 07 Mar 2010 21:28:47 +0000</pubDate>
			<dc:creator>Zammy</dc:creator>
			<guid isPermaLink="false">29100@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It took me 30 minutes to figure out why my code was blowing up.<br />
PLEASE, add comments to CallFuncND explaining that it calls a method with two arguments.<br />
First is sender and second is the actual data.</p>
<p>I would rather change this two have 3 versions with 1 2 or 3 arguments and leave people decide what this arguments will be.<br />
Assuming that I wand the sender is a restriction.</p>
<p>I am using 0.8.2 atm, I am not sure if in 0.99 there are better explanations.
</p></description>
		</item>
		<item>
			<title>javy on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-17557</link>
			<pubDate>Fri, 06 Nov 2009 02:27:34 +0000</pubDate>
			<dc:creator>javy</dc:creator>
			<guid isPermaLink="false">17557@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yes, that's very helpful.  Multiple arguments would be nice, but I understand that any library has to have some limitations.  I'm grateful for what we have as it is.</p>
<p>Thanks again.
</p></description>
		</item>
		<item>
			<title>Mark Sawicki on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-17530</link>
			<pubDate>Thu, 05 Nov 2009 21:50:21 +0000</pubDate>
			<dc:creator>Mark Sawicki</dc:creator>
			<guid isPermaLink="false">17530@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1644'>javy</a>,<br />
I do it like this (I couldn't find the original post here that helped me figure it out.. ):<br />
<pre><code>NSMutableArray *prams = [[NSMutableArray alloc] initWithCapacity:2];

			[prams addObject:[NSValue valueWithCGPoint: enemy.position] ];
			[prams addObject:[NSValue valueWithCGPoint: enemysh-&#62;body-&#62;v] ];

			id sgi = [CallFuncND actionWithTarget:game selector:@selector(spawnGameItemFromCallFuncND:data:) data:prams];</code></pre>
<p>then, get the items from the array and call the real function..<br />
<pre><code>- (void) spawnGameItemFromCallFuncND:(id) sender data:(void*)d
{
	NSMutableArray *dta = (NSMutableArray*)d;

	[self spawnGameItemAtPoint:[[dta objectAtIndex:0] CGPointValue] withVelocity:[[dta objectAtIndex:1] CGPointValue] ];
	[dta release];
}

- (BOOL) spawnGameItemAtPoint: (CGPoint) spawnSpot withVelocity:(CGPoint) velocity
{
...</code></pre>
<p>There is probably a be a better way, but this works for what I'm doing.</p>
<p>HTH,<br />
Mark
</p></description>
		</item>
		<item>
			<title>javy on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-17471</link>
			<pubDate>Thu, 05 Nov 2009 07:57:11 +0000</pubDate>
			<dc:creator>javy</dc:creator>
			<guid isPermaLink="false">17471@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>If I wanted to use CallFuncND on a method like this:</p>
<p>-(void) doSomethingWithScene:(Scene *) withEffect:(int)effectType;</p>
<p>Can a selector with two or more data objects be used?  I think I understand most of the CallFuncND method, but not completely.</p>
<p>My test code (one variation):<br />
<pre><code>[myCustomNode runAction:
  [CallFuncND actionWithTarget:myNode selector:@selector(doSomethingWithScene:withEffect:)
   data:[Director sharedDirector].runningScene, (void*)10], nil];</code></pre></description>
		</item>
		<item>
			<title>newacct on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-4280</link>
			<pubDate>Thu, 16 Jul 2009 23:14:39 +0000</pubDate>
			<dc:creator>newacct</dc:creator>
			<guid isPermaLink="false">4280@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yeah you need to use CallFuncND, but that requires that your method take an additional initial parameter that is the CocosNode that the action is being run on. (If you don't need that then you can just create a dummy parameter and ignore it.) So something like this:</p>
<p>- (void)removeStuff:(id)dummy atIndex:(int)i { ... }</p>
<p>and then you call it like</p>
<p>[someNode runAction:[CallFuncND actionWithTarget:yourObject selector:@selector(removeStuff:atIndex:) data:(void *)8]]
</p></description>
		</item>
		<item>
			<title>riq on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-4273</link>
			<pubDate>Thu, 16 Jul 2009 22:04:55 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">4273@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>And since it is an <code>int</code>, and the <code>int</code> types and <code>pointer</code> types have the same size, you can pass directly the <code>int</code>. Just cast it as a <code>(void*)</code>.</p>
<p>See SpriteTest.m (r1159).<br />
I've just improved the CallFunc test. Now, it also shows how to use CallFuncND and CallFuncN.
</p></description>
		</item>
		<item>
			<title>Codemattic on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-4272</link>
			<pubDate>Thu, 16 Jul 2009 21:56:50 +0000</pubDate>
			<dc:creator>Codemattic</dc:creator>
			<guid isPermaLink="false">4272@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>CallFunc doesnt work that way.  Try CallFuncND with a pointer to your int.
</p></description>
		</item>
		<item>
			<title>bsharp42 on "CallFunc with int parameter"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/721#post-4270</link>
			<pubDate>Thu, 16 Jul 2009 21:33:17 +0000</pubDate>
			<dc:creator>bsharp42</dc:creator>
			<guid isPermaLink="false">4270@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a </p>
<p>- (void) removeStuff : (int) i<br />
{</p>
<p>}</p>
<p>CallFunc doesn't seem to recognize removeStuff i:8 ......</p>
<p>is this not possible ?
</p></description>
		</item>

	</channel>
</rss>

