• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: teaching a game to "speak" different languages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: teaching a game to "speak" different languages


  • Subject: Re: teaching a game to "speak" different languages
  • From: tobias <email@hidden>
  • Date: Thu, 1 Aug 2002 12:49:43 -0500

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.

  • Follow-Ups:
    • Re: teaching a game to "speak" different languages
      • From: Aki Inoue <email@hidden>
    • Re: teaching a game to "speak" different languages
      • From: Greg Titus <email@hidden>
  • Prev by Date: Re: subclassing NSMutableArray
  • Next by Date: Re: teaching a game to "speak" different languages
  • Previous by thread: teaching a game to "speak" different languages
  • Next by thread: Re: teaching a game to "speak" different languages
  • Index(es):
    • Date
    • Thread