SFML community forums

Help => Window => Topic started by: thoniel on July 14, 2009, 04:54:41 pm

Title: KeyEventArgs.Alt / Control / Shift
Post by: thoniel on July 14, 2009, 04:54:41 pm
hi
im using sfml 1.5 with c# and trying to wrap parts of sfml so have it easy to modifiy things.

right now, im wrapping Input in my own input class. and by that i recognized that KeyEventArgs.Alt etc. do not seem to work.

i have a method that listens to KeyPressed for example. but when i press Alt and A,first Alt and then A events are fired (in the keycodes, the booleans are never true).

is that right?

cheers
Title: KeyEventArgs.Alt / Control / Shift
Post by: Laurent on July 14, 2009, 06:12:11 pm
You're talking about KeyEventArgs and Input, but they are unrelated. Can you show some code?
Title: KeyEventArgs.Alt / Control / Shift
Post by: thoniel on July 14, 2009, 07:00:35 pm
yeah sorry, they are unrelated in sfml but in my Input class i put your input functions and in addition the events from Window


Code: [Select]

            window.KeyPressed += new EventHandler<SFML.Window.KeyEventArgs>(OnKeyPressedSFML);

Code: [Select]


        private void OnKeyPressedSFML(object sender, SFML.Window.KeyEventArgs args)
        {
            String ret = "SFML:";

            if (args.Alt)
                ret += " Alt";

            if (args.Control)
                ret += " Ctrl";

            if (args.Shift)
                ret += " Shift";

            ret += " " + args.Code;

            write(ret);
        }
Title: KeyEventArgs.Alt / Control / Shift
Post by: thoniel on July 14, 2009, 10:04:16 pm
so, is that a bug or am i getting the meaning of the booleans wrong?
Title: KeyEventArgs.Alt / Control / Shift
Post by: Laurent on July 14, 2009, 11:41:31 pm
It's a bug, I'll try to fix it as soon as possible.

Until I solve it, a simple workaround is to use the Input class to know if Control/Alt/Shift are pressed.
Title: KeyEventArgs.Alt / Control / Shift
Post by: thoniel on July 14, 2009, 11:57:55 pm
yeah thanks. the biggest reason to use this library is your support ;)
Title: KeyEventArgs.Alt / Control / Shift
Post by: Laurent on July 17, 2009, 10:01:49 am
It's fixed.