Mr. Yuk
2002.11.01, 02:40 PM
Ok, well, this is my first posting to iDevGames so greetingz to everybody...
I'm a professional windoze developer, and spend a lot of time mucking about in databases and boring goo like that. In an effort to recapture the 'fun side' of programming, I've been screwing around with learning Cocoa and OpenGL on my G4 tower...
(which I will mention is almost as much fun as programming on my old Amiga back in the day...)
At this point, I've got a fairly decent grasp on Objective C, and know enough about Project Builder to consider myself dangerous.
I've worked through writing a C++ class that is using the CGDisplay stuff to setup my display. Further, I created a simple window in Interface Builder with some buttons and such to give me a way of excercising my C++ class. This works fine (especially with dual monitors) for experimentation because I can control whats going on from my window, and see the results on my secondary display. Neat.
I've started wondering about how to nuke the window and controller class in favor of using the keyboard to get user input directly. For example, catch the function keys, arrow keys, etc.
I've seen some examples of this using Carbon, but I am curious what the 'appropriate' method is to build an input/event handler loop in Cocoa?
I would venture that I should be able to craft something like the following in 'pure' Cocoa?:
main() {
//do some setup
while( wating_for_someting_to_happen) {
//process whatever happened
}
//do some cleanup
}
I've seen vague references to NSRunLoop, or the HID Manager, but haven't found anthing really usefull to someone (like me) that hasn't got a clear grasp of the OSX event mechanism or input model.
Of course, I'm angling toward joystick control next. But for now I would be happy with just smaking keys...
Input is greatly appreciated (no pun there)...
:???: Mr. Yuk...
I'm a professional windoze developer, and spend a lot of time mucking about in databases and boring goo like that. In an effort to recapture the 'fun side' of programming, I've been screwing around with learning Cocoa and OpenGL on my G4 tower...
(which I will mention is almost as much fun as programming on my old Amiga back in the day...)
At this point, I've got a fairly decent grasp on Objective C, and know enough about Project Builder to consider myself dangerous.
I've worked through writing a C++ class that is using the CGDisplay stuff to setup my display. Further, I created a simple window in Interface Builder with some buttons and such to give me a way of excercising my C++ class. This works fine (especially with dual monitors) for experimentation because I can control whats going on from my window, and see the results on my secondary display. Neat.
I've started wondering about how to nuke the window and controller class in favor of using the keyboard to get user input directly. For example, catch the function keys, arrow keys, etc.
I've seen some examples of this using Carbon, but I am curious what the 'appropriate' method is to build an input/event handler loop in Cocoa?
I would venture that I should be able to craft something like the following in 'pure' Cocoa?:
main() {
//do some setup
while( wating_for_someting_to_happen) {
//process whatever happened
}
//do some cleanup
}
I've seen vague references to NSRunLoop, or the HID Manager, but haven't found anthing really usefull to someone (like me) that hasn't got a clear grasp of the OSX event mechanism or input model.
Of course, I'm angling toward joystick control next. But for now I would be happy with just smaking keys...
Input is greatly appreciated (no pun there)...
:???: Mr. Yuk...