add platform functions for querying monitor information
This commit is contained in:
parent
ed388fc82e
commit
f27dfb6809
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user