Changed 'hidecursor' to 'cursor', and allowed it to set cursor visibility

for UI and emulation modes separately.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3179 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-06-28 18:16:33 +00:00
parent a9ba018403
commit 26e9f15b86
8 changed files with 50 additions and 28 deletions

View File

@ -14,6 +14,10 @@
4.6.1 to 4.7: (mmm dd, 2015)
* Changed 'hidecursor' commandline argument (and associated UI item) to
'cursor'. The new argument allows to set mouse cursor visibility
separately for both UI and emulation modes.
* Fixed memory leak; the game console wasn't being closed after exiting
a ROM.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -10,7 +10,7 @@
<br><br>
<center><h2><b>A multi-platform Atari 2600 VCS emulator</b></h2></center>
<center><h4><b>Release 4.6.1</b></h4></center>
<center><h4><b>Release 4.7</b></h4></center>
<br><br>
<center><h2><b>User's Guide</b></h2></center>
@ -54,7 +54,7 @@
<br><br><br>
<center><b>February 1999 - April 2015</b></center>
<center><b>February 1999 - July 2015</b></center>
<center><b>The Stella Team</b></center>
<center><b><a href="http://stella.sourceforge.net">Stella Homepage</a></b></center>
@ -1972,8 +1972,8 @@
</tr>
<tr>
<td><pre>-hidecursor &lt;1|0&gt;</pre></td>
<td>Always hide the mouse cursor, or show it when appropriate.</td>
<td><pre>-cursor &lt;0|1|2|3&gt;</pre></td>
<td>Set mouse cursor state in UI/emulation modes.</td>
</tr>
<tr>
@ -2610,13 +2610,13 @@
<tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">CommandLine</a></th></tr>
<tr><td>Stelladaptor port order</td><td>Specifies which virtual port each Stelladaptor/2600-daptor uses (See <b>Advanced Configuration - <a href="#Adaptor">Stelladaptor/2600-daptor Support</a></b>)</td><td>-saport</td></tr>
<tr><td>Use mouse as ...</td><td>Allow the mouse to emulate various controllers</td><td>-usemouse</td></tr>
<tr><td>Mouse cursor visibility</td><td>Show/hide cursor depending on current state</td><td>-cursor</td></tr>
<tr><td>AVox serial port</td><td>Described in further detail in <b>Advanced Configuration - <a href="#AtariVox">AtariVox/SaveKey Support</a></b> </td><td>-avoxport</td></tr>
<tr><td>Joy deadzone size</td><td>Deadzone area for axes on joysticks/gamepads</td><td>-joydeadzone</td></tr>
<tr><td>Digital paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
<tr><td>Mouse paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a mouse</td><td>-msense</td></tr>
<tr><td>Allow all 4 ...</td><td>Allow all 4 joystick directions to be pressed simultaneously</td><td>-joyallow4</td></tr>
<tr><td>Grab mouse ...</td><td>Keep mouse in window in emulation mode</td><td>-grabmouse</td></tr>
<tr><td>Always hide mouse ...</td><td>Completely disable showing the mouse cursor</td><td>-hidemouse</td></tr>
<tr><td>Use Control key combos</td><td>Enable using Control key in keyboard actions</td><td>-ctrlcombo</td></tr>
<tr><td>Show Joystick Database</td><td>Show all joysticks that Stella knows about, with the option to remove them</td><td>&nbsp;</td></tr>
</table>

View File

@ -593,12 +593,19 @@ bool FrameBuffer::changeWindowedVidMode(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setCursorState()
{
// Always grab mouse in emulation (if enabled),
// and don't show the cursor during emulation (if enabled)
// Always grab mouse in emulation (if enabled)
bool emulation =
myOSystem.eventHandler().state() == EventHandler::S_EMULATE;
grabMouse(emulation && myOSystem.settings().getBool("grabmouse"));
showCursor(!(emulation || myOSystem.settings().getBool("hidecursor")));
// Show/hide cursor in UI/emulation mode based on 'cursor' setting
switch(myOSystem.settings().getInt("cursor"))
{
case 0: showCursor(false); break;
case 1: showCursor(emulation); break;
case 2: showCursor(!emulation); break;
case 3: showCursor(true); break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -84,7 +84,7 @@ Settings::Settings(OSystem& osystem)
setInternal("joyallow4", "false");
setInternal("usemouse", "analog");
setInternal("grabmouse", "true");
setInternal("hidecursor", "false");
setInternal("cursor", "2");
setInternal("dsense", "5");
setInternal("msense", "7");
setInternal("saport", "lr");
@ -296,6 +296,10 @@ void Settings::validate()
if(i < 1) setInternal("dsense", "1");
else if(i > 10) setInternal("dsense", "10");
i = getInt("cursor");
if(i < 0 || i > 3)
setInternal("cursor", "2");
i = getInt("dsense");
if(i < 1) setInternal("dsense", "1");
else if(i > 10) setInternal("dsense", "10");
@ -393,7 +397,7 @@ void Settings::usage() const
<< " analog|\n"
<< " never> Use mouse as a controller as specified by ROM properties in given mode(see manual)\n"
<< " -grabmouse <1|0> Locks the mouse cursor in the TIA window\n"
<< " -hidecursor <1|0> Always hide the cursor, or show it when appropriate\n"
<< " -cursor <0,1,2,3> Set cursor state in UI/emulation modes\n"
<< " -dsense <number> Sensitivity of digital emulated paddle movement (1-10)\n"
<< " -msense <number> Sensitivity of mouse emulated paddle movement (1-15)\n"
<< " -saport <lr|rl> How to assign virtual ports to multiple Stelladaptor/2600-daptors\n"

View File

@ -112,7 +112,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
// Stelladaptor mappings
xpos = 5; ypos = 5;
lwidth = font.getStringWidth("Use mouse as a controller: ");
pwidth = font.getStringWidth("Analog devices");
pwidth = font.getStringWidth("-UI, -Emulation");
VarList::push_back(items, "Left / Right", "lr");
VarList::push_back(items, "Right / Left", "rl");
@ -130,6 +130,20 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
"Use mouse as a controller: ", lwidth);
wid.push_back(myMouseControl);
// Mouse cursor state
ypos += lineHeight + 5;
items.clear();
VarList::push_back(items, "-UI, -Emulation", "0");
VarList::push_back(items, "-UI, +Emulation", "1");
VarList::push_back(items, "+UI, -Emulation", "2");
VarList::push_back(items, "+UI, +Emulation", "3");
myCursorState = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
"Mouse cursor visibility: ", lwidth);
wid.push_back(myCursorState);
#ifndef WINDOWED_SUPPORT
myCursorState->clearFlags(WIDGET_ENABLED);
#endif
// Add AtariVox serial port
ypos += lineHeight + 5;
lwidth = font.getStringWidth("AVox serial port: ");
@ -193,15 +207,6 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
myGrabMouse->clearFlags(WIDGET_ENABLED);
#endif
// Hide mouse cursor
ypos += lineHeight + 4;
myHideCursor = new CheckboxWidget(myTab, font, xpos, ypos,
"Always hide mouse cursor");
wid.push_back(myHideCursor);
#ifndef WINDOWED_SUPPORT
myHideCursor->clearFlags(WIDGET_ENABLED);
#endif
// Enable/disable control key-combos
ypos += lineHeight + 4;
myCtrlCombo = new CheckboxWidget(myTab, font, xpos, ypos,
@ -229,6 +234,9 @@ void InputDialog::loadConfig()
myMouseControl->setSelected(
instance().settings().getString("usemouse"), "analog");
// Mouse cursor state
myCursorState->setSelected(instance().settings().getString("cursor"), "2");
// Joystick deadzone
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
myDeadzoneLabel->setValue(Joystick::deadzone());
@ -248,9 +256,6 @@ void InputDialog::loadConfig()
// Grab mouse
myGrabMouse->setState(instance().settings().getBool("grabmouse"));
// Hide cursor
myHideCursor->setState(instance().settings().getBool("hidecursor"));
// Enable/disable control key-combos
myCtrlCombo->setState(instance().settings().getBool("ctrlcombo"));
@ -290,8 +295,9 @@ void InputDialog::saveConfig()
instance().eventHandler().allowAllDirections(allowall4);
// Grab mouse and hide cursor
const string& cursor = myCursorState->getSelectedTag().toString();
instance().settings().setValue("cursor", cursor);
instance().settings().setValue("grabmouse", myGrabMouse->getState());
instance().settings().setValue("hidecursor", myHideCursor->getState());
instance().frameBuffer().setCursorState();
// Enable/disable control key-combos
@ -319,6 +325,9 @@ void InputDialog::setDefaults()
// Use mouse as a controller
myMouseControl->setSelected("analog");
// Mouse cursor state
myCursorState->setSelected("2");
// Joystick deadzone
myDeadzone->setValue(0);
myDeadzoneLabel->setValue(3200);
@ -338,9 +347,6 @@ void InputDialog::setDefaults()
// Grab mouse
myGrabMouse->setState(true);
// Hide cursor
myHideCursor->setState(false);
// Enable/disable control key-combos
myCtrlCombo->setState(true);

View File

@ -70,6 +70,7 @@ class InputDialog : public Dialog
PopUpWidget* mySAPort;
PopUpWidget* myMouseControl;
PopUpWidget* myCursorState;
EditTextWidget* myAVoxPort;
@ -81,7 +82,6 @@ class InputDialog : public Dialog
StaticTextWidget* myMPaddleLabel;
CheckboxWidget* myAllowAll4;
CheckboxWidget* myGrabMouse;
CheckboxWidget* myHideCursor;
CheckboxWidget* myCtrlCombo;
ButtonWidget* myJoyDlgButton;

View File

@ -41,6 +41,7 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
int w = _w - 2 * xpos;
int h = _h - buttonHeight - ypos - 20;
myJoyList = new StringListWidget(this, font, xpos, ypos, w, h);
myJoyList->setEditable(false);
wid.push_back(myJoyList);
// Joystick ID