Hi,
I've just come across a weird problem with the desktop_color_depth()
function on Windows (95 OSR2 French, DirectX 6.0)
Here the code:
#include <allegro.h>
#include <winalleg.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine,
int nCmdShow)
{
allegro_init();
allegro_message("color depth = %d", desktop_color_depth());
return 0;
}
Sometimes I get 32232 (!!), sometimes 29940 or 28840, whatever the actual
color depth Windows is using.
Can someone figure out what does it mean ?
Anyway, after looking into the Platform SDK docs, I've found a somewhat
different way of doing the things:
/* sys_directx_desktop_color_depth:
* Returns the current desktop color depth.
*/
static int sys_directx_desktop_color_depth(void)
{
HDC dc;
int depth;
dc = GetWindowDC(allegro_wnd);
depth = GetDeviceCaps(dc, BITSPIXEL);
ReleaseDC(allegro_wnd, dc);
return depth;
}
The return value is correct in every color depth (15bpp is reported as
16bpp, according to the docs) with my code.
--
Eric Botcazou (ebotcazou@xxxxxxxxxx)
Web Site: http://www.multimania.com/ebotcazou