Difference for arch/ogl/wgl.c from version 1.6 to 1.7


version 1.6 version 1.7
Line 9
 
Line 9
 #include "key.h"  #include "key.h"
 #include "joy.h"  #include "joy.h"
 #include "mouse.h"  #include "mouse.h"
   #include "digi.h"
   #include "args.h"
 /*#include "event.h"*/  /*#include "event.h"*/
   
   
Line 142
 
Line 144
    
  if (!ogl_fullscreen){   if (!ogl_fullscreen){
  x+=get_win_x_bs();y+=get_win_y_bs();   x+=get_win_x_bs();y+=get_win_y_bs();
    }else{
    x=GetSystemMetrics(SM_CXSCREEN);
    y=GetSystemMetrics(SM_CYSCREEN);
  }   }
  g_hWnd = CreateWindowEx(0,   g_hWnd = CreateWindowEx(0,
  "WinD1X",   "WinD1X",
Line 149
 
Line 154
  flags,   flags,
  0, 0,   0, 0,
  x,y,   x,y,
 // GetSystemMetrics(SM_CXSCREEN),  
 // GetSystemMetrics(SM_CYSCREEN),  
  NULL,   NULL,
  NULL,   NULL,
  hInst,   hInst,
Line 170
 
Line 173
  key_init();   key_init();
  mouse_init(0);   mouse_init(0);
  joy_init(JOYSTICKID1);   joy_init(JOYSTICKID1);
    if (!FindArg( "-nosound" ))
    digi_init();
 // printf("arch_init successfully completed\n");  // printf("arch_init successfully completed\n");
    
  OpenGL_Initialize();   OpenGL_Initialize();
Line 185
 
Line 190
  key_close();   key_close();
  mouse_close();   mouse_close();
  joy_close();   joy_close();
    if (!FindArg( "-nosound" ))
    digi_close();
  DestroyWindow(g_hWnd);   DestroyWindow(g_hWnd);
  }   }
 }  }
Line 214
 
Line 221
  GLPREF_width=x;   GLPREF_width=x;
  GLPREF_height=y;   GLPREF_height=y;
  if (gl_initialized){   if (gl_initialized){
    if (GLSTATE_width==GLPREF_width && GLSTATE_height==GLPREF_height && GLPREF_windowed!=ogl_fullscreen)
    return 0;//we are already in the right mode, don't do anything.
  if (!ogl_fullscreen && GLPREF_windowed){   if (!ogl_fullscreen && GLPREF_windowed){
  SetWindowPos(g_hWnd,0,0,0,x+get_win_x_bs(),y+get_win_y_bs(),SWP_NOMOVE);//the width/height seem to include borders/title/etc.. this isn't an exact value, but I didn't feel like testing enough to find the true values. -MPM   SetWindowPos(g_hWnd,0,0,0,x+get_win_x_bs(),y+get_win_y_bs(),SWP_NOMOVE);//the width/height seem to include borders/title/etc.. this isn't an exact value, but I didn't feel like testing enough to find the true values. -MPM
 // SetWindowPos(g_hWnd,0,0,0,x,y,0);//the width/height seem to include borders/title/etc.. this isn't an exact value, but I didn't feel like testing enough to find the true values. -MPM  // SetWindowPos(g_hWnd,0,0,0,x,y,0);//the width/height seem to include borders/title/etc.. this isn't an exact value, but I didn't feel like testing enough to find the true values. -MPM
Line 257
 
Line 266
 // Saved_gamma_values: Initial gamma values  // Saved_gamma_values: Initial gamma values
 bool OpenGL_Initialize(void)  bool OpenGL_Initialize(void)
 {  {
    char *errstr="";
  int width,height;   int width,height;
  int pf;   int pf;
  PIXELFORMATDESCRIPTOR pfd, pfd_copy;   PIXELFORMATDESCRIPTOR pfd, pfd_copy;
Line 291
 
Line 301
  retval=ChangeDisplaySettings(&devmode,0);   retval=ChangeDisplaySettings(&devmode,0);
  if (retval!=DISP_CHANGE_SUCCESSFUL)   if (retval!=DISP_CHANGE_SUCCESSFUL)
  {   {
    errstr="ChangeDisplaySettings";
  // we couldn't even switch to 640x480, we're out of here   // we couldn't even switch to 640x480, we're out of here
  // restore screen mode to default   // restore screen mode to default
  ChangeDisplaySettings(NULL,0);   ChangeDisplaySettings(NULL,0);
Line 352
 
Line 363
  pf = ChoosePixelFormat(GLPREF_windowdc,&pfd);   pf = ChoosePixelFormat(GLPREF_windowdc,&pfd);
  if(pf == 0)    if(pf == 0)
  {   {
    errstr="ChoosePixelFormat";
  // no pixel format closely matches    // no pixel format closely matches
  goto OpenGLError;   goto OpenGLError;
  }    }
Line 359
 
Line 371
  // Set the new PFD   // Set the new PFD
  if(SetPixelFormat(GLPREF_windowdc,pf,&pfd)==FALSE)    if(SetPixelFormat(GLPREF_windowdc,pf,&pfd)==FALSE)
  {   {
    errstr="SetPixelFormat";
  // unable to set the pixel format   // unable to set the pixel format
  goto OpenGLError;   goto OpenGLError;
  }   }
Line 366
 
Line 379
  // Now retrieve the PFD, we need to check some things   // Now retrieve the PFD, we need to check some things
  if(DescribePixelFormat(GLPREF_windowdc,pf,sizeof(PIXELFORMATDESCRIPTOR),&pfd_copy)==0)   if(DescribePixelFormat(GLPREF_windowdc,pf,sizeof(PIXELFORMATDESCRIPTOR),&pfd_copy)==0)
  {   {
    errstr="DescribePixelFormat";
  // unable to get the PFD   // unable to get the PFD
  goto OpenGLError;   goto OpenGLError;
  }   }
Line 381
 
Line 395
  GL_ResourceContext = wglCreateContext(GLPREF_windowdc);   GL_ResourceContext = wglCreateContext(GLPREF_windowdc);
  if(GL_ResourceContext==NULL)   if(GL_ResourceContext==NULL)
  {   {
    errstr="wglCreateContext";
  // we couldn't create a context!   // we couldn't create a context!
  goto OpenGLError;   goto OpenGLError;
  }   }
Line 398
 
Line 413
 OpenGLError:  OpenGLError:
  // Shutdown OpenGL   // Shutdown OpenGL
  OpenGL_Shutdown();   OpenGL_Shutdown();
  Error("opengl init error\n");   Error("opengl init error: %s\n",errstr);
  return false;   return false;
 }  }
   

Legend:
line(s) removed in v.1.6 
line(s) changed
 line(s) added in v.1.7