4 ms·
> Can anyone comment on how this is actually obtaining the video output from ETS2? In Windows, it's done by grabbing the handle of the window with the "Prism3D
by omegaham 10y ago
> Can anyone comment on how this is actually obtaining the video output from ETS2?
In Windows, it's done by grabbing the handle of the window with the "Prism3D" classname.
This then goes to the hwnd2mat function[1], which does `GetDC`[2] to get the device content and then creates a bitmap with `CreateCompatibleBitmap`[3].
---
On Linux[4], it's done by grabbing the screen with `XOpenDisplay` and the current window with `DefaultRootWindow`. It then uses `XGetImage` and memcpys the result into the vector of pixels.
Note that the `main` function in the Windows and Linux version is slightly different to accommodate the difference in how these images are grabbed.
[1] https://github.com/bethesirius/ChosunTruck/blob/master/windows/src/hwnd2mat.cpp https://github.com/bethesirius/ChosunTruck/blob/master/windo...
[2] https://msdn.microsoft.com/en-us/library/windows/desktop/dd144871(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/dd1...
[3] https://msdn.microsoft.com/en-us/library/windows/desktop/dd183488(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/dd1...
[4] https://github.com/bethesirius/ChosunTruck/blob/master/linux/src/getScreen_linux.cc https://github.com/bethesirius/ChosunTruck/blob/master/linux...