00001 #ifndef OSDL_BASIC_H_
00002 #define OSDL_BASIC_H_
00003
00004
00005 #include "OSDLException.h"
00006
00007
00008 #include "Ceylan.h"
00009
00010
00011
00012 namespace OSDL
00013 {
00014
00015
00035 #define CHECK_OSDL_VERSIONS() \
00036 Ceylan::LibtoolVersion headerVersion( \
00037 OSDL::actualOSDLHeaderLibtoolVersion ) ; \
00038 if ( ! \
00039 OSDL::GetVersion().isCompatibleWith( headerVersion ) ) \
00040 Ceylan::emergencyShutdown( \
00041 "OSDL library version currently linked (" \
00042 + OSDL::GetVersion().toString() \
00043 + ") is not compatible with the one read from the OSDL " \
00044 "header files used to compile this application (" \
00045 + headerVersion.toString() + "), aborting." ) ;
00046
00047
00048
00049
00050 namespace Video
00051 {
00052
00053
00054 class VideoModule ;
00055
00056 }
00057
00058
00059 namespace Events
00060 {
00061
00062
00063 class EventsModule ;
00064
00065 }
00066
00067
00068 namespace Audio
00069 {
00070
00071
00072 class AudioModule ;
00073
00074 }
00075
00076
00077
00078 class CDROMDriveHandler ;
00079
00080
00082 OSDL_DLL const Ceylan::LibtoolVersion & GetVersion() throw() ;
00083
00084
00086 OSDL_DLL void stop() throw() ;
00087
00088
00095 class OSDL_DLL CommonModule : public Ceylan::Module
00096 {
00097
00098
00099
00119 OSDL_DLL friend CommonModule & getCommonModule( Ceylan::Flags flags )
00120 throw() ;
00121
00122
00127 OSDL_DLL friend bool hasExistingCommonModule() throw() ;
00128
00129
00146 OSDL_DLL friend CommonModule & getExistingCommonModule() throw() ;
00147
00148
00149
00150
00152 OSDL_DLL friend void stop() throw() ;
00153
00154
00155
00156 public:
00157
00158
00160 typedef Ceylan::Sint32 BackendReturnCode ;
00161
00162
00164 static const BackendReturnCode BackendSuccess ;
00165
00166
00174 static const BackendReturnCode BackendError ;
00175
00176
00178 virtual bool hasVideoModule() const throw() ;
00179
00180
00187 virtual Video::VideoModule & getVideoModule()
00188 const throw( OSDL::Exception ) ;
00189
00190
00191
00193 virtual bool hasEventsModule() const throw() ;
00194
00195
00202 virtual Events::EventsModule & getEventsModule()
00203 const throw( OSDL::Exception ) ;
00204
00205
00206
00208 virtual bool hasAudioModule() const throw() ;
00209
00210
00217 virtual Audio::AudioModule & getAudioModule()
00218 const throw( OSDL::Exception ) ;
00219
00220
00221
00223 virtual Ceylan::Flags getFlags() const throw() ;
00224
00225
00226
00227
00229 virtual bool hasCDROMDriveHandler() const throw() ;
00230
00231
00238 virtual CDROMDriveHandler & getCDROMDriveHandler()
00239 const throw( OSDL::Exception ) ;
00240
00241
00242
00253 virtual const std::string toString(
00254 Ceylan::VerbosityLevels level = Ceylan::high ) const throw() ;
00255
00256
00257
00258
00259
00260
00273 static std::string InterpretFlags( Ceylan::Flags flags ) throw() ;
00274
00275
00285 static std::string DescribeEnvironmentVariables() throw() ;
00286
00287
00288 static bool IsBackendInitialized() throw() ;
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00306 static const Ceylan::Flags UseTimer ;
00307
00309 static const Ceylan::Flags UseAudio ;
00310
00312 static const Ceylan::Flags UseVideo ;
00313
00315 static const Ceylan::Flags UseCDROM ;
00316
00317
00323 static const Ceylan::Flags UseJoystick ;
00324
00325
00331 static const Ceylan::Flags UseKeyboard ;
00332
00333
00339 static const Ceylan::Flags UseMouse ;
00340
00341
00343 static const Ceylan::Flags UseEverything ;
00344
00345
00366 static const Ceylan::Flags NoParachute ;
00367
00368
00370 static const Ceylan::Flags UseEventThread ;
00371
00372
00373
00374
00375 protected:
00376
00377
00390 static Ceylan::Flags AutoCorrectFlags( Ceylan::Flags inputFlags )
00391 throw() ;
00392
00393
00395 Video::VideoModule * _video ;
00396
00398 Events::EventsModule * _events ;
00399
00401 Audio::AudioModule * _audio ;
00402
00404 Ceylan::Flags _flags ;
00405
00407 CDROMDriveHandler * _cdromHandler ;
00408
00409
00410
00411
00412
00414 static bool _BackendInitialized ;
00415
00417 static CommonModule * _CurrentCommonModule ;
00418
00419
00425 static std::string _SDLEnvironmentVariables[] ;
00426
00427
00428
00429 private:
00430
00431
00440 explicit CommonModule( Ceylan::Flags flags )
00441 throw ( OSDL::Exception ) ;
00442
00443
00450 virtual ~CommonModule() throw() ;
00451
00452
00453
00454 } ;
00455
00456
00457
00463 OSDL_DLL CommonModule & getCommonModule( Ceylan::Flags flags ) throw() ;
00464
00465
00470 OSDL_DLL bool hasExistingCommonModule() throw() ;
00471
00472
00489 OSDL_DLL CommonModule & getExistingCommonModule() throw() ;
00490
00491
00492 }
00493
00494
00495
00496 #endif // OSDL_BASIC_H_
00497