Re: Blocking for input during a loop?

2010-01-20 Thread Michael Ash
On Tue, Jan 19, 2010 at 1:16 PM, Jens Alfke j...@mooseyard.com wrote: On Jan 19, 2010, at 6:10 AM, Per Bull Holmen wrote: I have made one class called GameController, which is overridden by subclasses to control one specific type of game (PS: I will soon rename the class Controller to

Re: Blocking for input during a loop?

2010-01-19 Thread Ben Haller
On 18-Jan-10, at 9:29 PM, Per Bull Holmen wrote: ...Again, I have clearly not explained what I wanted to do properly. No, I did not want what you describe. I have done it now, I chose to use threads, and it got far cleaner than the standard Cocoa way. No, I don't have to handle any other

Re: Blocking for input during a loop?

2010-01-19 Thread Per Bull Holmen
Ben Haller wrote: On 18-Jan-10, at 9:29 PM, Per Bull Holmen wrote: ...Again, I have clearly not explained what I wanted to do properly. No, I did not want what you describe. I have done it now, I chose to use threads, and it got far cleaner than the standard Cocoa way. No, I don't have

Re: Blocking for input during a loop? (Yahoo mail destroyed my indentation)

2010-01-19 Thread Per Bull Holmen
Hi all Sorry that Yahoo mail (my mail service) destroyed my indentation on the last post. I guess that wasn't easy to read... :( Actually I don't know how to send the code properly with Yahoo Mail. If I find it out I might repost. Perhaps pasting it into XCode would restore the indentation.

Re: Blocking for input during a loop? (Yahoo mail destroyed my indentation)

2010-01-19 Thread Greg Guerin
Per Bull Holmen wrote: Sorry that Yahoo mail (my mail service) destroyed my indentation on the last post. I guess that wasn't easy to read... :( Actually I don't know how to send the code properly with Yahoo Mail. If I find it out I might repost. Perhaps pasting it into XCode would

Re: Blocking for input during a loop?

2010-01-19 Thread Jens Alfke
On Jan 19, 2010, at 6:10 AM, Per Bull Holmen wrote: I have made one class called GameController, which is overridden by subclasses to control one specific type of game (PS: I will soon rename the class Controller to MainController, and instance variable controller to mainController). The

Re: Blocking for input during a loop? (Yahoo mail destroyed my indentation)

2010-01-19 Thread Per Bull Holmen
Greg Guerin wrote: Per Bull Holmen wrote: Sorry that Yahoo mail (my mail service) destroyed my indentation on the last post. I guess that wasn't easy to read... :( Actually I don't know how to send the code properly with Yahoo Mail. If I find it out I might repost. Perhaps pasting

Re: Blocking for input during a loop?

2010-01-19 Thread Per Bull Holmen
Jens Afke wrote: You've basically implemented coroutines, actually a simple form of an actor, using multiple threads. Each coroutine is running an event loop, and the game one blocks waiting for incoming events from the UI one. /.../ This is a fine way to do things, except that you can't

Re: Blocking for input during a loop?

2010-01-19 Thread Jens Alfke
On Jan 19, 2010, at 10:16 AM, Jens Alfke wrote: You've basically implemented coroutines, actually a simple form of an actor, using multiple threads. The listserv stripped the links from that sentence. They were: http://en.wikipedia.org/wiki/Coroutine

Re: Blocking for input during a loop?

2010-01-19 Thread Per Bull Holmen
Jens Afke wrote: The listserv stripped the links from that sentence. They were: http://en.wikipedia.org/wiki/Coroutine http://en.wikipedia.org/wiki/Actor_model Thanks. This is will be very useful as I learn more about game programming. :) Per

Re: Blocking for input during a loop?

2010-01-18 Thread Per Bull Holmen
- Original Message From: Kyle Sluder kyle.slu...@gmail.com To: Per Bull Holmen pbhol...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Mon, January 18, 2010 6:29:32 AM Subject: Re: Blocking for input during a loop? On Sun, Jan 17, 2010 at 1:59 PM, Per Bull Holmen pbhol

Re: Blocking for input during a loop?

2010-01-18 Thread Jens Alfke
On Jan 18, 2010, at 3:38 AM, Per Bull Holmen wrote: You say my initially proposed loop is a bad idea - but lots of applications use this type of loop. The difference is that they do it only inside one window, and block user access to all other parts of the application (modal windows).

Re: Blocking for input during a loop?

2010-01-18 Thread Per Bull Holmen
Thank you all for the replies! :) Anyway, you've clearly misunderstood. I have clearly not explained properly what I wanted to do, sorry about that. Probably because I'm not quite into the lingo. I've found a great solution, but in case anyone has a technical interest I'll try to explain it

Blocking for input during a loop?

2010-01-17 Thread Per Bull Holmen
Hi Is it possible, in Cocoa, do program a loop which goes something like this: for i=1 to 20 do something block for GUI user input do something with the input repeat It is for a simple game that plays tones etc, and lets the user guess what was played. Originally, I had implemented it without

Re: Blocking for input during a loop?

2010-01-17 Thread Kyle Sluder
On Sun, Jan 17, 2010 at 1:59 PM, Per Bull Holmen pbhol...@yahoo.com wrote: Is it possible, in Cocoa, do program a loop which goes something like this: for i=1 to 20 do something block for GUI user input do something with the input repeat This is a bad idea. Don't block the UI thread,