mglwin.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /****************************************************************************
  2. *
  3. * MegaGraph Graphics Library
  4. *
  5. * Copyright (C) 1996 SciTech Software.
  6. * All rights reserved.
  7. *
  8. * Filename: $Workfile: mglwin.h $
  9. * Version: $Revision: 1.14 $
  10. *
  11. * Language: ANSI C
  12. * Environment: IBM PC (MS DOS)
  13. *
  14. * Description: Header file for the MGLWIN bindings for MS Windows using
  15. * WinG in a window and WinDirect for full screen. The MGLWIN
  16. * binding only targets Win32 applications, so cannot be used
  17. * for 16 bit Windows development.
  18. *
  19. * $Date: 14 Mar 1997 16:09:34 $ $Author: KendallB $
  20. *
  21. ****************************************************************************/
  22. #ifndef __MGLWIN_H
  23. #define __MGLWIN_H
  24. #ifndef MGLWIN
  25. #define MGLWIN
  26. #endif
  27. /*---------------------- Macros and type definitions ----------------------*/
  28. typedef HWND MGL_HWND;
  29. typedef HDC MGL_HDC;
  30. typedef HINSTANCE MGL_HINSTANCE;
  31. /*------------------------- Function Prototypes ---------------------------*/
  32. #ifdef __cplusplus
  33. extern "C" { /* Use "C" linkage when in C++ mode */
  34. #endif
  35. /* Initialise the MGL for fullscreen output */
  36. bool MGLAPI MGL_init(m_int *driver,m_int *mode,const char *mglpath);
  37. /* Initialise the MGL just for Windowed output, not full screen */
  38. bool MGLAPI MGL_initWindowed(const char *mglpath);
  39. /* Function to register a fullscreen window with the MGL. If you wish
  40. * for the MGL to use your own window for fullscreen modes, you can
  41. * register it with this function. Note that when the MGL goes into
  42. * fullscreen modes, the attributes, size and position of the window are
  43. * modified to make it into a fullscreen Window necessary to cover the
  44. * entire desktop, and the state of the window will be restore to the original
  45. * format on return to normal GDI mode.
  46. *
  47. * Note that if you are using a common window for Windowed mode and fullscreen
  48. * modes of your application, you will need to ensure that certain messages
  49. * that you window normally handles in windowed modes are ignored when in
  50. * fullscreen modes.
  51. */
  52. void MGLAPI MGL_registerFullScreenWindow(HWND hwndFullScreen);
  53. /* Function to register a fullscreen event handling window procedure.
  54. * If you wish to do your own event handling, you can register your window
  55. * procedure with the MGL using this function and it will be called
  56. * when there are messages to be handled. You can still call the MGL_event()
  57. * functions even if you have registered an event handling procedure.
  58. */
  59. void MGLAPI MGL_registerEventProc(WNDPROC userWndProc);
  60. /* Change the active display mode. You must destroy all display device
  61. * contexts before calling this function, and re-create them again with
  62. * the new display mode. Does not affect any event handling hooks.
  63. */
  64. bool MGLAPI MGL_changeDisplayMode(m_int mode);
  65. /* Obtain the handle to the MGL fullscreen window when in fullscreen modes */
  66. MGL_HWND MGLAPI MGL_getFullScreenWindow(void);
  67. /* Tell the MGL what your applications main window is */
  68. void MGLAPI MGL_setMainWindow(MGL_HWND hwnd);
  69. /* Tell the MGL your applications instance handle (call before all funcs!) */
  70. void MGLAPI MGL_setAppInstance(MGL_HINSTANCE hInstApp);
  71. /* Device context management */
  72. MGLDC * MGLAPI MGL_createDisplayDC(m_int numBuffers);
  73. MGLDC * MGLAPI MGL_createSrollingDC(m_int virtualX,m_int virtualY,m_int numBuffers);
  74. MGLDC * MGLAPI MGL_createOffscreenDC(void);
  75. MGLDC * MGLAPI MGL_createLinearOffscreenDC(void);
  76. MGLDC * MGLAPI MGL_createWindowedDC(MGL_HWND hwnd);
  77. MGLDC * MGLAPI MGL_createMemoryDC(m_int xSize,m_int ySize,m_int bitsPerPixel,pixel_format_t *pf);
  78. bool MGLAPI MGL_destroyDC(MGLDC *dc);
  79. /* Get a Windows HDC for the MGL device context. You can use this returned
  80. * HDC to get GDI to draw to the device context surface, such as rendering
  81. * and using TrueType fonts with the MGL. If a Windows compatible HDC is not
  82. * available, this function will return NULL.
  83. */
  84. HDC MGLAPI MGL_getWinDC(MGLDC *dc);
  85. /* Associate a Window manager DC with the MGLDC for painting */
  86. bool MGLAPI MGL_setWinDC(MGLDC *dc,MGL_HDC hdc);
  87. /* Activate the WindowDC's palette */
  88. bool MGLAPI MGL_activatePalette(MGLDC *dc,bool unrealize);
  89. /* Let the MGL know when your application is being activated or deactivated.
  90. * This function only needs to be called when running in Windowed modes and
  91. * you have set the system palette to SYSPAL_NOSTATIC mode, to ensure
  92. * that the MGL can properly re-map your application palette when your
  93. * app is not active and allow Windows to re-map your bitmap colors on the
  94. * fly. This function should be passed a pointer to the currently active
  95. * MGL Windowed DC and a flag to indicate whether the app is in the background
  96. * or not.
  97. */
  98. void MGLAPI MGL_appActivate(MGLDC *winDC,bool active);
  99. /* Generic helper functions */
  100. ulong MGLAPI MGL_getTicks(void);
  101. ulong MGLAPI MGL_getTickResolution(void);
  102. void MGLAPI MGL_delay(m_int millseconds);
  103. void MGLAPI MGL_beep(m_int freq,m_int milliseconds);
  104. /* Fullscreen specific routines */
  105. void MGLAPI MGL_setPaletteSnowLevel(MGLDC *dc,m_int level);
  106. m_int MGLAPI MGL_getPaletteSnowLevel(MGLDC *dc);
  107. /* Determine if a specific scancode'ed key is held down (PC specific) */
  108. bool MGLAPI EVT_isKeyDown(uchar scanCode);
  109. #ifdef __cplusplus
  110. } /* End of "C" linkage for C++ */
  111. #endif
  112. #endif /* __MGLWIN_H */