Animating Graphics in Cocoa, Part 1
Subject:   Some changes and questions
Date:   2002-01-09 11:34:51
From:   mikebeam
Response to: Some changes and questions

Wow, that's a lot to read! I hope i address all of you points, and if not, ask again :)

First: You are correct about the modification of the code that you proposed. This is indeed something you would want to do if you were programming a game or something that checks collisions. I was kind of hoping no one would change the speed near the edges :)

Second: Again, you are correct that you can import AnimationView.h into AnimationController.h to get rid of annoying build warnings. I should have mentioned that.

Third: Whoops! Typo! Thanks for catching that for me. I would never have seen that in a million years!

Fourth: [NSThread exit] is used when you want to stop a thread before the completion of the threaded method. In our application we have the neverending while loop, which means that the end of the animate: method will never be reached. This also means that the thread won't stop until the application quits. However, if the while loop did stop somehow and allow the remainder of animate: to finish executing, the thread would exit normally at the end, so we don't need to do [NSThread exit]. Originally i was going to put this line in at the end of animate:, but then i realized it was unnecessary, so i took it out. I thought i had cut out the accompanying explanation, but i guess i missed part of it.

From the NSThread reference:

"If you need to terminate the current thread before reaching the end of the initial selector, send the exit message to the NSThread class object."

Fifth: You're correct on this too, we really should have a dealloc method to make things proper. I've been kind of lazy about this, and will make a point in the future to include it.

Well, i hope i covered everything. That's all for now!


1 to 1 of 1
  1. Some changes and questions
    2002-01-10 13:34:04  michele [View]

1 to 1 of 1