📄 aintern.h
字号:
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Some definitions for internal use by the library code.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef AINTERN_H
#define AINTERN_H
#ifndef ALLEGRO_H
#error must include allegro.h first
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* flag for how many times we have been initialised */
AL_VAR(int, _allegro_count);
/* some Allegro functions need a block of scratch memory */
AL_VAR(void *, _scratch_mem);
AL_VAR(int, _scratch_mem_size);
AL_INLINE(void, _grow_scratch_mem, (int size),
{
if (size > _scratch_mem_size) {
size = (size+1023) & 0xFFFFFC00;
_scratch_mem = realloc(_scratch_mem, size);
_scratch_mem_size = size;
}
})
/* malloc wrappers for DLL <-> application shared memory */
AL_FUNC(void *, _al_malloc, (int size));
AL_FUNC(void, _al_free, (void *mem));
AL_FUNC(void *, _al_realloc, (void *mem, int size));
/* list of functions to call at program cleanup */
AL_FUNC(void, _add_exit_func, (AL_METHOD(void, func, (void))));
AL_FUNC(void, _remove_exit_func, (AL_METHOD(void, func, (void))));
/* helper structure for talking to Unicode strings */
typedef struct UTYPE_INFO
{
int id;
AL_METHOD(int, u_getc, (AL_CONST char *s));
AL_METHOD(int, u_getx, (char **s));
AL_METHOD(int, u_setc, (char *s, int c));
AL_METHOD(int, u_width, (AL_CONST char *s));
AL_METHOD(int, u_cwidth, (int c));
AL_METHOD(int, u_isok, (int c));
int u_width_max;
} UTYPE_INFO;
AL_FUNC(UTYPE_INFO *, _find_utype, (int type));
/* message stuff */
#define ALLEGRO_MESSAGE_SIZE 4096
/* wrappers for implementing disk I/O on different platforms */
AL_FUNC(int, _al_file_isok, (AL_CONST char *filename));
AL_FUNC(long, _al_file_size, (AL_CONST char *filename));
AL_FUNC(time_t, _al_file_time, (AL_CONST char *filename));
AL_FUNC(int, _al_drive_exists, (int drive));
AL_FUNC(int, _al_getdrive, (void));
AL_FUNC(void, _al_getdcwd, (int drive, char *buf, int size));
/* packfile stuff */
AL_VAR(int, _packfile_filesize);
AL_VAR(int, _packfile_datasize);
AL_VAR(int, _packfile_type);
AL_FUNC(PACKFILE *, _pack_fdopen, (int fd, AL_CONST char *mode));
/* various bits of mouse stuff */
AL_FUNC(void, _handle_mouse_input, (void));
AL_VAR(int, _mouse_x);
AL_VAR(int, _mouse_y);
AL_VAR(int, _mouse_z);
AL_VAR(int, _mouse_b);
AL_VAR(int, _mouse_on);
AL_VAR(int, _mouse_installed);
AL_VAR(int, _mouse_type);
AL_VAR(BITMAP *, _mouse_screen);
AL_VAR(BITMAP *, _mouse_pointer);
/* various bits of timer stuff */
AL_FUNC(long, _handle_timer_tick, (int interval));
#define MAX_TIMERS 16
/* list of active timer handlers */
typedef struct TIMER_QUEUE
{
AL_METHOD(void, proc, (void)); /* timer handler functions */
AL_METHOD(void, param_proc, (void *param));
void *param; /* param for param_proc if used */
long speed; /* timer speed */
long counter; /* counts down to zero=blastoff */
} TIMER_QUEUE;
AL_ARRAY(TIMER_QUEUE, _timer_queue);
AL_VAR(int, _timer_installed);
AL_VAR(int, _timer_use_retrace);
AL_VAR(volatile int, _retrace_hpp_value);
/* various bits of keyboard stuff */
AL_FUNC(void, _handle_key_press, (int keycode, int scancode));
AL_FUNC(void, _handle_key_release, (int scancode));
AL_VAR(int, _keyboard_installed);
AL_ARRAY(volatile char, _key);
AL_VAR(volatile int, _key_shifts);
AL_FUNC(void, _pckeys_init, (void));
AL_FUNC(void, _handle_pckey, (int code));
AL_FUNC(int, _pckey_scancode_to_ascii, (int scancode));
AL_VAR(unsigned short *, _key_ascii_table);
AL_VAR(unsigned short *, _key_capslock_table);
AL_VAR(unsigned short *, _key_shift_table);
AL_VAR(unsigned short *, _key_control_table);
AL_VAR(unsigned short *, _key_altgr_lower_table);
AL_VAR(unsigned short *, _key_altgr_upper_table);
AL_VAR(unsigned short *, _key_accent1_lower_table);
AL_VAR(unsigned short *, _key_accent1_upper_table);
AL_VAR(unsigned short *, _key_accent2_lower_table);
AL_VAR(unsigned short *, _key_accent2_upper_table);
AL_VAR(unsigned short *, _key_accent3_lower_table);
AL_VAR(unsigned short *, _key_accent3_upper_table);
AL_VAR(unsigned short *, _key_accent4_lower_table);
AL_VAR(unsigned short *, _key_accent4_upper_table);
AL_VAR(int, _key_accent1);
AL_VAR(int, _key_accent2);
AL_VAR(int, _key_accent3);
AL_VAR(int, _key_accent4);
AL_VAR(int, _key_accent1_flag);
AL_VAR(int, _key_accent2_flag);
AL_VAR(int, _key_accent3_flag);
AL_VAR(int, _key_accent4_flag);
AL_VAR(int, _key_standard_kb);
/* various bits of joystick stuff */
AL_VAR(int, _joy_type);
AL_VAR(int, _joystick_installed);
/* some GUI innards that other people need to use */
AL_FUNC(int, _gui_shadow_box_proc, (int msg, DIALOG *d, int c));
AL_FUNC(int, _gui_ctext_proc, (int msg, DIALOG *d, int c));
AL_FUNC(int, _gui_button_proc, (int msg, DIALOG *d, int c));
AL_FUNC(int, _gui_edit_proc, (int msg, DIALOG *d, int c));
AL_FUNC(int, _gui_list_proc, (int msg, DIALOG *d, int c));
AL_FUNC(int, _gui_text_list_proc, (int msg, DIALOG *d, int c));
AL_FUNC(void, _handle_scrollable_scroll_click, (DIALOG *d, int listsize, int *offset, int height));
AL_FUNC(void, _handle_scrollable_scroll, (DIALOG *d, int listsize, int *index, int *offset));
AL_FUNC(void, _handle_listbox_click, (DIALOG *d));
AL_FUNC(void, _draw_scrollable_frame, (DIALOG *d, int listsize, int offset, int height, int fg_color, int bg));
AL_FUNC(void, _draw_listbox, (DIALOG *d));
AL_FUNC(void, _draw_textbox, (char *thetext, int *listsize, int draw, int offset, int wword, int tabsize, int x, int y, int w, int h, int disabled, int fore, int deselect, int disable));
/* text- and font-related stuff */
typedef struct FONT_VTABLE
{
AL_METHOD(int, font_height, (AL_CONST FONT *f));
AL_METHOD(int, char_length, (AL_CONST FONT *f, int ch));
AL_METHOD(int, text_length, (AL_CONST FONT *f, AL_CONST char *text));
AL_METHOD(int, render_char, (AL_CONST FONT *f, int ch, int fg, int bg, BITMAP *bmp, int x, int y));
AL_METHOD(void, render, (AL_CONST FONT *f, AL_CONST char *text, int fg, int bg, BITMAP *bmp, int x, int y));
AL_METHOD(void, destroy, (FONT *f));
} FONT_VTABLE;
AL_VAR(FONT, _default_font);
AL_VAR(FONT_VTABLE, _font_vtable_mono);
AL_VAR(FONT_VTABLE *, font_vtable_mono);
AL_VAR(FONT_VTABLE, _font_vtable_color);
AL_VAR(FONT_VTABLE *, font_vtable_color);
AL_FUNC(FONT_GLYPH *, _mono_find_glyph, (AL_CONST FONT *f, int ch));
AL_FUNC(BITMAP *, _color_find_glyph, (AL_CONST FONT *f, int ch));
typedef struct FONT_MONO_DATA
{
int begin, end; /* first char and one-past-the-end char */
FONT_GLYPH **glyphs; /* our glyphs */
struct FONT_MONO_DATA *next; /* linked list structure */
} FONT_MONO_DATA;
typedef struct FONT_COLOR_DATA
{
int begin, end; /* first char and one-past-the-end char */
BITMAP **bitmaps; /* our glyphs */
struct FONT_COLOR_DATA *next; /* linked list structure */
} FONT_COLOR_DATA;
/* caches and tables for svga bank switching */
AL_VAR(int, _last_bank_1);
AL_VAR(int, _last_bank_2);
AL_VAR(int *, _gfx_bank);
/* bank switching routines (these use a non-C calling convention on i386!) */
AL_FUNC(unsigned long, _stub_bank_switch, (BITMAP *bmp, int line));
AL_FUNC(void, _stub_unbank_switch, (BITMAP *bmp));
AL_FUNC(void, _stub_bank_switch_end, (void));
#ifdef GFX_MODEX
AL_FUNC(unsigned long, _x_bank_switch, (BITMAP *bmp, int line));
AL_FUNC(void, _x_unbank_switch, (BITMAP *bmp));
AL_FUNC(void, _x_bank_switch_end, (void));
#endif
#ifdef GFX_VBEAF
AL_FUNC(void, _accel_bank_stub, (void));
AL_FUNC(void, _accel_bank_stub_end, (void));
AL_FUNC(void, _accel_bank_switch, (void));
AL_FUNC(void, _accel_bank_switch_end, (void));
AL_VAR(void *, _accel_driver);
AL_VAR(int, _accel_active);
AL_VAR(void *, _accel_set_bank);
AL_VAR(void *, _accel_idle);
AL_FUNC(void, _fill_vbeaf_libc_exports, (void *ptr));
AL_FUNC(void, _fill_vbeaf_pmode_exports, (void *ptr));
#endif
/* stuff for setting up bitmaps */
AL_FUNC(BITMAP *, _make_bitmap, (int w, int h, unsigned long addr, GFX_DRIVER *driver, int color_depth, int bpl));
AL_FUNC(void, _sort_out_virtual_width, (int *width, GFX_DRIVER *driver));
AL_FUNC(GFX_VTABLE *, _get_vtable, (int color_depth));
AL_VAR(GFX_VTABLE, _screen_vtable);
AL_VAR(int, _gfx_mode_set_count);
AL_VAR(int, _refresh_rate_request);
AL_VAR(int, _current_refresh_rate);
AL_VAR(int, _sub_bitmap_id_count);
AL_VAR(int, _screen_split_position);
AL_VAR(int, _safe_gfx_mode_change);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -