Fairly large reorganization of the EventHandler class, separating out

SDL-specific code into its own EventHandlerSDL2 class.  This is part
of a larger reorganization of the codebase, to completely remove
SDL-specific code from src/emucore, and make it easier to port to SDL2.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2850 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-02-15 21:37:29 +00:00
parent 32199509b3
commit 5a48bf0311
20 changed files with 1327 additions and 1174 deletions

View File

@ -0,0 +1,176 @@
//============================================================================
//
// 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
//
// Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#include "OSystem.hxx"
#include "EventHandlerSDL2.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerSDL2::EventHandlerSDL2(OSystem* osystem)
: EventHandler(osystem)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerSDL2::~EventHandlerSDL2()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandlerSDL2::initializeJoysticks()
{
#ifdef JOYSTICK_SUPPORT
// Initialize the joystick subsystem
if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) || (SDL_NumJoysticks() <= 0))
{
myOSystem->logMessage("No joysticks present.", 1);
return;
}
int numSticks = SDL_NumJoysticks();
for(uInt32 i = 0; i < numSticks; ++i)
addJoystick(new JoystickSDL2(i), i);
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandlerSDL2::pollEvent()
{
while(SDL_PollEvent(&event))
{
switch(event.type)
{
// keyboard events
case SDL_KEYUP:
case SDL_KEYDOWN:
{
handleKeyEvent((StellaKey)event.key.keysym.sym,
(StellaMod)event.key.keysym.mod,
event.key.keysym.unicode & 0x7f,
event.key.type == SDL_KEYDOWN);
break;
}
case SDL_MOUSEMOTION:
{
handleMouseMotionEvent(event.motion.x, event.motion.y,
event.motion.xrel, event.motion.yrel, 0);
break;
}
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
bool pressed = event.button.type == SDL_MOUSEBUTTONDOWN;
switch(event.button.button)
{
case SDL_BUTTON_LEFT:
handleMouseButtonEvent(pressed ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP,
event.button.x, event.button.y);
break;
case SDL_BUTTON_RIGHT:
handleMouseButtonEvent(pressed ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP,
event.button.x, event.button.y);
break;
case SDL_BUTTON_WHEELDOWN:
if(pressed)
handleMouseButtonEvent(EVENT_WHEELDOWN, event.button.x,
event.button.y);
break;
case SDL_BUTTON_WHEELUP:
if(pressed)
handleMouseButtonEvent(EVENT_WHEELUP, event.button.x,
event.button.y);
break;
}
break;
}
#ifdef JOYSTICK_SUPPORT
case SDL_JOYBUTTONUP:
case SDL_JOYBUTTONDOWN:
{
handleJoyEvent(event.jbutton.which, event.jbutton.button,
event.jbutton.state == SDL_PRESSED ? 1 : 0);
break;
}
case SDL_JOYAXISMOTION:
{
handleJoyAxisEvent(event.jaxis.which, event.jaxis.axis,
event.jaxis.value);
break;
}
case SDL_JOYHATMOTION:
{
int v = event.jhat.value, value = 0;
if(v & SDL_HAT_UP) value |= EVENT_HATUP_M;
if(v & SDL_HAT_DOWN) value |= EVENT_HATDOWN_M;
if(v & SDL_HAT_LEFT) value |= EVENT_HATLEFT_M;
if(v & SDL_HAT_RIGHT) value |= EVENT_HATRIGHT_M;
if(v == SDL_HAT_CENTERED) value = EVENT_HATCENTER_M;
handleJoyHatEvent(event.jhat.which, event.jhat.hat, value);
break; // SDL_JOYHATMOTION
}
#endif
case SDL_QUIT:
handleEvent(Event::Quit, 1);
break; // SDL_QUIT
#if 0 // FIXME
case SDL_ACTIVEEVENT:
if((event.active.state & SDL_APPACTIVE) && (event.active.gain == 0))
if(myState == S_EMULATE) enterMenuMode(S_MENU);
break; // SDL_ACTIVEEVENT
case SDL_VIDEOEXPOSE:
myOSystem->frameBuffer().refresh();
break; // SDL_VIDEOEXPOSE
#endif
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx)
: stick(NULL)
{
#ifdef JOYSTICK_SUPPORT
stick = SDL_JoystickOpen(idx);
if(stick)
{
initialize(SDL_JoystickName(idx), SDL_JoystickNumAxes(stick),
SDL_JoystickNumButtons(stick), SDL_JoystickNumHats(stick));
}
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerSDL2::JoystickSDL2::~JoystickSDL2()
{
#ifdef JOYSTICK_SUPPORT
if(stick)
SDL_JoystickClose(stick);
stick = NULL;
#endif
}

View File

@ -0,0 +1,74 @@
//============================================================================
//
// 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
//
// Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef EVENTHANDLER_SDL2_HXX
#define EVENTHANDLER_SDL2_HXX
#include <SDL.h>
#include "EventHandler.hxx"
/**
This class handles event collection from the point of view of the specific
backend toolkit (SDL2). It converts from SDL2-specific events into events
that the Stella core can understand.
@author Stephen Anthony
@version $Id$
*/
class EventHandlerSDL2 : public EventHandler
{
public:
/**
Create a new SDL2 event handler object
*/
EventHandlerSDL2(OSystem* osystem);
/**
Destructor
*/
virtual ~EventHandlerSDL2();
private:
/**
Set up any joysticks on the system.
*/
void initializeJoysticks();
/**
Collects and dispatches any pending SDL2 events.
*/
void pollEvent();
private:
SDL_Event event;
// A thin wrapper around a basic StellaJoystick, holding the pointer to
// the underlying SDL stick.
class JoystickSDL2 : public StellaJoystick
{
public:
JoystickSDL2(int idx);
virtual ~JoystickSDL2();
private:
SDL_Joystick* stick;
};
};
#endif

View File

@ -18,7 +18,6 @@
//============================================================================
#include <SDL.h>
#include <SDL_syswm.h>
#include <sstream>
#include <time.h>
#include <fstream>

View File

@ -22,7 +22,6 @@
#include <SDL.h>
#include <SDL_opengl.h>
#include <SDL_syswm.h>
class OSystem;
class FBSurfaceUI;

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#define STELLA_VERSION "3.9.100_svn"
#define STELLA_VERSION "3.9.101_svn"
#define STELLA_BUILD atoi("$Rev$" + 6)
#endif

View File

@ -21,6 +21,7 @@
#include <cstdlib>
#include "bspf.hxx"
#include "MediaFactory.hxx"
#include "Console.hxx"
#include "Event.hxx"
#include "EventHandler.hxx"
@ -32,22 +33,6 @@
#include "OSystem.hxx"
#include "System.hxx"
#if defined(BSPF_UNIX)
#include "SettingsUNIX.hxx"
#include "OSystemUNIX.hxx"
#elif defined(BSPF_WINDOWS)
#include "SettingsWINDOWS.hxx"
#include "OSystemWINDOWS.hxx"
#elif defined(BSPF_MAC_OSX)
#include "SettingsMACOSX.hxx"
#include "OSystemMACOSX.hxx"
extern "C" {
int stellaMain(int argc, char* argv[]);
}
#else
#error Unsupported platform!
#endif
#ifdef DEBUGGER_SUPPORT
#include "Debugger.hxx"
#endif
@ -59,6 +44,7 @@
// Pointer to the main parent osystem object or the null pointer
OSystem* theOSystem = (OSystem*) NULL;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Does general Cleanup in case any operation failed (or at end of program)
int Cleanup()
{
@ -74,9 +60,8 @@ int Cleanup()
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#if defined(MAC_OSX)
#if defined(BSPF_MAC_OSX)
int stellaMain(int argc, char* argv[])
#else
int main(int argc, char* argv[])
@ -84,20 +69,8 @@ int main(int argc, char* argv[])
{
ios_base::sync_with_stdio(false);
// Create the parent OSystem object and settings
#if defined(BSPF_UNIX)
theOSystem = new OSystemUNIX();
SettingsUNIX settings(theOSystem);
#elif defined(BSPF_WINDOWS)
theOSystem = new OSystemWINDOWS();
SettingsWINDOWS settings(theOSystem);
#elif defined(MAC_OSX)
theOSystem = new OSystemMACOSX();
SettingsMACOSX settings(theOSystem);
#else
#error Unsupported platform!
#endif
// Create the parent OSystem object
theOSystem = MediaFactory::createOSystem();
theOSystem->loadConfig();
theOSystem->logMessage("Loading config options ...", 2);

View File

@ -3,6 +3,7 @@ MODULE := src/common
MODULE_OBJS := \
src/common/mainSDL.o \
src/common/Base.o \
src/common/EventHandlerSDL2.o \
src/common/FrameBufferSDL2.o \
src/common/FBSurfaceUI.o \
src/common/FBSurfaceTIA.o \

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@
#define EVENTHANDLER_HXX
#include <map>
#include <SDL.h>
class Console;
class OSystem;
@ -52,6 +51,13 @@ enum JoyHat {
EVENT_HATRIGHT = 3,
EVENT_HATCENTER = 4
};
enum JoyHatMask {
EVENT_HATUP_M = 1<<0,
EVENT_HATDOWN_M = 1<<1,
EVENT_HATLEFT_M = 1<<2,
EVENT_HATRIGHT_M = 1<<3,
EVENT_HATCENTER_M = 1<<4
};
enum EventMode {
kEmulationMode = 0, // make sure these are set correctly,
@ -110,13 +116,6 @@ class EventHandler
*/
void initialize();
/**
Set up any joysticks on the system. This must be called *after* the
framebuffer has been created, since SDL requires the video to be
intialized before joysticks can be probed.
*/
void setupJoysticks();
/**
Maps the given Stelladaptor/2600-daptor(s) to specified ports on a real 2600.
@ -177,7 +176,7 @@ class EventHandler
inline bool kbdAlt(int mod) const
{
#ifndef MAC_OSX
#ifndef BSPF_MAC_OSX
return (mod & KMOD_ALT);
#else
return (mod & KMOD_META);
@ -221,11 +220,11 @@ class EventHandler
Event::Type eventForKey(StellaKey key, EventMode mode) const
{ return myKeyTable[key][mode]; }
Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode) const
{ return myJoysticks[stick].axisTable[axis][(value > 0)][mode]; }
{ return myJoysticks[stick]->axisTable[axis][(value > 0)][mode]; }
Event::Type eventForJoyButton(int stick, int button, EventMode mode) const
{ return myJoysticks[stick].btnTable[button][mode]; }
{ return myJoysticks[stick]->btnTable[button][mode]; }
Event::Type eventForJoyHat(int stick, int hat, int value, EventMode mode) const
{ return myJoysticks[stick].hatTable[hat][value][mode]; }
{ return myJoysticks[stick]->hatTable[hat][value][mode]; }
Event::Type eventAtIndex(int idx, EventMode mode) const;
string actionAtIndex(int idx, EventMode mode) const;
@ -318,6 +317,82 @@ class EventHandler
*/
void allowAllDirections(bool allow) { myAllowAllDirectionsFlag = allow; }
protected:
// Global OSystem object
OSystem* myOSystem;
/**
Methods which are called by derived classes to handle specific types
of input.
*/
// TODO - adapt these to SDL2
void handleKeyEvent(StellaKey key, StellaMod mod, char ascii, bool state);
void handleMouseMotionEvent(int x, int y, int xrel, int yrel, int button);
void handleMouseButtonEvent(MouseButton b, int x, int y);
void handleJoyEvent(int stick, int button, uInt8 state);
void handleJoyAxisEvent(int stick, int axis, int value);
void handleJoyHatEvent(int stick, int hat, int value);
/**
Set up any joysticks on the system.
*/
virtual void initializeJoysticks() = 0;
/**
Collects and dispatches any pending events.
*/
virtual void pollEvent() = 0;
// An abstraction of joystick in Stella.
// A StellaJoystick holds its own event mapping information, space for
// which is dynamically allocated based on the actual number of buttons,
// axes, etc that the device contains.
// Specific backend class(es) will inherit from this class, and implement
// functionality specific to the device.
class StellaJoystick
{
friend class EventHandler;
public:
StellaJoystick();
virtual ~StellaJoystick();
string getMap() const;
bool setMap(const string& map);
void eraseMap(EventMode mode);
void eraseEvent(Event::Type event, EventMode mode);
string about() const;
protected:
void initialize(const string& desc, int axes, int buttons, int hats);
private:
enum JoyType {
JT_NONE = 0,
JT_REGULAR = 1,
JT_STELLADAPTOR_LEFT = 2,
JT_STELLADAPTOR_RIGHT = 3,
JT_2600DAPTOR_LEFT = 4,
JT_2600DAPTOR_RIGHT = 5
};
JoyType type;
string name;
int numAxes, numButtons, numHats;
Event::Type (*axisTable)[2][kNumModes];
Event::Type (*btnTable)[kNumModes];
Event::Type (*hatTable)[4][kNumModes];
int* axisLastValue;
private:
void getValues(const string& list, IntArray& map);
};
/**
Add the given joystick to the list of sticks available to the handler.
*/
void addJoystick(StellaJoystick* stick, int idx);
private:
enum {
kComboSize = 16,
@ -338,7 +413,7 @@ class EventHandler
The following methods take care of assigning action mappings.
*/
void setActionMappings(EventMode mode);
void setSDLMappings();
void setKeyNames();
void setKeymap();
void setJoymap();
void setDefaultKeymap(Event::Type, EventMode mode);
@ -346,7 +421,6 @@ class EventHandler
void saveKeyMapping();
void saveJoyMapping();
void saveComboMapping();
void setMouseAsPaddle(int paddle, const string& message);
/**
Tests if a given event should use continuous/analog values.
@ -358,7 +432,7 @@ class EventHandler
void setEventState(State state);
// Callback function invoked by the event-reset SDL Timer
// Callback function invoked by the event-reset timer
static uInt32 resetEventsCallback(uInt32 interval, void* param);
private:
@ -370,14 +444,6 @@ class EventHandler
bool allow_combo;
};
struct JoyMouse { // Used for joystick to mouse emulation
bool active;
int x, y, x_amt, y_amt, amt, val, old_val;
};
// Global OSystem object
OSystem* myOSystem;
// Global Event object
Event myEvent;
@ -395,7 +461,7 @@ class EventHandler
Event::Type myComboTable[kComboSize][kEventsPerCombo];
// Array of strings which correspond to the given StellaKey
string ourKBDKMapping[KBDK_LAST];
string ourKBDKNames[KBDK_LAST];
// Indicates the current state of the system (ie, which mode is current)
State myState;
@ -430,47 +496,7 @@ class EventHandler
static const Event::Type SA_Button[2][4];
static const Event::Type SA_Key[2][12];
// Thin wrapper holding all information about an SDL joystick in Stella.
// A StellaJoystick holds its own event mapping information, space for
// which is dynamically allocated based on the actual number of buttons,
// axes, etc that the device contains.
class StellaJoystick
{
public:
StellaJoystick();
virtual ~StellaJoystick();
string setStick(int i);
string getMap() const;
bool setMap(const string& map);
void eraseMap(EventMode mode);
void eraseEvent(Event::Type event, EventMode mode);
string about() const;
public:
enum JoyType {
JT_NONE = 0,
JT_REGULAR = 1,
JT_STELLADAPTOR_LEFT = 2,
JT_STELLADAPTOR_RIGHT = 3,
JT_2600DAPTOR_LEFT = 4,
JT_2600DAPTOR_RIGHT = 5
};
JoyType type;
string name;
SDL_Joystick* stick;
int numAxes, numButtons, numHats;
Event::Type (*axisTable)[2][kNumModes];
Event::Type (*btnTable)[kNumModes];
Event::Type (*hatTable)[4][kNumModes];
int* axisLastValue;
private:
void getValues(const string& list, IntArray& map);
};
StellaJoystick* myJoysticks;
uInt32 myNumJoysticks;
Common::Array<StellaJoystick*> myJoysticks;
map<string,string> myJoystickMap;
};

View File

@ -22,9 +22,21 @@
#include "OSystem.hxx"
#include "Settings.hxx"
#if defined(BSPF_UNIX)
#include "SettingsUNIX.hxx"
#include "OSystemUNIX.hxx"
#elif defined(BSPF_WINDOWS)
#include "SettingsWINDOWS.hxx"
#include "OSystemWINDOWS.hxx"
#elif defined(BSPF_MAC_OSX)
#include "SettingsMACOSX.hxx"
#include "OSystemMACOSX.hxx"
#else
#error Unsupported platform!
#endif
#include "FrameBufferSDL2.hxx"
#include "EventHandlerSDL2.hxx"
#ifdef SOUND_SUPPORT
#include "SoundSDL2.hxx"
#else
@ -32,9 +44,9 @@
#endif
/**
This class deals with the different framebuffer/sound implementations
for the various ports of Stella, and always returns a valid media object
based on the specific port and restrictions on that port.
This class deals with the different framebuffer/sound/event
implementations for the various ports of Stella, and always returns a
valid object based on the specific port and restrictions on that port.
As of SDL2, this code is greatly simplified. However, it remains here
in case we ever have multiple backend implementations again (should
@ -46,6 +58,32 @@
class MediaFactory
{
public:
static OSystem* createOSystem()
{
#if defined(BSPF_UNIX)
return new OSystemUNIX();
#elif defined(BSPF_WINDOWS)
return new OSystemWINDOWS();
#elif defined(BSPF_MAC_OSX)
return new OSystemMACOSX();
#else
#error Unsupported platform for OSystem!
#endif
}
static Settings* createSettings(OSystem* osystem)
{
#if defined(BSPF_UNIX)
return new SettingsUNIX(osystem);
#elif defined(BSPF_WINDOWS)
return new SettingsWINDOWS(osystem);
#elif defined(BSPF_MAC_OSX)
return new SettingsMACOSX(osystem);
#else
#error Unsupported platform for Settings!
#endif
}
static FrameBuffer* createVideo(OSystem* osystem)
{
return new FrameBufferSDL2(osystem);
@ -59,6 +97,12 @@ class MediaFactory
return new SoundNull(osystem);
#endif
}
static EventHandler* createEventHandler(OSystem* osystem)
{
return new EventHandlerSDL2(osystem);
}
};
#endif

View File

@ -113,6 +113,8 @@ OSystem::OSystem()
<< "." << (int)ver->minor << "."<< (int)ver->patch
<< " [" << BSPF_ARCH << "]";
myBuildInfo = info.str();
mySettings = MediaFactory::createSettings(this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -125,11 +127,6 @@ OSystem::~OSystem()
// Remove any game console that is currently attached
deleteConsole();
// OSystem takes responsibility for framebuffer and sound,
// since it created them
delete myFrameBuffer;
delete mySound;
// These must be deleted after all the others
// This is a bit hacky, since it depends on ordering
// of d'tor calls
@ -142,11 +139,17 @@ OSystem::~OSystem()
delete myStateManager;
delete myPropSet;
delete myEventHandler;
delete mySerialPort;
delete myPNGLib;
delete myZipHandler;
// OSystem takes responsibility for these, since it called MediaFactory
// to create them
delete myFrameBuffer;
delete mySound;
delete myEventHandler;
delete mySettings;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -175,7 +178,7 @@ bool OSystem::create()
return false;
// Create the event handler for the system
myEventHandler = new EventHandler(this);
myEventHandler = MediaFactory::createEventHandler(this);
myEventHandler->initialize();
// Create a properties set for us to use and set it up
@ -341,16 +344,6 @@ FBInitStatus OSystem::createFrameBuffer()
logMessage("ERROR: Unknown emulation state in createFrameBuffer()", 0);
break;
}
#if 0 // FIXME
// The following only need to be done once
if(firstTime)
{
// Setup the SDL joysticks (must be done after FrameBuffer is created)
myEventHandler->setupJoysticks();
}
#endif
return fbstatus;
}
@ -754,6 +747,12 @@ void OSystem::setDefaultJoymap(Event::Type event, EventMode mode)
// Left joystick up/down directions (assume joystick zero and hat 0)
SET_DEFAULT_HAT(Event::JoystickZeroUp, mode, 0, 0, EVENT_HATUP, event);
SET_DEFAULT_HAT(Event::JoystickZeroDown, mode, 0, 0, EVENT_HATDOWN, event);
// Right joystick left/right directions (assume joystick one and hat 0)
SET_DEFAULT_HAT(Event::JoystickOneLeft, mode, 1, 0, EVENT_HATLEFT, event);
SET_DEFAULT_HAT(Event::JoystickOneRight, mode, 1, 0, EVENT_HATRIGHT, event);
// Right joystick up/down directions (assume joystick one and hat 0)
SET_DEFAULT_HAT(Event::JoystickOneUp, mode, 1, 0, EVENT_HATUP, event);
SET_DEFAULT_HAT(Event::JoystickOneDown, mode, 1, 0, EVENT_HATDOWN, event);
break;

View File

@ -80,13 +80,6 @@ class OSystem
virtual bool create();
public:
/**
Adds the specified settings object to the system.
@param settings The settings object to add
*/
void attach(Settings* settings) { mySettings = settings; }
/**
Get the event handler of the system
@ -442,11 +435,6 @@ class OSystem
*/
virtual void setDefaultJoymap(Event::Type event, EventMode mode);
/**
This method creates events from platform-specific hardware.
*/
virtual void pollEvent() { }
/**
Informs the OSystem of a change in EventHandler state.
*/

View File

@ -37,9 +37,6 @@
Settings::Settings(OSystem* osystem)
: myOSystem(osystem)
{
// Add this settings object to the OSystem
myOSystem->attach(this);
// Add options that are common to all versions of Stella
setInternal("video", "soft");

View File

@ -41,7 +41,7 @@ AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
WidgetArray wid;
// Set real dimensions
_w = 52 * fontWidth + 8;
_w = 55 * fontWidth + 8;
_h = 14 * lineHeight + 20;
// Add Previous, Next and Close buttons

View File

@ -92,7 +92,7 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
buttonWidth, buttonHeight, "Base Dir", kBaseDirCmd);
addFocusWidget(_basedirButton);
#ifndef MAC_OSX
#ifndef BSPF_MAC_OSX
b = new ButtonWidget(this, font, _w - 2 * (buttonWidth + 7), _h - buttonHeight - 10,
buttonWidth, buttonHeight, "Choose", kChooseCmd);
addFocusWidget(b);

View File

@ -658,7 +658,7 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
font.getStringWidth(okText))) + 15;
int buttonHeight = font.getLineHeight() + 4;
ButtonWidget* b;
#ifndef MAC_OSX
#ifndef BSPF_MAC_OSX
b = new ButtonWidget(this, font, _w - 2 * (buttonWidth + 7), _h - buttonHeight - 10,
buttonWidth, buttonHeight,
okText == "" ? "OK" : okText, kOKCmd);

View File

@ -185,7 +185,7 @@ void DialogContainer::handleMouseMotionEvent(int x, int y, int button)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y, uInt8 state)
void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y)
{
if(myDialogStack.empty())
return;

View File

@ -89,9 +89,8 @@ class DialogContainer
@param b The mouse button
@param x The x location
@param y The y location
@param state The state (pressed or released)
*/
void handleMouseButtonEvent(MouseButton b, int x, int y, uInt8 state);
void handleMouseButtonEvent(MouseButton b, int x, int y);
/**
Handle a joystick button event.

View File

@ -96,7 +96,7 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
#define ADD_BIND(k,d) do { myKeyStr[i] = k; myDescStr[i] = d; i++; } while(0)
#define ADD_TEXT(d) ADD_BIND("",d)
#define ADD_LINE ADD_BIND("","")
#ifdef MAC_OSX
#ifdef BSPF_MAC_OSX
#define ALT_ "Cmd"
#else
#define ALT_ "Alt"
@ -107,7 +107,7 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
{
case 1:
title = "Common commands:";
#ifndef MAC_OSX
#ifndef BSPF_MAC_OSX
ADD_BIND("Ctrl Q", "Quit emulation");
#else
ADD_BIND("Cmd Q", "Quit emulation");

View File

@ -134,7 +134,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
// Add four buttons at the bottom
xpos = 10; ypos += myDir->getHeight() + 4;
#ifndef MAC_OSX
#ifndef BSPF_MAC_OSX
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Select", kLoadROMCmd);
wid.push_back(myStartButton);