]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CEAGLManager.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / source / Irrlicht / CEAGLManager.h
1 // Copyright (C) 2015 Patryk Nadrowski\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in Irrlicht.h\r
4 \r
5 #ifndef __C_EAGL_MANAGER_H_INCLUDED__\r
6 #define __C_EAGL_MANAGER_H_INCLUDED__\r
7 \r
8 \r
9 #ifdef _IRR_COMPILE_WITH_EAGL_MANAGER_\r
10 \r
11 #include "SIrrCreationParameters.h"\r
12 #include "SExposedVideoData.h"\r
13 #include "IContextManager.h"\r
14 \r
15 namespace irr\r
16 {\r
17 namespace video\r
18 {\r
19         // EAGL manager.\r
20         class CEAGLManager : public IContextManager\r
21         {\r
22         public:\r
23                 //! Constructor.\r
24                 CEAGLManager();\r
25 \r
26                 //! Destructor.\r
27                 virtual ~CEAGLManager();\r
28 \r
29                 // Initialize EAGL.\r
30                 /* This method checks if a view has CAEAGLLayer and grabs it if it does, anyway surface and context\r
31                 aren't create. */\r
32                 bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data);\r
33 \r
34                 // Terminate EAGL.\r
35                 /* Terminate EAGL context. This method break both existed surface and context. */\r
36                 void terminate();\r
37 \r
38                 // Create EAGL surface.\r
39                 /* This method configure CAEAGLLayer. */\r
40                 bool generateSurface();\r
41 \r
42                 // Destroy EAGL surface.\r
43                 /* This method reset CAEAGLLayer states. */\r
44                 void destroySurface();\r
45 \r
46                 // Create EAGL context.\r
47                 /* This method create and activate EAGL context. */\r
48                 bool generateContext();\r
49 \r
50                 // Destroy EAGL context.\r
51                 /* This method destroy EAGL context. */\r
52                 void destroyContext();\r
53 \r
54                 const SExposedVideoData& getContext() const;\r
55 \r
56                 bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero);\r
57 \r
58                 // Swap buffers.\r
59                 bool swapBuffers();\r
60 \r
61         private:\r
62                 SIrrlichtCreationParameters Params;\r
63                 SExposedVideoData Data;\r
64 \r
65                 bool Configured;\r
66 \r
67         void* DataStorage;\r
68 \r
69                 struct SFrameBuffer\r
70                 {\r
71                         SFrameBuffer() : BufferID(0), ColorBuffer(0), DepthBuffer(0)\r
72                         {\r
73                         }\r
74 \r
75                         u32 BufferID;\r
76                         u32 ColorBuffer;\r
77                         u32 DepthBuffer;\r
78                 };\r
79 \r
80                 SFrameBuffer FrameBuffer;\r
81         };\r
82 }\r
83 }\r
84 \r
85 #endif\r
86 #endif\r