Closed zappybiby closed 1 year ago
Program arguments could be used for monitor number and resolution (i.ie -m 2 -r 1920
). This would be a lazy or simple approach to it. I don't know how much time I will have to help look into this but any resources for this should be placed here @zappybiby.
We could use screeninfo which supports Windows/OSX/Linux if additional requirements are obtained (PyOBJus for OSX and Xinerama for Linux)
For someone with two monitors, using the code
from screeninfo import get_monitors
for m in get_monitors():
print(str(m))
will return
monitor(1920x1080+1920+0)
monitor(1920x1080+0+0)
Knowing this, we can return the number of monitors and monitor size with the following code:
from screeninfo import get_monitors
import re
for m in get_monitors():
x = (str(m))
print("number of monitors:", x.count("monitor"))
y = re.sub(r'monitor', '', x)
print(y)
which will return this on a computer with one monitor
number of monitors: 1
(1100x655+0+0)
Not sure how to get rid of parentheses and we would have to interpret this string somehow. Note that screeninfo does not comma separate different monitors but just puts each of them on a new line.
Currently ETA uses hardcoded coordinates to display OpenCV windows. This means that the windows may not display correctly for those that don't have a 1920x1080 monitor. We need to implement a way to have the windows resize/move so that they display alongside the ETS2 Window.
It might be beneficial to have ETA detect if there are two monitors available so that those windows can be displayed on the monitor opposite of ETS2
Using ctypes (windows only): https://code.activestate.com/recipes/460509-get-the-actual-and-usable-sizes-of-all-the-monitor/
Currently looking for a environment-agnostic method of doing this (future goal to make ETA work for mac/linux)