Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_allegro_4.h
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 */
17
63
64#ifndef __NILOREA_ALLEGRO_4_COMPAT__
65#define __NILOREA_ALLEGRO_4_COMPAT__
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
75
76#include <stdint.h>
77#include <stdio.h>
78
80#define ALLEGRO_ERROR_SIZE 256
83
84/* Things Allegro 4 needed for DOS / Windows interrupt handlers. */
86#define END_OF_MAIN()
88#define END_OF_FUNCTION(x)
90#define END_OF_STATIC_FUNCTION(x)
92#define LOCK_VARIABLE(x)
94#define LOCK_FUNCTION(x)
95
96/* Text encoding, only plain ASCII / UTF-8 strings are handled. */
98#define U_ASCII 0x41534338
100#define U_UTF8 0x55544638
102void set_uformat(int type);
104int ustricmp(const char* s1, const char* s2);
105
107typedef struct BITMAP {
109 int w;
111 int h;
113 unsigned char** line;
115 void* priv;
116} BITMAP;
117
119typedef struct RGB {
121 unsigned char r;
123 unsigned char g;
125 unsigned char b;
127 unsigned char filler;
128} RGB;
129
131typedef struct FONT FONT;
133typedef struct SAMPLE SAMPLE;
135typedef struct MIDI MIDI;
136
138extern BITMAP* screen;
140extern FONT* font;
141
143#define SCREEN_W (screen ? screen->w : 0)
145#define SCREEN_H (screen ? screen->h : 0)
146
147/* Graphics modes. */
149#define GFX_TEXT -1
151#define GFX_AUTODETECT 0
153#define GFX_AUTODETECT_FULLSCREEN 1
155#define GFX_AUTODETECT_WINDOWED 2
157#define GFX_SAFE 3
159#define GFX_DIRECTX 4
161#define GFX_DIRECTX_WIN 5
163#define GFX_OPENGL_WINDOWED 6
165#define GFX_OPENGL_FULLSCREEN 7
167#define GFX_OPENGL 8
168
170int allegro_init(void);
172void allegro_exit(void);
174void allegro_message(const char* format, ...);
177int alert(const char* s1, const char* s2, const char* s3, const char* b1, const char* b2, int c1, int c2);
179void set_color_depth(int depth);
181int get_color_depth(void);
183int set_gfx_mode(int card, int w, int h, int v_w, int v_h);
185void set_window_title(const char* name);
187int set_close_button_callback(void (*proc)(void));
188
189/* AllegroGL. */
191int install_allegro_gl(void);
197void allegro_gl_flip(void);
198#ifndef GL_COLOR_BUFFER_BIT
200#define GL_COLOR_BUFFER_BIT 0x00004000
202#define glClear(mask) ((void)(mask))
203#endif
204
205/* Keyboard. Key codes are Allegro 5's, so key[] is indexed like it. */
207int install_keyboard(void);
209int poll_keyboard(void);
211int keypressed(void);
213int readkey(void);
215void clear_keybuf(void);
217#define KEY_MAX 227
219extern volatile char key[KEY_MAX];
221extern volatile int key_shifts;
222
224#define KEY_A 1
226#define KEY_B 2
228#define KEY_C 3
230#define KEY_D 4
232#define KEY_E 5
234#define KEY_F 6
236#define KEY_G 7
238#define KEY_H 8
240#define KEY_I 9
242#define KEY_J 10
244#define KEY_K 11
246#define KEY_L 12
248#define KEY_M 13
250#define KEY_N 14
252#define KEY_O 15
254#define KEY_P 16
256#define KEY_Q 17
258#define KEY_R 18
260#define KEY_S 19
262#define KEY_T 20
264#define KEY_U 21
266#define KEY_V 22
268#define KEY_W 23
270#define KEY_X 24
272#define KEY_Y 25
274#define KEY_Z 26
276#define KEY_0 27
278#define KEY_1 28
280#define KEY_2 29
282#define KEY_3 30
284#define KEY_4 31
286#define KEY_5 32
288#define KEY_6 33
290#define KEY_7 34
292#define KEY_8 35
294#define KEY_9 36
296#define KEY_F1 47
298#define KEY_F2 48
300#define KEY_F3 49
302#define KEY_F4 50
304#define KEY_F5 51
306#define KEY_F6 52
308#define KEY_F7 53
310#define KEY_F8 54
312#define KEY_F9 55
314#define KEY_F10 56
316#define KEY_F11 57
318#define KEY_F12 58
320#define KEY_ESC 59
322#define KEY_BACKSPACE 63
324#define KEY_TAB 64
326#define KEY_ENTER 67
328#define KEY_SPACE 75
330#define KEY_INSERT 76
332#define KEY_DEL 77
334#define KEY_HOME 78
336#define KEY_END 79
338#define KEY_PGUP 80
340#define KEY_PGDN 81
342#define KEY_LEFT 82
344#define KEY_RIGHT 83
346#define KEY_UP 84
348#define KEY_DOWN 85
350#define KEY_ENTER_PAD 91
352#define KEY_LSHIFT 215
354#define KEY_RSHIFT 216
356#define KEY_LCONTROL 217
358#define KEY_RCONTROL 218
360#define KEY_ALT 219
362#define KEY_ALTGR 220
363
364/* Mouse. */
366int install_mouse(void);
368int poll_mouse(void);
370void show_mouse(BITMAP* bmp);
372void get_mouse_mickeys(int* mickeyx, int* mickeyy);
374void position_mouse(int x, int y);
376extern volatile int mouse_x;
378extern volatile int mouse_y;
380extern volatile int mouse_z;
382extern volatile int mouse_b;
383
384/* Timers. */
386#define TIMERS_PER_SECOND 1193181L
388#define SECS_TO_TIMER(x) ((long)(x) * TIMERS_PER_SECOND)
390#define MSEC_TO_TIMER(x) ((long)(x) * (TIMERS_PER_SECOND / 1000))
392#define BPS_TO_TIMER(x) (TIMERS_PER_SECOND / (long)(x))
394#define BPM_TO_TIMER(x) ((60 * TIMERS_PER_SECOND) / (long)(x))
396int install_timer(void);
398int install_int(void (*proc)(void), int speed);
400int install_int_ex(void (*proc)(void), long speed);
402void remove_int(void (*proc)(void));
404void rest(unsigned int ms);
405
406/* Bitmaps. */
408BITMAP* create_bitmap(int width, int height);
410BITMAP* create_video_bitmap(int width, int height);
412BITMAP* create_bitmap_ex(int depth, int width, int height);
414void destroy_bitmap(BITMAP* bmp);
416BITMAP* load_bitmap(const char* filename, RGB* pal);
418int save_bitmap(const char* filename, BITMAP* bmp, const RGB* pal);
420int bitmap_color_depth(BITMAP* bmp);
422int bitmap_mask_color(BITMAP* bmp);
424int is_memory_bitmap(BITMAP* bmp);
426void clear(BITMAP* bmp);
428void clear_bitmap(BITMAP* bmp);
430void clear_to_color(BITMAP* bmp, int color);
431
433void blit(BITMAP* source, BITMAP* dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
435void masked_blit(BITMAP* source, BITMAP* dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
437void 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);
439void 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);
441void draw_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y);
443void draw_sprite_h_flip(BITMAP* bmp, BITMAP* sprite, int x, int y);
445void draw_sprite_v_flip(BITMAP* bmp, BITMAP* sprite, int x, int y);
447void draw_sprite_vh_flip(BITMAP* bmp, BITMAP* sprite, int x, int y);
449void draw_trans_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y);
451void stretch_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y, int w, int h);
452
454typedef int32_t fixed;
456#define itofix(x) ((fixed)((x) * 65536))
458#define fixtoi(x) ((int)(((x) + 0x8000) >> 16))
460#define ftofix(x) ((fixed)((x) * 65536.0 + ((x) < 0 ? -0.5 : 0.5)))
462#define fixtof(x) ((double)(x) / 65536.0)
464void rotate_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y, fixed angle);
466void rotate_scaled_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y, fixed angle, fixed scale);
468void pivot_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y, int cx, int cy, fixed angle);
470void pivot_scaled_sprite(BITMAP* bmp, BITMAP* sprite, int x, int y, int cx, int cy, fixed angle, fixed scale);
471
472/* Primitives. */
474#define DRAW_MODE_SOLID 0
476#define DRAW_MODE_TRANS 5
478void drawing_mode(int mode, BITMAP* pattern, int x_anchor, int y_anchor);
480void solid_mode(void);
482void set_trans_blender(int r, int g, int b, int a);
484void set_alpha_blender(void);
486void putpixel(BITMAP* bmp, int x, int y, int color);
488int getpixel(BITMAP* bmp, int x, int y);
490void line(BITMAP* bmp, int x1, int y1, int x2, int y2, int color);
492void hline(BITMAP* bmp, int x1, int y, int x2, int color);
494void vline(BITMAP* bmp, int x, int y1, int y2, int color);
496void rect(BITMAP* bmp, int x1, int y1, int x2, int y2, int color);
498void rectfill(BITMAP* bmp, int x1, int y1, int x2, int y2, int color);
500void circle(BITMAP* bmp, int x, int y, int radius, int color);
502void circlefill(BITMAP* bmp, int x, int y, int radius, int color);
504void ellipse(BITMAP* bmp, int x, int y, int rx, int ry, int color);
506void ellipsefill(BITMAP* bmp, int x, int y, int rx, int ry, int color);
508void triangle(BITMAP* bmp, int x1, int y1, int x2, int y2, int x3, int y3, int color);
509
510/* Direct pixel access, as used by libraries like PMASK. */
512void bmp_select(BITMAP* bmp);
514uintptr_t bmp_write_line(BITMAP* bmp, int y);
516uintptr_t bmp_read_line(BITMAP* bmp, int y);
518void bmp_unwrite_line(BITMAP* bmp);
520uint32_t _a4_pixel_from_color(int color);
522#define bmp_write32(addr, c) (*((uint32_t*)(uintptr_t)(addr)) = _a4_pixel_from_color(c))
524#define bmp_write24(addr, c) bmp_write32(addr, c)
526#define bmp_write16(addr, c) bmp_write32(addr, c)
528#define bmp_write15(addr, c) bmp_write32(addr, c)
530#define bmp_write8(addr, c) bmp_write32(addr, c)
531
532/* Colours. */
534int makecol(int r, int g, int b);
536int makecol32(int r, int g, int b);
538int makeacol(int r, int g, int b, int a);
540int makeacol32(int r, int g, int b, int a);
542int getr(int c);
544int getg(int c);
546int getb(int c);
548int geta(int c);
549
550/* Text. A colour of -1 draws white, a background of -1 is transparent. */
552int text_length(const FONT* f, const char* str);
554int text_height(const FONT* f);
556void textout_ex(BITMAP* bmp, const FONT* f, const char* s, int x, int y, int color, int bg);
558void textout_centre_ex(BITMAP* bmp, const FONT* f, const char* s, int x, int y, int color, int bg);
560void textout_right_ex(BITMAP* bmp, const FONT* f, const char* s, int x, int y, int color, int bg);
562void textprintf_ex(BITMAP* bmp, const FONT* f, int x, int y, int color, int bg, const char* format, ...);
564void textprintf_centre_ex(BITMAP* bmp, const FONT* f, int x, int y, int color, int bg, const char* format, ...);
566void textprintf_right_ex(BITMAP* bmp, const FONT* f, int x, int y, int color, int bg, const char* format, ...);
568void destroy_font(FONT* f);
569
570/* AllegTTF. */
572#define ALLEGTTF_NOSMOOTH 0
574#define ALLEGTTF_TTFSMOOTH 1
576#define ALLEGTTF_REALSMOOTH 2
578FONT* load_ttf_font(const char* filename, int points, int smooth);
580FONT* load_ttf_font_mem(const char* filename, int points, int smooth);
581
582/* Sound. */
584#define DIGI_AUTODETECT -1
586#define DIGI_NONE 0
588#define MIDI_AUTODETECT -1
590#define MIDI_NONE 0
592int install_sound(int digi, int midi, const char* cfg_path);
594void remove_sound(void);
596void set_volume(int digi_volume, int midi_volume);
598SAMPLE* load_sample(const char* filename);
600void destroy_sample(SAMPLE* spl);
602int play_sample(const SAMPLE* spl, int vol, int pan, int freq, int loop);
604void stop_sample(const SAMPLE* spl);
606void adjust_sample(const SAMPLE* spl, int vol, int pan, int freq, int loop);
608MIDI* load_midi(const char* filename);
610void destroy_midi(MIDI* midi);
612int play_midi(MIDI* midi, int loop);
614void stop_midi(void);
616void midi_pause(void);
618void midi_resume(void);
619
620/* Old nilorea Allegro 4 helpers. */
621#ifndef GET
623#define GET 4321
624#endif
625#ifndef SET
627#define SET 1234
628#endif
630#define MODE_STD 0
632#define MODE_OGL 1
635int gfx_mode(int mode, int w, int h, int v_w, int v_h, int depth, double r, double g, double b, double a);
637int gfx_status(int action, int value);
639void fill_str(char* str, int c, size_t len);
645int a4_get_keyboard(char* keybuf, int* cur, int flags, int max);
647#define get_keyboard a4_get_keyboard
648
649/* Old nilorea INI driven menu module. */
651#define LEX_MENU_NORMAL 0
653#define LEX_MENU_OVER 1
655typedef struct LexMenu LexMenu;
657LexMenu* lexLoadMenuFromFile(const char* file, const char* section);
659BITMAP* lexMenuGetBitmap(LexMenu* menu, int item, int state);
661int lexMenuRun(LexMenu* menu, BITMAP* buf);
664
668
669#ifdef __cplusplus
670}
671#endif
672
673#endif
static int mode
static void type(N_GUI_CTX *gui, const char *s)
Type a whole string into whatever has focus.
int w
width in pixels
unsigned char filler
padding
unsigned char g
green
int h
height in pixels
unsigned char r
red
unsigned char b
blue
void * priv
private state of the compatibility layer
unsigned char ** line
always NULL: direct line access goes through bmp_write_line()
int makeacol32(int r, int g, int b, int a)
make a colour with alpha
void allegro_gl_unset_allegro_mode(void)
no-op
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
int install_mouse(void)
start the input thread for the mouse
SAMPLE * load_sample(const char *filename)
load a WAV, OGG, FLAC or VOC file
uintptr_t bmp_write_line(BITMAP *bmp, int y)
lock the bitmap and return the address of line y, 32 bit ARGB pixels
FONT * load_ttf_font_mem(const char *filename, int points, int smooth)
same as load_ttf_font()
void draw_sprite_h_flip(BITMAP *bmp, BITMAP *sprite, int x, int y)
draw a sprite mirrored horizontally
void destroy_bitmap(BITMAP *bmp)
free a bitmap
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 allegro_exit(void)
shut everything down
int is_memory_bitmap(BITMAP *bmp)
always FALSE: pixels are reached through bmp_write_line()
char allegro_error[256]
last error message, as in Allegro 4
BITMAP * create_video_bitmap(int width, int height)
same as create_bitmap()
int set_close_button_callback(void(*proc)(void))
call proc when the window close button is pressed
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 terminate...
int poll_mouse(void)
no-op, input is updated by a thread
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_unwrite_line(BITMAP *bmp)
no-op, the bitmap is unlocked when next drawn with the GPU
int install_int_ex(void(*proc)(void), long speed)
call proc every speed timer ticks, from the timer thread
BITMAP * create_bitmap(int width, int height)
create a w x h bitmap
int install_sound(int digi, int midi, const char *cfg_path)
start the audio, cfg_path is ignored
void destroy_sample(SAMPLE *spl)
free a sample, stopping it
int bitmap_mask_color(BITMAP *bmp)
the mask colour, magenta
int getr(int c)
red component
int readkey(void)
wait for a key: (scancode << 8) | ascii
void line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
draw a line
volatile char key[227]
TRUE while the key is held.
int save_bitmap(const char *filename, BITMAP *bmp, const RGB *pal)
save a bitmap
void draw_sprite_vh_flip(BITMAP *bmp, BITMAP *sprite, int x, int y)
draw a sprite mirrored both ways
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
int ustricmp(const char *s1, const char *s2)
case insensitive string compare
FONT * font
the default 8x8 font, valid after allegro_init()
void clear_keybuf(void)
empty the readkey() buffer
void set_uformat(int type)
no-op, kept for source compatibility
void textprintf_ex(BITMAP *bmp, const FONT *f, int x, int y, int color, int bg, const char *format,...)
draw a formatted string
void drawing_mode(int mode, BITMAP *pattern, int x_anchor, int y_anchor)
set the drawing mode of primitives, pattern arguments are ignored
int makecol32(int r, int g, int b)
make an opaque colour
volatile int mouse_x
mouse x in screen coordinates
int poll_keyboard(void)
no-op, input is updated by a thread
volatile int key_shifts
modifier flags, unused
void ellipse(BITMAP *bmp, int x, int y, int rx, int ry, int color)
draw an ellipse outline
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 destroy_midi(MIDI *midi)
free a MIDI song, stopping it if it plays
void remove_int(void(*proc)(void))
stop calling proc
int makeacol(int r, int g, int b, int a)
make a colour with alpha
void solid_mode(void)
same as drawing_mode(DRAW_MODE_SOLID, ...)
BITMAP * screen
the screen, valid after set_gfx_mode()
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 set_alpha_blender(void)
blend with the alpha channel of the source colour or sprite
#define KEY_MAX
number of entries in key[]
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 get_mouse_mickeys(int *mickeyx, int *mickeyy)
movement since the last call
int install_keyboard(void)
start the input thread for the keyboard
BITMAP * create_bitmap_ex(int depth, int width, int height)
same as create_bitmap(), depth is ignored
void vline(BITMAP *bmp, int x, int y1, int y2, int color)
draw a vertical line
void allegro_message(const char *format,...)
show a message: a box over the screen, or stderr without a display
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 position_mouse(int x, int y)
move the mouse pointer
void set_volume(int digi_volume, int midi_volume)
set the volumes (0-255), a negative value leaves one unchanged
int allegro_init(void)
init the layer and Allegro 5
int install_timer(void)
no-op, timers are always available
void circle(BITMAP *bmp, int x, int y, int radius, int color)
draw a circle outline
int lexMenuRun(LexMenu *menu, BITMAP *buf)
run the menu, drawing into buf: the chosen item index, -1 on escape
void adjust_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop)
change the settings of the playing instances of a sample
void clear_bitmap(BITMAP *bmp)
clear to black
void set_window_title(const char *name)
set the window title
int makecol(int r, int g, int b)
make an opaque colour
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
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
void allegro_gl_set_allegro_mode(void)
no-op
int bitmap_color_depth(BITMAP *bmp)
always 32
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 ellipsefill(BITMAP *bmp, int x, int y, int rx, int ry, int color)
draw a filled ellipse
int get_color_depth(void)
return the color depth (always 32)
void stop_sample(const SAMPLE *spl)
stop every playing instance of a sample
int install_int(void(*proc)(void), int speed)
call proc every speed milliseconds, from the timer thread
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
int32_t fixed
16.16 fixed point number
int getb(int c)
blue 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),...
void destroy_font(FONT *f)
free a font loaded with load_ttf_font()
void bmp_select(BITMAP *bmp)
no-op
LexMenu * lexMenuDestroy(LexMenu *menu)
free a menu, returns NULL
volatile int mouse_b
button flags: 1 left, 2 right, 4 middle
void remove_sound(void)
stop the audio
void midi_pause(void)
pause 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)
int install_allegro_gl(void)
no-op, the layer always uses Allegro 5's own driver
MIDI * load_midi(const char *filename)
load a MIDI file
int getg(int c)
green component
void fill_str(char *str, int c, size_t len)
fill len bytes of str with c
void draw_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y)
draw a 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
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,...
volatile int mouse_y
mouse y in screen coordinates
void midi_resume(void)
resume the MIDI song
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
int keypressed(void)
TRUE if a key is waiting in the readkey() buffer.
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)
BITMAP * load_bitmap(const char *filename, RGB *pal)
load a BMP, PCX, TGA, PNG or JPG file, pal is ignored
void stretch_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int w, int h)
draw a sprite scaled to w x h
void putpixel(BITMAP *bmp, int x, int y, int color)
write a pixel
int gfx_status(int action, int value)
with GET, MODE_OGL when the current mode is an AllegroGL one, else MODE_STD
void set_color_depth(int depth)
set the color depth, only 32 is honoured
void clear_to_color(BITMAP *bmp, int color)
clear to a colour
void rectfill(BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
draw a filled rectangle
void hline(BITMAP *bmp, int x1, int y, int x2, int color)
draw a horizontal line
void triangle(BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, int y3, int color)
draw a filled triangle
FONT * load_ttf_font(const char *filename, int points, int smooth)
load a TrueType font at the given pixel size
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 text_height(const FONT *f)
height of the font in pixels
void rest(unsigned int ms)
sleep ms milliseconds
int text_length(const FONT *f, const char *str)
width of str in pixels
int geta(int c)
alpha component, 255 for an opaque colour
void circlefill(BITMAP *bmp, int x, int y, int radius, int color)
draw a filled circle
void textout_ex(BITMAP *bmp, const FONT *f, const char *s, int x, int y, int color, int bg)
draw a string
LexMenu * lexLoadMenuFromFile(const char *file, const char *section)
load menu section from INI file file, NULL on error
#define ALLEGRO_ERROR_SIZE
size of the allegro_error buffer
Definition n_allegro_4.h:80
void draw_sprite_v_flip(BITMAP *bmp, BITMAP *sprite, int x, int y)
draw a sprite mirrored vertically
volatile int mouse_z
mouse wheel position
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 show_mouse(BITMAP *bmp)
show the system cursor (bmp != NULL) or hide it (NULL)
void clear(BITMAP *bmp)
clear to black
int getpixel(BITMAP *bmp, int x, int y)
read a pixel, -1 outside the bitmap
void allegro_gl_flip(void)
show the screen bitmap
void stop_midi(void)
stop the MIDI song
BITMAP * lexMenuGetBitmap(LexMenu *menu, int item, int state)
the image of item item in state state, NULL if there is none
void rect(BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
draw a rectangle outline
int play_midi(MIDI *midi, int loop)
play a MIDI song, replacing the current one, NULL stops
Allegro 4 bitmap.
palette entry, unused in 32 bit mode
a font: the built in one, or a TTF font loaded with load_ttf_font()
Definition n_allegro_4.c:98
an INI driven menu
a MIDI song
a sound sample