LCOV - code coverage report
Current view: top level - usr/include/irrlicht - SIrrCreationParameters.h (source / functions) Hit Total Coverage
Test: report Lines: 3 3 100.0 %
Date: 2015-07-11 18:23:49 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright (C) 2002-2012 Nikolaus Gebhardt
       2             : // This file is part of the "Irrlicht Engine".
       3             : // For conditions of distribution and use, see copyright notice in irrlicht.h
       4             : 
       5             : #ifndef __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
       6             : #define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
       7             : 
       8             : #include "EDriverTypes.h"
       9             : #include "EDeviceTypes.h"
      10             : #include "dimension2d.h"
      11             : #include "ILogger.h"
      12             : 
      13             : namespace irr
      14             : {
      15             :         class IEventReceiver;
      16             : 
      17             :         //! Structure for holding Irrlicht Device creation parameters.
      18             :         /** This structure is used in the createDeviceEx() function. */
      19             :         struct SIrrlichtCreationParameters
      20             :         {
      21             :                 //! Constructs a SIrrlichtCreationParameters structure with default values.
      22           1 :                 SIrrlichtCreationParameters() :
      23             :                         DeviceType(EIDT_BEST),
      24             :                         DriverType(video::EDT_BURNINGSVIDEO),
      25             :                         WindowSize(core::dimension2d<u32>(800, 600)),
      26             :                         Bits(16),
      27             :                         ZBufferBits(16),
      28             :                         Fullscreen(false),
      29             :                         Stencilbuffer(false),
      30             :                         Vsync(false),
      31             :                         AntiAlias(0),
      32             :                         HandleSRGB(false),
      33             :                         WithAlphaChannel(false),
      34             :                         Doublebuffer(true),
      35             :                         IgnoreInput(false),
      36             :                         Stereobuffer(false),
      37             :                         HighPrecisionFPU(false),
      38             :                         EventReceiver(0),
      39             :                         WindowId(0),
      40             : #ifdef _DEBUG
      41             :                         LoggingLevel(ELL_DEBUG),
      42             : #else
      43             :                         LoggingLevel(ELL_INFORMATION),
      44             : #endif
      45             :                         DisplayAdapter(0),
      46             :                         DriverMultithreaded(false),
      47             :                         UsePerformanceTimer(true),
      48           1 :                         SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
      49             :                 {
      50           1 :                 }
      51             : 
      52             :                 SIrrlichtCreationParameters(const SIrrlichtCreationParameters& other) :
      53             :                         SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
      54             :                 {*this = other;}
      55             : 
      56             :                 SIrrlichtCreationParameters& operator=(const SIrrlichtCreationParameters& other)
      57             :                 {
      58             :                         DeviceType = other.DeviceType;
      59             :                         DriverType = other.DriverType;
      60             :                         WindowSize = other.WindowSize;
      61             :                         Bits = other.Bits;
      62             :                         ZBufferBits = other.ZBufferBits;
      63             :                         Fullscreen = other.Fullscreen;
      64             :                         Stencilbuffer = other.Stencilbuffer;
      65             :                         Vsync = other.Vsync;
      66             :                         AntiAlias = other.AntiAlias;
      67             :                         HandleSRGB = other.HandleSRGB;
      68             :                         WithAlphaChannel = other.WithAlphaChannel;
      69             :                         Doublebuffer = other.Doublebuffer;
      70             :                         IgnoreInput = other.IgnoreInput;
      71             :                         Stereobuffer = other.Stereobuffer;
      72             :                         HighPrecisionFPU = other.HighPrecisionFPU;
      73             :                         EventReceiver = other.EventReceiver;
      74             :                         WindowId = other.WindowId;
      75             :                         LoggingLevel = other.LoggingLevel;
      76             :                         DriverMultithreaded = other.DriverMultithreaded;
      77             :                         DisplayAdapter = other.DisplayAdapter;
      78             :                         UsePerformanceTimer = other.UsePerformanceTimer;
      79             :                         return *this;
      80             :                 }
      81             : 
      82             :                 //! Type of the device.
      83             :                 /** This setting decides the windowing system used by the device, most device types are native
      84             :                 to a specific operating system and so may not be available.
      85             :                 EIDT_WIN32 is only available on Windows desktops,
      86             :                 EIDT_WINCE is only available on Windows mobile devices,
      87             :                 EIDT_COCOA is only available on Mac OSX,
      88             :                 EIDT_X11 is available on Linux, Solaris, BSD and other operating systems which use X11,
      89             :                 EIDT_SDL is available on most systems if compiled in,
      90             :                 EIDT_CONSOLE is usually available but can only render to text,
      91             :                 EIDT_BEST will select the best available device for your operating system.
      92             :                 Default: EIDT_BEST. */
      93             :                 E_DEVICE_TYPE DeviceType;
      94             : 
      95             :                 //! Type of video driver used to render graphics.
      96             :                 /** This can currently be video::EDT_NULL, video::EDT_SOFTWARE,
      97             :                 video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8,
      98             :                 video::EDT_DIRECT3D9, and video::EDT_OPENGL.
      99             :                 Default: Software. */
     100             :                 video::E_DRIVER_TYPE DriverType;
     101             : 
     102             :                 //! Size of the window or the video mode in fullscreen mode. Default: 800x600
     103             :                 core::dimension2d<u32> WindowSize;
     104             : 
     105             :                 //! Minimum Bits per pixel of the color buffer in fullscreen mode. Ignored if windowed mode. Default: 16.
     106             :                 u8 Bits;
     107             : 
     108             :                 //! Minimum Bits per pixel of the depth buffer. Default: 16.
     109             :                 u8 ZBufferBits;
     110             : 
     111             :                 //! Should be set to true if the device should run in fullscreen.
     112             :                 /** Otherwise the device runs in windowed mode. Default: false. */
     113             :                 bool Fullscreen;
     114             : 
     115             :                 //! Specifies if the stencil buffer should be enabled.
     116             :                 /** Set this to true, if you want the engine be able to draw
     117             :                 stencil buffer shadows. Note that not all drivers are able to
     118             :                 use the stencil buffer, hence it can be ignored during device
     119             :                 creation. Without the stencil buffer no shadows will be drawn.
     120             :                 Default: false. */
     121             :                 bool Stencilbuffer;
     122             : 
     123             :                 //! Specifies vertical syncronisation.
     124             :                 /** If set to true, the driver will wait for the vertical
     125             :                 retrace period, otherwise not. May be silently ignored.
     126             :                 Default: false */
     127             :                 bool Vsync;
     128             : 
     129             :                 //! Specifies if the device should use fullscreen anti aliasing
     130             :                 /** Makes sharp/pixelated edges softer, but requires more
     131             :                 performance. Also, 2D elements might look blurred with this
     132             :                 switched on. The resulting rendering quality also depends on
     133             :                 the hardware and driver you are using, your program might look
     134             :                 different on different hardware with this. So if you are
     135             :                 writing a game/application with AntiAlias switched on, it would
     136             :                 be a good idea to make it possible to switch this option off
     137             :                 again by the user.
     138             :                 The value is the maximal antialiasing factor requested for
     139             :                 the device. The cretion method will automatically try smaller
     140             :                 values if no window can be created with the given value.
     141             :                 Value one is usually the same as 0 (disabled), but might be a
     142             :                 special value on some platforms. On D3D devices it maps to
     143             :                 NONMASKABLE.
     144             :                 Default value: 0 - disabled */
     145             :                 u8 AntiAlias;
     146             : 
     147             :                 //! Flag to enable proper sRGB and linear color handling
     148             :                 /** In most situations, it is desireable to have the color handling in
     149             :                 non-linear sRGB color space, and only do the intermediate color
     150             :                 calculations in linear RGB space. If this flag is enabled, the device and
     151             :                 driver try to assure that all color input and output are color corrected
     152             :                 and only the internal color representation is linear. This means, that
     153             :                 the color output is properly gamma-adjusted to provide the brighter
     154             :                 colors for monitor display. And that blending and lighting give a more
     155             :                 natural look, due to proper conversion from non-linear colors into linear
     156             :                 color space for blend operations. If this flag is enabled, all texture colors
     157             :                 (which are usually in sRGB space) are correctly displayed. However vertex colors
     158             :                 and other explicitly set values have to be manually encoded in linear color space.
     159             :                 Default value: false. */
     160             :                 bool HandleSRGB;
     161             : 
     162             :                 //! Whether the main framebuffer uses an alpha channel.
     163             :                 /** In some situations it might be desireable to get a color
     164             :                 buffer with an alpha channel, e.g. when rendering into a
     165             :                 transparent window or overlay. If this flag is set the device
     166             :                 tries to create a framebuffer with alpha channel.
     167             :                 If this flag is set, only color buffers with alpha channel
     168             :                 are considered. Otherwise, it depends on the actual hardware
     169             :                 if the colorbuffer has an alpha channel or not.
     170             :                 Default value: false */
     171             :                 bool WithAlphaChannel;
     172             : 
     173             :                 //! Whether the main framebuffer uses doublebuffering.
     174             :                 /** This should be usually enabled, in order to avoid render
     175             :                 artifacts on the visible framebuffer. However, it might be
     176             :                 useful to use only one buffer on very small devices. If no
     177             :                 doublebuffering is available, the drivers will fall back to
     178             :                 single buffers. Default value: true */
     179             :                 bool Doublebuffer;
     180             : 
     181             :                 //! Specifies if the device should ignore input events
     182             :                 /** This is only relevant when using external I/O handlers.
     183             :                 External windows need to take care of this themselves.
     184             :                 Currently only supported by X11.
     185             :                 Default value: false */
     186             :                 bool IgnoreInput;
     187             : 
     188             :                 //! Specifies if the device should use stereo buffers
     189             :                 /** Some high-end gfx cards support two framebuffers for direct
     190             :                 support of stereoscopic output devices. If this flag is set the
     191             :                 device tries to create a stereo context.
     192             :                 Currently only supported by OpenGL.
     193             :                 Default value: false */
     194             :                 bool Stereobuffer;
     195             : 
     196             :                 //! Specifies if the device should use high precision FPU setting
     197             :                 /** This is only relevant for DirectX Devices, which switch to
     198             :                 low FPU precision by default for performance reasons. However,
     199             :                 this may lead to problems with the other computations of the
     200             :                 application. In this case setting this flag to true should help
     201             :                 - on the expense of performance loss, though.
     202             :                 Default value: false */
     203             :                 bool HighPrecisionFPU;
     204             : 
     205             :                 //! A user created event receiver.
     206             :                 IEventReceiver* EventReceiver;
     207             : 
     208             :                 //! Window Id.
     209             :                 /** If this is set to a value other than 0, the Irrlicht Engine
     210             :                 will be created in an already existing window. For windows, set
     211             :                 this to the HWND of the window you want. The windowSize and
     212             :                 FullScreen options will be ignored when using the WindowId
     213             :                 parameter. Default this is set to 0.
     214             :                 To make Irrlicht run inside the custom window, you still will
     215             :                 have to draw Irrlicht on your own. You can use this loop, as
     216             :                 usual:
     217             :                 \code
     218             :                 while (device->run())
     219             :                 {
     220             :                         driver->beginScene(true, true, 0);
     221             :                         smgr->drawAll();
     222             :                         driver->endScene();
     223             :                 }
     224             :                 \endcode
     225             :                 Instead of this, you can also simply use your own message loop
     226             :                 using GetMessage, DispatchMessage and whatever. Calling
     227             :                 IrrlichtDevice::run() will cause Irrlicht to dispatch messages
     228             :                 internally too.  You need not call Device->run() if you want to
     229             :                 do your own message dispatching loop, but Irrlicht will not be
     230             :                 able to fetch user input then and you have to do it on your own
     231             :                 using the window messages, DirectInput, or whatever. Also,
     232             :                 you'll have to increment the Irrlicht timer.
     233             :                 An alternative, own message dispatching loop without
     234             :                 device->run() would look like this:
     235             :                 \code
     236             :                 MSG msg;
     237             :                 while (true)
     238             :                 {
     239             :                         if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
     240             :                         {
     241             :                                 TranslateMessage(&msg);
     242             :                                 DispatchMessage(&msg);
     243             : 
     244             :                                 if (msg.message == WM_QUIT)
     245             :                                         break;
     246             :                         }
     247             : 
     248             :                         // increase virtual timer time
     249             :                         device->getTimer()->tick();
     250             : 
     251             :                         // draw engine picture
     252             :                         driver->beginScene(true, true, 0);
     253             :                         smgr->drawAll();
     254             :                         driver->endScene();
     255             :                 }
     256             :                 \endcode
     257             :                 However, there is no need to draw the picture this often. Just
     258             :                 do it how you like. */
     259             :                 void* WindowId;
     260             : 
     261             :                 //! Specifies the logging level used in the logging interface.
     262             :                 /** The default value is ELL_INFORMATION. You can access the ILogger interface
     263             :                 later on from the IrrlichtDevice with getLogger() and set another level.
     264             :                 But if you need more or less logging information already from device creation,
     265             :                 then you have to change it here.
     266             :                 */
     267             :                 ELOG_LEVEL LoggingLevel;
     268             : 
     269             :                 //! Allows to select which graphic card is used for rendering when more than one card is in the system.
     270             :                 /** So far only supported on D3D */
     271             :                 u32 DisplayAdapter;
     272             : 
     273             :                 //! Create the driver multithreaded.
     274             :                 /** Default is false. Enabling this can slow down your application.
     275             :                         Note that this does _not_ make Irrlicht threadsafe, but only the underlying driver-API for the graphiccard.
     276             :                         So far only supported on D3D. */
     277             :                 bool DriverMultithreaded;
     278             : 
     279             :                 //! Enables use of high performance timers on Windows platform.
     280             :                 /** When performance timers are not used, standard GetTickCount()
     281             :                 is used instead which usually has worse resolution, but also less
     282             :                 problems with speed stepping and other techniques.
     283             :                 */
     284             :                 bool UsePerformanceTimer;
     285             : 
     286             :                 //! Don't use or change this parameter.
     287             :                 /** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
     288             :                 This is needed for sdk version checks. */
     289             :                 const c8* const SDK_version_do_not_use;
     290             :         };
     291             : 
     292             : 
     293             : } // end namespace irr
     294             : 
     295             : #endif
     296             : 

Generated by: LCOV version 1.11