Re: Grease 0.2 Example + Development?

13 views
Skip to first unread message

Casey Duncan

unread,
Mar 2, 2011, 10:10:01 PM3/2/11
to Hello3171, grease...@googlegroups.com
Hi,

Thanks very much for digging into this. Since I am developing on a Mac
that doesn't even have a NumLock key, I think it would be safe to say
that I would have never though of, or run across this myself.

I checked in a fix, which although I cannot test for NumLock, seems to
do the trick. I added a modifier mask to the KeyControls class that
lets you globally ignore certain modifier keys. By default it ignores
NumLock and ScrollLock. I also fixed the self-test code so that it
works right. For the self-test I have it also ignore Ctrl, which works
as expected.

You can download the revised module from svn (or just check it out).
I'd appreciate it if you could test it on a machine with NumLock ;^)

http://code.google.com/p/caseman/source/browse/trunk/grease/grease/controls.py

I'll do a bugfix release if this works for you.

Thanks!

-Casey

On Wed, Mar 2, 2011 at 1:32 PM, Hello3171 <hell...@gmail.com> wrote:
> Hi,
>
> After a bit of digging I have managed to identify the problem! I am willing
> to bet that you have your numlock key turned off normally.
>
> Essentially I discovered that the pyglet events were occuring just fine and
> traced the problem into the on_key_press function of
> KeyControls(grease.Systems) class in Controls.py file. While I am not sure
> exactly how this class is functioning I can describe what the problem is.
>
> on_key_press takes the argument *key. This is infact passed as a tuple from
> pyglet (key, modifiers). eg. (97, 16) corresponds to the letter A with
> numlock on and (97, 0) corresponds to the letter A with numlock off. However
> in self._key_press_map the key is always stored as (97, 0). This is clearly
> not supposed to be the proper behaviour (ie. nobody would care if numlock is
> on/off normally).
>
> I am not familiar enough with the class to try to fix it at this stage but I
> hope I have provided you with sufficient information. Also I noticed the
> test in the file but when I tryed to run it, it seems that KeyControls
> accepted world in __init__ once upon a time but no longer does, so this no
> longer works.
>
> The reason why I found out about grease was from your planar post in
> pyglet-users. I went looking for silver but found gold instead!
>
>
> On 28 February 2011 21:31, Casey Duncan <casey....@gmail.com> wrote:
>>
>> Hi,
>>
>> There was another similar report from another user recently. Can you
>> let me know the particulars of your platform OS? I don't know how much
>> testing I have done with Python 2.7, but I will look into it and see
>> if there is a specific issue with 2.7, or not.
>>
>> I am still developing it, I am actually working on a geometry library,
>> planar, that will be incorporated into it. I just released a new
>> version of planar over the weekend, and I hope to get back to grease
>> proper soon. I have an idea for a new demo game that will require
>> adding some needed features (like sprite rendering, for example).
>>
>> -Casey
>>
>> On Mon, Feb 28, 2011 at 11:43 AM, Hello3171 <hell...@gmail.com> wrote:
>> > Hi,
>> >
>> > When I came across Grease I was quite shocked because this was extremely
>> > similar design to what I was working towards within my own game. So I
>> > have
>> > begun to try to understand it, however I cannot get any input to work on
>> > the
>> > blasteroids examples (2&3). I have using python 2.7 and pyglet 1.1.4. I
>> > don't really seem to be able to work out why. I did notice on pypi it
>> > says
>> > pyglet 1.1 and python 2.6. However this was last year, do you know if
>> > there
>> > are any issues with 2.7 and 1.1.4?
>> >
>> > Also, are you still developing this framework?
>> >
>
>

Casey Duncan

unread,
Mar 4, 2011, 12:22:32 AM3/4/11
to Hello3171, grease...@googlegroups.com
Adding capslock seems reasonable. That key should just be banned anyway ;^)

Also, if you let me know your name, I'll give you props in the changelist.

-Casey

On Thu, Mar 3, 2011 at 10:43 AM, Hello3171 <hell...@gmail.com> wrote:
> Hi,
>

> I can confirm that the fix works including the test with Ctrl. I would
> suggest that MOD_CAPSLOCK is also added to modifiers by default.
>
> I had tried looking for a grease forums/group; it seems I did not look hard
> enough. You might want to add a link to it on pypi and
> http://www.pygamesf.org/~casey/grease/doc/ or someplace just so that new
> users can find it.
>
> I laughed when you said you didnt have a numlock key.. that was most
> unexpected!

Reply all
Reply to author
Forward
0 new messages