Commit c0170c7c authored by bitplane's avatar bitplane

Allow multiple device types compiled in at the same time. Renamed...

Allow multiple device types compiled in at the same time. Renamed _IRR_USE_LINUX_DEVICE_ to _IRR_USE_X11_DEVICE_, added missing platform for Windows CE. Currently only tested in Linux (X11, SDL, console)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2513 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 4ee90d29
Changes in 1.6 (??.??.2009) Changes in 1.6 (??.??.2009)
- Irrlicht can now come with multiple device types compiled in, the device to use is selected by SIrrlichtCreationParameters.DeviceType. This defaults to EIDT_BEST which automatically select the best device available starting with native, then X11, SDL and finally the console.
- Added support for EXP2 fog distribution. This required a change in the setFog parameters where now an enum value instead of the bool linear is given. - Added support for EXP2 fog distribution. This required a change in the setFog parameters where now an enum value instead of the bool linear is given.
- IFileSystem changes: - IFileSystem changes:
......
#ifndef __E_DEVICE_TYPES_H_INCLUDED__
#define __E_DEVICE_TYPES_H_INCLUDED__
namespace irr
{
//! An enum for the different device types supported by the Irrlicht Engine.
enum E_DEVICE_TYPE
{
//! A device native to Microsoft Windows
/** This device uses the Win32 API and works in all versions of Windows. */
EIDT_WIN32,
//! A device native to Windows CE devices
/** This device works on Windows Mobile, Pocket PC and Microsoft SmartPhone devices */
EIDT_WINCE,
//! A device native to Unix style operating systems.
/** This device uses the X11 windowing system and works in Linux, Solaris, FreeBSD, OSX and
other operating systems which support X11. */
EIDT_X11,
//! A device native to Mac OSX
/** This device uses Apple's Cocoa API and works in Mac OSX 10.2 and above. */
EIDT_OSX,
//! A device which uses Simple DirectMedia Layer
/** The SDL device works under all platforms supported by SDL but first must be compiled
in by defining the IRR_USE_SDL_DEVICE macro in IrrCompileConfig.h */
EIDT_SDL,
//! A simple text only device supported by all platforms.
/** This device allows applications to run from the command line without opening a window.
It can render the output of the software drivers to the console as ASCII. It only supports
mouse and keyboard in Windows operating systems. */
EIDT_CONSOLE,
//! This selection allows Irrlicht to choose the best device from the ones available.
/** If this selection is chosen then Irrlicht will try to use the IrrlichtDevice native
to your operating system. If this is unavailable then the X11, SDL and then console device
will be tried. This ensures that Irrlicht will run even if your platform is unsupported,
although it may not be able to render anything. */
EIDT_BEST
};
} // end namespace irr
#endif // __E_DEVICE_TYPES_H_INCLUDED__
...@@ -19,36 +19,45 @@ ...@@ -19,36 +19,45 @@
//! The defines for different operating system are: //! The defines for different operating system are:
//! _IRR_XBOX_PLATFORM_ for XBox //! _IRR_XBOX_PLATFORM_ for XBox
//! _IRR_WINDOWS_ for all irrlicht supported Windows versions //! _IRR_WINDOWS_ for all irrlicht supported Windows versions
//! _IRR_WINDOWS_CE_PLATFORM_ for Windows CE
//! _IRR_WINDOWS_API_ for Windows or XBox //! _IRR_WINDOWS_API_ for Windows or XBox
//! _IRR_LINUX_PLATFORM_ for Linux (it is defined here if no other os is defined) //! _IRR_LINUX_PLATFORM_ for Linux (it is defined here if no other os is defined)
//! _IRR_SOLARIS_PLATFORM_ for Solaris //! _IRR_SOLARIS_PLATFORM_ for Solaris
//! _IRR_OSX_PLATFORM_ for Apple systems running OSX //! _IRR_OSX_PLATFORM_ for Apple systems running OSX
//! _IRR_POSIX_API_ for Posix compatible systems //! _IRR_POSIX_API_ for Posix compatible systems
//! _IRR_USE_SDL_DEVICE_ for platform independent SDL framework //! Note: PLATFORM defines the OS specific layer, API can group several platforms
//! _IRR_USE_CONSOLE_DEVICE_ for no windowing system, like for running as a service
//! _IRR_USE_WINDOWS_DEVICE_ for Windows API based device
//! _IRR_USE_WINDOWS_CE_DEVICE_ for Windows CE API based device
//! _IRR_USE_LINUX_DEVICE_ for X11 based device
//! _IRR_USE_OSX_DEVICE_ for Cocoa native windowing on OSX
//! Note: PLATFORM defines the OS specific layer, API can groups several platforms
//! DEVICE is the windowing system used, several PLATFORMs support more than one DEVICE //! DEVICE is the windowing system used, several PLATFORMs support more than one DEVICE
//! Moreover, the DEVICE defined here is not directly related to the Irrlicht devices created in the app (but may depend on each other). //! Irrlicht can be compiled with more than one device
//! _IRR_COMPILE_WITH_WINDOWS_DEVICE_ for Windows API based device
//! _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_ for Windows CE API based device
//! _IRR_COMPILE_WITH_OSX_DEVICE_ for Cocoa native windowing on OSX
//! _IRR_COMPILE_WITH_X11_DEVICE_ for Linux X11 based device
//! _IRR_COMPILE_WITH_SDL_DEVICE_ for platform independent SDL framework
//! _IRR_COMPILE_WITH_CONSOLE_DEVICE_ for no windowing system, used as a fallback
//! Uncomment this line to compile with the SDL device instead of platform specific devices //! Uncomment this line to compile with the SDL device
//#define _IRR_USE_SDL_DEVICE_ //#define _IRR_COMPILE_WITH_SDL_DEVICE_
//! Uncomment this line to compile as a console application with no windowing system. Hardware drivers will be disabled. //! Comment this line to compile without the fallback console device.
//#define _IRR_USE_CONSOLE_DEVICE_ #define _IRR_COMPILE_WITH_CONSOLE_DEVICE_
//! WIN32 for Windows32 //! WIN32 for Windows32
//! WIN64 for Windows64 //! WIN64 for Windows64
// The windows platform and API support SDL and WINDOW device // The windows platform and API support SDL and WINDOW device
#if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64) || defined(_WIN32_WCE) #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)
#define _IRR_WINDOWS_ #define _IRR_WINDOWS_
#define _IRR_WINDOWS_API_ #define _IRR_WINDOWS_API_
#if !defined(_IRR_USE_SDL_DEVICE_) && !defined(_IRR_USE_CONSOLE_DEVICE_) #define _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#define _IRR_USE_WINDOWS_DEVICE_
#endif #endif
//
#if defined(_WIN32_WCE)
#define _IRR_WINDOWS_
#define _IRR_WINDOWS_API_
#define _IRR_WINDOWS_CE_PLATFORM_
#define _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
#endif #endif
#if defined(_MSC_VER) && (_MSC_VER < 1300) #if defined(_MSC_VER) && (_MSC_VER < 1300)
...@@ -60,9 +69,9 @@ ...@@ -60,9 +69,9 @@
#undef _IRR_WINDOWS_ #undef _IRR_WINDOWS_
#define _IRR_XBOX_PLATFORM_ #define _IRR_XBOX_PLATFORM_
#define _IRR_WINDOWS_API_ #define _IRR_WINDOWS_API_
//#define _IRR_USE_WINDOWS_DEVICE_ //#define _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#undef _IRR_USE_WINDOWS_DEVICE_ #undef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
//#define _IRR_USE_SDL_DEVICE_ //#define _IRR_COMPILE_WITH_SDL_DEVICE_
#include <xtl.h> #include <xtl.h>
#endif #endif
...@@ -72,9 +81,7 @@ ...@@ -72,9 +81,7 @@
#define MACOSX // legacy support #define MACOSX // legacy support
#endif #endif
#define _IRR_OSX_PLATFORM_ #define _IRR_OSX_PLATFORM_
#if !defined(_IRR_USE_LINUX_DEVICE_) && !defined(_IRR_USE_CONSOLE_DEVICE_) && !defined(_IRR_USE_SDL_DEVICE_) #define _IRR_COMPILE_WITH_OSX_DEVICE_
#define _IRR_USE_OSX_DEVICE_
#endif
#endif #endif
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_) #if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
...@@ -85,10 +92,7 @@ ...@@ -85,10 +92,7 @@
#define _IRR_LINUX_PLATFORM_ #define _IRR_LINUX_PLATFORM_
#endif #endif
#define _IRR_POSIX_API_ #define _IRR_POSIX_API_
#define _IRR_COMPILE_WITH_X11_DEVICE_
#if !defined(_IRR_USE_SDL_DEVICE_) && !defined(_IRR_USE_CONSOLE_DEVICE_)
#define _IRR_USE_LINUX_DEVICE_
#endif
#endif #endif
//! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events. //! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events.
...@@ -409,8 +413,8 @@ precision will be lower but speed higher. currently X86 only ...@@ -409,8 +413,8 @@ precision will be lower but speed higher. currently X86 only
#undef BURNINGVIDEO_RENDERER_ULTRA_FAST #undef BURNINGVIDEO_RENDERER_ULTRA_FAST
#define BURNINGVIDEO_RENDERER_CE #define BURNINGVIDEO_RENDERER_CE
#undef _IRR_USE_WINDOWS_DEVICE_ #undef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#define _IRR_USE_WINDOWS_CE_DEVICE_ #define _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
//#define _IRR_WCHAR_FILESYSTEM //#define _IRR_WCHAR_FILESYSTEM
#undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_ #undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
...@@ -454,13 +458,5 @@ precision will be lower but speed higher. currently X86 only ...@@ -454,13 +458,5 @@ precision will be lower but speed higher. currently X86 only
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
#endif #endif
//! Remove joystick support and hardware drivers when compiling as a service
#if defined(_IRR_USE_CONSOLE_DEVICE_)
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
#undef _IRR_COMPILE_WITH_OPENGL_
#undef _IRR_COMPILE_WITH_DIRECT3D_8_
#undef _IRR_COMPILE_WITH_DIRECT3D_9_
#endif
#endif // __IRR_COMPILE_CONFIG_H_INCLUDED__ #endif // __IRR_COMPILE_CONFIG_H_INCLUDED__
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "dimension2d.h" #include "dimension2d.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "EDriverTypes.h" #include "EDriverTypes.h"
#include "EDeviceTypes.h"
#include "IEventReceiver.h" #include "IEventReceiver.h"
#include "ICursorControl.h" #include "ICursorControl.h"
#include "IVideoModeList.h" #include "IVideoModeList.h"
...@@ -230,10 +231,14 @@ namespace irr ...@@ -230,10 +231,14 @@ namespace irr
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue, virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
f32 &brightness, f32 &contrast) =0; f32 &brightness, f32 &contrast) =0;
//! Get the type of the device.
/** This allows the user to check which windowing system is currently being
used. */
virtual E_DEVICE_TYPE getType() const = 0;
//! Allows to check which drivers are supported by the engine. //! Check if a driver type is supported by the engine.
/** Even if true is returned the driver needs not be available /** Even if true is returned the driver may not be available
for an actual configuration requested upon device creation. */ for a configuration requested when creating the device. */
static bool isDriverSupported(video::E_DRIVER_TYPE driver) static bool isDriverSupported(video::E_DRIVER_TYPE driver)
{ {
switch (driver) switch (driver)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__ #define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
#include "EDriverTypes.h" #include "EDriverTypes.h"
#include "EDeviceTypes.h"
#include "dimension2d.h" #include "dimension2d.h"
namespace irr namespace irr
...@@ -18,6 +19,7 @@ namespace irr ...@@ -18,6 +19,7 @@ namespace irr
{ {
//! Constructs a SIrrlichtCreationParameters structure with default values. //! Constructs a SIrrlichtCreationParameters structure with default values.
SIrrlichtCreationParameters() : SIrrlichtCreationParameters() :
DeviceType(EIDT_BEST),
DriverType(video::EDT_BURNINGSVIDEO), DriverType(video::EDT_BURNINGSVIDEO),
WindowSize(core::dimension2d<u32>(800, 600)), WindowSize(core::dimension2d<u32>(800, 600)),
Bits(16), Bits(16),
...@@ -43,6 +45,7 @@ namespace irr ...@@ -43,6 +45,7 @@ namespace irr
SIrrlichtCreationParameters& operator=(const SIrrlichtCreationParameters& other) SIrrlichtCreationParameters& operator=(const SIrrlichtCreationParameters& other)
{ {
DeviceType = other.DeviceType;
DriverType = other.DriverType; DriverType = other.DriverType;
WindowSize = other.WindowSize; WindowSize = other.WindowSize;
Bits = other.Bits; Bits = other.Bits;
...@@ -62,6 +65,19 @@ namespace irr ...@@ -62,6 +65,19 @@ namespace irr
} }
//! Type of the device. //! Type of the device.
/** This setting decides the windowing system used by the device, most device types are native
to a specific operating system and so may not be available.
EIDT_WIN32 is only available on Windows desktops,
EIDT_WINCE is only available on Windows mobile devices,
EIDT_COCOA is only available on Mac OSX,
EIDT_X11 is available on Linux, Solaris, BSD and other operating systems which use X11,
EIDT_SDL is available on most systems if compiled in,
EIDT_CONSOLE is usually available but can only render to text,
EIDT_BEST will select the best available device for your operating system.
Default: EIDT_BEST. */
E_DEVICE_TYPE DeviceType;
//! Type of video driver used to render graphics.
/** This can currently be video::EDT_NULL, video::EDT_SOFTWARE, /** This can currently be video::EDT_NULL, video::EDT_SOFTWARE,
video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8, video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8,
video::EDT_DIRECT3D9, and video::EDT_OPENGL. video::EDT_DIRECT3D9, and video::EDT_OPENGL.
...@@ -83,7 +99,7 @@ namespace irr ...@@ -83,7 +99,7 @@ namespace irr
//! Specifies if the stencil buffer should be enabled. //! Specifies if the stencil buffer should be enabled.
/** Set this to true, if you want the engine be able to draw /** Set this to true, if you want the engine be able to draw
stencil buffer shadows. Note that not all devices are able to stencil buffer shadows. Note that not all drivers are able to
use the stencil buffer, hence it can be ignored during device use the stencil buffer, hence it can be ignored during device
creation. Without the stencil buffer no shadows will be drawn. creation. Without the stencil buffer no shadows will be drawn.
Default: false. */ Default: false. */
......
...@@ -321,7 +321,7 @@ const core::string<c16>& CFileSystem::getWorkingDirectory() ...@@ -321,7 +321,7 @@ const core::string<c16>& CFileSystem::getWorkingDirectory()
WorkingDirectory[type].reserve(FILE_SYSTEM_MAX_PATH); WorkingDirectory[type].reserve(FILE_SYSTEM_MAX_PATH);
c16* r = (c16*) WorkingDirectory[type].c_str(); c16* r = (c16*) WorkingDirectory[type].c_str();
#if defined(_IRR_USE_WINDOWS_CE_DEVICE_) #if defined(_IRR_WINDOWS_CE_PLATFORM_)
#elif defined(_IRR_WINDOWS_API_) #elif defined(_IRR_WINDOWS_API_)
#if defined(_IRR_WCHAR_FILESYSTEM ) #if defined(_IRR_WCHAR_FILESYSTEM )
_wgetcwd(r, FILE_SYSTEM_MAX_PATH); _wgetcwd(r, FILE_SYSTEM_MAX_PATH);
...@@ -361,7 +361,7 @@ bool CFileSystem::changeWorkingDirectoryTo(const core::string<c16>& newDirectory ...@@ -361,7 +361,7 @@ bool CFileSystem::changeWorkingDirectoryTo(const core::string<c16>& newDirectory
{ {
WorkingDirectory[FILESYSTEM_NATIVE] = newDirectory; WorkingDirectory[FILESYSTEM_NATIVE] = newDirectory;
#if defined(_IRR_USE_WINDOWS_CE_DEVICE_) #if defined(_IRR_WINDOWS_CE_PLATFORM_)
success = true; success = true;
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#if defined(_IRR_WCHAR_FILESYSTEM) #if defined(_IRR_WCHAR_FILESYSTEM)
...@@ -382,7 +382,7 @@ core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename ...@@ -382,7 +382,7 @@ core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename
{ {
c16 *p=0; c16 *p=0;
#if defined(_IRR_USE_WINDOWS_CE_DEVICE_) #if defined(_IRR_WINDOWS_CE_PLATFORM_)
return filename; return filename;
#elif defined(_IRR_WINDOWS_API_) #elif defined(_IRR_WINDOWS_API_)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "CIrrDeviceConsole.h" #include "CIrrDeviceConsole.h"
#ifdef _IRR_USE_CONSOLE_DEVICE_ #ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
#include "os.h" #include "os.h"
#include "IGUISkin.h" #include "IGUISkin.h"
...@@ -129,7 +129,7 @@ CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params) ...@@ -129,7 +129,7 @@ CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D8:
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
case video::EDT_OPENGL: case video::EDT_OPENGL:
os::Printer::log("The console device cannot use hardware drivers", ELL_ERROR); os::Printer::log("The console device cannot use hardware drivers yet.", ELL_ERROR);
break; break;
case video::EDT_NULL: case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize); VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
...@@ -449,23 +449,6 @@ void CIrrDeviceConsole::addPostPresentText(s16 X, s16 Y, const wchar_t *text) ...@@ -449,23 +449,6 @@ void CIrrDeviceConsole::addPostPresentText(s16 X, s16 Y, const wchar_t *text)
Text.push_back(p); Text.push_back(p);
} }
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters)
{
CIrrDeviceConsole* dev = new CIrrDeviceConsole(parameters);
if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL)
{
dev->closeDevice(); // close device
dev->run(); // consume quit message
dev->drop();
dev = 0;
}
return dev;
}
} // end namespace irr } // end namespace irr
#endif // _IRR_USE_CONSOLE_DEVICE_ #endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#define __C_IRR_DEVICE_CONSOLE_H_INCLUDED__ #define __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_CONSOLE_DEVICE_ #ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
#define _IRR_USE_CONSOLE_FONT_ //#define _IRR_USE_CONSOLE_FONT_
#include "SIrrCreationParameters.h" #include "SIrrCreationParameters.h"
#include "CIrrDeviceStub.h" #include "CIrrDeviceStub.h"
...@@ -81,6 +81,12 @@ namespace irr ...@@ -81,6 +81,12 @@ namespace irr
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
//! Get the device type
virtual E_DEVICE_TYPE getType() const
{
return EIDT_CONSOLE;
}
void addPostPresentText(s16 X, s16 Y, const wchar_t *text); void addPostPresentText(s16 X, s16 Y, const wchar_t *text);
//! Implementation of the win32 console mouse cursor //! Implementation of the win32 console mouse cursor
...@@ -313,7 +319,5 @@ namespace gui ...@@ -313,7 +319,5 @@ namespace gui
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
#endif // _IRR_USE_CONSOLE_DEVICE_
#endif // __C_IRR_DEVICE_CONSOLE_H_INCLUDED__ #endif // __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "CIrrDeviceLinux.h" #include "CIrrDeviceLinux.h"
#ifdef _IRR_USE_LINUX_DEVICE_ #ifdef _IRR_COMPILE_WITH_X11_DEVICE_
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -41,7 +41,7 @@ namespace irr ...@@ -41,7 +41,7 @@ namespace irr
namespace video namespace video
{ {
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io); io::IFileSystem* io, CIrrDeviceLinux* device);
} }
} // end namespace irr } // end namespace irr
...@@ -721,7 +721,7 @@ void CIrrDeviceLinux::createDriver() ...@@ -721,7 +721,7 @@ void CIrrDeviceLinux::createDriver()
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
if (Context) if (Context)
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem); VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
#else #else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif #endif
...@@ -1662,22 +1662,7 @@ void CIrrDeviceLinux::initXAtoms() ...@@ -1662,22 +1662,7 @@ void CIrrDeviceLinux::initXAtoms()
#endif #endif
} }
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
{
CIrrDeviceLinux* dev = new CIrrDeviceLinux(param);
if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL)
{
dev->drop();
dev = 0;
}
return dev;
}
} // end namespace } // end namespace
#endif // _IRR_USE_LINUX_DEVICE_ #endif // _IRR_COMPILE_WITH_X11_DEVICE_
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_LINUX_DEVICE_ #ifdef _IRR_COMPILE_WITH_X11_DEVICE_
#include "CIrrDeviceStub.h" #include "CIrrDeviceStub.h"
#include "IrrlichtDevice.h" #include "IrrlichtDevice.h"
...@@ -104,6 +104,12 @@ namespace irr ...@@ -104,6 +104,12 @@ namespace irr
//! This sets the clipboard selection and _not_ the primary selection which you have on X on the middle mouse button. //! This sets the clipboard selection and _not_ the primary selection which you have on X on the middle mouse button.
virtual void copyToClipboard(const c8* text) const; virtual void copyToClipboard(const c8* text) const;
//! Get the device type
virtual E_DEVICE_TYPE getType() const
{
return EIDT_X11;
}
private: private:
//! create the driver //! create the driver
...@@ -380,6 +386,6 @@ namespace irr ...@@ -380,6 +386,6 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_USE_LINUX_DEVICE_ #endif // _IRR_COMPILE_WITH_X11_DEVICE_
#endif // __C_IRR_DEVICE_LINUX_H_INCLUDED__ #endif // __C_IRR_DEVICE_LINUX_H_INCLUDED__
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_SDL_DEVICE_ #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
#include "CIrrDeviceSDL.h" #include "CIrrDeviceSDL.h"
#include "IEventReceiver.h" #include "IEventReceiver.h"
...@@ -42,7 +42,7 @@ namespace irr ...@@ -42,7 +42,7 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io); io::IFileSystem* io, CIrrDeviceSDL* device);
#endif #endif
} // end namespace video } // end namespace video
...@@ -52,8 +52,6 @@ namespace irr ...@@ -52,8 +52,6 @@ namespace irr
namespace irr namespace irr
{ {
const char* wmDeleteWindow = "WM_DELETE_WINDOW";
//! constructor //! constructor
CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param), : CIrrDeviceStub(param),
...@@ -276,7 +274,7 @@ void CIrrDeviceSDL::createDriver() ...@@ -276,7 +274,7 @@ void CIrrDeviceSDL::createDriver()
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem); VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
#else #else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif #endif
...@@ -456,8 +454,8 @@ bool CIrrDeviceSDL::run() ...@@ -456,8 +454,8 @@ bool CIrrDeviceSDL::run()
case SDL_USEREVENT: case SDL_USEREVENT:
irrevent.EventType = irr::EET_USER_EVENT; irrevent.EventType = irr::EET_USER_EVENT;
irrevent.UserEvent.UserData1 = reinterpret_cast<s32>(SDL_event.user.data1); irrevent.UserEvent.UserData1 = *(reinterpret_cast<s32*>(&SDL_event.user.data1));
irrevent.UserEvent.UserData2 = reinterpret_cast<s32>(SDL_event.user.data2); irrevent.UserEvent.UserData2 = *(reinterpret_cast<s32*>(&SDL_event.user.data2));
postEventFromUser(irrevent); postEventFromUser(irrevent);
break; break;
...@@ -946,21 +944,7 @@ void CIrrDeviceSDL::createKeyMap() ...@@ -946,21 +944,7 @@ void CIrrDeviceSDL::createKeyMap()
KeyMap.sort(); KeyMap.sort();
} }
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
{
CIrrDeviceSDL* dev = new CIrrDeviceSDL(param);
if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL)
{
dev->drop();
dev = 0;
}
return dev;
}
} // end namespace irr } // end namespace irr
#endif // _IRR_USE_SDL_DEVICE_ #endif // _IRR_COMPILE_WITH_SDL_DEVICE_
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_SDL_DEVICE_ #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
#include "IrrlichtDevice.h" #include "IrrlichtDevice.h"
#include "CIrrDeviceStub.h" #include "CIrrDeviceStub.h"
...@@ -74,6 +74,12 @@ namespace irr ...@@ -74,6 +74,12 @@ namespace irr
//! Activate any joysticks, and generate events for them. //! Activate any joysticks, and generate events for them.
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo); virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
//! Get the device type
virtual E_DEVICE_TYPE getType() const
{
return EIDT_CONSOLE;
}
//! Implementation of the linux cursor control //! Implementation of the linux cursor control
class CCursorControl : public gui::ICursorControl class CCursorControl : public gui::ICursorControl
{ {
...@@ -213,6 +219,6 @@ namespace irr ...@@ -213,6 +219,6 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_USE_SDL_DEVICE_ #endif // _IRR_COMPILE_WITH_SDL_DEVICE_
#endif // __C_IRR_DEVICE_SDL_H_INCLUDED__ #endif // __C_IRR_DEVICE_SDL_H_INCLUDED__
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#include "CIrrDeviceWin32.h" #include "CIrrDeviceWin32.h"
#include "IEventReceiver.h" #include "IEventReceiver.h"
...@@ -34,7 +34,7 @@ namespace irr ...@@ -34,7 +34,7 @@ namespace irr
#endif #endif
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io); IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io, this);
#endif #endif
} }
} // end namespace irr } // end namespace irr
...@@ -1123,24 +1123,7 @@ bool CIrrDeviceWin32::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright ...@@ -1123,24 +1123,7 @@ bool CIrrDeviceWin32::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
} }
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters)
{
CIrrDeviceWin32* dev = new CIrrDeviceWin32(parameters);
if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL)
{
dev->closeDevice(); // destroy window
dev->run(); // consume quit message
dev->drop();
dev = 0;
}
return dev;
}
} // end namespace } // end namespace
#endif // _IRR_USE_WINDOWS_DEVICE_ #endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define __C_IRR_DEVICE_WIN32_H_INCLUDED__ #define __C_IRR_DEVICE_WIN32_H_INCLUDED__
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#include "CIrrDeviceStub.h" #include "CIrrDeviceStub.h"
#include "IrrlichtDevice.h" #include "IrrlichtDevice.h"
...@@ -81,6 +81,12 @@ namespace irr ...@@ -81,6 +81,12 @@ namespace irr
//! Get the current Gamma Value for the Display //! Get the current Gamma Value for the Display
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ); virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast );
//! Get the device type
virtual E_DEVICE_TYPE getType() const
{
return EIDT_WIN32;
}
//! Compares to the last call of this function to return double and triple clicks. //! Compares to the last call of this function to return double and triple clicks.
//! \return Returns only 1,2 or 3. A 4th click will start with 1 again. //! \return Returns only 1,2 or 3. A 4th click will start with 1 again.
virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY) virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY)
...@@ -311,6 +317,6 @@ namespace irr ...@@ -311,6 +317,6 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_USE_WINDOWS_DEVICE_ #endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#endif // __C_IRR_DEVICE_WIN32_H_INCLUDED__ #endif // __C_IRR_DEVICE_WIN32_H_INCLUDED__
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_WINDOWS_CE_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
#include "CIrrDeviceWinCE.h" #include "CIrrDeviceWinCE.h"
#include "IEventReceiver.h" #include "IEventReceiver.h"
...@@ -40,7 +40,7 @@ namespace irr ...@@ -40,7 +40,7 @@ namespace irr
#endif #endif
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io); IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io, this);
#endif #endif
} }
} // end namespace irr } // end namespace irr
...@@ -783,25 +783,7 @@ void CIrrDeviceWinCE::minimizeWindow() ...@@ -783,25 +783,7 @@ void CIrrDeviceWinCE::minimizeWindow()
{ {
} }
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters)
{
CIrrDeviceWinCE* dev = new CIrrDeviceWinCE(parameters);
if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL)
{
dev->closeDevice(); // destroy window
dev->run(); // consume quit message
dev->drop();
dev = 0;
}
return dev;
}
} // end namespace } // end namespace
#endif // _IRR_USE_WINDOWS_CE_DEVICE_ #endif // _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define __C_IRR_DEVICE_WINCE_H_INCLUDED__ #define __C_IRR_DEVICE_WINCE_H_INCLUDED__
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_USE_WINDOWS_CE_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
#include "CIrrDeviceStub.h" #include "CIrrDeviceStub.h"
#include "IrrlichtDevice.h" #include "IrrlichtDevice.h"
...@@ -72,6 +72,12 @@ namespace irr ...@@ -72,6 +72,12 @@ namespace irr
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
//! Get the device type
virtual E_DEVICE_TYPE getType() const
{
return EIDT_WINCE;
}
//! Implementation of the win32 cursor control //! Implementation of the win32 cursor control
class CCursorControl : public gui::ICursorControl class CCursorControl : public gui::ICursorControl
{ {
...@@ -259,6 +265,5 @@ namespace irr ...@@ -259,6 +265,5 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif #endif // _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
#endif #endif // __C_IRR_DEVICE_WINCE_H_INCLUDED__
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#else #else
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifdef _IRR_USE_OSX_DEVICE_ #ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
#include "MacOSX/OSXClipboard.h" #include "MacOSX/OSXClipboard.h"
#endif #endif
#ifdef _IRR_OSX_PLATFORM_ #ifdef _IRR_OSX_PLATFORM_
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
#endif #endif
#endif #endif
#if defined(_IRR_USE_LINUX_DEVICE_) #if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#include "CIrrDeviceLinux.h" #include "CIrrDeviceLinux.h"
#endif #endif
namespace irr namespace irr
{ {
#if defined(_IRR_USE_LINUX_DEVICE_) #if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
// constructor linux // constructor linux
COSOperator::COSOperator(const c8* osversion, CIrrDeviceLinux* device) COSOperator::COSOperator(const c8* osversion, CIrrDeviceLinux* device)
: IrrDeviceLinux(device) : IrrDeviceLinux(device)
...@@ -79,11 +79,11 @@ void COSOperator::copyToClipboard(const c8* text) const ...@@ -79,11 +79,11 @@ void COSOperator::copyToClipboard(const c8* text) const
CloseClipboard(); CloseClipboard();
// MacOSX version // MacOSX version
#elif defined(_IRR_USE_OSX_DEVICE_) #elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
OSXCopyToClipboard(text); OSXCopyToClipboard(text);
#elif defined(_IRR_USE_LINUX_DEVICE_) #elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
if ( IrrDeviceLinux ) if ( IrrDeviceLinux )
IrrDeviceLinux->copyToClipboard(text); IrrDeviceLinux->copyToClipboard(text);
#else #else
...@@ -110,10 +110,10 @@ const c8* COSOperator::getTextFromClipboard() const ...@@ -110,10 +110,10 @@ const c8* COSOperator::getTextFromClipboard() const
CloseClipboard(); CloseClipboard();
return buffer; return buffer;
#elif defined(_IRR_USE_OSX_DEVICE_) #elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
return (OSXCopyFromClipboard()); return (OSXCopyFromClipboard());
#elif defined(_IRR_USE_LINUX_DEVICE_) #elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
if ( IrrDeviceLinux ) if ( IrrDeviceLinux )
return IrrDeviceLinux->getTextFromClipboard(); return IrrDeviceLinux->getTextFromClipboard();
return 0; return 0;
......
...@@ -20,7 +20,7 @@ class COSOperator : public IOSOperator ...@@ -20,7 +20,7 @@ class COSOperator : public IOSOperator
public: public:
// constructor // constructor
#if defined(_IRR_USE_LINUX_DEVICE_) #if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
COSOperator(const c8* osversion, CIrrDeviceLinux* device); COSOperator(const c8* osversion, CIrrDeviceLinux* device);
#endif #endif
COSOperator(const c8* osversion); COSOperator(const c8* osversion);
...@@ -50,7 +50,7 @@ private: ...@@ -50,7 +50,7 @@ private:
core::stringw OperatingSystem; core::stringw OperatingSystem;
#if defined(_IRR_USE_LINUX_DEVICE_) #if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
CIrrDeviceLinux * IrrDeviceLinux; CIrrDeviceLinux * IrrDeviceLinux;
#endif #endif
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "CImage.h" #include "CImage.h"
#include "os.h" #include "os.h"
#ifdef _IRR_USE_SDL_DEVICE_ #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
#include <SDL/SDL.h> #include <SDL/SDL.h>
#endif #endif
...@@ -29,17 +29,17 @@ namespace video ...@@ -29,17 +29,17 @@ namespace video
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// WINDOWS CONSTRUCTOR // WINDOWS CONSTRUCTOR
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
//! Windows constructor and init code //! Windows constructor and init code
COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params, COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params,
io::IFileSystem* io) io::IFileSystem* io, CIrrDeviceWin32* device)
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), : CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true), CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
AntiAlias(params.AntiAlias), RenderTargetTexture(0), AntiAlias(params.AntiAlias), RenderTargetTexture(0),
CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
CurrentTarget(ERT_FRAME_BUFFER), CurrentTarget(ERT_FRAME_BUFFER),
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer), Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer),
HDc(0), Window(static_cast<HWND>(params.WindowId)), HRc(0) HDc(0), Window(static_cast<HWND>(params.WindowId)), HRc(0), DeviceType(EIDT_WIN32)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLDriver"); setDebugName("COpenGLDriver");
...@@ -354,12 +354,12 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) ...@@ -354,12 +354,12 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params)
return true; return true;
} }
#endif //IRR_USE_WINDOWS_DEVICE_ #endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// MacOSX CONSTRUCTOR // MacOSX CONSTRUCTOR
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#ifdef _IRR_USE_OSX_DEVICE_ #ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
//! Windows constructor and init code //! Windows constructor and init code
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceMacOSX *device) io::IFileSystem* io, CIrrDeviceMacOSX *device)
...@@ -369,7 +369,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -369,7 +369,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
CurrentTarget(ERT_FRAME_BUFFER), CurrentTarget(ERT_FRAME_BUFFER),
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer), Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer),
_device(device) _device(device), DeviceType(EIDT_OSX)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLDriver"); setDebugName("COpenGLDriver");
...@@ -382,16 +382,16 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -382,16 +382,16 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// LINUX CONSTRUCTOR // LINUX CONSTRUCTOR
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#ifdef _IRR_USE_LINUX_DEVICE_ #ifdef _IRR_COMPILE_WITH_X11_DEVICE_
//! Linux constructor and init code //! Linux constructor and init code
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io) io::IFileSystem* io, CIrrDeviceLinux* device)
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), : CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(params.AntiAlias), Transformation3DChanged(true), AntiAlias(params.AntiAlias),
RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8), RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
CurrentTarget(ERT_FRAME_BUFFER), CurrentTarget(ERT_FRAME_BUFFER),
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer) Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer), DeviceType(EIDT_X11)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLDriver"); setDebugName("COpenGLDriver");
...@@ -415,22 +415,22 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -415,22 +415,22 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
#endif #endif
} }
#endif // _IRR_USE_LINUX_DEVICE_ #endif // _IRR_COMPILE_WITH_X11_DEVICE_
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// SDL CONSTRUCTOR // SDL CONSTRUCTOR
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
#ifdef _IRR_USE_SDL_DEVICE_ #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
//! SDL constructor and init code //! SDL constructor and init code
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io) io::IFileSystem* io, CIrrDeviceSDL* device)
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), : CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(params.AntiAlias), Transformation3DChanged(true), AntiAlias(params.AntiAlias),
RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8), RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
CurrentTarget(ERT_FRAME_BUFFER), CurrentTarget(ERT_FRAME_BUFFER),
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer) Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer), DeviceType(EIDT_SDL)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLDriver"); setDebugName("COpenGLDriver");
...@@ -439,7 +439,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -439,7 +439,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
genericDriverInit(params.WindowSize, params.Stencilbuffer); genericDriverInit(params.WindowSize, params.Stencilbuffer);
} }
#endif // _IRR_USE_SDL_DEVICE_ #endif // _IRR_COMPILE_WITH_SDL_DEVICE_
//! destructor //! destructor
...@@ -454,7 +454,10 @@ COpenGLDriver::~COpenGLDriver() ...@@ -454,7 +454,10 @@ COpenGLDriver::~COpenGLDriver()
deleteAllTextures(); deleteAllTextures();
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
if (DeviceType == EIDT_WIN32)
{
if (HRc) if (HRc)
{ {
if (!wglMakeCurrent(0, 0)) if (!wglMakeCurrent(0, 0))
...@@ -466,6 +469,7 @@ COpenGLDriver::~COpenGLDriver() ...@@ -466,6 +469,7 @@ COpenGLDriver::~COpenGLDriver()
if (HDc) if (HDc)
ReleaseDC(Window, HDc); ReleaseDC(Window, HDc);
}
#endif #endif
} }
...@@ -621,20 +625,38 @@ bool COpenGLDriver::endScene() ...@@ -621,20 +625,38 @@ bool COpenGLDriver::endScene()
glFlush(); glFlush();
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
if (DeviceType == EIDT_WIN32)
return SwapBuffers(HDc) == TRUE; return SwapBuffers(HDc) == TRUE;
#elif defined(_IRR_USE_LINUX_DEVICE_) #endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
if (DeviceType == EIDT_X11)
{
glXSwapBuffers((Display*)ExposedData.OpenGLLinux.X11Display, Drawable); glXSwapBuffers((Display*)ExposedData.OpenGLLinux.X11Display, Drawable);
return true; return true;
#elif defined(_IRR_USE_OSX_DEVICE_) }
#endif
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
if (DeviceType == EIDT_OSX)
{
_device->flush(); _device->flush();
return true; return true;
#elif defined(_IRR_USE_SDL_DEVICE_) }
#endif
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
if (DeviceType == EIDT_SDL)
{
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
return true; return true;
#else }
return false;
#endif #endif
// todo: console device present
return false;
} }
...@@ -671,10 +693,13 @@ bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color, ...@@ -671,10 +693,13 @@ bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
{ {
CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect); CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect);
#if defined(_IRR_USE_SDL_DEVICE_) #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
if (DeviceType == EIDT_SDL)
{
// todo: SDL sets glFrontFace(GL_CCW) after driver creation, // todo: SDL sets glFrontFace(GL_CCW) after driver creation,
// it would be better if this was fixed elsewhere. // it would be better if this was fixed elsewhere.
glFrontFace(GL_CW); glFrontFace(GL_CW);
}
#endif #endif
clearBuffers(backBuffer, zBuffer, false, color); clearBuffers(backBuffer, zBuffer, false, color);
...@@ -3272,12 +3297,12 @@ namespace video ...@@ -3272,12 +3297,12 @@ namespace video
// ----------------------------------- // -----------------------------------
// WINDOWS VERSION // WINDOWS VERSION
// ----------------------------------- // -----------------------------------
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io) io::IFileSystem* io, CIrrDeviceWin32* device)
{ {
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
COpenGLDriver* ogl = new COpenGLDriver(params, io); COpenGLDriver* ogl = new COpenGLDriver(params, io, device);
if (!ogl->initDriver(params)) if (!ogl->initDriver(params))
{ {
ogl->drop(); ogl->drop();
...@@ -3288,12 +3313,12 @@ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -3288,12 +3313,12 @@ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
return 0; return 0;
#endif // _IRR_COMPILE_WITH_OPENGL_ #endif // _IRR_COMPILE_WITH_OPENGL_
} }
#endif // _IRR_USE_WINDOWS_DEVICE_ #endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
// ----------------------------------- // -----------------------------------
// MACOSX VERSION // MACOSX VERSION
// ----------------------------------- // -----------------------------------
#if defined(_IRR_USE_OSX_DEVICE_) #if defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceMacOSX *device) io::IFileSystem* io, CIrrDeviceMacOSX *device)
{ {
...@@ -3303,22 +3328,38 @@ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -3303,22 +3328,38 @@ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
return 0; return 0;
#endif // _IRR_COMPILE_WITH_OPENGL_ #endif // _IRR_COMPILE_WITH_OPENGL_
} }
#endif // _IRR_USE_OSX_DEVICE_ #endif // _IRR_COMPILE_WITH_OSX_DEVICE_
// ----------------------------------- // -----------------------------------
// X11/SDL VERSION // X11 VERSION
// ----------------------------------- // -----------------------------------
#if defined(_IRR_USE_LINUX_DEVICE_) || defined(_IRR_USE_SDL_DEVICE_) #ifdef _IRR_COMPILE_WITH_X11_DEVICE_
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io) io::IFileSystem* io, CIrrDeviceLinux* device)
{ {
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
return new COpenGLDriver(params, io); return new COpenGLDriver(params, io, device);
#else
return 0;
#endif // _IRR_COMPILE_WITH_OPENGL_
}
#endif // _IRR_COMPILE_WITH_X11_DEVICE_
// -----------------------------------
// SDL VERSION
// -----------------------------------
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceSDL* device)
{
#ifdef _IRR_COMPILE_WITH_OPENGL_
return new COpenGLDriver(params, io, device);
#else #else
return 0; return 0;
#endif // _IRR_COMPILE_WITH_OPENGL_ #endif // _IRR_COMPILE_WITH_OPENGL_
} }
#endif // _IRR_USE_LINUX_DEVICE_ #endif // _IRR_COMPILE_WITH_SDL_DEVICE_
} // end namespace } // end namespace
} // end namespace } // end namespace
......
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
namespace irr namespace irr
{ {
class CIrrDeviceWin32;
class CIrrDeviceLinux;
class CIrrDeviceSDL;
class CIrrDeviceMacOSX;
namespace video namespace video
{ {
class COpenGLTexture; class COpenGLTexture;
...@@ -26,13 +31,20 @@ namespace video ...@@ -26,13 +31,20 @@ namespace video
{ {
public: public:
#if defined(_IRR_WINDOWS_API_) || defined(_IRR_USE_LINUX_DEVICE_) || defined(_IRR_USE_SDL_DEVICE_) #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io); COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceWin32* device);
#endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceLinux* device);
#endif
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceSDL* device);
#endif #endif
#ifdef _IRR_USE_OSX_DEVICE_ #ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
COpenGLDriver(const SIrrlichtCreationParameters& params, COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceMacOSX *device);
io::IFileSystem* io, CIrrDeviceMacOSX *device);
#endif #endif
#ifdef _IRR_WINDOWS_API_ #ifdef _IRR_WINDOWS_API_
...@@ -393,11 +405,15 @@ namespace video ...@@ -393,11 +405,15 @@ namespace video
HDC HDc; // Private GDI Device Context HDC HDc; // Private GDI Device Context
HWND Window; HWND Window;
HGLRC HRc; // Permanent Rendering Context HGLRC HRc; // Permanent Rendering Context
#elif defined(_IRR_USE_LINUX_DEVICE_) #endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
GLXDrawable Drawable; GLXDrawable Drawable;
#elif defined(_IRR_USE_OSX_DEVICE_) #endif
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
CIrrDeviceMacOSX *_device; CIrrDeviceMacOSX *_device;
#endif #endif
E_DEVICE_TYPE DeviceType;
}; };
} // end namespace video } // end namespace video
......
...@@ -35,7 +35,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : ...@@ -35,7 +35,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlStencilFuncSeparate(0), pGlStencilOpSeparate(0), pGlStencilFuncSeparate(0), pGlStencilOpSeparate(0),
pGlStencilFuncSeparateATI(0), pGlStencilOpSeparateATI(0), pGlStencilFuncSeparateATI(0), pGlStencilOpSeparateATI(0),
pGlCompressedTexImage2D(0), pGlCompressedTexImage2D(0),
#ifdef _IRR_USE_WINDOWS_DEVICE_ #ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
wglSwapIntervalEXT(0), wglSwapIntervalEXT(0),
#elif defined(GLX_SGI_swap_control) #elif defined(GLX_SGI_swap_control)
glxSwapIntervalSGI(0), glxSwapIntervalSGI(0),
...@@ -186,10 +186,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -186,10 +186,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
// vsync extension // vsync extension
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC) wglGetProcAddress("wglSwapIntervalEXT"); wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC) wglGetProcAddress("wglSwapIntervalEXT");
#elif defined(_IRR_USE_LINUX_DEVICE_) || defined (_IRR_USE_SDL_DEVICE_) #elif defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined (_IRR_COMPILE_WITH_SDL_DEVICE_)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
#ifdef _IRR_USE_SDL_DEVICE_ #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#define IRR_OGL_LOAD_EXTENSION(x) SDL_GL_GetProcAddress(reinterpret_cast<const char*>(x)) #define IRR_OGL_LOAD_EXTENSION(x) SDL_GL_GetProcAddress(reinterpret_cast<const char*>(x))
#else #else
// Accessing the correct function is quite complex // Accessing the correct function is quite complex
...@@ -322,7 +322,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -322,7 +322,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) pGlCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glCompressedTexImage2D")); IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glCompressedTexImage2D"));
#if defined(GLX_SGI_swap_control) && !defined(_IRR_USE_SDL_DEVICE_) #if defined(GLX_SGI_swap_control) && !defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
// get vsync extension // get vsync extension
glxSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI")); glxSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI"));
#endif #endif
......
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
#include "glext.h" #include "glext.h"
#endif #endif
#include "wglext.h" #include "wglext.h"
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib") #pragma comment(lib, "OpenGL32.lib")
#endif #endif
#elif defined(_IRR_USE_OSX_DEVICE_)
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
#include "CIrrDeviceMacOSX.h" #include "CIrrDeviceMacOSX.h"
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#define GL_GLEXT_LEGACY 1 #define GL_GLEXT_LEGACY 1
...@@ -36,7 +38,7 @@ ...@@ -36,7 +38,7 @@
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h" #include "glext.h"
#endif #endif
#elif defined(_IRR_USE_SDL_DEVICE_) #elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#define GL_GLEXT_LEGACY 1 #define GL_GLEXT_LEGACY 1
#define GLX_GLXEXT_LEGACY 1 #define GLX_GLXEXT_LEGACY 1
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <GL/gl.h> #include <GL/gl.h>
#elif defined(_IRR_OSX_PLATFORM_) #elif defined(_IRR_OSX_PLATFORM_)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#elif defined(_IRR_USE_SDL_DEVICE_) #elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
#define NO_SDL_GLEXT #define NO_SDL_GLEXT
#include <SDL/SDL_video.h> #include <SDL/SDL_video.h>
#include <SDL/SDL_opengl.h> #include <SDL/SDL_opengl.h>
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib") #pragma comment(lib, "OpenGL32.lib")
#endif #endif
#elif defined(_IRR_USE_OSX_DEVICE_) #elif defined(_IRR_OSX_PLATFORM_)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#elif defined(_IRR_USE_SDL_DEVICE_) #elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
#define NO_SDL_GLEXT #define NO_SDL_GLEXT
#include <SDL/SDL_video.h> #include <SDL/SDL_video.h>
#include <SDL/SDL_opengl.h> #include <SDL/SDL_opengl.h>
......
...@@ -723,10 +723,14 @@ ...@@ -723,10 +723,14 @@
<Unit filename="CIrrDeviceConsole.h" /> <Unit filename="CIrrDeviceConsole.h" />
<Unit filename="CIrrDeviceLinux.cpp" /> <Unit filename="CIrrDeviceLinux.cpp" />
<Unit filename="CIrrDeviceLinux.h" /> <Unit filename="CIrrDeviceLinux.h" />
<Unit filename="CIrrDeviceSDL.cpp" />
<Unit filename="CIrrDeviceSDL.h" />
<Unit filename="CIrrDeviceStub.cpp" /> <Unit filename="CIrrDeviceStub.cpp" />
<Unit filename="CIrrDeviceStub.h" /> <Unit filename="CIrrDeviceStub.h" />
<Unit filename="CIrrDeviceWin32.cpp" /> <Unit filename="CIrrDeviceWin32.cpp" />
<Unit filename="CIrrDeviceWin32.h" /> <Unit filename="CIrrDeviceWin32.h" />
<Unit filename="CIrrDeviceWinCE.cpp" />
<Unit filename="CIrrDeviceWinCE.h" />
<Unit filename="CIrrMeshFileLoader.cpp" /> <Unit filename="CIrrMeshFileLoader.cpp" />
<Unit filename="CIrrMeshFileLoader.h" /> <Unit filename="CIrrMeshFileLoader.h" />
<Unit filename="CIrrMeshWriter.cpp" /> <Unit filename="CIrrMeshWriter.cpp" />
...@@ -935,6 +939,8 @@ ...@@ -935,6 +939,8 @@
<Unit filename="ITriangleRenderer.h" /> <Unit filename="ITriangleRenderer.h" />
<Unit filename="IZBuffer.h" /> <Unit filename="IZBuffer.h" />
<Unit filename="Irrlicht.cpp" /> <Unit filename="Irrlicht.cpp" />
<Unit filename="MacOSX/CIrrDeviceMacOSX.h" />
<Unit filename="MacOSX/CIrrDeviceMacOSX.mm" />
<Unit filename="OctTree.h" /> <Unit filename="OctTree.h" />
<Unit filename="S2DVertex.h" /> <Unit filename="S2DVertex.h" />
<Unit filename="S4DVertex.h" /> <Unit filename="S4DVertex.h" />
......
...@@ -13,8 +13,33 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2009 Nikolaus Geb ...@@ -13,8 +13,33 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2009 Nikolaus Geb
#endif // _DEBUG #endif // _DEBUG
#endif #endif
#include "irrlicht.h" #include "irrlicht.h"
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#include "CIrrDeviceWin32.h"
#endif
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
#include "MacOSX/CIrrDeviceMacOSX.h"
#endif
#ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
#include "CIrrDeviceWinCE.h"
#endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
#include "CIrrDeviceLinux.h"
#endif
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
#include "CIrrDeviceSDL.h"
#endif
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
#include "CIrrDeviceConsole.h"
#endif
namespace irr namespace irr
{ {
...@@ -36,6 +61,52 @@ namespace irr ...@@ -36,6 +61,52 @@ namespace irr
return createDeviceEx(p); return createDeviceEx(p);
} }
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& params)
{
IrrlichtDevice* dev = 0;
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
if (params.DeviceType == EIDT_WIN32 || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceWin32(params);
#endif
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
if (params.DeviceType == EIDT_OSX || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceMacOSX(params);
#endif
#ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
if (params.DeviceType == EIDT_WINCE || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceWinCE(params);
#endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
if (params.DeviceType == EIDT_X11 || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceLinux(params);
#endif
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
if (params.DeviceType == EIDT_SDL || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceSDL(params);
#endif
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
if (params.DeviceType == EIDT_CONSOLE || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceConsole(params);
#endif
if (dev && !dev->getVideoDriver() && params.DriverType != video::EDT_NULL)
{
dev->closeDevice(); // destroy window
dev->run(); // consume quit message
dev->drop();
dev = 0;
}
return dev;
}
namespace core namespace core
{ {
const matrix4 IdentityMatrix(matrix4::EM4CONST_IDENTITY); const matrix4 IdentityMatrix(matrix4::EM4CONST_IDENTITY);
......
...@@ -78,6 +78,12 @@ namespace irr ...@@ -78,6 +78,12 @@ namespace irr
//! supported by the gfx adapter. //! supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList(); virtual video::IVideoModeList* getVideoModeList();
//! Get the device type
virtual E_DEVICE_TYPE getType() const
{
return EIDT_OSX;
}
void flush(); void flush();
void setMouseLocation(int x, int y); void setMouseLocation(int x, int y);
void setResize(int width, int height); void setResize(int width, int height);
......
...@@ -1436,19 +1436,6 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList() ...@@ -1436,19 +1436,6 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList()
return &VideoModeList; return &VideoModeList;
} }
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
{
CIrrDeviceMacOSX* dev = new CIrrDeviceMacOSX(param);
if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL)
{
dev->drop();
dev = 0;
}
return dev;
}
} // end namespace } // end namespace
#endif // _IRR_USE_OSX_DEVICE_ #endif // _IRR_USE_OSX_DEVICE_
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#include "irrMath.h" #include "irrMath.h"
#if defined(_IRR_USE_SDL_DEVICE_) #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
#include <SDL/SDL_endian.h> #include <SDL/SDL_endian.h>
#define bswap_16(X) SDL_Swap16(X) #define bswap_16(X) SDL_Swap16(X)
#define bswap_32(X) SDL_Swap32(X) #define bswap_32(X) SDL_Swap32(X)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment