0 Replies - 2056 Views - Last Post: 05 October 2013 - 12:49 PM

#1 lifeinbinary  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 158
  • Joined: 15-February 11

Menu to use methods from callback object

Posted 05 October 2013 - 12:49 PM

I'm trying to get a menu that was initialized by my main view to call methods from my main view (GameView). Here is my call to open menu:

self.bidMenu = [[BidMenu alloc] initWithMatch:self.match andTarget:self];



BTW match is a game controller with most of the functions to alter the game state (ex. attackTo, fortifyFrom...)

GameView has a HUD (HeadsUpDisplay) that would need to be updated in real-time when the bidMenu is changed (ie. player places a bid, nextplayer should be updated on the HUD).

Here's what I'm doing now but I get a warning "PerformSelector may cause a leak because its selector is unknown"


SEL updateHUD = @selector(updateHUD);
    [self.callbackObject performSelector:updateHUD];



I'm using Cocos2d as a graphics engine. I look at the code they use to perform methods from the callbackObject in they CCMenuItemSprite (just a button with a sprite). It seem they use something called a block which I haven't learned about yet. Could someone help me with this?

Is This A Good Question/Topic? 0
  • +

Page 1 of 1