[AD] Strange behaviour in the Windows GDI mode in Windows 2000

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I've noticed a rendering oddity when using the GDI mode in Windows 2000. If something is drawn off the edge of the screen, the screen becomes corrupted. When this happens, if I draw something close to the bottom of the screen (even if it lies within the size of the original screen), then the screen can become corrupted even more. If I am drawing something that goes off the edge of the screen inside my main loop, then I end up in a situation where the area surrounding the mousecursor appears normal (everything appears to be at the right coordinates), whereas the area not surrounding the mousecuror, parts of the screen are shifted downwards vertically.

This problem does not occur in Windows 98. Also, if I change GFX_GDI to GFX_DIRECTX_WIN, the problem goes away in Windows 2000.

Attatched is a program that demonstrates this glitch. I have put up two PNGs on the web. The first one at http://tmp.wackonet.net/Allegro/gdiglitchtest_w2k.png demonstrates the glitch, and the second one at http://tmp.wackonet.net/Allegro/gdiglitchtest_w98.png showing what it's supposed to look like.


AE.

/***************************************************************************
 *
 * removemousetest.c
 * Test program to show the glitch in Windows GDI mode.
 *
 **************************************************************************/


/****************************************************************************
 Includes
 */

#include <allegro.h>


/****************************************************************************
  Types
 */

typedef int TeBool;



/****************************************************************************
 Global Variables (across program)
 */




void
teDrawBackdrop()
{
	int nRadius=400;

	for(;nRadius;nRadius-=2)
	{
		circlefill(screen,320,200+(nRadius>>1),nRadius,nRadius>>1);
	}

	textout_ex(screen,font,"Hold down 'A' and move the mouse near the bottom of the window",0,250,1,-0);
	textout_ex(screen,font,"And observe the area surrounding the mouse.",0,258,1,-0);

}



void
teDoTest()
{
	show_mouse(screen);


	while(!key[KEY_ESC] && !key[KEY_SPACE])
	{

		if(key[KEY_A])
		{
			circlefill(screen,100,449,70,3);
		}

	}


	show_mouse(NULL);


}



TeBool
teSetupGfx()
{
	set_gfx_mode(GFX_GDI, 640, 480, 0, 0);


	set_palette(desktop_palette);

	teDrawBackdrop();

	return TRUE;
}



void
teCleanupGraphics()
{

}



TeBool
teSetup()
{
	if(allegro_init())
	{
		TRACE("Error Initialising Allegro.\n");
		return FALSE;
	}


	if(install_keyboard())
	{
		TRACE("Error Initialising Keyboard.\n");
		return FALSE;
	}


	if(install_timer())
	{
		TRACE("Error Initialising Timer.\n");
		return FALSE;
	}



	if(install_mouse() == -1)
	{
		TRACE("Error Initialising Mouse.\n");
		return FALSE;
	}


	if(!teSetupGfx())
	{
		TRACE("Error setting up the graphics.\n");
		return FALSE;
	}

	
	return TRUE;
}



void
teCleanUp()
{
	teCleanupGraphics();

	remove_mouse();


	remove_timer();
	remove_keyboard();

	allegro_exit();
}



int main(void)
{
	if(!teSetup())
	{
		teCleanUp();
		return -1;
	}


	teDoTest();


	teCleanUp();

	return 0;
}
END_OF_MAIN();


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/