1 /* ______ ___ ___ 2 * /\ _ \ /\_ \ /\_ \ 3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ 4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ 5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ 6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ 7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ 8 * /\____/ 9 * \_/__/ 10 * 11 * Some definitions for internal use by the Windows library code. 12 * 13 * By Stefan Schimanski. 14 * 15 * See readme.txt for copyright information. 16 */ 17 18 19 #ifndef AINTWIN_H 20 #define AINTWIN_H 21 22 #ifndef ALLEGRO_H 23 #error must include allegro.h first 24 #endif 25 26 #ifndef ALLEGRO_WINDOWS 27 #error bad include 28 #endif 29 30 31 #include "winalleg.h" 32 33 #ifndef SCAN_DEPEND 34 /* workaround for buggy MinGW32 headers */ 35 #ifdef ALLEGRO_MINGW32 36 #ifndef HMONITOR_DECLARED 37 #define HMONITOR_DECLARED 38 #endif 39 #if (defined _HRESULT_DEFINED) && (defined WINNT) 40 #undef WINNT 41 #endif 42 #endif 43 44 #include <objbase.h> /* for LPGUID */ 45 #endif 46 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 /* generals */ 53 AL_VAR(HINSTANCE, allegro_inst); 54 AL_VAR(HANDLE, allegro_thread); 55 AL_VAR(CRITICAL_SECTION, allegro_critical_section); 56 AL_VAR(int, _dx_ver); 57 58 #define _enter_critical() EnterCriticalSection(&allegro_critical_section) 59 #define _exit_critical() LeaveCriticalSection(&allegro_critical_section) 60 61 AL_FUNC(int, init_directx_window, (void)); 62 AL_FUNC(void, exit_directx_window, (void)); 63 AL_FUNC(int, get_dx_ver, (void)); 64 AL_FUNC(int, adjust_window, (int w, int h)); 65 AL_FUNC(void, restore_window_style, (void)); 66 AL_FUNC(void, save_window_pos, (void)); 67 68 69 /* main window */ 70 #define WND_TITLE_SIZE 128 71 72 AL_ARRAY(char, wnd_title); 73 AL_VAR(int, wnd_x); 74 AL_VAR(int, wnd_y); 75 AL_VAR(int, wnd_width); 76 AL_VAR(int, wnd_height); 77 AL_VAR(int, wnd_sysmenu); 78 79 AL_FUNCPTR(void, user_close_proc, (void)); 80 81 82 /* gfx synchronization */ 83 AL_VAR(CRITICAL_SECTION, gfx_crit_sect); 84 AL_VAR(int, gfx_crit_sect_nesting); 85 86 #define _enter_gfx_critical() EnterCriticalSection(&gfx_crit_sect); \ 87 gfx_crit_sect_nesting++ 88 #define _exit_gfx_critical() LeaveCriticalSection(&gfx_crit_sect); \ 89 gfx_crit_sect_nesting-- 90 #define GFX_CRITICAL_RELEASED (!gfx_crit_sect_nesting) 91 92 93 /* switch routines */ 94 AL_VAR(int, _win_app_foreground); 95 96 AL_FUNC(void, sys_directx_display_switch_init, (void)); 97 AL_FUNC(void, sys_directx_display_switch_exit, (void)); 98 AL_FUNC(int, sys_directx_set_display_switch_mode, (int mode)); 99 100 AL_FUNC(void, _win_switch_in, (void)); 101 AL_FUNC(void, _win_switch_out, (void)); 102 AL_FUNC(void, _win_reset_switch_mode, (void)); 103 104 AL_FUNC(int, _win_thread_switch_out, (void)); 105 106 107 /* main window routines */ 108 AL_FUNC(int, wnd_call_proc, (int (*proc)(void))); 109 AL_FUNC(void, wnd_schedule_proc, (int (*proc)(void))); 110 111 112 /* input routines */ 113 AL_VAR(int, _win_input_events); 114 AL_ARRAY(HANDLE, _win_input_event_id); 115 AL_FUNCPTRARRAY(void, _win_input_event_handler, (void)); 116 117 AL_FUNC(void, _win_input_init, (int need_thread)); 118 AL_FUNC(void, _win_input_exit, (void)); 119 AL_FUNC(int, _win_input_register_event, (HANDLE event_id, void (*event_handler)(void))); 120 AL_FUNC(void, _win_input_unregister_event, (HANDLE event_id)); 121 122 123 /* keyboard routines */ 124 AL_FUNC(int, key_dinput_acquire, (void)); 125 AL_FUNC(int, key_dinput_unacquire, (void)); 126 127 128 /* mouse routines */ 129 AL_VAR(HCURSOR, _win_hcursor); 130 AL_FUNC(int, mouse_dinput_acquire, (void)); 131 AL_FUNC(int, mouse_dinput_unacquire, (void)); 132 AL_FUNC(int, mouse_dinput_grab, (void)); 133 AL_FUNC(int, mouse_set_syscursor, (void)); 134 AL_FUNC(int, mouse_set_sysmenu, (int state)); 135 136 137 /* joystick routines */ 138 #define WINDOWS_MAX_AXES 6 139 140 #define WINDOWS_JOYSTICK_INFO_MEMBERS \ 141 int caps; \ 142 int num_axes; \ 143 int axis[WINDOWS_MAX_AXES]; \ 144 char *axis_name[WINDOWS_MAX_AXES]; \ 145 int hat; \ 146 char *hat_name; \ 147 int num_buttons; \ 148 int button[MAX_JOYSTICK_BUTTONS]; \ 149 char *button_name[MAX_JOYSTICK_BUTTONS]; 150 151 typedef struct WINDOWS_JOYSTICK_INFO { 152 WINDOWS_JOYSTICK_INFO_MEMBERS 153 } WINDOWS_JOYSTICK_INFO; 154 155 AL_FUNC(int, win_add_joystick, (WINDOWS_JOYSTICK_INFO *win_joy)); 156 AL_FUNC(void, win_remove_all_joysticks, (void)); 157 AL_FUNC(int, win_update_joystick_status, (int n, WINDOWS_JOYSTICK_INFO *win_joy)); 158 159 AL_FUNC(int, joystick_dinput_acquire, (void)); 160 AL_FUNC(int, joystick_dinput_unacquire, (void)); 161 162 163 /* thread routines */ 164 AL_FUNC(void, _win_thread_init, (void)); 165 AL_FUNC(void, _win_thread_exit, (void)); 166 167 168 /* synchronization routines */ 169 AL_FUNC(void *, sys_directx_create_mutex, (void)); 170 AL_FUNC(void, sys_directx_destroy_mutex, (void *handle)); 171 AL_FUNC(void, sys_directx_lock_mutex, (void *handle)); 172 AL_FUNC(void, sys_directx_unlock_mutex, (void *handle)); 173 174 175 /* sound routines */ 176 AL_FUNC(_DRIVER_INFO *, _get_win_digi_driver_list, (void)); 177 AL_FUNC(void, _free_win_digi_driver_list, (void)); 178 179 AL_FUNC(DIGI_DRIVER *, _get_dsalmix_driver, (char *name, LPGUID guid, int num)); 180 AL_FUNC(void, _free_win_dsalmix_name_list, (void)); 181 AL_FUNC(DIGI_DRIVER *, _get_woalmix_driver, (int num)); 182 183 AL_FUNC(int, digi_directsound_capture_init, (LPGUID guid)); 184 AL_FUNC(void, digi_directsound_capture_exit, (void)); 185 AL_FUNC(int, digi_directsound_capture_detect, (LPGUID guid)); 186 AL_FUNC(int, digi_directsound_rec_cap_rate, (int bits, int stereo)); 187 AL_FUNC(int, digi_directsound_rec_cap_param, (int rate, int bits, int stereo)); 188 AL_FUNC(int, digi_directsound_rec_source, (int source)); 189 AL_FUNC(int, digi_directsound_rec_start, (int rate, int bits, int stereo)); 190 AL_FUNC(void, digi_directsound_rec_stop, (void)); 191 AL_FUNC(int, digi_directsound_rec_read, (void *buf)); 192 193 194 /* midi routines */ 195 AL_FUNC(_DRIVER_INFO *, _get_win_midi_driver_list, (void)); 196 AL_FUNC(void, _free_win_midi_driver_list, (void)); 197 198 AL_FUNC(void, midi_switch_out, (void)); 199 200 201 /* file routines */ 202 AL_VAR(int, _al_win_unicode_filenames); 203 204 205 /* error handling */ 206 AL_FUNC(char* , win_err_str, (long err)); 207 AL_FUNC(void, thread_safe_trace, (char *msg, ...)); 208 209 #if DEBUGMODE >= 2 210 #define _TRACE thread_safe_trace 211 #else 212 #define _TRACE 1 ? (void) 0 : thread_safe_trace 213 #endif 214 215 216 #ifdef __cplusplus 217 } 218 #endif 219 220 #endif /* !defined AINTWIN_H */ 221 222