Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
GRAPHICS: Allegro 4 compatibility layer

Data Structures

struct  BITMAP
 Allegro 4 bitmap. More...
struct  RGB
 palette entry, unused in 32 bit mode More...

Macros

#define ALLEGRO_ERROR_SIZE   256
 size of the allegro_error buffer
#define ALLEGTTF_NOSMOOTH   0
 no anti aliasing
#define ALLEGTTF_REALSMOOTH   2
 anti aliased
#define ALLEGTTF_TTFSMOOTH   1
 anti aliased
#define bmp_write15(addr, c)
 write a pixel at addr, only 32 bit bitmaps exist
#define bmp_write16(addr, c)
 write a pixel at addr, only 32 bit bitmaps exist
#define bmp_write24(addr, c)
 write a pixel at addr, only 32 bit bitmaps exist
#define bmp_write32(addr, c)
 write a 32 bit pixel at addr
#define bmp_write8(addr, c)
 write a pixel at addr, only 32 bit bitmaps exist
#define BPM_TO_TIMER(x)
 convert beats per minute to timer ticks
#define BPS_TO_TIMER(x)
 convert beats per second to timer ticks
#define DIGI_AUTODETECT   -1
 any digital driver
#define DIGI_NONE   0
 no digital sound
#define DRAW_MODE_SOLID   0
 drawing mode: plain copy
#define DRAW_MODE_TRANS   5
 drawing mode: blend with the current blender
#define END_OF_FUNCTION(x)
 no-op
#define END_OF_MAIN()
 no-op, Allegro 5 programs need no END_OF_MAIN
#define END_OF_STATIC_FUNCTION(x)
 no-op
#define fixtof(x)
 fixed to double
#define fixtoi(x)
 fixed to int, rounded
#define ftofix(x)
 double to fixed
