diff --git a/CMakeLists.txt b/CMakeLists.txt index d646b23f..5abf45fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.16) project(screen_capture_lite_build) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) option(BUILD_EXAMPLE "Build example" ON) diff --git a/Example_OpenGL/Screen_Capture_Example_OpenGL.cpp b/Example_OpenGL/Screen_Capture_Example_OpenGL.cpp index 6811920a..0a29ed08 100644 --- a/Example_OpenGL/Screen_Capture_Example_OpenGL.cpp +++ b/Example_OpenGL/Screen_Capture_Example_OpenGL.cpp @@ -3,6 +3,7 @@ #include "ScreenCapture.h" #include #include +#include using namespace std::chrono_literals; void CheckStatus(GLuint obj, bool isShader) diff --git a/src_cpp/ScreenCapture.cpp b/src_cpp/ScreenCapture.cpp index b20f7cb4..65963459 100644 --- a/src_cpp/ScreenCapture.cpp +++ b/src_cpp/ScreenCapture.cpp @@ -7,23 +7,25 @@ #include #include #include -#include #include #include namespace SL::Screen_Capture { -template bool IsMonitorInsideBounds(MonitorT monitors, const Monitor &monitor) +bool IsMonitorInsideBounds(const Monitor *monitors, const int monitorsize, const Monitor &monitor) { auto totalwidth = 0; - for (auto &m : monitors) { - totalwidth += Width(m); + for (int i = 0; i < monitorsize; i++) { + totalwidth += Width(monitors[i]); } // if the monitor doesnt exist any more! - if (std::find_if(begin(monitors), end(monitors), [&](auto &m) { return m.Id == monitor.Id; }) == end(monitors)) { + int index = 0; + while(index < monitorsize && monitors[index].Id != monitor.Id) + index++; + if (index == monitorsize) { return false; } // if the area to capture is outside the dimensions of the desktop!! @@ -44,7 +46,7 @@ template bool IsMonitorInsideBounds(MonitorT monitors, const Mo return true; } -bool isMonitorInsideBounds(const std::vector &monitors, const Monitor &monitor) { return IsMonitorInsideBounds(monitors, monitor); } +bool isMonitorInsideBounds(const std::vector &monitors, const Monitor &monitor) { return IsMonitorInsideBounds(monitors.data(), (int)monitors.size(), monitor); } namespace C_API { @@ -272,7 +274,7 @@ int SCL_GetWindows(SCL_WindowRef windows, int monitors_size) int SCL_IsMonitorInsideBounds(SCL_MonitorRefConst monitors, const int monitorsize, SCL_MonitorRefConst monitor) { - return int(IsMonitorInsideBounds(std::span(monitors, monitorsize), *monitor)); + return int(IsMonitorInsideBounds(monitors, monitorsize, *monitor)); } void SCL_MonitorOnNewFrame(SCL_ICaptureConfigurationScreenCaptureCallbackWrapperRef ptr, SCL_ScreenCaptureCallback cb)