home *** CD-ROM | disk | FTP | other *** search
/ Learn 3D Graphics Programming on the PC / Learn_3D_Graphics_Programming_on_the_PC_Ferraro.iso / rwwin / common.c1_ / common.bin
Text File  |  1995-11-14  |  3KB  |  95 lines

  1. /**********************************************************************
  2.  *
  3.  * File :     common.c
  4.  *
  5.  * Abstract : Common definitions shared by all modules in the
  6.  *            RenderWare 3D Object Viewer.
  7.  *
  8.  *            This application had been written to be compatible with
  9.  *            both the fixed and floating-point versions of the
  10.  *            RenderWare library, i.e., it uses the macros CREAL,
  11.  *            INT2REAL, RAdd, RDiv, RSub etc. If your application is
  12.  *            intended for the floating-point version of the library
  13.  *            only these macros are not necessary.
  14.  *
  15.  *            Please note that this application is intended for
  16.  *            demonstration purposes only. No support will be
  17.  *            provided for this code and it comes with no warranty.
  18.  *
  19.  **********************************************************************
  20.  *
  21.  * This file is a product of Criterion Software Ltd.
  22.  *
  23.  * This file is provided as is with no warranties of any kind and is
  24.  * provided without any obligation on Criterion Software Ltd. or
  25.  * Canon Inc. to assist in its use or modification.
  26.  *
  27.  * Criterion Software Ltd. will not, under any
  28.  * circumstances, be liable for any lost revenue or other damages arising
  29.  * from the use of this file.
  30.  *
  31.  * Copyright (c) 1994, 1995 Criterion Software Ltd.
  32.  * All Rights Reserved.
  33.  *
  34.  * RenderWare is a trademark of Canon Inc.
  35.  *
  36.  **********************************************************************/
  37.  
  38. /**********************************************************************
  39.  *
  40.  * Header files.
  41.  *
  42.  **********************************************************************/
  43.  
  44. #include <windows.h>
  45. #include <rwlib.h>
  46. #include <rwwin.h>
  47.  
  48. #include "common.h"
  49.  
  50. /**********************************************************************
  51.  *
  52.  * Global data.
  53.  *
  54.  **********************************************************************/
  55.  
  56. /*
  57.  * The application instance handle (from rwview.c).
  58.  */ 
  59. HINSTANCE AppInstance;
  60.  
  61. /**********************************************************************
  62.  *
  63.  * Functions.
  64.  *
  65.  **********************************************************************/
  66.  
  67. /**********************************************************************/
  68.  
  69. /*
  70.  * Convert a RenderWare RwRGBColor to a Windows COLORREF.
  71.  */
  72. COLORREF
  73. RGBToColorRef(RwRGBColor *rgb)
  74. {
  75.     return PALETTERGB(REALTOBYTE((rgb)->r),
  76.                       REALTOBYTE((rgb)->g),
  77.                       REALTOBYTE((rgb)->b));
  78. }
  79.  
  80. /**********************************************************************/
  81.  
  82. /*
  83.  * Convert a Windows COLORREF to a RenderWare RwRGBColor.
  84.  */
  85. RwRGBColor *
  86. ColorRefToRGB(COLORREF color, RwRGBColor *rgb)
  87. {
  88.     rgb->r = BYTETOREAL(GetRValue(color));
  89.     rgb->g = BYTETOREAL(GetGValue(color));
  90.     rgb->b = BYTETOREAL(GetBValue(color));
  91.     return rgb;
  92. }
  93.  
  94. /**********************************************************************/
  95.