#define GET   4321
 gfx_status() action: read the status (same value as n_common.h's)
#define get_keyboard   a4_get_keyboard
 the old nilorea name of a4_get_keyboard()
#define GFX_AUTODETECT   0
 any mode, windowed here
#define GFX_AUTODETECT_FULLSCREEN   1
 fullscreen
#define GFX_AUTODETECT_WINDOWED   2
 windowed
#define GFX_DIRECTX   4
 DirectX fullscreen, mapped to fullscreen.
#define GFX_DIRECTX_WIN   5
 DirectX windowed, mapped to windowed.
#define GFX_OPENGL   8
 AllegroGL, windowed.
#define GFX_OPENGL_FULLSCREEN   7
 AllegroGL fullscreen: screen is shown on allegro_gl_flip() only.
#define GFX_OPENGL_WINDOWED   6
 AllegroGL windowed: screen is shown on allegro_gl_flip() only.
#define GFX_SAFE   3
 windowed
#define GFX_TEXT   -1
 leave graphics mode
#define GL_COLOR_BUFFER_BIT   0x00004000
 no-op: screen is redrawn whole on every flip
#define glClear(mask)
 no-op: screen is redrawn whole on every flip
#define itofix(x)
 int to fixed
#define KEY_0   27
 key code
#define KEY_1   28
 key code
#define KEY_2   29
 key code
#define KEY_3   30
 key code
#define KEY_4   31
 key code
#define KEY_5   32
 key code
#define KEY_6   33
 key code
#define KEY_7   34
 key code
#define KEY_8   35
 key code
#define KEY_9   36
 key code
#define KEY_A   1
 key code
#define KEY_ALT   219
 key code
#define KEY_ALTGR   220
 key code
#define KEY_B   2
 key code
#define KEY_BACKSPACE   63
 key code
#define KEY_C   3
 key code
#define KEY_D   4
 key code
#define KEY_DEL   77
 key code
#define KEY_DOWN   85
 key code
#define KEY_E   5
 key code
#define KEY_END   79
 key code
#define KEY_ENTER   67
 key code
#define KEY_ENTER_PAD   91
 key code
#define KEY_ESC   59
 key code
#define KEY_F   6
 key code
#define KEY_F1   47
 key code
#define KEY_F10   56
 key code
#define KEY_F11   57
 key code
#define KEY_F12   58
 key code
#define KEY_F2   48
 key code
#define KEY_F3   49
 key code
#define KEY_F4   50
 key code
#define KEY_F5   51
 key code
#define KEY_F6   52
 key code
#define KEY_F7   53
 key code
#define KEY_F8   54
 key code
#define KEY_F9   55
 key code
#define KEY_G   7
 key code
#define KEY_H   8
 key code
#define KEY_HOME   78
 key code
#define KEY_I   9
 key code
#define KEY_INSERT   76
 key code
#define KEY_J   10
 key code
#define KEY_K   11
 key code
#define KEY_L   12
 key code
#define KEY_LCONTROL   217
 key code
#define KEY_LEFT   82
 key code
#define KEY_LSHIFT   215
 key code
#define KEY_M   13
 key code
#define KEY_MAX   227
 number of entries in key[]
#define KEY_N   14
 key code
#define KEY_O   15
 key code
#define KEY_P   16
 key code
#define KEY_PGDN   81
 key code
#define KEY_PGUP   80
 key code
#define KEY_Q   17
 key code
#define KEY_R   18
 key code
#define KEY_RCONTROL   218
 key code
#define KEY_RIGHT   83
 key code
#define KEY_RSHIFT   216
 key code
#define KEY_S   19
 key code
#define KEY_SPACE   75
 key code
#define KEY_T   20
 key code
#define KEY_TAB   64
 key code
#define KEY_U   21
 key code
#define KEY_UP   84
 key code
#define KEY_V   22
 key code
#define KEY_W   23
 key code
#define KEY_X   24
 key code
#define KEY_Y   25
 key code
#define KEY_Z   26
 key code
#define LEX_MENU_NORMAL   0
 item state for lexMenuGetBitmap(): normal
#define LEX_MENU_OVER   1
 item state for lexMenuGetBitmap(): under the pointer
#define LOCK_FUNCTION(x)
 no-op
#define LOCK_VARIABLE(x)
 no-op
#define MIDI_AUTODETECT   -1
 any MIDI driver
#define MIDI_NONE   0
 no MIDI
#define MODE_OGL   1
 gfx_status() value: an AllegroGL mode
#define MODE_STD   0
 gfx_status() value: a non OpenGL mode
#define MSEC_TO_TIMER(x)
 convert milliseconds to timer ticks
#define SCREEN_H   (screen ? screen->h : 0)
 screen height
#define SCREEN_W   (screen ? screen->w : 0)
 screen width
#define SECS_TO_TIMER(x)
 convert seconds to timer ticks
#define SET   1234
 gfx_status() action: set the status (same value as n_common.h's)
#define TIMERS_PER_SECOND   1193181L
 ticks per second of install_int_ex() speeds
#define U_ASCII   0x41534338
 unicode format id, ignored
#define U_UTF8   0x55544638
 unicode format id, ignored

Typedefs

typedef int32_t fixed
 16.16 fixed point number

Functions

uint32_t _a4_pixel_from_color (int color)
 store a colour as it is kept in a bitmap (opaque when its alpha byte is 0)
int a4_get_keyboard (char *keybuf, int *cur, int flags, int max)
 read the typed keys into keybuf at *cur (printable ASCII, backspace erases), keeping it nul terminated within max bytes; flags is ignored.
void adjust_sample (const SAMPLE *spl, int vol, int pan, int freq, int loop)
 change the settings of the playing instances of a sample
int alert (const char *s1, const char *s2, const char *s3, const char *b1, const char *b2, int c1, int c2)
 a box with up to three lines and one or two buttons (b2 may be NULL), chosen with the mouse, the c1 / c2 shortcut keys, Enter (first) or Escape (second): 1 or 2
void allegro_exit (void)
 shut everything down
void allegro_gl_flip (void)
 show the screen bitmap
void allegro_gl_set_allegro_mode (void)
 no-op
void allegro_gl_unset_allegro_mode (void)
 no-op
int allegro_init (void)
 init the layer and Allegro 5
void allegro_message (const char *format,...)
 show a message: a box over the screen, or stderr without a display
int bitmap_color_depth (BITMAP *bmp)
 always 32
int bitmap_mask_color (BITMAP *bmp)
 the mask colour, magenta
void blit (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
 copy a rectangle
uintptr_t bmp_read_line (BITMAP *bmp, int y)
 lock the bitmap and return the address of line y, 32 bit ARGB pixels
void bmp_select (BITMAP *bmp)
 no-op
void bmp_unwrite_line (BITMAP *bmp)
 no-op, the bitmap is unlocked when next drawn with the GPU
uintptr_t bmp_write_line (BITMAP *bmp, int y)
 lock the bitmap and return the address of line y, 32 bit ARGB pixels
void circle (BITMAP *bmp, int x, int y, int radius, int color)
 draw a circle outline
void circlefill (BITMAP *bmp, int x, int y, int radius, int color)
 draw a filled circle
void clear (BITMAP *bmp)
 clear to black
void clear_bitmap (BITMAP *bmp)
 clear to black
void clear_keybuf (void)
 empty the readkey() buffer
void clear_to_color (BITMAP *bmp, int color)
 clear to a colour
BITMAP * create_bitmap (int width, int height)
 create a w x h bitmap
BITMAP * create_bitmap_ex (int depth, int width, int height)
 same as create_bitmap(), depth is ignored
BITMAP * create_video_bitmap (int width, int height)
 same as create_bitmap()
void destroy_bitmap (BITMAP *bmp)
 free a bitmap
void destroy_font (FONT *f)
 free a font loaded with load_ttf_font()
void destroy_midi (MIDI *midi)
 free a MIDI song, stopping it if it plays
void destroy_sample (SAMPLE *spl)
 free a sample, stopping it
void draw_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y)
 draw a sprite
void draw_sprite_h_flip (BITMAP *bmp, BITMAP *sprite, int x, int y)
 draw a sprite mirrored horizontally
void draw_sprite_v_flip (BITMAP *bmp, BITMAP *sprite, int x, int y)
 draw a sprite mirrored vertically
void draw_sprite_vh_flip (BITMAP *bmp, BITMAP *sprite, int x, int y)
 draw a sprite mirrored both ways
void draw_trans_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y)
 draw a sprite with the current blender (set_alpha_blender / set_trans_blender)
void drawing_mode (int mode, BITMAP *pattern, int x_anchor, int y_anchor)
 set the drawing mode of primitives, pattern arguments are ignored
void ellipse (BITMAP *bmp, int x, int y, int rx, int ry, int color)
 draw an ellipse outline
void ellipsefill (BITMAP *bmp, int x, int y, int rx, int ry, int color)
 draw a filled ellipse
void fill_str (char *str, int c, size_t len)
 fill len bytes of str with c
int get_color_depth (void)
 return the color depth (always 32)
void get_mouse_mickeys (int *mickeyx, int *mickeyy)
 movement since the last call
int geta (int c)
 alpha component, 255 for an opaque colour
int getb (int c)
 blue component
int getg (int c)
 green component
int getpixel (BITMAP *bmp, int x, int y)
 read a pixel, -1 outside the bitmap
int getr (int c)
 red component
int gfx_mode (int mode, int w, int h, int v_w, int v_h, int depth, double r, double g, double b, double a)
 set the color depth and the graphics mode in one go, clearing the screen to (r,g,b), components in 0-1 or 0-255; TRUE or FALSE
int gfx_status (int action, int value)
 with GET, MODE_OGL when the current mode is an AllegroGL one, else MODE_STD
void hline (BITMAP *bmp, int x1, int y, int x2, int color)
 draw a horizontal line
int install_allegro_gl (void)
 no-op, the layer always uses Allegro 5's own driver
int install_int (void(*proc)(void), int speed)
 call proc every speed milliseconds, from the timer thread
int install_int_ex (void(*proc)(void), long speed)
 call proc every speed timer ticks, from the timer thread
int install_keyboard (void)
 start the input thread for the keyboard
int install_mouse (void)
 start the input thread for the mouse
int install_sound (int digi, int midi, const char *cfg_path)
 start the audio, cfg_path is ignored
int install_timer (void)
 no-op, timers are always available
int is_memory_bitmap (BITMAP *bmp)
 always FALSE: pixels are reached through bmp_write_line()
int keypressed (void)
 TRUE if a key is waiting in the readkey() buffer.
LexMenu * lexLoadMenuFromFile (const char *file, const char *section)
 load menu section from INI file file, NULL on error
LexMenu * lexMenuDestroy (LexMenu *menu)
 free a menu, returns NULL
BITMAP * lexMenuGetBitmap (LexMenu *menu, int item, int state)
 the image of item item in state state, NULL if there is none
int lexMenuRun (LexMenu *menu, BITMAP *buf)
 run the menu, drawing into buf: the chosen item index, -1 on escape
void line (BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
 draw a line
BITMAP * load_bitmap (const char *filename, RGB *pal)
 load a BMP, PCX, TGA, PNG or JPG file, pal is ignored
MIDI * load_midi (const char *filename)
 load a MIDI file
SAMPLE * load_sample (const char *filename)
 load a WAV, OGG, FLAC or VOC file
FONT * load_ttf_font (const char *filename, int points, int smooth)
 load a TrueType font at the given pixel size
FONT * load_ttf_font_mem (const char *filename, int points, int smooth)
 same as load_ttf_font()
int makeacol (int r, int g, int b, int a)
 make a colour with alpha
int makeacol32 (int r, int g, int b, int a)
 make a colour with alpha
int makecol (int r, int g, int b)
 make an opaque colour
int makecol32 (int r, int g, int b)
 make an opaque colour
void masked_blit (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
 copy a rectangle, skipping mask colour pixels
void masked_stretch_blit (BITMAP *source, BITMAP *dest, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h)
 copy and scale a rectangle, skipping mask colour pixels
void midi_pause (void)
 pause the MIDI song
void midi_resume (void)
 resume the MIDI song
void pivot_scaled_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale)
 rotate and scale a sprite around (cx,cy) in the sprite, drawn at (x,y)
void pivot_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle)
 rotate a sprite around (cx,cy) in the sprite, drawn at (x,y)
int play_midi (MIDI *midi, int loop)
 play a MIDI song, replacing the current one, NULL stops
int play_sample (const SAMPLE *spl, int vol, int pan, int freq, int loop)
 play a sample: vol and pan 0-255, freq 1000 = normal speed
int poll_keyboard (void)
 no-op, input is updated by a thread
int poll_mouse (void)
 no-op, input is updated by a thread
void position_mouse (int x, int y)
 move the mouse pointer
void putpixel (BITMAP *bmp, int x, int y, int color)
 write a pixel
int readkey (void)
 wait for a key: (scancode << 8) | ascii
void rect (BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
 draw a rectangle outline
void rectfill (BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
 draw a filled rectangle
void remove_int (void(*proc)(void))
 stop calling proc
void remove_sound (void)
 stop the audio
void rest (unsigned int ms)
 sleep ms milliseconds
void rotate_scaled_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale)
 rotate and scale a sprite around its centre
void rotate_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle)
 rotate a sprite around its centre, angle in 256ths of a turn, clockwise
int save_bitmap (const char *filename, BITMAP *bmp, const RGB *pal)
 save a bitmap
void set_alpha_blender (void)
 blend with the alpha channel of the source colour or sprite
int set_close_button_callback (void(*proc)(void))
 call proc when the window close button is pressed
void set_color_depth (int depth)
 set the color depth, only 32 is honoured
int set_gfx_mode (int card, int w, int h, int v_w, int v_h)
 open a display of w x h pixels, or close it with GFX_TEXT
void set_trans_blender (int r, int g, int b, int a)
 blend with a constant opacity a (0-255), r, g and b are ignored
void set_uformat (int type)
 no-op, kept for source compatibility
void set_volume (int digi_volume, int midi_volume)
 set the volumes (0-255), a negative value leaves one unchanged
void set_window_title (const char *name)
 set the window title
void show_mouse (BITMAP *bmp)
 show the system cursor (bmp != NULL) or hide it (NULL)
void solid_mode (void)
 same as drawing_mode(DRAW_MODE_SOLID, ...)
void stop_midi (void)
 stop the MIDI song
void stop_sample (const SAMPLE *spl)
 stop every playing instance of a sample
void stretch_blit (BITMAP *source, BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int dest_width, int dest_height)
 copy and scale a rectangle
void stretch_sprite (BITMAP *bmp, BITMAP *sprite, int x, int y, int w, int h)
 draw a sprite scaled to w x h
int text_height (const FONT *f)
 height of the font in pixels
int text_length (const FONT *f, const char *str)
 width of str in pixels
void textout_centre_ex (BITMAP *bmp, const FONT *f, const char *s, int x, int y, int color, int bg)
 draw a string centred on x
void textout_ex (BITMAP *bmp, const FONT *f, const char *s, int x, int y, int color, int bg)
 draw a string
void textout_right_ex (BITMAP *bmp, const FONT *f, const char *s, int x, int y, int color, int bg)
 draw a string ending at x
void textprintf_centre_ex (BITMAP *bmp, const FONT *f, int x, int y, int color, int bg, const char *format,...)
 draw a formatted string centred on x
void textprintf_ex (BITMAP *bmp, const FONT *f, int x, int y, int color, int bg, const char *format,...)
 draw a formatted string
void textprintf_right_ex (BITMAP *bmp, const FONT *f, int x, int y, int color, int bg, const char *format,...)
 draw a formatted string ending at x
void triangle (BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, int y3, int color)
 draw a filled triangle
int ustricmp (const char *s1, const char *s2)
 case insensitive string compare
void vline (BITMAP *bmp, int x, int y1, int y2, int color)
 draw a vertical line

Variables

char allegro_error [256]
 last error message, as in Allegro 4
FONT * font
 the default 8x8 font, valid after allegro_init()
volatile char key [227]
 TRUE while the key is held.
volatile int key_shifts
 modifier flags, unused
volatile int mouse_b
 button flags: 1 left, 2 right, 4 middle
volatile int mouse_x
 mouse x in screen coordinates
volatile int mouse_y
 mouse y in screen coordinates
volatile int mouse_z
 mouse wheel position
static const char * SAMPLE
 Every block kind at once, so one measure covers the lot.
BITMAP * screen
 the screen, valid after set_gfx_mode()

Detailed Description


Data Structure Documentation

◆ BITMAP

struct BITMAP

Allegro 4 bitmap.

Only w and h are meant to be read by programs.

Examples
ex_allegro_4.c.

Definition at line 107 of file n_allegro_4.h.

Collaboration diagram for BITMAP:
Data Fields
int h height in pixels
unsigned char ** line always NULL: direct line access goes through bmp_write_line()
void * priv private state of the compatibility layer
int w width in pixels

◆ RGB

struct RGB

palette entry, unused in 32 bit mode

Definition at line 119 of file n_allegro_4.h.

Collaboration diagram for RGB:
Data Fields
unsigned char b blue
unsigned char filler padding
unsigned char g green
unsigned char r red

Macro Definition Documentation

◆ ALLEGRO_ERROR_SIZE

#define ALLEGRO_ERROR_SIZE   256

size of the allegro_error buffer

Definition at line 80 of file n_allegro_4.h.

◆ ALLEGTTF_NOSMOOTH

#define ALLEGTTF_NOSMOOTH   0

no anti aliasing

Definition at line 572 of file n_allegro_4.h.

Referenced by load_ttf_font().

◆ ALLEGTTF_REALSMOOTH

#define ALLEGTTF_REALSMOOTH   2

anti aliased

Definition at line 576 of file n_allegro_4.h.

◆ ALLEGTTF_TTFSMOOTH

#define ALLEGTTF_TTFSMOOTH   1

anti aliased

Definition at line 574 of file n_allegro_4.h.

◆ bmp_write15

#define bmp_write15 ( addr,
c )
Value:
char * addr
#define bmp_write32(addr, c)
write a 32 bit pixel at addr

write a pixel at addr, only 32 bit bitmaps exist

Definition at line 528 of file n_allegro_4.h.

◆ bmp_write16

#define bmp_write16 ( addr,
c )
Value:

write a pixel at addr, only 32 bit bitmaps exist

Definition at line 526 of file n_allegro_4.h.

◆ bmp_write24

#define bmp_write24 ( addr,
c )
Value:

write a pixel at addr, only 32 bit bitmaps exist

Definition at line 524 of file n_allegro_4.h.

◆ bmp_write32

#define bmp_write32 ( addr,
c )
Value:
(*((uint32_t*)(uintptr_t)(addr)) = _a4_pixel_from_color(c))
uint32_t _a4_pixel_from_color(int color)
store a colour as it is kept in a bitmap (opaque when its alpha byte is 0)

write a 32 bit pixel at addr

Examples
ex_allegro_4.c.

Definition at line 522 of file n_allegro_4.h.

Referenced by draw_scene().

◆ bmp_write8

#define bmp_write8 ( addr,
c )
Value:

write a pixel at addr, only 32 bit bitmaps exist

Definition at line 530 of file n_allegro_4.h.

◆ BPM_TO_TIMER

#define BPM_TO_TIMER ( x)
Value:
((60 * TIMERS_PER_SECOND) / (long)(x))
#define TIMERS_PER_SECOND
ticks per second of install_int_ex() speeds

convert beats per minute to timer ticks

Definition at line 394 of file n_allegro_4.h.

◆ BPS_TO_TIMER

#define BPS_TO_TIMER ( x)
Value:
(TIMERS_PER_SECOND / (long)(x))

convert beats per second to timer ticks

Definition at line 392 of file n_allegro_4.h.

◆ DIGI_AUTODETECT

#define DIGI_AUTODETECT   -1

any digital driver

Definition at line 584 of file n_allegro_4.h.

◆ DIGI_NONE

#define DIGI_NONE   0

no digital sound

Definition at line 586 of file n_allegro_4.h.

Referenced by install_sound().

◆ DRAW_MODE_SOLID

#define DRAW_MODE_SOLID   0

drawing mode: plain copy

Examples
ex_allegro_4.c.

Definition at line 474 of file n_allegro_4.h.

Referenced by _a4_text(), alert(), allegro_message(), draw_scene(), drawing_mode(), main(), and solid_mode().

◆ DRAW_MODE_TRANS

#define DRAW_MODE_TRANS   5

drawing mode: blend with the current blender

Examples
ex_allegro_4.c.

Definition at line 476 of file n_allegro_4.h.

Referenced by _a4_prim(), draw_scene(), drawing_mode(), main(), and putpixel().

◆ END_OF_FUNCTION

#define END_OF_FUNCTION ( x)

no-op

Definition at line 88 of file n_allegro_4.h.

◆ END_OF_MAIN

#define END_OF_MAIN ( )

no-op, Allegro 5 programs need no END_OF_MAIN

Definition at line 86 of file n_allegro_4.h.

◆ END_OF_STATIC_FUNCTION

#define END_OF_STATIC_FUNCTION ( x)

no-op

Definition at line 90 of file n_allegro_4.h.

◆ fixtof

#define fixtof ( x)
Value:
((double)(x) / 65536.0)

fixed to double

Definition at line 462 of file n_allegro_4.h.

Referenced by _a4_rotated(), and rotate_scaled_sprite().

◆ fixtoi

#define fixtoi ( x)
Value:
((int)(((x) + 0x8000) >> 16))

fixed to int, rounded

Examples
ex_allegro_4.c.

Definition at line 458 of file n_allegro_4.h.

Referenced by main().

◆ ftofix

#define ftofix ( x)
Value:
((fixed)((x) * 65536.0 + ((x) < 0 ? -0.5 : 0.5)))
int32_t fixed
16.16 fixed point number

double to fixed

Examples
ex_allegro_4.c.

Definition at line 460 of file n_allegro_4.h.

Referenced by draw_scene(), and main().

◆ GET

#define GET   4321

gfx_status() action: read the status (same value as n_common.h's)

Definition at line 623 of file n_allegro_4.h.

◆ get_keyboard

#define get_keyboard   a4_get_keyboard

the old nilorea name of a4_get_keyboard()

Definition at line 647 of file n_allegro_4.h.

◆ GFX_AUTODETECT

#define GFX_AUTODETECT   0

any mode, windowed here

Definition at line 151 of file n_allegro_4.h.

◆ GFX_AUTODETECT_FULLSCREEN

#define GFX_AUTODETECT_FULLSCREEN   1

fullscreen

Definition at line 153 of file n_allegro_4.h.

Referenced by set_gfx_mode().

◆ GFX_AUTODETECT_WINDOWED

#define GFX_AUTODETECT_WINDOWED   2

windowed

Definition at line 155 of file n_allegro_4.h.

◆ GFX_DIRECTX

#define GFX_DIRECTX   4

DirectX fullscreen, mapped to fullscreen.

Definition at line 159 of file n_allegro_4.h.

Referenced by set_gfx_mode().

◆ GFX_DIRECTX_WIN

#define GFX_DIRECTX_WIN   5

DirectX windowed, mapped to windowed.

Definition at line 161 of file n_allegro_4.h.

◆ GFX_OPENGL

#define GFX_OPENGL   8

AllegroGL, windowed.

Definition at line 167 of file n_allegro_4.h.

Referenced by set_gfx_mode().

◆ GFX_OPENGL_FULLSCREEN

#define GFX_OPENGL_FULLSCREEN   7

AllegroGL fullscreen: screen is shown on allegro_gl_flip() only.

Definition at line 165 of file n_allegro_4.h.

Referenced by set_gfx_mode().

◆ GFX_OPENGL_WINDOWED

#define GFX_OPENGL_WINDOWED   6

AllegroGL windowed: screen is shown on allegro_gl_flip() only.

Examples
ex_allegro_4.c.

Definition at line 163 of file n_allegro_4.h.

Referenced by main(), and set_gfx_mode().

◆ GFX_SAFE

#define GFX_SAFE   3

windowed

Definition at line 157 of file n_allegro_4.h.

◆ GFX_TEXT

#define GFX_TEXT   -1

leave graphics mode

Definition at line 149 of file n_allegro_4.h.

Referenced by set_gfx_mode().

◆ GL_COLOR_BUFFER_BIT

#define GL_COLOR_BUFFER_BIT   0x00004000

no-op: screen is redrawn whole on every flip

Definition at line 200 of file n_allegro_4.h.

◆ glClear

#define glClear ( mask)
Value:
((void)(mask))

no-op: screen is redrawn whole on every flip

Definition at line 202 of file n_allegro_4.h.

◆ itofix

#define itofix ( x)
Value:
((fixed)((x) * 65536))

int to fixed

Examples
ex_allegro_4.c.

Definition at line 456 of file n_allegro_4.h.

Referenced by draw_scene(), main(), pivot_sprite(), and rotate_sprite().

◆ KEY_0

#define KEY_0   27

key code

Definition at line 276 of file n_allegro_4.h.

◆ KEY_1

#define KEY_1   28

key code

Definition at line 278 of file n_allegro_4.h.

◆ KEY_2

#define KEY_2   29

key code

Definition at line 280 of file n_allegro_4.h.

◆ KEY_3

#define KEY_3   30

key code

Definition at line 282 of file n_allegro_4.h.

◆ KEY_4

#define KEY_4   31

key code

Definition at line 284 of file n_allegro_4.h.

◆ KEY_5

#define KEY_5   32

key code

Definition at line 286 of file n_allegro_4.h.

◆ KEY_6

#define KEY_6   33

key code

Definition at line 288 of file n_allegro_4.h.

◆ KEY_7

#define KEY_7   34

key code

Definition at line 290 of file n_allegro_4.h.

◆ KEY_8

#define KEY_8   35

key code

Definition at line 292 of file n_allegro_4.h.

◆ KEY_9

#define KEY_9   36

key code

Definition at line 294 of file n_allegro_4.h.

◆ KEY_A

#define KEY_A   1

key code

Definition at line 224 of file n_allegro_4.h.

◆ KEY_ALT

#define KEY_ALT   219

key code

Definition at line 360 of file n_allegro_4.h.

◆ KEY_ALTGR

#define KEY_ALTGR   220

key code

Definition at line 362 of file n_allegro_4.h.

◆ KEY_B

#define KEY_B   2

key code

Definition at line 226 of file n_allegro_4.h.

◆ KEY_BACKSPACE

#define KEY_BACKSPACE   63

key code

Definition at line 322 of file n_allegro_4.h.

Referenced by a4_get_keyboard().

◆ KEY_C

#define KEY_C   3

key code

Definition at line 228 of file n_allegro_4.h.

◆ KEY_D

#define KEY_D   4

key code

Definition at line 230 of file n_allegro_4.h.

◆ KEY_DEL

#define KEY_DEL   77

key code

Definition at line 332 of file n_allegro_4.h.

◆ KEY_DOWN

#define KEY_DOWN   85

key code

Examples
ex_fluid.c, and ex_gui_particles.c.

Definition at line 348 of file n_allegro_4.h.

Referenced by lexMenuRun(), and main().

◆ KEY_E

#define KEY_E   5

key code

Definition at line 232 of file n_allegro_4.h.

◆ KEY_END

#define KEY_END   79

key code

Definition at line 336 of file n_allegro_4.h.

◆ KEY_ENTER

#define KEY_ENTER   67

key code

Definition at line 326 of file n_allegro_4.h.

Referenced by alert(), and lexMenuRun().

◆ KEY_ENTER_PAD

#define KEY_ENTER_PAD   91

key code

Definition at line 350 of file n_allegro_4.h.

Referenced by alert(), and lexMenuRun().

◆ KEY_ESC

#define KEY_ESC   59

key code

Examples
ex_allegro_4.c, ex_fluid.c, ex_gui_dictionary.c, and ex_gui_particles.c.

Definition at line 320 of file n_allegro_4.h.

Referenced by alert(), lexMenuRun(), main(), and main().

◆ KEY_F

#define KEY_F   6

key code

Definition at line 234 of file n_allegro_4.h.

◆ KEY_F1

#define KEY_F1   47

key code

Examples
ex_fluid.c.

Definition at line 296 of file n_allegro_4.h.

Referenced by main().

◆ KEY_F10

#define KEY_F10   56

key code

Definition at line 314 of file n_allegro_4.h.

◆ KEY_F11

#define KEY_F11   57

key code

Definition at line 316 of file n_allegro_4.h.

◆ KEY_F12

#define KEY_F12   58

key code

Definition at line 318 of file n_allegro_4.h.

◆ KEY_F2

#define KEY_F2   48

key code

Examples
ex_fluid.c.

Definition at line 298 of file n_allegro_4.h.

Referenced by main().

◆ KEY_F3

#define KEY_F3   49

key code

Examples
ex_fluid.c.

Definition at line 300 of file n_allegro_4.h.

Referenced by main().

◆ KEY_F4

#define KEY_F4   50

key code

Examples
ex_fluid.c.

Definition at line 302 of file n_allegro_4.h.

Referenced by main().

◆ KEY_F5

#define KEY_F5   51

key code

Examples
ex_fluid.c.

Definition at line 304 of file n_allegro_4.h.

Referenced by main().

◆ KEY_F6

#define KEY_F6   52

key code

Examples
ex_fluid.c.

Definition at line 306 of file n_allegro_4.h.

Referenced by main().

◆ KEY_F7

#define KEY_F7   53

key code

Definition at line 308 of file n_allegro_4.h.

◆ KEY_F8

#define KEY_F8   54

key code

Definition at line 310 of file n_allegro_4.h.

◆ KEY_F9

#define KEY_F9   55

key code

Definition at line 312 of file n_allegro_4.h.

◆ KEY_G

#define KEY_G   7

key code

Definition at line 236 of file n_allegro_4.h.

◆ KEY_H

#define KEY_H   8

key code

Definition at line 238 of file n_allegro_4.h.

◆ KEY_HOME

#define KEY_HOME   78

key code

Definition at line 334 of file n_allegro_4.h.

◆ KEY_I

#define KEY_I   9

key code

Definition at line 240 of file n_allegro_4.h.

◆ KEY_INSERT

#define KEY_INSERT   76

key code

Definition at line 330 of file n_allegro_4.h.

◆ KEY_J

#define KEY_J   10

key code

Definition at line 242 of file n_allegro_4.h.

◆ KEY_K

#define KEY_K   11

key code

Definition at line 244 of file n_allegro_4.h.

◆ KEY_L

#define KEY_L   12

key code

Definition at line 246 of file n_allegro_4.h.

◆ KEY_LCONTROL

#define KEY_LCONTROL   217

key code

Definition at line 356 of file n_allegro_4.h.

◆ KEY_LEFT

#define KEY_LEFT   82

key code

Examples
ex_fluid.c, and ex_gui_particles.c.

Definition at line 342 of file n_allegro_4.h.

Referenced by main().

◆ KEY_LSHIFT

#define KEY_LSHIFT   215

key code

Definition at line 352 of file n_allegro_4.h.

◆ KEY_M

#define KEY_M   13

key code

Examples
ex_fluid.c.

Definition at line 248 of file n_allegro_4.h.

Referenced by main().

◆ KEY_MAX

#define KEY_MAX   227

number of entries in key[]

Definition at line 217 of file n_allegro_4.h.

Referenced by _a4_input_handle(), and allegro_message().

◆ KEY_N

#define KEY_N   14

key code

Definition at line 250 of file n_allegro_4.h.

◆ KEY_O

#define KEY_O   15

key code

Definition at line 252 of file n_allegro_4.h.

◆ KEY_P

#define KEY_P   16

key code

Definition at line 254 of file n_allegro_4.h.

◆ KEY_PGDN

#define KEY_PGDN   81

key code

Definition at line 340 of file n_allegro_4.h.

◆ KEY_PGUP

#define KEY_PGUP   80

key code

Definition at line 338 of file n_allegro_4.h.

◆ KEY_Q

#define KEY_Q   17

key code

Definition at line 256 of file n_allegro_4.h.

◆ KEY_R

#define KEY_R   18

key code

Definition at line 258 of file n_allegro_4.h.

◆ KEY_RCONTROL

#define KEY_RCONTROL   218

key code

Definition at line 358 of file n_allegro_4.h.

◆ KEY_RIGHT

#define KEY_RIGHT   83

key code

Examples
ex_fluid.c, and ex_gui_particles.c.

Definition at line 344 of file n_allegro_4.h.

Referenced by main().

◆ KEY_RSHIFT

#define KEY_RSHIFT   216

key code

Definition at line 354 of file n_allegro_4.h.

◆ KEY_S

#define KEY_S   19

key code

Definition at line 260 of file n_allegro_4.h.

◆ KEY_SPACE

#define KEY_SPACE   75

key code

Examples
ex_fluid.c, and ex_gui_particles.c.

Definition at line 328 of file n_allegro_4.h.

Referenced by lexMenuRun(), and main().

◆ KEY_T

#define KEY_T   20

key code

Definition at line 262 of file n_allegro_4.h.

◆ KEY_TAB

#define KEY_TAB   64

key code

Definition at line 324 of file n_allegro_4.h.

◆ KEY_U

#define KEY_U   21

key code

Definition at line 264 of file n_allegro_4.h.

◆ KEY_UP

#define KEY_UP   84

key code

Examples
ex_fluid.c, and ex_gui_particles.c.

Definition at line 346 of file n_allegro_4.h.

Referenced by lexMenuRun(), and main().

◆ KEY_V

#define KEY_V   22

key code

Definition at line 266 of file n_allegro_4.h.

◆ KEY_W

#define KEY_W   23

key code

Examples
ex_fluid.c.

Definition at line 268 of file n_allegro_4.h.

Referenced by main().

◆ KEY_X

#define KEY_X   24

key code

Definition at line 270 of file n_allegro_4.h.

◆ KEY_Y

#define KEY_Y   25

key code

Definition at line 272 of file n_allegro_4.h.

◆ KEY_Z

#define KEY_Z   26

key code

Definition at line 274 of file n_allegro_4.h.

◆ LEX_MENU_NORMAL

#define LEX_MENU_NORMAL   0

item state for lexMenuGetBitmap(): normal

Definition at line 651 of file n_allegro_4.h.

◆ LEX_MENU_OVER

#define LEX_MENU_OVER   1

item state for lexMenuGetBitmap(): under the pointer

Definition at line 653 of file n_allegro_4.h.

Referenced by lexMenuGetBitmap().

◆ LOCK_FUNCTION

#define LOCK_FUNCTION ( x)

no-op

Definition at line 94 of file n_allegro_4.h.

◆ LOCK_VARIABLE

#define LOCK_VARIABLE ( x)

no-op

Definition at line 92 of file n_allegro_4.h.

◆ MIDI_AUTODETECT

#define MIDI_AUTODETECT   -1

any MIDI driver

Definition at line 588 of file n_allegro_4.h.

◆ MIDI_NONE

#define MIDI_NONE   0

no MIDI

Definition at line 590 of file n_allegro_4.h.

◆ MODE_OGL

#define MODE_OGL   1

gfx_status() value: an AllegroGL mode

Definition at line 632 of file n_allegro_4.h.

Referenced by gfx_status().

◆ MODE_STD

#define MODE_STD   0

gfx_status() value: a non OpenGL mode

Definition at line 630 of file n_allegro_4.h.

Referenced by gfx_status().

◆ MSEC_TO_TIMER

#define MSEC_TO_TIMER ( x)
Value:
((long)(x) * (TIMERS_PER_SECOND / 1000))

convert milliseconds to timer ticks

Definition at line 390 of file n_allegro_4.h.

Referenced by install_int().

◆ SCREEN_H

#define SCREEN_H   (screen ? screen->h : 0)

screen height

Examples
ex_allegro_4.c, and ex_gui_isometric.c.

Definition at line 145 of file n_allegro_4.h.

Referenced by draw_scene(), main(), and main().

◆ SCREEN_W

#define SCREEN_W   (screen ? screen->w : 0)

screen width

Examples
ex_allegro_4.c, and ex_gui_isometric.c.

Definition at line 143 of file n_allegro_4.h.

Referenced by draw_scene(), main(), and main().

◆ SECS_TO_TIMER

#define SECS_TO_TIMER ( x)
Value:
((long)(x) * TIMERS_PER_SECOND)

convert seconds to timer ticks

Definition at line 388 of file n_allegro_4.h.

◆ SET

#define SET   1234

gfx_status() action: set the status (same value as n_common.h's)

Definition at line 627 of file n_allegro_4.h.

Referenced by gfx_status().

◆ TIMERS_PER_SECOND

#define TIMERS_PER_SECOND   1193181L

ticks per second of install_int_ex() speeds

Definition at line 386 of file n_allegro_4.h.

Referenced by install_int_ex().

◆ U_ASCII

#define U_ASCII   0x41534338

unicode format id, ignored

Definition at line 98 of file n_allegro_4.h.

◆ U_UTF8

#define U_UTF8   0x55544638

unicode format id, ignored

Definition at line 100 of file n_allegro_4.h.

Typedef Documentation

◆ fixed

typedef int32_t fixed

16.16 fixed point number

Definition at line 454 of file n_allegro_4.h.

Function Documentation

◆ _a4_pixel_from_color()

uint32_t _a4_pixel_from_color ( int color)

store a colour as it is kept in a bitmap (opaque when its alpha byte is 0)

Definition at line 258 of file n_allegro_4.c.

Referenced by _a4_prim(), clear_to_color(), geta(), and putpixel().

Here is the caller graph for this function:

◆ a4_get_keyboard()

int a4_get_keyboard ( char * keybuf,
int * cur,
int flags,
int max )

read the typed keys into keybuf at *cur (printable ASCII, backspace erases), keeping it nul terminated within max bytes; flags is ignored.

Returns the number of keys taken. Old nilorea code calls it get_keyboard(), which the macro below keeps working; the linked symbol is a4_get_keyboard because n_allegro5.h already has a get_keyboard() with another signature, and both live in the same library

Definition at line 2031 of file n_allegro_4.c.

References KEY_BACKSPACE, keypressed(), and readkey().

Here is the call graph for this function:

◆ adjust_sample()

void adjust_sample ( const SAMPLE * spl,
int vol,
int pan,
int freq,
int loop )

change the settings of the playing instances of a sample

Definition at line 1694 of file n_allegro_4.c.

References _a4_gain(), _a4_pan(), A4_SAMPLE_IDS, a4_sound_ok, SAMPLE::ids, and SAMPLE::used.

Here is the call graph for this function:

◆ alert()

int alert ( const char * s1,
const char * s2,
const char * s3,
const char * b1,
const char * b2,
int c1,
int c2 )

a box with up to three lines and one or two buttons (b2 may be NULL), chosen with the mouse, the c1 / c2 shortcut keys, Enter (first) or Escape (second): 1 or 2

Definition at line 1520 of file n_allegro_4.c.

References _a4_present(), _a4_take_click(), a4_close_requested, a4_cursor_shown, a4_display, a4_draw_mode, a4_gl_mode, blit(), clear_keybuf(), create_bitmap(), destroy_bitmap(), DRAW_MODE_SOLID, font, key, KEY_ENTER, KEY_ENTER_PAD, KEY_ESC, keypressed(), makecol(), mode, mouse_b, mouse_x, mouse_y, readkey(), rect(), rectfill(), screen, show_mouse(), and textout_centre_ex().

Here is the call graph for this function:

◆ allegro_exit()

void allegro_exit ( void )

shut everything down

Definition at line 657 of file n_allegro_4.c.

References _a4_destroy_display(), a4_inited, a4_input_mutex, a4_input_queue, a4_input_thread, a4_timer_mutex, a4_timer_thread, font, Free, and remove_sound().

Referenced by allegro_init(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allegro_gl_flip()

void allegro_gl_flip ( void )

show the screen bitmap

Definition at line 783 of file n_allegro_4.c.

References _a4_present(), a4_gl_mode, and a4_screen_dirty.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allegro_gl_set_allegro_mode()

void allegro_gl_set_allegro_mode ( void )

no-op

Definition at line 777 of file n_allegro_4.c.

◆ allegro_gl_unset_allegro_mode()

void allegro_gl_unset_allegro_mode ( void )

no-op

Definition at line 780 of file n_allegro_4.c.

◆ allegro_init()

int allegro_init ( void )

init the layer and Allegro 5

Definition at line 610 of file n_allegro_4.c.

References _a4_input_proc(), _a4_timer_proc(), a4_inited, a4_input_mutex, a4_input_queue, a4_input_thread, a4_timer_mutex, a4_timer_thread, a4_timers, allegro_error, allegro_exit(), FONT::f, font, key, and Malloc.

Referenced by install_int_ex(), install_keyboard(), install_mouse(), install_sound(), install_timer(), main(), and set_gfx_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allegro_message()

void allegro_message ( const char * format,
... )

show a message: a box over the screen, or stderr without a display

Definition at line 1428 of file n_allegro_4.c.

References _a4_present(), _a4_strndup(), _a4_take_click(), a4_close_requested, a4_display, a4_draw_mode, a4_gl_mode, blit(), clear_keybuf(), create_bitmap(), destroy_bitmap(), DRAW_MODE_SOLID, font, key, KEY_MAX, keypressed(), makecol(), mode, mouse_b, rect(), rectfill(), screen, textout_centre_ex(), and textout_ex().

Referenced by gfx_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitmap_color_depth()

int bitmap_color_depth ( BITMAP * bmp)

always 32

Definition at line 998 of file n_allegro_4.c.

◆ bitmap_mask_color()

int bitmap_mask_color ( BITMAP * bmp)

the mask colour, magenta

Definition at line 1003 of file n_allegro_4.c.

References A4_MASK_COLOR.

Referenced by main(), and make_sprite().

Here is the caller graph for this function:

◆ blit()

void blit ( BITMAP * source,
BITMAP * dest,
int source_x,
int source_y,
int dest_x,
int dest_y,
int width,
int height )

copy a rectangle

Definition at line 1054 of file n_allegro_4.c.

References _a4_draw_region().

Referenced by alert(), allegro_message(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmp_read_line()

uintptr_t bmp_read_line ( BITMAP * bmp,
int y )

lock the bitmap and return the address of line y, 32 bit ARGB pixels

Definition at line 1305 of file n_allegro_4.c.

References _a4_lock(), and BITMAP::h.

Here is the call graph for this function:

◆ bmp_select()

void bmp_select ( BITMAP * bmp)

no-op

Definition at line 1292 of file n_allegro_4.c.

◆ bmp_unwrite_line()

void bmp_unwrite_line ( BITMAP * bmp)

no-op, the bitmap is unlocked when next drawn with the GPU

Definition at line 1312 of file n_allegro_4.c.

Referenced by draw_scene().

Here is the caller graph for this function:

◆ bmp_write_line()

uintptr_t bmp_write_line ( BITMAP * bmp,
int y )

lock the bitmap and return the address of line y, 32 bit ARGB pixels

Definition at line 1296 of file n_allegro_4.c.

References _a4_lock(), a4_screen_dirty, A4P, and BITMAP::h.

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ circle()

void circle ( BITMAP * bmp,
int x,
int y,
int radius,
int color )

draw a circle outline

Definition at line 1255 of file n_allegro_4.c.

References _a4_done(), _a4_prim_color(), and _a4_target().

Referenced by draw_scene(), and make_sprite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ circlefill()

void circlefill ( BITMAP * bmp,
int x,
int y,
int radius,
int color )

draw a filled circle

Definition at line 1261 of file n_allegro_4.c.

References _a4_done(), _a4_prim_color(), and _a4_target().

Referenced by make_sprite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void clear ( BITMAP * bmp)

clear to black

Definition at line 1019 of file n_allegro_4.c.

References clear_to_color().

Referenced by lexMenuRun(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_bitmap()

void clear_bitmap ( BITMAP * bmp)

clear to black

Definition at line 1023 of file n_allegro_4.c.

References clear_to_color().

Here is the call graph for this function:

◆ clear_keybuf()

void clear_keybuf ( void )

empty the readkey() buffer

Definition at line 838 of file n_allegro_4.c.

References a4_input_mutex, a4_keybuf_count, and a4_keybuf_start.

Referenced by alert(), allegro_message(), and lexMenuRun().

Here is the caller graph for this function:

◆ clear_to_color()

void clear_to_color ( BITMAP * bmp,
int color )

clear to a colour

Definition at line 1013 of file n_allegro_4.c.

References _a4_done(), _a4_pixel_from_color(), _a4_rgba(), and _a4_target().

Referenced by clear(), clear_bitmap(), draw_scene(), gfx_mode(), main(), and make_sprite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_bitmap()

BITMAP * create_bitmap ( int width,
int height )

create a w x h bitmap

Definition at line 935 of file n_allegro_4.c.

References _a4_wrap(), and allegro_error.

Referenced by _a4_highlight(), alert(), allegro_message(), create_bitmap_ex(), create_video_bitmap(), main(), make_sprite(), and set_gfx_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_bitmap_ex()

BITMAP * create_bitmap_ex ( int depth,
int width,
int height )

same as create_bitmap(), depth is ignored

Definition at line 955 of file n_allegro_4.c.

References create_bitmap().

Here is the call graph for this function:

◆ create_video_bitmap()

BITMAP * create_video_bitmap ( int width,
int height )

same as create_bitmap()

Definition at line 951 of file n_allegro_4.c.

References create_bitmap().

Here is the call graph for this function:

◆ destroy_bitmap()

void destroy_bitmap ( BITMAP * bmp)

free a bitmap

Definition at line 960 of file n_allegro_4.c.

References _a4_unlock(), a4_batch_n, a4_batch_target, A4P, A4_BMP::bmp, Free, A4_BMP::masked, and screen.

Referenced by _a4_destroy_display(), alert(), allegro_message(), lexMenuDestroy(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy_font()

void destroy_font ( FONT * f)

free a font loaded with load_ttf_font()

Definition at line 1420 of file n_allegro_4.c.

References FONT::f, font, and Free.

◆ destroy_midi()

void destroy_midi ( MIDI * midi)

free a MIDI song, stopping it if it plays

Definition at line 1976 of file n_allegro_4.c.

References a4_fs, Free, MIDI::path, and stop_midi().

Here is the call graph for this function:

◆ destroy_sample()

void destroy_sample ( SAMPLE * spl)

free a sample, stopping it

Definition at line 1666 of file n_allegro_4.c.

References Free, SAMPLE::spl, and stop_sample().

Referenced by lexMenuDestroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_sprite()

void draw_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y )

draw a sprite

Definition at line 1075 of file n_allegro_4.c.

References _a4_sprite().

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_sprite_h_flip()

void draw_sprite_h_flip ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y )

draw a sprite mirrored horizontally

Definition at line 1079 of file n_allegro_4.c.

References _a4_sprite().

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_sprite_v_flip()

void draw_sprite_v_flip ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y )

draw a sprite mirrored vertically

Definition at line 1083 of file n_allegro_4.c.

References _a4_sprite().

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_sprite_vh_flip()

void draw_sprite_vh_flip ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y )

draw a sprite mirrored both ways

Definition at line 1087 of file n_allegro_4.c.

References _a4_sprite().

Here is the call graph for this function:

◆ draw_trans_sprite()

void draw_trans_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y )

draw a sprite with the current blender (set_alpha_blender / set_trans_blender)

Definition at line 1096 of file n_allegro_4.c.

References _a4_blend_alpha(), _a4_done(), _a4_source(), _a4_target(), a4_alpha_blender, and a4_trans_alpha.

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawing_mode()

void drawing_mode ( int mode,
BITMAP * pattern,
int x_anchor,
int y_anchor )

set the drawing mode of primitives, pattern arguments are ignored

Definition at line 1142 of file n_allegro_4.c.

References a4_draw_mode, DRAW_MODE_SOLID, DRAW_MODE_TRANS, and mode.

Referenced by draw_scene(), and main().

Here is the caller graph for this function:

◆ ellipse()

void ellipse ( BITMAP * bmp,
int x,
int y,
int rx,
int ry,
int color )

draw an ellipse outline

Definition at line 1267 of file n_allegro_4.c.

References _a4_done(), _a4_prim_color(), and _a4_target().

Here is the call graph for this function:

◆ ellipsefill()

void ellipsefill ( BITMAP * bmp,
int x,
int y,
int rx,
int ry,
int color )

draw a filled ellipse

Definition at line 1273 of file n_allegro_4.c.

References _a4_done(), _a4_prim_color(), and _a4_target().

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_str()

void fill_str ( char * str,
int c,
size_t len )

fill len bytes of str with c

Definition at line 2027 of file n_allegro_4.c.

◆ get_color_depth()

int get_color_depth ( void )

return the color depth (always 32)

Definition at line 701 of file n_allegro_4.c.

◆ get_mouse_mickeys()

void get_mouse_mickeys ( int * mickeyx,
int * mickeyy )

movement since the last call

Definition at line 869 of file n_allegro_4.c.

References a4_input_mutex, a4_mickey_x, and a4_mickey_y.

◆ geta()

int geta ( int c)

alpha component, 255 for an opaque colour

Definition at line 338 of file n_allegro_4.c.

References _a4_pixel_from_color().

Here is the call graph for this function:

◆ getb()

int getb ( int c)

blue component

Definition at line 334 of file n_allegro_4.c.

Referenced by expect(), and main().

Here is the caller graph for this function:

◆ getg()

int getg ( int c)

green component

Definition at line 330 of file n_allegro_4.c.

Referenced by expect(), and main().

Here is the caller graph for this function:

◆ getpixel()

int getpixel ( BITMAP * bmp,
int x,
int y )

read a pixel, -1 outside the bitmap

Definition at line 1181 of file n_allegro_4.c.

References _a4_color_from_pixel(), _a4_lock(), BITMAP::h, row(), and BITMAP::w.

Referenced by expect(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getr()

int getr ( int c)

red component

Definition at line 326 of file n_allegro_4.c.

Referenced by expect(), and main().

Here is the caller graph for this function:

◆ gfx_mode()

int gfx_mode ( int mode,
int w,
int h,
int v_w,
int v_h,
int depth,
double r,
double g,
double b,
double a )

set the color depth and the graphics mode in one go, clearing the screen to (r,g,b), components in 0-1 or 0-255; TRUE or FALSE

Definition at line 2005 of file n_allegro_4.c.

References _a4_present(), a4_gl_mode, allegro_error, allegro_message(), clear_to_color(), makecol(), mode, screen, set_color_depth(), and set_gfx_mode().

Here is the call graph for this function:

◆ gfx_status()

int gfx_status ( int action,
int value )

with GET, MODE_OGL when the current mode is an AllegroGL one, else MODE_STD

Definition at line 2022 of file n_allegro_4.c.

References a4_gl_mode, MODE_OGL, MODE_STD, and SET.

◆ hline()

void hline ( BITMAP * bmp,
int x1,
int y,
int x2,
int color )

draw a horizontal line

Definition at line 1210 of file n_allegro_4.c.

References rectfill().

Here is the call graph for this function:

◆ install_allegro_gl()

int install_allegro_gl ( void )

no-op, the layer always uses Allegro 5's own driver

Definition at line 773 of file n_allegro_4.c.

◆ install_int()

int install_int ( void(* proc )(void),
int speed )

call proc every speed milliseconds, from the timer thread

Definition at line 917 of file n_allegro_4.c.

References install_int_ex(), and MSEC_TO_TIMER.

Here is the call graph for this function:

◆ install_int_ex()

int install_int_ex ( void(* proc )(void),
long speed )

call proc every speed timer ticks, from the timer thread

Definition at line 892 of file n_allegro_4.c.

References a4_inited, A4_MAX_TIMERS, a4_timer_mutex, a4_timers, allegro_init(), and TIMERS_PER_SECOND.

Referenced by install_int().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_keyboard()

int install_keyboard ( void )

start the input thread for the keyboard

Definition at line 789 of file n_allegro_4.c.

References a4_inited, a4_input_queue, and allegro_init().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_mouse()

int install_mouse ( void )

start the input thread for the mouse

Definition at line 846 of file n_allegro_4.c.

References a4_inited, a4_input_queue, and allegro_init().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_sound()

int install_sound ( int digi,
int midi,
const char * cfg_path )

start the audio, cfg_path is ignored

Definition at line 1607 of file n_allegro_4.c.

References a4_inited, a4_sound_ok, allegro_error, allegro_init(), and DIGI_NONE.

Here is the call graph for this function:

◆ install_timer()

int install_timer ( void )

no-op, timers are always available

Definition at line 888 of file n_allegro_4.c.

References a4_inited, and allegro_init().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_memory_bitmap()

int is_memory_bitmap ( BITMAP * bmp)

always FALSE: pixels are reached through bmp_write_line()

Definition at line 1008 of file n_allegro_4.c.

◆ keypressed()

int keypressed ( void )

TRUE if a key is waiting in the readkey() buffer.

Definition at line 814 of file n_allegro_4.c.

References a4_input_mutex, and a4_keybuf_count.

Referenced by a4_get_keyboard(), alert(), allegro_message(), and lexMenuRun().

Here is the caller graph for this function:

◆ lexLoadMenuFromFile()

LexMenu * lexLoadMenuFromFile ( const char * file,
const char * section )

load menu section from INI file file, NULL on error

Definition at line 2094 of file n_allegro_4.c.

References _a4_align(), _a4_highlight(), _a4_resolve(), LexMenu::bg, LEX_ITEM::h_align, LEX_ITEM::image, LexMenu::items, load_bitmap(), load_sample(), LOG_ERR, Malloc, n_log, LexMenu::nb_items, LEX_ITEM::over, LEX_ITEM::sound, LEX_ITEM::v_align, LEX_ITEM::x, and LEX_ITEM::y.

Here is the call graph for this function:

◆ lexMenuDestroy()

LexMenu * lexMenuDestroy ( LexMenu * menu)

free a menu, returns NULL

Definition at line 2252 of file n_allegro_4.c.

References LexMenu::bg, destroy_bitmap(), destroy_sample(), Free, LEX_ITEM::image, LexMenu::items, LexMenu::nb_items, LEX_ITEM::over, and LEX_ITEM::sound.

Here is the call graph for this function:

◆ lexMenuGetBitmap()

BITMAP * lexMenuGetBitmap ( LexMenu * menu,
int item,
int state )

the image of item item in state state, NULL if there is none

Definition at line 2146 of file n_allegro_4.c.

References LEX_ITEM::image, LexMenu::items, LEX_MENU_OVER, LexMenu::nb_items, and LEX_ITEM::over.

◆ lexMenuRun()

◆ line()

◆ load_bitmap()

BITMAP * load_bitmap ( const char * filename,
RGB * pal )

load a BMP, PCX, TGA, PNG or JPG file, pal is ignored

Definition at line 977 of file n_allegro_4.c.

References _a4_resolve(), _a4_wrap(), allegro_error, LOG_ERR, and n_log.

Referenced by lexLoadMenuFromFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_midi()

MIDI * load_midi ( const char * filename)

load a MIDI file

Definition at line 1930 of file n_allegro_4.c.

References _a4_resolve(), LOG_ERR, Malloc, n_log, and MIDI::path.

Here is the call graph for this function:

◆ load_sample()

SAMPLE * load_sample ( const char * filename)

load a WAV, OGG, FLAC or VOC file

Definition at line 1634 of file n_allegro_4.c.

References _a4_resolve(), a4_sound_ok, LOG_ERR, Malloc, n_log, and SAMPLE::spl.

Referenced by lexLoadMenuFromFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_ttf_font()

FONT * load_ttf_font ( const char * filename,
int points,
int smooth )

load a TrueType font at the given pixel size

Definition at line 1395 of file n_allegro_4.c.

References _a4_resolve(), allegro_error, ALLEGTTF_NOSMOOTH, FONT::f, LOG_ERR, Malloc, and n_log.

Referenced by load_ttf_font_mem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_ttf_font_mem()

FONT * load_ttf_font_mem ( const char * filename,
int points,
int smooth )

same as load_ttf_font()

Definition at line 1416 of file n_allegro_4.c.

References load_ttf_font().

Here is the call graph for this function:

◆ makeacol()

int makeacol ( int r,
int g,
int b,
int a )

make a colour with alpha

Definition at line 318 of file n_allegro_4.c.

References makecol().

Referenced by draw_scene(), main(), and makeacol32().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeacol32()

int makeacol32 ( int r,
int g,
int b,
int a )

make a colour with alpha

Definition at line 322 of file n_allegro_4.c.

References makeacol().

Here is the call graph for this function:

◆ makecol()

int makecol ( int r,
int g,
int b )

make an opaque colour

Definition at line 310 of file n_allegro_4.c.

Referenced by alert(), allegro_message(), draw_scene(), gfx_mode(), main(), make_sprite(), makeacol(), and makecol32().

Here is the caller graph for this function:

◆ makecol32()

int makecol32 ( int r,
int g,
int b )

make an opaque colour

Definition at line 314 of file n_allegro_4.c.

References makecol().

Here is the call graph for this function:

◆ masked_blit()

void masked_blit ( BITMAP * source,
BITMAP * dest,
int source_x,
int source_y,
int dest_x,
int dest_y,
int width,
int height )

copy a rectangle, skipping mask colour pixels

Definition at line 1058 of file n_allegro_4.c.

References _a4_draw_region().

Here is the call graph for this function:

◆ masked_stretch_blit()

void masked_stretch_blit ( BITMAP * source,
BITMAP * dest,
int source_x,
int source_y,
int source_w,
int source_h,
int dest_x,
int dest_y,
int dest_w,
int dest_h )

copy and scale a rectangle, skipping mask colour pixels

Definition at line 1066 of file n_allegro_4.c.

References _a4_draw_region().

Here is the call graph for this function:

◆ midi_pause()

void midi_pause ( void )

pause the MIDI song

Definition at line 1983 of file n_allegro_4.c.

References a4_fs.

◆ midi_resume()

void midi_resume ( void )

resume the MIDI song

Definition at line 1990 of file n_allegro_4.c.

References a4_fs.

◆ pivot_scaled_sprite()

void pivot_scaled_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y,
int cx,
int cy,
fixed angle,
fixed scale )

rotate and scale a sprite around (cx,cy) in the sprite, drawn at (x,y)

Definition at line 1136 of file n_allegro_4.c.

References _a4_rotated().

Here is the call graph for this function:

◆ pivot_sprite()

void pivot_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y,
int cx,
int cy,
fixed angle )

rotate a sprite around (cx,cy) in the sprite, drawn at (x,y)

Definition at line 1132 of file n_allegro_4.c.

References _a4_rotated(), and itofix.

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ play_midi()

int play_midi ( MIDI * midi,
int loop )

play a MIDI song, replacing the current one, NULL stops

Definition at line 1950 of file n_allegro_4.c.

References _a4_midi_init(), _a4_midi_stop_locked(), a4_fs, MIDI::path, and stop_midi().

Here is the call graph for this function:

◆ play_sample()

int play_sample ( const SAMPLE * spl,
int vol,
int pan,
int freq,
int loop )

play a sample: vol and pan 0-255, freq 1000 = normal speed

Definition at line 1682 of file n_allegro_4.c.

References _a4_gain(), _a4_pan(), A4_SAMPLE_IDS, a4_sound_ok, SAMPLE::ids, SAMPLE::next, SAMPLE::spl, and SAMPLE::used.

Referenced by lexMenuRun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ poll_keyboard()

int poll_keyboard ( void )

no-op, input is updated by a thread

Definition at line 796 of file n_allegro_4.c.

◆ poll_mouse()

int poll_mouse ( void )

no-op, input is updated by a thread

Definition at line 853 of file n_allegro_4.c.

◆ position_mouse()

