Root of all OSDL modules. More...
#include <OSDLBasic.h>
Public Types | |
typedef Ceylan::Sint32 | BackendReturnCode |
Data type of back-end return code: | |
Public Member Functions | |
Ceylan::System::Microsecond | getRuntimeDuration () const |
Returns the number of microseconds OSDL has been running. | |
virtual bool | hasVideoModule () const |
Tells whether a video module is available. | |
virtual Video::VideoModule & | getVideoModule () const |
Returns current video module. | |
virtual bool | hasEventsModule () const |
Tells whether a video module is available. | |
virtual Events::EventsModule & | getEventsModule () const |
Returns current events module. | |
virtual bool | hasAudioModule () const |
Tells whether a video module is available. | |
virtual Audio::AudioModule & | getAudioModule () const |
Returns current audio module. | |
virtual void | removeAudioModule () |
Removes the current audio module. | |
virtual Ceylan::Flags | getFlags () const |
Returns flags used for this common module. | |
virtual bool | isGUIEnabled () const |
Tells whether the GUI support is enabled. | |
virtual void | enableGUI () |
Enables the GUI support. | |
virtual void | disableGUI () |
Disables the GUI support. | |
virtual bool | hasCDROMDriveHandler () const |
Tells whether a CD-ROM drive handler is available. | |
virtual CDROMDriveHandler & | getCDROMDriveHandler () const |
Returns current CD-ROM handler. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
static std::string | InterpretFlags (Ceylan::Flags flags) |
Describes specified top-level flags used to initialize the SDL back-end. | |
static std::string | DescribeEnvironmentVariables () |
Returns a summary about the possible use of general-purpose* environment variables, for the selected back-end, expressed in specified format. | |
static bool | IsBackendInitialized () |
Tells whether the back-end is initialized. | |
Static Public Attributes | |
static const BackendReturnCode | BackendSuccess = 0 |
Exported logical value for back-end success. | |
static const BackendReturnCode | BackendError = -1 |
Exported logical value for back-end success/. | |
static const Ceylan::Flags | UseTimer = 0x00000001 |
Initializes the timer subsystem. | |
static const Ceylan::Flags | UseAudio = 0x00000010 |
Initializes the audio subsystem. | |
static const Ceylan::Flags | UseVideo = 0x00000020 |
Initializes the video subsystem. | |
static const Ceylan::Flags | UseCDROM = 0x00000100 |
Initializes the CD-ROM subsystem. | |
static const Ceylan::Flags | UseJoystick = 0x00000200 |
Initializes the joystick subsystem, implies initializing the video (UseVideo). | |
static const Ceylan::Flags | UseKeyboard = 0x4000 |
Initializes the keyboard subsystem, implies initializing the video (UseVideo). | |
static const Ceylan::Flags | UseMouse = 0x8000 |
Initializes the mouse subsystem, implies initializing the video (UseVideo). | |
static const Ceylan::Flags | UseEvents |
Initializes the events subsystem; implies initializing the video (UseVideo). | |
static const Ceylan::Flags | UseGUI = 0x10000 |
Initializes the GUI (Graphical User Interface) subsystem, implies initializing the video (UseVideo) and the events (UseEvents) subsystems. | |
static const Ceylan::Flags | UseEverything = 0x0001FFFF |
Initializes all above subsystems. | |
static const Ceylan::Flags | NoParachute = 0x00100000 |
Do not catch fatal signals. | |
static const Ceylan::Flags | UseEventThread = 0x01000000 |
Initializes the event thread. | |
Static Protected Member Functions | |
static Ceylan::Flags | AutoCorrectFlags (Ceylan::Flags inputFlags) |
Corrects the input flags, formatted as parameters used to create the common module, so that they can be retain directly, without further change. | |
Protected Attributes | |
Video::VideoModule * | _video |
Pointer to the current video module used, if any. | |
Events::EventsModule * | _events |
Pointer to the current events module used, if any. | |
Audio::AudioModule * | _audio |
Pointer to the current video module used, if any. | |
bool | _useGUI |
Tells whether a GUI (Graphical User Interface) is to be used. | |
Ceylan::Flags | _flags |
Flags used for this common module. | |
CDROMDriveHandler * | _cdromHandler |
Pointer to the current CD-ROM drive handler used, if any. | |
Ceylan::System::Second | _startingSecond |
Stores the second at which OSDL was started. | |
Ceylan::System::Microsecond | _startingMicrosecond |
Stores the microsecond at which OSDL was started. | |
Static Protected Attributes | |
static bool | _BackendInitialized = false |
Tells whether the back-end used by OSDL is initialized. | |
static CommonModule * | _CurrentCommonModule = 0 |
The common module being currently used, if any. | |
static const std::string | _SDLEnvironmentVariables [] = {} |
Array of all known general purpose environment variables, for SDL back-end. | |
Private Member Functions | |
CommonModule (Ceylan::Flags flags) | |
Initializes OSDL system common module. | |
virtual | ~CommonModule () throw () |
Stops OSDL system common module. | |
Friends | |
OSDL_DLL friend CommonModule & | getCommonModule (Ceylan::Flags flags) |
This friend function is intended to be the initial means of getting a reference to the common module: this is the entry point to the whole OSDL system. | |
OSDL_DLL friend bool | hasExistingCommonModule () |
Tells whether there already exists a common module. | |
OSDL_DLL friend CommonModule & | getExistingCommonModule () |
This friend function is intended to be the usual means of getting a reference to the common module, which must already exist. | |
OSDL_DLL friend void | stop () |
This friend function allows to shutdown all OSDL services. |
Root of all OSDL modules.
From this common module, all other modules can be triggered.
Definition at line 134 of file OSDLBasic.h.
typedef Ceylan::Sint32 OSDL::CommonModule::BackendReturnCode |
Data type of back-end return code:
Definition at line 179 of file OSDLBasic.h.
OSDL::CommonModule::CommonModule | ( | Ceylan::Flags | flags | ) | [explicit, private] |
Initializes OSDL system common module.
flags | parameters to initialize SDL. |
OSDL::Exception | if the creation failed. |
CommonModule::~CommonModule | ( | ) | throw () [private, virtual] |
Stops OSDL system common module.
Definition at line 476 of file OSDLBasic.cc.
References _audio, _cdromHandler, _events, _startingMicrosecond, _startingSecond, _useGUI, _video, and disableGUI().
static Ceylan::Flags OSDL::CommonModule::AutoCorrectFlags | ( | Ceylan::Flags | inputFlags | ) | [static, protected] |
Corrects the input flags, formatted as parameters used to create the common module, so that they can be retain directly, without further change.
For example, if an event source such as a joystick is selected, then the video module must be activated, even if not explicitly selected, otherwise no event at all will be available. Thus the method will fix the flags so that they are consistent.
string CommonModule::DescribeEnvironmentVariables | ( | ) | [static] |
Returns a summary about the possible use of general-purpose* environment variables, for the selected back-end, expressed in specified format.
Definition at line 959 of file OSDLBasic.cc.
References _SDLEnvironmentVariables, and toString().
virtual void OSDL::CommonModule::disableGUI | ( | ) | [virtual] |
Disables the GUI support.
Referenced by ~CommonModule().
void CommonModule::enableGUI | ( | ) | [virtual] |
Enables the GUI support.
OSDL::Exception | if the video, audio or events module is lacking. |
Definition at line 754 of file OSDLBasic.cc.
References _audio, _events, _useGUI, _video, oldestAgarSupportedMajor, oldestAgarSupportedMinor, oldestAgarSupportedPatch, OSDL::Events::EventsModule::setGUIEnableStatus(), OSDL::Audio::AudioModule::setGUIEnableStatus(), OSDL::Video::VideoModule::setGUIEnableStatus(), and OSDL::Video::Pixels::toString().
Audio::AudioModule & CommonModule::getAudioModule | ( | ) | const [virtual] |
Returns current audio module.
OSDL::Exception | is no audio module is available. |
Definition at line 708 of file OSDLBasic.cc.
References _audio.
Referenced by OSDL::Audio::getExistingAudioModule().
CDROMDriveHandler & CommonModule::getCDROMDriveHandler | ( | ) | const [virtual] |
Returns current CD-ROM handler.
OSDL::Exception | is not CD-ROM handler is available. |
Definition at line 879 of file OSDLBasic.cc.
References _cdromHandler.
Events::EventsModule & CommonModule::getEventsModule | ( | ) | const [virtual] |
Returns current events module.
OSDL::Exception | is no events module is available. |
Definition at line 686 of file OSDLBasic.cc.
References _events.
Referenced by OSDL::Engine::Scheduler::schedule().
Flags CommonModule::getFlags | ( | ) | const [virtual] |
Returns flags used for this common module.
Definition at line 736 of file OSDLBasic.cc.
References _flags.
Ceylan::System::Microsecond CommonModule::getRuntimeDuration | ( | ) | const |
Returns the number of microseconds OSDL has been running.
Definition at line 640 of file OSDLBasic.cc.
References _startingMicrosecond, and _startingSecond.
Video::VideoModule & CommonModule::getVideoModule | ( | ) | const [virtual] |
Returns current video module.
OSDL::Exception | is no video module is available. |
Definition at line 664 of file OSDLBasic.cc.
References _video.
Referenced by OSDL::Events::EventsModule::enterBasicMainLoop(), OSDL::Video::VideoModule::GetAntiAliasingState(), OSDL::Video::VideoModule::GetEndPointDrawState(), OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Events::EventsModule::onResizedWindow(), OSDL::Events::EventsModule::onScreenNeedsRedraw(), OSDL::Video::Overlay::Overlay(), and OSDL::Engine::Scheduler::schedule().
bool CommonModule::hasAudioModule | ( | ) | const [virtual] |
Tells whether a video module is available.
Definition at line 699 of file OSDLBasic.cc.
References _audio.
bool CommonModule::hasCDROMDriveHandler | ( | ) | const [virtual] |
Tells whether a CD-ROM drive handler is available.
Definition at line 871 of file OSDLBasic.cc.
References _cdromHandler.
bool CommonModule::hasEventsModule | ( | ) | const [virtual] |
Tells whether a video module is available.
Definition at line 677 of file OSDLBasic.cc.
References _events.
bool CommonModule::hasVideoModule | ( | ) | const [virtual] |
Tells whether a video module is available.
Definition at line 655 of file OSDLBasic.cc.
References _video.
Referenced by OSDL::Video::VideoModule::GetAntiAliasingState(), OSDL::Video::VideoModule::GetEndPointDrawState(), OSDL::Video::VideoModule::IsDisplayInitialized(), and OSDL::Video::Overlay::Overlay().
static std::string OSDL::CommonModule::InterpretFlags | ( | Ceylan::Flags | flags | ) | [static] |
Describes specified top-level flags used to initialize the SDL back-end.
flags |
Referenced by toString().
bool CommonModule::IsBackendInitialized | ( | ) | [static] |
Tells whether the back-end is initialized.
Definition at line 1020 of file OSDLBasic.cc.
References _BackendInitialized.
Referenced by OSDL::Events::EventsModule::enterMainLoop(), and OSDL::Events::EventsModule::GetMillisecondsSinceStartup().
bool CommonModule::isGUIEnabled | ( | ) | const [virtual] |
Tells whether the GUI support is enabled.
Definition at line 745 of file OSDLBasic.cc.
References _useGUI.
void CommonModule::removeAudioModule | ( | ) | [virtual] |
Removes the current audio module.
OSDL::Exception | is no audio module was available. |
Definition at line 721 of file OSDLBasic.cc.
References _audio.
const string CommonModule::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Definition at line 892 of file OSDLBasic.cc.
References _audio, _cdromHandler, _events, _flags, _useGUI, _video, OSDL::GetVersion(), InterpretFlags(), and OSDL::Video::Pixels::toString().
Referenced by DescribeEnvironmentVariables().
OSDL_DLL friend CommonModule& getCommonModule | ( | Ceylan::Flags | flags | ) | [friend] |
This friend function is intended to be the initial means of getting a reference to the common module: this is the entry point to the whole OSDL system.
See its declaration at the end of this file for further details.
This friend function is intended to be the initial means of getting a reference to the common module: this is the entry point to the whole OSDL system.
flags | The requested flags for this common root module, any OR'd combination of CommonModule static flags, so that associated subsystems are instanciated. |
OSDL_DLL friend CommonModule& getExistingCommonModule | ( | ) | [friend] |
This friend function is intended to be the usual means of getting a reference to the common module, which must already exist.
If not, a fatal error will be triggered (not an exception to avoid handling it in all user methods).
See its declaration at the end of file for further details.
OSDL::Exception | if the common module does not exist already. |
OSDL_DLL friend bool hasExistingCommonModule | ( | ) | [friend] |
Tells whether there already exists a common module.
OSDL_DLL friend void stop | ( | ) | [friend] |
This friend function allows to shutdown all OSDL services.
Audio::AudioModule* OSDL::CommonModule::_audio [protected] |
Pointer to the current video module used, if any.
Definition at line 499 of file OSDLBasic.h.
Referenced by enableGUI(), getAudioModule(), hasAudioModule(), removeAudioModule(), toString(), and ~CommonModule().
bool CommonModule::_BackendInitialized = false [static, protected] |
Tells whether the back-end used by OSDL is initialized.
Definition at line 535 of file OSDLBasic.h.
Referenced by IsBackendInitialized().
CDROMDriveHandler* OSDL::CommonModule::_cdromHandler [protected] |
Pointer to the current CD-ROM drive handler used, if any.
Definition at line 516 of file OSDLBasic.h.
Referenced by getCDROMDriveHandler(), hasCDROMDriveHandler(), toString(), and ~CommonModule().
CommonModule * CommonModule::_CurrentCommonModule = 0 [static, protected] |
The common module being currently used, if any.
Definition at line 539 of file OSDLBasic.h.
Events::EventsModule* OSDL::CommonModule::_events [protected] |
Pointer to the current events module used, if any.
Definition at line 494 of file OSDLBasic.h.
Referenced by enableGUI(), getEventsModule(), hasEventsModule(), toString(), and ~CommonModule().
Ceylan::Flags OSDL::CommonModule::_flags [protected] |
Flags used for this common module.
Definition at line 511 of file OSDLBasic.h.
Referenced by getFlags(), and toString().
const string CommonModule::_SDLEnvironmentVariables = {} [static, protected] |
Array of all known general purpose environment variables, for SDL back-end.
Definition at line 548 of file OSDLBasic.h.
Referenced by DescribeEnvironmentVariables().
Ceylan::System::Microsecond OSDL::CommonModule::_startingMicrosecond [protected] |
Stores the microsecond at which OSDL was started.
Definition at line 525 of file OSDLBasic.h.
Referenced by getRuntimeDuration(), and ~CommonModule().
Ceylan::System::Second OSDL::CommonModule::_startingSecond [protected] |
Stores the second at which OSDL was started.
Definition at line 521 of file OSDLBasic.h.
Referenced by getRuntimeDuration(), and ~CommonModule().
bool OSDL::CommonModule::_useGUI [protected] |
Tells whether a GUI (Graphical User Interface) is to be used.
Definition at line 506 of file OSDLBasic.h.
Referenced by enableGUI(), isGUIEnabled(), toString(), and ~CommonModule().
Video::VideoModule* OSDL::CommonModule::_video [protected] |
Pointer to the current video module used, if any.
Definition at line 489 of file OSDLBasic.h.
Referenced by enableGUI(), getVideoModule(), hasVideoModule(), toString(), and ~CommonModule().
const CommonModule::BackendReturnCode CommonModule::BackendError = -1 [static] |
Exported logical value for back-end success/.
Prefer only testing against SDLSuccess: if ( [...] != BackendSuccess ) ...
Definition at line 195 of file OSDLBasic.h.
const CommonModule::BackendReturnCode CommonModule::BackendSuccess = 0 [static] |
Exported logical value for back-end success.
Definition at line 184 of file OSDLBasic.h.
Referenced by OSDL::Audio::AudioModule::AudioModule(), OSDL::CDROMDriveHandler::CDROMDriveHandler(), OSDL::Events::JoystickHandler::JoystickHandler(), and OSDL::Video::VideoModule::VideoModule().
const Ceylan::Flags CommonModule::NoParachute = 0x00100000 [static] |
Do not catch fatal signals.
By default fatal signals are caught, so that if your program crashes, the resulting exception will be intercepted in order to clean up and return the display to a usable state.
However this system does not behave nicely with debuggers, so it might be disabled (mostly for debugging purpose) with this flag.
Definition at line 458 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseAudio = 0x00000010 [static] |
Initializes the audio subsystem.
Definition at line 378 of file OSDLBasic.h.
Referenced by OSDL::Audio::AudioModule::AudioModule(), and OSDL::Audio::AudioModule::~AudioModule().
const Ceylan::Flags CommonModule::UseCDROM = 0x00000100 [static] |
Initializes the CD-ROM subsystem.
Definition at line 386 of file OSDLBasic.h.
Referenced by OSDL::CDROMDriveHandler::CDROMDriveHandler(), and OSDL::CDROMDriveHandler::~CDROMDriveHandler().
const Ceylan::Flags CommonModule::UseEvents [static] |
Initializes the events subsystem; implies initializing the video (UseVideo).
This is just a convenience flag gathering all event-related flags (UseJoystick, UseKeyboard, UseMouse, etc.)
Definition at line 422 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseEventThread = 0x01000000 [static] |
Initializes the event thread.
Definition at line 462 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseEverything = 0x0001FFFF [static] |
Initializes all above subsystems.
Definition at line 435 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseGUI = 0x10000 [static] |
Initializes the GUI (Graphical User Interface) subsystem, implies initializing the video (UseVideo) and the events (UseEvents) subsystems.
Definition at line 431 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseJoystick = 0x00000200 [static] |
Initializes the joystick subsystem, implies initializing the video (UseVideo).
Definition at line 395 of file OSDLBasic.h.
Referenced by OSDL::Events::JoystickHandler::~JoystickHandler().
const Ceylan::Flags CommonModule::UseKeyboard = 0x4000 [static] |
Initializes the keyboard subsystem, implies initializing the video (UseVideo).
Definition at line 403 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseMouse = 0x8000 [static] |
Initializes the mouse subsystem, implies initializing the video (UseVideo).
Definition at line 411 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseTimer = 0x00000001 [static] |
Initializes the timer subsystem.
Definition at line 374 of file OSDLBasic.h.
const Ceylan::Flags CommonModule::UseVideo = 0x00000020 [static] |
Initializes the video subsystem.
Definition at line 382 of file OSDLBasic.h.
Referenced by OSDL::Events::JoystickHandler::JoystickHandler(), OSDL::Video::VideoModule::VideoModule(), and OSDL::Video::VideoModule::~VideoModule().