mirror of https://github.com/stella-emu/stella.git
Fixed bug whereby remapping a joystick axis to a digital event didn't
erase that axis from the analog assignment (if it was also assigned to an analog event). Started work on intelligent focusing in the InputTextDialog, but it requires some more work on the focusing the Dialog class (which is really sort of a mess). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@919 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
978c97c2d0
commit
b1439714dc
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CheatCodeDialog.cxx,v 1.6 2005-12-18 18:37:01 stephena Exp $
|
||||
// $Id: CheatCodeDialog.cxx,v 1.7 2005-12-20 00:56:31 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -134,6 +134,7 @@ void CheatCodeDialog::addCheat()
|
|||
myCheatInput->setEditString("", 0);
|
||||
myCheatInput->setEditString("", 1);
|
||||
myCheatInput->setTitle("");
|
||||
myCheatInput->setFocus(0);
|
||||
myCheatInput->setEmitSignal(kCheatAdded);
|
||||
parent()->addDialog(myCheatInput);
|
||||
}
|
||||
|
@ -151,6 +152,7 @@ void CheatCodeDialog::editCheat()
|
|||
|
||||
myCheatInput->setEditString(name, 0);
|
||||
myCheatInput->setEditString(code, 1);
|
||||
myCheatInput->setFocus(1);
|
||||
myCheatInput->setEmitSignal(kCheatEdited);
|
||||
parent()->addDialog(myCheatInput);
|
||||
}
|
||||
|
@ -168,6 +170,7 @@ void CheatCodeDialog::addOneShotCheat()
|
|||
myCheatInput->setEditString("One-shot cheat", 0);
|
||||
myCheatInput->setEditString("", 1);
|
||||
myCheatInput->setTitle("");
|
||||
myCheatInput->setFocus(1);
|
||||
myCheatInput->setEmitSignal(kOneShotCheatAdded);
|
||||
parent()->addDialog(myCheatInput);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventHandler.cxx,v 1.132 2005-12-19 02:19:49 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.133 2005-12-20 00:56:31 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -1274,10 +1274,20 @@ void EventHandler::addJoyMapping(Event::Type event, int stick, int button)
|
|||
void EventHandler::addJoyAxisMapping(Event::Type event, int stick, int axis,
|
||||
int value)
|
||||
{
|
||||
// This confusing code is because each axis has two associated values,
|
||||
// but analog events only affect on of the axis.
|
||||
if(eventIsAnalog(event))
|
||||
myJoyAxisTable[stick][axis][0] = myJoyAxisTable[stick][axis][1] = event;
|
||||
else
|
||||
{
|
||||
// Otherwise, turn off the analog event(s) for this axis
|
||||
if(eventIsAnalog(myJoyAxisTable[stick][axis][0]))
|
||||
myJoyAxisTable[stick][axis][0] = Event::NoType;
|
||||
if(eventIsAnalog(myJoyAxisTable[stick][axis][1]))
|
||||
myJoyAxisTable[stick][axis][1] = Event::NoType;
|
||||
|
||||
myJoyAxisTable[stick][axis][(value > 0)] = event;
|
||||
}
|
||||
saveJoyAxisMapping();
|
||||
|
||||
setActionMappings();
|
||||
|
@ -1416,6 +1426,8 @@ void EventHandler::setDefaultJoymap()
|
|||
// Right joystick (assume joystick one, button zero)
|
||||
myJoyTable[1][0] = Event::JoystickOneFire;
|
||||
|
||||
// FIXME - add call to OSystem (or some other class) to set default
|
||||
// joy button mapping for the specific platform
|
||||
#ifdef PSP
|
||||
myJoyTable[0][0] = Event::TakeSnapshot; // Triangle
|
||||
myJoyTable[0][1] = Event::LoadState; // Circle
|
||||
|
@ -1524,10 +1536,7 @@ bool EventHandler::isValidList(string& list, IntArray& map, uInt32 length)
|
|||
while(buf >> key)
|
||||
map.push_back(atoi(key.c_str()));
|
||||
|
||||
if(event == Event::LastType && map.size() == length)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (event == Event::LastType && map.size() == length);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: InputTextDialog.cxx,v 1.8 2005-11-27 22:37:25 stephena Exp $
|
||||
// $Id: InputTextDialog.cxx,v 1.9 2005-12-20 00:56:31 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -126,6 +126,18 @@ void InputTextDialog::setEditString(const string& str, int idx)
|
|||
myInput[idx]->setEditString(str);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputTextDialog::setFocus(int idx)
|
||||
{
|
||||
cerr << "size = " << getFocusList().size() << endl;
|
||||
/* FIXME - a related problem in InputDialog EventMappingWidget list
|
||||
is occurring, whereby the focuslist isn't being filled
|
||||
right away
|
||||
if((unsigned int)idx < myInput.size())
|
||||
Dialog::setFocus(getFocusList()[idx]);
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputTextDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: InputTextDialog.hxx,v 1.5 2005-12-09 01:16:14 stephena Exp $
|
||||
// $Id: InputTextDialog.hxx,v 1.6 2005-12-20 00:56:31 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -44,6 +44,8 @@ class InputTextDialog : public Dialog, public CommandSender
|
|||
void setEmitSignal(int cmd) { myCmd = cmd; }
|
||||
void setTitle(const string& title);
|
||||
|
||||
void setFocus(int idx = 0);
|
||||
|
||||
protected:
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue