Re-added 'joymouse' argument, and made sure that joystick navigation is

completely disabled when it's turned on.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@942 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-01-08 20:55:54 +00:00
parent beab75c5b0
commit e545c973c5
6 changed files with 32 additions and 18 deletions

View File

@ -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: OSystem.cxx,v 1.54 2006-01-08 13:55:03 stephena Exp $
// $Id: OSystem.cxx,v 1.55 2006-01-08 20:55:53 stephena Exp $
//============================================================================
#include <cassert>
@ -130,6 +130,8 @@ bool OSystem::create()
#ifdef CHEATCODE_SUPPORT
myFeatures += "Cheats";
#endif
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: CommandDialog.cxx,v 1.6 2006-01-04 01:24:17 stephena Exp $
// $Id: CommandDialog.cxx,v 1.7 2006-01-08 20:55:53 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -208,6 +208,9 @@ void CommandDialog::handleKeyDown(int ascii, int keycode, int modifiers)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CommandDialog::handleJoyAxis(int stick, int axis, int value)
{
if(!parent()->joymouse())
return;
// We make the (hopefully) valid assumption that all joysticks
// treat axis the same way. Eventually, we may need to remap
// these actions of this assumption is invalid.

View File

@ -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: DialogContainer.cxx,v 1.27 2006-01-08 13:55:03 stephena Exp $
// $Id: DialogContainer.cxx,v 1.28 2006-01-08 20:55:53 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -73,7 +73,8 @@ void DialogContainer::updateTime(uInt32 time)
myClickRepeatTime = myTime + kClickRepeatSustainDelay;
}
if(myCurrentAxisDown.stick != -1 && myAxisRepeatTime < myTime)
if(ourEnableJoyMouseFlag && myCurrentAxisDown.stick != -1 &&
myAxisRepeatTime < myTime)
{
// 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
@ -311,7 +312,7 @@ void DialogContainer::handleJoyEvent(int stick, int button, uInt8 state)
else
activeDialog->handleJoyUp(stick, button);
}
else
else if(ourEnableJoyMouseFlag)
myOSystem->eventHandler().createMouseButtonEvent(
ourJoyMouse.x, ourJoyMouse.y, state);
}

View File

@ -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: DialogContainer.hxx,v 1.14 2006-01-08 13:55:03 stephena Exp $
// $Id: DialogContainer.hxx,v 1.15 2006-01-08 20:55:54 stephena Exp $
//============================================================================
#ifndef DIALOG_CONTAINER_HXX
@ -37,7 +37,7 @@ typedef FixedStack<Dialog *> DialogStack;
a stack, and handles their events.
@author Stephen Anthony
@version $Id: DialogContainer.hxx,v 1.14 2006-01-08 13:55:03 stephena Exp $
@version $Id: DialogContainer.hxx,v 1.15 2006-01-08 20:55:54 stephena Exp $
*/
class DialogContainer
{
@ -141,11 +141,10 @@ class DialogContainer
*/
virtual void initialize() = 0;
// Whether to enable joymouse emulation
static bool ourEnableJoyMouseFlag;
// Emulation of mouse using joystick axis events
static JoyMouse ourJoyMouse;
/**
Whether joymouse emulation is enabled
*/
static bool joymouse() { return ourEnableJoyMouseFlag; }
private:
void handleJoyMouse(uInt32);
@ -203,6 +202,12 @@ class DialogContainer
uInt32 time; // Time
int count; // How often was it already pressed?
} myLastClick;
// Whether to enable joymouse emulation
static bool ourEnableJoyMouseFlag;
// Emulation of mouse using joystick axis events
static JoyMouse ourJoyMouse;
};
#endif

View File

@ -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: LauncherDialog.cxx,v 1.36 2006-01-05 18:53:23 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.37 2006-01-08 20:55:54 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -394,6 +394,9 @@ void LauncherDialog::handleKeyDown(int ascii, int keycode, int modifiers)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::handleJoyAxis(int stick, int axis, int value)
{
if(!parent()->joymouse())
return;
// We make the (hopefully) valid assumption that all joysticks
// treat axis the same way. Eventually, we may need to remap
// these actions of this assumption is invalid.

View File

@ -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: Widget.cxx,v 1.40 2005-12-21 01:50:16 stephena Exp $
// $Id: Widget.cxx,v 1.41 2006-01-08 20:55:54 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -23,6 +23,7 @@
#include "FrameBuffer.hxx"
#include "Font.hxx"
#include "Dialog.hxx"
#include "DialogContainer.hxx"
#include "Command.hxx"
#include "GuiObject.hxx"
#include "bspf.hxx"
@ -30,8 +31,6 @@
#include "Widget.hxx"
#include "EditableWidget.hxx"
//static int COUNT = 0;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget::Widget(GuiObject* boss, int x, int y, int w, int h)
: GuiObject(boss->instance(), boss->parent(), x, y, w, h),
@ -377,8 +376,9 @@ bool ButtonWidget::handleKeyDown(int ascii, int keycode, int modifiers)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleJoyDown(int stick, int button)
{
// Any button activates the button
handleMouseUp(0, 0, 1, 0);
// Any button activates the button, but only while in joymouse mode
if(DialogContainer::joymouse())
handleMouseUp(0, 0, 1, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -