1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-21 06:05:33 +01:00
Files
luanti/irr/src/CSDLManager.cpp
2025-11-18 12:00:46 +01:00

57 lines
1.1 KiB
C++

// Copyright (C) 2022 sfan5
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#include "CSDLManager.h"
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
#include "CIrrDeviceSDL.h"
#include "os.h"
namespace video
{
CSDLManager::CSDLManager(CIrrDeviceSDL *device) :
IContextManager(), SDLDevice(device)
{}
bool CSDLManager::initialize(const SIrrlichtCreationParameters &params, const SExposedVideoData &data)
{
Data = data;
int interval = params.Vsync ? 1 : 0;
#ifdef _IRR_USE_SDL3_
bool ok = SDL_GL_SetSwapInterval(interval);
#else
bool ok = SDL_GL_SetSwapInterval(interval) == 0;
#endif
if (!ok)
os::Printer::log("Setting GL swap interval failed");
return true;
}
const SExposedVideoData &CSDLManager::getContext() const
{
return Data;
}
bool CSDLManager::activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero)
{
return true;
}
void *CSDLManager::getProcAddress(const std::string &procName)
{
return (void *)SDL_GL_GetProcAddress(procName.c_str());
}
bool CSDLManager::swapBuffers()
{
SDLDevice->SwapWindow();
return true;
}
}
#endif