2005-05-04 21:32:25 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2005-06-16 00:56:00 +00:00
|
|
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
2005-05-04 21:32:25 +00:00
|
|
|
//
|
|
|
|
// See the file "license" for information on usage and redistribution of
|
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
// $Id: DialogContainer.cxx,v 1.32 2006-05-04 17:45:25 stephena Exp $
|
2005-05-04 21:32:25 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include "OSystem.hxx"
|
|
|
|
#include "Dialog.hxx"
|
|
|
|
#include "Stack.hxx"
|
2005-05-26 15:43:44 +00:00
|
|
|
#include "EventHandler.hxx"
|
2005-05-04 21:32:25 +00:00
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "DialogContainer.hxx"
|
|
|
|
|
2005-12-24 22:09:36 +00:00
|
|
|
#define JOY_DEADZONE 3200
|
|
|
|
|
2005-05-04 21:32:25 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
DialogContainer::DialogContainer(OSystem* osystem)
|
2005-08-11 19:12:39 +00:00
|
|
|
: myOSystem(osystem),
|
|
|
|
myBaseDialog(NULL),
|
|
|
|
myTime(0),
|
2005-12-24 22:50:53 +00:00
|
|
|
myRefreshFlag(false)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
2005-12-24 22:09:36 +00:00
|
|
|
reset();
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
DialogContainer::~DialogContainer()
|
|
|
|
{
|
|
|
|
if(myBaseDialog)
|
|
|
|
delete myBaseDialog;
|
|
|
|
}
|
|
|
|
|
2005-05-26 15:43:44 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::updateTime(uInt32 time)
|
|
|
|
{
|
|
|
|
// We only need millisecond precision
|
|
|
|
myTime = time / 1000;
|
|
|
|
|
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Check for pending continuous events and send them to the active dialog box
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
|
|
|
|
|
|
|
if(myCurrentKeyDown.keycode != 0 && myKeyRepeatTime < myTime)
|
|
|
|
{
|
|
|
|
activeDialog->handleKeyDown(myCurrentKeyDown.ascii, myCurrentKeyDown.keycode,
|
|
|
|
myCurrentKeyDown.flags);
|
|
|
|
myKeyRepeatTime = myTime + kKeyRepeatSustainDelay;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(myCurrentMouseDown.button != -1 && myClickRepeatTime < myTime)
|
|
|
|
{
|
|
|
|
activeDialog->handleMouseDown(myCurrentMouseDown.x - activeDialog->_x,
|
|
|
|
myCurrentMouseDown.y - activeDialog->_y,
|
|
|
|
myCurrentMouseDown.button, 1);
|
|
|
|
myClickRepeatTime = myTime + kClickRepeatSustainDelay;
|
|
|
|
}
|
2005-12-24 22:09:36 +00:00
|
|
|
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
/* FIXME - make this similar to the key-repeat code above
|
2006-01-08 20:55:54 +00:00
|
|
|
if(ourEnableJoyMouseFlag && myCurrentAxisDown.stick != -1 &&
|
|
|
|
myAxisRepeatTime < myTime)
|
2006-01-04 01:24:17 +00:00
|
|
|
{
|
|
|
|
// The longer an axis event is enabled, the faster it should change
|
|
|
|
// We do this by decreasing the amount of time between consecutive axis events
|
|
|
|
// After a certain threshold, send 10 events at a time (this is necessary
|
|
|
|
// since at some point, we'd like to process more eventss than the
|
|
|
|
// current framerate allows)
|
|
|
|
myCurrentAxisDown.count++;
|
|
|
|
int interval = myCurrentAxisDown.count / 40 + 1;
|
|
|
|
myAxisRepeatTime = myTime + kAxisRepeatSustainDelay / interval;
|
|
|
|
if(interval > 3)
|
|
|
|
{
|
|
|
|
for(int i = 0; i < 10; ++i)
|
|
|
|
activeDialog->handleJoyAxis(myCurrentAxisDown.stick, myCurrentAxisDown.axis,
|
|
|
|
myCurrentAxisDown.value);
|
|
|
|
myAxisRepeatTime = myTime + kAxisRepeatSustainDelay / 3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
activeDialog->handleJoyAxis(myCurrentAxisDown.stick, myCurrentAxisDown.axis,
|
|
|
|
myCurrentAxisDown.value);
|
|
|
|
myAxisRepeatTime = myTime + kAxisRepeatSustainDelay / interval;
|
|
|
|
}
|
|
|
|
}
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
*/
|
2005-05-26 15:43:44 +00:00
|
|
|
}
|
|
|
|
|
2005-05-04 21:32:25 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-08-11 19:12:39 +00:00
|
|
|
void DialogContainer::draw()
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
2005-08-01 22:33:16 +00:00
|
|
|
// Draw all the dialogs on the stack when we want a full refresh
|
2005-08-11 19:12:39 +00:00
|
|
|
if(myRefreshFlag)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
2005-08-01 22:33:16 +00:00
|
|
|
for(int i = 0; i < myDialogStack.size(); i++)
|
|
|
|
{
|
2005-08-11 19:12:39 +00:00
|
|
|
myDialogStack[i]->setDirty();
|
2005-08-01 22:33:16 +00:00
|
|
|
myDialogStack[i]->drawDialog();
|
|
|
|
}
|
2005-08-11 19:12:39 +00:00
|
|
|
myRefreshFlag = false;
|
2005-08-01 22:33:16 +00:00
|
|
|
}
|
|
|
|
else if(!myDialogStack.empty())
|
|
|
|
{
|
|
|
|
myDialogStack.top()->drawDialog();
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::addDialog(Dialog* d)
|
|
|
|
{
|
|
|
|
myDialogStack.push(d);
|
2005-08-10 12:23:42 +00:00
|
|
|
|
2005-08-11 19:12:39 +00:00
|
|
|
d->open();
|
2005-08-04 22:59:54 +00:00
|
|
|
d->setDirty(); // Next update() will take care of drawing
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::removeDialog()
|
|
|
|
{
|
|
|
|
if(!myDialogStack.empty())
|
|
|
|
{
|
|
|
|
myDialogStack.pop();
|
2005-08-04 22:59:54 +00:00
|
|
|
|
2005-08-11 19:12:39 +00:00
|
|
|
// We need to redraw the entire screen contents, since we don't know
|
|
|
|
// what was obscured
|
|
|
|
myOSystem->eventHandler().refreshDisplay();
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::reStack()
|
|
|
|
{
|
|
|
|
// Pop all items from the stack, and then add the base menu
|
|
|
|
while(!myDialogStack.empty())
|
2005-05-16 15:37:30 +00:00
|
|
|
myDialogStack.pop();
|
2005-07-20 15:52:58 +00:00
|
|
|
addDialog(myBaseDialog);
|
2005-05-16 15:37:30 +00:00
|
|
|
|
2005-08-29 18:36:42 +00:00
|
|
|
// Erase any previous messages
|
|
|
|
myOSystem->frameBuffer().hideMessage();
|
|
|
|
|
2005-05-26 15:43:44 +00:00
|
|
|
// Reset all continuous events
|
2005-12-24 22:09:36 +00:00
|
|
|
reset();
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-06-07 21:22:39 +00:00
|
|
|
void DialogContainer::handleKeyEvent(int unicode, int key, int mod, uInt8 state)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Send the event to the dialog box on the top of the stack
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
|
|
|
if(state == 1)
|
2005-05-26 15:43:44 +00:00
|
|
|
{
|
2005-06-07 21:22:39 +00:00
|
|
|
myCurrentKeyDown.ascii = unicode;
|
2005-05-26 15:43:44 +00:00
|
|
|
myCurrentKeyDown.keycode = key;
|
|
|
|
myCurrentKeyDown.flags = mod;
|
|
|
|
myKeyRepeatTime = myTime + kKeyRepeatInitialDelay;
|
|
|
|
|
2005-06-07 21:22:39 +00:00
|
|
|
activeDialog->handleKeyDown(unicode, key, mod);
|
2005-05-26 15:43:44 +00:00
|
|
|
}
|
2005-05-04 21:32:25 +00:00
|
|
|
else
|
2005-05-26 15:43:44 +00:00
|
|
|
{
|
2005-06-07 21:22:39 +00:00
|
|
|
activeDialog->handleKeyUp(unicode, key, mod);
|
2005-05-26 15:43:44 +00:00
|
|
|
|
|
|
|
// Only stop firing events if it's the current key
|
|
|
|
if (key == myCurrentKeyDown.keycode)
|
|
|
|
myCurrentKeyDown.keycode = 0;
|
|
|
|
}
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void DialogContainer::handleMouseMotionEvent(int x, int y, int button)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Send the event to the dialog box on the top of the stack
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
|
|
|
activeDialog->handleMouseMoved(x - activeDialog->_x,
|
|
|
|
y - activeDialog->_y,
|
|
|
|
button);
|
2005-06-10 18:46:11 +00:00
|
|
|
|
|
|
|
// Turn off continuous click events as soon as the mouse moves
|
|
|
|
myCurrentMouseDown.button = -1;
|
2005-05-04 21:32:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-13 18:28:06 +00:00
|
|
|
void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y, uInt8 state)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Send the event to the dialog box on the top of the stack
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
|
|
|
|
2005-08-31 19:15:10 +00:00
|
|
|
int button = (b == EVENT_LBUTTONDOWN || b == EVENT_LBUTTONUP) ? 1 : 2;
|
2005-05-04 21:32:25 +00:00
|
|
|
switch(b)
|
|
|
|
{
|
|
|
|
case EVENT_LBUTTONDOWN:
|
|
|
|
case EVENT_RBUTTONDOWN:
|
|
|
|
// If more than two clicks have been recorded, we start over
|
|
|
|
if(myLastClick.count == 2)
|
|
|
|
{
|
|
|
|
myLastClick.x = myLastClick.y = 0;
|
|
|
|
myLastClick.time = 0;
|
|
|
|
myLastClick.count = 0;
|
|
|
|
}
|
|
|
|
|
2005-05-26 15:43:44 +00:00
|
|
|
if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay)
|
2005-05-04 21:32:25 +00:00
|
|
|
&& ABS(myLastClick.x - x) < 3
|
|
|
|
&& ABS(myLastClick.y - y) < 3)
|
|
|
|
{
|
|
|
|
myLastClick.count++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
myLastClick.x = x;
|
|
|
|
myLastClick.y = y;
|
|
|
|
myLastClick.count = 1;
|
|
|
|
}
|
2005-05-26 15:43:44 +00:00
|
|
|
myLastClick.time = myTime;
|
|
|
|
|
|
|
|
// Now account for repeated mouse events (click and hold)
|
|
|
|
myCurrentMouseDown.x = x;
|
|
|
|
myCurrentMouseDown.y = y;
|
2005-08-31 19:15:10 +00:00
|
|
|
myCurrentMouseDown.button = button;
|
2005-05-26 15:43:44 +00:00
|
|
|
myClickRepeatTime = myTime + kClickRepeatInitialDelay;
|
|
|
|
|
2005-05-04 21:32:25 +00:00
|
|
|
activeDialog->handleMouseDown(x - activeDialog->_x, y - activeDialog->_y,
|
2005-08-31 19:15:10 +00:00
|
|
|
button, myLastClick.count);
|
2005-05-04 21:32:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_LBUTTONUP:
|
|
|
|
case EVENT_RBUTTONUP:
|
|
|
|
activeDialog->handleMouseUp(x - activeDialog->_x, y - activeDialog->_y,
|
2005-08-31 19:15:10 +00:00
|
|
|
button, myLastClick.count);
|
|
|
|
|
|
|
|
if(button == myCurrentMouseDown.button)
|
|
|
|
myCurrentMouseDown.button = -1;
|
2005-05-04 21:32:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_WHEELUP:
|
|
|
|
activeDialog->handleMouseWheel(x - activeDialog->_x, y - activeDialog->_y, -1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_WHEELDOWN:
|
|
|
|
activeDialog->handleMouseWheel(x - activeDialog->_x, y - activeDialog->_y, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-05-25 23:22:11 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-05-26 15:43:44 +00:00
|
|
|
void DialogContainer::handleJoyEvent(int stick, int button, uInt8 state)
|
2005-05-25 23:22:11 +00:00
|
|
|
{
|
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Send the event to the dialog box on the top of the stack
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
2005-12-24 22:09:36 +00:00
|
|
|
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
if(state == 1)
|
|
|
|
activeDialog->handleJoyDown(stick, button);
|
|
|
|
else
|
|
|
|
activeDialog->handleJoyUp(stick, button);
|
2005-05-25 23:22:11 +00:00
|
|
|
}
|
2005-12-07 02:33:56 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::handleJoyAxisEvent(int stick, int axis, int value)
|
|
|
|
{
|
2005-12-07 20:46:49 +00:00
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
2005-12-24 22:50:53 +00:00
|
|
|
// Send the event to the dialog box on the top of the stack
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
|
|
|
|
2006-01-04 01:24:17 +00:00
|
|
|
if(value > JOY_DEADZONE)
|
|
|
|
value -= JOY_DEADZONE;
|
|
|
|
else if(value < -JOY_DEADZONE )
|
|
|
|
value += JOY_DEADZONE;
|
|
|
|
else
|
|
|
|
value = 0;
|
|
|
|
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
// Only stop firing events if it's the current stick
|
|
|
|
if(myCurrentAxisDown.stick == stick && value == 0)
|
2006-01-04 01:24:17 +00:00
|
|
|
{
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
|
|
|
myCurrentAxisDown.count = 0;
|
2006-01-04 01:24:17 +00:00
|
|
|
}
|
2005-12-24 22:50:53 +00:00
|
|
|
else
|
2005-12-24 22:09:36 +00:00
|
|
|
{
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
// Now account for repeated axis events (press and hold)
|
|
|
|
myCurrentAxisDown.stick = stick;
|
|
|
|
myCurrentAxisDown.axis = axis;
|
|
|
|
myCurrentAxisDown.value = value;
|
|
|
|
myAxisRepeatTime = myTime + kAxisRepeatInitialDelay;
|
2005-12-24 22:09:36 +00:00
|
|
|
}
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
activeDialog->handleJoyAxis(stick, axis, value);
|
2005-12-24 22:09:36 +00:00
|
|
|
}
|
|
|
|
|
2006-01-09 16:50:01 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::handleJoyHatEvent(int stick, int hat, int value)
|
|
|
|
{
|
2006-01-09 19:30:04 +00:00
|
|
|
if(myDialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Send the event to the dialog box on the top of the stack
|
|
|
|
Dialog* activeDialog = myDialogStack.top();
|
|
|
|
|
Huge GUI-related changes. The GUI in launcher/options/command modes
is now fully navigable via the keyboard be means of 'tab-like'
functionality. This means that eventually systems without a keyboard
will also be able to navigate the interface without resorting to the
buggy joymouse code (which is soon to be removed).
Laid the infrastructure for remapping GUI events, whereby (for example)
a widget checks for Event::UISelect for 'doing its thing', vs. looking
at the Enter/Return key. So widgets now respond to events, and events
can (eventually) be remapped to *any* device.
Currently, these UI events are as follows:
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect
At present, they're hardcoded to key events only, so pressing 'Return'
will send a UISelect, cursor up a UIUp, etc. When the remapping code
is complete, *any* input will be able to send these events, and that
remapping will be distinct from emulation mode. So, for example,
cursor up in GUI mode might generate a UIUp event, but in emulation
mode might generate a left joystick up event.
Modified 'tab' key while in emulation mode to only enter the options
menu. Once inside the menu, the tab key acts as navigation between
elements, and exiting the options menu requires navigating to the
'Exit menu' button.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1100 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-05-04 17:45:25 +00:00
|
|
|
// FIXME - add speedup processing, similar to axis events
|
|
|
|
activeDialog->handleJoyHat(stick, hat, value);
|
2005-12-24 22:09:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void DialogContainer::reset()
|
|
|
|
{
|
|
|
|
myCurrentKeyDown.keycode = 0;
|
|
|
|
myCurrentMouseDown.button = -1;
|
|
|
|
myLastClick.x = myLastClick.y = 0;
|
|
|
|
myLastClick.time = 0;
|
|
|
|
myLastClick.count = 0;
|
|
|
|
|
2006-01-04 01:24:17 +00:00
|
|
|
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
|
|
|
myCurrentAxisDown.count = 0;
|
2005-12-07 02:33:56 +00:00
|
|
|
}
|