diff --git a/changes.txt b/changes.txt
index 94fc9206..fd9d4106 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,6 +1,10 @@
30.12.2006 TA
+ added Initial Windows Mobile 6 Version.
+ - Windows Mobile 6 SDK
+ - Visual Studio 2005
+
Minor:
- - Burningvideo: MipMap Selection
+ - Burningvideo: MipMap Selection repaired
- renamed private Driver function getTextureSizeFromImageSize to getTextureSizeFromSurfaceSize
-------------------------------------------
Changes in version 1.5 (... 2008)
diff --git a/examples/17.HelloWorld_Mobile/HelloWorld_mobile.sln b/examples/17.HelloWorld_Mobile/HelloWorld_mobile.sln
new file mode 100644
index 00000000..92150b71
--- /dev/null
+++ b/examples/17.HelloWorld_Mobile/HelloWorld_mobile.sln
@@ -0,0 +1,30 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld_mobile", "HelloWorld_mobile.vcproj", "{AD95D5D7-91D2-4030-B28D-23A6FE5C0359}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\..\source\Irrlicht\Irrlicht_mobile6.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AD95D5D7-91D2-4030-B28D-23A6FE5C0359}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {AD95D5D7-91D2-4030-B28D-23A6FE5C0359}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {AD95D5D7-91D2-4030-B28D-23A6FE5C0359}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {AD95D5D7-91D2-4030-B28D-23A6FE5C0359}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {AD95D5D7-91D2-4030-B28D-23A6FE5C0359}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {AD95D5D7-91D2-4030-B28D-23A6FE5C0359}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/examples/17.HelloWorld_Mobile/HelloWorld_mobile.vcproj b/examples/17.HelloWorld_Mobile/HelloWorld_mobile.vcproj
new file mode 100644
index 00000000..3cdc3eb5
--- /dev/null
+++ b/examples/17.HelloWorld_Mobile/HelloWorld_mobile.vcproj
@@ -0,0 +1,198 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/17.HelloWorld_Mobile/main.cpp b/examples/17.HelloWorld_Mobile/main.cpp
new file mode 100644
index 00000000..c5969ddf
--- /dev/null
+++ b/examples/17.HelloWorld_Mobile/main.cpp
@@ -0,0 +1,184 @@
+#include
+
+#ifdef _IRR_USE_WINDOWS_CE_DEVICE_
+#include
+#endif
+
+using namespace irr;
+using namespace core;
+using namespace scene;
+using namespace video;
+using namespace io;
+using namespace gui;
+
+#pragma comment(lib, "Irrlicht.lib")
+
+class MyEventReceiver : public IEventReceiver
+{
+private:
+ IrrlichtDevice *Device;
+public:
+ MyEventReceiver ( IrrlichtDevice *device ): Device ( device ) {}
+
+ virtual bool OnEvent(const SEvent& event)
+ {
+ if (event.EventType == EET_GUI_EVENT)
+ {
+ s32 id = event.GUIEvent.Caller->getID();
+
+ switch(event.GUIEvent.EventType)
+ {
+ case EGET_BUTTON_CLICKED:
+ if (id == 2)
+ {
+ Device->closeDevice();
+ return true;
+ } break;
+ }
+ }
+
+ return false;
+ }
+};
+
+class CSampleSceneNode : public ISceneNode
+{
+ aabbox3d Box;
+ S3DVertex Vertices[4];
+ SMaterial Material;
+public:
+
+ CSampleSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
+ : ISceneNode(parent, mgr, id)
+ {
+ Material.Wireframe = false;
+ Material.Lighting = false;
+
+ Vertices[0] = S3DVertex(0,0,10, 1,1,0, SColor(255,0,255,255), 0, 1);
+ Vertices[1] = S3DVertex(10,0,-10, 1,0,0, SColor(255,255,0,255), 1, 1);
+ Vertices[2] = S3DVertex(0,20,0, 0,1,1, SColor(255,255,255,0), 1, 0);
+ Vertices[3] = S3DVertex(-10,0,-10, 0,0,1, SColor(255,0,255,0), 0, 0);
+ Box.reset(Vertices[0].Pos);
+ for (s32 i=1; i<4; ++i)
+ Box.addInternalPoint(Vertices[i].Pos);
+ }
+ virtual void OnRegisterSceneNode()
+ {
+ if (IsVisible)
+ SceneManager->registerNodeForRendering(this);
+
+ ISceneNode::OnRegisterSceneNode();
+ }
+
+ virtual void render()
+ {
+ u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
+ IVideoDriver* driver = SceneManager->getVideoDriver();
+
+ driver->setMaterial(Material);
+ driver->setTransform(ETS_WORLD, AbsoluteTransformation);
+ driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
+ }
+
+ virtual const aabbox3d& getBoundingBox() const
+ {
+ return Box;
+ }
+
+ virtual u32 getMaterialCount()
+ {
+ return 1;
+ }
+
+ virtual SMaterial& getMaterial(u32 i)
+ {
+ return Material;
+ }
+};
+
+
+#if defined(_WIN32_WCE)
+int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
+ int nCmdShow )
+#else
+int main()
+#endif
+{
+ E_DRIVER_TYPE driverType = EDT_BURNINGSVIDEO;
+
+ // create device
+
+ IrrlichtDevice *device =
+ //createDevice(driverType, dimension2d(220, 240), 16, false );
+ createDevice(driverType, dimension2d(240, 320), 16, true );
+
+ if (device == 0)
+ return 1; // could not create selected driver.
+
+ // create engine and camera
+ MyEventReceiver receiver(device);
+ device->setEventReceiver(&receiver);
+ device->setWindowCaption(L"Irrlicht CE Demo");
+
+ IVideoDriver* driver = device->getVideoDriver();
+ ISceneManager* smgr = device->getSceneManager();
+ IGUIEnvironment* guienv = device->getGUIEnvironment();
+
+ // set the filesystem relative to the executable
+ {
+ wchar_t buf[255];
+ GetModuleFileNameW ( 0, buf, 255 );
+
+ stringc base = buf;
+ base = base.subString ( 0, base.findLast ( '\\' ) );
+ device->getFileSystem()->addFolderFileArchive ( base.c_str() );
+ }
+
+
+ IGUIStaticText *text =
+ guienv->addStaticText(L"FPS: 25",
+ rect(60,5,200,20), false );
+
+ guienv->addButton(core::rect(10,5,50,20), 0, 2, L"Quit");
+
+ smgr->addCameraSceneNode(0, vector3df(0,-40,0), vector3df(0,0,0));
+
+ CSampleSceneNode *myNode =
+ new CSampleSceneNode(smgr->getRootSceneNode(), smgr, 666);
+
+ ISceneNodeAnimator* anim =
+ smgr->createRotationAnimator(vector3df(0.8f, 0, 0.8f));
+
+ if(anim)
+ {
+ myNode->addAnimator(anim);
+ anim->drop();
+ anim = 0; // As I shouldn't refer to it again, ensure that I can't
+ }
+
+ myNode->drop();
+ myNode = 0; // As I shouldn't refer to it again, ensure that I can't
+
+ u32 frames=0;
+ while(device->run())
+ {
+ driver->beginScene(true, true, SColor(0,100,100,100));
+ smgr->drawAll();
+ guienv->drawAll();
+ driver->endScene();
+
+ if (++frames==10)
+ {
+ stringw str = L"FPS: ";
+ str += (s32)driver->getFPS();
+
+ text->setText ( str.c_str() );
+ frames=0;
+ }
+ }
+
+ device->drop();
+
+ return 0;
+}
+
diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h
index 79ef9ff1..093e7e4f 100644
--- a/include/IrrCompileConfig.h
+++ b/include/IrrCompileConfig.h
@@ -17,6 +17,7 @@
//! _IRR_POSIX_API_ for Posix compatible systems
//! _IRR_USE_SDL_DEVICE_ for platform independent SDL framework
//! _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
//! MACOSX for Mac OS X
@@ -24,7 +25,7 @@
//! WIN32 for Windows32
//! WIN64 for Windows64
-#if defined(WIN32) || defined(WIN64)
+#if defined(WIN32) || defined(WIN64) || defined(_WIN32_WCE)
#define _IRR_WINDOWS_
#define _IRR_WINDOWS_API_
#ifndef _IRR_USE_SDL_DEVICE_
@@ -312,5 +313,17 @@ precision will be lower but speed higher. currently X86 only
#undef _IRR_COMPILE_WITH_DIRECT3D_9_
#endif
+// WinCE does not have OpenGL or DirectX9
+#if defined(_WIN32_WCE)
+ #undef _IRR_COMPILE_WITH_OPENGL_
+ #undef _IRR_COMPILE_WITH_DIRECT3D_8_
+ #undef _IRR_COMPILE_WITH_DIRECT3D_9_
+ #undef _IRR_COMPILE_WITH_SOFTWARE_
+ #undef BURNINGVIDEO_RENDERER_BEAUTIFUL
+ #undef _IRR_USE_WINDOWS_DEVICE_
+ #define _IRR_USE_WINDOWS_CE_DEVICE_
+ #define BURNINGVIDEO_RENDERER_CE
+#endif
+
#endif // __IRR_COMPILE_CONFIG_H_INCLUDED__
diff --git a/include/irrMath.h b/include/irrMath.h
index 568880de..c3da4234 100644
--- a/include/irrMath.h
+++ b/include/irrMath.h
@@ -9,7 +9,7 @@
#include "irrTypes.h"
#include
-#if defined(_IRR_SOLARIS_PLATFORM_) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
+#if defined(_IRR_SOLARIS_PLATFORM_) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) || defined (_WIN32_WCE)
#define sqrtf(X) (f32)sqrt((f64)(X))
#define sinf(X) (f32)sin((f64)(X))
#define cosf(X) (f32)cos((f64)(X))
diff --git a/include/irrTypes.h b/include/irrTypes.h
index 98b9f9d5..e6c9fc21 100644
--- a/include/irrTypes.h
+++ b/include/irrTypes.h
@@ -70,7 +70,7 @@ typedef double f64;
//! standard on Windows platforms, but it does on all others.
//! These should be int snprintf(char *str, size_t size, const char *format, ...);
//! and int swprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);
-#if defined(_MSC_VER) && _MSC_VER > 1310
+#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
#define swprintf swprintf_s
#define snprintf sprintf_s
#else
@@ -97,7 +97,7 @@ typedef unsigned short wchar_t;
//! define a break macro for debugging.
#if defined(_DEBUG)
-#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER)
+#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#else
#include "assert.h"
@@ -122,7 +122,7 @@ Compiler version defines: VC6.0 : 1200, VC7.0 : 1300, VC7.1 : 1310, VC8.0 : 1400
// memory debugging
#if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \
- (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE)
+ (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
#define CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC
diff --git a/include/quaternion.h b/include/quaternion.h
index 354d6a8a..32dd547d 100644
--- a/include/quaternion.h
+++ b/include/quaternion.h
@@ -483,7 +483,7 @@ inline void quaternion::toAngleAxis(f32 &angle, core::vector3df &axis) const
}
else
{
- angle = 2.0f * acos(W);
+ angle = 2.0f * (f32) acos(W);
axis.X = X / scale;
axis.Y = Y / scale;
axis.Z = Z / scale;
diff --git a/source/Irrlicht/CBurningShader_Raster_Reference.cpp b/source/Irrlicht/CBurningShader_Raster_Reference.cpp
index 1df3b9c5..655173fa 100644
--- a/source/Irrlicht/CBurningShader_Raster_Reference.cpp
+++ b/source/Irrlicht/CBurningShader_Raster_Reference.cpp
@@ -594,7 +594,7 @@ void CBurningShader_Raster_Reference::setMaterial ( const SBurningShaderMaterial
ShaderParam.ColorUnits = 0;
ShaderParam.TextureUnits = 0;
- for ( i = 0; i != MATERIAL_MAX_TEXTURES; ++i )
+ for ( i = 0; i != BURNING_MATERIAL_MAX_TEXTURES; ++i )
{
if ( m.getTexture( i ) )
ShaderParam.TextureUnits = i;
@@ -683,11 +683,13 @@ REALINLINE void CBurningShader_Raster_Reference::scanline2()
u32 i;
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
line.c[i][1] = (line.c[i][1] - line.c[i][0]) * invDeltaX;
line.c[i][0] += line.c[i][1] * subPixel;
}
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
@@ -708,10 +710,12 @@ REALINLINE void CBurningShader_Raster_Reference::scanline2()
// advance next pixel
line.w[0] += line.w[1];
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
line.c[i][0] += line.c[i][1];
}
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
line.t[i][0] += line.t[i][1];
@@ -780,11 +784,13 @@ REALINLINE void CBurningShader_Raster_Reference::scanline ()
a = (f32) pShader.i + subPixel;
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
line.c[i][1] = (line.c[i][1] - line.c[i][0]) * invDeltaX;
line.c[i][0] += line.c[i][1] * a;
}
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
@@ -803,11 +809,12 @@ REALINLINE void CBurningShader_Raster_Reference::scanline ()
line.w[0] += line.w[1];
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
line.c[i][0] += line.c[i][1];
}
-
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
line.t[i][0] += line.t[i][1];
@@ -856,11 +863,13 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0];
scan.w[0] = a->Pos.w;
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
scan.c[i][0] = a->Color[i];
scan.slopeC[i][0] = (c->Color[i] - a->Color[i]) * scan.invDeltaY[0];
}
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
@@ -884,12 +893,13 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1];
scan.w[1] = a->Pos.w;
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
scan.c[i][1] = a->Color[i];
scan.slopeC[i][1] = (b->Color[i] - a->Color[i]) * scan.invDeltaY[1];
}
-
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
scan.t[i][1] = a->Tex[i];
@@ -930,12 +940,13 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
line.x[scan.right] = scan.x[1];
line.w[scan.right] = scan.w[1];
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
line.c[i][scan.left] = scan.c[i][0];
line.c[i][scan.right] = scan.c[i][1];
}
-
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
line.t[i][scan.left] = scan.t[i][0];
@@ -977,11 +988,12 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0];
scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0];
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
scan.c[i][0] = a->Color[i] + scan.slopeC[i][0] * temp[0];
}
-
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
scan.t[i][0] = a->Tex[i] + scan.slopeT[i][0] * temp[0];
@@ -995,12 +1007,13 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2];
scan.w[1] = b->Pos.w;
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
scan.c[i][1] = b->Color[i];
scan.slopeC[i][1] = (c->Color[i] - b->Color[i]) * scan.invDeltaY[2];
}
-
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
scan.t[i][1] = b->Tex[i];
@@ -1042,12 +1055,13 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
line.x[scan.right] = scan.x[1];
line.w[scan.right] = scan.w[1];
+#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
for ( i = 0; i != ShaderParam.ColorUnits; ++i )
{
line.c[i][scan.left] = scan.c[i][0];
line.c[i][scan.right] = scan.c[i][1];
}
-
+#endif
for ( i = 0; i != ShaderParam.TextureUnits; ++i )
{
line.t[i][scan.left] = scan.t[i][0];
diff --git a/source/Irrlicht/CFileList.cpp b/source/Irrlicht/CFileList.cpp
index bd786f7c..8da2af88 100644
--- a/source/Irrlicht/CFileList.cpp
+++ b/source/Irrlicht/CFileList.cpp
@@ -24,8 +24,10 @@ namespace io
#endif
#ifdef _IRR_WINDOWS_API_
-#include
-#include
+ #if !defined ( _WIN32_WCE )
+ #include
+ #include
+ #endif
#endif
@@ -38,7 +40,7 @@ CFileList::CFileList()
// --------------------------------------------
// Windows version
#ifdef _IRR_WINDOWS_API_
-
+ #if !defined ( _WIN32_WCE )
char tmp[_MAX_PATH];
_getcwd(tmp, _MAX_PATH);
Path = tmp;
@@ -60,6 +62,7 @@ CFileList::CFileList()
_findclose( hFile );
}
+ #endif
//TODO add drives
//entry.Name = "E:\\";
diff --git a/source/Irrlicht/CFileSystem.cpp b/source/Irrlicht/CFileSystem.cpp
index 0b2dcfab..9d2e612c 100644
--- a/source/Irrlicht/CFileSystem.cpp
+++ b/source/Irrlicht/CFileSystem.cpp
@@ -16,12 +16,14 @@
#include "CAttributes.h"
#include "CMemoryReadFile.h"
-#ifdef _IRR_WINDOWS_API_
-#include // for _chdir
+#if defined (_IRR_WINDOWS_API_)
+ #if !defined ( _WIN32_WCE )
+ #include // for _chdir
+ #endif
#else
-#include
-#include
-#include
+ #include
+ #include
+ #include
#endif
namespace irr
@@ -184,7 +186,9 @@ bool CFileSystem::addPakFileArchive(const c8* filename, bool ignoreCase, bool ig
const c8* CFileSystem::getWorkingDirectory()
{
#ifdef _IRR_WINDOWS_API_
- _getcwd(WorkingDirectory, FILE_SYSTEM_MAX_PATH);
+ #if !defined ( _WIN32_WCE )
+ _getcwd(WorkingDirectory, FILE_SYSTEM_MAX_PATH);
+ #endif
#endif
#if (defined(_IRR_POSIX_API_) || defined(MACOSX))
@@ -202,7 +206,9 @@ bool CFileSystem::changeWorkingDirectoryTo(const c8* newDirectory)
{
bool success=false;
#ifdef _MSC_VER
- success=(_chdir(newDirectory) == 0);
+ #if !defined ( _WIN32_WCE )
+ success=(_chdir(newDirectory) == 0);
+ #endif
#else
success=(chdir(newDirectory) == 0);
#endif
@@ -215,10 +221,11 @@ core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
core::stringc ret;
#ifdef _IRR_WINDOWS_API_
-
- c8 fpath[_MAX_PATH];
- p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
- ret = p;
+ #if !defined ( _WIN32_WCE )
+ c8 fpath[_MAX_PATH];
+ p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
+ ret = p;
+ #endif
#elif (defined(_IRR_POSIX_API_) || defined(MACOSX))
diff --git a/source/Irrlicht/CIrrDeviceWinCE.cpp b/source/Irrlicht/CIrrDeviceWinCE.cpp
new file mode 100644
index 00000000..5dc36dc9
--- /dev/null
+++ b/source/Irrlicht/CIrrDeviceWinCE.cpp
@@ -0,0 +1,811 @@
+// Copyright (C) 2002-2007 Nikolaus Gebhardt
+// This file is part of the "Irrlicht Engine".
+// For conditions of distribution and use, see copyright notice in irrlicht.h
+
+#include "IrrCompileConfig.h"
+
+#ifdef _IRR_USE_WINDOWS_CE_DEVICE_
+
+#include "CIrrDeviceWinCE.h"
+#include "IEventReceiver.h"
+#include "irrList.h"
+#include "os.h"
+
+#include "CTimer.h"
+#include "irrString.h"
+#include "COSOperator.h"
+#include "dimension2d.h"
+#include
+#include "irrlicht.h"
+
+#ifdef _MSC_VER
+ #pragma comment (lib, "aygshell.lib")
+#endif
+
+
+
+namespace irr
+{
+ namespace video
+ {
+ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
+ IVideoDriver* createDirectX8Driver(const core::dimension2d& screenSize, HWND window,
+ u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
+ bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias);
+ #endif
+
+ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
+ IVideoDriver* createDirectX9Driver(const core::dimension2d& screenSize, HWND window,
+ u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io,
+ bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias);
+ #endif
+
+ #ifdef _IRR_COMPILE_WITH_OPENGL_
+ IVideoDriver* createOpenGLDriver(const core::dimension2d& screenSize, HWND window,
+ u32 bits, bool fullscreen, bool stencilBuffer, io::IFileSystem* io,
+ bool vsync, bool antiAlias);
+ #endif
+ }
+} // end namespace irr
+
+
+
+struct SEnvMapper
+{
+ HWND hWnd;
+ irr::CIrrDeviceWinCE* irrDev;
+};
+
+irr::core::list EnvMap;
+
+SEnvMapper* getEnvMapperFromHWnd(HWND hWnd)
+{
+ irr::core::list::Iterator it = EnvMap.begin();
+ for (; it!= EnvMap.end(); ++it)
+ if ((*it).hWnd == hWnd)
+ return &(*it);
+
+ return 0;
+}
+
+irr::CIrrDeviceWinCE* getDeviceFromHWnd(HWND hWnd)
+{
+ irr::core::list::Iterator it = EnvMap.begin();
+ for (; it!= EnvMap.end(); ++it)
+ if ((*it).hWnd == hWnd)
+ return (*it).irrDev;
+
+ return 0;
+}
+
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ #ifndef WM_MOUSEWHEEL
+ #define WM_MOUSEWHEEL 0x020A
+ #endif
+ #ifndef WHEEL_DELTA
+ #define WHEEL_DELTA 120
+ #endif
+
+ irr::CIrrDeviceWinCE* dev = 0;
+ irr::SEvent event;
+ SEnvMapper* envm = 0;
+
+ //BYTE allKeys[256];
+
+ static irr::s32 ClickCount=0;
+ if (GetCapture() != hWnd && ClickCount > 0)
+ ClickCount = 0;
+
+ switch (message)
+ {
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ BeginPaint(hWnd, &ps);
+ EndPaint(hWnd, &ps);
+ }
+ return 0;
+
+ case WM_ERASEBKGND:
+ return 0;
+
+ case WM_SETCURSOR:
+ envm = getEnvMapperFromHWnd(hWnd);
+ if (envm && !envm->irrDev->getWin32CursorControl()->isVisible())
+ {
+ SetCursor(NULL);
+ return 0;
+ }
+ break;
+
+ case WM_MOUSEWHEEL:
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Wheel = ((irr::f32)((short)HIWORD(wParam))) / (irr::f32)WHEEL_DELTA;
+ event.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
+
+ POINT p; // fixed by jox
+ p.x = 0; p.y = 0;
+ ClientToScreen(hWnd, &p);
+ event.MouseInput.X = LOWORD(lParam) - p.x;
+ event.MouseInput.Y = HIWORD(lParam) - p.y;
+
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ break;
+
+ case WM_LBUTTONDOWN:
+ ClickCount++;
+ SetCapture(hWnd);
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+
+ case WM_LBUTTONUP:
+ ClickCount--;
+ if (ClickCount<1)
+ {
+ ClickCount=0;
+ ReleaseCapture();
+ }
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_LMOUSE_LEFT_UP;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+
+ case WM_RBUTTONDOWN:
+ ClickCount++;
+ SetCapture(hWnd);
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+
+ case WM_RBUTTONUP:
+ ClickCount--;
+ if (ClickCount<1)
+ {
+ ClickCount=0;
+ ReleaseCapture();
+ }
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+
+ case WM_MBUTTONDOWN:
+ ClickCount++;
+ SetCapture(hWnd);
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_MMOUSE_PRESSED_DOWN;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+
+ case WM_MBUTTONUP:
+ ClickCount--;
+ if (ClickCount<1)
+ {
+ ClickCount=0;
+ ReleaseCapture();
+ }
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_MMOUSE_LEFT_UP;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ event.EventType = irr::EET_MOUSE_INPUT_EVENT;
+ event.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
+ event.MouseInput.X = (short)LOWORD(lParam);
+ event.MouseInput.Y = (short)HIWORD(lParam);
+ dev = getDeviceFromHWnd(hWnd);
+
+ if (dev)
+ dev->postEventFromUser(event);
+
+ return 0;
+
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ {
+ event.EventType = irr::EET_KEY_INPUT_EVENT;
+ event.KeyInput.Key = (irr::EKEY_CODE)wParam;
+ event.KeyInput.PressedDown = (message==WM_KEYDOWN);
+ dev = getDeviceFromHWnd(hWnd);
+/*
+ WORD KeyAsc=0;
+ GetKeyboardState(allKeys);
+ ToAscii(wParam,lParam,allKeys,&KeyAsc,0);
+*/
+// event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0);
+// event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0);
+// event.KeyInput.Char = (KeyAsc & 0x00ff); //KeyAsc >= 0 ? KeyAsc : 0;
+
+ if (dev)
+ dev->postEventFromUser(event);
+
+ return 0;
+ }
+
+ case WM_SIZE:
+ {
+ // resize
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->OnResized();
+ }
+ return 0;
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+
+ }
+
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+namespace irr
+{
+
+//! constructor
+CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType,
+ core::dimension2d windowSize,
+ u32 bits, bool fullscreen,
+ bool stencilbuffer, bool vsync,
+ bool antiAlias,
+ bool highPrecisionFPU,
+ IEventReceiver* receiver,
+ HWND externalWindow,
+ const char* version)
+: CIrrDeviceStub(version, receiver), HWnd(0), ChangedToFullScreen(false),
+ FullScreen(fullscreen), Resized(false),
+ ExternalWindow(false), Win32CursorControl(0)
+{
+ core::stringc winversion;
+ getWindowsVersion(winversion);
+ Operator = new COSOperator(winversion.c_str());
+ os::Printer::log(winversion.c_str(), ELL_INFORMATION);
+
+ // create window
+
+ HINSTANCE hInstance = GetModuleHandle(0);
+
+ #ifdef _DEBUG
+ setDebugName("CIrrDeviceWinCE");
+ #endif
+
+ // create the window, only if we do not use the null device
+ if (driverType != video::EDT_NULL && externalWindow==0)
+ {
+ const wchar_t* ClassName = L"CIrrDeviceWinCE";
+
+ // Register Class
+ WNDCLASS wc;
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = 0;
+ wc.lpszClassName = ClassName;
+
+ // if there is an icon, load it
+ wc.hIcon = (HICON)LoadImageW(hInstance, L"irrlicht.ico", IMAGE_ICON, 0,0, 0);
+
+ RegisterClass(&wc);
+
+ // calculate client size
+
+ RECT clientSize;
+ clientSize.top = 0;
+ clientSize.left = 0;
+ clientSize.right = windowSize.Width;
+ clientSize.bottom = windowSize.Height;
+
+ DWORD style = WS_POPUP;
+
+ if (!fullscreen)
+ style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+
+ AdjustWindowRectEx(&clientSize, style, FALSE, 0);
+
+ s32 realWidth = clientSize.right - clientSize.left;
+ s32 realHeight = clientSize.bottom - clientSize.top;
+
+ s32 windowLeft = core::s32_max ( 0, (GetSystemMetrics(SM_CXSCREEN) - realWidth) >> 1 );
+ s32 windowTop = core::s32_max ( 0, (GetSystemMetrics(SM_CYSCREEN) - realHeight) >> 1 );
+
+ // create window
+
+ HWnd = CreateWindowW( ClassName, L"", style, windowLeft, windowTop,
+ realWidth, realHeight, NULL, NULL, hInstance, NULL);
+
+ ShowWindow(HWnd , SW_SHOW);
+ UpdateWindow(HWnd);
+
+ // fix ugly ATI driver bugs. Thanks to ariaci
+ MoveWindow(HWnd, windowLeft, windowTop, realWidth, realHeight, TRUE);
+ }
+
+ // attach external window
+ if (externalWindow)
+ {
+ HWnd = externalWindow;
+ RECT r;
+ GetWindowRect(HWnd, &r);
+ windowSize.Width = r.right - r.left;
+ windowSize.Height = r.bottom - r.top;
+ fullscreen = false;
+ ExternalWindow = true;
+ }
+
+ // create cursor control
+
+ Win32CursorControl = new CCursorControl(windowSize, HWnd, fullscreen);
+ CursorControl = Win32CursorControl;
+
+ // create driver
+
+ createDriver(driverType, windowSize, bits, fullscreen, stencilbuffer, vsync, antiAlias, highPrecisionFPU);
+
+ if (VideoDriver)
+ createGUIAndScene();
+
+ // register environment
+
+ SEnvMapper em;
+ em.irrDev = this;
+ em.hWnd = HWnd;
+ EnvMap.push_back(em);
+
+ // set this as active window
+ SetActiveWindow(HWnd);
+ SetForegroundWindow(HWnd);
+}
+
+
+
+//! destructor
+CIrrDeviceWinCE::~CIrrDeviceWinCE()
+{
+ // unregister environment
+
+ if (ChangedToFullScreen)
+ SHFullScreen(HWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
+
+ irr::core::list::Iterator it = EnvMap.begin();
+ for (; it!= EnvMap.end(); ++it)
+ if ((*it).hWnd == HWnd)
+ {
+ EnvMap.erase(it);
+ break;
+ }
+
+
+}
+
+
+
+//! create the driver
+void CIrrDeviceWinCE::createDriver(video::E_DRIVER_TYPE driverType,
+ const core::dimension2d& windowSize,
+ u32 bits,
+ bool fullscreen,
+ bool stencilbuffer,
+ bool vsync,
+ bool antiAlias,
+ bool highPrecisionFPU)
+{
+ switch(driverType)
+ {
+ case video::EDT_DIRECT3D8:
+ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
+ VideoDriver = video::createDirectX8Driver(windowSize, HWnd, bits, fullscreen,
+ stencilbuffer, FileSystem, false, highPrecisionFPU, vsync, antiAlias);
+ if (!VideoDriver)
+ {
+ os::Printer::log("Could not create DIRECT3D8 Driver.", ELL_ERROR);
+ }
+ #else
+ os::Printer::log("DIRECT3D8 Driver was not compiled into this dll. Try another one.", ELL_ERROR);
+ #endif // _IRR_COMPILE_WITH_DIRECT3D_8_
+
+ break;
+
+ case video::EDT_DIRECT3D9:
+ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
+ VideoDriver = video::createDirectX9Driver(windowSize, HWnd, bits, fullscreen,
+ stencilbuffer, FileSystem, false, highPrecisionFPU, vsync, antiAlias);
+ if (!VideoDriver)
+ {
+ os::Printer::log("Could not create DIRECT3D9 Driver.", ELL_ERROR);
+ }
+ #else
+ os::Printer::log("DIRECT3D9 Driver was not compiled into this dll. Try another one.", ELL_ERROR);
+ #endif // _IRR_COMPILE_WITH_DIRECT3D_9_
+
+ break;
+
+ case video::EDT_OPENGL:
+
+ #ifdef _IRR_COMPILE_WITH_OPENGL_
+ if (fullscreen) switchToFullScreen(windowSize.Width, windowSize.Height, bits);
+ VideoDriver = video::createOpenGLDriver(windowSize, HWnd, bits, fullscreen, stencilbuffer, FileSystem,
+ vsync, antiAlias);
+ if (!VideoDriver)
+ {
+ os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
+ }
+ #else
+ os::Printer::log("OpenGL driver was not compiled in.", ELL_ERROR);
+ #endif
+ break;
+
+ case video::EDT_SOFTWARE:
+
+ #ifdef _IRR_COMPILE_WITH_SOFTWARE_
+ if (fullscreen) switchToFullScreen(windowSize.Width, windowSize.Height, bits);
+ VideoDriver = video::createSoftwareDriver(windowSize, fullscreen, FileSystem, this);
+ #else
+ os::Printer::log("Software driver was not compiled in.", ELL_ERROR);
+ #endif
+
+ break;
+
+ case video::EDT_BURNINGSVIDEO:
+ #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
+ if (fullscreen) switchToFullScreen(windowSize.Width, windowSize.Height, bits);
+ VideoDriver = video::createSoftwareDriver2(windowSize, fullscreen, FileSystem, this);
+ #else
+ os::Printer::log("Burning's Video driver was not compiled in.", ELL_ERROR);
+ #endif
+ break;
+
+ case video::EDT_NULL:
+ // create null driver
+ VideoDriver = video::createNullDriver(FileSystem, windowSize);
+ break;
+
+ default:
+ os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR);
+ break;
+ }
+}
+
+
+
+//! runs the device. Returns false if device wants to be deleted
+bool CIrrDeviceWinCE::run()
+{
+ os::Timer::tick();
+
+ MSG msg;
+
+ bool quit = false;
+
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&msg);
+
+ if (ExternalWindow && msg.hwnd == HWnd)
+ WndProc(HWnd, msg.message, msg.wParam, msg.lParam);
+ else
+ DispatchMessage(&msg);
+
+ if (msg.message == WM_QUIT)
+ quit = true;
+ }
+
+ if (!quit)
+ resizeIfNecessary();
+
+ _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
+ return !quit;
+}
+
+
+//! Pause the current process for the minimum time allowed only to allow other processes to execute
+void CIrrDeviceWinCE::yield()
+{
+ Sleep(1);
+
+}
+
+//! Pause execution and let other processes to run for a specified amount of time.
+void CIrrDeviceWinCE::sleep(u32 timeMs, bool pauseTimer)
+{
+ bool wasStopped = Timer ? Timer->isStopped() : true;
+ if (pauseTimer && !wasStopped)
+ Timer->stop();
+
+ Sleep(timeMs);
+
+ if (pauseTimer && !wasStopped)
+ Timer->start();
+}
+
+
+void CIrrDeviceWinCE::resizeIfNecessary()
+{
+ if (!Resized)
+ return;
+
+ RECT r;
+ GetClientRect(HWnd, &r);
+
+ char tmp[255];
+
+ if (r.right < 2 || r.bottom < 2)
+ {
+ sprintf(tmp, "Ignoring resize operation to (%ld %ld)", r.right, r.bottom);
+ os::Printer::log(tmp);
+ }
+ else
+ {
+ sprintf(tmp, "Resizing window (%ld %ld)", r.right, r.bottom);
+ os::Printer::log(tmp);
+
+ getVideoDriver()->OnResize(irr::core::dimension2d(r.right, r.bottom));
+ }
+
+ Resized = false;
+}
+
+
+
+//! sets the caption of the window
+void CIrrDeviceWinCE::setWindowCaption(const wchar_t* text)
+{
+ SetWindowTextW(HWnd, text);
+}
+
+#if !defined(BITMAPV4HEADER)
+
+
+typedef struct {
+ DWORD bV4Size;
+ LONG bV4Width;
+ LONG bV4Height;
+ WORD bV4Planes;
+ WORD bV4BitCount;
+ DWORD bV4V4Compression;
+ DWORD bV4SizeImage;
+ LONG bV4XPelsPerMeter;
+ LONG bV4YPelsPerMeter;
+ DWORD bV4ClrUsed;
+ DWORD bV4ClrImportant;
+ DWORD bV4RedMask;
+ DWORD bV4GreenMask;
+ DWORD bV4BlueMask;
+ DWORD bV4AlphaMask;
+ DWORD bV4CSType;
+ DWORD un[9];
+} BITMAPV4HEADER, *PBITMAPV4HEADER;
+#endif
+
+//! presents a surface in the client area
+void CIrrDeviceWinCE::present(video::IImage* image, s32 windowId, core::rect* src )
+{
+ HWND hwnd = HWnd;
+ if ( windowId )
+ hwnd = (HWND)windowId;
+
+ HDC dc = GetDC(hwnd);
+
+ if ( dc )
+ {
+ RECT rect;
+ GetClientRect(hwnd, &rect);
+ const void* memory = (const void *)image->lock();
+
+ BITMAPV4HEADER bi;
+ memset (&bi, 0, sizeof(bi));
+ bi.bV4Size = sizeof(BITMAPINFOHEADER);
+ bi.bV4BitCount = image->getBitsPerPixel();
+ bi.bV4Planes = 1;
+ bi.bV4Width = image->getDimension().Width;
+ bi.bV4Height = -image->getDimension().Height;
+ bi.bV4V4Compression = BI_BITFIELDS;
+ bi.bV4AlphaMask = image->getAlphaMask ();
+ bi.bV4RedMask = image->getRedMask ();
+ bi.bV4GreenMask = image->getGreenMask();
+ bi.bV4BlueMask = image->getBlueMask();
+
+ int r = 0;
+ if ( src )
+ {
+ r = StretchDIBits(dc, 0,0, rect.right, rect.bottom,
+ src->UpperLeftCorner.X, src->UpperLeftCorner.Y,
+ src->getWidth(), src->getHeight(),
+ memory, (const BITMAPINFO*)(&bi), DIB_RGB_COLORS, SRCCOPY);
+ }
+ else
+ {
+ r = StretchDIBits(dc, 0,0, rect.right, rect.bottom,
+ 0, 0, image->getDimension().Width, image->getDimension().Height,
+ memory, (const BITMAPINFO*)(&bi), DIB_RGB_COLORS, SRCCOPY);
+ }
+
+
+ image->unlock();
+
+ ReleaseDC(hwnd, dc);
+ }
+}
+
+
+
+//! notifies the device that it should close itself
+void CIrrDeviceWinCE::closeDevice()
+{
+ MSG msg;
+ PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
+ PostQuitMessage(0);
+ PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
+ DestroyWindow(HWnd);
+}
+
+
+
+//! returns if window is active. if not, nothing need to be drawn
+bool CIrrDeviceWinCE::isWindowActive() const
+{
+ bool ret = (GetActiveWindow() == HWnd);
+ _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
+ return ret;
+}
+
+
+
+//! switches to fullscreen
+bool CIrrDeviceWinCE::switchToFullScreen(s32 width, s32 height, s32 bits)
+{
+ ChangedToFullScreen = SHFullScreen(HWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR) != 0;
+ return ChangedToFullScreen;
+}
+
+
+//! returns the win32 cursor control
+CIrrDeviceWinCE::CCursorControl* CIrrDeviceWinCE::getWin32CursorControl()
+{
+ return Win32CursorControl;
+}
+
+
+//! \return Returns a pointer to a list with all video modes supported
+//! by the gfx adapter.
+video::IVideoModeList* CIrrDeviceWinCE::getVideoModeList()
+{
+ if (!VideoModeList.getVideoModeCount())
+ {
+ // enumerate video modes.
+ DWORD i=0;
+ DEVMODE mode;
+ memset(&mode, 0, sizeof(mode));
+ mode.dmSize = sizeof(mode);
+
+ while (EnumDisplaySettings(NULL, i, &mode))
+ {
+ VideoModeList.addMode(core::dimension2d(mode.dmPelsWidth, mode.dmPelsHeight),
+ mode.dmBitsPerPel);
+
+ ++i;
+ }
+
+ if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode))
+ VideoModeList.setDesktop(mode.dmBitsPerPel, core::dimension2d(mode.dmPelsWidth, mode.dmPelsHeight));
+ }
+
+ return &VideoModeList;
+}
+
+
+void CIrrDeviceWinCE::getWindowsVersion(core::stringc& out)
+{
+ out = "WinCE";
+}
+
+//! Notifies the device, that it has been resized
+void CIrrDeviceWinCE::OnResized()
+{
+ Resized = true;
+}
+
+//! Sets if the window should be resizeable in windowed mode.
+void CIrrDeviceWinCE::setResizeAble(bool resize)
+{
+ if (ExternalWindow || !getVideoDriver() || FullScreen)
+ return;
+
+ LONG style = WS_POPUP;
+
+ if (!resize)
+ style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+ else
+ style = WS_THICKFRAME | WS_SYSMENU | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MAXIMIZEBOX;
+
+ if (!SetWindowLong(HWnd, GWL_STYLE, style))
+ os::Printer::log("Could not change window style.");
+
+ RECT clientSize;
+ clientSize.top = 0;
+ clientSize.left = 0;
+ clientSize.right = getVideoDriver()->getScreenSize().Width;
+ clientSize.bottom = getVideoDriver()->getScreenSize().Height;
+
+ AdjustWindowRectEx(&clientSize, style, FALSE, 0);
+
+ s32 realWidth = clientSize.right - clientSize.left;
+ s32 realHeight = clientSize.bottom - clientSize.top;
+
+ s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
+ s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2;
+
+ SetWindowPos(HWnd, HWND_TOP, windowLeft, windowTop, realWidth, realHeight,
+ SWP_FRAMECHANGED | SWP_NOMOVE | SWP_SHOWWINDOW);
+}
+
+
+IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
+ const SIrrlichtCreationParameters& parameters)
+{
+ CIrrDeviceWinCE* dev = new CIrrDeviceWinCE(
+ parameters.DriverType,
+ parameters.WindowSize,
+ parameters.Bits,
+ parameters.Fullscreen,
+ parameters.Stencilbuffer,
+ parameters.Vsync,
+ parameters.AntiAlias,
+ parameters.HighPrecisionFPU,
+ parameters.EventReceiver,
+ reinterpret_cast(parameters.WindowId),
+ parameters.SDK_version_do_not_use);
+
+ 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_
+
diff --git a/source/Irrlicht/CIrrDeviceWinCE.h b/source/Irrlicht/CIrrDeviceWinCE.h
new file mode 100644
index 00000000..66d495e5
--- /dev/null
+++ b/source/Irrlicht/CIrrDeviceWinCE.h
@@ -0,0 +1,264 @@
+// Copyright (C) 2002-2007 Nikolaus Gebhardt
+// This file is part of the "Irrlicht Engine".
+// For conditions of distribution and use, see copyright notice in irrlicht.h
+
+#ifndef __C_IRR_DEVICE_WINCE_H_INCLUDED__
+#define __C_IRR_DEVICE_WINCE_H_INCLUDED__
+
+#include "IrrCompileConfig.h"
+#ifdef _IRR_USE_WINDOWS_CE_DEVICE_
+
+#include "CIrrDeviceStub.h"
+#include "IrrlichtDevice.h"
+#include "IImagePresenter.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace irr
+{
+ class CIrrDeviceWinCE : public CIrrDeviceStub, video::IImagePresenter
+ {
+ public:
+
+ //! constructor
+ CIrrDeviceWinCE(video::E_DRIVER_TYPE deviceType,
+ core::dimension2d windowSize, u32 bits,
+ bool fullscreen, bool stencilbuffer, bool vsync,
+ bool antiAlias, bool highPrecisionFPU,
+ IEventReceiver* receiver,
+ HWND window,
+ const char* version);
+
+ //! destructor
+ virtual ~CIrrDeviceWinCE();
+
+ //! runs the device. Returns false if device wants to be deleted
+ virtual bool run();
+
+ //! Cause the device to temporarily pause execution and let other processes to run
+ // This should bring down processor usage without major performance loss for Irrlicht
+ virtual void yield();
+
+ //! Pause execution and let other processes to run for a specified amount of time.
+ virtual void sleep(u32 timeMs, bool pauseTimer);
+
+ //! sets the caption of the window
+ virtual void setWindowCaption(const wchar_t* text);
+
+ //! returns if window is active. if not, nothing need to be drawn
+ virtual bool isWindowActive() const;
+
+ //! presents a surface in the client area
+ virtual void present(video::IImage* surface, s32 windowId = 0, core::rect* src=0 );
+
+ //! notifies the device that it should close itself
+ virtual void closeDevice();
+
+ //! \return Returns a pointer to a list with all video modes
+ //! supported by the gfx adapter.
+ video::IVideoModeList* getVideoModeList();
+
+ //! Notifies the device, that it has been resized
+ void OnResized();
+
+ //! Sets if the window should be resizeable in windowed mode.
+ virtual void setResizeAble(bool resize=false);
+
+ //! Implementation of the win32 cursor control
+ class CCursorControl : public gui::ICursorControl
+ {
+ public:
+
+ CCursorControl(const core::dimension2d& wsize, HWND hwnd, bool fullscreen)
+ : WindowSize(wsize), InvWindowSize(0.0f, 0.0f), IsVisible(true),
+ HWnd(hwnd), BorderX(0), BorderY(0), UseReferenceRect(false)
+ {
+ if (WindowSize.Width!=0)
+ InvWindowSize.Width = 1.0f / WindowSize.Width;
+
+ if (WindowSize.Height!=0)
+ InvWindowSize.Height = 1.0f / WindowSize.Height;
+
+ if (!fullscreen)
+ {
+ BorderX = GetSystemMetrics(SM_CXDLGFRAME);
+ BorderY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYDLGFRAME);
+ }
+ }
+
+ //! Changes the visible state of the mouse cursor.
+ virtual void setVisible(bool visible)
+ {
+ IsVisible = visible;
+ }
+
+ //! Returns if the cursor is currently visible.
+ virtual bool isVisible() const
+ {
+ _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
+ return IsVisible;
+ }
+
+ //! Sets the new position of the cursor.
+ virtual void setPosition(const core::position2d &pos)
+ {
+ setPosition(pos.X, pos.Y);
+ }
+
+ //! Sets the new position of the cursor.
+ virtual void setPosition(f32 x, f32 y)
+ {
+ if (!UseReferenceRect)
+ setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height));
+ else
+ setPosition((s32)(x*ReferenceRect.getWidth()), (s32)(y*ReferenceRect.getHeight()));
+ }
+
+ //! Sets the new position of the cursor.
+ virtual void setPosition(const core::position2d &pos)
+ {
+ setPosition(pos.X, pos.Y);
+ }
+
+ //! Sets the new position of the cursor.
+ virtual void setPosition(s32 x, s32 y)
+ {
+ RECT rect;
+
+ if (UseReferenceRect)
+ {
+ SetCursorPos(ReferenceRect.UpperLeftCorner.X + x,
+ ReferenceRect.UpperLeftCorner.Y + y);
+ }
+ else
+ {
+ if (GetWindowRect(HWnd, &rect))
+ SetCursorPos(x + rect.left + BorderX, y + rect.top + BorderY);
+ }
+
+ CursorPos.X = x;
+ CursorPos.Y = y;
+ }
+
+ //! Returns the current position of the mouse cursor.
+ virtual core::position2d getPosition()
+ {
+ updateInternalCursorPosition();
+ return CursorPos;
+ }
+
+ //! Returns the current position of the mouse cursor.
+ virtual core::position2d getRelativePosition()
+ {
+ updateInternalCursorPosition();
+
+ if (!UseReferenceRect)
+ {
+ return core::position2d(CursorPos.X * InvWindowSize.Width,
+ CursorPos.Y * InvWindowSize.Height);
+ }
+
+ return core::position2d(CursorPos.X / (f32)ReferenceRect.getWidth(),
+ CursorPos.Y / (f32)ReferenceRect.getHeight());
+ }
+
+ //! Sets an absolute reference rect for calculating the cursor position.
+ virtual void setReferenceRect(core::rect* rect=0)
+ {
+ if (rect)
+ {
+ ReferenceRect = *rect;
+ UseReferenceRect = true;
+
+ // prevent division through zero and uneven sizes
+
+ if (!ReferenceRect.getHeight() || ReferenceRect.getHeight()%2)
+ ReferenceRect.LowerRightCorner.Y += 1;
+
+ if (!ReferenceRect.getWidth() || ReferenceRect.getWidth()%2)
+ ReferenceRect.LowerRightCorner.X += 1;
+ }
+ else
+ UseReferenceRect = false;
+ }
+
+ private:
+
+ //! Updates the internal cursor position
+ void updateInternalCursorPosition()
+ {
+ POINT p;
+ GetCursorPos(&p);
+ RECT rect;
+
+ if (UseReferenceRect)
+ {
+ CursorPos.X = p.x - ReferenceRect.UpperLeftCorner.X;
+ CursorPos.Y = p.y - ReferenceRect.UpperLeftCorner.Y;
+ }
+ else
+ {
+ if (GetWindowRect(HWnd, &rect))
+ {
+ CursorPos.X = p.x-rect.left-BorderX;
+ CursorPos.Y = p.y-rect.top-BorderY;
+ }
+ else
+ {
+ // window seems not to be existent, so set cursor to
+ // a negative value
+ CursorPos.X = -1;
+ CursorPos.Y = -1;
+ }
+ }
+ }
+
+ core::position2d CursorPos;
+ core::dimension2d WindowSize;
+ core::dimension2d InvWindowSize;
+ bool IsVisible;
+ HWND HWnd;
+
+ s32 BorderX, BorderY;
+ bool UseReferenceRect;
+ core::rect ReferenceRect;
+ };
+
+
+ //! returns the win32 cursor control
+ CCursorControl* getWin32CursorControl();
+
+ private:
+
+ //! create the driver
+ void createDriver(video::E_DRIVER_TYPE driverType,
+ const core::dimension2d& windowSize, u32 bits, bool fullscreen,
+ bool stencilbuffer, bool vsync, bool antiAlias, bool highPrecisionFPU);
+
+ //! switchs to fullscreen
+ bool switchToFullScreen(s32 width, s32 height, s32 bits);
+
+ void getWindowsVersion(core::stringc& version);
+
+ void resizeIfNecessary();
+
+ HWND HWnd;
+
+ bool ChangedToFullScreen;
+ bool FullScreen;
+ bool Resized;
+ bool ExternalWindow;
+ CCursorControl* Win32CursorControl;
+ };
+
+
+} // end namespace irr
+
+#endif
+#endif
+
diff --git a/source/Irrlicht/COSOperator.cpp b/source/Irrlicht/COSOperator.cpp
index 4f0e3474..8699fac6 100644
--- a/source/Irrlicht/COSOperator.cpp
+++ b/source/Irrlicht/COSOperator.cpp
@@ -97,7 +97,7 @@ c8* COSOperator::getTextFromClipboard() const
bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
{
-#if defined(_IRR_WINDOWS_API_)
+#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE )
LONG Error;
HKEY Key;
diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h
index 243d5cee..31030225 100644
--- a/source/Irrlicht/COpenGLExtensionHandler.h
+++ b/source/Irrlicht/COpenGLExtensionHandler.h
@@ -5,6 +5,9 @@
#ifndef __C_OPEN_GL_FEATURE_MAP_H_INCLUDED__
#define __C_OPEN_GL_FEATURE_MAP_H_INCLUDED__
+#include "IrrCompileConfig.h"
+#ifdef _IRR_COMPILE_WITH_OPENGL_
+
#include "EDriverFeatures.h"
#include "irrTypes.h"
#include "os.h"
@@ -1493,3 +1496,4 @@ inline void COpenGLExtensionHandler::extGlGetBufferPointerv (GLenum target, GLen
#endif
+#endif
diff --git a/source/Irrlicht/CSoftwareDriver2.cpp b/source/Irrlicht/CSoftwareDriver2.cpp
index 2b7bd6a0..53533d31 100644
--- a/source/Irrlicht/CSoftwareDriver2.cpp
+++ b/source/Irrlicht/CSoftwareDriver2.cpp
@@ -1155,7 +1155,7 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
// select mipmap
for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g )
- //for ( g = 0; g != MATERIAL_MAX_TEXTURES; ++g )
+ //for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g )
{
if ( 0 == MAT_TEXTURE ( g ) )
{
@@ -1268,7 +1268,7 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
continue;
// select mipmap
- //for ( g = 0; g != MATERIAL_MAX_TEXTURES; ++g )
+ //for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g )
for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g )
{
if ( 0 == MAT_TEXTURE ( g ) )
diff --git a/source/Irrlicht/CSoftwareTexture2.cpp b/source/Irrlicht/CSoftwareTexture2.cpp
index 2a980439..f04f7f97 100644
--- a/source/Irrlicht/CSoftwareTexture2.cpp
+++ b/source/Irrlicht/CSoftwareTexture2.cpp
@@ -44,7 +44,7 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool gener
}
else
{
- os::Printer::log ( "Burningvideo: Warning Texture reformat", ELL_WARNING );
+ //os::Printer::log ( "Burningvideo: Warning Texture reformat", ELL_WARNING );
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, optSize);
// temporary CImage needed
diff --git a/source/Irrlicht/CTRTextureBlend.cpp b/source/Irrlicht/CTRTextureBlend.cpp
index fc47d0bf..ca79e100 100644
--- a/source/Irrlicht/CTRTextureBlend.cpp
+++ b/source/Irrlicht/CTRTextureBlend.cpp
@@ -144,7 +144,7 @@ void CTRTextureBlend::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureDetailMap2.cpp b/source/Irrlicht/CTRTextureDetailMap2.cpp
index 72c50cad..bd43e532 100644
--- a/source/Irrlicht/CTRTextureDetailMap2.cpp
+++ b/source/Irrlicht/CTRTextureDetailMap2.cpp
@@ -134,7 +134,7 @@ void CTRTextureDetailMap2::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureGouraud2.cpp b/source/Irrlicht/CTRTextureGouraud2.cpp
index 81c5e483..296bf051 100644
--- a/source/Irrlicht/CTRTextureGouraud2.cpp
+++ b/source/Irrlicht/CTRTextureGouraud2.cpp
@@ -133,7 +133,7 @@ void CTRTextureGouraud2::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
@@ -197,8 +197,9 @@ void CTRTextureGouraud2::scanline_bilinear ()
tFixPoint tx0;
tFixPoint ty0;
-#ifdef IPOL_C0
tFixPoint r0, g0, b0;
+
+#ifdef IPOL_C0
tFixPoint r1, g1, b1;
#endif
diff --git a/source/Irrlicht/CTRTextureGouraudAdd2.cpp b/source/Irrlicht/CTRTextureGouraudAdd2.cpp
index 5960a665..d4b38546 100644
--- a/source/Irrlicht/CTRTextureGouraudAdd2.cpp
+++ b/source/Irrlicht/CTRTextureGouraudAdd2.cpp
@@ -133,7 +133,7 @@ void CTRTextureGouraudAdd2::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureGouraudAddNoZ2.cpp b/source/Irrlicht/CTRTextureGouraudAddNoZ2.cpp
index 5b3da86a..45babdfd 100644
--- a/source/Irrlicht/CTRTextureGouraudAddNoZ2.cpp
+++ b/source/Irrlicht/CTRTextureGouraudAddNoZ2.cpp
@@ -133,7 +133,7 @@ void CTRTextureGouraudAddNoZ2::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureGouraudAlpha.cpp b/source/Irrlicht/CTRTextureGouraudAlpha.cpp
index 102d776f..00433954 100644
--- a/source/Irrlicht/CTRTextureGouraudAlpha.cpp
+++ b/source/Irrlicht/CTRTextureGouraudAlpha.cpp
@@ -150,7 +150,7 @@ void CTRTextureGouraudAlpha2::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureGouraudAlphaNoZ.cpp b/source/Irrlicht/CTRTextureGouraudAlphaNoZ.cpp
index cc2fdaba..ee6c7aef 100644
--- a/source/Irrlicht/CTRTextureGouraudAlphaNoZ.cpp
+++ b/source/Irrlicht/CTRTextureGouraudAlphaNoZ.cpp
@@ -150,7 +150,7 @@ void CTRTextureGouraudAlphaNoZ::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureGouraudNoZ2.cpp b/source/Irrlicht/CTRTextureGouraudNoZ2.cpp
index aeca247b..cf9e6527 100644
--- a/source/Irrlicht/CTRTextureGouraudNoZ2.cpp
+++ b/source/Irrlicht/CTRTextureGouraudNoZ2.cpp
@@ -138,7 +138,7 @@ void CTRTextureGouraudNoZ2::scanline_bilinear ( )
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureGouraudVertexAlpha2.cpp b/source/Irrlicht/CTRTextureGouraudVertexAlpha2.cpp
index 2b1ad285..073b243c 100644
--- a/source/Irrlicht/CTRTextureGouraudVertexAlpha2.cpp
+++ b/source/Irrlicht/CTRTextureGouraudVertexAlpha2.cpp
@@ -132,7 +132,7 @@ void CTRTextureVertexAlpha2::scanline_bilinear ( )
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureLightMap2_Add.cpp b/source/Irrlicht/CTRTextureLightMap2_Add.cpp
index 62f8b9e8..6175787a 100644
--- a/source/Irrlicht/CTRTextureLightMap2_Add.cpp
+++ b/source/Irrlicht/CTRTextureLightMap2_Add.cpp
@@ -133,7 +133,7 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/CTRTextureLightMapGouraud2_M4.cpp b/source/Irrlicht/CTRTextureLightMapGouraud2_M4.cpp
index 8a610984..366780a1 100644
--- a/source/Irrlicht/CTRTextureLightMapGouraud2_M4.cpp
+++ b/source/Irrlicht/CTRTextureLightMapGouraud2_M4.cpp
@@ -133,7 +133,7 @@ void CTRGTextureLightMap2_M4::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
- sVec2 slopeT[MATERIAL_MAX_TEXTURES];
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
diff --git a/source/Irrlicht/IBurningShader.cpp b/source/Irrlicht/IBurningShader.cpp
index 69bcd42a..431a2ff9 100644
--- a/source/Irrlicht/IBurningShader.cpp
+++ b/source/Irrlicht/IBurningShader.cpp
@@ -29,7 +29,7 @@ namespace video
setDebugName("IBurningShader");
#endif
- for ( u32 i = 0; i != MATERIAL_MAX_TEXTURES; ++i )
+ for ( u32 i = 0; i != BURNING_MATERIAL_MAX_TEXTURES; ++i )
{
IT[i].Texture = 0;
}
@@ -48,7 +48,7 @@ namespace video
if (DepthBuffer)
DepthBuffer->drop();
- for ( u32 i = 0; i != MATERIAL_MAX_TEXTURES; ++i )
+ for ( u32 i = 0; i != BURNING_MATERIAL_MAX_TEXTURES; ++i )
{
if ( IT[i].Texture )
IT[i].Texture->drop();
diff --git a/source/Irrlicht/IBurningShader.h b/source/Irrlicht/IBurningShader.h
index 726af3fd..0d95eee8 100644
--- a/source/Irrlicht/IBurningShader.h
+++ b/source/Irrlicht/IBurningShader.h
@@ -125,7 +125,7 @@ namespace video
fp24* lockedDepthBuffer;
tVideoSample* lockedSurface;
- sInternalTexture IT[ MATERIAL_MAX_TEXTURES ];
+ sInternalTexture IT[ BURNING_MATERIAL_MAX_TEXTURES ];
static const tFixPointu dithermask[ 4 * 4];
};
diff --git a/source/Irrlicht/Irrlicht.cpp b/source/Irrlicht/Irrlicht.cpp
index ade41f7b..59141b50 100644
--- a/source/Irrlicht/Irrlicht.cpp
+++ b/source/Irrlicht/Irrlicht.cpp
@@ -8,7 +8,7 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2007 Nikolaus Geb
#ifdef _IRR_WINDOWS_
#include
- #if defined(_DEBUG) && !defined(__GNUWIN32__)
+ #if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(_WIN32_WCE)
#include
#endif // _DEBUG
#endif
@@ -55,7 +55,7 @@ BOOL APIENTRY DllMain( HANDLE hModule,
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
- #if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__)
+ #if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__) && !defined (_WIN32_WCE)
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
#endif
break;
diff --git a/source/Irrlicht/Irrlicht_mobile6.sln b/source/Irrlicht/Irrlicht_mobile6.sln
new file mode 100644
index 00000000..be319a34
--- /dev/null
+++ b/source/Irrlicht/Irrlicht_mobile6.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht_mobile6.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/source/Irrlicht/Irrlicht_mobile6.vcproj b/source/Irrlicht/Irrlicht_mobile6.vcproj
new file mode 100644
index 00000000..11bd6cc8
--- /dev/null
+++ b/source/Irrlicht/Irrlicht_mobile6.vcproj
@@ -0,0 +1,2848 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Irrlicht/S4DVertex.h b/source/Irrlicht/S4DVertex.h
index a7e44f93..368d404d 100644
--- a/source/Irrlicht/S4DVertex.h
+++ b/source/Irrlicht/S4DVertex.h
@@ -277,7 +277,8 @@ enum e4DVertexFlag
};
-const u32 MATERIAL_MAX_COLORS = 2;
+const u32 MATERIAL_MAX_COLORS = 1;
+const u32 BURNING_MATERIAL_MAX_TEXTURES = 2;
// dummy Vertex. used for calculation vertex memory size
struct __s4DVertex
@@ -288,12 +289,12 @@ struct __s4DVertex
sVec4 Color[MATERIAL_MAX_COLORS];
#endif
- sVec2 Tex[MATERIAL_MAX_TEXTURES];
+ sVec2 Tex[BURNING_MATERIAL_MAX_TEXTURES];
u32 flag;
};
-#define SIZEOF_SVERTEX 128
-#define SIZEOF_SVERTEX_LOG2 7
+#define SIZEOF_SVERTEX 64
+#define SIZEOF_SVERTEX_LOG2 6
struct s4DVertex
{
@@ -303,7 +304,7 @@ struct s4DVertex
sVec4 Color[ MATERIAL_MAX_COLORS ];
#endif
- sVec2 Tex[ MATERIAL_MAX_TEXTURES ];
+ sVec2 Tex[ BURNING_MATERIAL_MAX_TEXTURES ];
u32 flag;
@@ -441,8 +442,8 @@ struct sScanConvertData
sVec4 c[MATERIAL_MAX_COLORS][2]; // color
sVec4 slopeC[MATERIAL_MAX_COLORS][2]; // color slope along edges
- sVec2 t[MATERIAL_MAX_TEXTURES][2]; // texture
- sVec2 slopeT[MATERIAL_MAX_TEXTURES][2]; // texture slope along edges
+ sVec2 t[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture
+ sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture slope along edges
};
@@ -462,7 +463,7 @@ struct sScanLineData
sVec4 c[MATERIAL_MAX_COLORS][2]; // color start, color end of scanline
#endif
- sVec2 t[MATERIAL_MAX_TEXTURES][2]; // texture start, texture end of scanline
+ sVec2 t[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture start, texture end of scanline
};
// passed to pixel Shader
diff --git a/source/Irrlicht/SoftwareDriver2_compile_config.h b/source/Irrlicht/SoftwareDriver2_compile_config.h
index d5a20ae8..0fa686c8 100644
--- a/source/Irrlicht/SoftwareDriver2_compile_config.h
+++ b/source/Irrlicht/SoftwareDriver2_compile_config.h
@@ -24,6 +24,18 @@
#define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
#endif
+#ifdef BURNINGVIDEO_RENDERER_CE
+ #define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
+ #define SOFTWARE_DRIVER_2_SUBTEXEL
+ #define SOFTWARE_DRIVER_2_BILINEAR
+ #define SOFTWARE_DRIVER_2_LIGHTING
+ #define SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
+ #define SOFTWARE_DRIVER_2_16BIT
+ #define SOFTWARE_DRIVER_2_MIPMAPPING
+ #define SOFTWARE_DRIVER_2_USE_WBUFFER
+ #define SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM
+#endif
+
#ifdef BURNINGVIDEO_RENDERER_FAST
#define SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
#define SOFTWARE_DRIVER_2_SUBTEXEL
diff --git a/source/Irrlicht/SoftwareDriver2_helper.h b/source/Irrlicht/SoftwareDriver2_helper.h
index 32a20b2e..7f99bfdf 100644
--- a/source/Irrlicht/SoftwareDriver2_helper.h
+++ b/source/Irrlicht/SoftwareDriver2_helper.h
@@ -703,7 +703,24 @@ inline void getSample_texture ( tFixPoint &r, tFixPoint &g, tFixPoint &b,
(tFixPointu &) r = (t00 & MASK_R) >> ( SHIFT_R - FIX_POINT_PRE);
(tFixPointu &) g = (t00 & MASK_G) << ( FIX_POINT_PRE - SHIFT_G );
(tFixPointu &) b = (t00 & MASK_B) << ( FIX_POINT_PRE - SHIFT_B );
+}
+inline void getSample_texture ( tFixPointu &a, tFixPointu &r, tFixPointu &g, tFixPointu &b,
+ const sInternalTexture * t, const tFixPointu tx, const tFixPointu ty
+ )
+{
+ u32 ofs;
+
+ ofs = ( ( ty & t->textureYMask ) >> FIX_POINT_PRE ) << t->pitchlog2;
+ ofs |= ( tx & t->textureXMask ) >> ( FIX_POINT_PRE - VIDEO_SAMPLE_GRANULARITY );
+
+ // texel
+ const tVideoSample t00 = *((tVideoSample*)( (u8*) t->data + ofs ));
+
+ (tFixPointu &)a = (t00 & MASK_A) >> ( SHIFT_A - FIX_POINT_PRE);
+ (tFixPointu &)r = (t00 & MASK_R) >> ( SHIFT_R - FIX_POINT_PRE);
+ (tFixPointu &)g = (t00 & MASK_G) << ( FIX_POINT_PRE - SHIFT_G );
+ (tFixPointu &)b = (t00 & MASK_B) << ( FIX_POINT_PRE - SHIFT_B );
}
diff --git a/source/Irrlicht/jpeglib/jconfig.h b/source/Irrlicht/jpeglib/jconfig.h
index 2f4da14c..7e276e89 100644
--- a/source/Irrlicht/jpeglib/jconfig.h
+++ b/source/Irrlicht/jpeglib/jconfig.h
@@ -30,11 +30,11 @@ typedef unsigned char boolean;
#ifdef JPEG_CJPEG_DJPEG
-#define BMP_SUPPORTED /* BMP image file format */
-#define GIF_SUPPORTED /* GIF image file format */
-#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
+#undef BMP_SUPPORTED /* BMP image file format */
+#undef GIF_SUPPORTED /* GIF image file format */
+#undef PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#undef RLE_SUPPORTED /* Utah RLE image file format */
-#define TARGA_SUPPORTED /* Targa image file format */
+#undef TARGA_SUPPORTED /* Targa image file format */
#define TWO_FILE_COMMANDLINE /* optional */
#define USE_SETMODE /* Microsoft has setmode() */
@@ -42,4 +42,8 @@ typedef unsigned char boolean;
#undef DONT_USE_B_MODE
#undef PROGRESS_REPORT /* optional */
+#if defined(_WIN32_WCE)
+ #undef USE_SETMODE
+#endif
+
#endif /* JPEG_CJPEG_DJPEG */
diff --git a/source/Irrlicht/jpeglib/jmorecfg.h b/source/Irrlicht/jpeglib/jmorecfg.h
index c856e226..2a9a345a 100644
--- a/source/Irrlicht/jpeglib/jmorecfg.h
+++ b/source/Irrlicht/jpeglib/jmorecfg.h
@@ -158,7 +158,7 @@ typedef short INT16;
/* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
-typedef long INT32;
+typedef int INT32;
#endif
/* Datatype used for image dimensions. The JPEG standard only supports
diff --git a/source/Irrlicht/libpng/pngconf.h b/source/Irrlicht/libpng/pngconf.h
index f1c27671..49663f5f 100644
--- a/source/Irrlicht/libpng/pngconf.h
+++ b/source/Irrlicht/libpng/pngconf.h
@@ -1394,7 +1394,11 @@ typedef z_stream FAR * png_zstreamp;
*/
#ifndef PNG_ABORT
-# define PNG_ABORT() abort()
+ #if !defined(_WIN32_WCE )
+ #define PNG_ABORT() abort()
+ #else
+ #define PNG_ABORT()
+ #endif
#endif
#ifdef PNG_SETJMP_SUPPORTED
diff --git a/source/Irrlicht/libpng/pngrutil.c b/source/Irrlicht/libpng/pngrutil.c
index 9860768d..498b602c 100644
--- a/source/Irrlicht/libpng/pngrutil.c
+++ b/source/Irrlicht/libpng/pngrutil.c
@@ -17,7 +17,7 @@
#if defined(PNG_READ_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
-# if defined(_WIN32_WCE)
+# if defined(_WIN32_WCE) && 0
/* strtod() function is not supported on WindowsCE */
__inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr)
{
diff --git a/source/Irrlicht/os.cpp b/source/Irrlicht/os.cpp
index afee872f..69c98ecd 100644
--- a/source/Irrlicht/os.cpp
+++ b/source/Irrlicht/os.cpp
@@ -67,11 +67,13 @@ namespace os
//! prints a debuginfo string
void Printer::print(const c8* message)
{
+#if !defined (_WIN32_WCE )
c8* tmp = new c8[strlen(message) + 2];
sprintf(tmp, "%s\n", message);
OutputDebugString(tmp);
printf(tmp);
delete [] tmp;
+#endif
}
LARGE_INTEGER HighPerformanceFreq;
@@ -79,6 +81,7 @@ namespace os
void Timer::initTimer()
{
+#if !defined (_WIN32_WCE )
// disable hires timer on multiple core systems, bios bugs result in bad hires timers.
SYSTEM_INFO sysinfo;
DWORD affinity, sysaffinity;
@@ -103,6 +106,9 @@ namespace os
{
HighPerformanceTimerSupport = false;
}
+#else
+ HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
+#endif
initVirtualTimer();
}