Cleaned up the Video and Audio dialog boxes a little, making them waste

as little space as possible.

Added ability to enable/disable sound from within the emulation.  So you
no longer *have* to specify it on the commandline (but you still can, if
you want to).

Changed makefile to conditionally compile sound support.  It makes the app
approx 15KB smaller, if anyone really wants to do that ...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@399 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-04-28 19:28:33 +00:00
parent db67ba4bb4
commit c8fd06bc69
10 changed files with 202 additions and 119 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.71 2005-04-04 02:19:19 stephena Exp $
## $Id: makefile,v 1.72 2005-04-28 19:28:31 stephena Exp $
##============================================================================
##============================================================================
@ -39,6 +39,9 @@ OPTIMIZATIONS =
### to override some emulation defaults
DEVELOPER_SUPPORT = 1
### to include sound support
SOUND_SUPPORT = 1
### to build on SMP (or distcc-based) machines
### change to number of CPU's you have
NUMBER_CPU = 1
@ -53,7 +56,7 @@ LD = g++
LDFLAGS = `sdl-config --cflags`
LDLIBS = `sdl-config --libs`
OBJECTS = mainSDL.o SoundSDL.o FrameBufferSoft.o
OBJECTS = mainSDL.o FrameBufferSoft.o
OPTIONS =
EXE_NAME =
SMP =
@ -97,6 +100,11 @@ ifdef DEVELOPER_SUPPORT
OPTIONS += -DDEVELOPER_SUPPORT
endif
ifdef SOUND_SUPPORT
OBJECTS += TIASound.o SoundSDL.o
OPTIONS += -DSOUND_SUPPORT
endif
default:
@echo ""
@ -155,8 +163,8 @@ CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
CartF8.o CartF8SC.o CartFASC.o CartFE.o CartMC.o CartCV.o \
CartMB.o CartUA.o Console.o Control.o Driving.o \
Event.o Joystick.o Keyboard.o M6532.o MD5.o MediaSrc.o Paddles.o \
Props.o PropsSet.o Random.o Sound.o Switches.o Settings.o TIA.o \
Serializer.o Deserializer.o TIASound.o EventHandler.o FrameBuffer.o \
Props.o PropsSet.o Random.o SoundNull.o Switches.o Settings.o TIA.o \
Serializer.o Deserializer.o EventHandler.o FrameBuffer.o \
OSystem.o \
$(M6502_OBJS) $(GUI_OBJS)
@ -290,9 +298,6 @@ Props.o: $(CORE)/Props.cxx $(CORE)/Props.hxx
Random.o: $(CORE)/Random.cxx $(CORE)/Random.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Random.cxx
Sound.o: $(CORE)/Sound.cxx $(CORE)/Sound.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Sound.cxx
Switches.o: $(CORE)/Switches.cxx $(CORE)/Switches.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Switches.cxx
@ -320,6 +325,9 @@ SettingsWin32.o: $(SRC)/win32/SettingsWin32.cxx $(SRC)/win32/SettingsWin32.hxx
OSystemWin32.o: $(SRC)/win32/OSystemWin32.cxx $(SRC)/win32/OSystemWin32.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/win32/OSystemWin32.cxx
SoundNull.o: $(COMMON)/SoundNull.cxx $(COMMON)/SoundNull.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/SoundNull.cxx
SoundSDL.o: $(COMMON)/SoundSDL.cxx $(COMMON)/SoundSDL.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/SoundSDL.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: SoundSDL.cxx,v 1.12 2005-03-26 19:26:47 stephena Exp $
// $Id: SoundSDL.cxx,v 1.13 2005-04-28 19:28:32 stephena Exp $
//============================================================================
#include <sstream>
@ -34,9 +34,11 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundSDL::SoundSDL(OSystem* osystem)
: Sound(osystem),
myIsEnabled(osystem->settings().getBool("sound")),
myFragmentSizeLogBase2(0),
myIsMuted(false)
{
myOSystem->attach(this);
initialize(true);
}
@ -44,25 +46,31 @@ SoundSDL::SoundSDL(OSystem* osystem)
SoundSDL::~SoundSDL()
{
// Close the SDL audio system if it's initialized
if(myIsInitializedFlag)
{
SDL_PauseAudio(1);
SDL_CloseAudio();
}
closeAudio();
}
myIsInitializedFlag = false;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::setEnabled(bool enable)
{
myIsEnabled = enable;
myOSystem->settings().setBool("sound", enable);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::initialize(bool forcerestart)
{
if(forcerestart && myIsInitializedFlag)
// Check whether to start the sound subsystem
if(!myIsEnabled)
{
SDL_PauseAudio(1);
SDL_CloseAudio();
myIsInitializedFlag = false;
closeAudio();
if(myOSystem->settings().getBool("showinfo"))
cout << "Sound disabled." << endl << endl;
return;
}
if(forcerestart && myIsInitializedFlag)
closeAudio();
bool isAlreadyInitialized = (SDL_WasInit(SDL_INIT_AUDIO) & SDL_INIT_AUDIO) > 0;
if(!isAlreadyInitialized)
@ -138,8 +146,6 @@ void SoundSDL::initialize(bool forcerestart)
<< " Frag size: " << fragsize << endl << endl;
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -186,6 +192,7 @@ void SoundSDL::setVolume(Int32 percent)
{
if((percent >= 0) && (percent <= 100))
{
myOSystem->settings().setInt("volume", percent);
SDL_LockAudio();
myVolume = percent;
Tia_volume(percent);
@ -218,7 +225,19 @@ void SoundSDL::adjustVolume(Int8 direction)
message += strval.str();
myOSystem->frameBuffer().showMessage(message);
myOSystem->settings().setInt("volume", percent);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::adjustCycleCounter(Int32 amount)
{
myLastRegisterSetCycle += amount;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::setFrameRate(uInt32 framerate)
{
myDisplayFrameRate = framerate;
myLastRegisterSetCycle = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -250,9 +269,7 @@ void SoundSDL::set(uInt16 addr, uInt8 value, Int32 cycle)
void SoundSDL::processFragment(uInt8* stream, Int32 length)
{
if(!myIsInitializedFlag)
{
return;
}
// If there are excessive items on the queue then we'll remove some
if(myRegWriteQueue.duration() > (myFragmentSizeLogBase2 / myDisplayFrameRate))
@ -334,6 +351,17 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len)
sound->processFragment(stream, (Int32)len);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::closeAudio()
{
if(myIsInitializedFlag)
{
SDL_PauseAudio(1);
SDL_CloseAudio();
myIsInitializedFlag = false;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundSDL::load(Deserializer& in)
{

View File

@ -13,11 +13,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SoundSDL.hxx,v 1.9 2005-03-26 19:26:47 stephena Exp $
// $Id: SoundSDL.hxx,v 1.10 2005-04-28 19:28:32 stephena Exp $
//============================================================================
#ifndef SOUNDSDL_HXX
#define SOUNDSDL_HXX
#ifndef SOUND_SDL_HXX
#define SOUND_SDL_HXX
class OSystem;
@ -31,7 +31,7 @@ class OSystem;
This class implements the sound API for SDL.
@author Stephen Anthony and Bradford W. Mott
@version $Id: SoundSDL.hxx,v 1.9 2005-03-26 19:26:47 stephena Exp $
@version $Id: SoundSDL.hxx,v 1.10 2005-04-28 19:28:32 stephena Exp $
*/
class SoundSDL : public Sound
{
@ -48,41 +48,64 @@ class SoundSDL : public Sound
virtual ~SoundSDL();
public:
/**
Enables/disables the sound subsystem.
@param enable Either true or false, to enable or disable the sound system
*/
void setEnabled(bool enable);
/**
The system cycle counter is being adjusting by the specified amount. Any
members using the system cycle counter should be adjusted as needed.
@param amount The amount the cycle counter is being adjusted by
*/
void adjustCycleCounter(Int32 amount);
/**
Sets the display framerate. Sound generation for NTSC and PAL games
depends on the framerate, so we need to set it here.
@param framerate The base framerate depending on NTSC or PAL ROM
*/
void setFrameRate(uInt32 framerate);
/**
Initializes the sound device. This must be called before any
calls are made to derived methods.
@param forcerestart Do a soft or hard reset of the sound subsystem
*/
virtual void initialize(bool forcerestart = false);
void initialize(bool forcerestart = false);
/**
Return true iff the sound device was successfully initialized.
@return true iff the sound device was successfully initialized
@return true iff the sound device was successfully initialized.
*/
virtual bool isSuccessfullyInitialized() const;
bool isSuccessfullyInitialized() const;
/**
Set the mute state of the sound object. While muted no sound is played.
@param state Mutes sound if true, unmute if false
*/
virtual void mute(bool state);
void mute(bool state);
/**
Resets the sound device.
Reset the sound device.
*/
virtual void reset();
void reset();
/**
Sets the sound register to a given value.
@param addr The register address
@param value The value to save into the register
@param cycle The CPU cycle at which the register is being updated
@param cycle The system cycle at which the register is being updated
*/
virtual void set(uInt16 addr, uInt8 value, Int32 cycle);
void set(uInt16 addr, uInt8 value, Int32 cycle);
/**
Sets the volume of the sound device to the specified level. The
@ -91,7 +114,7 @@ class SoundSDL : public Sound
@param percent The new volume percentage level for the sound device
*/
virtual void setVolume(Int32 percent);
void setVolume(Int32 percent);
/**
Adjusts the volume of the sound device based on the given direction.
@ -99,7 +122,7 @@ class SoundSDL : public Sound
@param direction Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 =decrease)
*/
virtual void adjustVolume(Int8 direction);
void adjustVolume(Int8 direction);
public:
/**
@ -203,8 +226,17 @@ class SoundSDL : public Sound
};
private:
// Audio specification structure
SDL_AudioSpec myHardwareSpec;
// Indicates if the sound subsystem is to be initialized
bool myIsEnabled;
// Indicates if the sound device was successfully initialized
bool myIsInitializedFlag;
// Indicates the cycle when a sound register was last set
Int32 myLastRegisterSetCycle;
// Indicates the base framerate depending on whether the ROM is NTSC or PAL
uInt32 myDisplayFrameRate;
// Log base 2 of the selected fragment size
double myFragmentSizeLogBase2;
@ -215,12 +247,18 @@ class SoundSDL : public Sound
// Current volume as a percentage (0 - 100)
uInt32 myVolume;
// Audio specification structure
SDL_AudioSpec myHardwareSpec;
// Queue of TIA register writes
RegWriteQueue myRegWriteQueue;
private:
// Callback function invoked by the SDL Audio library when it needs data
static void callback(void* udata, uInt8* stream, int len);
// Closes the audio device
void closeAudio();
};
#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: mainSDL.cxx,v 1.30 2005-04-03 19:37:32 stephena Exp $
// $Id: mainSDL.cxx,v 1.31 2005-04-28 19:28:32 stephena Exp $
//============================================================================
#include <fstream>
@ -38,10 +38,15 @@
#include "FrameBufferSoft.hxx"
#include "PropsSet.hxx"
#include "Sound.hxx"
#include "SoundSDL.hxx"
#include "Settings.hxx"
#include "OSystem.hxx"
#ifdef SOUND_SUPPORT
#include "SoundSDL.hxx"
#else
#include "SoundNull.hxx"
#endif
#ifdef DISPLAY_OPENGL
#include "FrameBufferGL.hxx"
#endif
@ -396,10 +401,11 @@ int main(int argc, char* argv[])
}
// Create a sound object for playing audio, even if sound has been disabled
if(theSettings->getBool("sound"))
#ifdef SOUND_SUPPORT
theSound = new SoundSDL(theOSystem);
else
theSound = new Sound(theOSystem);
#else
theSound = new SoundNull(theOSystem);
#endif
// Setup the SDL joysticks (must be done after FrameBuffer is created)
/* FIXME - don't exit if joysticks can't be initialized

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: Sound.hxx,v 1.16 2005-03-26 19:26:47 stephena Exp $
// $Id: Sound.hxx,v 1.17 2005-04-28 19:28:33 stephena Exp $
//============================================================================
#ifndef SOUND_HXX
@ -26,12 +26,11 @@ class Deserializer;
#include "bspf.hxx"
/**
This class is a base class for the various sound objects.
It has almost no functionality, but is useful if one wishes
to compile Stella with no sound support whatsoever.
This class is an abstract base class for the various sound objects.
It has no functionality whatsoever.
@author Stephen Anthony and Bradford W. Mott
@version $Id: Sound.hxx,v 1.16 2005-03-26 19:26:47 stephena Exp $
@author Stephen Anthony
@version $Id: Sound.hxx,v 1.17 2005-04-28 19:28:33 stephena Exp $
*/
class Sound
{
@ -40,21 +39,23 @@ class Sound
Create a new sound object. The init method must be invoked before
using the object.
*/
Sound(OSystem* osystem);
/**
Destructor
*/
virtual ~Sound();
Sound(OSystem* osystem) { myOSystem = osystem; }
public:
/**
Enables/disables the sound subsystem.
@param enable Either true or false, to enable or disable the sound system
*/
virtual void setEnabled(bool enable) = 0;
/**
The system cycle counter is being adjusting by the specified amount. Any
members using the system cycle counter should be adjusted as needed.
@param amount The amount the cycle counter is being adjusted by
*/
virtual void adjustCycleCounter(Int32 amount);
virtual void adjustCycleCounter(Int32 amount) = 0;
/**
Sets the display framerate. Sound generation for NTSC and PAL games
@ -62,7 +63,7 @@ class Sound
@param framerate The base framerate depending on NTSC or PAL ROM
*/
virtual void setFrameRate(uInt32 framerate);
virtual void setFrameRate(uInt32 framerate) = 0;
/**
Initializes the sound device. This must be called before any
@ -70,26 +71,26 @@ class Sound
@param forcerestart Do a soft or hard reset of the sound subsystem
*/
virtual void initialize(bool forcerestart = false);
virtual void initialize(bool forcerestart = false) = 0;
/**
Return true iff the sound device was successfully initialized.
@return true iff the sound device was successfully initialized.
*/
virtual bool isSuccessfullyInitialized() const;
virtual bool isSuccessfullyInitialized() const = 0;
/**
Set the mute state of the sound object. While muted no sound is played.
@param state Mutes sound if true, unmute if false
*/
virtual void mute(bool state);
virtual void mute(bool state) = 0;
/**
Reset the sound device.
*/
virtual void reset();
virtual void reset() = 0;
/**
Sets the sound register to a given value.
@ -98,7 +99,7 @@ class Sound
@param value The value to save into the register
@param cycle The system cycle at which the register is being updated
*/
virtual void set(uInt16 addr, uInt8 value, Int32 cycle);
virtual void set(uInt16 addr, uInt8 value, Int32 cycle) = 0;
/**
Sets the volume of the sound device to the specified level. The
@ -107,7 +108,7 @@ class Sound
@param percent The new volume percentage level for the sound device
*/
virtual void setVolume(Int32 percent);
virtual void setVolume(Int32 percent) = 0;
/**
Adjusts the volume of the sound device based on the given direction.
@ -115,7 +116,7 @@ class Sound
@param direction Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 =decrease)
*/
virtual void adjustVolume(Int8 direction);
virtual void adjustVolume(Int8 direction) = 0;
public:
/**
@ -124,7 +125,7 @@ public:
@param in The deserializer device to load from.
@return The result of the load. True on success, false on failure.
*/
virtual bool load(Deserializer& in);
virtual bool load(Deserializer& in) = 0;
/**
Saves the current state of this device to the given Serializer.
@ -132,20 +133,11 @@ public:
@param out The serializer device to save to.
@return The result of the save. True on success, false on failure.
*/
virtual bool save(Serializer& out);
virtual bool save(Serializer& out) = 0;
protected:
// The OSystem for this sound object
OSystem* myOSystem;
// Indicates if the sound device was successfully initialized
bool myIsInitializedFlag;
// Indicates the cycle when a sound register was last set
Int32 myLastRegisterSetCycle;
// Indicates the base framerate depending on whether the ROM is NTSC or PAL
uInt32 myDisplayFrameRate;
};
#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: AudioDialog.cxx,v 1.2 2005-03-27 03:07:34 stephena Exp $
// $Id: AudioDialog.cxx,v 1.3 2005-04-28 19:28:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -45,9 +45,9 @@ AudioDialog::AudioDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
: Dialog(osystem, x, y, w, h)
{
int yoff = 10,
xoff = 10,
woff = _w - 100,
labelWidth = 70;
xoff = 30,
woff = _w - 80,
labelWidth = 80;
// Volume
myVolumeSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
@ -69,18 +69,17 @@ AudioDialog::AudioDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
yoff += kAudioRowHeight + 4;
// Enable sound
new StaticTextWidget(this, xoff+8, yoff+3, 20, kLineHeight,
"(*)", kTextAlignLeft);
new StaticTextWidget(this, xoff+8, yoff+3, 20, kLineHeight, "", kTextAlignLeft);
mySoundEnableCheckbox = new CheckboxWidget(this, xoff+28, yoff, woff - 14, kLineHeight,
"Enable sound", kSoundEnableChanged);
yoff += kAudioRowHeight + 12;
// Add a short message about options that need a restart
new StaticTextWidget(this, xoff+30, yoff, 170, kLineHeight,
"* Note that these options take effect", kTextAlignLeft);
yoff += kAudioRowHeight;
new StaticTextWidget(this, xoff+30, yoff, 170, kLineHeight,
"the next time you restart Stella.", kTextAlignLeft);
// new StaticTextWidget(this, xoff+30, yoff, 170, kLineHeight,
// "* Note that these options take effect", kTextAlignLeft);
// yoff += kAudioRowHeight;
// new StaticTextWidget(this, xoff+30, yoff, 170, kLineHeight,
// "the next time you restart Stella.", kTextAlignLeft);
// Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0);
@ -132,27 +131,36 @@ void AudioDialog::saveConfig()
{
string s;
uInt32 i;
bool b;
bool b, restart = false;
// Volume
i = myVolumeSlider->getValue();
instance()->settings().setInt("volume", i);
instance()->sound().setVolume(i);
// Fragsize
// This one requires a complete re-initialization of the sound subsystem,
// so we only do it if the fragsize really has changed
// Fragsize (requires a restart to take effect)
i = 1;
i <<= (myFragsizePopup->getSelectedTag() + 7);
if(instance()->settings().getInt("fragsize") != (Int32)i)
{
instance()->settings().setInt("fragsize", i);
instance()->sound().initialize(true); // force a re-initialization
restart = true;
}
// Enable sound (requires a restart to take effect) // FIXME - let this work without a restart
// Enable/disable sound (requires a restart to take effect)
b = mySoundEnableCheckbox->getState();
instance()->settings().setBool("sound", b);
if(instance()->settings().getBool("sound") != b)
{
instance()->sound().setEnabled(b);
restart = true;
}
// Only force a re-initialization when necessary, since it can
// be a time-consuming operation
if(restart)
{
instance()->sound().initialize(true);
instance()->sound().mute(true);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -161,6 +169,7 @@ void AudioDialog::setDefaults()
myVolumeSlider->setValue(100);
myVolumeLabel->setLabel("100");
// FIXME - get defaults from OSystem or Settings
#ifdef WIN32
myFragsizePopup->setSelectedTag(4);
#else

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: GameInfoDialog.cxx,v 1.1 2005-03-27 03:07:34 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.2 2005-04-28 19:28:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -45,7 +45,7 @@ GameInfoDialog::GameInfoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, u
for(uInt8 i = 0; i < LINES_PER_PAGE; i++)
{
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 210, 16, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, 16, "", kTextAlignLeft);
}
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: HelpDialog.cxx,v 1.1 2005-03-27 03:07:34 stephena Exp $
// $Id: HelpDialog.cxx,v 1.2 2005-04-28 19:28:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -44,7 +44,7 @@ HelpDialog::HelpDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h)
for(uInt8 i = 0; i < LINES_PER_PAGE; i++)
{
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 210, 16, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, 16, "", kTextAlignLeft);
}
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.10 2005-04-05 00:40:55 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.11 2005-04-28 19:28:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -78,11 +78,11 @@ OptionsDialog::OptionsDialog(OSystem* osystem)
uInt16 x, y, w, h;
// Now create all the dialogs attached to each menu button
w = 250; h = 150;
w = 230; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myVideoDialog = new VideoDialog(myOSystem, x, y, w, h);
w = 220; h = 120;
w = 200; h = 100;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAudioDialog = new AudioDialog(myOSystem, x, y, w, h);

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: VideoDialog.cxx,v 1.5 2005-03-27 03:07:34 stephena Exp $
// $Id: VideoDialog.cxx,v 1.6 2005-04-28 19:28:33 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -45,8 +45,8 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
{
int yoff = 10,
xoff = 2,
woff = _w - 130,
labelWidth = 65;
woff = 110,
labelWidth = 55;
// Video driver (query OSystem for what's supported)
myDriverPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
@ -61,9 +61,11 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
// _langPopUp->appendEntry(l->description, l->id);
// }
// FIXME - get list of renderers from OSystem
// Also, make these options work without requiring a restart
// Video renderer
myRendererPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
"(*)Renderer: ", labelWidth, kRendererChanged);
"Renderer: ", labelWidth, kRendererChanged);
myRendererPopup->appendEntry("Software", 1);
myRendererPopup->appendEntry("OpenGL", 2);
yoff += kVideoRowHeight + 4;
@ -77,9 +79,9 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
// Aspect ratio
myAspectRatioSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
"(*)GL Aspect: ", labelWidth, kAspectRatioChanged);
"GL Aspect: ", labelWidth, kAspectRatioChanged);
myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100);
myAspectRatioLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 24, kLineHeight,
myAspectRatioLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 15, kLineHeight,
"", kTextAlignLeft);
myAspectRatioLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4;
@ -96,36 +98,36 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
xoff = xoff + 115;
// Framerate
myFrameRateSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
myFrameRateSlider = new SliderWidget(this, xoff, yoff, woff - 25, kLineHeight,
"Framerate: ", labelWidth, kFrameRateChanged);
myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300);
myFrameRateLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 20, kLineHeight,
myFrameRateLabel = new StaticTextWidget(this, xoff + woff - 22, yoff, 20, kLineHeight,
"", kTextAlignLeft);
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4;
// Zoom level
myZoomSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
myZoomSlider = new SliderWidget(this, xoff, yoff, woff - 25, kLineHeight,
"Zoom: ", labelWidth, kZoomChanged);
myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50);
myZoomLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 20, kLineHeight,
myZoomLabel = new StaticTextWidget(this, xoff + woff - 22, yoff, 20, kLineHeight,
"", kTextAlignLeft);
myZoomLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 10;
myFullscreenCheckbox = new CheckboxWidget(this, xoff + 25, yoff, woff - 14, kLineHeight,
myFullscreenCheckbox = new CheckboxWidget(this, xoff + 5, yoff, woff - 14, kLineHeight,
"Fullscreen mode");
yoff += kVideoRowHeight + 4;
myUseDeskResCheckbox = new CheckboxWidget(this, xoff + 25, yoff, woff - 14, kLineHeight,
myUseDeskResCheckbox = new CheckboxWidget(this, xoff + 5, yoff, woff - 14, kLineHeight,
"Desktop Res in FS");
yoff += kVideoRowHeight + 20;
// Add a short message about options that need a restart
new StaticTextWidget(this, xoff-40, yoff, 170, kLineHeight,
new StaticTextWidget(this, _w - 175, yoff, 170, kLineHeight,
"* Note that these options take effect", kTextAlignLeft);
yoff += kVideoRowHeight;
new StaticTextWidget(this, xoff-40, yoff, 170, kLineHeight,
new StaticTextWidget(this, _w - 175, yoff, 170, kLineHeight,
"the next time you restart Stella.", kTextAlignLeft);
// Add Defaults, OK and Cancel buttons