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