1 /* ______ ___ ___ 2 * /\ _ \ /\_ \ /\_ \ 3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ 4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ 5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ 6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ 7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ 8 * /\____/ 9 * \_/__/ 10 * 11 * Backward compatibility stuff. 12 * 13 * By Shawn Hargreaves. 14 * 15 * See readme.txt for copyright information. 16 */ 17 18 19 #ifndef ALLEGRO_COMPAT_H 20 #define ALLEGRO_COMPAT_H 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 27 #ifndef ALLEGRO_SRC 28 29 #ifndef ALLEGRO_NO_CLEAR_BITMAP_ALIAS 30 #if (defined ALLEGRO_GCC) clear(BITMAP * bmp)31 static __attribute__((unused)) __inline__ void clear(BITMAP *bmp) 32 { 33 clear_bitmap(bmp); 34 } 35 #else 36 static INLINE void clear(BITMAP *bmp) 37 { 38 clear_bitmap(bmp); 39 } 40 #endif 41 #endif 42 43 #endif /* !defined ALLEGRO_SRC */ 44 45 46 #define KB_NORMAL 1 47 #define KB_EXTENDED 2 48 49 #define SEND_MESSAGE object_message 50 51 #define cpu_fpu (cpu_capabilities & CPU_FPU) 52 #define cpu_mmx (cpu_capabilities & CPU_MMX) 53 #define cpu_3dnow (cpu_capabilities & CPU_3DNOW) 54 #define cpu_cpuid (cpu_capabilities & CPU_ID) 55 56 #define joy_x (joy[0].stick[0].axis[0].pos) 57 #define joy_y (joy[0].stick[0].axis[1].pos) 58 #define joy_left (joy[0].stick[0].axis[0].d1) 59 #define joy_right (joy[0].stick[0].axis[0].d2) 60 #define joy_up (joy[0].stick[0].axis[1].d1) 61 #define joy_down (joy[0].stick[0].axis[1].d2) 62 #define joy_b1 (joy[0].button[0].b) 63 #define joy_b2 (joy[0].button[1].b) 64 #define joy_b3 (joy[0].button[2].b) 65 #define joy_b4 (joy[0].button[3].b) 66 #define joy_b5 (joy[0].button[4].b) 67 #define joy_b6 (joy[0].button[5].b) 68 #define joy_b7 (joy[0].button[6].b) 69 #define joy_b8 (joy[0].button[7].b) 70 71 #define joy2_x (joy[1].stick[0].axis[0].pos) 72 #define joy2_y (joy[1].stick[0].axis[1].pos) 73 #define joy2_left (joy[1].stick[0].axis[0].d1) 74 #define joy2_right (joy[1].stick[0].axis[0].d2) 75 #define joy2_up (joy[1].stick[0].axis[1].d1) 76 #define joy2_down (joy[1].stick[0].axis[1].d2) 77 #define joy2_b1 (joy[1].button[0].b) 78 #define joy2_b2 (joy[1].button[1].b) 79 80 #define joy_throttle (joy[0].stick[2].axis[0].pos) 81 82 #define joy_hat ((joy[0].stick[1].axis[0].d1) ? 1 : \ 83 ((joy[0].stick[1].axis[0].d2) ? 3 : \ 84 ((joy[0].stick[1].axis[1].d1) ? 4 : \ 85 ((joy[0].stick[1].axis[1].d2) ? 2 : \ 86 0)))) 87 88 #define JOY_HAT_CENTRE 0 89 #define JOY_HAT_CENTER 0 90 #define JOY_HAT_LEFT 1 91 #define JOY_HAT_DOWN 2 92 #define JOY_HAT_RIGHT 3 93 #define JOY_HAT_UP 4 94 95 AL_FUNC_DEPRECATED(int, initialise_joystick, (void)); 96 97 98 /* in case you want to spell 'palette' as 'pallete' */ 99 #define PALLETE PALETTE 100 #define black_pallete black_palette 101 #define desktop_pallete desktop_palette 102 #define set_pallete set_palette 103 #define get_pallete get_palette 104 #define set_pallete_range set_palette_range 105 #define get_pallete_range get_palette_range 106 #define fli_pallete fli_palette 107 #define pallete_color palette_color 108 #define DAT_PALLETE DAT_PALETTE 109 #define select_pallete select_palette 110 #define unselect_pallete unselect_palette 111 #define generate_332_pallete generate_332_palette 112 #define generate_optimised_pallete generate_optimised_palette 113 114 115 /* a pretty vague name */ 116 #define fix_filename_path canonicalize_filename 117 118 119 /* the good old file selector */ 120 #define OLD_FILESEL_WIDTH -1 121 #define OLD_FILESEL_HEIGHT -1 122 123 AL_INLINE_DEPRECATED(int, file_select, (AL_CONST char *message, char *path, AL_CONST char *ext), 124 { 125 return file_select_ex(message, path, ext, 1024, OLD_FILESEL_WIDTH, OLD_FILESEL_HEIGHT); 126 }) 127 128 129 /* the old (and broken!) file enumeration function */ 130 AL_FUNC_DEPRECATED(int, for_each_file, (AL_CONST char *name, int attrib, AL_METHOD(void, callback, (AL_CONST char *filename, int attrib, int param)), int param)); 131 /* long is 32-bit only on some systems, and we want to list DVDs! */ 132 AL_FUNC_DEPRECATED(long, file_size, (AL_CONST char *filename)); 133 134 135 /* the old state-based textout functions */ 136 AL_VAR(int, _textmode); 137 AL_FUNC_DEPRECATED(int, text_mode, (int mode)); 138 139 AL_INLINE_DEPRECATED(void, textout, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x, int y, int color), 140 { 141 textout_ex(bmp, f, str, x, y, color, _textmode); 142 }) 143 144 AL_INLINE_DEPRECATED(void, textout_centre, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x, int y, int color), 145 { 146 textout_centre_ex(bmp, f, str, x, y, color, _textmode); 147 }) 148 149 AL_INLINE_DEPRECATED(void, textout_right, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x, int y, int color), 150 { 151 textout_right_ex(bmp, f, str, x, y, color, _textmode); 152 }) 153 154 AL_INLINE_DEPRECATED(void, textout_justify, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x1, int x2, int y, int diff, int color), 155 { 156 textout_justify_ex(bmp, f, str, x1, x2, y, diff, color, _textmode); 157 }) 158 159 AL_PRINTFUNC_DEPRECATED(void, textprintf, (struct BITMAP *bmp, AL_CONST FONT *f, int x, int y, int color, AL_CONST char *format, ...), 6, 7); 160 AL_PRINTFUNC_DEPRECATED(void, textprintf_centre, (struct BITMAP *bmp, AL_CONST FONT *f, int x, int y, int color, AL_CONST char *format, ...), 6, 7); 161 AL_PRINTFUNC_DEPRECATED(void, textprintf_right, (struct BITMAP *bmp, AL_CONST FONT *f, int x, int y, int color, AL_CONST char *format, ...), 6, 7); 162 AL_PRINTFUNC_DEPRECATED(void, textprintf_justify, (struct BITMAP *bmp, AL_CONST FONT *f, int x1, int x2, int y, int diff, int color, AL_CONST char *format, ...), 8, 9); 163 164 AL_INLINE_DEPRECATED(void, draw_character, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color), 165 { 166 draw_character_ex(bmp, sprite, x, y, color, _textmode); 167 }) 168 169 AL_INLINE_DEPRECATED(int, gui_textout, (struct BITMAP *bmp, AL_CONST char *s, int x, int y, int color, int centre), 170 { 171 return gui_textout_ex(bmp, s, x, y, color, _textmode, centre); 172 }) 173 174 175 /* the old close button functions */ 176 AL_INLINE_DEPRECATED(int, set_window_close_button, (int enable), 177 { 178 (void)enable; 179 return 0; 180 }) 181 182 AL_INLINE_DEPRECATED(void, set_window_close_hook, (void (*proc)(void)), 183 { 184 set_close_button_callback(proc); 185 }) 186 187 188 /* the weird old clipping API */ 189 AL_FUNC_DEPRECATED(void, set_clip, (BITMAP *bitmap, int x1, int y_1, int x2, int y2)); 190 191 192 /* unnecessary, can use rest(0) */ 193 AL_INLINE_DEPRECATED(void, yield_timeslice, (void), 194 { 195 ASSERT(system_driver); 196 197 if (system_driver->yield_timeslice) 198 system_driver->yield_timeslice(); 199 }) 200 201 202 /* DOS-ish monitor retrace ideas that don't work elsewhere */ 203 AL_FUNCPTR(void, retrace_proc, (void)); 204 205 206 /* Those were never documented, but we need to keep them for DLL compatibility, 207 * and to be on the safe side also let's keep them work regardless. 208 */ 209 AL_INLINE_DEPRECATED(void, set_file_encoding, (int encoding), 210 { 211 set_filename_encoding(encoding); 212 }) 213 AL_INLINE_DEPRECATED(int, get_file_encoding, (void), 214 { 215 return get_filename_encoding(); 216 }) 217 218 219 #ifdef ALLEGRO_SRC 220 AL_FUNC(int, timer_can_simulate_retrace, (void)); 221 AL_FUNC(void, timer_simulate_retrace, (int enable)); 222 #else 223 AL_FUNC_DEPRECATED(int, timer_can_simulate_retrace, (void)); 224 AL_FUNC_DEPRECATED(void, timer_simulate_retrace, (int enable)); 225 #endif 226 AL_FUNC_DEPRECATED(int, timer_is_using_retrace, (void)); 227 228 #ifdef __cplusplus 229 } 230 #endif 231 232 #endif /* ifndef ALLEGRO_COMPAT_H */ 233 234