PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

fullscreen issue

Hi,

I'm trying to switch my game to fullscreen as shown in the code below. I'm starting the game at 640x480 windowed, then setting the resolution to 1024x768 fullscreen. It works fine at first, but a little while later, the top left part of the screen (I think its the top left 640x480 pixels) continues to display fine, while the remainder of the screen "freezes." Sometimes the screen freezes entirely.

Here's my code:
Code:

bool fullFlag = true;
int height = 768;
int width = 1024;
int bpp = 32;

if(fullFlag) {
DEVMODE devmodescreen;
memset(&devmodescreen;, 9, sizeof(devmodescreen));
devmodescreen.dmSize = sizeof(devmodescreen);
devmodescreen.dmPelsHeight = height;
devmodescreen.dmPelsWidth = width;
devmodescreen.dmBitsPerPel = bpp;
devmodescreen.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
if(ChangeDisplaySettings(&devmodescreen;, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
MessageBox(NULL, "Display mode failed", NULL, MB_OK);
fullFlag = false;
}
}
HWND ghwnd = (HWND)shared->main->GetWindowHandle();
if(!ghwnd)
return;
ShowWindow(ghwnd, SW_SHOWMAXIMIZED);
LONG style = GetWindowLong(ghwnd, GWL_STYLE);
style &= ~(WS_BORDER|WS_CAPTION);
SetWindowLong(ghwnd, GWL_STYLE, style);
UpdateWindow(ghwnd);

shared->ecd->dispcfg->width = width;
shared->ecd->dispcfg->height = height;


Any pointers as to what I'm be doing wrong? Thanks!
Hi,

The problem is that when the display resolution changes, the EDGELIB backbuffer isn't sized properly with it.

You can try to force the backbuffer to update by calling ClassEDisplay :: ChangeOrientation and use DOR_NONE as a parameter.
Works perfect, thanks for the quick reply!