void position_mouse ( int x,
int y )

move the mouse pointer

Definition at line 879 of file n_allegro_4.c.

References a4_display, a4_off_x, a4_off_y, a4_scale, mouse_x, and mouse_y.

◆ putpixel()

void putpixel ( BITMAP * bmp,
int x,
int y,
int color )

write a pixel

Definition at line 1165 of file n_allegro_4.c.

References _a4_box(), _a4_done(), _a4_lock(), _a4_pixel_from_color(), a4_draw_mode, a4_screen_dirty, A4P, DRAW_MODE_TRANS, BITMAP::h, BITMAP::priv, row(), and BITMAP::w.

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readkey()

int readkey ( void )

wait for a key: (scancode << 8) | ascii

Definition at line 822 of file n_allegro_4.c.

References a4_input_mutex, a4_keybuf, a4_keybuf_count, A4_KEYBUF_SIZE, and a4_keybuf_start.

Referenced by a4_get_keyboard(), alert(), and lexMenuRun().

Here is the caller graph for this function:

◆ rect()

void rect ( BITMAP * bmp,
int x1,
int y1,
int x2,
int y2,
int color )

draw a rectangle outline

Definition at line 1218 of file n_allegro_4.c.

References _a4_box(), _a4_done(), and BITMAP::priv.

