if (!RegisterClassEx (&wincl)) return false;
hWnd = CreateWindowEx (0,szClassName,szClassName,WS_POPUP,
INITAL_POS_X,INITAL_POS_Y,INITAL_SIZE_X,INITAL_SIZE_Y,HWND_DESKTOP,NULL,hInstance,NULL);
if(hWnd==NULL) {
MSGBOX("Init error.");
KillWindow();
return false;
}
if(FAILED(DirectDrawCreateEx(NULL,(void**)&lpdd,IID_IDirectDraw7,NULL))) {
MSGBOX("Init error.");
KillWindow();
return false;
}
lpdd->SetCooperativeLevel(hWnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN);
lpdd->SetDisplayMode(INITAL_SIZE_X,INITAL_SIZE_Y,32,0,0);
INIT_DXSTRUCT(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if (FAILED(lpdd->CreateSurface(&ddsd,&lpddsPrimary,NULL))) {
MSGBOX("lpdd Init error.");
KillWindow();
return false;
}
if(FAILED(lpddsPrimary->Lock(NULL,&ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,NULL))) {
MSGBOX("Couldn''t lock surface.");
KillWindow();
return false;
}
UINT* buffer = (UINT*)ddsd.lpSurface;
nPitch = ddsd.lPitch >> 2;
PLOT32(10,10,RGB32(255,0,0),buffer);
Blank screen in DDraw
I am trying to draw a simple point using ddraw and finally got the screen set up, but it won''t draw anything. It will change display mode to 800 x 600 and display a black screen (no mouse) but will quit properly when I press ESC. I''m glad I programmed that in. Here''s my codeI already init''ed wincl)
I just put the plot32 in for testing. Here''s PLOT32:
buffer[y*nPitch + x] = color;
I got some of the source from an article here. Can anyone help?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement