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-e03cc46cb475master
parent
4ee90d2951
commit
c0170c7c48
|
@ -1,5 +1,7 @@
|
|||
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.
|
||||
|
||||
- IFileSystem changes:
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
#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 @@
|
|||
//! The defines for different operating system are:
|
||||
//! _IRR_XBOX_PLATFORM_ for XBox
|
||||
//! _IRR_WINDOWS_ for all irrlicht supported Windows versions
|
||||
//! _IRR_WINDOWS_CE_PLATFORM_ for Windows CE
|
||||
//! _IRR_WINDOWS_API_ for Windows or XBox
|
||||
//! _IRR_LINUX_PLATFORM_ for Linux (it is defined here if no other os is defined)
|
||||
//! _IRR_SOLARIS_PLATFORM_ for Solaris
|
||||
//! _IRR_OSX_PLATFORM_ for Apple systems running OSX
|
||||
//! _IRR_POSIX_API_ for Posix compatible systems
|
||||
//! _IRR_USE_SDL_DEVICE_ for platform independent SDL framework
|
||||
//! _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
|
||||
//! Note: PLATFORM defines the OS specific layer, API can group several platforms
|
||||
|
||||
//! 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
|
||||
//#define _IRR_USE_SDL_DEVICE_
|
||||
|
||||
//! Uncomment this line to compile as a console application with no windowing system. Hardware drivers will be disabled.
|
||||
//#define _IRR_USE_CONSOLE_DEVICE_
|
||||
//! Uncomment this line to compile with the SDL device
|
||||
//#define _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
//! Comment this line to compile without the fallback console device.
|
||||
#define _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
|
||||
//! WIN32 for Windows32
|
||||
//! WIN64 for Windows64
|
||||
// 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_API_
|
||||
#if !defined(_IRR_USE_SDL_DEVICE_) && !defined(_IRR_USE_CONSOLE_DEVICE_)
|
||||
#define _IRR_USE_WINDOWS_DEVICE_
|
||||
#define _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
#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
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
|
@ -60,9 +69,9 @@
|
|||
#undef _IRR_WINDOWS_
|
||||
#define _IRR_XBOX_PLATFORM_
|
||||
#define _IRR_WINDOWS_API_
|
||||
//#define _IRR_USE_WINDOWS_DEVICE_
|
||||
#undef _IRR_USE_WINDOWS_DEVICE_
|
||||
//#define _IRR_USE_SDL_DEVICE_
|
||||
//#define _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
#undef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
//#define _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
#include <xtl.h>
|
||||
#endif
|
||||
|
@ -72,9 +81,7 @@
|
|||
#define MACOSX // legacy support
|
||||
#endif
|
||||
#define _IRR_OSX_PLATFORM_
|
||||
#if !defined(_IRR_USE_LINUX_DEVICE_) && !defined(_IRR_USE_CONSOLE_DEVICE_) && !defined(_IRR_USE_SDL_DEVICE_)
|
||||
#define _IRR_USE_OSX_DEVICE_
|
||||
#endif
|
||||
#define _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
#endif
|
||||
|
||||
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
|
||||
|
@ -85,10 +92,7 @@
|
|||
#define _IRR_LINUX_PLATFORM_
|
||||
#endif
|
||||
#define _IRR_POSIX_API_
|
||||
|
||||
#if !defined(_IRR_USE_SDL_DEVICE_) && !defined(_IRR_USE_CONSOLE_DEVICE_)
|
||||
#define _IRR_USE_LINUX_DEVICE_
|
||||
#endif
|
||||
#define _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
#endif
|
||||
|
||||
//! 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
|
|||
#undef BURNINGVIDEO_RENDERER_ULTRA_FAST
|
||||
#define BURNINGVIDEO_RENDERER_CE
|
||||
|
||||
#undef _IRR_USE_WINDOWS_DEVICE_
|
||||
#define _IRR_USE_WINDOWS_CE_DEVICE_
|
||||
#undef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
#define _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
|
||||
//#define _IRR_WCHAR_FILESYSTEM
|
||||
|
||||
#undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
|
||||
|
@ -454,13 +458,5 @@ precision will be lower but speed higher. currently X86 only
|
|||
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
#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__
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "dimension2d.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "EDriverTypes.h"
|
||||
#include "EDeviceTypes.h"
|
||||
#include "IEventReceiver.h"
|
||||
#include "ICursorControl.h"
|
||||
#include "IVideoModeList.h"
|
||||
|
@ -230,10 +231,14 @@ namespace irr
|
|||
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
|
||||
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.
|
||||
/** Even if true is returned the driver needs not be available
|
||||
for an actual configuration requested upon device creation. */
|
||||
//! Check if a driver type is supported by the engine.
|
||||
/** Even if true is returned the driver may not be available
|
||||
for a configuration requested when creating the device. */
|
||||
static bool isDriverSupported(video::E_DRIVER_TYPE driver)
|
||||
{
|
||||
switch (driver)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
|
||||
|
||||
#include "EDriverTypes.h"
|
||||
#include "EDeviceTypes.h"
|
||||
#include "dimension2d.h"
|
||||
|
||||
namespace irr
|
||||
|
@ -18,6 +19,7 @@ namespace irr
|
|||
{
|
||||
//! Constructs a SIrrlichtCreationParameters structure with default values.
|
||||
SIrrlichtCreationParameters() :
|
||||
DeviceType(EIDT_BEST),
|
||||
DriverType(video::EDT_BURNINGSVIDEO),
|
||||
WindowSize(core::dimension2d<u32>(800, 600)),
|
||||
Bits(16),
|
||||
|
@ -43,6 +45,7 @@ namespace irr
|
|||
|
||||
SIrrlichtCreationParameters& operator=(const SIrrlichtCreationParameters& other)
|
||||
{
|
||||
DeviceType = other.DeviceType;
|
||||
DriverType = other.DriverType;
|
||||
WindowSize = other.WindowSize;
|
||||
Bits = other.Bits;
|
||||
|
@ -62,6 +65,19 @@ namespace irr
|
|||
}
|
||||
|
||||
//! 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,
|
||||
video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8,
|
||||
video::EDT_DIRECT3D9, and video::EDT_OPENGL.
|
||||
|
@ -83,7 +99,7 @@ namespace irr
|
|||
|
||||
//! Specifies if the stencil buffer should be enabled.
|
||||
/** 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
|
||||
creation. Without the stencil buffer no shadows will be drawn.
|
||||
Default: false. */
|
||||
|
|
|
@ -321,7 +321,7 @@ const core::string<c16>& CFileSystem::getWorkingDirectory()
|
|||
WorkingDirectory[type].reserve(FILE_SYSTEM_MAX_PATH);
|
||||
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_)
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM )
|
||||
_wgetcwd(r, FILE_SYSTEM_MAX_PATH);
|
||||
|
@ -361,7 +361,7 @@ bool CFileSystem::changeWorkingDirectoryTo(const core::string<c16>& newDirectory
|
|||
{
|
||||
WorkingDirectory[FILESYSTEM_NATIVE] = newDirectory;
|
||||
|
||||
#if defined(_IRR_USE_WINDOWS_CE_DEVICE_)
|
||||
#if defined(_IRR_WINDOWS_CE_PLATFORM_)
|
||||
success = true;
|
||||
#elif defined(_MSC_VER)
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||
|
@ -382,7 +382,7 @@ core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename
|
|||
{
|
||||
c16 *p=0;
|
||||
|
||||
#if defined(_IRR_USE_WINDOWS_CE_DEVICE_)
|
||||
#if defined(_IRR_WINDOWS_CE_PLATFORM_)
|
||||
return filename;
|
||||
#elif defined(_IRR_WINDOWS_API_)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "CIrrDeviceConsole.h"
|
||||
|
||||
#ifdef _IRR_USE_CONSOLE_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
|
||||
#include "os.h"
|
||||
#include "IGUISkin.h"
|
||||
|
@ -129,7 +129,7 @@ CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
|
|||
case video::EDT_DIRECT3D8:
|
||||
case video::EDT_DIRECT3D9:
|
||||
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;
|
||||
case video::EDT_NULL:
|
||||
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
|
||||
|
@ -449,23 +449,6 @@ void CIrrDeviceConsole::addPostPresentText(s16 X, s16 Y, const wchar_t *text)
|
|||
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
|
||||
|
||||
#endif // _IRR_USE_CONSOLE_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#define __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
|
||||
|
||||
#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 "CIrrDeviceStub.h"
|
||||
|
@ -81,6 +81,12 @@ namespace irr
|
|||
//! Minimizes the window.
|
||||
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);
|
||||
|
||||
//! Implementation of the win32 console mouse cursor
|
||||
|
@ -313,7 +319,5 @@ namespace gui
|
|||
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
|
||||
#endif // _IRR_USE_CONSOLE_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "CIrrDeviceLinux.h"
|
||||
|
||||
#ifdef _IRR_USE_LINUX_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -41,7 +41,7 @@ namespace irr
|
|||
namespace video
|
||||
{
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io);
|
||||
io::IFileSystem* io, CIrrDeviceLinux* device);
|
||||
}
|
||||
} // end namespace irr
|
||||
|
||||
|
@ -721,7 +721,7 @@ void CIrrDeviceLinux::createDriver()
|
|||
case video::EDT_OPENGL:
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
if (Context)
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem);
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||
#else
|
||||
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
|
@ -1662,22 +1662,7 @@ void CIrrDeviceLinux::initXAtoms()
|
|||
#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
|
||||
|
||||
#endif // _IRR_USE_LINUX_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_USE_LINUX_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
|
||||
#include "CIrrDeviceStub.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
|
@ -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.
|
||||
virtual void copyToClipboard(const c8* text) const;
|
||||
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const
|
||||
{
|
||||
return EIDT_X11;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! create the driver
|
||||
|
@ -380,6 +386,6 @@ namespace irr
|
|||
|
||||
} // end namespace irr
|
||||
|
||||
#endif // _IRR_USE_LINUX_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_LINUX_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_USE_SDL_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
#include "CIrrDeviceSDL.h"
|
||||
#include "IEventReceiver.h"
|
||||
|
@ -42,7 +42,7 @@ namespace irr
|
|||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io);
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device);
|
||||
#endif
|
||||
} // end namespace video
|
||||
|
||||
|
@ -52,8 +52,6 @@ namespace irr
|
|||
namespace irr
|
||||
{
|
||||
|
||||
const char* wmDeleteWindow = "WM_DELETE_WINDOW";
|
||||
|
||||
//! constructor
|
||||
CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
||||
: CIrrDeviceStub(param),
|
||||
|
@ -276,7 +274,7 @@ void CIrrDeviceSDL::createDriver()
|
|||
|
||||
case video::EDT_OPENGL:
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem);
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||
#else
|
||||
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
|
@ -456,8 +454,8 @@ bool CIrrDeviceSDL::run()
|
|||
|
||||
case SDL_USEREVENT:
|
||||
irrevent.EventType = irr::EET_USER_EVENT;
|
||||
irrevent.UserEvent.UserData1 = reinterpret_cast<s32>(SDL_event.user.data1);
|
||||
irrevent.UserEvent.UserData2 = reinterpret_cast<s32>(SDL_event.user.data2);
|
||||
irrevent.UserEvent.UserData1 = *(reinterpret_cast<s32*>(&SDL_event.user.data1));
|
||||
irrevent.UserEvent.UserData2 = *(reinterpret_cast<s32*>(&SDL_event.user.data2));
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
@ -946,21 +944,7 @@ void CIrrDeviceSDL::createKeyMap()
|
|||
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
|
||||
|
||||
#endif // _IRR_USE_SDL_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_USE_SDL_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
#include "IrrlichtDevice.h"
|
||||
#include "CIrrDeviceStub.h"
|
||||
|
@ -74,6 +74,12 @@ namespace irr
|
|||
//! Activate any joysticks, and generate events for them.
|
||||
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
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
{
|
||||
|
@ -213,6 +219,6 @@ namespace irr
|
|||
|
||||
} // end namespace irr
|
||||
|
||||
#endif // _IRR_USE_SDL_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_SDL_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
|
||||
#include "CIrrDeviceWin32.h"
|
||||
#include "IEventReceiver.h"
|
||||
|
@ -34,7 +34,7 @@ namespace irr
|
|||
#endif
|
||||
|
||||
#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
|
||||
}
|
||||
} // end namespace irr
|
||||
|
@ -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
|
||||
|
||||
#endif // _IRR_USE_WINDOWS_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define __C_IRR_DEVICE_WIN32_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
|
||||
#include "CIrrDeviceStub.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
|
@ -81,6 +81,12 @@ namespace irr
|
|||
//! Get the current Gamma Value for the Display
|
||||
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.
|
||||
//! \return Returns only 1,2 or 3. A 4th click will start with 1 again.
|
||||
virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY)
|
||||
|
@ -311,6 +317,6 @@ namespace irr
|
|||
|
||||
} // end namespace irr
|
||||
|
||||
#endif // _IRR_USE_WINDOWS_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_WIN32_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_USE_WINDOWS_CE_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
|
||||
|
||||
#include "CIrrDeviceWinCE.h"
|
||||
#include "IEventReceiver.h"
|
||||
|
@ -40,7 +40,7 @@ namespace irr
|
|||
#endif
|
||||
|
||||
#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
|
||||
}
|
||||
} // end namespace irr
|
||||
|
@ -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
|
||||
|
||||
#endif // _IRR_USE_WINDOWS_CE_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define __C_IRR_DEVICE_WINCE_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
#ifdef _IRR_USE_WINDOWS_CE_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
|
||||
|
||||
#include "CIrrDeviceStub.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
|
@ -72,6 +72,12 @@ namespace irr
|
|||
//! Minimizes the window.
|
||||
virtual void minimizeWindow();
|
||||
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const
|
||||
{
|
||||
return EIDT_WINCE;
|
||||
}
|
||||
|
||||
//! Implementation of the win32 cursor control
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
{
|
||||
|
@ -259,6 +265,5 @@ namespace irr
|
|||
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_WINCE_H_INCLUDED__
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#else
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#ifdef _IRR_USE_OSX_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
#include "MacOSX/OSXClipboard.h"
|
||||
#endif
|
||||
#ifdef _IRR_OSX_PLATFORM_
|
||||
|
@ -21,14 +21,14 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#include "CIrrDeviceLinux.h"
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
// constructor linux
|
||||
COSOperator::COSOperator(const c8* osversion, CIrrDeviceLinux* device)
|
||||
: IrrDeviceLinux(device)
|
||||
|
@ -79,11 +79,11 @@ void COSOperator::copyToClipboard(const c8* text) const
|
|||
CloseClipboard();
|
||||
|
||||
// MacOSX version
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
|
||||
OSXCopyToClipboard(text);
|
||||
|
||||
#elif defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if ( IrrDeviceLinux )
|
||||
IrrDeviceLinux->copyToClipboard(text);
|
||||
#else
|
||||
|
@ -110,10 +110,10 @@ const c8* COSOperator::getTextFromClipboard() const
|
|||
CloseClipboard();
|
||||
return buffer;
|
||||
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
return (OSXCopyFromClipboard());
|
||||
|
||||
#elif defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if ( IrrDeviceLinux )
|
||||
return IrrDeviceLinux->getTextFromClipboard();
|
||||
return 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ class COSOperator : public IOSOperator
|
|||
public:
|
||||
|
||||
// constructor
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
COSOperator(const c8* osversion, CIrrDeviceLinux* device);
|
||||
#endif
|
||||
COSOperator(const c8* osversion);
|
||||
|
@ -50,7 +50,7 @@ private:
|
|||
|
||||
core::stringw OperatingSystem;
|
||||
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
CIrrDeviceLinux * IrrDeviceLinux;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "CImage.h"
|
||||
#include "os.h"
|
||||
|
||||
#ifdef _IRR_USE_SDL_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
#include <SDL/SDL.h>
|
||||
#endif
|
||||
|
||||
|
@ -29,17 +29,17 @@ namespace video
|
|||
// -----------------------------------------------------------------------
|
||||
// WINDOWS CONSTRUCTOR
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
//! Windows constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io)
|
||||
io::IFileSystem* io, CIrrDeviceWin32* device)
|
||||
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(params.AntiAlias), RenderTargetTexture(0),
|
||||
CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
|
||||
CurrentTarget(ERT_FRAME_BUFFER),
|
||||
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
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -354,12 +354,12 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params)
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif //IRR_USE_WINDOWS_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// MacOSX CONSTRUCTOR
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef _IRR_USE_OSX_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
//! Windows constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceMacOSX *device)
|
||||
|
@ -369,7 +369,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
|
||||
CurrentTarget(ERT_FRAME_BUFFER),
|
||||
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer),
|
||||
_device(device)
|
||||
_device(device), DeviceType(EIDT_OSX)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -382,16 +382,16 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
// -----------------------------------------------------------------------
|
||||
// LINUX CONSTRUCTOR
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef _IRR_USE_LINUX_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
//! Linux constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io)
|
||||
io::IFileSystem* io, CIrrDeviceLinux* device)
|
||||
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||
RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
|
||||
CurrentTarget(ERT_FRAME_BUFFER),
|
||||
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer)
|
||||
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer), DeviceType(EIDT_X11)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -415,22 +415,22 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // _IRR_USE_LINUX_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// SDL CONSTRUCTOR
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef _IRR_USE_SDL_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
//! SDL constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io)
|
||||
io::IFileSystem* io, CIrrDeviceSDL* device)
|
||||
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||
RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
|
||||
CurrentTarget(ERT_FRAME_BUFFER),
|
||||
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer)
|
||||
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer), DeviceType(EIDT_SDL)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -439,7 +439,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
||||
}
|
||||
|
||||
#endif // _IRR_USE_SDL_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
|
||||
//! destructor
|
||||
|
@ -454,7 +454,10 @@ COpenGLDriver::~COpenGLDriver()
|
|||
|
||||
deleteAllTextures();
|
||||
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
if (DeviceType == EIDT_WIN32)
|
||||
{
|
||||
|
||||
if (HRc)
|
||||
{
|
||||
if (!wglMakeCurrent(0, 0))
|
||||
|
@ -466,6 +469,7 @@ COpenGLDriver::~COpenGLDriver()
|
|||
|
||||
if (HDc)
|
||||
ReleaseDC(Window, HDc);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -621,20 +625,38 @@ bool COpenGLDriver::endScene()
|
|||
|
||||
glFlush();
|
||||
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
if (DeviceType == EIDT_WIN32)
|
||||
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);
|
||||
return true;
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
if (DeviceType == EIDT_OSX)
|
||||
{
|
||||
_device->flush();
|
||||
return true;
|
||||
#elif defined(_IRR_USE_SDL_DEVICE_)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
if (DeviceType == EIDT_SDL)
|
||||
{
|
||||
SDL_GL_SwapBuffers();
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// todo: console device present
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -671,10 +693,13 @@ bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
|
|||
{
|
||||
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,
|
||||
// it would be better if this was fixed elsewhere.
|
||||
glFrontFace(GL_CW);
|
||||
}
|
||||
#endif
|
||||
|
||||
clearBuffers(backBuffer, zBuffer, false, color);
|
||||
|
@ -3272,12 +3297,12 @@ namespace video
|
|||
// -----------------------------------
|
||||
// WINDOWS VERSION
|
||||
// -----------------------------------
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io)
|
||||
io::IFileSystem* io, CIrrDeviceWin32* device)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
COpenGLDriver* ogl = new COpenGLDriver(params, io);
|
||||
COpenGLDriver* ogl = new COpenGLDriver(params, io, device);
|
||||
if (!ogl->initDriver(params))
|
||||
{
|
||||
ogl->drop();
|
||||
|
@ -3288,12 +3313,12 @@ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
return 0;
|
||||
#endif // _IRR_COMPILE_WITH_OPENGL_
|
||||
}
|
||||
#endif // _IRR_USE_WINDOWS_DEVICE_
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
|
||||
// -----------------------------------
|
||||
// MACOSX VERSION
|
||||
// -----------------------------------
|
||||
#if defined(_IRR_USE_OSX_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceMacOSX *device)
|
||||
{
|
||||
|
@ -3303,22 +3328,38 @@ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
return 0;
|
||||
#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,
|
||||
io::IFileSystem* io)
|
||||
io::IFileSystem* io, CIrrDeviceLinux* device)
|
||||
{
|
||||
#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_USE_LINUX_DEVICE_
|
||||
#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
|
||||
return 0;
|
||||
#endif // _IRR_COMPILE_WITH_OPENGL_
|
||||
}
|
||||
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
|
||||
namespace irr
|
||||
{
|
||||
class CIrrDeviceWin32;
|
||||
class CIrrDeviceLinux;
|
||||
class CIrrDeviceSDL;
|
||||
class CIrrDeviceMacOSX;
|
||||
|
||||
namespace video
|
||||
{
|
||||
class COpenGLTexture;
|
||||
|
@ -26,13 +31,20 @@ namespace video
|
|||
{
|
||||
public:
|
||||
|
||||
#if defined(_IRR_WINDOWS_API_) || defined(_IRR_USE_LINUX_DEVICE_) || defined(_IRR_USE_SDL_DEVICE_)
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io);
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceWin32* device);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_USE_OSX_DEVICE_
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceMacOSX *device);
|
||||
#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
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceMacOSX *device);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
|
@ -393,11 +405,15 @@ namespace video
|
|||
HDC HDc; // Private GDI Device Context
|
||||
HWND Window;
|
||||
HGLRC HRc; // Permanent Rendering Context
|
||||
#elif defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
GLXDrawable Drawable;
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
CIrrDeviceMacOSX *_device;
|
||||
#endif
|
||||
|
||||
E_DEVICE_TYPE DeviceType;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
|
|
|
@ -35,7 +35,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
|||
pGlStencilFuncSeparate(0), pGlStencilOpSeparate(0),
|
||||
pGlStencilFuncSeparateATI(0), pGlStencilOpSeparateATI(0),
|
||||
pGlCompressedTexImage2D(0),
|
||||
#ifdef _IRR_USE_WINDOWS_DEVICE_
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
wglSwapIntervalEXT(0),
|
||||
#elif defined(GLX_SGI_swap_control)
|
||||
glxSwapIntervalSGI(0),
|
||||
|
@ -186,10 +186,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
// vsync extension
|
||||
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_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))
|
||||
#else
|
||||
// Accessing the correct function is quite complex
|
||||
|
@ -322,7 +322,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
pGlCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)
|
||||
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
|
||||
glxSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI"));
|
||||
#endif
|
||||
|
|
|
@ -24,10 +24,12 @@
|
|||
#include "glext.h"
|
||||
#endif
|
||||
#include "wglext.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "OpenGL32.lib")
|
||||
#endif
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
#include "CIrrDeviceMacOSX.h"
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
|
@ -36,7 +38,7 @@
|
|||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include "glext.h"
|
||||
#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_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#define GLX_GLXEXT_LEGACY 1
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <GL/gl.h>
|
||||
#elif defined(_IRR_OSX_PLATFORM_)
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined(_IRR_USE_SDL_DEVICE_)
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#define NO_SDL_GLEXT
|
||||
#include <SDL/SDL_video.h>
|
||||
#include <SDL/SDL_opengl.h>
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "OpenGL32.lib")
|
||||
#endif
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
#elif defined(_IRR_OSX_PLATFORM_)
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined(_IRR_USE_SDL_DEVICE_)
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#define NO_SDL_GLEXT
|
||||
#include <SDL/SDL_video.h>
|
||||
#include <SDL/SDL_opengl.h>
|
||||
|
|
|
@ -723,10 +723,14 @@
|
|||
<Unit filename="CIrrDeviceConsole.h" />
|
||||
<Unit filename="CIrrDeviceLinux.cpp" />
|
||||
<Unit filename="CIrrDeviceLinux.h" />
|
||||
<Unit filename="CIrrDeviceSDL.cpp" />
|
||||
<Unit filename="CIrrDeviceSDL.h" />
|
||||
<Unit filename="CIrrDeviceStub.cpp" />
|
||||
<Unit filename="CIrrDeviceStub.h" />
|
||||
<Unit filename="CIrrDeviceWin32.cpp" />
|
||||
<Unit filename="CIrrDeviceWin32.h" />
|
||||
<Unit filename="CIrrDeviceWinCE.cpp" />
|
||||
<Unit filename="CIrrDeviceWinCE.h" />
|
||||
<Unit filename="CIrrMeshFileLoader.cpp" />
|
||||
<Unit filename="CIrrMeshFileLoader.h" />
|
||||
<Unit filename="CIrrMeshWriter.cpp" />
|
||||
|
@ -935,6 +939,8 @@
|
|||
<Unit filename="ITriangleRenderer.h" />
|
||||
<Unit filename="IZBuffer.h" />
|
||||
<Unit filename="Irrlicht.cpp" />
|
||||
<Unit filename="MacOSX/CIrrDeviceMacOSX.h" />
|
||||
<Unit filename="MacOSX/CIrrDeviceMacOSX.mm" />
|
||||
<Unit filename="OctTree.h" />
|
||||
<Unit filename="S2DVertex.h" />
|
||||
<Unit filename="S4DVertex.h" />
|
||||
|
|
|
@ -13,8 +13,33 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2009 Nikolaus Geb
|
|||
#endif // _DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
#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
|
||||
{
|
||||
|
@ -36,6 +61,52 @@ namespace irr
|
|||
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
|
||||
{
|
||||
const matrix4 IdentityMatrix(matrix4::EM4CONST_IDENTITY);
|
||||
|
|
|
@ -78,6 +78,12 @@ namespace irr
|
|||
//! supported by the gfx adapter.
|
||||
virtual video::IVideoModeList* getVideoModeList();
|
||||
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const
|
||||
{
|
||||
return EIDT_OSX;
|
||||
}
|
||||
|
||||
void flush();
|
||||
void setMouseLocation(int x, int y);
|
||||
void setResize(int width, int height);
|
||||
|
|
|
@ -1436,19 +1436,6 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList()
|
|||
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
|
||||
|
||||
#endif // _IRR_USE_OSX_DEVICE_
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "IrrCompileConfig.h"
|
||||
#include "irrMath.h"
|
||||
|
||||
#if defined(_IRR_USE_SDL_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include <SDL/SDL_endian.h>
|
||||
#define bswap_16(X) SDL_Swap16(X)
|
||||
#define bswap_32(X) SDL_Swap32(X)
|
||||
|
|
Loading…
Reference in New Issue