Difference for arch/win32/glinit.c from version 1.2 to 1.3


version 1.2 version 1.3
Line 1
 
Line 1
 #include "ogl_init.h"  //nothing to do, everything is in wgl.c.  Just some empty funcs to make it happy. -MM
   
 #include <stdio.h>  
 #include <stdlib.h>  
 #include <string.h>  
 #include <windows.h>  
 #include <mmsystem.h>  
 #include "args.h"  
   
 HINSTANCE hInst;  
 HWND g_hWnd;  
   
 extern int Inferno_verbose;  
   
 static int mouse_hidden=0;  
   
   
 //extern unsigned int key_wparam, key_lparam, key_msg;  
 void keyboard_handler();  
 extern int WMKey_Handler_Ready;  
   
 HDC hDC;  
 HGLRC hRC;  
   
 // Enable OpenGL  
 /*  
 VOID EnableOpenGL( HWND hWnd, HDC * hDC, HGLRC * hRC )  
 {  
   PIXELFORMATDESCRIPTOR pfd;  
   int iFormat;  
   
   // get the device context (DC)  
   *hDC = GetDC( hWnd );  
   
   // set the pixel format for the DC  
   ZeroMemory( &pfd, sizeof( pfd ) );  
   pfd.nSize = sizeof( pfd );  
   pfd.nVersion = 1;  
   pfd.dwFlags = PFD_DRAW_TO_WINDOW |   
     PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;  
   pfd.iPixelType = PFD_TYPE_RGBA;  
   pfd.cColorBits = 24;  
   //pfd.cDepthBits = 16;  
   pfd.cDepthBits = 0;//we don't use depth buffering.  
   pfd.iLayerType = PFD_MAIN_PLANE;  
   iFormat = ChoosePixelFormat( *hDC, &pfd );  
   SetPixelFormat( *hDC, iFormat, &pfd );  
   
 #ifdef OGL_RUNTIME_LOAD  
   ogl_init_load_library();  
 #endif  
   
   // create and enable the render context (RC)  
   *hRC = wglCreateContext( *hDC );  
   wglMakeCurrent( *hDC, *hRC );  
   
 }  
   
 // Disable OpenGL  
   
 VOID DisableOpenGL( HWND hWnd, HDC hDC, HGLRC hRC )  
 {  
   wglMakeCurrent( NULL, NULL );  
   wglDeleteContext( hRC );  
   ReleaseDC( hWnd, hDC );  
 }  
 */  
 static void finiObjects()  
 {  
    if(mouse_hidden)  
     ShowCursor(TRUE);  
   
  //  DisableOpenGL( g_hWnd, hDC, hRC );  
 }   
   
   
 void PumpMessages(void)  
 {  
   MSG msg;  
   
   while (PeekMessage(&msg,NULL,0,0,PM_REMOVE|PM_NOYIELD))  
   {  
  TranslateMessage(&msg);  
  DispatchMessage(&msg);  
   }  
 }  
   
 long PASCAL DescentWndProc(HWND hWnd,UINT message,  
     WPARAM wParam,LPARAM lParam )  
 {  
   switch(message)  
   {  
   
    case WM_KEYDOWN:  
    case WM_KEYUP:  
  if (WMKey_Handler_Ready) {  
 //      key_wparam=wParam; key_lparam=lParam; key_msg=message;  
    keyboard_handler();  
  }  
  break;  
    case WM_MOUSEMOVE:  
    case WM_LBUTTONDOWN:  
    case WM_LBUTTONUP:  
    case WM_RBUTTONDOWN:  
    case WM_RBUTTONUP:  
    case WM_NCMOUSEMOVE:  
    case WM_NCLBUTTONDOWN:  
    case WM_NCLBUTTONUP:  
    case WM_NCRBUTTONDOWN:  
    case WM_NCRBUTTONUP:  
  break;  
    case WM_PALETTECHANGED:  
    case WM_PALETTEISCHANGING:  
    return 0;  
    case WM_ACTIVATEAPP:  
 //     Win32_Key_Hook(wParam);  
 // DPH: This doesn't work... no idea why not...  
  break;  
    case WM_DESTROY:  
          finiObjects();  
  PostQuitMessage(0);  
  break;  
   }  
   return DefWindowProc(hWnd,message,wParam,lParam);  
 }  
   
 void arch_init_start()  void arch_init_start()
 {  {
  WNDCLASS wcDescentClass;  
   
  wcDescentClass.lpszClassName = "WinD1X";  
  wcDescentClass.hInstance     = hInst;  
  wcDescentClass.lpfnWndProc   = DescentWndProc;  
  wcDescentClass.hCursor       = LoadCursor(NULL, IDC_ARROW);  
  wcDescentClass.hIcon         = LoadIcon(NULL, IDI_WINLOGO);  
  wcDescentClass.lpszMenuName  = NULL;  
  wcDescentClass.hbrBackground = NULL;  
  wcDescentClass.style         = CS_OWNDC;  
  wcDescentClass.cbClsExtra    = 0;  
  wcDescentClass.cbWndExtra    = 0;  
   
  // Register the class  
  RegisterClass(&wcDescentClass);  
  g_hWnd = CreateWindowEx(0,  
  "WinD1X",  
  "Descent",  
  WS_POPUP | WS_SYSMENU,  
 // WS_OVERLAPPED | WS_BORDER,  
  0, 0,  
  GetSystemMetrics(SM_CXSCREEN),  
  GetSystemMetrics(SM_CYSCREEN),  
  NULL,  
  NULL,  
  hInst,  
  NULL  
     );  
   
  if (!g_hWnd) return; // CRAP!  
  ShowWindow(g_hWnd,SW_SHOWNORMAL);  
  UpdateWindow(g_hWnd);  
   
  //        EnableOpenGL( g_hWnd, &hDC, &hRC);  
 }  }
   
 extern void key_init(void);  
 extern void mouse_init(void);  
 //added/changed 3/7/99 Owen Evans (next line)  
 extern void joy_init(int joyid);  
   
 void arch_init()  void arch_init()
 {  {
   
         ShowCursor(FALSE);  
         mouse_hidden = 1;  
   
  key_init();  
  mouse_init();  
         joy_init(JOYSTICKID1);  
  printf("arch_init successfully completed\n");  
 }  }

Legend:
line(s) removed in v.1.2 
line(s) changed
 line(s) added in v.1.3