updating iPhone view without user input -


Writing a 4-player iPhone game app with a programmable mix of human-auto computer player, each player is presented with a "Game View "Must be updated after it is started. I am using "setNeedsDisplay" to update this view. However, this view updates only when my "turn processing" code is "finished" and it is waiting for a human player's touch to trigger this code again.

For the auto computer player, the display is updated only when the next human player is waiting for the turn again, therefore, for the game of all auto computer player, the whole game is played for the first time ( The app ends) SetNeeds draws once before the display - Showing the last game view status.

Does the auto computer player change the rate once every time a human player can see (such as once).

In general your game code It would be better to run on a separate thread and keep the display on the main thread.

In a pinch, however, you can do this to update the display immediately after calling setNeedsDisplay:

[[NSRunLoop currentRunLoop] acceptInputForMode: NSDefaultRunLoopMode beforeDate: zero] ;

You have to be a little careful because other queued messages can also be started by calls. (Messages distributed on the Mac will trigger a message for example)


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -