Decided not to add a MiscDialog box, since there weren't really any options

to add to it.

Reworked the EventMappingDialog to take up less screen real-estate, and added
the "Mouse is paddle x" option there (since technically it's also a mapping).

Added an 'emphasized' text color to the list of available GUI colors, and
made some text in the EventMappingDialog use that color.

Added AboutDialog, which lists info such as version of Stella, supported
features, list of developers and contributors, and thanks to certain groups.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@425 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-05-16 00:02:32 +00:00
parent addac558c1
commit 9c557fb016
23 changed files with 573 additions and 174 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: makefile,v 1.78 2005-05-13 18:28:04 stephena Exp $
## $Id: makefile,v 1.79 2005-05-16 00:02:30 stephena Exp $
##============================================================================
##============================================================================
@ -158,7 +158,7 @@ M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o
GUI_OBJS = StellaFont.o Menu.o Launcher.o \
Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o TabWidget.o \
Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \
EventMappingDialog.o GameInfoDialog.o HelpDialog.o \
EventMappingDialog.o GameInfoDialog.o HelpDialog.o AboutDialog.o \
LauncherDialog.o LauncherOptionsDialog.o BrowserDialog.o GameList.o
CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
@ -424,6 +424,9 @@ GameInfoDialog.o: $(GUI)/GameInfoDialog.cxx $(GUI)/GameInfoDialog.hxx
HelpDialog.o: $(GUI)/HelpDialog.cxx $(GUI)/HelpDialog.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/HelpDialog.cxx
AboutDialog.o: $(GUI)/AboutDialog.cxx $(GUI)/AboutDialog.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/AboutDialog.cxx
LauncherDialog.o: $(GUI)/LauncherDialog.cxx $(GUI)/LauncherDialog.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/LauncherDialog.cxx

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: FrameBufferGL.cxx,v 1.22 2005-05-06 22:50:14 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.23 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#include <SDL.h>
@ -151,7 +151,7 @@ bool FrameBufferGL::initSubsystem()
// Precompute the GUI palette
// We abuse the concept of 'enum' by referring directly to the integer values
for(uInt8 i = 0; i < 5; i++)
for(uInt8 i = 0; i < kNumColors; i++)
myGUIPalette[i] = mapRGB(myGUIColors[i][0], myGUIColors[i][1], myGUIColors[i][2]);
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: FrameBufferGL.hxx,v 1.11 2005-04-24 20:36:27 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.12 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -26,6 +26,7 @@
class OSystem;
#include "bspf.hxx"
#include "GuiUtils.hxx"
#include "FrameBuffer.hxx"
@ -33,7 +34,7 @@ class OSystem;
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.11 2005-04-24 20:36:27 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.12 2005-05-16 00:02:31 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -192,9 +193,6 @@ class FrameBufferGL : public FrameBuffer
return value;
}
inline void* getBasePtr(uInt32 x, uInt32 y) const
{ return (void *)((uInt16*)myTexture->pixels + y * myTexture->w + x); }
private:
// The main texture buffer
SDL_Surface* myTexture;
@ -218,7 +216,7 @@ class FrameBufferGL : public FrameBuffer
GLfloat myTexCoord[4];
// GUI palette
Uint32 myGUIPalette[5];
Uint32 myGUIPalette[kNumColors];
// The texture filtering to use
GLint myFilterParam;

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: FrameBufferSoft.cxx,v 1.20 2005-05-05 00:10:43 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.21 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#include <SDL.h>
@ -65,7 +65,7 @@ bool FrameBufferSoft::initSubsystem()
// Precompute the GUI palette
// We abuse the concept of 'enum' by referring directly to the integer values
for(uInt8 i = 0; i < 5; i++)
for(uInt8 i = 0; i < kNumColors; i++)
myGUIPalette[i] = mapRGB(myGUIColors[i][0], myGUIColors[i][1], myGUIColors[i][2]);
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: FrameBufferSoft.hxx,v 1.12 2005-04-04 02:19:20 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.13 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX
@ -23,18 +23,18 @@
#include <SDL_syswm.h>
class OSystem;
class RectList;
#include "bspf.hxx"
#include "GuiUtils.hxx"
#include "FrameBuffer.hxx"
class RectList;
/**
This class implements an SDL software framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.12 2005-04-04 02:19:20 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.13 2005-05-16 00:02:31 stephena Exp $
*/
class FrameBufferSoft : public FrameBuffer
{
@ -185,7 +185,7 @@ class FrameBufferSoft : public FrameBuffer
RectList* myRectList;
// GUI palette
Uint32 myGUIPalette[5];
Uint32 myGUIPalette[kNumColors];
};
class RectList

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: Event.hxx,v 1.9 2005-05-12 18:45:21 stephena Exp $
// $Id: Event.hxx,v 1.10 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#ifndef EVENT_HXX
@ -25,7 +25,7 @@ class Event;
/**
@author Bradford W. Mott
@version $Id: Event.hxx,v 1.9 2005-05-12 18:45:21 stephena Exp $
@version $Id: Event.hxx,v 1.10 2005-05-16 00:02:31 stephena Exp $
*/
class Event
{
@ -72,7 +72,7 @@ class Event
DrivingOneFire,
ChangeState, LoadState, SaveState, TakeSnapshot, Pause, Quit,
MenuMode, LauncherMode,
MenuMode, DebuggerMode, LauncherMode,
LastType
};

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: EventHandler.cxx,v 1.55 2005-05-12 18:45:21 stephena Exp $
// $Id: EventHandler.cxx,v 1.56 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#include <algorithm>
@ -624,7 +624,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 state)
void EventHandler::setActionMappings()
{
// Fill the ActionList with the current key and joystick mappings
for(Int32 i = 0; i < 60; ++i)
for(Int32 i = 0; i < 61; ++i)
{
Event::Type event = ourActionList[i].event;
ourActionList[i].key = "None";
@ -1283,73 +1283,74 @@ void EventHandler::setSDLMappings()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ActionList EventHandler::ourActionList[60] = {
{ Event::ConsoleSelect, "Select", "" },
{ Event::ConsoleReset, "Reset", "" },
{ Event::ConsoleColor, "Color TV", "" },
{ Event::ConsoleBlackWhite, "Black & White TV", "" },
{ Event::ConsoleLeftDifficultyA, "Left Difficulty A", "" },
{ Event::ConsoleLeftDifficultyB, "Left Difficulty B", "" },
{ Event::ConsoleRightDifficultyA, "Right Difficulty A", "" },
{ Event::ConsoleRightDifficultyB, "Right Difficulty B", "" },
{ Event::SaveState, "Save State", "" },
{ Event::ChangeState, "Change State", "" },
{ Event::LoadState, "Load State", "" },
{ Event::TakeSnapshot, "Snapshot", "" },
{ Event::Pause, "Pause", "" },
{ Event::MenuMode, "Enter/exit menu mode", "" },
{ Event::LauncherMode, "Enter ROM launcher", "" },
{ Event::Quit, "Quit", "" },
ActionList EventHandler::ourActionList[61] = {
{ Event::ConsoleSelect, "Select", "" },
{ Event::ConsoleReset, "Reset", "" },
{ Event::ConsoleColor, "Color TV", "" },
{ Event::ConsoleBlackWhite, "Black & White TV", "" },
{ Event::ConsoleLeftDifficultyA, "P1 Difficulty A", "" },
{ Event::ConsoleLeftDifficultyB, "P1 Difficulty B", "" },
{ Event::ConsoleRightDifficultyA, "P2 Difficulty A", "" },
{ Event::ConsoleRightDifficultyB, "P2 Difficulty B", "" },
{ Event::SaveState, "Save State", "" },
{ Event::ChangeState, "Change State", "" },
{ Event::LoadState, "Load State", "" },
{ Event::TakeSnapshot, "Snapshot", "" },
{ Event::Pause, "Pause", "" },
{ Event::MenuMode, "Toggle menu/options mode", "" },
{ Event::DebuggerMode, "Toggle debugger mode", "" },
{ Event::LauncherMode, "Enter ROM launcher", "" },
{ Event::Quit, "Quit", "" },
{ Event::JoystickZeroUp, "Left Joystick Up Direction", "" },
{ Event::JoystickZeroDown, "Left Joystick Down Direction", "" },
{ Event::JoystickZeroLeft, "Left Joystick Left Direction", "" },
{ Event::JoystickZeroRight, "Left Joystick Right Direction", "" },
{ Event::JoystickZeroFire, "Left Joystick Fire Button", "" },
{ Event::JoystickZeroUp, "P1 Joystick Up", "" },
{ Event::JoystickZeroDown, "P1 Joystick Down", "" },
{ Event::JoystickZeroLeft, "P1 Joystick Left", "" },
{ Event::JoystickZeroRight, "P1 Joystick Right", "" },
{ Event::JoystickZeroFire, "P1 Joystick Fire", "" },
{ Event::JoystickOneUp, "Right Joystick Up Direction", "" },
{ Event::JoystickOneDown, "Right Joystick Down Direction", "" },
{ Event::JoystickOneLeft, "Right Joystick Left Direction", "" },
{ Event::JoystickOneRight, "Right Joystick Right Direction", "" },
{ Event::JoystickOneFire, "Right Joystick Fire Button", "" },
{ Event::JoystickOneUp, "P2 Joystick Up", "" },
{ Event::JoystickOneDown, "P2 Joystick Down", "" },
{ Event::JoystickOneLeft, "P2 Joystick Left", "" },
{ Event::JoystickOneRight, "P2 Joystick Right", "" },
{ Event::JoystickOneFire, "P2 Joystick Fire", "" },
{ Event::BoosterGripZeroTrigger, "Left Booster-Grip Trigger", "" },
{ Event::BoosterGripZeroBooster, "Left Booster-Grip Booster", "" },
{ Event::BoosterGripZeroTrigger, "P1 Booster-Grip Trigger", "" },
{ Event::BoosterGripZeroBooster, "P1 Booster-Grip Booster", "" },
{ Event::BoosterGripOneTrigger, "Right Booster-Grip Trigger", "" },
{ Event::BoosterGripOneBooster, "Right Booster-Grip Booster", "" },
{ Event::BoosterGripOneTrigger, "P2 Booster-Grip Trigger", "" },
{ Event::BoosterGripOneBooster, "P2 Booster-Grip Booster", "" },
{ Event::DrivingZeroCounterClockwise, "Left Driving Controller Left Direction", "" },
{ Event::DrivingZeroClockwise, "Left Driving Controller Right Direction", "" },
{ Event::DrivingZeroFire, "Left Driving Controller Fire Button", "" },
{ Event::DrivingZeroCounterClockwise, "P1 Driving Controller Left", "" },
{ Event::DrivingZeroClockwise, "P1 Driving Controller Right", "" },
{ Event::DrivingZeroFire, "P1 Driving Controller Fire", "" },
{ Event::DrivingOneCounterClockwise, "Right Driving Controller Left Direction", "" },
{ Event::DrivingOneClockwise, "Right Driving Controller Right Direction", "" },
{ Event::DrivingOneFire, "Right Driving Controller Fire Button", "" },
{ Event::DrivingOneCounterClockwise, "P2 Driving Controller Left", "" },
{ Event::DrivingOneClockwise, "P2 Driving Controller Right", "" },
{ Event::DrivingOneFire, "P2 Driving Controller Fire", "" },
{ Event::KeyboardZero1, "Left GamePad 1", "" },
{ Event::KeyboardZero2, "Left GamePad 2", "" },
{ Event::KeyboardZero3, "Left GamePad 3", "" },
{ Event::KeyboardZero4, "Left GamePad 4", "" },
{ Event::KeyboardZero5, "Left GamePad 5", "" },
{ Event::KeyboardZero6, "Left GamePad 6", "" },
{ Event::KeyboardZero7, "Left GamePad 7", "" },
{ Event::KeyboardZero8, "Left GamePad 8", "" },
{ Event::KeyboardZero9, "Left GamePad 9", "" },
{ Event::KeyboardZeroStar, "Left GamePad *", "" },
{ Event::KeyboardZero0, "Left GamePad 0", "" },
{ Event::KeyboardZeroPound, "Left GamePad #", "" },
{ Event::KeyboardZero1, "P1 GamePad 1", "" },
{ Event::KeyboardZero2, "P1 GamePad 2", "" },
{ Event::KeyboardZero3, "P1 GamePad 3", "" },
{ Event::KeyboardZero4, "P1 GamePad 4", "" },
{ Event::KeyboardZero5, "P1 GamePad 5", "" },
{ Event::KeyboardZero6, "P1 GamePad 6", "" },
{ Event::KeyboardZero7, "P1 GamePad 7", "" },
{ Event::KeyboardZero8, "P1 GamePad 8", "" },
{ Event::KeyboardZero9, "P1 GamePad 9", "" },
{ Event::KeyboardZeroStar, "P1 GamePad *", "" },
{ Event::KeyboardZero0, "P1 GamePad 0", "" },
{ Event::KeyboardZeroPound, "P1 GamePad #", "" },
{ Event::KeyboardOne1, "Right GamePad 1", "" },
{ Event::KeyboardOne2, "Right GamePad 2", "" },
{ Event::KeyboardOne3, "Right GamePad 3", "" },
{ Event::KeyboardOne4, "Right GamePad 4", "" },
{ Event::KeyboardOne5, "Right GamePad 5", "" },
{ Event::KeyboardOne6, "Right GamePad 6", "" },
{ Event::KeyboardOne7, "Right GamePad 7", "" },
{ Event::KeyboardOne8, "Right GamePad 8", "" },
{ Event::KeyboardOne9, "Right GamePad 9", "" },
{ Event::KeyboardOneStar, "Right GamePad *", "" },
{ Event::KeyboardOne0, "Right GamePad 0", "" },
{ Event::KeyboardOnePound, "Right GamePad #", "" }
{ Event::KeyboardOne1, "P2 GamePad 1", "" },
{ Event::KeyboardOne2, "P2 GamePad 2", "" },
{ Event::KeyboardOne3, "P2 GamePad 3", "" },
{ Event::KeyboardOne4, "P2 GamePad 4", "" },
{ Event::KeyboardOne5, "P2 GamePad 5", "" },
{ Event::KeyboardOne6, "P2 GamePad 6", "" },
{ Event::KeyboardOne7, "P2 GamePad 7", "" },
{ Event::KeyboardOne8, "P2 GamePad 8", "" },
{ Event::KeyboardOne9, "P2 GamePad 9", "" },
{ Event::KeyboardOneStar, "P2 GamePad *", "" },
{ Event::KeyboardOne0, "P2 GamePad 0", "" },
{ Event::KeyboardOnePound, "P2 GamePad #", "" }
};

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: EventHandler.hxx,v 1.27 2005-05-06 22:50:15 stephena Exp $
// $Id: EventHandler.hxx,v 1.28 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#ifndef EVENTHANDLER_HXX
@ -57,7 +57,7 @@ struct ActionList {
mapping can take place.
@author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.27 2005-05-06 22:50:15 stephena Exp $
@version $Id: EventHandler.hxx,v 1.28 2005-05-16 00:02:31 stephena Exp $
*/
class EventHandler
{
@ -142,8 +142,16 @@ class EventHandler
*/
inline void quit() { handleEvent(Event::Quit, 1); }
/**
Sets the mouse to act as paddle 'num'
@param num The paddle which the mouse should emulate
@param showmessage Print a message to the framebuffer
*/
void setPaddleMode(uInt32 num, bool showmessage = false);
// Holds static strings for the remap menu
static ActionList ourActionList[60];
static ActionList ourActionList[61];
private:
/**
@ -188,14 +196,6 @@ class EventHandler
void sendJoyEvent(StellaEvent::JoyStick stick, StellaEvent::JoyCode code,
Int32 state);
/**
Sets the mouse to act as paddle 'num'
@param num The paddle which the mouse should emulate
@param showmessage Print a message to the framebuffer
*/
void setPaddleMode(uInt32 num, bool showmessage = false);
/**
The following methods take care of assigning action mappings.
*/

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: FrameBuffer.cxx,v 1.36 2005-05-13 18:28:05 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.37 2005-05-16 00:02:31 stephena Exp $
//============================================================================
#include <sstream>
@ -52,15 +52,16 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
{
// Fill the GUI colors array
// The specific video subsystem will know what to do with it
uInt8 colors[5][3] = {
uInt8 colors[kNumColors][3] = {
{104, 104, 104},
{0, 0, 0},
{64, 64, 64},
{32, 160, 32},
{0, 255, 0} // FIXME - add kTextColorEm
{0, 255, 0},
{200, 0, 0}
};
for(uInt8 i = 0; i < 5; i++)
for(uInt8 i = 0; i < kNumColors; i++)
for(uInt8 j = 0; j < 3; j++)
myGUIColors[i][j] = colors[i][j];
@ -80,7 +81,7 @@ FrameBuffer::~FrameBuffer(void)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
bool aspect)
bool useAspect)
{
bool isAlreadyInitialized = (SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO) > 0;
@ -132,7 +133,7 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
setWindowTitle(title);
// Indicate whether we want to use aspect ratio correction
theUseAspectRatioFlag = aspect;
theUseAspectRatioFlag = useAspect;
// Get the maximum size of a window for the current desktop
theMaxZoomLevel = maxWindowSizeForScreen();
@ -176,10 +177,10 @@ void FrameBuffer::update()
// Draw any pending messages
if(myMessageTime > 0)
{
Int32 w = myFont->getStringWidth(myMessageText) + 10;
Int32 h = myFont->getFontHeight() + 8;
Int32 x = (myBaseDim.w >> 1) - (w >> 1);
Int32 y = myBaseDim.h - h - 10/2;
int w = myFont->getStringWidth(myMessageText) + 10;
int h = myFont->getFontHeight() + 8;
int x = (myBaseDim.w >> 1) - (w >> 1);
int y = myBaseDim.h - h - 10/2;
// Draw the bounded box and text
blendRect(x+1, y+2, w-2, h-4, kBGColor);
@ -347,9 +348,6 @@ void FrameBuffer::resize(Size size, Int8 zoom)
if(!createScreen())
return;
// Update the settings
// myOSystem->settings().setInt("zoom", theZoomLevel);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.14 2005-05-12 18:45:21 stephena Exp $
// $Id: OSystem.cxx,v 1.15 2005-05-16 00:02:32 stephena Exp $
//============================================================================
#include <cassert>
@ -50,11 +50,29 @@ OSystem::OSystem()
myConsole(NULL),
myMenu(NULL),
myLauncher(NULL),
myRomFile("")
myRomFile(""),
myFeatures("")
{
// Create menu and launcher GUI objects
myMenu = new Menu(this);
myLauncher = new Launcher(this);
// Determine which features were conditionally compiled into Stella
#ifdef DISPLAY_OPENGL
myFeatures += "OpenGL ";
#endif
#ifdef SOUND_SUPPORT
myFeatures += "Sound ";
#endif
#ifdef JOYSTICK_SUPPORT
myFeatures += "Joystick ";
#endif
#ifdef SNAPSHOT_SUPPORT
myFeatures += "Snapshot ";
#endif
#ifdef DEVELOPER_SUPPORT
myFeatures += "Debugger";
#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: OSystem.hxx,v 1.13 2005-05-12 18:45:21 stephena Exp $
// $Id: OSystem.hxx,v 1.14 2005-05-16 00:02:32 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -38,7 +38,7 @@ class Launcher;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.13 2005-05-12 18:45:21 stephena Exp $
@version $Id: OSystem.hxx,v 1.14 2005-05-16 00:02:32 stephena Exp $
*/
class OSystem
{
@ -255,6 +255,13 @@ class OSystem
*/
void createLauncher();
/**
The features which are conditionally compiled into Stella.
@return The supported features
*/
const string& features() { return myFeatures; }
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented
@ -346,6 +353,8 @@ class OSystem
string myGameListCacheFile;
string myRomFile;
string myFeatures;
private:
// Copy constructor isn't supported by this class so make it private
OSystem(const OSystem&);

View File

@ -0,0 +1,260 @@
//============================================================================
//
// 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-2005 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutDialog.cxx,v 1.1 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "OSystem.hxx"
#include "Widget.hxx"
#include "Dialog.hxx"
#include "GuiUtils.hxx"
#include "Version.hxx"
#include "AboutDialog.hxx"
#define ADD_ATEXT(d) do { dsc[i] = d; i++; } while(0)
#define ADD_ALINE ADD_ATEXT("")
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h),
myPage(1),
myNumPages(6)
{
// Add Previous, Next and Close buttons
myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton((kButtonWidth + 15), h - 24,
"Next", kNextCmd, 'N');
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
myPrevButton->clearFlags(WIDGET_ENABLED);
myTitle = new StaticTextWidget(this, 0, 5, w, 16, "", kTextAlignCenter);
myTitle->setColor(kTextColorHi);
for(int i = 0; i < LINES_PER_PAGE; i++)
{
myDesc[i] = new StaticTextWidget(this, 10, 18 + (10 * i), w - 20,
kLineHeight, "", kTextAlignLeft);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AboutDialog::~AboutDialog()
{
}
// The following commands can be put at the start of a line (all subject to change):
// \C, \L, \R -- set center/left/right alignment
// \c0 - \c5 -- set a custom color:
// 0 normal text (green)
// 1 highlighted text (light green)
// 2 light border (light gray)
// 3 dark border (dark gray)
// 4 background (black)
// 5 emphasized text (red)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AboutDialog::updateStrings(int page, int lines, string& title, string* &dsc)
{
dsc = new string[lines];
int i = 0;
switch(page)
{
case 1:
title = string("Stella ") + STELLA_VERSION;
ADD_ATEXT("\\CA multi-platform Atari 2600 VCS emulator");
ADD_ATEXT(string("\\C\\c2Supports: ") + instance()->features());
ADD_ALINE;
ADD_ATEXT("\\CCopyright (C) 1995-2005 The Stella team");
ADD_ATEXT("\\Chttp://stella.sourceforge.net");
ADD_ALINE;
ADD_ATEXT("Stella is free software released under the GNU GPL");
ADD_ATEXT("See manual for further details");
break;
case 2:
title = "The Stella team";
ADD_ATEXT("\\L\\c0"" Bradford W. Mott");
ADD_ATEXT("\\L\\c2"" Original author, lead developer");
ADD_ATEXT("\\L\\c0"" Stephen Anthony");
ADD_ATEXT("\\L\\c2"" Lead developer, Linux/Win32 maintainer");
ADD_ATEXT("\\L\\c0"" Mark Grebe");
ADD_ATEXT("\\L\\c2"" Author/maintainer for OSX port");
ADD_ATEXT("\\L\\c0"" Brian Watson");
ADD_ATEXT("\\L\\c2"" Emulation core enhancement, debugger support");
ADD_ATEXT("\\L\\c0"" Eckhard Stolberg");
ADD_ATEXT("\\L\\c2"" Emulation core development");
break;
case 3:
title = "The Stella team";
ADD_ATEXT("\\L\\c0"" Erik \"Voch\" Kovach");
ADD_ATEXT("\\L\\c2"" Maintainer of the 'stella.pro' game properties file");
ADD_ATEXT("\\L\\c0"" Joe D'Andrea");
ADD_ATEXT("\\L\\c2"" Maintainer for Solaris port");
ADD_ATEXT("\\L\\c0"" Darrell Spice Jr.");
ADD_ATEXT("\\L\\c2"" Original author for OS/2 port");
ADD_ATEXT("\\L\\c0"" Doodle");
ADD_ATEXT("\\L\\c2"" Current maintainer for OS/2 port");
break;
case 4:
title = "Retired members / Contributors";
ADD_ATEXT("\\L\\c0""See Stella manual for contribution details");
ADD_ALINE;
ADD_ATEXT("\\L\\c0"" David Aspell, Christopher Bennett, Alexander Bilstein");
ADD_ATEXT("\\L\\c0"" Dan Boris, Piero Cavina, Bob Colbert");
ADD_ATEXT("\\L\\c0"" Renato Ferreira, Ron Fries, Aaron Giles");
ADD_ATEXT("\\L\\c0"" Mark Hahn, Kevin Horton, Thomas Jentzsch");
ADD_ATEXT("\\L\\c0"" Daniel Marks, James Mcclain, David McEwen");
ADD_ATEXT("\\L\\c0"" Jeff Miller, Dan Mowczan, Jack Nutting");
ADD_ATEXT("\\L\\c0"" Manuel Polik, Jim Pragit, John Saeger");
ADD_ATEXT("\\L\\c0"" Chris Salomon, Jason Scott, David Shaw");
break;
case 5:
title = "Retired members / Contributors";
ADD_ATEXT("\\L\\c0""See Stella manual for contribution details");
ADD_ALINE;
ADD_ATEXT("\\L\\c0"" Raul Silva, Chris Snell, John Stiles");
ADD_ATEXT("\\L\\c0"" Matthew Stroup, Joel Sutton, Greg Troutman");
ADD_ATEXT("\\L\\c0"" Curt Vendel, Keith Wilkins, Jeff Wisnia");
ADD_ALINE;
ADD_ATEXT("\\L\\c0""And many others ...");
ADD_ALINE;
ADD_ATEXT("\\L\\c0""Thanks to the ScummVM project for the GUI code");
break;
case 6:
title = "Cast of thousands";
ADD_ATEXT("\\L\\c0""Special thanks to AtariAge for introducing the");
ADD_ATEXT("\\L\\c0""Atari 2600 to a whole new generation");
ADD_ATEXT("\\L\\c2"" http://www.atariage.com");
ADD_ALINE;
ADD_ATEXT("\\L\\c0""Finally, a huge thanks to the original Atari 2600");
ADD_ATEXT("\\L\\c0""VCS team for giving us the magic, and to the");
ADD_ATEXT("\\L\\c0""homebrew developers for keeping the magic alive");
break;
}
while(i < lines)
ADD_ALINE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AboutDialog::displayInfo()
{
string titleStr, *dscStr;
updateStrings(myPage, LINES_PER_PAGE, titleStr, dscStr);
myTitle->setLabel(titleStr);
for(int i = 0; i < LINES_PER_PAGE; i++)
{
const char *str = dscStr[i].c_str();
TextAlignment align = kTextAlignCenter;
OverlayColor color = kTextColor;
while (str[0] == '\\')
{
switch (str[1])
{
case 'C':
align = kTextAlignCenter;
break;
case 'L':
align = kTextAlignLeft;
break;
case 'R':
align = kTextAlignRight;
break;
case 'c':
switch (str[2])
{
case '0':
color = kTextColor;
break;
case '1':
color = kTextColorHi;
break;
case '2':
color = kColor;
break;
case '3':
color = kShadowColor;
break;
case '4':
color = kBGColor;
break;
case '5':
color = kTextColorEm;
break;
default:
break;
}
str++;
break;
default:
break;
}
str += 2;
}
myDesc[i]->setAlign(align);
myDesc[i]->setColor(color);
myDesc[i]->setLabel(str);
}
delete[] dscStr;
instance()->frameBuffer().refresh();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data)
{
switch(cmd)
{
case kNextCmd:
myPage++;
if(myPage >= myNumPages)
myNextButton->clearFlags(WIDGET_ENABLED);
if(myPage >= 2)
myPrevButton->setFlags(WIDGET_ENABLED);
displayInfo();
break;
case kPrevCmd:
myPage--;
if(myPage <= myNumPages)
myNextButton->setFlags(WIDGET_ENABLED);
if(myPage <= 1)
myPrevButton->clearFlags(WIDGET_ENABLED);
displayInfo();
break;
default:
Dialog::handleCommand(sender, cmd, data);
}
}

View File

@ -0,0 +1,61 @@
//============================================================================
//
// 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-2005 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutDialog.hxx,v 1.1 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#ifndef ABOUT_DIALOG_HXX
#define ABOUT_DIALOG_HXX
#define LINES_PER_PAGE 10
class OSystem;
class DialogContainer;
class CommandSender;
class ButtonWidget;
class StaticTextWidget;
#include "GuiUtils.hxx"
class AboutDialog : public Dialog
{
public:
AboutDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h);
~AboutDialog();
protected:
ButtonWidget* myNextButton;
ButtonWidget* myPrevButton;
StaticTextWidget* myTitle;
StaticTextWidget* myDesc[LINES_PER_PAGE];
int myPage;
int myNumPages;
private:
virtual void handleCommand(CommandSender* sender, int cmd, int data);
virtual void updateStrings(int page, int lines, string& title, string* &dsc);
void displayInfo();
void loadConfig() { displayInfo(); }
};
#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: DialogContainer.cxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
// $Id: DialogContainer.cxx,v 1.4 2005-05-16 00:02:32 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -72,9 +72,12 @@ void DialogContainer::removeDialog()
void DialogContainer::reStack()
{
// Pop all items from the stack, and then add the base menu
Dialog* d;
while(!myDialogStack.empty())
myDialogStack.pop();
{
d = myDialogStack.pop();
d->close();
}
myDialogStack.push(myBaseDialog);
}

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: EventMappingDialog.cxx,v 1.9 2005-05-13 18:28:05 stephena Exp $
// $Id: EventMappingDialog.cxx,v 1.10 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -22,6 +22,7 @@
#include "OSystem.hxx"
#include "Widget.hxx"
#include "ListWidget.hxx"
#include "PopUpWidget.hxx"
#include "Dialog.hxx"
#include "GuiUtils.hxx"
#include "Event.hxx"
@ -39,26 +40,36 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
{
// Add Default and OK buttons
myDefaultsButton = addButton(10, h - 24, "Defaults", kDefaultsCmd, 0);
myOKButton = addButton(w - (kButtonWidth + 10), h - 24, "OK", kCloseCmd, 0);
myOKButton = addButton(w - (kButtonWidth + 10), h - 24, "OK", kOKCmd, 0);
new StaticTextWidget(this, 10, 8, 200, 16, "Select an event to remap:", kTextAlignCenter);
myActionsList = new ListWidget(this, 10, 20, 200, 100);
new StaticTextWidget(this, 10, 8, 150, 16, "Select an event to remap:", kTextAlignCenter);
myActionsList = new ListWidget(this, 10, 20, 150, 100);
myActionsList->setNumberingMode(kListNumberingOff);
myKeyMapping = new StaticTextWidget(this, 10, 125, w - 20, 16,
"Key(s) : ", kTextAlignLeft);
"Action: ", kTextAlignLeft);
myKeyMapping->setFlags(WIDGET_CLEARBG);
// Add remap and erase buttons
myMapButton = addButton(220, 30, "Map", kStartMapCmd, 0);
myEraseButton = addButton(220, 50, "Erase", kEraseCmd, 0);
myCancelMapButton = addButton(220, 70, "Cancel", kStopMapCmd, 0);
myMapButton = addButton(170, 25, "Map", kStartMapCmd, 0);
myEraseButton = addButton(170, 45, "Erase", kEraseCmd, 0);
myCancelMapButton = addButton(170, 65, "Cancel", kStopMapCmd, 0);
myCancelMapButton->setEnabled(false);
// Add 'mouse to paddle' mapping
myPaddleModeText = new StaticTextWidget(this, 168, 93, 50, kLineHeight,
"Mouse is", kTextAlignCenter);
myPaddleModePopup = new PopUpWidget(this, 160, 105, 60, kLineHeight,
"paddle: ", 40, 0);
myPaddleModePopup->appendEntry("0", 0);
myPaddleModePopup->appendEntry("1", 1);
myPaddleModePopup->appendEntry("2", 2);
myPaddleModePopup->appendEntry("3", 3);
// Get actions names
StringList l;
for(int i = 0; i < 60; ++i) // FIXME - create a size() method
for(int i = 0; i < 61; ++i)
l.push_back(EventHandler::ourActionList[i].action);
myActionsList->setList(l);
@ -75,6 +86,18 @@ void EventMappingDialog::loadConfig()
// Make sure remapping is turned off, just in case the user didn't properly
// exit from the dialog last time
stopRemapping();
// Paddle mode
int mode = instance()->settings().getInt("paddle");
myPaddleModePopup->setSelectedTag(mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventMappingDialog::saveConfig()
{
// Paddle mode
int mode = myPaddleModePopup->getSelectedTag();
instance()->eventHandler().setPaddleMode(mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -92,12 +115,15 @@ void EventMappingDialog::startRemapping()
myEraseButton->setEnabled(false);
myDefaultsButton->setEnabled(false);
myOKButton->setEnabled(false);
myPaddleModeText->setEnabled(false);
myPaddleModePopup->setEnabled(false);
myCancelMapButton->setEnabled(true);
// And show a message indicating which key is being remapped
string buf = "Select a new event for the '" +
string buf = "Select action for '" +
EventHandler::ourActionList[ myActionSelected ].action +
"' action";
"' event";
myKeyMapping->setColor(kTextColorEm);
myKeyMapping->setLabel(buf);
}
@ -125,6 +151,8 @@ void EventMappingDialog::stopRemapping()
myEraseButton->setEnabled(false);
myDefaultsButton->setEnabled(true);
myOKButton->setEnabled(true);
myPaddleModeText->setEnabled(true);
myPaddleModePopup->setEnabled(true);
myCancelMapButton->setEnabled(false);
// Make sure the list widget is in a known state
@ -141,7 +169,8 @@ void EventMappingDialog::drawKeyMapping()
{
if(myActionSelected >= 0)
{
string buf = "Key(s) : " + EventHandler::ourActionList[ myActionSelected ].key;
string buf = "Action: " + EventHandler::ourActionList[ myActionSelected ].key;
myKeyMapping->setColor(kTextColor);
myKeyMapping->setLabel(buf);
}
}
@ -166,6 +195,11 @@ void EventMappingDialog::handleCommand(CommandSender* sender, int cmd, int data)
{
switch(cmd)
{
case kOKCmd:
saveConfig();
close();
break;
case kListSelectionChangedCmd:
if(myActionsList->getSelected() >= 0)
{

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: EventMappingDialog.hxx,v 1.6 2005-05-13 18:28:05 stephena Exp $
// $Id: EventMappingDialog.hxx,v 1.7 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -27,6 +27,7 @@ class CommandSender;
class ButtonWidget;
class StaticTextWidget;
class ListWidget;
class PopUpWidget;
#include "OSystem.hxx"
#include "bspf.hxx"
@ -48,6 +49,8 @@ class EventMappingDialog : public Dialog
ButtonWidget* myDefaultsButton;
ListWidget* myActionsList;
StaticTextWidget* myKeyMapping;
PopUpWidget* myPaddleModePopup;
StaticTextWidget* myPaddleModeText;
private:
enum {
@ -62,6 +65,7 @@ class EventMappingDialog : public Dialog
void eraseRemapping();
void stopRemapping();
void loadConfig();
void saveConfig();
void drawKeyMapping();

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: GuiUtils.hxx,v 1.7 2005-05-01 20:11:07 stephena Exp $
// $Id: GuiUtils.hxx,v 1.8 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ...
@author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.7 2005-05-01 20:11:07 stephena Exp $
@version $Id: GuiUtils.hxx,v 1.8 2005-05-16 00:02:32 stephena Exp $
*/
#define kLineHeight 12
@ -42,7 +42,8 @@ enum OverlayColor {
kShadowColor,
kTextColor,
kTextColorHi,
kTextColorEm
kTextColorEm,
kNumColors
};
// The commands generated by various widgets

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: HelpDialog.cxx,v 1.5 2005-05-13 18:28:05 stephena Exp $
// $Id: HelpDialog.cxx,v 1.6 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -108,8 +108,8 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines,
ADD_BIND("Remapped Events", "");
ADD_TEXT("Most other commands can be");
ADD_TEXT("remapped. Please consult the");
ADD_TEXT("'Event Remapping' section");
ADD_TEXT("for more information.");
ADD_TEXT("'Event Mapping' section for");
ADD_TEXT("more information.");
break;
}

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: HelpDialog.hxx,v 1.3 2005-05-13 18:28:05 stephena Exp $
// $Id: HelpDialog.hxx,v 1.4 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -59,7 +59,7 @@ class HelpDialog : public Dialog
virtual void handleCommand(CommandSender* sender, int cmd, int data);
virtual void updateStrings(uInt8 page, uInt8 lines,
string& title, string*& key, string* &dsc);
void displayInfo();
void displayInfo();
void loadConfig() { displayInfo(); }
};

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: OptionsDialog.cxx,v 1.16 2005-05-13 18:28:06 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.17 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,6 +29,7 @@
#include "EventMappingDialog.hxx"
#include "GameInfoDialog.hxx"
#include "HelpDialog.hxx"
#include "AboutDialog.hxx"
#include "OptionsDialog.hxx"
#include "bspf.hxx"
@ -37,14 +38,14 @@ enum {
kVidCmd = 'VIDO',
kAudCmd = 'AUDO',
kEMapCmd = 'EMAP',
kMiscCmd = 'MISC',
kInfoCmd = 'INFO',
kHelpCmd = 'HELP',
kAboutCmd = 'ABOU'
};
enum {
kRowHeight = 22,
kBigButtonWidth = 100,
kBigButtonWidth = 90,
kMainMenuWidth = (kBigButtonWidth + 2 * 8),
kMainMenuHeight = 6 * kRowHeight + 10,
};
@ -58,22 +59,27 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
(osystem->frameBuffer().baseWidth() - kMainMenuWidth) / 2,
(osystem->frameBuffer().baseHeight() - kMainMenuHeight)/2,
kMainMenuWidth, kMainMenuHeight),
myVideoDialog(NULL)
myVideoDialog(NULL),
myAudioDialog(NULL),
myEventMappingDialog(NULL),
myGameInfoDialog(NULL),
myHelpDialog(NULL),
myAboutDialog(NULL)
{
int yoffset = 7;
const int xoffset = (_w - kBigButtonWidth) / 2;
addBigButton("Video Settings", kVidCmd, 'V');
addBigButton("Video Settings", kVidCmd, 0);
#ifdef SOUND_SUPPORT
addBigButton("Audio Settings", kAudCmd, 'A');
addBigButton("Audio Settings", kAudCmd, 0);
#else
ButtonWidget* b = addBigButton("Audio Settings", kAudCmd, 'A');
ButtonWidget* b = addBigButton("Audio Settings", kAudCmd, 0);
b->setEnabled(false);
#endif
addBigButton("Event Remapping", kEMapCmd, 'E');
addBigButton("Miscellaneous", kMiscCmd, 'M');
addBigButton("Game Information", kInfoCmd, 'I');
addBigButton("Help", kHelpCmd, 'H');
addBigButton("Event Mapping", kEMapCmd, 0);
addBigButton("Game Information", kInfoCmd, 0);
addBigButton("Help", kHelpCmd, 0);
addBigButton("About", kAboutCmd, 0);
// Set some sane values for the dialog boxes
int fbWidth = osystem->frameBuffer().baseWidth();
@ -89,14 +95,10 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAudioDialog = new AudioDialog(myOSystem, parent, x, y, w, h);
w = 280; h = 170;
w = 230; h = 170;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myEventMappingDialog = new EventMappingDialog(myOSystem, parent, x, y, w, h);
// w = 250; h = 150;
// checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
// myMiscDialog = new MiscDialog(myOSystem, parent, x, y, w, h);
w = 255; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, x, y, w, h);
@ -104,6 +106,10 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
w = 255; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myHelpDialog = new HelpDialog(myOSystem, parent, x, y, w, h);
w = 255; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAboutDialog = new AboutDialog(myOSystem, parent, x, y, w, h);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -112,9 +118,9 @@ OptionsDialog::~OptionsDialog()
delete myVideoDialog;
delete myAudioDialog;
delete myEventMappingDialog;
// delete myMiscDialog;
delete myGameInfoDialog;
delete myHelpDialog;
delete myAboutDialog;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -144,11 +150,6 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd, int data)
parent()->addDialog(myEventMappingDialog);
break;
case kMiscCmd:
// parent()->addDialog(myMiscDialog);
cerr << "push MiscDialog to top of stack\n";
break;
case kInfoCmd:
parent()->addDialog(myGameInfoDialog);
break;
@ -157,6 +158,10 @@ cerr << "push MiscDialog to top of stack\n";
parent()->addDialog(myHelpDialog);
break;
case kAboutCmd:
parent()->addDialog(myAboutDialog);
break;
default:
Dialog::handleCommand(sender, cmd, data);
}

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: OptionsDialog.hxx,v 1.6 2005-05-13 18:28:06 stephena Exp $
// $Id: OptionsDialog.hxx,v 1.7 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,8 +29,8 @@ class DialogContainer;
class VideoDialog;
class AudioDialog;
class EventMappingDialog;
class MiscDialog;
class HelpDialog;
class AboutDialog;
#include "OSystem.hxx"
#include "GameInfoDialog.hxx"
@ -50,9 +50,9 @@ class OptionsDialog : public Dialog
VideoDialog* myVideoDialog;
AudioDialog* myAudioDialog;
EventMappingDialog* myEventMappingDialog;
MiscDialog* myMiscDialog;
GameInfoDialog* myGameInfoDialog;
HelpDialog* myHelpDialog;
AboutDialog* myAboutDialog;
private:
void checkBounds(int width, int height,

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.9 2005-05-13 18:28:06 stephena Exp $
// $Id: Widget.cxx,v 1.10 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -125,7 +125,8 @@ Widget* Widget::findWidgetInChain(Widget *w, int x, int y)
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
const string& text, TextAlignment align)
: Widget(boss, x, y, w, h),
_align(align)
_align(align),
_color(kTextColor)
{
_flags = WIDGET_ENABLED;
_type = kStaticTextWidget;
@ -149,7 +150,7 @@ void StaticTextWidget::drawWidget(bool hilite)
{
FrameBuffer& fb = _boss->instance()->frameBuffer();
fb.font().drawString(_label, _x, _y, _w,
isEnabled() ? kTextColor : kColor, _align);
isEnabled() ? _color : kColor, _align);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -177,7 +178,7 @@ void ButtonWidget::drawWidget(bool hilite)
FrameBuffer& fb = _boss->instance()->frameBuffer();
fb.font().drawString(_label, _x, _y + (_h - kLineHeight)/2 + 1, _w,
!isEnabled() ? kColor :
hilite ? kTextColorHi : kTextColor, _align);
hilite ? kTextColorHi : _color, _align);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -238,13 +239,13 @@ void CheckboxWidget::drawWidget(bool hilite)
// If checked, draw cross inside the box
if(_state)
fb.drawBitmap(checked_img, _x + 3, _y + 3,
isEnabled() ? kTextColor : kColor);
isEnabled() ? _color : kColor);
else
fb.fillRect(_x + 2, _y + 2, 10, 10, kBGColor);
// Finally draw the label
fb.font().drawString(_label, _x + 20, _y + 3, _w,
isEnabled() ? kTextColor : kColor);
isEnabled() ? _color : kColor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -315,7 +316,7 @@ void SliderWidget::drawWidget(bool hilite)
// Draw the label, if any
if(_labelWidth > 0)
fb.font().drawString(_label, _x, _y + 2, _labelWidth,
isEnabled() ? kTextColor : kColor, kTextAlignRight);
isEnabled() ? _color : kColor, kTextAlignRight);
// Draw the box
fb.box(_x + _labelWidth, _y, _w - _labelWidth, _h, kColor, kShadowColor);
@ -323,7 +324,7 @@ void SliderWidget::drawWidget(bool hilite)
// Draw the 'bar'
fb.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4,
!isEnabled() ? kColor :
hilite ? kTextColorHi : kTextColor);
hilite ? kTextColorHi : _color);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.hxx,v 1.9 2005-05-13 18:28:06 stephena Exp $
// $Id: Widget.hxx,v 1.10 2005-05-16 00:02:32 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -65,7 +65,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.9 2005-05-13 18:28:06 stephena Exp $
@version $Id: Widget.hxx,v 1.10 2005-05-16 00:02:32 stephena Exp $
*/
class Widget : public GuiObject
{
@ -95,11 +95,11 @@ class Widget : public GuiObject
void setFlags(int flags) { _flags |= flags;
_boss->instance()->frameBuffer().refresh();
}
}
void clearFlags(int flags) { _flags &= ~flags;
_boss->instance()->frameBuffer().refresh();
}
int getFlags() const { return _flags; }
}
int getFlags() const { return _flags; }
void setEnabled(bool e) { if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); }
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
@ -140,6 +140,8 @@ class StaticTextWidget : public Widget
int x, int y, int w, int h,
const string& text, TextAlignment align);
void setValue(int value);
void setColor(OverlayColor color) { _color = color; }
void setAlign(TextAlignment align) { _align = align; }
void setLabel(const string& label) { _label = label;
_boss->instance()->frameBuffer().refresh();
}
@ -149,8 +151,9 @@ class StaticTextWidget : public Widget
void drawWidget(bool hilite);
protected:
string _label;
string _label;
TextAlignment _align;
OverlayColor _color;
};