mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
More code for event handling
almost working, for some reason the event handler creates 2 instances instead of one if anyone can see why from the code I'll be like SOOOO happy:P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1798 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -108,12 +108,16 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
|
||||
}
|
||||
|
||||
|
||||
// FIXME: unregister old event
|
||||
// We need to handle mod change
|
||||
// and double registers
|
||||
if (pad[nPad].keyForControl[id] != 0) {
|
||||
|
||||
oldKey.inputType = KeyboardInput;
|
||||
oldKey.keyCode = pad[nPad].keyForControl[id];
|
||||
oldKey.mods = mods;
|
||||
|
||||
|
||||
// Might be not be registered yet
|
||||
// eventHandler->RemoveEventListener(oldKey);
|
||||
}
|
||||
@ -236,6 +240,16 @@ void PAD_Shutdown()
|
||||
}
|
||||
|
||||
bool ParseKeyEvent(sf::Event ev) {
|
||||
fprintf(stderr, "parsing type %d code %d\n", ev.Type, ev.Key.Code);
|
||||
|
||||
// FIXME: should we support more than one control?
|
||||
for (int i = 0; i < NUMCONTROLS; i++) {
|
||||
if (ev.Key.Code == pad[0].keyForControl[i]) {
|
||||
KeyStatus[i] = (ev.Type == sf::Event::KeyPressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@ -384,7 +398,6 @@ void LoadConfig()
|
||||
file.Get(SectionName, controlNames[x],
|
||||
&key, (i==0)?defaultKeyForControl[x]:0);
|
||||
|
||||
// pad[i].keyForControl[x] = (sf::Key::Code)key;
|
||||
registerKey(i, x, (sf::Key::Code)key);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user