DUB package used to get a device's display resolution for the D programming language.
This is a wrapper for a couple winuser functions, meaning you'll have to import it. More on this down below.
Because of this, the package only works for windows; linux and mac are not compatible.
In your project directory enter the following commands:
dub add dsplay
Installs dsplay.
This package has 2 functions:
getScreenWidth()
getScreenHeight()
Prints the display resolution.
import std.stdio;
import core.sys.windows.winuser;
import dsplay;
pragma(lib, "User32.lib");
void main()
{
int x = getScreenWidth();
int y = getScreenHeight();
writeln(x,"x", y);
}
Output on a 1920x1080 display:
1920x1080
This package is licensed under:
which you can view here.