I have a problem with fullscreen ;My game run correctly on my computer.
But when I tried to run it on my notebook it doesn't want to run in fullscreen.
Here's the code
width = GetSystemMetrics(SM_CXSCREEN);
height = GetSystemMetrics(SM_CYSCREEN);
windowRect.left=(long)0;
windowRect.right=(long)width;
windowRect.top=(long)0;
windowRect.bottom=(long)height;
// definicja klasy okna
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = WndProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hbrBackground = NULL;
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = "MojaKlasa";
windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
if (!RegisterClassEx(&windowClass))
return 0;
if (fullScreen)
{
DEVMODE screenSettings;
memset(&screenSettings,0,sizeof(screenSettings));
screenSettings.dmSize = sizeof(DEVMODE);
screenSettings.dmPelsWidth = width;
screenSettings.dmPelsHeight = height;
screenSettings.dmBitsPerPel = bits;
screenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
if (ChangeDisplaySettings(&screenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
if (MessageBox(NULL, "Can't run in FULLSCREEN",
MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
{
fullScreen = true;
}
else
{
return FALSE;
}
}
So when I run it I recive this message : ""Can't run in FULLSCREEN""
Why?
I'm not sure but I think it becouse this lines:
width = GetSystemMetrics(SM_CXSCREEN);
height = GetSystemMetrics(SM_CYSCREEN);