Re: teaching a game to "speak" different languages
Re: teaching a game to "speak" different languages
- Subject: Re: teaching a game to "speak" different languages
- From: Greg Titus <email@hidden>
- Date: Thu, 1 Aug 2002 11:08:47 -0700
Okay, you may have some problems taking advantage of AppKit's language
input manager support then. :-)
I'd suggest reading up on NSInputServer and the NSTextInput protocol:
<file://localhost/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/
English.lproj/Documentation/Reference/ObjC_classic/Classes/NSInputServer.html>
<file://localhost/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/
English.lproj/Documentation/Reference/ObjC_classic/Protocols/NSTextInput.html>
You may be able to get this stuff working without using an AppKit NSView
of some sort, but I doubt it will be easy...
-- Greg
On Thursday, August 1, 2002, at 10:49 AM, tobias wrote:
Thanks for the start. Unfortunately, I'm bypassing the event chain,
and Appkit hierarchy for a higher framerate. In fact, when in
fullscreen mode, there isn't even a window.
The following might show off my lack of obj-c knowledge :)
Since NSApplication is derived from NSResponder it seemed possible that
I may be able to get by with doing the following.
calling [NSApp interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
and then implementing insertText as a category to NSApplication. This
seems that it should be able to work. I can send a message to [NSApp
insertText] in the source and everything is good. Unfortunately, the
insertText message produced by interpretKeyEvents seems to be getting
lost.
Any more suggestions or know why this might not be working?
Thanks.
On Thursday, August 1, 2002, at 01:09 AM, Greg Titus wrote:
Hi Tobias,
The problem you are having is that -keyDown: is to low of a level to
get text when there is a foreign language input manager active.
(Because many of these languages can require more than one keystroke
to input a single character.)
What you need to do is have your -keyDown: method call
-interpretKeyEvents:, which will invoke the active input manager and
create the correct string for you, then call you back with the
-insertText: method. This is documented in NSResponder.
So the code would look like:
- (void)keyDown:(NSEvent *)theEvent;
{
// handle any keys that you want to handle directly, instead of
as text input...
// ...
// then for any left over:
[self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
}
- (void)insertText:(id)aString;
{
NSLog(@"%@", aString);
}
Hope this helps,
-Greg
-------------------
Tobias Ford...
email@hidden email@hidden
-------------------
Senior Software Engineer @ WolfPack Studios
www.wolfpackstudios.com www.shadowbane.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.