Referenced by alert(), allegro_message(), and draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rectfill()

void rectfill ( BITMAP * bmp,
int x1,
int y1,
int x2,
int y2,
int color )

draw a filled rectangle

Definition at line 1239 of file n_allegro_4.c.

References _a4_box(), _a4_done(), and BITMAP::priv.

Referenced by _a4_text(), alert(), allegro_message(), draw_scene(), hline(), main(), make_sprite(), and vline().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_int()

void remove_int ( void(* proc )(void))

stop calling proc

Definition at line 921 of file n_allegro_4.c.

References A4_MAX_TIMERS, a4_timer_mutex, and a4_timers.

◆ remove_sound()

void remove_sound ( void )

stop the audio

Definition at line 1626 of file n_allegro_4.c.

References _a4_midi_shutdown(), and a4_sound_ok.

Referenced by allegro_exit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rest()

void rest ( unsigned int ms)

sleep ms milliseconds

Definition at line 929 of file n_allegro_4.c.

Referenced by main(), occupy_thread(), and tensor_read().

Here is the caller graph for this function:

◆ rotate_scaled_sprite()

void rotate_scaled_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y,
fixed angle,
fixed scale )

rotate and scale a sprite around its centre

Definition at line 1126 of file n_allegro_4.c.

References _a4_rotated(), fixtof, BITMAP::h, and BITMAP::w.

Here is the call graph for this function:

◆ rotate_sprite()

void rotate_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y,
fixed angle )

rotate a sprite around its centre, angle in 256ths of a turn, clockwise

Definition at line 1121 of file n_allegro_4.c.

References _a4_rotated(), BITMAP::h, itofix, and BITMAP::w.

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_bitmap()

int save_bitmap ( const char * filename,
BITMAP * bmp,
const RGB * pal )

save a bitmap

Definition at line 991 of file n_allegro_4.c.

References _a4_unlock(), and A4P.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_alpha_blender()

void set_alpha_blender ( void )

blend with the alpha channel of the source colour or sprite

Definition at line 1161 of file n_allegro_4.c.

References a4_alpha_blender.

Referenced by draw_scene(), and main().

Here is the caller graph for this function:

◆ set_close_button_callback()

int set_close_button_callback ( void(* proc )(void))

call proc when the window close button is pressed

Definition at line 755 of file n_allegro_4.c.

References a4_close_cb.

Referenced by main().

Here is the caller graph for this function:

◆ set_color_depth()

void set_color_depth ( int depth)

set the color depth, only 32 is honoured

Definition at line 697 of file n_allegro_4.c.

References LOG_DEBUG, and n_log.

Referenced by gfx_mode(), and main().

Here is the caller graph for this function:

◆ set_gfx_mode()

int set_gfx_mode ( int card,
int w,
int h,
int v_w,
int v_h )

open a display of w x h pixels, or close it with GFX_TEXT

Definition at line 717 of file n_allegro_4.c.

References _a4_compute_scale(), _a4_destroy_display(), _a4_present(), a4_cursor_shown, a4_display, a4_gl_mode, a4_inited, a4_input_queue, A4P, allegro_error, allegro_init(), create_bitmap(), GFX_AUTODETECT_FULLSCREEN, GFX_DIRECTX, GFX_OPENGL, GFX_OPENGL_FULLSCREEN, GFX_OPENGL_WINDOWED, GFX_TEXT, and screen.

