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
|
|
|
|
//
|
2010-01-10 02:58:28 +00:00
|
|
|
// Copyright (c) 1995-2010 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.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
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"
|
2008-05-11 21:18:35 +00:00
|
|
|
#include "Joystick.hxx"
|
2005-05-04 21:32:25 +00:00
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "DialogContainer.hxx"
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
DialogContainer::DialogContainer(OSystem* osystem)
|
2005-08-11 19:12:39 +00:00
|
|
|
: myOSystem(osystem),
|
|
|
|
myBaseDialog(NULL),
|
2008-12-28 21:01:55 +00:00
|
|
|
myTime(0)
|
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
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2009-07-01 14:39:01 +00:00
|
|
|
void DialogContainer::updateTime(uInt64 time)
|
2005-05-26 15:43:44 +00:00
|
|
|
{
|
|
|
|
// 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();
|
|
|
|
|
2006-05-25 22:23:39 +00:00
|
|
|
// Key still pressed
|
2005-05-26 15:43:44 +00:00
|
|
|
if(myCurrentKeyDown.keycode != 0 && myKeyRepeatTime < myTime)
|
|
|
|
{
|
|
|
|
activeDialog->handleKeyDown(myCurrentKeyDown.ascii, myCurrentKeyDown.keycode,
|
|
|
|
myCurrentKeyDown.flags);
|
2006-05-25 22:23:39 +00:00
|
|
|
myKeyRepeatTime = myTime + kRepeatSustainDelay;
|
2005-05-26 15:43:44 +00:00
|
|
|
}
|
|
|
|
|
2006-05-25 22:23:39 +00:00
|
|
|
// Mouse button still pressed
|
2005-05-26 15:43:44 +00:00
|
|
|
if(myCurrentMouseDown.button != -1 && myClickRepeatTime < myTime)
|
|
|
|
{
|
|
|
|
activeDialog->handleMouseDown(myCurrentMouseDown.x - activeDialog->_x,
|
|
|
|
myCurrentMouseDown.y - activeDialog->_y,
|
|
|
|
myCurrentMouseDown.button, 1);
|
2006-05-25 22:23:39 +00:00
|
|
|
myClickRepeatTime = myTime + kRepeatSustainDelay;
|
2005-05-26 15:43:44 +00:00
|
|
|
}
|
2005-12-24 22:09:36 +00:00
|
|
|
|
2006-05-25 22:23:39 +00:00
|
|
|
// Joystick button still pressed
|
|
|
|
if(myCurrentButtonDown.stick != -1 && myButtonRepeatTime < myTime)
|
2006-01-04 01:24:17 +00:00
|
|
|
{
|
2006-05-25 22:23:39 +00:00
|
|
|
activeDialog->handleJoyDown(myCurrentButtonDown.stick, myCurrentButtonDown.button);
|
|
|
|
myButtonRepeatTime = myTime + kRepeatSustainDelay;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Joystick axis still pressed
|
|
|
|
if(myCurrentAxisDown.stick != -1 && myAxisRepeatTime < myTime)
|
|
|
|
{
|
|
|
|
activeDialog->handleJoyAxis(myCurrentAxisDown.stick, myCurrentAxisDown.axis,
|
|
|
|
myCurrentAxisDown.value);
|
|
|
|
myAxisRepeatTime = myTime + kRepeatSustainDelay;
|
2006-01-04 01:24:17 +00:00
|
|
|
}
|
2005-05-26 15:43:44 +00:00
|
|
|
}
|
|
|
|
|
2005-05-04 21:32:25 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2008-12-27 23:27:32 +00:00
|
|
|
void DialogContainer::draw(bool full)
|
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
|
2008-12-27 23:27:32 +00:00
|
|
|
if(full)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
2005-08-01 22:33:16 +00:00
|
|
|
for(int i = 0; i < myDialogStack.size(); i++)
|
|
|
|
{
|
2008-12-21 19:51:35 +00:00
|
|
|
myDialogStack[i]->center();
|
2005-08-11 19:12:39 +00:00
|
|
|
myDialogStack[i]->setDirty();
|
2005-08-01 22:33:16 +00:00
|
|
|
myDialogStack[i]->drawDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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-11 19:12:39 +00:00
|
|
|
d->open();
|
2008-12-27 23:27:32 +00:00
|
|
|
|
|
|
|
myOSystem->frameBuffer().refresh();
|
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
|
2008-12-27 23:27:32 +00:00
|
|
|
myOSystem->frameBuffer().refresh();
|
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-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
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2006-12-08 16:49:42 +00:00
|
|
|
void DialogContainer::handleKeyEvent(int ascii, 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
|
|
|
{
|
2006-12-08 16:49:42 +00:00
|
|
|
myCurrentKeyDown.ascii = ascii;
|
2005-05-26 15:43:44 +00:00
|
|
|
myCurrentKeyDown.keycode = key;
|
|
|
|
myCurrentKeyDown.flags = mod;
|
2006-05-25 22:23:39 +00:00
|
|
|
myKeyRepeatTime = myTime + kRepeatInitialDelay;
|
2005-05-26 15:43:44 +00:00
|
|
|
|
2006-12-08 16:49:42 +00:00
|
|
|
activeDialog->handleKeyDown(ascii, 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
|
|
|
{
|
2006-12-08 16:49:42 +00:00
|
|
|
activeDialog->handleKeyUp(ascii, 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();
|
2008-06-13 13:14:52 +00:00
|
|
|
activeDialog->surface().translateCoords(x, y);
|
2005-05-04 21:32:25 +00:00
|
|
|
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();
|
2008-06-13 13:14:52 +00:00
|
|
|
activeDialog->surface().translateCoords(x, y);
|
2005-05-04 21:32:25 +00:00
|
|
|
|
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)
|
2007-07-31 15:46:21 +00:00
|
|
|
&& BSPF_abs(myLastClick.x - x) < 3
|
|
|
|
&& BSPF_abs(myLastClick.y - y) < 3)
|
2005-05-04 21:32:25 +00:00
|
|
|
{
|
|
|
|
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;
|
2006-05-25 22:23:39 +00:00
|
|
|
myClickRepeatTime = myTime + kRepeatInitialDelay;
|
2005-05-26 15:43:44 +00:00
|
|
|
|
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)
|
2006-05-25 22:23:39 +00:00
|
|
|
{
|
|
|
|
myCurrentButtonDown.stick = stick;
|
|
|
|
myCurrentButtonDown.button = button;
|
|
|
|
myButtonRepeatTime = myTime + kRepeatInitialDelay;
|
|
|
|
|
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->handleJoyDown(stick, button);
|
2006-05-25 22:23:39 +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
|
|
|
else
|
2006-05-25 22:23:39 +00:00
|
|
|
{
|
|
|
|
// Only stop firing events if it's the current button
|
|
|
|
if(stick == myCurrentButtonDown.stick)
|
|
|
|
myCurrentButtonDown.stick = myCurrentButtonDown.button = -1;
|
|
|
|
|
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->handleJoyUp(stick, button);
|
2006-05-25 22:23:39 +00:00
|
|
|
}
|
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)
|
|
|
|
{
|
Large number of changes related to controller input and handling.
Moved a lot of the code into the respective Controller classes, in the
process cleaning up the EventHandler (which was starting to get a little
unwieldy).
I've borrowed some code and ideas from z26, but also improved on it as
well:
1) Stelladaptor devices now send their events directly to a
controller class, allowing for any Stelladaptor device to emulate
a controller (to the limits of the input device, of course).
2) Hopefully fixed Stelladaptor driving controller support. Eckhard,
could you test this, since I don't have any of those myself?
3) Improved interaction with different input devices. For example,
a Stelladaptor, mouse, joystick (digital and/or analog axis), and
the keyboard can now simulate paddle events at the same time. So it
shouldn't matter what input devices you have plugged in; things should
'just work'. In the case of Stelladaptor paddles, you may have to
'zero' them by turning completely left, however.
4) Related to (3), changed mouse events to use relative motion. This
should fix the issues with paddle emulation/movement behaving
differently based on the window size.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1412 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2008-03-02 19:20:50 +00:00
|
|
|
// FIXME - analog axis events cause autofire to inadvertently come on and not go off
|
|
|
|
|
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();
|
|
|
|
|
2008-05-11 21:18:35 +00:00
|
|
|
int deadzone = Joystick::deadzone();
|
|
|
|
if(value > deadzone)
|
|
|
|
value -= deadzone;
|
|
|
|
else if(value < -deadzone )
|
|
|
|
value += deadzone;
|
2006-01-04 01:24:17 +00:00
|
|
|
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;
|
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;
|
2006-05-25 22:23:39 +00:00
|
|
|
myAxisRepeatTime = myTime + kRepeatInitialDelay;
|
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();
|
|
|
|
|
2006-05-25 22:23:39 +00:00
|
|
|
// FIXME - add repeat processing, similar to axis/button events
|
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->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-05-25 22:23:39 +00:00
|
|
|
myCurrentButtonDown.stick = myCurrentButtonDown.button = -1;
|
2006-01-04 01:24:17 +00:00
|
|
|
myCurrentAxisDown.stick = myCurrentAxisDown.axis = -1;
|
2006-05-25 22:23:39 +00:00
|
|
|
myCurrentHatDown.stick = myCurrentHatDown.hat = -1;
|
2005-12-07 02:33:56 +00:00
|
|
|
}
|