提交 f27dfb68 编写于 作者: J jp9000

add platform functions for querying monitor information

上级 ed388fc8
......@@ -23,3 +23,9 @@ bool GetDataFilePath(const char *data, string &output)
// TODO
return false;
}
void GetMonitors(vector<MonitorInfo> &monitors)
{
monitors.clear();
// TODO
}
......@@ -27,3 +27,9 @@ bool GetDataFilePath(const char *data, string &output)
output = str.str();
return !access(output.c_str(), R_OK);
}
void GetMonitors(vector<MonitorInfo> &monitors)
{
monitors.clear();
// TODO
}
......@@ -30,3 +30,23 @@ bool GetDataFilePath(const char *data, string &output)
output = str.str();
return os_file_exists(output.c_str());
}
static BOOL CALLBACK OBSMonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor,
LPRECT rect, LPARAM param)
{
vector<MonitorInfo> &monitors = *(vector<MonitorInfo> *)param;
MonitorInfo monitor;
monitor.x = rect->left;
monitor.y = rect->top;
monitor.cx = rect->right - rect->left;
monitor.cy = rect->bottom - rect->top;
monitors.push_back(monitor);
return true;
}
void GetMonitors(vector<MonitorInfo> &monitors)
{
monitors.clear();
EnumDisplayMonitors(NULL, NULL, OBSMonitorEnumProc, (LPARAM)&monitors);
}
......@@ -17,8 +17,17 @@
#pragma once
#include <util/c99defs.h>
#include <string>
#include <vector>
using namespace std;
struct MonitorInfo {
int32_t x, y;
uint32_t cx, cy;
};
/* Gets the path of obs-studio specific data files (such as locale) */
bool GetDataFilePath(const char *data, string &path);
void GetMonitors(vector<MonitorInfo> &monitors);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册