Skip to main content
gamedev.net
🔒 Locked

Why does it do this?

Started by SL33pY_Kr3W Feb 19, 2005 at 6:15 PM 2 replies 950+ views
Original Post
SL33pY_Kr3W
SL33pY_Kr3W
Why is it that this code runs the exe using full screen display....

int GameInit(void *parms,int num_parms)
{
    //intiate stuff for game
    if(FAILED(DirectDrawCreateEx(NULL,(void**)&lpdd7,IID_IDirectDraw7,NULL)))
      return(0);
    
    if(FAILED(lpdd7->SetCooperativeLevel(GLOB_HWND1,DDSCL_NORMAL)))
      return(0);
    
    lpdd7->SetDisplayMode(800,600,8,0,0);
    //return success
    return(1);
}


But this code doesn't?

int GameInit(void *parms,int num_parms)
{
    //intiate stuff for game
    if(FAILED(DirectDrawCreateEx(NULL,(void**)&lpdd7,IID_IDirectDraw7,NULL)))
      return(0);
    
    if(FAILED(lpdd7->SetCooperativeLevel(GLOB_HWND1,DDSCL_FULLSCREEN|DDSCL_ALLOWMODEX|DDSCL_EXCLUSIVE|DDSCL_ALLOWREBOOT)))
      return(0);
    
    lpdd7->SetDisplayMode(800,600,8,0,0);
    //return success
    return(1);
}


Other than these little quirks I think im getting the hang of Win32/DirectX. *fixed my typo... still same prob* [Edited by - SL33pY_Kr3W on February 19, 2005 6:31:03 PM]
lack o comments
lack o comments
Off the bat, I see one mistake. IDirectDraw::SetDisplayMode cannot be called in Windowed mode (DDSCL_NORMAL) because the application doesn't have control of the display. Other than that...it should be the other way 'round. The first example SHOULD be windowed and the second SHOULD be fullscreen. Are you sure you're setting the window style to something desirable for each situation. (WS_POPUP for fullscreen and WS_OVERLAPPED/whatever for windowed)?
SL33pY_Kr3W
SL33pY_Kr3W
That was the first thing I went to and the window was set to WS_POPUP for both. :(
lack o comments
lack o comments
For Windowed Mode, try setting the window style to WS_OVERLPAPPEDWINDOW, and make sure the dimensions of the window are smaller than the screen resolution. Also make sure to remove the call to SetDisplayMode.

For Fullscreen Mode, make sure the size of the window matches the dimensions used in SetDisplayMode.

Finally, make sure the HWND parameter is valid. If that doesn't help...then I really don't know what to say. [oh]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.