Zardoz89 / dcpu_vm

Another DCPU-16 Virtual Machine
http://zardoz89.github.io/dcpu_vm/
MIT License
6 stars 2 forks source link

Key events handling #8

Closed Zardoz89 closed 11 years ago

Zardoz89 commented 11 years ago

For what I researched, SFML can't handle some key events, like ! " | @ (Alt gr+number or Shift + number). It isn't a bug, they simple ignored these cases and return a "Unknow key" (-1) value. I send a Issue but looks that is pretty old (first issue two years ago!).

I think that We have this options.

What do you think that should try ?

lamogui commented 11 years ago
lamogui commented 11 years ago

May be these key are send on "text enter event" another solution is use these event only for theses special cases and send pressed and released event to the keyboard

lamogui commented 11 years ago

if (event.type == sf::Event::TextEntered) { if (event.text.unicode == '!' || event.text.unicode == '@'|| event.text.unicode=='|') { keyboard.handlekey(true,event.text.unicode); keyboard.handlekey(false,event.text.unicode); }

}

Zardoz89 commented 11 years ago

I thought that Event::TextEntered returned a text string, not individual characters. I'm testing it in a small test program to see how works.

Zardoz89 commented 11 years ago

OK, works pretty fine. The only problem is that the generic keyboard will push a Shift pressed /released after and before.

Updated: Implemented