]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CSDLManager.cpp
3132b60a1600fb1b37f816adb6dcc7b1fa4e2ef9
[irrlicht.git] / source / Irrlicht / CSDLManager.cpp
1 // Copyright (C) 2022 sfan5
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 "CSDLManager.h"
6
7 #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && defined(_IRR_COMPILE_WITH_OPENGL_)
8
9 #include "CIrrDeviceSDL.h"
10 #include "COpenGLCommon.h"
11
12 namespace irr
13 {
14 namespace video
15 {
16
17 CSDLManager::CSDLManager(CIrrDeviceSDL* device) : IContextManager(), SDLDevice(device)
18 {
19         #ifdef _DEBUG
20         setDebugName("CSDLManager");
21         #endif
22 }
23
24 bool CSDLManager::initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data)
25 {
26         Data = data;
27         return true;
28 }
29
30 const SExposedVideoData& CSDLManager::getContext() const
31 {
32         return Data;
33 }
34
35 bool CSDLManager::activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero)
36 {
37         // unclear if this is still needed:
38         glFrontFace(GL_CW);
39         return true;
40 }
41
42 void* CSDLManager::getProcAddress(const std::string &procName)
43 {
44         return SDL_GL_GetProcAddress(procName.c_str());
45 }
46
47 bool CSDLManager::swapBuffers()
48 {
49         SDLDevice->SwapWindow();
50         return true;
51 }
52
53 }
54 }
55
56 #endif