On Wed, Jan 14, 2009 at 10:06 PM, Kao Cardoso Felix <[email protected]> wrote:
> On Wed, Jan 14, 2009 at 9:33 PM, Hordeling <[email protected]> wrote:
>> I tried to get around this with a simple test example, show below.
>> (Sorry, I don't know how to format it to make it show up as "code".)
>
> Hi,
>
> I didn't run your code so I'm not sure what's the problem you're
> having with it, but it looks like you're trying to mimic the behaviour
> of pyglet's KeyStateHandler.
>
> I can't access pyglet's site right now to link to the docs, but you
> just instance a KeyStateHandler class, push it as an event handler and
> you can query the state of a key using [] with the key code. Something
> like that:
>
> from pyglet.keys import KeyStateHandler
>
> keys = KeyStateHandler()
> director.window.push_handler(keys)
>
> # During you're game:
> if keys[key_code]:
>     # do something
>
> I'm not sure about the code above and I can't verify it right now, but
> it's something like this and it can save you some work :)
>
> --
> Kao Cardoso Félix
>
> Página pessoal: http://www.inf.ufrgs.br/~kcfelix
> Blog: http://kaofelix.blogspot.com
>



-- 
Kao Cardoso Félix

Página pessoal: http://www.inf.ufrgs.br/~kcfelix
Blog: http://kaofelix.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to