Referenced by gfx_mode(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_trans_blender()

void set_trans_blender ( int r,
int g,
int b,
int a )

blend with a constant opacity a (0-255), r, g and b are ignored

Definition at line 1153 of file n_allegro_4.c.

References a4_alpha_blender, and a4_trans_alpha.

Referenced by draw_scene().

Here is the caller graph for this function:

◆ set_uformat()

void set_uformat ( int type)

no-op, kept for source compatibility

Definition at line 689 of file n_allegro_4.c.

References type().

Here is the call graph for this function:

◆ set_volume()

void set_volume ( int digi_volume,
int midi_volume )

set the volumes (0-255), a negative value leaves one unchanged

Definition at line 1997 of file n_allegro_4.c.

References a4_digi_volume, a4_fs, and a4_midi_volume.

◆ set_window_title()

void set_window_title ( const char * name)

set the window title

Definition at line 751 of file n_allegro_4.c.

References a4_display.

Referenced by main().

Here is the caller graph for this function:

◆ show_mouse()

void show_mouse ( BITMAP * bmp)

show the system cursor (bmp != NULL) or hide it (NULL)

Definition at line 860 of file n_allegro_4.c.

References a4_cursor_shown, and a4_display.

Referenced by alert(), and lexMenuRun().

Here is the caller graph for this function:

◆ solid_mode()

void solid_mode ( void )

same as drawing_mode(DRAW_MODE_SOLID, ...)

Definition at line 1149 of file n_allegro_4.c.

References a4_draw_mode, and DRAW_MODE_SOLID.

◆ stop_midi()

void stop_midi ( void )

stop the MIDI song

Definition at line 1969 of file n_allegro_4.c.

References _a4_midi_stop_locked(), and a4_fs.

Referenced by destroy_midi(), and play_midi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_sample()

void stop_sample ( const SAMPLE * spl)

stop every playing instance of a sample

Definition at line 1655 of file n_allegro_4.c.

References A4_SAMPLE_IDS, a4_sound_ok, SAMPLE::ids, and SAMPLE::used.

Referenced by destroy_sample().

Here is the caller graph for this function:

◆ stretch_blit()

void stretch_blit ( BITMAP * source,
BITMAP * dest,
int source_x,
int source_y,
int source_width,
int source_height,
int dest_x,
int dest_y,
int dest_width,
int dest_height )

copy and scale a rectangle

Definition at line 1062 of file n_allegro_4.c.

References _a4_draw_region().

Referenced by lexMenuRun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stretch_sprite()

void stretch_sprite ( BITMAP * bmp,
BITMAP * sprite,
int x,
int y,
int w,
int h )

draw a sprite scaled to w x h

Definition at line 1091 of file n_allegro_4.c.

References _a4_draw_region(), BITMAP::h, and BITMAP::w.

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ text_height()

int text_height ( const FONT * f)

height of the font in pixels

Definition at line 1328 of file n_allegro_4.c.

References _a4_font().

Here is the call graph for this function:

◆ text_length()

int text_length ( const FONT * f,
const char * str )

width of str in pixels

Definition at line 1323 of file n_allegro_4.c.

References _a4_font().

Here is the call graph for this function:

◆ textout_centre_ex()

void textout_centre_ex ( BITMAP * bmp,
const FONT * f,
const char * s,
int x,
int y,
int color,
int bg )

draw a string centred on x

Definition at line 1357 of file n_allegro_4.c.

References _a4_text().

Referenced by alert(), and allegro_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textout_ex()

void textout_ex ( BITMAP * bmp,
const FONT * f,
const char * s,
int x,
int y,
int color,
int bg )

draw a string

Definition at line 1353 of file n_allegro_4.c.

References _a4_text().

Referenced by allegro_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textout_right_ex()

void textout_right_ex ( BITMAP * bmp,
const FONT * f,
const char * s,
int x,
int y,
int color,
int bg )

draw a string ending at x

Definition at line 1361 of file n_allegro_4.c.

References _a4_text().

Referenced by draw_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textprintf_centre_ex()

void textprintf_centre_ex ( BITMAP * bmp,
const FONT * f,
int x,
int y,
int color,
int bg,
const char * format,
... )

draw a formatted string centred on x

Definition at line 1381 of file n_allegro_4.c.

References A4_TEXTPRINTF.

Referenced by draw_scene().

Here is the caller graph for this function:

◆ textprintf_ex()

void textprintf_ex ( BITMAP * bmp,
const FONT * f,
int x,
int y,
int color,
int bg,
const char * format,
... )

draw a formatted string

Definition at line 1374 of file n_allegro_4.c.

References A4_TEXTPRINTF.

Referenced by draw_scene().

Here is the caller graph for this function:

◆ textprintf_right_ex()

void textprintf_right_ex ( BITMAP * bmp,
const FONT * f,
int x,
int y,
int color,
int bg,
const char * format,
... )

draw a formatted string ending at x

Definition at line 1388 of file n_allegro_4.c.

References A4_TEXTPRINTF.

◆ triangle()

void triangle ( BITMAP * bmp,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int color )

draw a filled triangle

Definition at line 1279 of file n_allegro_4.c.

References _a4_done(), _a4_prim(), _a4_reserve(), _a4_vertex(), A4_BLEND_COPY, and BITMAP::priv.

Referenced by make_sprite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ustricmp()

int ustricmp ( const char * s1,
const char * s2 )

case insensitive string compare

Definition at line 693 of file n_allegro_4.c.

◆ vline()

void vline ( BITMAP * bmp,
int x,
int y1,
int y2,
int color )

draw a vertical line

Definition at line 1214 of file n_allegro_4.c.

References rectfill().

Here is the call graph for this function:

Variable Documentation

◆ allegro_error

char allegro_error[256]
extern

last error message, as in Allegro 4

Definition at line 118 of file n_allegro_4.c.

Referenced by allegro_init(), create_bitmap(), gfx_mode(), install_sound(), load_bitmap(), load_ttf_font(), main(), and set_gfx_mode().

◆ font

FONT* font
extern

the default 8x8 font, valid after allegro_init()

Definition at line 120 of file n_allegro_4.c.

Referenced by _a4_font(), _combobox_dropdown_width(), _curve_draw(), _datagrid_hmetrics(), _datagrid_resize_hover(), _draw_button(), _draw_checkbox(), _draw_combobox(), _draw_combobox_dropdown(), _draw_datagrid(), _draw_dropmenu(), _draw_dropmenu_panel(), _draw_hexview(), _draw_justified_selection(), _draw_label(), _draw_label_lines(), _draw_label_overflow(), _draw_listbox(), _draw_progressbar(), _draw_radiolist(), _draw_slider(), _draw_syntaxview(), _draw_text_justified(), _draw_text_truncated(), _draw_textarea(), _draw_textarea_placeholder(), _draw_textarea_suggest(), _draw_window(), _grid_draw(), _justified_char_at_pos(), _label_char_at_x(), _label_content_height(), _label_effective_w(), _label_lines_char_at(), _label_text_origin_x(), _listbox_hmetrics(), _n_gui_color_draw_swatch(), _ngui_meas_slot(), _popup_draw(), _popup_layout(), _popup_row_h(), _shorten_start(), _split_words(), _suggest_panel_rect(), _syntax_draw_line(), _syntax_prefix_w(), _syntax_prefix_w_lim(), _syntaxview_ensure_width(), _syntaxview_hmetrics(), _syntaxview_offset_from_mouse(), _text_dims(), _text_w(), _textarea_content_height(), _textarea_handle_key(), _textarea_pos_from_mouse(), _textarea_step(), _wheel_draw(), _win_auto_sb_rects(), _window_update_content_size(), alert(), allegro_exit(), allegro_init(), allegro_message(), check_shared_resources(), custom_draw(), destroy_font(), draw_2d_panel(), draw_3d_axes(), draw_3d_panel(), draw_scene(), main(), main(), main(), md_build_seg(), md_flow(), md_flow_width(), md_lh(), n_gui_dropmenu_panel_width(), n_gui_get_text_dims(), n_gui_label_fits(), n_gui_listbox_content_width(), n_gui_set_default_font(), n_gui_slider_value_width(), n_gui_syntaxview_content_width(), n_gui_syntaxview_scroll_to_offset(), n_gui_text_shorten(), n_gui_textarea_scroll_to_bottom(), n_gui_textarea_scroll_to_offset(), and run().

◆ key

volatile char key[227]
extern

TRUE while the key is held.

Definition at line 121 of file n_allegro_4.c.

Referenced by _a4_input_handle(), _ht_check_trie_divergence(), _ht_find_longest_prefix_trie(), _ht_get_double(), _ht_get_double_trie(), _ht_get_int(), _ht_get_int_trie(), _ht_get_node(), _ht_get_node_trie(), _ht_get_ptr(), _ht_get_ptr_trie(), _ht_get_string(), _ht_get_string_trie(), _ht_hash_value(), _ht_is_leaf_node_trie(), _ht_new_double_node(), _ht_new_int_node(), _ht_new_node(), _ht_new_node_trie(), _ht_new_ptr_node(), _ht_new_string_node(), _ht_new_string_ptr_node(), _ht_put_double(), _ht_put_double_trie(), _ht_put_int(), _ht_put_int_trie(), _ht_put_ptr(), _ht_put_ptr_trie(), _ht_put_string(), _ht_put_string_ptr(), _ht_put_string_ptr_trie(), _ht_put_string_trie(), _ht_remove(), _ht_remove_trie(), _n_nodup_log(), _n_nodup_log_indexed(), _register_widget(), alert(), allegro_init(), allegro_message(), avro_decode_container(), avro_decode_datum(), avro_encode_datum(), check_n_log_dup(), check_n_log_dup_indexed(), collect(), has(), ht_get_completion_list(), ht_get_double(), ht_get_int(), ht_get_node(), ht_get_ptr(), ht_get_string(), ht_put_double(), ht_put_int(), ht_put_ptr(), ht_put_string(), ht_put_string_ptr(), ht_remove(), iso_map_draw(), lexMenuRun(), main(), main(), mp_disp_param(), MurmurHash3_x64_128(), MurmurHash3_x86_128(), MurmurHash3_x86_32(), n_aead_aes256gcm_decrypt(), n_aead_aes256gcm_encrypt(), n_aead_chacha20poly1305_decrypt(), n_aead_chacha20poly1305_encrypt(), n_disk_cache_get(), n_disk_cache_path(), n_disk_cache_put(), n_disk_cache_remove(), n_gui_datagrid_sort(), n_gui_get_widget(), n_gui_kvtable_add_row(), n_gui_widget_set_persist_key(), n_hmac_oneshot(), n_hmac_sha1(), n_hmac_sha256(), n_hmac_sha384(), n_hmac_sha512(), n_json_bool(), n_json_get(), n_json_int(), n_json_string(), n_json_string_dup(), n_kafka_add_header(), n_kafka_add_header_ex(), n_str_template_expand(), n_vigenere_cypher(), n_vigenere_cypher_thread(), n_vigenere_decode(), n_vigenere_decode_file(), n_vigenere_decode_in_place(), n_vigenere_encode(), n_vigenere_encode_file(), n_vigenere_encode_in_place(), netw_parse_post_data(), netw_pool_add(), netw_pool_remove(), netw_set_crypto(), netw_set_crypto_chain(), put_aged(), test_aead(), test_aead_chacha(), test_hmac(), test_hmac_variants(), and write_config_file().

◆ key_shifts

volatile int key_shifts
extern

modifier flags, unused

Definition at line 122 of file n_allegro_4.c.

◆ mouse_b

volatile int mouse_b
extern

button flags: 1 left, 2 right, 4 middle

Definition at line 126 of file n_allegro_4.c.

Referenced by _a4_input_handle(), alert(), allegro_message(), and lexMenuRun().

◆ mouse_x

volatile int mouse_x
extern

mouse x in screen coordinates

Definition at line 123 of file n_allegro_4.c.

Referenced by _a4_input_handle(), alert(), lexMenuRun(), n_iso_camera_zoom(), and position_mouse().

◆ mouse_y

volatile int mouse_y
extern

mouse y in screen coordinates

Definition at line 124 of file n_allegro_4.c.

Referenced by _a4_input_handle(), alert(), lexMenuRun(), n_iso_camera_zoom(), and position_mouse().

◆ mouse_z

volatile int mouse_z
extern

mouse wheel position

Definition at line 125 of file n_allegro_4.c.

Referenced by _a4_input_handle().

◆ SAMPLE

typedef struct SAMPLE SAMPLE
static
Initial value:
=
"# A heading\n"
"\n"
"A paragraph with **bold**, *italic*, `code` and a\n"
"[link](https://example.com/page) in it, hard wrapped by whoever wrote it\n"
"and re-wrapped by the renderer.\n"
"\n"
"## A smaller heading\n"
"\n"
"> a quoted line\n"
"\n"
"```\n"
"a fenced code block\n"
"keeping its own line breaks\n"
"```\n"
"\n"
"- a list item\n"
"- one that carries on\n"
" onto a second line\n"
"\n"
"| Key | Effect |\n"
"|:----|-------:|\n"
"| `G` | back to the grid |\n"
"| Escape | close a dialog, otherwise go back to the grid |\n"

Every block kind at once, so one measure covers the lot.

a sound sample

Definition at line 60 of file ex_gui_md.c.

◆ screen