~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/Irrlicht.cpp

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
 
2
// This file is part of the "Irrlicht Engine".
 
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
4
 
 
5
#include "IrrCompileConfig.h"
 
6
 
 
7
static const char* const copyright = "Irrlicht Engine (c) 2002-2011 Nikolaus Gebhardt";
 
8
 
 
9
#ifdef _IRR_WINDOWS_
 
10
        #include <windows.h>
 
11
        #if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(_WIN32_WCE)
 
12
                #include <crtdbg.h>
 
13
        #endif // _DEBUG
 
14
#endif
 
15
 
 
16
#include "irrlicht.h"
 
17
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
 
18
#include "CIrrDeviceWin32.h"
 
19
#endif
 
20
 
 
21
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
 
22
#include "MacOSX/CIrrDeviceMacOSX.h"
 
23
#endif
 
24
 
 
25
#ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
 
26
#include "CIrrDeviceWinCE.h"
 
27
#endif
 
28
 
 
29
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
 
30
#include "CIrrDeviceLinux.h"
 
31
#endif
 
32
 
 
33
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
 
34
#include "CIrrDeviceSDL.h"
 
35
#endif
 
36
 
 
37
#ifdef _IRR_COMPILE_WITH_FB_DEVICE_
 
38
#include "CIrrDeviceFB.h"
 
39
#endif
 
40
 
 
41
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
 
42
#include "CIrrDeviceConsole.h"
 
43
#endif
 
44
 
 
45
namespace irr
 
46
{
 
47
        //! stub for calling createDeviceEx
 
48
        IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(video::E_DRIVER_TYPE driverType,
 
49
                        const core::dimension2d<u32>& windowSize,
 
50
                        u32 bits, bool fullscreen,
 
51
                        bool stencilbuffer, bool vsync, IEventReceiver* res)
 
52
        {
 
53
                SIrrlichtCreationParameters p;
 
54
                p.DriverType = driverType;
 
55
                p.WindowSize = windowSize;
 
56
                p.Bits = (u8)bits;
 
57
                p.Fullscreen = fullscreen;
 
58
                p.Stencilbuffer = stencilbuffer;
 
59
                p.Vsync = vsync;
 
60
                p.EventReceiver = res;
 
61
 
 
62
                return createDeviceEx(p);
 
63
        }
 
64
 
 
65
        extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& params)
 
66
        {
 
67
 
 
68
                IrrlichtDevice* dev = 0;
 
69
 
 
70
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
 
71
                if (params.DeviceType == EIDT_WIN32 || (!dev && params.DeviceType == EIDT_BEST))
 
72
                        dev = new CIrrDeviceWin32(params);
 
73
#endif
 
74
 
 
75
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
 
76
                if (params.DeviceType == EIDT_OSX || (!dev && params.DeviceType == EIDT_BEST))
 
77
                        dev = new CIrrDeviceMacOSX(params);
 
78
#endif
 
79
 
 
80
#ifdef _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
 
81
                if (params.DeviceType == EIDT_WINCE || (!dev && params.DeviceType == EIDT_BEST))
 
82
                        dev = new CIrrDeviceWinCE(params);
 
83
#endif
 
84
 
 
85
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
 
86
                if (params.DeviceType == EIDT_X11 || (!dev && params.DeviceType == EIDT_BEST))
 
87
                        dev = new CIrrDeviceLinux(params);
 
88
#endif
 
89
 
 
90
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
 
91
                if (params.DeviceType == EIDT_SDL || (!dev && params.DeviceType == EIDT_BEST))
 
92
                dev = new CIrrDeviceSDL(params);
 
93
#endif
 
94
 
 
95
#ifdef _IRR_COMPILE_WITH_FB_DEVICE_
 
96
                if (params.DeviceType == EIDT_FRAMEBUFFER || (!dev && params.DeviceType == EIDT_BEST))
 
97
                dev = new CIrrDeviceFB(params);
 
98
#endif
 
99
 
 
100
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
 
101
                if (params.DeviceType == EIDT_CONSOLE || (!dev && params.DeviceType == EIDT_BEST))
 
102
                dev = new CIrrDeviceConsole(params);
 
103
#endif
 
104
 
 
105
                if (dev && !dev->getVideoDriver() && params.DriverType != video::EDT_NULL)
 
106
                {
 
107
                        dev->closeDevice(); // destroy window
 
108
                        dev->run(); // consume quit message
 
109
                        dev->drop();
 
110
                        dev = 0;
 
111
                }
 
112
 
 
113
                return dev;
 
114
        }
 
115
 
 
116
namespace core
 
117
{
 
118
        const matrix4 IdentityMatrix(matrix4::EM4CONST_IDENTITY);
 
119
}
 
120
 
 
121
namespace video
 
122
{
 
123
        SMaterial IdentityMaterial;
 
124
}
 
125
 
 
126
} // end namespace irr
 
127
 
 
128
 
 
129
#if defined(_IRR_WINDOWS_API_)
 
130
 
 
131
BOOL APIENTRY DllMain( HANDLE hModule,
 
132
                       DWORD  ul_reason_for_call,
 
133
                       LPVOID lpReserved )
 
134
{
 
135
        // _crtBreakAlloc = 139;
 
136
 
 
137
    switch (ul_reason_for_call)
 
138
        {
 
139
                case DLL_PROCESS_ATTACH:
 
140
                        #if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__) && !defined (_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
 
141
                                _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
 
142
                        #endif
 
143
                        break;
 
144
                case DLL_THREAD_ATTACH:
 
145
                case DLL_THREAD_DETACH:
 
146
                case DLL_PROCESS_DETACH:
 
147
                        break;
 
148
    }
 
149
    return TRUE;
 
150
}
 
151
 
 
152
#endif // defined(_IRR_WINDOWS_)
 
153