On Dec 31, 2013, at 9:13 AM, Alex Hall <mehg...@gmail.com> wrote:
> Sorry, I should have specified - I'm so used to seeing it I didn't even 
> think. The loop is based on an NSTimer and is used to process sound position 
> updates. Basically, I use it to pan sounds and draw updates. I'm not putting 
> key management in there. Here's the setup for it:
>>      [self setGameTimer:[NSTimer scheduledTimerWithTimeInterval:1.0/30 
>> target:self selector:@selector(gameLoop:) userInfo:nil repeats:YES]];
> The docs indicate that this automatically adds itself to the app's mainLoop, 
> so I should be okay here, unless I've misunderstood something (a distinct 
> possibility).

Ah, okay.  I wouldn't expect that to be the cause of the problem then.

> I have no idea how that got in there. :) In the code I'm working with, there 
> is no &. It must have been left over from when I had it in my head that 
> NSRect needed to be passed by reference and was using asterisks all over the 
> place. I'm not doing that anymore, don't worry.

Got it.

>> One more suggestion.  After the program has launched, you might want to see 
>> if everything is what you think it is.  Maybe you could add an action method 
>> in the app delegate that prints out (using NSLog) the current key window, 
>> and its first responder.  Then connect a menu item to that method.  Launch 
>> the program and try to invoke the menu item.  If your problem is the "loop" 
>> thing I wondered about earlier, you won't be able to invoke the menu item.  
>> If not, you should get either a sanity check that you have set up the window 
>> and view correctly, or a possible indication of where the bug is.
> 
> I'll have to re-visit Charles' sample code to be sure I can do this one right 
> as I've never done this before. Perhaps a button would work just as well? It 
> seems less prone to errors from me while setting up. It is a great idea 
> though, and will let me be sure my view is getting drawn in the first place. 
> Thanks for your response.

Oh sure, a button would work as well.  Yeah, in fact I do things like that with 
buttons all the time.  You could also break in the debugger and print the 
information with debugger commands, but often I find a button is handy for this 
kind of sanity checking.

--Andy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to