00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_VIDEO_H_
00028 #define OSDL_VIDEO_H_
00029
00030
00031 #include "OSDLSurface.h"
00032 #include "OSDLPixel.h"
00033 #include "OSDLVideoTypes.h"
00034 #include "OSDLOpenGL.h"
00035
00036 #include "Ceylan.h"
00037
00038 #include <string>
00039 #include <list>
00040 #include <utility>
00041
00042
00043
00044
00045
00046 namespace OSDL
00047 {
00048
00049
00050
00051
00052 class CommonModule ;
00053
00054
00055
00056 namespace Rendering
00057 {
00058
00059
00060 class VideoRenderer ;
00061
00062 }
00063
00064
00065
00066 namespace Video
00067 {
00068
00069
00070
00071
00072 class Surface ;
00073
00074
00075 namespace OpenGL
00076 {
00077
00078
00079 class OpenGLContext ;
00080
00081 }
00082
00083
00084
00086 typedef Ceylan::Uint8 IconMask ;
00087
00088
00089
00091 typedef std::pair<Length, Length> Definition ;
00092
00093
00094
00096 enum StandardScreenSize
00097 {
00098
00099 Size_FullScreen = 0,
00100 Size_640x480 = 1,
00101 Size_800x600 = 2,
00102 Size_1024x780 = 3,
00103 Size_1280x1024 = 4,
00104 Size_1680x1050 = 5
00105
00106 } ;
00107
00108
00109
00123 class OSDL_DLL VideoModule : public Ceylan::Module
00124 {
00125
00126
00127
00128
00129 friend class OSDL::CommonModule ;
00130
00131
00132
00133 public:
00134
00135
00136
00141 bool hasScreenSurface() const ;
00142
00143
00144
00154 virtual Surface & getScreenSurface() const ;
00155
00156
00157
00171 virtual void setScreenSurface( Surface & newScreenSurface ) ;
00172
00173
00174
00179 virtual bool hasRenderer() const ;
00180
00181
00182
00191 virtual Rendering::VideoRenderer & getRenderer() const ;
00192
00193
00194
00207 virtual void setRenderer(
00208 Rendering::VideoRenderer & newRenderer ) ;
00209
00210
00211
00216 virtual bool hasOpenGLContext() const ;
00217
00218
00219
00230 virtual void setOpenGLContext(
00231 OpenGL::OpenGLContext & newOpenGLContext ) ;
00232
00233
00234
00243 virtual OpenGL::OpenGLContext & getOpenGLContext() const ;
00244
00245
00246
00261 virtual BitsPerPixel getBestColorDepthForMode(
00262 Length width, Length height,
00263 BitsPerPixel askedBpp, Ceylan::Flags flags ) ;
00264
00265
00266
00273 virtual bool isDisplayInitialized() const ;
00274
00275
00281 virtual bool isGUIEnabled() const ;
00282
00283
00284
00292 virtual void setGUIEnableStatus( bool newStatus ) ;
00293
00294
00295
00337 virtual Ceylan::Flags setMode( Length width, Length height,
00338 BitsPerPixel askedBpp, Ceylan::Flags flags,
00339 OpenGL::Flavour flavour = OpenGL::None ) ;
00340
00341
00342
00351 static const BitsPerPixel UseCurrentColorDepth ;
00352
00353
00354
00365 virtual void resize( Length newWidth, Length newHeight ) ;
00366
00367
00368
00377 virtual void redraw() ;
00378
00379
00380
00389 virtual void toggleFullscreen() ;
00390
00391
00392
00410 virtual void makeBMPScreenshot(
00411 const std::string & screenshotFilename ) ;
00412
00413
00414
00423 virtual bool getEndPointDrawState() const ;
00424
00425
00426
00436 virtual void setEndPointDrawState( bool newState ) ;
00437
00438
00439
00440
00449 virtual bool getAntiAliasingState() const ;
00450
00451
00452
00462 virtual void setAntiAliasingState( bool newState ) ;
00463
00464
00465
00466
00476 virtual std::string getDriverName() const ;
00477
00478
00479
00480
00489 virtual void setWindowCaption( const std::string & newTitle,
00490 const std::string & iconName ) ;
00491
00492
00493
00504 virtual void getWindowCaption( std::string & title,
00505 std::string & iconName ) ;
00506
00507
00508
00509
00527 virtual void setWindowIcon( const std::string & filename ) ;
00528
00529
00530
00543 virtual bool iconifyWindow() ;
00544
00545
00546
00555 virtual Ceylan::Float32 getAverageRefreshRate() ;
00556
00557
00558
00564 virtual bool isUsingOpenGL() const ;
00565
00566
00567
00579 virtual const std::string toString(
00580 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00581
00582
00583
00584
00585
00586
00587
00588
00589
00602 static bool IsDisplayInitialized() ;
00603
00604
00605
00618 static bool GetEndPointDrawState() ;
00619
00620
00621
00633 static bool GetAntiAliasingState() ;
00634
00635
00636
00646 static std::string GetDriverName() ;
00647
00648
00649
00662 static std::string InterpretFlags( Ceylan::Flags flags ) ;
00663
00664
00665
00673 static bool HardwareSurfacesCanBeCreated() ;
00674
00675
00676
00684 static bool WindowManagerAvailable() ;
00685
00686
00687
00688
00689
00690
00691
00692
00700 static bool HardwareToHardwareBlitsAccelerated() ;
00701
00702
00703
00712 static bool HardwareToHardwareColorkeyBlitsAccelerated() ;
00713
00714
00715
00724 static bool HardwareToHardwareAlphaBlitsAccelerated() ;
00725
00726
00727
00728
00729
00730
00731
00732
00740 static bool SoftwareToHardwareBlitsAccelerated() ;
00741
00742
00743
00752 static bool SoftwareToHardwareColorkeyBlitsAccelerated() ;
00753
00754
00755
00764 static bool SoftwareToHardwareAlphaBlitsAccelerated() ;
00765
00766
00767
00775 static bool ColorFillsAccelerated() ;
00776
00777
00778
00786 static Ceylan::Uint32 GetVideoMemorySize() ;
00787
00788
00789
00802 static Pixels::PixelFormat GetVideoDevicePixelFormat() ;
00803
00804
00805
00813 static std::string DescribeVideoCapabilities() ;
00814
00815
00816
00843 static bool AreDefinitionsRestricted(
00844 std::list<Definition> & definitions,
00845 Ceylan::Flags flags,
00846 Pixels::PixelFormat * pixelFormat = 0 ) ;
00847
00848
00849
00864 static std::string DescribeAvailableDefinitions(
00865 Ceylan::Flags flags,
00866 Pixels::PixelFormat * pixelFormat = 0 ) ;
00867
00868
00869
00870
00883 static StandardScreenSize ToStandardScreenSize(
00884 const std::string & standardScreenSizeInText ) ;
00885
00886
00906 static void ToScreenDimensions( StandardScreenSize screenSize,
00907 Length & screenWidth, Length & screenHeight ) ;
00908
00909
00910
00920 static std::string DescribeEnvironmentVariables() ;
00921
00922
00923
00932 static bool IsUsingOpenGL() ;
00933
00934
00946 static bool IsUsingDrawingPrimitives() ;
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00972 static const Ceylan::Flags SoftwareSurface ;
00973
00974
00975
00981 static const Ceylan::Flags HardwareSurface ;
00982
00983
00984
00990 static const Ceylan::Flags AsynchronousBlit ;
00991
00992
00993
00995 static const Ceylan::Flags AnyPixelFormat ;
00996
00997
00998
01000 static const Ceylan::Flags ExclusivePalette ;
01001
01002
01003
01013 static const Ceylan::Flags DoubleBuffered ;
01014
01015
01016
01022 static const Ceylan::Flags FullScreen ;
01023
01024
01025
01031 static const Ceylan::Flags OpenGL ;
01032
01033
01034
01039 static const Ceylan::Flags Resizable ;
01040
01041
01042
01049 static const Ceylan::Flags NoFrame ;
01050
01051
01052
01053
01054
01055 protected:
01056
01057
01058
01059
01060
01061
01062
01063
01065 Surface * _screen ;
01066
01067
01068
01073 bool _displayInitialized ;
01074
01075
01076
01081 bool _isGuiEnabled ;
01082
01083
01084
01086 Rendering::VideoRenderer * _renderer ;
01087
01088
01089
01099 static bool _IsUsingOpenGL ;
01100
01101
01102
01112 static bool _DrawEndPoint ;
01113
01114
01115
01124 static bool _AntiAliasing ;
01125
01126
01127
01129 static const Ceylan::Uint16 DriverNameMaximumLength ;
01130
01131
01132
01133 private:
01134
01135
01136
01143 OpenGL::OpenGLContext * _openGLcontext ;
01144
01145
01146
01156 bool _drawEndPoint ;
01157
01158
01159
01168 bool _antiAliasing ;
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01186 Ceylan::System::Second _screenStartingSecond ;
01187
01188
01195 Ceylan::System::Microsecond _screenStartingMicrosecond ;
01196
01197
01198
01199
01208 VideoModule() ;
01209
01210
01211
01213 virtual ~VideoModule() throw() ;
01214
01215
01216
01217
01226 explicit VideoModule( const VideoModule & source ) ;
01227
01228
01229
01238 VideoModule & operator = ( const VideoModule & source ) ;
01239
01240
01241
01247 static const std::string _SDLEnvironmentVariables[] ;
01248
01249
01250
01251 } ;
01252
01253
01254 }
01255
01256 }
01257
01258
01259
01260 #endif // OSDL_VIDEO_H_