Initial Upload

This commit is contained in:
Asrın Doğan
2019-09-10 11:14:36 +03:00
parent 9cf2d97a3b
commit af73c60abf
280 changed files with 72103 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#ifndef __al_included_allegro5_alcompat_h
#define __al_included_allegro5_alcompat_h
#ifdef __cplusplus
extern "C" {
#endif
#define ALLEGRO_DST_COLOR (ALLEGRO_DEST_COLOR)
#define ALLEGRO_INVERSE_DST_COLOR (ALLEGRO_INVERSE_DEST_COLOR)
#define al_current_time() (al_get_time())
#define al_event_queue_is_empty(q) (al_is_event_queue_empty(q))
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,32 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#include "allegro5/inline/gfx.inl"
#include "allegro5/inline/color.inl"
#include "allegro5/inline/draw.inl"
#include "allegro5/inline/fmaths.inl"
#include "allegro5/inline/3dmaths.inl"
#include "allegro5/inline/matrix.inl"
/* alcompat.h includes some inline functions */
#include "allegro5/alcompat.h"

View File

@@ -0,0 +1,73 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Main header file for the entire Allegro library.
* (separate modules can be included from the allegro/ directory)
*
* By Shawn Hargreaves.
*
* Vincent Penquerc'h split the original allegro.h into separate headers.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_allegro_h
#define __al_included_allegro5_allegro_h
#include "allegro5/base.h"
#include "allegro5/altime.h"
#include "allegro5/bitmap.h"
#include "allegro5/bitmap_draw.h"
#include "allegro5/bitmap_io.h"
#include "allegro5/bitmap_lock.h"
#include "allegro5/blender.h"
#include "allegro5/color.h"
#include "allegro5/config.h"
#include "allegro5/debug.h"
#include "allegro5/display.h"
#include "allegro5/drawing.h"
#include "allegro5/error.h"
#include "allegro5/events.h"
#include "allegro5/file.h"
#include "allegro5/fixed.h"
#include "allegro5/fmaths.h"
#include "allegro5/fshook.h"
#include "allegro5/fullscreen_mode.h"
#include "allegro5/joystick.h"
#include "allegro5/keyboard.h"
#include "allegro5/memory.h"
#include "allegro5/monitor.h"
#include "allegro5/mouse.h"
#include "allegro5/mouse_cursor.h"
#include "allegro5/path.h"
#include "allegro5/system.h"
#include "allegro5/threads.h"
#include "allegro5/timer.h"
#include "allegro5/tls.h"
#include "allegro5/transformations.h"
#include "allegro5/utf8.h"
#ifndef ALLEGRO_NO_COMPATIBILITY
#include "allegro5/alcompat.h"
#endif
#ifdef ALLEGRO_EXTRA_HEADER
#include ALLEGRO_EXTRA_HEADER
#endif
#endif

View File

@@ -0,0 +1,2 @@
#include "allegro.h"

View File

@@ -0,0 +1,40 @@
#ifndef __al_included_allegro5_allegro_acodec_h
#define __al_included_allegro5_allegro_acodec_h
#include "allegro5/allegro.h"
#include "allegro5/allegro_audio.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_ACODEC_SRC
#define _ALLEGRO_ACODEC_DLL __declspec(dllexport)
#else
#define _ALLEGRO_ACODEC_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_ACODEC_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_ACODEC_FUNC(type, name, args) _ALLEGRO_ACODEC_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_ACODEC_FUNC(type, name, args) extern type name args
#else
#define ALLEGRO_ACODEC_FUNC AL_FUNC
#endif
ALLEGRO_ACODEC_FUNC(bool, al_init_acodec_addon, (void));
ALLEGRO_ACODEC_FUNC(uint32_t, al_get_allegro_acodec_version, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,374 @@
/*
* Updated for 4.9 api inclusion by Ryan Dickie
* Originally done by KC/Milan
*/
#ifndef __al_included_allegro5_allegro_audio_h
#define __al_included_allegro5_allegro_audio_h
#ifdef __cplusplus
extern "C" {
#endif
/* Title: Audio types
*/
#include "allegro5/allegro.h"
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_KCM_AUDIO_SRC
#define _ALLEGRO_KCM_AUDIO_DLL __declspec(dllexport)
#else
#define _ALLEGRO_KCM_AUDIO_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_KCM_AUDIO_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) _ALLEGRO_KCM_AUDIO_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) extern _ALLEGRO_KCM_AUDIO_DLL type name args
#else
#define ALLEGRO_KCM_AUDIO_FUNC AL_FUNC
#endif
/* Internal, used to communicate with acodec. */
/* Must be in 512 <= n < 1024 */
#define _KCM_STREAM_FEEDER_QUIT_EVENT_TYPE (512)
/* User event type emitted when a stream fragment is ready to be
* refilled with more audio data.
* Must be in 512 <= n < 1024
*/
#define ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT (513)
#define ALLEGRO_EVENT_AUDIO_STREAM_FINISHED (514)
/* Enum: ALLEGRO_AUDIO_DEPTH
*/
enum ALLEGRO_AUDIO_DEPTH
{
/* Sample depth and type, and signedness. Mixers only use 32-bit signed
* float (-1..+1). The unsigned value is a bit-flag applied to the depth
* value.
*/
ALLEGRO_AUDIO_DEPTH_INT8 = 0x00,
ALLEGRO_AUDIO_DEPTH_INT16 = 0x01,
ALLEGRO_AUDIO_DEPTH_INT24 = 0x02,
ALLEGRO_AUDIO_DEPTH_FLOAT32 = 0x03,
ALLEGRO_AUDIO_DEPTH_UNSIGNED = 0x08,
/* For convenience */
ALLEGRO_AUDIO_DEPTH_UINT8 = ALLEGRO_AUDIO_DEPTH_INT8 |
ALLEGRO_AUDIO_DEPTH_UNSIGNED,
ALLEGRO_AUDIO_DEPTH_UINT16 = ALLEGRO_AUDIO_DEPTH_INT16 |
ALLEGRO_AUDIO_DEPTH_UNSIGNED,
ALLEGRO_AUDIO_DEPTH_UINT24 = ALLEGRO_AUDIO_DEPTH_INT24 |
ALLEGRO_AUDIO_DEPTH_UNSIGNED
};
/* Enum: ALLEGRO_CHANNEL_CONF
*/
enum ALLEGRO_CHANNEL_CONF
{
/* Speaker configuration (mono, stereo, 2.1, 3, etc). With regards to
* behavior, most of this code makes no distinction between, say, 4.1 and
* 5 speaker setups.. they both have 5 "channels". However, users would
* like the distinction, and later when the higher-level stuff is added,
* the differences will become more important. (v>>4)+(v&0xF) should yield
* the total channel count.
*/
ALLEGRO_CHANNEL_CONF_1 = 0x10,
ALLEGRO_CHANNEL_CONF_2 = 0x20,
ALLEGRO_CHANNEL_CONF_3 = 0x30,
ALLEGRO_CHANNEL_CONF_4 = 0x40,
ALLEGRO_CHANNEL_CONF_5_1 = 0x51,
ALLEGRO_CHANNEL_CONF_6_1 = 0x61,
ALLEGRO_CHANNEL_CONF_7_1 = 0x71
#define ALLEGRO_MAX_CHANNELS 8
};
/* Enum: ALLEGRO_PLAYMODE
*/
enum ALLEGRO_PLAYMODE
{
ALLEGRO_PLAYMODE_ONCE = 0x100,
ALLEGRO_PLAYMODE_LOOP = 0x101,
ALLEGRO_PLAYMODE_BIDIR = 0x102,
_ALLEGRO_PLAYMODE_STREAM_ONCE = 0x103, /* internal */
_ALLEGRO_PLAYMODE_STREAM_ONEDIR = 0x104 /* internal */
};
/* Enum: ALLEGRO_MIXER_QUALITY
*/
enum ALLEGRO_MIXER_QUALITY
{
ALLEGRO_MIXER_QUALITY_POINT = 0x110,
ALLEGRO_MIXER_QUALITY_LINEAR = 0x111,
ALLEGRO_MIXER_QUALITY_CUBIC = 0x112
};
/* Enum: ALLEGRO_AUDIO_PAN_NONE
*/
#define ALLEGRO_AUDIO_PAN_NONE (-1000.0f)
/* Type: ALLEGRO_SAMPLE
*/
typedef struct ALLEGRO_SAMPLE ALLEGRO_SAMPLE;
/* Type: ALLEGRO_SAMPLE_ID
*/
typedef struct ALLEGRO_SAMPLE_ID ALLEGRO_SAMPLE_ID;
struct ALLEGRO_SAMPLE_ID {
int _index;
int _id;
};
/* Type: ALLEGRO_SAMPLE_INSTANCE
*/
typedef struct ALLEGRO_SAMPLE_INSTANCE ALLEGRO_SAMPLE_INSTANCE;
/* Type: ALLEGRO_AUDIO_STREAM
*/
typedef struct ALLEGRO_AUDIO_STREAM ALLEGRO_AUDIO_STREAM;
/* Type: ALLEGRO_MIXER
*/
typedef struct ALLEGRO_MIXER ALLEGRO_MIXER;
/* Type: ALLEGRO_VOICE
*/
typedef struct ALLEGRO_VOICE ALLEGRO_VOICE;
#ifndef __cplusplus
typedef enum ALLEGRO_AUDIO_DEPTH ALLEGRO_AUDIO_DEPTH;
typedef enum ALLEGRO_CHANNEL_CONF ALLEGRO_CHANNEL_CONF;
typedef enum ALLEGRO_PLAYMODE ALLEGRO_PLAYMODE;
typedef enum ALLEGRO_MIXER_QUALITY ALLEGRO_MIXER_QUALITY;
#endif
/* Sample functions */
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_create_sample, (void *buf,
unsigned int samples, unsigned int freq, ALLEGRO_AUDIO_DEPTH depth,
ALLEGRO_CHANNEL_CONF chan_conf, bool free_buf));
ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_sample, (ALLEGRO_SAMPLE *spl));
/* Sample instance functions */
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE_INSTANCE*, al_create_sample_instance, (
ALLEGRO_SAMPLE *data));
ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_sample_instance, (
ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_frequency, (const ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_length, (const ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_sample_depth, (const ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_sample_channels, (const ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(void *, al_get_sample_data, (const ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_frequency, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_length, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_position, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_speed, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_gain, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_pan, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_time, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_sample_instance_depth, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_sample_instance_channels, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_PLAYMODE, al_get_sample_instance_playmode, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_sample_instance_playing, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_sample_instance_attached, (const ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_position, (ALLEGRO_SAMPLE_INSTANCE *spl, unsigned int val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_length, (ALLEGRO_SAMPLE_INSTANCE *spl, unsigned int val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_speed, (ALLEGRO_SAMPLE_INSTANCE *spl, float val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_gain, (ALLEGRO_SAMPLE_INSTANCE *spl, float val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_pan, (ALLEGRO_SAMPLE_INSTANCE *spl, float val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playmode, (ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_PLAYMODE val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playing, (ALLEGRO_SAMPLE_INSTANCE *spl, bool val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample, (ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_get_sample, (ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_play_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_stop_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl));
/* Stream functions */
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM*, al_create_audio_stream, (size_t buffer_count,
unsigned int samples, unsigned int freq,
ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf));
ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(void, al_drain_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_frequency, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_length, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_fragments, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_available_audio_stream_fragments, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_speed, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_gain, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_pan, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_audio_stream_channels, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_audio_stream_depth, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_PLAYMODE, al_get_audio_stream_playmode, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_audio_stream_playing, (const ALLEGRO_AUDIO_STREAM *spl));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_audio_stream_attached, (const ALLEGRO_AUDIO_STREAM *spl));
ALLEGRO_KCM_AUDIO_FUNC(void *, al_get_audio_stream_fragment, (const ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_speed, (ALLEGRO_AUDIO_STREAM *stream, float val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_gain, (ALLEGRO_AUDIO_STREAM *stream, float val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_pan, (ALLEGRO_AUDIO_STREAM *stream, float val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playmode, (ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_PLAYMODE val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playing, (ALLEGRO_AUDIO_STREAM *stream, bool val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_fragment, (ALLEGRO_AUDIO_STREAM *stream, void *val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_rewind_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_seek_audio_stream_secs, (ALLEGRO_AUDIO_STREAM *stream, double time));
ALLEGRO_KCM_AUDIO_FUNC(double, al_get_audio_stream_position_secs, (ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(double, al_get_audio_stream_length_secs, (ALLEGRO_AUDIO_STREAM *stream));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_loop_secs, (ALLEGRO_AUDIO_STREAM *stream, double start, double end));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_audio_stream_event_source, (ALLEGRO_AUDIO_STREAM *stream));
/* Mixer functions */
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER*, al_create_mixer, (unsigned int freq,
ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf));
ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_mixer, (ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_mixer, (
ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_mixer, (ALLEGRO_AUDIO_STREAM *stream,
ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_mixer, (ALLEGRO_MIXER *stream,
ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_postprocess_callback, (
ALLEGRO_MIXER *mixer,
void (*cb)(void *buf, unsigned int samples, void *data),
void *data));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_mixer_frequency, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_mixer_channels, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_mixer_depth, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER_QUALITY, al_get_mixer_quality, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(float, al_get_mixer_gain, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_mixer_playing, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_mixer_attached, (const ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_frequency, (ALLEGRO_MIXER *mixer, unsigned int val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_quality, (ALLEGRO_MIXER *mixer, ALLEGRO_MIXER_QUALITY val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_gain, (ALLEGRO_MIXER *mixer, float gain));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_playing, (ALLEGRO_MIXER *mixer, bool val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_mixer, (ALLEGRO_MIXER *mixer));
/* Voice functions */
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_VOICE*, al_create_voice, (unsigned int freq,
ALLEGRO_AUDIO_DEPTH depth,
ALLEGRO_CHANNEL_CONF chan_conf));
ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_voice, (ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_voice, (
ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_voice, (
ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_VOICE *voice ));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_voice, (ALLEGRO_MIXER *mixer,
ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(void, al_detach_voice, (ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_voice_frequency, (const ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_voice_position, (const ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_voice_channels, (const ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_voice_depth, (const ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_voice_playing, (const ALLEGRO_VOICE *voice));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_voice_position, (ALLEGRO_VOICE *voice, unsigned int val));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_voice_playing, (ALLEGRO_VOICE *voice, bool val));
/* Misc. audio functions */
ALLEGRO_KCM_AUDIO_FUNC(bool, al_install_audio, (void));
ALLEGRO_KCM_AUDIO_FUNC(void, al_uninstall_audio, (void));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_is_audio_installed, (void));
ALLEGRO_KCM_AUDIO_FUNC(uint32_t, al_get_allegro_audio_version, (void));
ALLEGRO_KCM_AUDIO_FUNC(size_t, al_get_channel_count, (ALLEGRO_CHANNEL_CONF conf));
ALLEGRO_KCM_AUDIO_FUNC(size_t, al_get_audio_depth_size, (ALLEGRO_AUDIO_DEPTH conf));
/* Simple audio layer */
ALLEGRO_KCM_AUDIO_FUNC(bool, al_reserve_samples, (int reserve_samples));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER *, al_get_default_mixer, (void));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_default_mixer, (ALLEGRO_MIXER *mixer));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_restore_default_mixer, (void));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_play_sample, (ALLEGRO_SAMPLE *data,
float gain, float pan, float speed, ALLEGRO_PLAYMODE loop, ALLEGRO_SAMPLE_ID *ret_id));
ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_sample, (ALLEGRO_SAMPLE_ID *spl_id));
ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_samples, (void));
/* File type handlers */
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader, (const char *ext,
ALLEGRO_SAMPLE *(*loader)(const char *filename)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver, (const char *ext,
bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader, (const char *ext,
ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename,
size_t buffer_count, unsigned int samples)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader_f, (const char *ext,
ALLEGRO_SAMPLE *(*loader)(ALLEGRO_FILE *fp)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver_f, (const char *ext,
bool (*saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader_f, (const char *ext,
ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE *fp,
size_t buffer_count, unsigned int samples)));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample, (const char *filename));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample, (const char *filename,
ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream, (const char *filename,
size_t buffer_count, unsigned int samples));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample_f, (ALLEGRO_FILE* fp, const char *ident));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample_f, (ALLEGRO_FILE* fp, const char *ident,
ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream_f, (ALLEGRO_FILE* fp, const char *ident,
size_t buffer_count, unsigned int samples));
#ifdef __cplusplus
} /* End extern "C" */
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,68 @@
#ifndef __al_included_allegro5_allegro_color_h
#define __al_included_allegro5_allegro_color_h
#include "allegro5/allegro.h"
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_COLOR_SRC
#define _ALLEGRO_COLOR_DLL __declspec(dllexport)
#else
#define _ALLEGRO_COLOR_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_COLOR_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_COLOR_FUNC(type, name, args) _ALLEGRO_COLOR_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_COLOR_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_COLOR_FUNC(type, name, args) extern _ALLEGRO_COLOR_DLL type name args
#else
#define ALLEGRO_COLOR_FUNC AL_FUNC
#endif
#ifdef __cplusplus
extern "C" {
#endif
ALLEGRO_COLOR_FUNC(uint32_t, al_get_allegro_color_version, (void));
ALLEGRO_COLOR_FUNC(void, al_color_hsv_to_rgb, (float hue, float saturation,
float value, float *red, float *green, float *blue));
ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_hsl, (float red, float green, float blue,
float *hue, float *saturation, float *lightness));
ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_hsv, (float red, float green, float blue,
float *hue, float *saturation, float *value));
ALLEGRO_COLOR_FUNC(void, al_color_hsl_to_rgb, (float hue, float saturation, float lightness,
float *red, float *green, float *blue));
ALLEGRO_COLOR_FUNC(bool, al_color_name_to_rgb, (char const *name, float *r, float *g,
float *b));
ALLEGRO_COLOR_FUNC(const char*, al_color_rgb_to_name, (float r, float g, float b));
ALLEGRO_COLOR_FUNC(void, al_color_cmyk_to_rgb, (float cyan, float magenta, float yellow,
float key, float *red, float *green, float *blue));
ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_cmyk, (float red, float green, float blue,
float *cyan, float *magenta, float *yellow, float *key));
ALLEGRO_COLOR_FUNC(void, al_color_yuv_to_rgb, (float y, float u, float v,
float *red, float *green, float *blue));
ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_yuv, (float red, float green, float blue,
float *y, float *u, float *v));
ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_html, (float red, float green, float blue,
char *string));
ALLEGRO_COLOR_FUNC(void, al_color_html_to_rgb, (char const *string,
float *red, float *green, float *blue));
ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_yuv, (float y, float u, float v));
ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_cmyk, (float c, float m, float y, float k));
ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_hsl, (float h, float s, float l));
ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_hsv, (float h, float s, float v));
ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_name, (char const *name));
ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_html, (char const *string));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,49 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Header file for Direct3D specific API.
*
* By Milan Mimica.
*
*/
#ifndef __al_included_allegro5_allegro_direct3d_h
#define __al_included_allegro5_allegro_direct3d_h
#include <d3d9.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Public Direct3D-related API
*/
/* Display creation flag. */
#define ALLEGRO_DIRECT3D ALLEGRO_DIRECT3D_INTERNAL
AL_FUNC(LPDIRECT3DDEVICE9, al_get_d3d_device, (ALLEGRO_DISPLAY *));
AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_system_texture, (ALLEGRO_BITMAP *));
AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_video_texture, (ALLEGRO_BITMAP *));
AL_FUNC(bool, al_have_d3d_non_pow2_texture_support, (void));
AL_FUNC(bool, al_have_d3d_non_square_texture_support, (void));
AL_FUNC(void, al_get_d3d_texture_position, (ALLEGRO_BITMAP *bitmap, int *u, int *v));
AL_FUNC(bool, al_is_d3d_device_lost, (ALLEGRO_DISPLAY *display));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,115 @@
#ifndef __al_included_allegro5_allegro_font_h
#define __al_included_allegro5_allegro_font_h
#include "allegro5/allegro.h"
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_FONT_SRC
#define _ALLEGRO_FONT_DLL __declspec(dllexport)
#else
#define _ALLEGRO_FONT_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_FONT_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_FONT_FUNC(type, name, args) _ALLEGRO_FONT_DLL type __cdecl name args
#define ALLEGRO_FONT_METHOD(type, name, args) type (__cdecl *name) args
#define ALLEGRO_FONT_FUNCPTR(type, name, args) extern _ALLEGRO_FONT_DLL type (__cdecl *name) args
#define ALLEGRO_FONT_PRINTFUNC(type, name, args, a, b) ALLEGRO_FONT_FUNC(type, name, args)
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_FONT_FUNC(type, name, args) extern type name args
#define ALLEGRO_FONT_METHOD(type, name, args) type (*name) args
#define ALLEGRO_FONT_FUNCPTR(type, name, args) extern _ALLEGRO_FONT_DLL type (*name) args
#define ALLEGRO_FONT_PRINTFUNC(type, name, args, a, b) ALLEGRO_FONT_FUNC(type, name, args) __attribute__ ((format (printf, a, b)))
#elif defined ALLEGRO_BCC32
#define ALLEGRO_FONT_FUNC(type, name, args) extern _ALLEGRO_FONT_DLL type name args
#define ALLEGRO_FONT_METHOD(type, name, args) type (*name) args
#define ALLEGRO_FONT_FUNCPTR(type, name, args) extern _ALLEGRO_FONT_DLL type (*name) args
#define ALLEGRO_FONT_PRINTFUNC(type, name, args, a, b) ALLEGRO_FONT_FUNC(type, name, args)
#else
#define ALLEGRO_FONT_FUNC AL_FUNC
#define ALLEGRO_FONT_METHOD AL_METHOD
#define ALLEGRO_FONT_FUNCPTR AL_FUNCPTR
#define ALLEGRO_FONT_PRINTFUNC AL_PRINTFUNC
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_FONT
*/
typedef struct ALLEGRO_FONT ALLEGRO_FONT;
typedef struct ALLEGRO_FONT_VTABLE ALLEGRO_FONT_VTABLE;
struct ALLEGRO_FONT
{
void *data;
int height;
ALLEGRO_FONT_VTABLE *vtable;
};
/* text- and font-related stuff */
struct ALLEGRO_FONT_VTABLE
{
ALLEGRO_FONT_METHOD(int, font_height, (const ALLEGRO_FONT *f));
ALLEGRO_FONT_METHOD(int, font_ascent, (const ALLEGRO_FONT *f));
ALLEGRO_FONT_METHOD(int, font_descent, (const ALLEGRO_FONT *f));
ALLEGRO_FONT_METHOD(int, char_length, (const ALLEGRO_FONT *f, int ch));
ALLEGRO_FONT_METHOD(int, text_length, (const ALLEGRO_FONT *f, const ALLEGRO_USTR *text));
ALLEGRO_FONT_METHOD(int, render_char, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, float x, float y));
ALLEGRO_FONT_METHOD(int, render, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, const ALLEGRO_USTR *text, float x, float y));
ALLEGRO_FONT_METHOD(void, destroy, (ALLEGRO_FONT *f));
ALLEGRO_FONT_METHOD(void, get_text_dimensions, (const ALLEGRO_FONT *f,
const ALLEGRO_USTR *text, int *bbx, int *bby, int *bbw, int *bbh));
};
enum {
ALLEGRO_ALIGN_LEFT = 0,
ALLEGRO_ALIGN_CENTRE = 1,
ALLEGRO_ALIGN_CENTER = 1,
ALLEGRO_ALIGN_RIGHT = 2,
ALLEGRO_ALIGN_INTEGER = 4
};
ALLEGRO_FONT_FUNC(bool, al_register_font_loader, (const char *ext, ALLEGRO_FONT *(*load)(const char *filename, int size, int flags)));
ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_load_bitmap_font, (const char *filename));
ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_load_font, (const char *filename, int size, int flags));
ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_grab_font_from_bitmap, (ALLEGRO_BITMAP *bmp, int n, const int ranges[]));
ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_create_builtin_font, (void));
ALLEGRO_FONT_FUNC(void, al_draw_ustr, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, ALLEGRO_USTR const *ustr));
ALLEGRO_FONT_FUNC(void, al_draw_text, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, char const *text));
ALLEGRO_FONT_FUNC(void, al_draw_justified_text, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x1, float x2, float y, float diff, int flags, char const *text));
ALLEGRO_FONT_FUNC(void, al_draw_justified_ustr, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x1, float x2, float y, float diff, int flags, ALLEGRO_USTR const *text));
ALLEGRO_FONT_PRINTFUNC(void, al_draw_textf, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, char const *format, ...), 6, 7);
ALLEGRO_FONT_PRINTFUNC(void, al_draw_justified_textf, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x1, float x2, float y, float diff, int flags, char const *format, ...), 8, 9);
ALLEGRO_FONT_FUNC(int, al_get_text_width, (const ALLEGRO_FONT *f, const char *str));
ALLEGRO_FONT_FUNC(int, al_get_ustr_width, (const ALLEGRO_FONT *f, const ALLEGRO_USTR *ustr));
ALLEGRO_FONT_FUNC(int, al_get_font_line_height, (const ALLEGRO_FONT *f));
ALLEGRO_FONT_FUNC(int, al_get_font_ascent, (const ALLEGRO_FONT *f));
ALLEGRO_FONT_FUNC(int, al_get_font_descent, (const ALLEGRO_FONT *f));
ALLEGRO_FONT_FUNC(void, al_destroy_font, (ALLEGRO_FONT *f));
ALLEGRO_FONT_FUNC(void, al_get_ustr_dimensions, (const ALLEGRO_FONT *f,
ALLEGRO_USTR const *text,
int *bbx, int *bby, int *bbw, int *bbh));
ALLEGRO_FONT_FUNC(void, al_get_text_dimensions, (const ALLEGRO_FONT *f,
char const *text,
int *bbx, int *bby, int *bbw, int *bbh));
ALLEGRO_FONT_FUNC(void, al_init_font_addon, (void));
ALLEGRO_FONT_FUNC(void, al_shutdown_font_addon, (void));
ALLEGRO_FONT_FUNC(uint32_t, al_get_allegro_font_version, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,42 @@
#ifndef __al_included_allegro5_allegro_image_h
#define __al_included_allegro5_allegro_image_h
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_IIO_SRC
#define _ALLEGRO_IIO_DLL __declspec(dllexport)
#else
#define _ALLEGRO_IIO_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_IIO_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_IIO_FUNC(type, name, args) _ALLEGRO_IIO_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_IIO_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_IIO_FUNC(type, name, args) extern _ALLEGRO_IIO_DLL type name args
#else
#define ALLEGRO_IIO_FUNC AL_FUNC
#endif
#ifdef __cplusplus
extern "C" {
#endif
ALLEGRO_IIO_FUNC(bool, al_init_image_addon, (void));
ALLEGRO_IIO_FUNC(void, al_shutdown_image_addon, (void));
ALLEGRO_IIO_FUNC(uint32_t, al_get_allegro_image_version, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
*/
#ifndef A5_IPHONE_ALLEGRO_H
#define A5_IPHONE_ALLEGRO_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Public iPhone-related API
*/
AL_FUNC(void, al_iphone_program_has_halted, (void));
AL_FUNC(void, al_iphone_override_screen_scale, (float scale));
#ifdef __cplusplus
}
#endif
#endif /* A5_IPONE_ALLEGRO_H */

View File

@@ -0,0 +1,40 @@
#ifndef __al_included_allegro5_memfile_h
#define __al_included_allegro5_memfile_h
#include "allegro5/allegro.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_MEMFILE_SRC
#define _ALLEGRO_MEMFILE_DLL __declspec(dllexport)
#else
#define _ALLEGRO_MEMFILE_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_MEMFILE_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_MEMFILE_FUNC(type, name, args) _ALLEGRO_MEMFILE_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_MEMFILE_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_MEMFILE_FUNC(type, name, args) extern _ALLEGRO_MEMFILE_DLL type name args
#else
#define ALLEGRO_MEMFILE_FUNC AL_FUNC
#endif
ALLEGRO_MEMFILE_FUNC(ALLEGRO_FILE *, al_open_memfile, (void *mem, int64_t size, const char *mode));
ALLEGRO_MEMFILE_FUNC(uint32_t, al_get_allegro_memfile_version, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,93 @@
#ifndef __al_included_allegro5_allegro_native_dialog_h
#define __al_included_allegro5_allegro_native_dialog_h
#include "allegro5/allegro.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_NATIVE_DIALOG_SRC
#define _ALLEGRO_DIALOG_DLL __declspec(dllexport)
#else
#define _ALLEGRO_DIALOG_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_DIALOG_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_DIALOG_FUNC(type, name, args) _ALLEGRO_DIALOG_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_DIALOG_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_DIALOG_FUNC(type, name, args) extern _ALLEGRO_DIALOG_DLL type name args
#else
#define ALLEGRO_DIALOG_FUNC AL_FUNC
#endif
/* Type: ALLEGRO_FILECHOOSER
*/
typedef struct ALLEGRO_FILECHOOSER ALLEGRO_FILECHOOSER;
/* Type: ALLEGRO_TEXTLOG
*/
typedef struct ALLEGRO_TEXTLOG ALLEGRO_TEXTLOG;
ALLEGRO_DIALOG_FUNC(bool, al_init_native_dialog_addon, (void));
ALLEGRO_DIALOG_FUNC(void, al_shutdown_native_dialog_addon, (void));
ALLEGRO_DIALOG_FUNC(ALLEGRO_FILECHOOSER *, al_create_native_file_dialog, (char const *initial_path,
char const *title, char const *patterns, int mode));
ALLEGRO_DIALOG_FUNC(bool, al_show_native_file_dialog, (ALLEGRO_DISPLAY *display, ALLEGRO_FILECHOOSER *dialog));
ALLEGRO_DIALOG_FUNC(int, al_get_native_file_dialog_count, (const ALLEGRO_FILECHOOSER *dialog));
ALLEGRO_DIALOG_FUNC(const char *, al_get_native_file_dialog_path, (const ALLEGRO_FILECHOOSER *dialog,
size_t index));
ALLEGRO_DIALOG_FUNC(void, al_destroy_native_file_dialog, (ALLEGRO_FILECHOOSER *dialog));
ALLEGRO_DIALOG_FUNC(int, al_show_native_message_box, (ALLEGRO_DISPLAY *display, char const *title,
char const *heading, char const *text, char const *buttons, int flags));
ALLEGRO_DIALOG_FUNC(ALLEGRO_TEXTLOG *, al_open_native_text_log, (char const *title, int flags));
ALLEGRO_DIALOG_FUNC(void, al_close_native_text_log, (ALLEGRO_TEXTLOG *textlog));
ALLEGRO_DIALOG_FUNC(void, al_append_native_text_log, (ALLEGRO_TEXTLOG *textlog, char const *format, ...));
ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_native_text_log_event_source, (ALLEGRO_TEXTLOG *textlog));
ALLEGRO_DIALOG_FUNC(uint32_t, al_get_allegro_native_dialog_version, (void));
enum {
ALLEGRO_FILECHOOSER_FILE_MUST_EXIST = 1,
ALLEGRO_FILECHOOSER_SAVE = 2,
ALLEGRO_FILECHOOSER_FOLDER = 4,
ALLEGRO_FILECHOOSER_PICTURES = 8,
ALLEGRO_FILECHOOSER_SHOW_HIDDEN = 16,
ALLEGRO_FILECHOOSER_MULTIPLE = 32
};
enum {
ALLEGRO_MESSAGEBOX_WARN = 1<<0,
ALLEGRO_MESSAGEBOX_ERROR = 1<<1,
ALLEGRO_MESSAGEBOX_OK_CANCEL = 1<<2,
ALLEGRO_MESSAGEBOX_YES_NO = 1<<3,
ALLEGRO_MESSAGEBOX_QUESTION = 1<<4
};
enum {
ALLEGRO_TEXTLOG_NO_CLOSE = 1<<0,
ALLEGRO_TEXTLOG_MONOSPACE = 1<<1
};
enum {
ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE = 600
};
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,144 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Main header file for all OpenGL drivers.
*
* By Milan Mimica.
*
*/
#ifndef __al_included_allegro5_allegro_opengl_h
#define __al_included_allegro5_allegro_opengl_h
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ALLEGRO_WINDOWS)
#include <windows.h>
#endif
#if defined ALLEGRO_IPHONE
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
/* Apple defines OES versions for these - however the separated alpha ones
* don't seem to work on the device and just crash.
*/
#define glBlendEquation glBlendEquationOES
#define glBlendFuncSeparate glBlendFuncSeparateOES
#define glBlendEquationSeparate glBlendEquationSeparateOES
#ifdef GL_FUNC_ADD
#undef GL_FUNC_ADD
#undef GL_FUNC_SUBTRACT
#undef GL_FUNC_REVERSE_SUBTRACT
#endif
#define GL_FUNC_ADD GL_FUNC_ADD_OES
#define GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES
#define GL_FUNC_REVERSE_SUBTRACT GL_FUNC_REVERSE_SUBTRACT_OES
#elif defined ALLEGRO_MACOSX
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#endif
#elif defined ALLEGRO_GP2XWIZ
#include <wiz/GL/gl.h>
#include <wiz/GL/nanogl.h>
#include <wiz/GL/wizGLES.h>
#include <wiz/GL/egl.h>
#else /* ALLEGRO_MACOSX */
/* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
#define __glext_h_
#define __glxext_h_
#include <GL/gl.h>
#undef __glext_h_
#undef __glxext_h_
#endif /* ALLEGRO_MACOSX */
#include "allegro5/opengl/gl_ext.h"
#ifdef ALLEGRO_WINDOWS
/* Missing #defines from Mingw */
#ifndef PFD_SWAP_LAYER_BUFFERS
#define PFD_SWAP_LAYER_BUFFERS 0x00000800
#endif
#ifndef PFD_GENERIC_ACCELERATED
#define PFD_GENERIC_ACCELERATED 0x00001000
#endif
#ifndef PFD_SUPPORT_DIRECTDRAW
#define PFD_SUPPORT_DIRECTDRAW 0x00002000
#endif
#ifndef CDS_FULLSCREEN
#define CDS_FULLSCREEN 0x00000004
#endif
#ifndef ENUM_CURRENT_SETTINGS
#define ENUM_CURRENT_SETTINGS ((DWORD)-1)
#endif
#endif /* ALLEGRO_WINDOWS */
#if defined ALLEGRO_WINDOWS
#define ALLEGRO_DEFINE_PROC_TYPE(type, name, args) \
typedef type (APIENTRY * name) args;
#else
#define ALLEGRO_DEFINE_PROC_TYPE(type, name, args) \
typedef type (*name) args;
#endif
/*
* Public OpenGL-related API
*/
/* Enum: ALLEGRO_OPENGL_VARIANT
*/
typedef enum ALLEGRO_OPENGL_VARIANT {
ALLEGRO_DESKTOP_OPENGL = 0,
ALLEGRO_OPENGL_ES
} ALLEGRO_OPENGL_VARIANT;
AL_FUNC(uint32_t, al_get_opengl_version, (void));
AL_FUNC(bool, al_have_opengl_extension, (const char *extension));
AL_FUNC(void*, al_get_opengl_proc_address, (const char *name));
AL_FUNC(ALLEGRO_OGL_EXT_LIST*, al_get_opengl_extension_list, (void));
AL_FUNC(GLuint, al_get_opengl_texture, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(void, al_remove_opengl_fbo, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(GLuint, al_get_opengl_fbo, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(void, al_get_opengl_texture_size, (ALLEGRO_BITMAP *bitmap,
int *w, int *h));
AL_FUNC(void, al_get_opengl_texture_position, (ALLEGRO_BITMAP *bitmap,
int *u, int *v));
AL_FUNC(void, al_set_current_opengl_context, (ALLEGRO_DISPLAY *display));
AL_FUNC(int, al_get_opengl_variant, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,30 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
*/
#ifndef A5_OSX_ALLEGRO_H
#define A5_OSX_ALLEGRO_H
/*
* Public Objective-C OSX-related API
*/
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(NSWindow *, al_osx_get_window, (ALLEGRO_DISPLAY *d));
#ifdef __cplusplus
}
#endif
#endif /* A5_OSX_ALLEGRO_H */

View File

@@ -0,0 +1,41 @@
#ifndef __al_included_allegro5_allegro_physfs_h
#define __al_included_allegro5_allegro_physfs_h
#include "allegro5/allegro.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_PHYSFS_SRC
#define _ALLEGRO_PHYSFS_DLL __declspec(dllexport)
#else
#define _ALLEGRO_PHYSFS_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_PHYSFS_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_PHYSFS_FUNC(type, name, args) _ALLEGRO_PHYSFS_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_PHYSFS_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_PHYSFS_FUNC(type, name, args) extern _ALLEGRO_PHYSFS_DLL type name args
#else
#define ALLEGRO_PHYSFS_FUNC AL_FUNC
#endif
ALLEGRO_PHYSFS_FUNC(void, al_set_physfs_file_interface, (void));
ALLEGRO_PHYSFS_FUNC(uint32_t, al_get_allegro_physfs_version, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,164 @@
#ifndef __al_included_allegro5_allegro_primitives_h
#define __al_included_allegro5_allegro_primitives_h
#include <allegro5/allegro.h>
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_PRIMITIVES_SRC
#define _ALLEGRO_PRIM_DLL __declspec(dllexport)
#else
#define _ALLEGRO_PRIM_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_PRIM_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_PRIM_FUNC(type, name, args) _ALLEGRO_PRIM_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_PRIM_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_PRIM_FUNC(type, name, args) extern _ALLEGRO_PRIM_DLL type name args
#else
#define ALLEGRO_PRIM_FUNC AL_FUNC
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* Enum: ALLEGRO_PRIM_TYPE
*/
typedef enum ALLEGRO_PRIM_TYPE
{
ALLEGRO_PRIM_LINE_LIST,
ALLEGRO_PRIM_LINE_STRIP,
ALLEGRO_PRIM_LINE_LOOP,
ALLEGRO_PRIM_TRIANGLE_LIST,
ALLEGRO_PRIM_TRIANGLE_STRIP,
ALLEGRO_PRIM_TRIANGLE_FAN,
ALLEGRO_PRIM_POINT_LIST,
ALLEGRO_PRIM_NUM_TYPES
} ALLEGRO_PRIM_TYPE;
/* Enum: ALLEGRO_PRIM_ATTR
*/
typedef enum ALLEGRO_PRIM_ATTR
{
ALLEGRO_PRIM_POSITION = 1,
ALLEGRO_PRIM_COLOR_ATTR,
ALLEGRO_PRIM_TEX_COORD,
ALLEGRO_PRIM_TEX_COORD_PIXEL,
ALLEGRO_PRIM_ATTR_NUM
} ALLEGRO_PRIM_ATTR;
/* Enum: ALLEGRO_PRIM_STORAGE
*/
typedef enum ALLEGRO_PRIM_STORAGE
{
ALLEGRO_PRIM_FLOAT_2,
ALLEGRO_PRIM_FLOAT_3,
ALLEGRO_PRIM_SHORT_2
} ALLEGRO_PRIM_STORAGE;
/* Enum: ALLEGRO_VERTEX_CACHE_SIZE
*/
#define ALLEGRO_VERTEX_CACHE_SIZE 256
/* Enum: ALLEGRO_PRIM_QUALITY
*/
#define ALLEGRO_PRIM_QUALITY 10
/* Type: ALLEGRO_VERTEX_ELEMENT
*/
typedef struct ALLEGRO_VERTEX_ELEMENT ALLEGRO_VERTEX_ELEMENT;
struct ALLEGRO_VERTEX_ELEMENT {
int attribute;
int storage;
int offset;
};
/* Type: ALLEGRO_VERTEX_DECL
*/
typedef struct ALLEGRO_VERTEX_DECL ALLEGRO_VERTEX_DECL;
/* Duplicated in allegro5/internal/aintern_tri_soft.h */
#ifndef _ALLEGRO_VERTEX_DEFINED
#define _ALLEGRO_VERTEX_DEFINED
/* Type: ALLEGRO_VERTEX
*/
typedef struct ALLEGRO_VERTEX ALLEGRO_VERTEX;
struct ALLEGRO_VERTEX {
float x, y, z;
float u, v;
ALLEGRO_COLOR color;
};
#endif
ALLEGRO_PRIM_FUNC(uint32_t, al_get_allegro_primitives_version, (void));
/*
* Primary Functions
*/
ALLEGRO_PRIM_FUNC(bool, al_init_primitives_addon, (void));
ALLEGRO_PRIM_FUNC(void, al_shutdown_primitives_addon, (void));
ALLEGRO_PRIM_FUNC(int, al_draw_prim, (const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEGRO_BITMAP* texture, int start, int end, int type));
ALLEGRO_PRIM_FUNC(int, al_draw_indexed_prim, (const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEGRO_BITMAP* texture, const int* indices, int num_vtx, int type));
ALLEGRO_PRIM_FUNC(ALLEGRO_VERTEX_DECL*, al_create_vertex_decl, (const ALLEGRO_VERTEX_ELEMENT* elements, int stride));
ALLEGRO_PRIM_FUNC(void, al_destroy_vertex_decl, (ALLEGRO_VERTEX_DECL* decl));
/*
* Custom primitives
*/
ALLEGRO_PRIM_FUNC(void, al_draw_soft_triangle, (ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state,
void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*),
void (*first)(uintptr_t, int, int, int, int),
void (*step)(uintptr_t, int),
void (*draw)(uintptr_t, int, int, int)));
ALLEGRO_PRIM_FUNC(void, al_draw_soft_line, (ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, uintptr_t state,
void (*first)(uintptr_t, int, int, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*),
void (*step)(uintptr_t, int),
void (*draw)(uintptr_t, int, int)));
/*
*High level primitives
*/
ALLEGRO_PRIM_FUNC(void, al_draw_line, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_rectangle, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_calculate_arc, (float* dest, int stride, float cx, float cy, float rx, float ry, float start_theta, float delta_theta, float thickness, int num_segments));
ALLEGRO_PRIM_FUNC(void, al_draw_circle, (float cx, float cy, float r, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_ellipse, (float cx, float cy, float rx, float ry, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_arc, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_elliptical_arc, (float cx, float cy, float rx, float ry, float start_theta, float delta_theta, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_draw_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_calculate_spline, (float* dest, int stride, float points[8], float thickness, int num_segments));
ALLEGRO_PRIM_FUNC(void, al_draw_spline, (float points[8], ALLEGRO_COLOR color, float thickness));
ALLEGRO_PRIM_FUNC(void, al_calculate_ribbon, (float* dest, int dest_stride, const float *points, int points_stride, float thickness, int num_segments));
ALLEGRO_PRIM_FUNC(void, al_draw_ribbon, (const float *points, int points_stride, ALLEGRO_COLOR color, float thickness, int num_segments));
ALLEGRO_PRIM_FUNC(void, al_draw_filled_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, ALLEGRO_COLOR color));
ALLEGRO_PRIM_FUNC(void, al_draw_filled_rectangle, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color));
ALLEGRO_PRIM_FUNC(void, al_draw_filled_ellipse, (float cx, float cy, float rx, float ry, ALLEGRO_COLOR color));
ALLEGRO_PRIM_FUNC(void, al_draw_filled_circle, (float cx, float cy, float r, ALLEGRO_COLOR color));
ALLEGRO_PRIM_FUNC(void, al_draw_filled_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color));
ALLEGRO_PRIM_FUNC(void, al_draw_filled_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, ALLEGRO_COLOR color));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,49 @@
#ifndef __al_included_allegro5_allegro_ttf_h
#define __al_included_allegro5_allegro_ttf_h
#include "allegro5/allegro.h"
#include "allegro5/allegro_font.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ALLEGRO_TTF_NO_KERNING 1
#define ALLEGRO_TTF_MONOCHROME 2
#define ALLEGRO_TTF_NO_AUTOHINT 4
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
#ifndef ALLEGRO_STATICLINK
#ifdef ALLEGRO_TTF_SRC
#define _ALLEGRO_TTF_DLL __declspec(dllexport)
#else
#define _ALLEGRO_TTF_DLL __declspec(dllimport)
#endif
#else
#define _ALLEGRO_TTF_DLL
#endif
#endif
#if defined ALLEGRO_MSVC
#define ALLEGRO_TTF_FUNC(type, name, args) _ALLEGRO_TTF_DLL type __cdecl name args
#elif defined ALLEGRO_MINGW32
#define ALLEGRO_TTF_FUNC(type, name, args) extern type name args
#elif defined ALLEGRO_BCC32
#define ALLEGRO_TTF_FUNC(type, name, args) extern _ALLEGRO_TTF_DLL type name args
#else
#define ALLEGRO_TTF_FUNC AL_FUNC
#endif
ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font, (char const *filename, int size, int flags));
ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font_f, (ALLEGRO_FILE *file, char const *filename, int size, int flags));
ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font_stretch, (char const *filename, int w, int h, int flags));
ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font_stretch_f, (ALLEGRO_FILE *file, char const *filename, int w, int h, int flags));
ALLEGRO_TTF_FUNC(bool, al_init_ttf_addon, (void));
ALLEGRO_TTF_FUNC(void, al_shutdown_ttf_addon, (void));
ALLEGRO_TTF_FUNC(uint32_t, al_get_allegro_ttf_version, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,38 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Header file for Windows specific API.
*
* By Trent Gamblin.
*
*/
#ifndef __al_included_allegro5_allegro_windows_h
#define __al_included_allegro5_allegro_windows_h
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Public Windows-related API
*/
AL_FUNC(HWND, al_get_win_window_handle, (ALLEGRO_DISPLAY *));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,30 @@
#ifndef __al_included_allegro5_altime_h
#define __al_included_allegro5_altime_h
#include "allegro5/base.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_TIMEOUT
*/
typedef struct ALLEGRO_TIMEOUT ALLEGRO_TIMEOUT;
struct ALLEGRO_TIMEOUT {
uint64_t __pad1__;
uint64_t __pad2__;
};
AL_FUNC(double, al_get_time, (void));
AL_FUNC(void, al_rest, (double seconds));
AL_FUNC(void, al_init_timeout, (ALLEGRO_TIMEOUT *timeout, double seconds));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,96 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Base header, defines basic stuff needed by pretty much
* everything else.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_base_h
#define __al_included_allegro5_base_h
#ifndef ALLEGRO_NO_STD_HEADERS
#include <errno.h>
#ifdef _MSC_VER
/* enable posix for limits.h and only limits.h
enabling it for all msvc headers will potentially
disable a lot of commonly used msvcrt functions */
#define _POSIX_
#include <limits.h>
#undef _POSIX_
#else
#include <limits.h>
#endif
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <sys/types.h>
#endif
#if (defined DEBUGMODE) && (defined FORTIFY)
#include <fortify/fortify.h>
#endif
#if (defined DEBUGMODE) && (defined DMALLOC)
#include <dmalloc.h>
#endif
#include "allegro5/internal/alconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ALLEGRO_VERSION 5
#define ALLEGRO_SUB_VERSION 0
#define ALLEGRO_WIP_VERSION 10
/* Not sure we need it, but since ALLEGRO_VERSION_STR contains it:
* 0 = SVN
* 1 = first release
* 2... = hotfixes?
*
* Note x.y.z (= x.y.z.0) has release number 1, and x.y.z.1 has release
* number 2, just to confuse you.
*/
#define ALLEGRO_RELEASE_NUMBER 1
#define ALLEGRO_VERSION_STR "5.0.10"
#define ALLEGRO_DATE_STR "2013"
#define ALLEGRO_DATE 20130616 /* yyyymmdd */
#define ALLEGRO_VERSION_INT \
((ALLEGRO_VERSION << 24) | (ALLEGRO_SUB_VERSION << 16) | \
(ALLEGRO_WIP_VERSION << 8) | ALLEGRO_RELEASE_NUMBER)
AL_FUNC(uint32_t, al_get_allegro_version, (void));
AL_FUNC(int, al_run_main, (int argc, char **argv, int (*)(int, char **)));
/*******************************************/
/************ Some global stuff ************/
/*******************************************/
/* Type: ALLEGRO_PI
*/
#define ALLEGRO_PI 3.14159265358979323846
#define AL_ID(a,b,c,d) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d))
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,71 @@
#ifndef __al_included_allegro5_bitmap_h
#define __al_included_allegro5_bitmap_h
#include "allegro5/color.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_BITMAP
*/
typedef struct ALLEGRO_BITMAP ALLEGRO_BITMAP;
/*
* Bitmap flags
*/
enum {
ALLEGRO_MEMORY_BITMAP = 0x0001,
ALLEGRO_KEEP_BITMAP_FORMAT = 0x0002,
ALLEGRO_FORCE_LOCKING = 0x0004,
ALLEGRO_NO_PRESERVE_TEXTURE = 0x0008,
ALLEGRO_ALPHA_TEST = 0x0010,
_ALLEGRO_INTERNAL_OPENGL = 0x0020,
ALLEGRO_MIN_LINEAR = 0x0040,
ALLEGRO_MAG_LINEAR = 0x0080,
ALLEGRO_MIPMAP = 0x0100,
ALLEGRO_NO_PREMULTIPLIED_ALPHA = 0x0200,
ALLEGRO_VIDEO_BITMAP = 0x0400
};
AL_FUNC(void, al_set_new_bitmap_format, (int format));
AL_FUNC(void, al_set_new_bitmap_flags, (int flags));
AL_FUNC(int, al_get_new_bitmap_format, (void));
AL_FUNC(int, al_get_new_bitmap_flags, (void));
AL_FUNC(void, al_add_new_bitmap_flag, (int flag));
AL_FUNC(int, al_get_bitmap_width, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(int, al_get_bitmap_height, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(int, al_get_bitmap_format, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(int, al_get_bitmap_flags, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(ALLEGRO_BITMAP*, al_create_bitmap, (int w, int h));
AL_FUNC(void, al_destroy_bitmap, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(void, al_put_pixel, (int x, int y, ALLEGRO_COLOR color));
AL_FUNC(void, al_put_blended_pixel, (int x, int y, ALLEGRO_COLOR color));
AL_FUNC(ALLEGRO_COLOR, al_get_pixel, (ALLEGRO_BITMAP *bitmap, int x, int y));
/* Masking */
AL_FUNC(void, al_convert_mask_to_alpha, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR mask_color));
/* Clipping */
AL_FUNC(void, al_set_clipping_rectangle, (int x, int y, int width, int height));
AL_FUNC(void, al_reset_clipping_rectangle, (void));
AL_FUNC(void, al_get_clipping_rectangle, (int *x, int *y, int *w, int *h));
/* Sub bitmaps */
AL_FUNC(ALLEGRO_BITMAP *, al_create_sub_bitmap, (ALLEGRO_BITMAP *parent, int x, int y, int w, int h));
AL_FUNC(bool, al_is_sub_bitmap, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(ALLEGRO_BITMAP *, al_get_parent_bitmap, (ALLEGRO_BITMAP *bitmap));
/* Miscellaneous */
AL_FUNC(ALLEGRO_BITMAP *, al_clone_bitmap, (ALLEGRO_BITMAP *bitmap));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,42 @@
#ifndef __al_included_allegro5_bitmap_draw_h
#define __al_included_allegro5_bitmap_draw_h
#include "allegro5/bitmap.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Flags for the blitting functions */
enum {
ALLEGRO_FLIP_HORIZONTAL = 0x00001,
ALLEGRO_FLIP_VERTICAL = 0x00002
};
/* Blitting */
AL_FUNC(void, al_draw_bitmap, (ALLEGRO_BITMAP *bitmap, float dx, float dy, int flags));
AL_FUNC(void, al_draw_bitmap_region, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, int flags));
AL_FUNC(void, al_draw_scaled_bitmap, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags));
AL_FUNC(void, al_draw_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float angle, int flags));
AL_FUNC(void, al_draw_scaled_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags));
/* Tinted blitting */
AL_FUNC(void, al_draw_tinted_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float dx, float dy, int flags));
AL_FUNC(void, al_draw_tinted_bitmap_region, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, int flags));
AL_FUNC(void, al_draw_tinted_scaled_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags));
AL_FUNC(void, al_draw_tinted_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float cx, float cy, float dx, float dy, float angle, int flags));
AL_FUNC(void, al_draw_tinted_scaled_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags));
AL_FUNC(void, al_draw_tinted_scaled_rotated_bitmap_region, (
ALLEGRO_BITMAP *bitmap,
float sx, float sy, float sw, float sh,
ALLEGRO_COLOR tint,
float cx, float cy, float dx, float dy, float xscale, float yscale,
float angle, int flags));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,31 @@
#ifndef __al_included_allegro5_bitmap_io_h
#define __al_included_allegro5_bitmap_io_h
#include "allegro5/bitmap.h"
#include "allegro5/file.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef ALLEGRO_BITMAP *(*ALLEGRO_IIO_LOADER_FUNCTION)(const char *filename);
typedef ALLEGRO_BITMAP *(*ALLEGRO_IIO_FS_LOADER_FUNCTION)(ALLEGRO_FILE *fp);
typedef bool (*ALLEGRO_IIO_SAVER_FUNCTION)(const char *filename, ALLEGRO_BITMAP *bitmap);
typedef bool (*ALLEGRO_IIO_FS_SAVER_FUNCTION)(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bitmap);
AL_FUNC(bool, al_register_bitmap_loader, (const char *ext, ALLEGRO_IIO_LOADER_FUNCTION loader));
AL_FUNC(bool, al_register_bitmap_saver, (const char *ext, ALLEGRO_IIO_SAVER_FUNCTION saver));
AL_FUNC(bool, al_register_bitmap_loader_f, (const char *ext, ALLEGRO_IIO_FS_LOADER_FUNCTION fs_loader));
AL_FUNC(bool, al_register_bitmap_saver_f, (const char *ext, ALLEGRO_IIO_FS_SAVER_FUNCTION fs_saver));
AL_FUNC(ALLEGRO_BITMAP *, al_load_bitmap, (const char *filename));
AL_FUNC(ALLEGRO_BITMAP *, al_load_bitmap_f, (ALLEGRO_FILE *fp, const char *ident));
AL_FUNC(bool, al_save_bitmap, (const char *filename, ALLEGRO_BITMAP *bitmap));
AL_FUNC(bool, al_save_bitmap_f, (ALLEGRO_FILE *fp, const char *ident, ALLEGRO_BITMAP *bitmap));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,42 @@
#ifndef __al_included_allegro5_bitmap_lock_h
#define __al_included_allegro5_bitmap_lock_h
#include "allegro5/bitmap.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Locking flags
*/
enum {
ALLEGRO_LOCK_READWRITE = 0,
ALLEGRO_LOCK_READONLY = 1,
ALLEGRO_LOCK_WRITEONLY = 2
};
/* Type: ALLEGRO_LOCKED_REGION
*/
typedef struct ALLEGRO_LOCKED_REGION ALLEGRO_LOCKED_REGION;
struct ALLEGRO_LOCKED_REGION {
void *data;
int format;
int pitch;
int pixel_size;
};
AL_FUNC(ALLEGRO_LOCKED_REGION*, al_lock_bitmap, (ALLEGRO_BITMAP *bitmap, int format, int flags));
AL_FUNC(ALLEGRO_LOCKED_REGION*, al_lock_bitmap_region, (ALLEGRO_BITMAP *bitmap, int x, int y, int width, int height, int format, int flags));
AL_FUNC(void, al_unlock_bitmap, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(bool, al_is_bitmap_locked, (ALLEGRO_BITMAP *bitmap));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,44 @@
#ifndef __al_included_allegro5_blender_h
#define __al_included_allegro5_blender_h
#ifdef __cplusplus
extern "C" {
#endif
/*
* Blending modes
*/
enum ALLEGRO_BLEND_MODE {
ALLEGRO_ZERO = 0,
ALLEGRO_ONE = 1,
ALLEGRO_ALPHA = 2,
ALLEGRO_INVERSE_ALPHA = 3,
ALLEGRO_SRC_COLOR = 4,
ALLEGRO_DEST_COLOR = 5,
ALLEGRO_INVERSE_SRC_COLOR = 6,
ALLEGRO_INVERSE_DEST_COLOR = 7,
ALLEGRO_NUM_BLEND_MODES
};
enum ALLEGRO_BLEND_OPERATIONS {
ALLEGRO_ADD = 0,
ALLEGRO_SRC_MINUS_DEST = 1,
ALLEGRO_DEST_MINUS_SRC = 2,
ALLEGRO_NUM_BLEND_OPERATIONS
};
AL_FUNC(void, al_set_blender, (int op, int source, int dest));
AL_FUNC(void, al_get_blender, (int *op, int *source, int *dest));
AL_FUNC(void, al_set_separate_blender, (int op, int source, int dest,
int alpha_op, int alpha_source, int alpha_dest));
AL_FUNC(void, al_get_separate_blender, (int *op, int *source, int *dest,
int *alpha_op, int *alpha_src, int *alpha_dest));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,79 @@
#ifndef __al_included_allegro5_color_h
#define __al_included_allegro5_color_h
#include "allegro5/base.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_COLOR
*/
typedef struct ALLEGRO_COLOR ALLEGRO_COLOR;
struct ALLEGRO_COLOR
{
float r, g, b, a;
};
/* Enum: ALLEGRO_PIXEL_FORMAT
*/
typedef enum ALLEGRO_PIXEL_FORMAT
{
ALLEGRO_PIXEL_FORMAT_ANY = 0,
ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA,
ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA,
ALLEGRO_PIXEL_FORMAT_ARGB_8888,
ALLEGRO_PIXEL_FORMAT_RGBA_8888,
ALLEGRO_PIXEL_FORMAT_ARGB_4444,
ALLEGRO_PIXEL_FORMAT_RGB_888, /* 24 bit format */
ALLEGRO_PIXEL_FORMAT_RGB_565,
ALLEGRO_PIXEL_FORMAT_RGB_555,
ALLEGRO_PIXEL_FORMAT_RGBA_5551,
ALLEGRO_PIXEL_FORMAT_ARGB_1555,
ALLEGRO_PIXEL_FORMAT_ABGR_8888,
ALLEGRO_PIXEL_FORMAT_XBGR_8888,
ALLEGRO_PIXEL_FORMAT_BGR_888, /* 24 bit format */
ALLEGRO_PIXEL_FORMAT_BGR_565,
ALLEGRO_PIXEL_FORMAT_BGR_555,
ALLEGRO_PIXEL_FORMAT_RGBX_8888,
ALLEGRO_PIXEL_FORMAT_XRGB_8888,
ALLEGRO_PIXEL_FORMAT_ABGR_F32,
ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE,
ALLEGRO_PIXEL_FORMAT_RGBA_4444,
ALLEGRO_NUM_PIXEL_FORMATS
} ALLEGRO_PIXEL_FORMAT;
/* Pixel mapping */
AL_FUNC(ALLEGRO_COLOR, al_map_rgb, (unsigned char r, unsigned char g, unsigned char b));
AL_FUNC(ALLEGRO_COLOR, al_map_rgba, (unsigned char r, unsigned char g, unsigned char b, unsigned char a));
AL_FUNC(ALLEGRO_COLOR, al_map_rgb_f, (float r, float g, float b));
AL_FUNC(ALLEGRO_COLOR, al_map_rgba_f, (float r, float g, float b, float a));
/* Pixel unmapping */
AL_FUNC(void, al_unmap_rgb, (ALLEGRO_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b));
AL_FUNC(void, al_unmap_rgba, (ALLEGRO_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a));
AL_FUNC(void, al_unmap_rgb_f, (ALLEGRO_COLOR color, float *r, float *g, float *b));
AL_FUNC(void, al_unmap_rgba_f, (ALLEGRO_COLOR color, float *r, float *g, float *b, float *a));
/* Pixel formats */
AL_FUNC(int, al_get_pixel_size, (int format));
AL_FUNC(int, al_get_pixel_format_bits, (int format));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,45 @@
#ifndef __al_included_allegro5_config_h
#define __al_included_allegro5_config_h
#include "allegro5/file.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_CONFIG
*/
typedef struct ALLEGRO_CONFIG ALLEGRO_CONFIG;
/* Type: ALLEGRO_CONFIG_SECTION
*/
typedef struct ALLEGRO_CONFIG_SECTION ALLEGRO_CONFIG_SECTION;
/* Type: ALLEGRO_CONFIG_ENTRY
*/
typedef struct ALLEGRO_CONFIG_ENTRY ALLEGRO_CONFIG_ENTRY;
AL_FUNC(ALLEGRO_CONFIG *, al_create_config, (void));
AL_FUNC(void, al_add_config_section, (ALLEGRO_CONFIG *config, const char *name));
AL_FUNC(void, al_set_config_value, (ALLEGRO_CONFIG *config, const char *section, const char *key, const char *value));
AL_FUNC(void, al_add_config_comment, (ALLEGRO_CONFIG *config, const char *section, const char *comment));
AL_FUNC(const char*, al_get_config_value, (const ALLEGRO_CONFIG *config, const char *section, const char *key));
AL_FUNC(ALLEGRO_CONFIG*, al_load_config_file, (const char *filename));
AL_FUNC(ALLEGRO_CONFIG*, al_load_config_file_f, (ALLEGRO_FILE *filename));
AL_FUNC(bool, al_save_config_file, (const char *filename, const ALLEGRO_CONFIG *config));
AL_FUNC(bool, al_save_config_file_f, (ALLEGRO_FILE *file, const ALLEGRO_CONFIG *config));
AL_FUNC(void, al_merge_config_into, (ALLEGRO_CONFIG *master, const ALLEGRO_CONFIG *add));
AL_FUNC(ALLEGRO_CONFIG *, al_merge_config, (const ALLEGRO_CONFIG *cfg1, const ALLEGRO_CONFIG *cfg2));
AL_FUNC(void, al_destroy_config, (ALLEGRO_CONFIG *config));
AL_FUNC(char const *, al_get_first_config_section, (ALLEGRO_CONFIG const *config, ALLEGRO_CONFIG_SECTION **iterator));
AL_FUNC(char const *, al_get_next_config_section, (ALLEGRO_CONFIG_SECTION **iterator));
AL_FUNC(char const *, al_get_first_config_entry, (ALLEGRO_CONFIG const *config, char const *section,
ALLEGRO_CONFIG_ENTRY **iterator));
AL_FUNC(char const *, al_get_next_config_entry, (ALLEGRO_CONFIG_ENTRY **iterator));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,92 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Debug facilities.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_debug_h
#define __al_included_allegro5_debug_h
#include <assert.h>
#include "allegro5/base.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(bool, _al_trace_prefix, (char const *channel, int level,
char const *file, int line, char const *function));
AL_PRINTFUNC(void, _al_trace_suffix, (const char *msg, ...), 1, 2);
#ifdef DEBUGMODE
/* Must not be used with a trailing semicolon. */
#ifdef ALLEGRO_GCC
#define ALLEGRO_DEBUG_CHANNEL(x) \
static char const *__al_debug_channel __attribute__((unused)) = x;
#else
#define ALLEGRO_DEBUG_CHANNEL(x) \
static char const *__al_debug_channel = x;
#endif
#define ALLEGRO_TRACE_CHANNEL_LEVEL(channel, level) \
!_al_trace_prefix(channel, level, __FILE__, __LINE__, __func__) \
? (void)0 : _al_trace_suffix
#else
#define ALLEGRO_TRACE_CHANNEL_LEVEL(channel, x) 1 ? (void) 0 : _al_trace_suffix
#define ALLEGRO_DEBUG_CHANNEL(x)
#endif
#define ALLEGRO_TRACE_LEVEL(x) ALLEGRO_TRACE_CHANNEL_LEVEL(__al_debug_channel, x)
#define ALLEGRO_DEBUG ALLEGRO_TRACE_LEVEL(0)
#define ALLEGRO_INFO ALLEGRO_TRACE_LEVEL(1)
#define ALLEGRO_WARN ALLEGRO_TRACE_LEVEL(2)
#define ALLEGRO_ERROR ALLEGRO_TRACE_LEVEL(3)
/* Run-time assertions. */
AL_FUNCPTR(void, _al_user_assert_handler, (char const *expr, char const *file,
int line, char const *func));
AL_FUNC(void, al_register_assert_handler, (void (*handler)(char const *expr,
char const *file, int line, char const *func)));
#ifdef NDEBUG
#define ALLEGRO_ASSERT(e) ((void)(0 && (e)))
#else
#define ALLEGRO_ASSERT(e) \
((e) ? (void) 0 \
: (_al_user_assert_handler) ? \
_al_user_assert_handler(#e, __FILE__, __LINE__, __func__) \
: assert(e))
#endif
/* Compile time assertions. */
#define ALLEGRO_ASSERT_CONCAT_(a, b) a##b
#define ALLEGRO_ASSERT_CONCAT(a, b) ALLEGRO_ASSERT_CONCAT_(a, b)
#define ALLEGRO_STATIC_ASSERT(module, e) \
struct ALLEGRO_ASSERT_CONCAT(static_assert_##module##_line_, __LINE__) \
{ unsigned int bf : !!(e); }
/* We are lazy and use just ASSERT while Allegro itself is compiled. */
#ifdef ALLEGRO_LIB_BUILD
#define ASSERT(x) ALLEGRO_ASSERT(x)
#endif
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,151 @@
#ifndef __al_included_allegro5_display_h
#define __al_included_allegro5_display_h
#include "allegro5/bitmap.h"
#include "allegro5/color.h"
#include "allegro5/events.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Possible bit combinations for the flags parameter of al_create_display. */
enum {
ALLEGRO_WINDOWED = 1 << 0,
ALLEGRO_FULLSCREEN = 1 << 1,
ALLEGRO_OPENGL = 1 << 2,
ALLEGRO_DIRECT3D_INTERNAL = 1 << 3,
ALLEGRO_RESIZABLE = 1 << 4,
ALLEGRO_FRAMELESS = 1 << 5,
ALLEGRO_NOFRAME = ALLEGRO_FRAMELESS, /* older synonym */
ALLEGRO_GENERATE_EXPOSE_EVENTS = 1 << 6,
ALLEGRO_OPENGL_3_0 = 1 << 7,
ALLEGRO_OPENGL_FORWARD_COMPATIBLE = 1 << 8,
ALLEGRO_FULLSCREEN_WINDOW = 1 << 9,
ALLEGRO_MINIMIZED = 1 << 10
};
/* Possible parameters for al_set_display_option.
* Make sure to update ALLEGRO_EXTRA_DISPLAY_SETTINGS if you modify
* anything here.
*/
enum ALLEGRO_DISPLAY_OPTIONS {
ALLEGRO_RED_SIZE,
ALLEGRO_GREEN_SIZE,
ALLEGRO_BLUE_SIZE,
ALLEGRO_ALPHA_SIZE,
ALLEGRO_RED_SHIFT,
ALLEGRO_GREEN_SHIFT,
ALLEGRO_BLUE_SHIFT,
ALLEGRO_ALPHA_SHIFT,
ALLEGRO_ACC_RED_SIZE,
ALLEGRO_ACC_GREEN_SIZE,
ALLEGRO_ACC_BLUE_SIZE,
ALLEGRO_ACC_ALPHA_SIZE,
ALLEGRO_STEREO,
ALLEGRO_AUX_BUFFERS,
ALLEGRO_COLOR_SIZE,
ALLEGRO_DEPTH_SIZE,
ALLEGRO_STENCIL_SIZE,
ALLEGRO_SAMPLE_BUFFERS,
ALLEGRO_SAMPLES,
ALLEGRO_RENDER_METHOD,
ALLEGRO_FLOAT_COLOR,
ALLEGRO_FLOAT_DEPTH,
ALLEGRO_SINGLE_BUFFER,
ALLEGRO_SWAP_METHOD,
ALLEGRO_COMPATIBLE_DISPLAY,
ALLEGRO_UPDATE_DISPLAY_REGION,
ALLEGRO_VSYNC,
ALLEGRO_MAX_BITMAP_SIZE,
ALLEGRO_SUPPORT_NPOT_BITMAP,
ALLEGRO_CAN_DRAW_INTO_BITMAP,
ALLEGRO_SUPPORT_SEPARATE_ALPHA,
ALLEGRO_DISPLAY_OPTIONS_COUNT
};
enum
{
ALLEGRO_DONTCARE,
ALLEGRO_REQUIRE,
ALLEGRO_SUGGEST
};
enum ALLEGRO_DISPLAY_ORIENTATION
{
ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES,
ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES,
ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES,
ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES,
ALLEGRO_DISPLAY_ORIENTATION_FACE_UP,
ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN
};
/* Type: ALLEGRO_DISPLAY
*/
typedef struct ALLEGRO_DISPLAY ALLEGRO_DISPLAY;
AL_FUNC(void, al_set_new_display_refresh_rate, (int refresh_rate));
AL_FUNC(void, al_set_new_display_flags, (int flags));
AL_FUNC(int, al_get_new_display_refresh_rate, (void));
AL_FUNC(int, al_get_new_display_flags, (void));
AL_FUNC(int, al_get_display_width, (ALLEGRO_DISPLAY *display));
AL_FUNC(int, al_get_display_height, (ALLEGRO_DISPLAY *display));
AL_FUNC(int, al_get_display_format, (ALLEGRO_DISPLAY *display));
AL_FUNC(int, al_get_display_refresh_rate, (ALLEGRO_DISPLAY *display));
AL_FUNC(int, al_get_display_flags, (ALLEGRO_DISPLAY *display));
AL_FUNC(bool, al_set_display_flag, (ALLEGRO_DISPLAY *display, int flag, bool onoff));
AL_FUNC(bool, al_toggle_display_flag, (ALLEGRO_DISPLAY *display, int flag, bool onoff));
AL_FUNC(ALLEGRO_DISPLAY*, al_create_display, (int w, int h));
AL_FUNC(void, al_destroy_display, (ALLEGRO_DISPLAY *display));
AL_FUNC(ALLEGRO_DISPLAY*, al_get_current_display, (void));
AL_FUNC(void, al_set_target_bitmap, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(void, al_set_target_backbuffer, (ALLEGRO_DISPLAY *display));
AL_FUNC(ALLEGRO_BITMAP*, al_get_backbuffer, (ALLEGRO_DISPLAY *display));
AL_FUNC(ALLEGRO_BITMAP*, al_get_target_bitmap, (void));
AL_FUNC(bool, al_acknowledge_resize, (ALLEGRO_DISPLAY *display));
AL_FUNC(bool, al_resize_display, (ALLEGRO_DISPLAY *display, int width, int height));
AL_FUNC(void, al_flip_display, (void));
AL_FUNC(void, al_update_display_region, (int x, int y, int width, int height));
AL_FUNC(bool, al_is_compatible_bitmap, (ALLEGRO_BITMAP *bitmap));
AL_FUNC(bool, al_wait_for_vsync, (void));
AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_display_event_source, (ALLEGRO_DISPLAY *display));
AL_FUNC(void, al_set_display_icon, (ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *icon));
AL_FUNC(void, al_set_display_icons, (ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP *icons[]));
/* Stuff for multihead/window management */
AL_FUNC(int, al_get_new_display_adapter, (void));
AL_FUNC(void, al_set_new_display_adapter, (int adapter));
AL_FUNC(void, al_set_new_window_position, (int x, int y));
AL_FUNC(void, al_get_new_window_position, (int *x, int *y));
AL_FUNC(void, al_set_window_position, (ALLEGRO_DISPLAY *display, int x, int y));
AL_FUNC(void, al_get_window_position, (ALLEGRO_DISPLAY *display, int *x, int *y));
AL_FUNC(void, al_set_window_title, (ALLEGRO_DISPLAY *display, const char *title));
/* Defined in display_settings.c */
AL_FUNC(void, al_set_new_display_option, (int option, int value, int importance));
AL_FUNC(int, al_get_new_display_option, (int option, int *importance));
AL_FUNC(void, al_reset_new_display_options, (void));
AL_FUNC(int, al_get_display_option, (ALLEGRO_DISPLAY *display, int option));
/*Deferred drawing*/
AL_FUNC(void, al_hold_bitmap_drawing, (bool hold));
AL_FUNC(bool, al_is_bitmap_drawing_held, (void));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,21 @@
#ifndef __al_included_allegro5_drawing_h
#define __al_included_allegro5_drawing_h
#include "allegro5/color.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Drawing primitives */
AL_FUNC(void, al_clear_to_color, (ALLEGRO_COLOR color));
AL_FUNC(void, al_draw_pixel, (float x, float y, ALLEGRO_COLOR color));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,39 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Error handling.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_error_h
#define __al_included_allegro5_error_h
#include "allegro5/base.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(int, al_get_errno, (void));
AL_FUNC(void, al_set_errno, (int errnum));
#ifdef __cplusplus
}
#endif
#endif
/*
* Local Variables:
* c-basic-offset: 3
* indent-tabs-mode: nil
* End:
*/

View File

@@ -0,0 +1,241 @@
#ifndef __al_included_allegro5_events_h
#define __al_included_allegro5_events_h
#include "allegro5/altime.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_EVENT_TYPE
*/
typedef unsigned int ALLEGRO_EVENT_TYPE;
enum
{
ALLEGRO_EVENT_JOYSTICK_AXIS = 1,
ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN = 2,
ALLEGRO_EVENT_JOYSTICK_BUTTON_UP = 3,
ALLEGRO_EVENT_JOYSTICK_CONFIGURATION = 4,
ALLEGRO_EVENT_KEY_DOWN = 10,
ALLEGRO_EVENT_KEY_CHAR = 11,
ALLEGRO_EVENT_KEY_UP = 12,
ALLEGRO_EVENT_MOUSE_AXES = 20,
ALLEGRO_EVENT_MOUSE_BUTTON_DOWN = 21,
ALLEGRO_EVENT_MOUSE_BUTTON_UP = 22,
ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY = 23,
ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY = 24,
ALLEGRO_EVENT_MOUSE_WARPED = 25,
ALLEGRO_EVENT_TIMER = 30,
ALLEGRO_EVENT_DISPLAY_EXPOSE = 40,
ALLEGRO_EVENT_DISPLAY_RESIZE = 41,
ALLEGRO_EVENT_DISPLAY_CLOSE = 42,
ALLEGRO_EVENT_DISPLAY_LOST = 43,
ALLEGRO_EVENT_DISPLAY_FOUND = 44,
ALLEGRO_EVENT_DISPLAY_SWITCH_IN = 45,
ALLEGRO_EVENT_DISPLAY_SWITCH_OUT = 46,
ALLEGRO_EVENT_DISPLAY_ORIENTATION = 47
};
/* Function: ALLEGRO_EVENT_TYPE_IS_USER
*
* 1 <= n < 512 - builtin events
* 512 <= n < 1024 - reserved user events (for addons)
* 1024 <= n - unreserved user events
*/
#define ALLEGRO_EVENT_TYPE_IS_USER(t) ((t) >= 512)
/* Function: ALLEGRO_GET_EVENT_TYPE
*/
#define ALLEGRO_GET_EVENT_TYPE(a, b, c, d) AL_ID(a, b, c, d)
/* Type: ALLEGRO_EVENT_SOURCE
*/
typedef struct ALLEGRO_EVENT_SOURCE ALLEGRO_EVENT_SOURCE;
struct ALLEGRO_EVENT_SOURCE
{
int __pad[32];
};
/*
* Event structures
*
* All event types have the following fields in common.
*
* type -- the type of event this is
* timestamp -- when this event was generated
* source -- which event source generated this event
*
* For people writing event sources: The common fields must be at the
* very start of each event structure, i.e. put _AL_EVENT_HEADER at the
* front.
*/
#define _AL_EVENT_HEADER(srctype) \
ALLEGRO_EVENT_TYPE type; \
srctype *source; \
double timestamp;
typedef struct ALLEGRO_ANY_EVENT
{
_AL_EVENT_HEADER(ALLEGRO_EVENT_SOURCE)
} ALLEGRO_ANY_EVENT;
typedef struct ALLEGRO_DISPLAY_EVENT
{
_AL_EVENT_HEADER(struct ALLEGRO_DISPLAY)
int x, y;
int width, height;
int orientation;
} ALLEGRO_DISPLAY_EVENT;
typedef struct ALLEGRO_JOYSTICK_EVENT
{
_AL_EVENT_HEADER(struct ALLEGRO_JOYSTICK)
struct ALLEGRO_JOYSTICK *id;
int stick;
int axis;
float pos;
int button;
} ALLEGRO_JOYSTICK_EVENT;
typedef struct ALLEGRO_KEYBOARD_EVENT
{
_AL_EVENT_HEADER(struct ALLEGRO_KEYBOARD)
struct ALLEGRO_DISPLAY *display; /* the window the key was pressed in */
int keycode; /* the physical key pressed */
int unichar; /* unicode character or negative */
unsigned int modifiers; /* bitfield */
bool repeat; /* auto-repeated or not */
} ALLEGRO_KEYBOARD_EVENT;
typedef struct ALLEGRO_MOUSE_EVENT
{
_AL_EVENT_HEADER(struct ALLEGRO_MOUSE)
struct ALLEGRO_DISPLAY *display;
/* (display) Window the event originate from
* (x, y) Primary mouse position
* (z) Mouse wheel position (1D 'wheel'), or,
* (w, z) Mouse wheel position (2D 'ball')
* (pressure) The pressure applied, for stylus (0 or 1 for normal mouse)
*/
int x, y, z, w;
int dx, dy, dz, dw;
unsigned int button;
float pressure;
} ALLEGRO_MOUSE_EVENT;
typedef struct ALLEGRO_TIMER_EVENT
{
_AL_EVENT_HEADER(struct ALLEGRO_TIMER)
int64_t count;
double error;
} ALLEGRO_TIMER_EVENT;
/* Type: ALLEGRO_USER_EVENT
*/
typedef struct ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT;
struct ALLEGRO_USER_EVENT
{
_AL_EVENT_HEADER(struct ALLEGRO_EVENT_SOURCE)
struct ALLEGRO_USER_EVENT_DESCRIPTOR *__internal__descr;
intptr_t data1;
intptr_t data2;
intptr_t data3;
intptr_t data4;
};
/* Type: ALLEGRO_EVENT
*/
typedef union ALLEGRO_EVENT ALLEGRO_EVENT;
union ALLEGRO_EVENT
{
/* This must be the same as the first field of _AL_EVENT_HEADER. */
ALLEGRO_EVENT_TYPE type;
/* `any' is to allow the user to access the other fields which are
* common to all event types, without using some specific type
* structure.
*/
ALLEGRO_ANY_EVENT any;
ALLEGRO_DISPLAY_EVENT display;
ALLEGRO_JOYSTICK_EVENT joystick;
ALLEGRO_KEYBOARD_EVENT keyboard;
ALLEGRO_MOUSE_EVENT mouse;
ALLEGRO_TIMER_EVENT timer;
ALLEGRO_USER_EVENT user;
};
/* Event sources */
AL_FUNC(void, al_init_user_event_source, (ALLEGRO_EVENT_SOURCE *));
AL_FUNC(void, al_destroy_user_event_source, (ALLEGRO_EVENT_SOURCE *));
/* The second argument is ALLEGRO_EVENT instead of ALLEGRO_USER_EVENT
* to prevent users passing a pointer to a too-short structure.
*/
AL_FUNC(bool, al_emit_user_event, (ALLEGRO_EVENT_SOURCE *, ALLEGRO_EVENT *,
void (*dtor)(ALLEGRO_USER_EVENT *)));
AL_FUNC(void, al_unref_user_event, (ALLEGRO_USER_EVENT *));
AL_FUNC(void, al_set_event_source_data, (ALLEGRO_EVENT_SOURCE*, intptr_t data));
AL_FUNC(intptr_t, al_get_event_source_data, (const ALLEGRO_EVENT_SOURCE*));
/* Event queues */
/* Type: ALLEGRO_EVENT_QUEUE
*/
typedef struct ALLEGRO_EVENT_QUEUE ALLEGRO_EVENT_QUEUE;
AL_FUNC(ALLEGRO_EVENT_QUEUE*, al_create_event_queue, (void));
AL_FUNC(void, al_destroy_event_queue, (ALLEGRO_EVENT_QUEUE*));
AL_FUNC(void, al_register_event_source, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT_SOURCE*));
AL_FUNC(void, al_unregister_event_source, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT_SOURCE*));
AL_FUNC(bool, al_is_event_queue_empty, (ALLEGRO_EVENT_QUEUE*));
AL_FUNC(bool, al_get_next_event, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT *ret_event));
AL_FUNC(bool, al_peek_next_event, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT *ret_event));
AL_FUNC(bool, al_drop_next_event, (ALLEGRO_EVENT_QUEUE*));
AL_FUNC(void, al_flush_event_queue, (ALLEGRO_EVENT_QUEUE*));
AL_FUNC(void, al_wait_for_event, (ALLEGRO_EVENT_QUEUE*,
ALLEGRO_EVENT *ret_event));
AL_FUNC(bool, al_wait_for_event_timed, (ALLEGRO_EVENT_QUEUE*,
ALLEGRO_EVENT *ret_event,
float secs));
AL_FUNC(bool, al_wait_for_event_until, (ALLEGRO_EVENT_QUEUE *queue,
ALLEGRO_EVENT *ret_event,
ALLEGRO_TIMEOUT *timeout));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,103 @@
#ifndef __al_included_allegro5_file_h
#define __al_included_allegro5_file_h
#include "allegro5/base.h"
#include "allegro5/path.h"
#include "allegro5/utf8.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_FILE
*/
typedef struct ALLEGRO_FILE ALLEGRO_FILE;
/* Type: ALLEGRO_FILE_INTERFACE
*/
typedef struct ALLEGRO_FILE_INTERFACE
{
AL_METHOD(void *, fi_fopen, (const char *path, const char *mode));
AL_METHOD(void, fi_fclose, (ALLEGRO_FILE *handle));
AL_METHOD(size_t, fi_fread, (ALLEGRO_FILE *f, void *ptr, size_t size));
AL_METHOD(size_t, fi_fwrite, (ALLEGRO_FILE *f, const void *ptr, size_t size));
AL_METHOD(bool, fi_fflush, (ALLEGRO_FILE *f));
AL_METHOD(int64_t, fi_ftell, (ALLEGRO_FILE *f));
AL_METHOD(bool, fi_fseek, (ALLEGRO_FILE *f, int64_t offset, int whence));
AL_METHOD(bool, fi_feof, (ALLEGRO_FILE *f));
AL_METHOD(bool, fi_ferror, (ALLEGRO_FILE *f));
AL_METHOD(void, fi_fclearerr, (ALLEGRO_FILE *f));
AL_METHOD(int, fi_fungetc, (ALLEGRO_FILE *f, int c));
AL_METHOD(off_t, fi_fsize, (ALLEGRO_FILE *f));
} ALLEGRO_FILE_INTERFACE;
/* Enum: ALLEGRO_SEEK
*/
typedef enum ALLEGRO_SEEK
{
ALLEGRO_SEEK_SET = 0,
ALLEGRO_SEEK_CUR,
ALLEGRO_SEEK_END
} ALLEGRO_SEEK;
/* The basic operations. */
AL_FUNC(ALLEGRO_FILE*, al_fopen, (const char *path, const char *mode));
AL_FUNC(ALLEGRO_FILE*, al_fopen_interface, (const ALLEGRO_FILE_INTERFACE *vt, const char *path, const char *mode));
AL_FUNC(ALLEGRO_FILE*, al_create_file_handle, (const ALLEGRO_FILE_INTERFACE *vt, void *userdata));
AL_FUNC(void, al_fclose, (ALLEGRO_FILE *f));
AL_FUNC(size_t, al_fread, (ALLEGRO_FILE *f, void *ptr, size_t size));
AL_FUNC(size_t, al_fwrite, (ALLEGRO_FILE *f, const void *ptr, size_t size));
AL_FUNC(bool, al_fflush, (ALLEGRO_FILE *f));
AL_FUNC(int64_t, al_ftell, (ALLEGRO_FILE *f));
AL_FUNC(bool, al_fseek, (ALLEGRO_FILE *f, int64_t offset, int whence));
AL_FUNC(bool, al_feof, (ALLEGRO_FILE *f));
AL_FUNC(bool, al_ferror, (ALLEGRO_FILE *f));
AL_FUNC(void, al_fclearerr, (ALLEGRO_FILE *f));
AL_FUNC(int, al_fungetc, (ALLEGRO_FILE *f, int c));
AL_FUNC(int64_t, al_fsize, (ALLEGRO_FILE *f));
/* Convenience functions. */
AL_FUNC(int, al_fgetc, (ALLEGRO_FILE *f));
AL_FUNC(int, al_fputc, (ALLEGRO_FILE *f, int c));
AL_FUNC(int16_t, al_fread16le, (ALLEGRO_FILE *f));
AL_FUNC(int16_t, al_fread16be, (ALLEGRO_FILE *f));
AL_FUNC(size_t, al_fwrite16le, (ALLEGRO_FILE *f, int16_t w));
AL_FUNC(size_t, al_fwrite16be, (ALLEGRO_FILE *f, int16_t w));
AL_FUNC(int32_t, al_fread32le, (ALLEGRO_FILE *f));
AL_FUNC(int32_t, al_fread32be, (ALLEGRO_FILE *f));
AL_FUNC(size_t, al_fwrite32le, (ALLEGRO_FILE *f, int32_t l));
AL_FUNC(size_t, al_fwrite32be, (ALLEGRO_FILE *f, int32_t l));
AL_FUNC(char*, al_fgets, (ALLEGRO_FILE *f, char * const p, size_t max));
AL_FUNC(ALLEGRO_USTR *, al_fget_ustr, (ALLEGRO_FILE *f));
AL_FUNC(int, al_fputs, (ALLEGRO_FILE *f, const char *p));
/* Specific to stdio backend. */
AL_FUNC(ALLEGRO_FILE*, al_fopen_fd, (int fd, const char *mode));
AL_FUNC(ALLEGRO_FILE*, al_make_temp_file, (const char *tmpl,
ALLEGRO_PATH **ret_path));
/* Specific to slices. */
AL_FUNC(ALLEGRO_FILE*, al_fopen_slice, (ALLEGRO_FILE *fp,
size_t initial_size, const char *mode));
/* Thread-local state. */
AL_FUNC(const ALLEGRO_FILE_INTERFACE *, al_get_new_file_interface, (void));
AL_FUNC(void, al_set_new_file_interface, (const ALLEGRO_FILE_INTERFACE *
file_interface));
AL_FUNC(void, al_set_standard_file_interface, (void));
/* ALLEGRO_FILE field accessors */
AL_FUNC(void *, al_get_file_userdata, (ALLEGRO_FILE *f));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,41 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fixed point type.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_fixed_h
#define __al_included_allegro5_fixed_h
#include "allegro5/base.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Type: al_fixed
*/
typedef int32_t al_fixed;
AL_VAR(const al_fixed, al_fixtorad_r);
AL_VAR(const al_fixed, al_radtofix_r);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,46 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fixed point math routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_fmaths_h
#define __al_included_allegro5_fmaths_h
#include "allegro5/base.h"
#include "allegro5/fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(al_fixed, al_fixsqrt, (al_fixed x));
AL_FUNC(al_fixed, al_fixhypot, (al_fixed x, al_fixed y));
AL_FUNC(al_fixed, al_fixatan, (al_fixed x));
AL_FUNC(al_fixed, al_fixatan2, (al_fixed y, al_fixed x));
AL_ARRAY(al_fixed, _al_fix_cos_tbl);
AL_ARRAY(al_fixed, _al_fix_tan_tbl);
AL_ARRAY(al_fixed, _al_fix_acos_tbl);
#ifdef __cplusplus
}
#endif
#include "allegro5/inline/fmaths.inl"
#endif

View File

@@ -0,0 +1,131 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* File System Hooks.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_fshook_h
#define __al_included_allegro5_fshook_h
#include "allegro5/base.h"
#include "allegro5/file.h"
#include "allegro5/path.h"
#ifdef ALLEGRO_HAVE_SYS_TYPES_H
#include <sys/types.h>
#else
/* 4 Gig max offsets if sys/types doesn't exist. */
typedef unsigned int off_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_FS_ENTRY
*/
typedef struct ALLEGRO_FS_ENTRY ALLEGRO_FS_ENTRY;
struct ALLEGRO_FS_ENTRY {
struct ALLEGRO_FS_INTERFACE const *vtable;
};
/* Enum: ALLEGRO_FILE_MODE
*/
typedef enum ALLEGRO_FILE_MODE
{
ALLEGRO_FILEMODE_READ = 1,
ALLEGRO_FILEMODE_WRITE = 1 << 1,
ALLEGRO_FILEMODE_EXECUTE = 1 << 2,
ALLEGRO_FILEMODE_HIDDEN = 1 << 3,
ALLEGRO_FILEMODE_ISFILE = 1 << 4,
ALLEGRO_FILEMODE_ISDIR = 1 << 5
} ALLEGRO_FILE_MODE;
#ifndef EOF
#define EOF (-1)
#endif
/* Type: ALLEGRO_FS_INTERFACE
*/
typedef struct ALLEGRO_FS_INTERFACE ALLEGRO_FS_INTERFACE;
struct ALLEGRO_FS_INTERFACE {
AL_METHOD(ALLEGRO_FS_ENTRY *, fs_create_entry, (const char *path));
AL_METHOD(void, fs_destroy_entry, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(const char *, fs_entry_name, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(bool, fs_update_entry, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(uint32_t, fs_entry_mode, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(time_t, fs_entry_atime, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(time_t, fs_entry_mtime, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(time_t, fs_entry_ctime, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(off_t, fs_entry_size, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(bool, fs_entry_exists, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(bool, fs_remove_entry, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(bool, fs_open_directory, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(ALLEGRO_FS_ENTRY *, fs_read_directory,(ALLEGRO_FS_ENTRY *e));
AL_METHOD(bool, fs_close_directory, (ALLEGRO_FS_ENTRY *e));
AL_METHOD(bool, fs_filename_exists, (const char *path));
AL_METHOD(bool, fs_remove_filename, (const char *path));
AL_METHOD(char *, fs_get_current_directory, (void));
AL_METHOD(bool, fs_change_directory, (const char *path));
AL_METHOD(bool, fs_make_directory, (const char *path));
AL_METHOD(ALLEGRO_FILE *, fs_open_file, (ALLEGRO_FS_ENTRY *e,
const char *mode));
};
AL_FUNC(ALLEGRO_FS_ENTRY *, al_create_fs_entry, (const char *path));
AL_FUNC(void, al_destroy_fs_entry, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(const char *, al_get_fs_entry_name,(ALLEGRO_FS_ENTRY *e));
AL_FUNC(bool, al_update_fs_entry, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(uint32_t, al_get_fs_entry_mode,(ALLEGRO_FS_ENTRY *e));
AL_FUNC(time_t, al_get_fs_entry_atime,(ALLEGRO_FS_ENTRY *e));
AL_FUNC(time_t, al_get_fs_entry_mtime,(ALLEGRO_FS_ENTRY *e));
AL_FUNC(time_t, al_get_fs_entry_ctime,(ALLEGRO_FS_ENTRY *e));
AL_FUNC(off_t, al_get_fs_entry_size,(ALLEGRO_FS_ENTRY *e));
AL_FUNC(bool, al_fs_entry_exists, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(bool, al_remove_fs_entry, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(bool, al_open_directory, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(ALLEGRO_FS_ENTRY *, al_read_directory, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(bool, al_close_directory, (ALLEGRO_FS_ENTRY *e));
AL_FUNC(bool, al_filename_exists, (const char *path));
AL_FUNC(bool, al_remove_filename, (const char *path));
AL_FUNC(char *, al_get_current_directory, (void));
AL_FUNC(bool, al_change_directory, (const char *path));
AL_FUNC(bool, al_make_directory, (const char *path));
AL_FUNC(ALLEGRO_FILE *, al_open_fs_entry, (ALLEGRO_FS_ENTRY *e,
const char *mode));
/* Thread-local state. */
AL_FUNC(const ALLEGRO_FS_INTERFACE *, al_get_fs_interface, (void));
AL_FUNC(void, al_set_fs_interface, (const ALLEGRO_FS_INTERFACE *vtable));
AL_FUNC(void, al_set_standard_fs_interface, (void));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,31 @@
#ifndef __al_included_allegro5_fullscreen_mode_h
#define __al_included_allegro5_fullscreen_mode_h
#ifdef __cplusplus
extern "C" {
#endif
/* Type: ALLEGRO_DISPLAY_MODE
*/
typedef struct ALLEGRO_DISPLAY_MODE
{
int width;
int height;
int format;
int refresh_rate;
} ALLEGRO_DISPLAY_MODE;
AL_FUNC(int, al_get_num_display_modes, (void));
AL_FUNC(ALLEGRO_DISPLAY_MODE*, al_get_display_mode, (int index,
ALLEGRO_DISPLAY_MODE *mode));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,254 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fixed point math inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_inline_fmaths_inl
#define __al_included_allegro5_inline_fmaths_inl
#include "allegro5/error.h"
#ifdef __cplusplus
extern "C" {
#endif
/* al_ftofix and al_fixtof are used in generic C versions of al_fixmul and al_fixdiv */
AL_INLINE(al_fixed, al_ftofix, (double x),
{
if (x > 32767.0) {
al_set_errno(ERANGE);
return 0x7FFFFFFF;
}
if (x < -32767.0) {
al_set_errno(ERANGE);
return -0x7FFFFFFF;
}
return (al_fixed)(x * 65536.0 + (x < 0 ? -0.5 : 0.5));
})
AL_INLINE(double, al_fixtof, (al_fixed x),
{
return (double)x / 65536.0;
})
AL_INLINE(al_fixed, al_fixadd, (al_fixed x, al_fixed y),
{
al_fixed result = x + y;
if (result >= 0) {
if ((x < 0) && (y < 0)) {
al_set_errno(ERANGE);
return -0x7FFFFFFF;
}
else
return result;
}
else {
if ((x > 0) && (y > 0)) {
al_set_errno(ERANGE);
return 0x7FFFFFFF;
}
else
return result;
}
})
AL_INLINE(al_fixed, al_fixsub, (al_fixed x, al_fixed y),
{
al_fixed result = x - y;
if (result >= 0) {
if ((x < 0) && (y > 0)) {
al_set_errno(ERANGE);
return -0x7FFFFFFF;
}
else
return result;
}
else {
if ((x > 0) && (y < 0)) {
al_set_errno(ERANGE);
return 0x7FFFFFFF;
}
else
return result;
}
})
/* In benchmarks conducted circa May 2005 we found that, in the main:
* - IA32 machines performed faster with one implementation;
* - AMD64 and G4 machines performed faster with another implementation.
*
* Benchmarks were mainly done with differing versions of gcc.
* Results varied with other compilers, optimisation levels, etc.
* so this is not optimal, though a tenable compromise.
*
* Note that the following implementation are NOT what were benchmarked.
* We had forgotten to put in overflow detection in those versions.
* If you don't need overflow detection then previous versions in the
* CVS tree might be worth looking at.
*
* PS. Don't move the #ifs inside the AL_INLINE; BCC doesn't like it.
*/
#if (defined ALLEGRO_I386) || (!defined LONG_LONG)
AL_INLINE(al_fixed, al_fixmul, (al_fixed x, al_fixed y),
{
return al_ftofix(al_fixtof(x) * al_fixtof(y));
})
#else
AL_INLINE(al_fixed, al_fixmul, (al_fixed x, al_fixed y),
{
LONG_LONG lx = x;
LONG_LONG ly = y;
LONG_LONG lres = (lx*ly);
if (lres > 0x7FFFFFFF0000LL) {
al_set_errno(ERANGE);
return 0x7FFFFFFF;
}
else if (lres < -0x7FFFFFFF0000LL) {
al_set_errno(ERANGE);
return 0x80000000;
}
else {
int res = lres >> 16;
return res;
}
})
#endif /* al_fixmul() C implementations */
#if (defined ALLEGRO_CFG_NO_FPU) && (defined LONG_LONG)
AL_INLINE(al_fixed, al_fixdiv, (al_fixed x, al_fixed y),
{
LONG_LONG lres = x;
if (y == 0) {
al_set_errno(ERANGE);
return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
}
lres <<= 16;
lres /= y;
if (lres > 0x7FFFFFFF) {
al_set_errno(ERANGE);
return 0x7FFFFFFF;
}
else if (lres < -0x7FFFFFFF) {
al_set_errno(ERANGE);
return 0x80000000;
}
else {
return (al_fixed)(lres);
}
})
#else
AL_INLINE(al_fixed, al_fixdiv, (al_fixed x, al_fixed y),
{
if (y == 0) {
al_set_errno(ERANGE);
return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
}
else
return al_ftofix(al_fixtof(x) / al_fixtof(y));
})
#endif
AL_INLINE(int, al_fixfloor, (al_fixed x),
{
/* (x >> 16) is not portable */
if (x >= 0)
return (x >> 16);
else
return ~((~x) >> 16);
})
AL_INLINE(int, al_fixceil, (al_fixed x),
{
if (x > 0x7FFF0000) {
al_set_errno(ERANGE);
return 0x7FFF;
}
return al_fixfloor(x + 0xFFFF);
})
AL_INLINE(al_fixed, al_itofix, (int x),
{
return x << 16;
})
AL_INLINE(int, al_fixtoi, (al_fixed x),
{
return al_fixfloor(x) + ((x & 0x8000) >> 15);
})
AL_INLINE(al_fixed, al_fixcos, (al_fixed x),
{
return _al_fix_cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
})
AL_INLINE(al_fixed, al_fixsin, (al_fixed x),
{
return _al_fix_cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
})
AL_INLINE(al_fixed, al_fixtan, (al_fixed x),
{
return _al_fix_tan_tbl[((x + 0x4000) >> 15) & 0xFF];
})
AL_INLINE(al_fixed, al_fixacos, (al_fixed x),
{
if ((x < -65536) || (x > 65536)) {
al_set_errno(EDOM);
return 0;
}
return _al_fix_acos_tbl[(x+65536+127)>>8];
})
AL_INLINE(al_fixed, al_fixasin, (al_fixed x),
{
if ((x < -65536) || (x > 65536)) {
al_set_errno(EDOM);
return 0;
}
return 0x00400000 - _al_fix_acos_tbl[(x+65536+127)>>8];
})
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,53 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Some definitions for internal use by the library code.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_aintern_h
#define __al_included_allegro5_aintern_h
#ifndef __al_included_allegro5_allegro_h
#error must include allegro5/allegro.h first
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define _ALLEGRO_MIN(x,y) (((x) < (y)) ? (x) : (y))
#define _ALLEGRO_MAX(x,y) (((x) > (y)) ? (x) : (y))
#define _ALLEGRO_CLAMP(x,y,z) _ALLEGRO_MAX((x), _ALLEGRO_MIN((y), (z)))
/* message stuff */
#define ALLEGRO_MESSAGE_SIZE 4096
/* various libc stuff */
AL_FUNC(void *, _al_sane_realloc, (void *ptr, size_t size));
AL_FUNC(char *, _al_sane_strncpy, (char *dest, const char *src, size_t n));
#define _AL_RAND_MAX 0xFFFF
AL_FUNC(void, _al_srand, (int seed));
AL_FUNC(int, _al_rand, (void));
AL_FUNC(int, _al_stricmp, (const char *s1, const char *s2));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,24 @@
#ifndef __al_included_allegro5_aintern_aatree_h
#define __al_included_allegro5_aintern_aatree_h
typedef struct _AL_AATREE _AL_AATREE;
struct _AL_AATREE
{
int level;
_AL_AATREE *left;
_AL_AATREE *right;
const void *key;
void *value;
};
typedef int (*_al_cmp_t)(const void *a, const void *b);
_AL_AATREE *_al_aa_insert(_AL_AATREE *T, const void *key, void *value, _al_cmp_t compare);
void *_al_aa_search(const _AL_AATREE *T, const void *key, _al_cmp_t compare);
_AL_AATREE *_al_aa_delete(_AL_AATREE *T, const void *key, _al_cmp_t compare, void **ret_value);
void _al_aa_free(_AL_AATREE *T);
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,9 @@
#define ALLEGRO_CFG_ACODEC_FLAC
#define ALLEGRO_CFG_ACODEC_MODAUDIO
#define ALLEGRO_CFG_ACODEC_VORBIS
/* #undef ALLEGRO_CFG_ACODEC_TREMOR */
/* Define if the library should be loaded dynamically. */
/* #undef ALLEGRO_CFG_ACODEC_FLAC_DLL */
/* #undef ALLEGRO_CFG_ACODEC_DUMB_DLL */
/* #undef ALLEGRO_CFG_ACODEC_VORBISFILE_DLL */

View File

@@ -0,0 +1,120 @@
#ifndef __al_included_allegro5_aintern_atomicops_h
#define __al_included_allegro5_aintern_atomicops_h
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
/* gcc 4.1 and above have builtin atomic operations. */
typedef int _AL_ATOMIC;
AL_INLINE(_AL_ATOMIC,
_al_fetch_and_add1, (volatile _AL_ATOMIC *ptr),
{
return __sync_fetch_and_add(ptr, 1);
})
AL_INLINE(_AL_ATOMIC,
_al_sub1_and_fetch, (volatile _AL_ATOMIC *ptr),
{
return __sync_sub_and_fetch(ptr, 1);
})
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
/* gcc, x86 or x86-64 */
typedef int _AL_ATOMIC;
#define __al_fetch_and_add(ptr, value, result) \
__asm__ __volatile__ ( \
"lock; xaddl %0, %1" \
: "=r" (result), "=m" (*ptr) \
: "0" (value), "m" (*ptr) \
: "memory" \
)
AL_INLINE(_AL_ATOMIC,
_al_fetch_and_add1, (volatile _AL_ATOMIC *ptr),
{
_AL_ATOMIC result;
__al_fetch_and_add(ptr, 1, result);
return result;
})
AL_INLINE(_AL_ATOMIC,
_al_sub1_and_fetch, (volatile _AL_ATOMIC *ptr),
{
_AL_ATOMIC old;
__al_fetch_and_add(ptr, -1, old);
return old - 1;
})
#elif defined(_MSC_VER) && _M_IX86 >= 400
/* MSVC, x86 */
/* MinGW supports these too, but we already have asm code above. */
typedef LONG _AL_ATOMIC;
AL_INLINE(_AL_ATOMIC,
_al_fetch_and_add1, (volatile _AL_ATOMIC *ptr),
{
return InterlockedIncrement(ptr) - 1;
})
AL_INLINE(_AL_ATOMIC,
_al_sub1_and_fetch, (volatile _AL_ATOMIC *ptr),
{
return InterlockedDecrement(ptr);
})
#elif defined(ALLEGRO_HAVE_OSATOMIC_H)
/* OS X, GCC < 4.1
* These functions only work on Tiger (10.4) and above.
* FIXME: Apple's manpage says these functions take volatile int*
* arguments, but at least the 10.4 SDK seems to prototype them as
* taking int * - should the volatile qualifier be removed from the
* wrapper functions in this case? (EG)
*/
#include <libkern/OSAtomic.h>
typedef int32_t _AL_ATOMIC;
AL_INLINE(_AL_ATOMIC,
_al_fetch_and_add1, (volatile _AL_ATOMIC *ptr),
{
return OSAtomicIncrement32Barrier((_AL_ATOMIC *)ptr) - 1;
})
AL_INLINE(_AL_ATOMIC,
_al_sub1_and_fetch, (volatile _AL_ATOMIC *ptr),
{
return OSAtomicDecrement32Barrier((_AL_ATOMIC *)ptr);
})
#else
/* Hope for the best? */
#warning Atomic operations undefined for your compiler/architecture.
typedef int _AL_ATOMIC;
AL_INLINE(_AL_ATOMIC,
_al_fetch_and_add1, (volatile _AL_ATOMIC *ptr),
{
return (*ptr)++;
})
AL_INLINE(_AL_ATOMIC,
_al_sub1_and_fetch, (volatile _AL_ATOMIC *ptr),
{
return --(*ptr);
})
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,327 @@
/* internal-only header
* Updated for 4.9 api inclusion by Ryan Dickie
* Originally done by KC/Milan
*/
#ifndef AINTERN_AUDIO_H
#define AINTERN_AUDIO_H
#include "allegro5/allegro.h"
#include "allegro5/internal/aintern_vector.h"
#include "../allegro_audio.h"
typedef enum ALLEGRO_AUDIO_DRIVER_ENUM
{
/* Various driver modes. */
ALLEGRO_AUDIO_DRIVER_AUTODETECT = 0x20000,
ALLEGRO_AUDIO_DRIVER_OPENAL = 0x20001,
ALLEGRO_AUDIO_DRIVER_ALSA = 0x20002,
ALLEGRO_AUDIO_DRIVER_DSOUND = 0x20003,
ALLEGRO_AUDIO_DRIVER_OSS = 0x20004,
ALLEGRO_AUDIO_DRIVER_AQUEUE = 0x20005,
ALLEGRO_AUDIO_DRIVER_PULSEAUDIO = 0x20006
} ALLEGRO_AUDIO_DRIVER_ENUM;
typedef struct ALLEGRO_AUDIO_DRIVER ALLEGRO_AUDIO_DRIVER;
struct ALLEGRO_AUDIO_DRIVER {
const char *specifier;
int (*open)(void);
void (*close)(void);
int (*allocate_voice)(ALLEGRO_VOICE*);
void (*deallocate_voice)(ALLEGRO_VOICE*);
int (*load_voice)(ALLEGRO_VOICE*, const void*);
void (*unload_voice)(ALLEGRO_VOICE*);
int (*start_voice)(ALLEGRO_VOICE*);
int (*stop_voice)(ALLEGRO_VOICE*);
bool (*voice_is_playing)(const ALLEGRO_VOICE*);
unsigned int (*get_voice_position)(const ALLEGRO_VOICE*);
int (*set_voice_position)(ALLEGRO_VOICE*, unsigned int);
};
extern ALLEGRO_AUDIO_DRIVER *_al_kcm_driver;
const void *_al_voice_update(ALLEGRO_VOICE *voice, unsigned int *samples);
bool _al_kcm_set_voice_playing(ALLEGRO_VOICE *voice, bool val);
/* A voice structure that you'd attach a mixer or sample to. Ideally there
* would be one ALLEGRO_VOICE per system/hardware voice.
*/
struct ALLEGRO_VOICE {
ALLEGRO_AUDIO_DEPTH depth;
ALLEGRO_CHANNEL_CONF chan_conf;
unsigned int frequency;
size_t buffer_size;
size_t num_buffers;
/* If non-0, they must be honored by the driver. */
ALLEGRO_SAMPLE_INSTANCE *attached_stream;
/* The stream that is attached to the voice, or NULL.
* May be an ALLEGRO_SAMPLE_INSTANCE or ALLEGRO_MIXER object.
*/
bool is_streaming;
/* True for voices with an attached mixer. */
ALLEGRO_MUTEX *mutex;
ALLEGRO_COND *cond;
ALLEGRO_AUDIO_DRIVER *driver;
/* XXX shouldn't there only be one audio driver active
* at a time?
*/
void *extra;
/* Extra data for use by the driver. */
};
typedef union {
float *f32;
uint32_t *u24;
int32_t *s24;
uint16_t *u16;
int16_t *s16;
uint8_t *u8;
int8_t *s8;
void *ptr;
} any_buffer_t;
struct ALLEGRO_SAMPLE {
ALLEGRO_AUDIO_DEPTH depth;
ALLEGRO_CHANNEL_CONF chan_conf;
unsigned int frequency;
int len;
any_buffer_t buffer;
bool free_buf;
/* Whether `buffer' needs to be freed when the sample
* is destroyed, or when `buffer' changes.
*/
};
/* Read some samples into a mixer buffer.
*
* source:
* The object to read samples from. This may be one of several types.
*
* *vbuf: (in-out parameter)
* Pointer to pointer to destination buffer.
* (should confirm what it means to change the pointer on return)
*
* *samples: (in-out parameter)
* On input indicates the maximum number of samples that can fit into *vbuf.
* On output indicates the actual number of samples that were read.
*
* buffer_depth:
* The audio depth of the destination buffer.
*
* dest_maxc:
* The number of channels in the destination.
*/
typedef void (*stream_reader_t)(void *source, void **vbuf,
unsigned int *samples, ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc);
typedef struct {
union {
ALLEGRO_MIXER *mixer;
ALLEGRO_VOICE *voice;
void *ptr;
} u;
bool is_voice;
} sample_parent_t;
/* The sample struct also serves the base of ALLEGRO_AUDIO_STREAM, ALLEGRO_MIXER. */
struct ALLEGRO_SAMPLE_INSTANCE {
/* ALLEGRO_SAMPLE_INSTANCE does not generate any events yet but ALLEGRO_AUDIO_STREAM
* does, which can inherit only ALLEGRO_SAMPLE_INSTANCE. */
ALLEGRO_EVENT_SOURCE es;
ALLEGRO_SAMPLE spl_data;
volatile bool is_playing;
/* Is this sample is playing? */
ALLEGRO_PLAYMODE loop;
float speed;
float gain;
float pan;
/* When resampling an audio stream there will be fractional sample
* positions due to the difference in frequencies.
*/
int pos;
int pos_bresenham_error;
int loop_start;
int loop_end;
int step;
int step_denom;
/* The numerator and denominator of the step are
* stored separately. The actual step is obtained by
* dividing step by step_denom */
float *matrix;
/* Used to convert from this format to the attached
* mixers, if any. Otherwise is NULL.
* The gain is premultiplied in.
*/
bool is_mixer;
stream_reader_t spl_read;
/* Reads sample data into the provided buffer, using
* the specified format, converting as necessary.
*/
ALLEGRO_MUTEX *mutex;
/* Points to the parent object's mutex. It is NULL if
* the sample is not directly or indirectly attached
* to a voice.
*/
sample_parent_t parent;
/* The object that this sample is attached to, if any.
*/
};
void _al_kcm_destroy_sample(ALLEGRO_SAMPLE_INSTANCE *sample, bool unregister);
void _al_kcm_stream_set_mutex(ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MUTEX *mutex);
void _al_kcm_detach_from_parent(ALLEGRO_SAMPLE_INSTANCE *spl);
typedef size_t (*stream_callback_t)(ALLEGRO_AUDIO_STREAM *, void *, size_t);
typedef void (*unload_feeder_t)(ALLEGRO_AUDIO_STREAM *);
typedef bool (*rewind_feeder_t)(ALLEGRO_AUDIO_STREAM *);
typedef bool (*seek_feeder_t)(ALLEGRO_AUDIO_STREAM *, double);
typedef double (*get_feeder_position_t)(ALLEGRO_AUDIO_STREAM *);
typedef double (*get_feeder_length_t)(ALLEGRO_AUDIO_STREAM *);
typedef bool (*set_feeder_loop_t)(ALLEGRO_AUDIO_STREAM *, double, double);
struct ALLEGRO_AUDIO_STREAM {
ALLEGRO_SAMPLE_INSTANCE spl;
/* ALLEGRO_AUDIO_STREAM is derived from
* ALLEGRO_SAMPLE_INSTANCE.
*/
unsigned int buf_count;
/* The stream buffer is divided into a number of
* fragments; this is the number of fragments.
*/
void *main_buffer;
/* Pointer to a single buffer big enough to hold all
* the fragments. Each fragment has additional samples
* at the start for linear/cubic interpolation.
*/
void **pending_bufs;
void **used_bufs;
/* Arrays of offsets into the main_buffer.
* The arrays are each 'buf_count' long.
*
* 'pending_bufs' holds pointers to fragments supplied
* by the user which are yet to be handed off to the
* audio driver.
*
* 'used_bufs' holds pointers to fragments which
* have been sent to the audio driver and so are
* ready to receive new data.
*/
volatile bool is_draining;
/* Set to true if sample data is not going to be passed
* to the stream any more. The stream must change its
* playing state to false after all buffers have been
* played.
*/
ALLEGRO_THREAD *feed_thread;
volatile bool quit_feed_thread;
unload_feeder_t unload_feeder;
rewind_feeder_t rewind_feeder;
seek_feeder_t seek_feeder;
get_feeder_position_t get_feeder_position;
get_feeder_length_t get_feeder_length;
set_feeder_loop_t set_feeder_loop;
stream_callback_t feeder;
/* If ALLEGRO_AUDIO_STREAM has been created by
* al_load_audio_stream(), the stream will be fed
* by a thread using the 'feeder' callback. Such
* streams don't need to be fed by the user.
*/
void *extra;
/* Extra data for use by the flac/vorbis addons. */
};
bool _al_kcm_refill_stream(ALLEGRO_AUDIO_STREAM *stream);
typedef void (*postprocess_callback_t)(void *buf, unsigned int samples,
void *userdata);
/* ALLEGRO_MIXER is derived from ALLEGRO_SAMPLE_INSTANCE. Certain internal functions and
* pointers may take either object type, and such things are explicitly noted.
* This is never exposed to the user, though. The sample object's read method
* will be set to a different function that will call the read method of all
* attached streams (which may be a sample, or another mixer).
*/
struct ALLEGRO_MIXER {
ALLEGRO_SAMPLE_INSTANCE ss;
/* ALLEGRO_MIXER is derived from ALLEGRO_SAMPLE_INSTANCE. */
ALLEGRO_MIXER_QUALITY quality;
postprocess_callback_t postprocess_callback;
void *pp_callback_userdata;
_AL_VECTOR streams;
/* Vector of ALLEGRO_SAMPLE_INSTANCE*. Holds the list of
* streams being mixed together.
*/
};
extern void _al_kcm_mixer_rejig_sample_matrix(ALLEGRO_MIXER *mixer,
ALLEGRO_SAMPLE_INSTANCE *spl);
extern void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples,
ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc);
typedef enum {
ALLEGRO_NO_ERROR = 0,
ALLEGRO_INVALID_PARAM = 1,
ALLEGRO_INVALID_OBJECT = 2,
ALLEGRO_GENERIC_ERROR = 255
} AL_ERROR_ENUM;
extern void _al_set_error(int error, char* string);
/* Supposedly internal */
ALLEGRO_KCM_AUDIO_FUNC(int, _al_kcm_get_silence, (ALLEGRO_AUDIO_DEPTH depth));
ALLEGRO_KCM_AUDIO_FUNC(void*, _al_kcm_feed_stream, (ALLEGRO_THREAD *self, void *vstream));
/* Helper to emit an event that the stream has got a buffer ready to be refilled. */
void _al_kcm_emit_stream_events(ALLEGRO_AUDIO_STREAM *stream);
void _al_kcm_init_destructors(void);
void _al_kcm_shutdown_destructors(void);
void _al_kcm_register_destructor(void *object, void (*func)(void*));
void _al_kcm_unregister_destructor(void *object);
void _al_kcm_foreach_destructor(
void (*callback)(void *object, void (*func)(void *), void *udata),
void *userdata);
ALLEGRO_KCM_AUDIO_FUNC(void, _al_kcm_shutdown_default_mixer, (void));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, _al_count_to_channel_conf, (int num_channels));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, _al_word_size_to_depth_conf, (int word_size));
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,6 @@
/* #undef ALLEGRO_CFG_KCM_ALSA */
#define ALLEGRO_CFG_KCM_OPENAL
#define ALLEGRO_CFG_KCM_DSOUND
/* #undef ALLEGRO_CFG_KCM_OSS */
/* #undef ALLEGRO_CFG_KCM_PULSEAUDIO */
/* #undef ALLEGRO_CFG_KCM_AQUEUE */

View File

@@ -0,0 +1,141 @@
#ifndef __al_included_allegro5_aintern_bitmap_h
#define __al_included_allegro5_aintern_bitmap_h
#include "allegro5/bitmap.h"
#include "allegro5/bitmap_lock.h"
#include "allegro5/display.h"
#include "allegro5/transformations.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALLEGRO_BITMAP_INTERFACE ALLEGRO_BITMAP_INTERFACE;
struct ALLEGRO_BITMAP
{
ALLEGRO_BITMAP_INTERFACE *vt;
ALLEGRO_DISPLAY *display;
int format;
int flags;
int w, h;
/*
* The number of bytes between a pixel at (x,y) and (x,y+1).
* This is larger than w * pixel_size if there is padding between lines.
*/
int pitch;
/*
* clip left, right, top, bottom
* Clip anything outside of this. cr/cb are exclusive, that is (0, 0, 1, 1)
* is the single pixel spawning a rectangle from floating point 0/0 to 1/1 -
* or in other words, the single pixel 0/0.
*
* There is always confusion as to whether cr/cb are exclusive, leading to
* subtle bugs. The suffixes are supposed to help with that.
*/
int cl;
int cr_excl;
int ct;
int cb_excl;
/*
* Locking info.
*
* locked - locked or not?
* lock_x/y - top left of the locked region
* lock_w/h - width and height of the locked region
* lock_flags - flags the region was locked with
* locked_region - a copy of the locked rectangle
*/
bool locked;
int lock_x;
int lock_y;
int lock_w;
int lock_h;
int lock_flags;
ALLEGRO_LOCKED_REGION locked_region;
/* Transformation for this bitmap */
ALLEGRO_TRANSFORM transform;
/* Info for sub-bitmaps */
ALLEGRO_BITMAP *parent;
int xofs;
int yofs;
/* A memory copy of the bitmap data. May be NULL for an empty bitmap. */
unsigned char *memory;
/* Size of the bitmap object. Used only by functions to convert bitmap
storage type. Can be missleading. */
size_t size;
bool preserve_texture;
};
struct ALLEGRO_BITMAP_INTERFACE
{
int id;
void (*draw_bitmap_region)(ALLEGRO_BITMAP *bitmap,
ALLEGRO_COLOR tint,float sx, float sy,
float sw, float sh, int flags);
/* After the memory-copy of the bitmap has been modified, need to call this
* to update the display-specific copy. E.g. with an OpenGL driver, this
* might create/update a texture. Returns false on failure.
*/
bool (*upload_bitmap)(ALLEGRO_BITMAP *bitmap);
/* If the display version of the bitmap has been modified, use this to update
* the memory copy accordingly. E.g. with an OpenGL driver, this might
* read the contents of an associated texture.
*/
void (*update_clipping_rectangle)(ALLEGRO_BITMAP *bitmap);
void (*destroy_bitmap)(ALLEGRO_BITMAP *bitmap);
ALLEGRO_LOCKED_REGION * (*lock_region)(ALLEGRO_BITMAP *bitmap,
int x, int y, int w, int h, int format,
int flags);
void (*unlock_region)(ALLEGRO_BITMAP *bitmap);
};
extern void (*_al_convert_funcs[ALLEGRO_NUM_PIXEL_FORMATS]
[ALLEGRO_NUM_PIXEL_FORMATS])(void *, int, void *, int,
int, int, int, int, int, int);
/* Bitmap conversion */
void _al_convert_bitmap_data(
void *src, int src_format, int src_pitch,
void *dst, int dst_format, int dst_pitch,
int sx, int sy, int dx, int dy,
int width, int height);
void _al_convert_to_memory_bitmap(ALLEGRO_BITMAP *bitmap);
void _al_convert_to_display_bitmap(ALLEGRO_BITMAP *bitmap);
#ifdef ALLEGRO_GP2XWIZ
/* Optimized blitters */
void _al_draw_bitmap_region_optimized_rgba_4444_to_rgb_565(
ALLEGRO_BITMAP *src, int sx, int sy, int sw, int sh,
ALLEGRO_BITMAP *dest, int dx, int dy, int flags);
void _al_draw_bitmap_region_optimized_rgb_565_to_rgb_565(
ALLEGRO_BITMAP *src, int sx, int sy, int sw, int sh,
ALLEGRO_BITMAP *dest, int dx, int dy, int flags);
void _al_draw_bitmap_region_optimized_rgba_4444_to_rgba_4444(
ALLEGRO_BITMAP *src, int sx, int sy, int sw, int sh,
ALLEGRO_BITMAP *dest, int dx, int dy, int flags);
#endif
/* Simple bitmap drawing */
/* _al_put_pixel was inadvertently exported in 5.0.x releases. */
AL_FUNC(void, _al_put_pixel, (ALLEGRO_BITMAP *bitmap, int x, int y, ALLEGRO_COLOR color));
/* Bitmap I/O */
void _al_init_iio_table(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,244 @@
#ifndef __al_included_allegro5_aintern_blend_h
#define __al_included_allegro5_aintern_blend_h
#include "allegro5/internal/aintern.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUC__
#define _AL_ALWAYS_INLINE inline __attribute__((always_inline))
#else
#define _AL_ALWAYS_INLINE INLINE
#endif
#define _AL_DEST_IS_ZERO \
(dst_mode == ALLEGRO_ZERO && dst_alpha == ALLEGRO_ZERO && \
op != ALLEGRO_DEST_MINUS_SRC && op_alpha != ALLEGRO_DEST_MINUS_SRC)
#define _AL_SRC_NOT_MODIFIED \
(src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE)
#define _AL_SRC_NOT_MODIFIED_TINT_WHITE \
(_AL_SRC_NOT_MODIFIED && \
tint.r == 1.0f && tint.g == 1.0f && tint.b == 1.0f && tint.a == 1.0f)
#ifndef _AL_NO_BLEND_INLINE_FUNC
/* Only cares about alpha blending modes. */
static _AL_ALWAYS_INLINE float
get_alpha_factor(enum ALLEGRO_BLEND_MODE operation, float src_alpha, float dst_alpha)
{
switch (operation) {
case ALLEGRO_ZERO: return 0;
case ALLEGRO_ONE: return 1;
case ALLEGRO_ALPHA: return src_alpha;
case ALLEGRO_INVERSE_ALPHA: return 1 - src_alpha;
case ALLEGRO_SRC_COLOR: return src_alpha;
case ALLEGRO_DEST_COLOR: return dst_alpha;
case ALLEGRO_INVERSE_SRC_COLOR: return 1 - src_alpha;
case ALLEGRO_INVERSE_DEST_COLOR: return 1 - dst_alpha;
default:
ASSERT(false);
return 0; /* silence warning in release build */
}
}
/* Puts the blending factor in an ALLEGRO_COLOR object. */
static _AL_ALWAYS_INLINE void get_factor(enum ALLEGRO_BLEND_MODE operation,
const ALLEGRO_COLOR *source, const ALLEGRO_COLOR *dest,
ALLEGRO_COLOR *factor)
{
switch (operation) {
case ALLEGRO_ZERO:
factor->r = factor->g = factor->b = factor->a = 0;
break;
case ALLEGRO_ONE:
factor->r = factor->g = factor->b = factor->a = 1;
break;
case ALLEGRO_ALPHA:
factor->r = factor->g = factor->b = factor->a = source->a;
break;
case ALLEGRO_INVERSE_ALPHA:
factor->r = factor->g = factor->b = factor->a = 1 - source->a;
break;
case ALLEGRO_SRC_COLOR:
*factor = *source;
break;
case ALLEGRO_DEST_COLOR:
*factor = *dest;
break;
case ALLEGRO_INVERSE_SRC_COLOR:
factor->r = 1 - source->r;
factor->g = 1 - source->g;
factor->b = 1 - source->b;
factor->a = 1 - source->a;
break;
case ALLEGRO_INVERSE_DEST_COLOR:
factor->r = 1 - dest->r;
factor->g = 1 - dest->g;
factor->b = 1 - dest->b;
factor->a = 1 - dest->a;
break;
default:
ASSERT(false);
factor->r = factor->g = factor->b = factor->a = 0;
break;
}
}
/* Only call this if the blend modes are one of:
* ALLEGRO_ONE, ALLEGRO_ZERO, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA
*/
static _AL_ALWAYS_INLINE
void _al_blend_alpha_inline(
const ALLEGRO_COLOR *scol, const ALLEGRO_COLOR *dcol,
int op, int src_, int dst_, int aop, int asrc_, int adst_,
ALLEGRO_COLOR *result)
{
float asrc, adst;
float src, dst;
result->r = scol->r;
result->g = scol->g;
result->b = scol->b;
result->a = scol->a;
asrc = get_alpha_factor(asrc_, scol->a, dcol->a);
adst = get_alpha_factor(adst_, scol->a, dcol->a);
src = get_alpha_factor(src_, scol->a, dcol->a);
dst = get_alpha_factor(dst_, scol->a, dcol->a);
#define BLEND(c, src, dst) \
result->c = OP(result->c * src, dcol->c * dst);
switch (op) {
case ALLEGRO_ADD:
#define OP(x, y) _ALLEGRO_MIN(1, x + y)
BLEND(r, src, dst)
BLEND(g, src, dst)
BLEND(b, src, dst)
#undef OP
break;
case ALLEGRO_SRC_MINUS_DEST:
#define OP(x, y) _ALLEGRO_MAX(0, x - y)
BLEND(r, src, dst)
BLEND(g, src, dst)
BLEND(b, src, dst)
#undef OP
break;
case ALLEGRO_DEST_MINUS_SRC:
#define OP(x, y) _ALLEGRO_MAX(0, y - x)
BLEND(r, src, dst)
BLEND(g, src, dst)
BLEND(b, src, dst)
#undef OP
break;
}
switch (aop) {
case ALLEGRO_ADD:
#define OP(x, y) _ALLEGRO_MIN(1, x + y)
BLEND(a, asrc, adst)
#undef OP
break;
case ALLEGRO_SRC_MINUS_DEST:
#define OP(x, y) _ALLEGRO_MAX(0, x - y)
BLEND(a, asrc, adst)
#undef OP
break;
case ALLEGRO_DEST_MINUS_SRC:
#define OP(x, y) _ALLEGRO_MAX(0, y - x)
BLEND(a, asrc, adst)
#undef OP
break;
}
#undef BLEND
}
/* call this for general blending. its a little slower than just using alpha */
static _AL_ALWAYS_INLINE
void _al_blend_inline(
const ALLEGRO_COLOR *scol, const ALLEGRO_COLOR *dcol,
int op, int src_, int dst_, int aop, int asrc_, int adst_,
ALLEGRO_COLOR *result)
{
float asrc, adst;
ALLEGRO_COLOR src, dst;
result->r = scol->r;
result->g = scol->g;
result->b = scol->b;
result->a = scol->a;
asrc = get_alpha_factor(asrc_, scol->a, dcol->a);
adst = get_alpha_factor(adst_, scol->a, dcol->a);
get_factor(src_, scol, dcol, &src);
get_factor(dst_, scol, dcol, &dst);
#define BLEND(c, src, dst) \
result->c = OP(result->c * src.c, dcol->c * dst.c);
switch (op) {
case ALLEGRO_ADD:
#define OP(x, y) _ALLEGRO_MIN(1, x + y)
BLEND(r, src, dst)
BLEND(g, src, dst)
BLEND(b, src, dst)
#undef OP
break;
case ALLEGRO_SRC_MINUS_DEST:
#define OP(x, y) _ALLEGRO_MAX(0, x - y)
BLEND(r, src, dst)
BLEND(g, src, dst)
BLEND(b, src, dst)
#undef OP
break;
case ALLEGRO_DEST_MINUS_SRC:
#define OP(x, y) _ALLEGRO_MAX(0, y - x)
BLEND(r, src, dst)
BLEND(g, src, dst)
BLEND(b, src, dst)
#undef OP
break;
}
#undef BLEND
#define BLEND(c, src, dst) \
result->c = OP(result->c * src, dcol->c * dst);
switch (aop) {
case ALLEGRO_ADD:
#define OP(x, y) _ALLEGRO_MIN(1, x + y)
BLEND(a, asrc, adst)
#undef OP
break;
case ALLEGRO_SRC_MINUS_DEST:
#define OP(x, y) _ALLEGRO_MAX(0, x - y)
BLEND(a, asrc, adst)
#undef OP
break;
case ALLEGRO_DEST_MINUS_SRC:
#define OP(x, y) _ALLEGRO_MAX(0, y - x)
BLEND(a, asrc, adst)
#undef OP
break;
}
#undef BLEND
}
#endif
void _al_blend_memory(ALLEGRO_COLOR *src_color, ALLEGRO_BITMAP *dest,
int dx, int dy, ALLEGRO_COLOR *result);
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,29 @@
#ifndef __al_included_allegro5_aintern_config_h
#define __al_included_allegro5_aintern_config_h
#include "allegro5/internal/aintern_aatree.h"
struct ALLEGRO_CONFIG_ENTRY {
bool is_comment;
ALLEGRO_USTR *key; /* comment if is_comment is true */
ALLEGRO_USTR *value;
ALLEGRO_CONFIG_ENTRY *next;
};
struct ALLEGRO_CONFIG_SECTION {
ALLEGRO_USTR *name;
ALLEGRO_CONFIG_ENTRY *head;
ALLEGRO_CONFIG_ENTRY *last;
_AL_AATREE *tree;
ALLEGRO_CONFIG_SECTION *next;
};
struct ALLEGRO_CONFIG {
ALLEGRO_CONFIG_SECTION *head;
ALLEGRO_CONFIG_SECTION *last;
_AL_AATREE *tree;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
#ifndef __al_included_allegro5_aintern_debug_h
#define __al_included_allegro5_aintern_debug_h
#ifdef __cplusplus
extern "C" {
#endif
void _al_shutdown_logging(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,18 @@
#ifndef __al_included_allegro5_aintern_direct3d_h
#define __al_included_allegro5_aintern_direct3d_h
#ifdef __cplusplus
extern "C" {
#endif
struct ALLEGRO_DISPLAY_D3D;
AL_FUNC(void, _al_d3d_set_blender, (struct ALLEGRO_DISPLAY_D3D *disp));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,148 @@
#ifndef __al_included_allegro5_aintern_display_h
#define __al_included_allegro5_aintern_display_h
#include "allegro5/allegro.h"
#include "allegro5/transformations.h"
#include "allegro5/display.h"
#include "allegro5/bitmap.h"
#include "allegro5/internal/aintern_events.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALLEGRO_DISPLAY_INTERFACE ALLEGRO_DISPLAY_INTERFACE;
struct ALLEGRO_DISPLAY_INTERFACE
{
int id;
ALLEGRO_DISPLAY *(*create_display)(int w, int h);
void (*destroy_display)(ALLEGRO_DISPLAY *display);
bool (*set_current_display)(ALLEGRO_DISPLAY *d);
void (*unset_current_display)(ALLEGRO_DISPLAY *d);
void (*clear)(ALLEGRO_DISPLAY *d, ALLEGRO_COLOR *color);
void (*draw_pixel)(ALLEGRO_DISPLAY *d, float x, float y, ALLEGRO_COLOR *color);
void (*flip_display)(ALLEGRO_DISPLAY *d);
void (*update_display_region)(ALLEGRO_DISPLAY *d, int x, int y,
int width, int height);
bool (*acknowledge_resize)(ALLEGRO_DISPLAY *d);
bool (*resize_display)(ALLEGRO_DISPLAY *d, int width, int height);
void (*quick_size)(ALLEGRO_DISPLAY *d);
ALLEGRO_BITMAP *(*create_bitmap)(ALLEGRO_DISPLAY *d,
int w, int h);
void (*set_target_bitmap)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap);
ALLEGRO_BITMAP *(*get_backbuffer)(ALLEGRO_DISPLAY *d);
bool (*is_compatible_bitmap)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap);
void (*switch_out)(ALLEGRO_DISPLAY *display);
void (*switch_in)(ALLEGRO_DISPLAY *display);
void (*draw_memory_bitmap_region)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap,
float sx, float sy, float sw, float sh, int flags);
ALLEGRO_BITMAP *(*create_sub_bitmap)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *parent,
int x, int y, int width, int height);
bool (*wait_for_vsync)(ALLEGRO_DISPLAY *display);
bool (*set_mouse_cursor)(ALLEGRO_DISPLAY *display,
ALLEGRO_MOUSE_CURSOR *cursor);
bool (*set_system_mouse_cursor)(ALLEGRO_DISPLAY *display,
ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id);
bool (*show_mouse_cursor)(ALLEGRO_DISPLAY *display);
bool (*hide_mouse_cursor)(ALLEGRO_DISPLAY *display);
void (*set_icons)(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP *bitmap[]);
void (*set_window_position)(ALLEGRO_DISPLAY *display, int x, int y);
void (*get_window_position)(ALLEGRO_DISPLAY *display, int *x, int *y);
bool (*set_display_flag)(ALLEGRO_DISPLAY *display, int flag, bool onoff);
void (*set_window_title)(ALLEGRO_DISPLAY *display, const char *title);
void (*flush_vertex_cache)(ALLEGRO_DISPLAY *d);
void* (*prepare_vertex_cache)(ALLEGRO_DISPLAY *d, int num_new_vertices);
void (*update_transformation)(ALLEGRO_DISPLAY* d, ALLEGRO_BITMAP *target);
void (*shutdown)(void);
};
struct ALLEGRO_OGL_EXTRAS;
typedef struct ALLEGRO_BLENDER
{
int blend_op;
int blend_source;
int blend_dest;
int blend_alpha_op;
int blend_alpha_source;
int blend_alpha_dest;
} ALLEGRO_BLENDER;
/* These are settings Allegro itself doesn't really care about on its
* own, but which users may want to specify for a display anyway.
*/
ALLEGRO_STATIC_ASSERT(aintern_display, ALLEGRO_DISPLAY_OPTIONS_COUNT <= 32);
typedef struct
{
int required, suggested; /* Bitfields. */
int settings[ALLEGRO_DISPLAY_OPTIONS_COUNT];
/* These are come in handy when creating a context. */
void *info;
int index, score;
} ALLEGRO_EXTRA_DISPLAY_SETTINGS;
struct ALLEGRO_DISPLAY
{
/* Must be first, so the display can be used as event source. */
ALLEGRO_EVENT_SOURCE es;
ALLEGRO_DISPLAY_INTERFACE *vt;
int refresh_rate;
int flags;
int w, h;
int backbuffer_format; /* ALLEGRO_PIXELFORMAT */
ALLEGRO_EXTRA_DISPLAY_SETTINGS extra_settings;
struct ALLEGRO_OGL_EXTRAS *ogl_extras;
_AL_VECTOR bitmaps; /* A list of bitmaps created for this display. */
int num_cache_vertices;
bool cache_enabled;
int vertex_cache_size;
void* vertex_cache;
uintptr_t cache_texture;
ALLEGRO_BLENDER cur_blender;
void (*display_invalidated)(ALLEGRO_DISPLAY*);
};
int _al_score_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref);
void _al_fill_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds);
void _al_set_color_components(int format, ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, int importance);
int _al_deduce_color_format(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds);
int _al_display_settings_sorter(const void *p0, const void *p1);
void _al_destroy_display_bitmaps(ALLEGRO_DISPLAY *d);
/* This is called from the primitives addon. */
AL_FUNC(void, _al_set_display_invalidated_callback, (ALLEGRO_DISPLAY *display,
void (*display_invalidated)(ALLEGRO_DISPLAY*)));
/* Defined in tls.c */
bool _al_set_current_display_only(ALLEGRO_DISPLAY *display);
void _al_set_new_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *settings);
ALLEGRO_EXTRA_DISPLAY_SETTINGS *_al_get_new_display_settings(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,13 @@
#ifndef __al_included_allegro5_internal_aintern_driver_h
#define __al_included_allegro5_internal_aintern_driver_h
typedef struct _AL_DRIVER_INFO /* info about a hardware driver */
{
int id; /* integer ID */
void *driver; /* the driver structure */
int autodetect; /* set to allow autodetection */
} _AL_DRIVER_INFO;
#endif

View File

@@ -0,0 +1,31 @@
#ifndef __al_included_allegro5_aintern_dtor_h
#define __al_included_allegro5_aintern_dtor_h
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _AL_DTOR_LIST _AL_DTOR_LIST;
AL_FUNC(_AL_DTOR_LIST *, _al_init_destructors, (void));
AL_FUNC(void, _al_push_destructor_owner, (void));
AL_FUNC(void, _al_pop_destructor_owner, (void));
AL_FUNC(void, _al_run_destructors, (_AL_DTOR_LIST *dtors));
AL_FUNC(void, _al_shutdown_destructors, (_AL_DTOR_LIST *dtors));
AL_FUNC(void, _al_register_destructor, (_AL_DTOR_LIST *dtors, void *object,
void (*func)(void*)));
AL_FUNC(void, _al_unregister_destructor, (_AL_DTOR_LIST *dtors, void *object));
AL_FUNC(void, _al_foreach_destructor, (_AL_DTOR_LIST *dtors,
void (*callback)(void *object, void (*func)(void *), void *udata),
void *userdata));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,48 @@
#ifndef __al_included_allegro5_aintern_events_h
#define __al_included_allegro5_aintern_events_h
#include "allegro5/internal/aintern_thread.h"
#include "allegro5/internal/aintern_vector.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALLEGRO_EVENT_SOURCE_REAL ALLEGRO_EVENT_SOURCE_REAL;
struct ALLEGRO_EVENT_SOURCE_REAL
{
_AL_MUTEX mutex;
_AL_VECTOR queues;
intptr_t data;
};
typedef struct ALLEGRO_USER_EVENT_DESCRIPTOR
{
void (*dtor)(ALLEGRO_USER_EVENT *event);
int refcount;
} ALLEGRO_USER_EVENT_DESCRIPTOR;
AL_FUNC(void, _al_init_events, (void));
AL_FUNC(void, _al_event_source_init, (ALLEGRO_EVENT_SOURCE*));
AL_FUNC(void, _al_event_source_free, (ALLEGRO_EVENT_SOURCE*));
AL_FUNC(void, _al_event_source_lock, (ALLEGRO_EVENT_SOURCE*));
AL_FUNC(void, _al_event_source_unlock, (ALLEGRO_EVENT_SOURCE*));
AL_FUNC(void, _al_event_source_on_registration_to_queue, (ALLEGRO_EVENT_SOURCE*, ALLEGRO_EVENT_QUEUE*));
AL_FUNC(void, _al_event_source_on_unregistration_from_queue, (ALLEGRO_EVENT_SOURCE*, ALLEGRO_EVENT_QUEUE*));
AL_FUNC(bool, _al_event_source_needs_to_generate_event, (ALLEGRO_EVENT_SOURCE*));
AL_FUNC(void, _al_event_source_emit_event, (ALLEGRO_EVENT_SOURCE *, ALLEGRO_EVENT*));
AL_FUNC(void, _al_event_queue_push_event, (ALLEGRO_EVENT_QUEUE*, const ALLEGRO_EVENT*));
#ifdef __cplusplus
}
#endif
#endif
/* vi ts=8 sts=3 sw=3 et */

View File

@@ -0,0 +1,19 @@
#ifndef __al_included_allegro5_aintern_exitfunc_h
#define __al_included_allegro5_aintern_exitfunc_h
#ifdef __cplusplus
extern "C" {
#endif
/* list of functions to call at program cleanup */
AL_FUNC(void, _al_add_exit_func, (AL_METHOD(void, func, (void)), const char *desc));
AL_FUNC(void, _al_remove_exit_func, (AL_METHOD(void, func, (void))));
AL_FUNC(void, _al_run_exit_funcs, (void));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,27 @@
#ifndef __al_included_allegro5_aintern_file_h
#define __al_included_allegro5_aintern_file_h
#ifdef __cplusplus
extern "C" {
#endif
extern const ALLEGRO_FILE_INTERFACE _al_file_interface_stdio;
#define ALLEGRO_UNGETC_SIZE 16
struct ALLEGRO_FILE
{
const ALLEGRO_FILE_INTERFACE *vtable;
void *userdata;
unsigned char ungetc[ALLEGRO_UNGETC_SIZE];
int ungetc_len;
};
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,16 @@
#ifndef __al_included_allegro5_aintern_float_h
#define __al_included_allegro5_aintern_float_h
/* This file used to contain a tricky function that sped up float->int
* conversions on x86 machines when the SSE instruction CVTTSS2SI wasn't
* available (or when SSE wasn't enabled in the compiler).
*
* However, it performed rounding instead of truncating like (int)f, which
* did cause problems. If an alternative is found we could define this
* macro once again.
*/
#define _al_fast_float_to_int(f) ((int)(f))
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,33 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Internal File System Hook support.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_aintern_fshook_h
#define __al_included_allegro5_aintern_fshook_h
#include "allegro5/base.h"
#ifdef __cplusplus
extern "C" {
#endif
extern struct ALLEGRO_FS_INTERFACE _al_fs_interface_stdio;
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,51 @@
#ifndef __al_included_allegro5_aintern_gp2xwiz_h
#define __al_included_allegro5_aintern_gp2xwiz_h
#include "allegro5/allegro.h"
#include "allegro5/allegro_opengl.h"
#include "allegro5/internal/aintern.h"
#include "allegro5/internal/aintern_system.h"
#include "allegro5/internal/aintern_bitmap.h"
#include "allegro5/platform/aintwiz.h"
#include "allegro5/internal/aintern_opengl.h"
#include <wiz/castor.h>
typedef struct ALLEGRO_SYSTEM_GP2XWIZ ALLEGRO_SYSTEM_GP2XWIZ;
typedef struct ALLEGRO_DISPLAY_GP2XWIZ_OGL ALLEGRO_DISPLAY_GP2XWIZ_OGL;
typedef struct ALLEGRO_DISPLAY_GP2XWIZ_FB ALLEGRO_DISPLAY_GP2XWIZ_FB;
struct ALLEGRO_SYSTEM_GP2XWIZ
{
ALLEGRO_SYSTEM system; /* This must be the first member, we "derive" from it. */
ALLEGRO_EXTRA_DISPLAY_SETTINGS extras;
};
/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */
struct ALLEGRO_DISPLAY_GP2XWIZ_OGL
{
ALLEGRO_DISPLAY display; /* This must be the first member. */
EGLDisplay egl_display;
EGLConfig egl_config;
EGLContext egl_context;
EGLSurface egl_surface;
NativeWindowType hNativeWnd;
};
/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */
struct ALLEGRO_DISPLAY_GP2XWIZ_FB
{
ALLEGRO_DISPLAY display; /* This must be the first member. */
ALLEGRO_BITMAP *backbuffer;
/*
* We create the backbuffer bitmap then points it's ->memory at
* lc_fb1 (initialized with libcastor. This is a backup of the
* ->memory as created by al_create_bitmap.
*/
unsigned char *screen_mem;
};
#endif

View File

@@ -0,0 +1,73 @@
#ifndef __al_included_allegro_aintern_image_h
#define __al_included_allegro_aintern_image_h
#include "allegro5/platform/alplatf.h"
#include "allegro5/internal/aintern_image_cfg.h"
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER
#ifdef ALLEGRO_IPHONE
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_iphone_load_image, (const char *filename));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_iphone_load_image_f, (ALLEGRO_FILE *f));
#endif
#ifdef ALLEGRO_MACOSX
ALLEGRO_IIO_FUNC(bool, _al_osx_register_image_loader, (void));
#endif
#endif
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_pcx, (const char *filename));
ALLEGRO_IIO_FUNC(bool, _al_save_pcx, (const char *filename, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_pcx_f, (ALLEGRO_FILE *f));
ALLEGRO_IIO_FUNC(bool, _al_save_pcx_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_bmp, (const char *filename));
ALLEGRO_IIO_FUNC(bool, _al_save_bmp, (const char *filename, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_bmp_f, (ALLEGRO_FILE *f));
ALLEGRO_IIO_FUNC(bool, _al_save_bmp_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_tga, (const char *filename));
ALLEGRO_IIO_FUNC(bool, _al_save_tga, (const char *filename, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_tga_f, (ALLEGRO_FILE *f));
ALLEGRO_IIO_FUNC(bool, _al_save_tga_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
#ifdef ALLEGRO_CFG_IIO_HAVE_GDIPLUS
ALLEGRO_IIO_FUNC(bool, _al_init_gdiplus, (void));
ALLEGRO_IIO_FUNC(void, _al_shutdown_gdiplus, (void));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_gdiplus_bitmap, (const char *filename));
ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_bitmap, (const char *filename, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_gdiplus_bitmap_f, (ALLEGRO_FILE *f));
ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_png_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_jpg_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_tif_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_gif_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
#endif
/* ALLEGRO_CFG_IIO_HAVE_PNG/JPG implies that "native" loaders aren't available. */
#ifdef ALLEGRO_CFG_IIO_HAVE_PNG
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_png, (const char *filename));
ALLEGRO_IIO_FUNC(bool, _al_save_png, (const char *filename, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_png_f, (ALLEGRO_FILE *f));
ALLEGRO_IIO_FUNC(bool, _al_save_png_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
#endif
#ifdef ALLEGRO_CFG_IIO_HAVE_JPG
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_jpg, (const char *filename));
ALLEGRO_IIO_FUNC(bool, _al_save_jpg, (const char *filename, ALLEGRO_BITMAP *bmp));
ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_jpg_f, (ALLEGRO_FILE *f));
ALLEGRO_IIO_FUNC(bool, _al_save_jpg_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp));
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,12 @@
#define ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER
/* which libraries are present and needed? */
#define ALLEGRO_CFG_IIO_HAVE_GDIPLUS
/* #undef ALLEGRO_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H */
/* #undef ALLEGRO_CFG_IIO_HAVE_ANDROID */
/* #undef ALLEGRO_CFG_IIO_HAVE_PNG */
/* #undef ALLEGRO_CFG_IIO_HAVE_JPG */
/* which formats are supported and wanted? */
#define ALLEGRO_CFG_IIO_SUPPORT_PNG
#define ALLEGRO_CFG_IIO_SUPPORT_JPG

View File

@@ -0,0 +1,42 @@
#include "allegro5/allegro.h"
#include <allegro5/internal/aintern_system.h>
#include <allegro5/internal/aintern_display.h>
typedef struct ALLEGRO_SYSTEM_IPHONE {
ALLEGRO_SYSTEM system;
ALLEGRO_MUTEX *mutex;
ALLEGRO_COND *cond;
bool has_shutdown, wants_shutdown;
int visuals_count;
ALLEGRO_EXTRA_DISPLAY_SETTINGS **visuals;
} ALLEGRO_SYSTEM_IPHONE;
typedef struct ALLEGRO_DISPLAY_IPHONE {
ALLEGRO_DISPLAY display;
} ALLEGRO_DISPLAY_IPHONE;
void _al_iphone_init_path(void);
void _al_iphone_add_view(ALLEGRO_DISPLAY *d);
void _al_iphone_make_view_current(void);
void _al_iphone_flip_view(void);
void _al_iphone_reset_framebuffer(void);
ALLEGRO_SYSTEM_INTERFACE *_al_get_iphone_system_interface(void);
ALLEGRO_DISPLAY_INTERFACE *_al_get_iphone_display_interface(void);
ALLEGRO_PATH *_al_iphone_get_path(int id);
ALLEGRO_KEYBOARD_DRIVER *_al_get_iphone_keyboard_driver(void);
ALLEGRO_MOUSE_DRIVER *_al_get_iphone_mouse_driver(void);
ALLEGRO_JOYSTICK_DRIVER *_al_get_iphone_joystick_driver(void);
void _al_iphone_setup_opengl_view(ALLEGRO_DISPLAY *d);
void _al_iphone_generate_mouse_event(unsigned int type,
int x, int y, unsigned int button, ALLEGRO_DISPLAY *d);
void _al_iphone_update_visuals(void);
void _al_iphone_accelerometer_control(int frequency);
void _al_iphone_generate_joystick_event(float x, float y, float z);
void _al_iphone_await_termination(void);
void _al_iphone_get_screen_size(int *w, int *h);
void _al_iphone_translate_from_screen(ALLEGRO_DISPLAY *d, int *x, int *y);
void _al_iphone_translate_to_screen(ALLEGRO_DISPLAY *d, int *x, int *y);
void _al_iphone_clip(ALLEGRO_BITMAP const *bitmap, int x_1, int y_1, int x_2, int y_2);
float _al_iphone_get_screen_scale(void);

View File

@@ -0,0 +1,90 @@
#ifndef __al_included_allegro5_aintern_joystick_h
#define __al_included_allegro5_aintern_joystick_h
#include "allegro5/internal/aintern_driver.h"
#include "allegro5/internal/aintern_events.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALLEGRO_JOYSTICK_DRIVER
{
int joydrv_id;
const char *joydrv_name;
const char *joydrv_desc;
const char *joydrv_ascii_name;
AL_METHOD(bool, init_joystick, (void));
AL_METHOD(void, exit_joystick, (void));
AL_METHOD(bool, reconfigure_joysticks, (void));
AL_METHOD(int, num_joysticks, (void));
AL_METHOD(ALLEGRO_JOYSTICK *, get_joystick, (int joyn));
AL_METHOD(void, release_joystick, (ALLEGRO_JOYSTICK *joy));
AL_METHOD(void, get_joystick_state, (ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state));
AL_METHOD(const char *, get_name, (ALLEGRO_JOYSTICK *joy));
AL_METHOD(bool, get_active, (ALLEGRO_JOYSTICK *joy));
} ALLEGRO_JOYSTICK_DRIVER;
AL_ARRAY(_AL_DRIVER_INFO, _al_joystick_driver_list);
/* macros for constructing the driver list */
#define _AL_BEGIN_JOYSTICK_DRIVER_LIST \
_AL_DRIVER_INFO _al_joystick_driver_list[] = \
{
#define _AL_END_JOYSTICK_DRIVER_LIST \
{ 0, NULL, false } \
};
/* information about a single joystick axis */
typedef struct _AL_JOYSTICK_AXIS_INFO
{
char *name;
} _AL_JOYSTICK_AXIS_INFO;
/* information about one or more axis (a slider or directional control) */
typedef struct _AL_JOYSTICK_STICK_INFO
{
int flags; /* bit-field */
int num_axes;
_AL_JOYSTICK_AXIS_INFO axis[_AL_MAX_JOYSTICK_AXES];
char *name;
} _AL_JOYSTICK_STICK_INFO;
/* information about a joystick button */
typedef struct _AL_JOYSTICK_BUTTON_INFO
{
const char *name;
} _AL_JOYSTICK_BUTTON_INFO;
/* information about an entire joystick */
typedef struct _AL_JOYSTICK_INFO
{
int num_sticks;
int num_buttons;
_AL_JOYSTICK_STICK_INFO stick[_AL_MAX_JOYSTICK_STICKS];
_AL_JOYSTICK_BUTTON_INFO button[_AL_MAX_JOYSTICK_BUTTONS];
} _AL_JOYSTICK_INFO;
struct ALLEGRO_JOYSTICK
{
_AL_JOYSTICK_INFO info;
};
void _al_generate_joystick_event(ALLEGRO_EVENT *event);
#ifdef __cplusplus
}
#endif
#endif
/* vi ts=8 sts=3 sw=3 et */

View File

@@ -0,0 +1,64 @@
#ifndef __al_included_allegro5_aintern_keyboard_h
#define __al_included_allegro5_aintern_keyboard_h
#include "allegro5/internal/aintern_driver.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALLEGRO_KEYBOARD_DRIVER
{
int keydrv_id;
const char *keydrv_name;
const char *keydrv_desc;
const char *keydrv_ascii_name;
AL_METHOD(bool, init_keyboard, (void));
AL_METHOD(void, exit_keyboard, (void));
AL_METHOD(ALLEGRO_KEYBOARD*, get_keyboard, (void));
AL_METHOD(bool, set_keyboard_leds, (int leds));
AL_METHOD(const char *, keycode_to_name, (int keycode));
AL_METHOD(void, get_keyboard_state, (ALLEGRO_KEYBOARD_STATE *ret_state));
} ALLEGRO_KEYBOARD_DRIVER;
AL_ARRAY(_AL_DRIVER_INFO, _al_keyboard_driver_list);
AL_ARRAY(const char *, _al_keyboard_common_names);
int _al_parse_key_binding(const char *s, unsigned int *modifiers);
struct ALLEGRO_KEYBOARD
{
ALLEGRO_EVENT_SOURCE es;
};
/* Helpers for AL_KEYBOARD_STATE structures. */
#define _AL_KEYBOARD_STATE_KEY_DOWN(STATE, KEYCODE) \
(((STATE).__key_down__internal__[(KEYCODE) / 32] & (1 << ((KEYCODE) % 32)))\
? true : false)
#define _AL_KEYBOARD_STATE_SET_KEY_DOWN(STATE, KEYCODE) \
do { \
int kc = (KEYCODE); \
(STATE).__key_down__internal__[kc / 32] |= (1 << (kc % 32)); \
} while (0)
#define _AL_KEYBOARD_STATE_CLEAR_KEY_DOWN(STATE, KEYCODE) \
do { \
int kc = (KEYCODE); \
(STATE).__key_down__internal__[kc / 32] &= ~(1 << (kc % 32)); \
} while (0)
#ifdef __cplusplus
}
#endif
#endif
/* vi ts=8 sts=3 sw=3 et */

View File

@@ -0,0 +1,75 @@
#ifndef __al_included_allegro5_aintern_list_h
#define __al_included_allegro5_aintern_list_h
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _AL_LIST _AL_LIST;
typedef struct _AL_LIST_ITEM _AL_LIST_ITEM;
typedef void (*_AL_LIST_DTOR)(void* userdata);
typedef void (*_AL_LIST_ITEM_DTOR)(void* value, void* userdata);
AL_FUNC(_AL_LIST*, _al_list_create, (void));
AL_FUNC(_AL_LIST*, _al_list_create_static, (size_t capacity));
AL_FUNC(void, _al_list_destroy, (_AL_LIST* list));
AL_FUNC(void, _al_list_set_dtor, (_AL_LIST* list, _AL_LIST_DTOR dtor));
AL_FUNC(_AL_LIST_DTOR, _al_list_get_dtor, (_AL_LIST* list));
AL_FUNC(_AL_LIST_ITEM*, _al_list_push_front, (_AL_LIST* list, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_push_front_ex, (_AL_LIST* list, void* data, _AL_LIST_ITEM_DTOR dtor));
AL_FUNC(_AL_LIST_ITEM*, _al_list_push_back, (_AL_LIST* list, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_push_back_ex, (_AL_LIST* list, void* data, _AL_LIST_ITEM_DTOR dtor));
AL_FUNC(void, _al_list_pop_front, (_AL_LIST* list));
AL_FUNC(void, _al_list_pop_back, (_AL_LIST* list));
AL_FUNC(_AL_LIST_ITEM*, _al_list_insert_after, (_AL_LIST* list, _AL_LIST_ITEM* where, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_insert_after_ex, (_AL_LIST* list, _AL_LIST_ITEM* where, void* data, _AL_LIST_ITEM_DTOR dtor));
AL_FUNC(_AL_LIST_ITEM*, _al_list_insert_before, (_AL_LIST* list, _AL_LIST_ITEM* where, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_insert_before_ex, (_AL_LIST* list, _AL_LIST_ITEM* where, void* data, _AL_LIST_ITEM_DTOR dtor));
AL_FUNC(void, _al_list_erase, (_AL_LIST* list, _AL_LIST_ITEM* item));
AL_FUNC(void, _al_list_clear, (_AL_LIST* list));
AL_FUNC(void, _al_list_remove, (_AL_LIST* list, void* data));
AL_FUNC(bool, _al_list_is_empty, (_AL_LIST* list));
AL_FUNC(bool, _al_list_contains, (_AL_LIST* list, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_find_first, (_AL_LIST* list, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_find_last, (_AL_LIST* list, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_find_after, (_AL_LIST* list, _AL_LIST_ITEM* where, void* data));
AL_FUNC(_AL_LIST_ITEM*, _al_list_find_before, (_AL_LIST* list, _AL_LIST_ITEM* where, void* data));
AL_FUNC(size_t, _al_list_size, (_AL_LIST* list));
AL_FUNC(_AL_LIST_ITEM*, _al_list_at, (_AL_LIST* list, size_t index));
AL_FUNC(_AL_LIST_ITEM*, _al_list_front, (_AL_LIST* list));
AL_FUNC(_AL_LIST_ITEM*, _al_list_back, (_AL_LIST* list));
AL_FUNC(_AL_LIST_ITEM*, _al_list_next, (_AL_LIST* list, _AL_LIST_ITEM* item));
AL_FUNC(_AL_LIST_ITEM*, _al_list_previous, (_AL_LIST* list, _AL_LIST_ITEM* item));
AL_FUNC(_AL_LIST_ITEM*, _al_list_next_circular, (_AL_LIST* list, _AL_LIST_ITEM* item));
AL_FUNC(_AL_LIST_ITEM*, _al_list_previous_circular, (_AL_LIST* list, _AL_LIST_ITEM* item));
AL_FUNC(void*, _al_list_item_data, (_AL_LIST_ITEM* item));
AL_FUNC(void, _al_list_item_set_dtor, (_AL_LIST_ITEM* item, _AL_LIST_ITEM_DTOR dtor));
AL_FUNC(_AL_LIST_ITEM_DTOR, _al_list_item_get_dtor, (_AL_LIST_ITEM* item));
AL_FUNC(void, _al_list_set_user_data, (_AL_LIST* list, void* user_data));
AL_FUNC(void*, _al_list_get_user_data, (_AL_LIST* list));
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,20 @@
#ifndef __al_included_allegro5_aintern_memblit_h
#define __al_included_allegro5_aintern_memblit_h
#ifdef __cplusplus
extern "C" {
#endif
void _al_draw_bitmap_region_memory(ALLEGRO_BITMAP *bitmap,
ALLEGRO_COLOR tint,
int sx, int sy, int sw, int sh, int dx, int dy, int flags);
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,19 @@
#ifndef __al_included_allegro5_aintern_memdraw_h
#define __al_included_allegro5_aintern_memdraw_h
#ifdef __cplusplus
extern "C" {
#endif
void _al_clear_bitmap_by_locking(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR *color);
void _al_draw_pixel_memory(ALLEGRO_BITMAP *bmp, float x, float y, ALLEGRO_COLOR *color);
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,44 @@
#ifndef __al_included_allegro5_aintern_mouse_h
#define __al_included_allegro5_aintern_mouse_h
#include "allegro5/internal/aintern_driver.h"
#include "allegro5/internal/aintern_events.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ALLEGRO_MOUSE_DRIVER
{
int msedrv_id;
const char *msedrv_name;
const char *msedrv_desc;
const char *msedrv_ascii_name;
AL_METHOD(bool, init_mouse, (void));
AL_METHOD(void, exit_mouse, (void));
AL_METHOD(ALLEGRO_MOUSE*, get_mouse, (void));
AL_METHOD(unsigned int, get_mouse_num_buttons, (void));
AL_METHOD(unsigned int, get_mouse_num_axes, (void));
AL_METHOD(bool, set_mouse_xy, (ALLEGRO_DISPLAY *display, int x, int y));
AL_METHOD(bool, set_mouse_axis, (int which, int value));
AL_METHOD(void, get_mouse_state, (ALLEGRO_MOUSE_STATE *ret_state));
} ALLEGRO_MOUSE_DRIVER;
AL_ARRAY(_AL_DRIVER_INFO, _al_mouse_driver_list);
struct ALLEGRO_MOUSE
{
ALLEGRO_EVENT_SOURCE es;
};
#ifdef __cplusplus
}
#endif
#endif
/* vi ts=8 sts=3 sw=3 et */

View File

@@ -0,0 +1,53 @@
#ifndef __al_included_allegro_aintern_native_dialog_h
#define __al_included_allegro_aintern_native_dialog_h
typedef struct ALLEGRO_NATIVE_DIALOG ALLEGRO_NATIVE_DIALOG;
/* We could use different structs for the different dialogs. But why
* bother.
*/
struct ALLEGRO_NATIVE_DIALOG
{
ALLEGRO_USTR *title;
int flags;
/* Only used by file chooser. */
ALLEGRO_PATH *fc_initial_path;
size_t fc_path_count;
ALLEGRO_PATH **fc_paths;
ALLEGRO_USTR *fc_patterns;
/* Only used by message box. */
ALLEGRO_USTR *mb_heading;
ALLEGRO_USTR *mb_text;
ALLEGRO_USTR *mb_buttons;
int mb_pressed_button;
/* Only used by text log. */
ALLEGRO_THREAD *tl_thread;
ALLEGRO_COND *tl_text_cond;
ALLEGRO_MUTEX *tl_text_mutex;
ALLEGRO_USTR *tl_pending_text;
bool tl_init_error;
bool tl_done;
bool tl_have_pending;
ALLEGRO_EVENT_SOURCE tl_events;
void *tl_textview;
/* Only used by platform implementations. */
bool is_active;
void *window;
void *async_queue;
};
extern bool _al_init_native_dialog_addon(void);
extern void _al_shutdown_native_dialog_addon(void);
extern bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display,
ALLEGRO_NATIVE_DIALOG *fd);
extern int _al_show_native_message_box(ALLEGRO_DISPLAY *display,
ALLEGRO_NATIVE_DIALOG *fd);
extern bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog);
extern void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog);
extern void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog);
#endif

View File

@@ -0,0 +1,3 @@
/* #undef ALLEGRO_CFG_NATIVE_DIALOG_GTK */
/* #undef ALLEGRO_CFG_NATIVE_DIALOG_OSX */
#define ALLEGRO_CFG_NATIVE_DIALOG_WINDOWS

View File

@@ -0,0 +1,143 @@
#ifndef __al_included_allegro5_aintern_opengl_h
#define __al_included_allegro5_aintern_opengl_h
#include "allegro5/opengl/gl_ext.h"
#include "allegro5/internal/aintern_bitmap.h"
#include "allegro5/internal/aintern_display.h"
enum {
_ALLEGRO_OPENGL_VERSION_0 = 0, /* dummy */
_ALLEGRO_OPENGL_VERSION_1_0 = 0x01000000,
_ALLEGRO_OPENGL_VERSION_1_1 = 0x01010000,
_ALLEGRO_OPENGL_VERSION_1_2 = 0x01020000,
_ALLEGRO_OPENGL_VERSION_1_2_1 = 0x01020100,
_ALLEGRO_OPENGL_VERSION_1_3 = 0x01030000,
_ALLEGRO_OPENGL_VERSION_1_4 = 0x01040000,
_ALLEGRO_OPENGL_VERSION_1_5 = 0x01050000,
_ALLEGRO_OPENGL_VERSION_2_0 = 0x02000000,
_ALLEGRO_OPENGL_VERSION_2_1 = 0x02010000,
_ALLEGRO_OPENGL_VERSION_3_0 = 0x03000000,
_ALLEGRO_OPENGL_VERSION_3_1 = 0x03010000,
_ALLEGRO_OPENGL_VERSION_3_2 = 0x03020000,
_ALLEGRO_OPENGL_VERSION_3_3 = 0x03030000,
_ALLEGRO_OPENGL_VERSION_4_0 = 0x04000000
};
#define ALLEGRO_MAX_OPENGL_FBOS 8
struct ALLEGRO_BITMAP_OGL;
enum {
FBO_INFO_UNUSED = 0,
FBO_INFO_TRANSIENT = 1, /* may be destroyed for another bitmap */
FBO_INFO_PERSISTENT = 2 /* exclusive to the owner bitmap */
};
typedef struct ALLEGRO_FBO_INFO
{
int fbo_state;
GLuint fbo;
struct ALLEGRO_BITMAP_OGL *owner;
double last_use_time;
} ALLEGRO_FBO_INFO;
typedef struct ALLEGRO_BITMAP_OGL
{
ALLEGRO_BITMAP bitmap; /* This must be the first member. */
/* Driver specifics. */
int true_w;
int true_h;
GLuint texture; /* 0 means, not uploaded yet. */
#if defined ALLEGRO_GP2XWIZ
EGLSurface pbuffer;
EGLContext context;
NativeWindowType pbuf_native_wnd;
bool changed;
#else
ALLEGRO_FBO_INFO *fbo_info;
#endif
unsigned char *lock_buffer;
float left, top, right, bottom; /* Texture coordinates. */
bool is_backbuffer; /* This is not a real bitmap, but the backbuffer. */
} ALLEGRO_BITMAP_OGL;
typedef struct OPENGL_INFO {
uint32_t version; /* OpenGL version */
int max_texture_size; /* Maximum texture size */
int is_voodoo3_and_under; /* Special cases for Voodoo 1-3 */
int is_voodoo; /* Special cases for Voodoo cards */
int is_matrox_g200; /* Special cases for Matrox G200 boards */
int is_ati_rage_pro; /* Special cases for ATI Rage Pro boards */
int is_ati_radeon_7000; /* Special cases for ATI Radeon 7000 */
int is_ati_r200_chip; /* Special cases for ATI card with chip R200 */
int is_mesa_driver; /* Special cases for MESA */
} OPENGL_INFO;
typedef struct ALLEGRO_OGL_EXTRAS
{
/* A list of extensions supported by Allegro, for this context. */
ALLEGRO_OGL_EXT_LIST *extension_list;
/* A list of extension API, loaded by Allegro, for this context. */
ALLEGRO_OGL_EXT_API *extension_api;
/* Various info about OpenGL implementation. */
OPENGL_INFO ogl_info;
ALLEGRO_BITMAP_OGL *opengl_target;
ALLEGRO_BITMAP_OGL *backbuffer;
/* True if display resources are shared among displays. */
bool is_shared;
ALLEGRO_FBO_INFO fbos[ALLEGRO_MAX_OPENGL_FBOS];
} ALLEGRO_OGL_EXTRAS;
typedef struct ALLEGRO_OGL_BITMAP_VERTEX
{
float x, y;
float tx, ty;
float r, g, b, a;
} ALLEGRO_OGL_BITMAP_VERTEX;
/* extensions */
int _al_ogl_look_for_an_extension(const char *name, const GLubyte *extensions);
void _al_ogl_set_extensions(ALLEGRO_OGL_EXT_API *ext);
void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *disp);
void _al_ogl_unmanage_extensions(ALLEGRO_DISPLAY *disp);
/* bitmap */
ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h);
ALLEGRO_BITMAP *_al_ogl_create_sub_bitmap(ALLEGRO_DISPLAY *d, ALLEGRO_BITMAP *parent,
int x, int y, int w, int h);
/* common driver */
void _al_ogl_reset_fbo_info(ALLEGRO_FBO_INFO *info);
bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap);
ALLEGRO_FBO_INFO *_al_ogl_persist_fbo(ALLEGRO_DISPLAY *display,
ALLEGRO_FBO_INFO *transient_fbo_info);
void _al_ogl_setup_gl(ALLEGRO_DISPLAY *d);
void _al_ogl_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap);
void _al_ogl_setup_bitmap_clipping(const ALLEGRO_BITMAP *bitmap);
ALLEGRO_BITMAP *_al_ogl_get_backbuffer(ALLEGRO_DISPLAY *d);
ALLEGRO_BITMAP_OGL* _al_ogl_create_backbuffer(ALLEGRO_DISPLAY *disp);
void _al_ogl_destroy_backbuffer(ALLEGRO_BITMAP_OGL *b);
bool _al_ogl_resize_backbuffer(ALLEGRO_BITMAP_OGL *b, int w, int h);
struct ALLEGRO_DISPLAY_INTERFACE;
/* draw */
void _al_ogl_add_drawing_functions(struct ALLEGRO_DISPLAY_INTERFACE *vt);
AL_FUNC(bool, _al_opengl_set_blender, (ALLEGRO_DISPLAY *disp));
#endif

View File

@@ -0,0 +1,14 @@
#ifndef __al_included_allegro5_aintern_path_h
#define __al_included_allegro5_aintern_path_h
struct ALLEGRO_PATH {
ALLEGRO_USTR *drive;
ALLEGRO_USTR *filename;
_AL_VECTOR segments; /* vector of ALLEGRO_USTR * */
ALLEGRO_USTR *basename;
ALLEGRO_USTR *full_string;
};
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,473 @@
#ifndef __al_included_allegro5_aintern_pixels_h
#define __al_included_allegro5_aintern_pixels_h
#include "allegro5/internal/aintern_float.h"
#ifdef __cplusplus
extern "C" {
#endif
#define _AL_MAP_RGBA(_color, _r, _g, _b, _a) \
do { \
(_color).r = _al_u8_to_float[_r]; \
(_color).g = _al_u8_to_float[_g]; \
(_color).b = _al_u8_to_float[_b]; \
(_color).a = _al_u8_to_float[_a]; \
} while (0)
#define _AL_INLINE_GET_PIXEL(format, data, color, advance) \
do { \
switch (format) { \
case ALLEGRO_PIXEL_FORMAT_ARGB_8888: { \
uint32_t _gp_pixel = *(uint32_t *)(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0x00FF0000) >> 16, \
(_gp_pixel & 0x0000FF00) >> 8, \
(_gp_pixel & 0x000000FF) >> 0, \
(_gp_pixel & 0xFF000000) >> 24); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGBA_8888: { \
uint32_t _gp_pixel = *(uint32_t *)(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0xFF000000) >> 24, \
(_gp_pixel & 0x00FF0000) >> 16, \
(_gp_pixel & 0x0000FF00) >> 8, \
(_gp_pixel & 0x000000FF) >> 0); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ARGB_4444: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_4[(_gp_pixel & 0x0F00) >> 8], \
_al_rgb_scale_4[(_gp_pixel & 0x00F0) >> 4], \
_al_rgb_scale_4[(_gp_pixel & 0x000F)], \
_al_rgb_scale_4[(_gp_pixel & 0xF000) >> 12]); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGB_888: { \
uint32_t _gp_pixel = READ3BYTES(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0xFF0000) >> 16, \
(_gp_pixel & 0x00FF00) >> 8, \
(_gp_pixel & 0x0000FF) >> 0, \
255); \
if (advance) \
data += 3; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGB_565: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_5[(_gp_pixel & 0xF800) >> 11], \
_al_rgb_scale_6[(_gp_pixel & 0x07E0) >> 5], \
_al_rgb_scale_5[(_gp_pixel & 0x001F)], \
255); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGB_555: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_5[(_gp_pixel & 0x7C00) >> 10], \
_al_rgb_scale_5[(_gp_pixel & 0x03E0) >> 5], \
_al_rgb_scale_5[(_gp_pixel & 0x001F)], \
255); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGBA_5551: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_5[(_gp_pixel & 0xF800) >> 11], \
_al_rgb_scale_5[(_gp_pixel & 0x07C0) >> 6], \
_al_rgb_scale_5[(_gp_pixel & 0x003E) >> 1], \
_al_rgb_scale_1[_gp_pixel & 1]); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ARGB_1555: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_5[(_gp_pixel & 0x7C00) >> 10], \
_al_rgb_scale_5[(_gp_pixel & 0x03E0) >> 5], \
_al_rgb_scale_5[(_gp_pixel & 0x001F)], \
_al_rgb_scale_1[(_gp_pixel & 0x8000) >> 15]); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ABGR_8888: { \
uint32_t _gp_pixel = *(uint32_t *)(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0x000000FF) >> 0, \
(_gp_pixel & 0x0000FF00) >> 8, \
(_gp_pixel & 0x00FF0000) >> 16, \
(_gp_pixel & 0xFF000000) >> 24); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_XBGR_8888: { \
uint32_t _gp_pixel = *(uint32_t *)(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0x000000FF) >> 0, \
(_gp_pixel & 0x0000FF00) >> 8, \
(_gp_pixel & 0x00FF0000) >> 16, \
255); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_BGR_888: { \
uint32_t _gp_pixel = READ3BYTES(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0x000000FF) >> 0, \
(_gp_pixel & 0x0000FF00) >> 8, \
(_gp_pixel & 0x00FF0000) >> 16, \
255); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_BGR_565: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_5[(_gp_pixel & 0x001F)], \
_al_rgb_scale_6[(_gp_pixel & 0x07E0) >> 5], \
_al_rgb_scale_5[(_gp_pixel & 0xF800) >> 11], \
255); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_BGR_555: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_5[(_gp_pixel & 0x001F)], \
_al_rgb_scale_5[(_gp_pixel & 0x03E0) >> 5], \
_al_rgb_scale_5[(_gp_pixel & 0x7C00) >> 10], \
255); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGBX_8888: { \
uint32_t _gp_pixel = *(uint32_t *)(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0xFF000000) >> 24, \
(_gp_pixel & 0x00FF0000) >> 16, \
(_gp_pixel & 0x0000FF00) >> 8, \
255); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_XRGB_8888: { \
uint32_t _gp_pixel = *(uint32_t *)(data); \
_AL_MAP_RGBA(color, \
(_gp_pixel & 0x00FF0000) >> 16, \
(_gp_pixel & 0x0000FF00) >> 8, \
(_gp_pixel & 0x000000FF), \
255); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ABGR_F32: { \
float *f = (float *)data; \
color.r = f[0]; \
color.g = f[1]; \
color.b = f[2]; \
color.a = f[3]; \
if (advance) \
data += 4 * sizeof(float); \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE: { \
uint8_t *p = (uint8_t *)data; \
_AL_MAP_RGBA(color, *p, *(p + 1), *(p + 2), *(p + 3)); \
if (advance) \
data += 4; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_RGBA_4444: { \
uint16_t _gp_pixel = *(uint16_t *)(data); \
_AL_MAP_RGBA(color, \
_al_rgb_scale_4[(_gp_pixel & 0xF000) >> 12], \
_al_rgb_scale_4[(_gp_pixel & 0x0F00) >> 8], \
_al_rgb_scale_4[(_gp_pixel & 0x00F0) >> 4], \
_al_rgb_scale_4[(_gp_pixel & 0x000F)]); \
if (advance) \
data += 2; \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ANY: \
case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: \
ALLEGRO_ERROR("INLINE_GET got fake _gp_pixel format: %d\n", format); \
abort(); \
break; \
\
case ALLEGRO_NUM_PIXEL_FORMATS: \
default: \
ALLEGRO_ERROR("INLINE_GET got non _gp_pixel format: %d\n", format); \
abort(); \
break; \
} \
} while (0)
#define _AL_INLINE_PUT_PIXEL(format, data, color, advance) \
do { \
uint32_t _pp_pixel; \
switch (format) { \
case ALLEGRO_PIXEL_FORMAT_ARGB_8888: \
_pp_pixel = _al_fast_float_to_int(color.a * 255) << 24; \
_pp_pixel |= _al_fast_float_to_int(color.r * 255) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.g * 255) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.b * 255); \
*(uint32_t *)(data) = _pp_pixel; \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGBA_8888: \
_pp_pixel = _al_fast_float_to_int(color.r * 255) << 24; \
_pp_pixel |= _al_fast_float_to_int(color.g * 255) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.b * 255) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.a * 255); \
*(uint32_t *)(data) = _pp_pixel; \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_ARGB_4444: \
_pp_pixel = _al_fast_float_to_int(color.a * 15) << 12; \
_pp_pixel |= _al_fast_float_to_int(color.r * 15) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.g * 15) << 4; \
_pp_pixel |= _al_fast_float_to_int(color.b * 15); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGB_888: \
_pp_pixel = _al_fast_float_to_int(color.r * 255) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.g * 255) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.b * 255); \
WRITE3BYTES(data, _pp_pixel); \
if (advance) \
data += 3; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGB_565: \
_pp_pixel = _al_fast_float_to_int(color.r * 0x1f) << 11; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0x3f) << 5; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0x1f); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGB_555: \
_pp_pixel = _al_fast_float_to_int(color.r * 0x1f) << 10; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 5; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0x1f); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGBA_5551: \
_pp_pixel = _al_fast_float_to_int(color.r * 0x1f) << 11; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 6; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0x1f) << 1; \
_pp_pixel |= _al_fast_float_to_int(color.a); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_ARGB_1555: \
_pp_pixel = _al_fast_float_to_int(color.a) << 15; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0x1f) << 10; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 5; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0x1f); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_ABGR_8888: \
_pp_pixel = _al_fast_float_to_int(color.a * 0xff) << 24; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0xff) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0xff); \
*(uint32_t *)(data) = _pp_pixel; \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_XBGR_8888: \
_pp_pixel = 0xff000000; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0xff) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0xff); \
*(uint32_t *)(data) = _pp_pixel; \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_BGR_888: \
_pp_pixel = _al_fast_float_to_int(color.b * 0xff) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0xff); \
WRITE3BYTES(data, _pp_pixel); \
if (advance) \
data += 3; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_BGR_565: \
_pp_pixel = _al_fast_float_to_int(color.b * 0x1f) << 11; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0x3f) << 5; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0x1f); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_BGR_555: \
_pp_pixel = _al_fast_float_to_int(color.b * 0x1f) << 10; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 5; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0x1f); \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGBX_8888: \
_pp_pixel = 0xff; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0xff) << 24; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0xff) << 8; \
*(uint32_t *)(data) = _pp_pixel; \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_XRGB_8888: \
_pp_pixel = 0xff000000; \
_pp_pixel |= _al_fast_float_to_int(color.r * 0xff) << 16; \
_pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.b * 0xff); \
*(uint32_t *)(data) = _pp_pixel; \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_ABGR_F32: { \
float *f = (float *)data; \
f[0] = color.r; \
f[1] = color.g; \
f[2] = color.b; \
f[3] = color.a; \
if (advance) \
data += 4 * sizeof(float); \
break; \
} \
\
case ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE: \
*((uint8_t *)data + 0) = _al_fast_float_to_int(color.r * 0xff); \
*((uint8_t *)data + 1) = _al_fast_float_to_int(color.g * 0xff); \
*((uint8_t *)data + 2) = _al_fast_float_to_int(color.b * 0xff); \
*((uint8_t *)data + 3) = _al_fast_float_to_int(color.a * 0xff); \
if (advance) \
data += 4; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_RGBA_4444: \
_pp_pixel = _al_fast_float_to_int(color.a * 15); \
_pp_pixel |= _al_fast_float_to_int(color.r * 15) << 12; \
_pp_pixel |= _al_fast_float_to_int(color.g * 15) << 8; \
_pp_pixel |= _al_fast_float_to_int(color.b * 15) << 4; \
*(uint16_t *)(data) = _pp_pixel; \
if (advance) \
data += 2; \
break; \
\
case ALLEGRO_PIXEL_FORMAT_ANY: \
case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: \
case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: \
ALLEGRO_ERROR("INLINE_PUT got fake _pp_pixel format: %d\n", format); \
abort(); \
break; \
\
case ALLEGRO_NUM_PIXEL_FORMATS: \
ALLEGRO_ERROR("INLINE_PUT got non _pp_pixel format: %d\n", format); \
abort(); \
break; \
} \
} while (0)
AL_ARRAY(int, _al_rgb_scale_1);
AL_ARRAY(int, _al_rgb_scale_4);
AL_ARRAY(int, _al_rgb_scale_5);
AL_ARRAY(int, _al_rgb_scale_6);
AL_ARRAY(float, _al_u8_to_float);
void _al_init_pixels(void);
bool _al_pixel_format_has_alpha(int format);
bool _al_pixel_format_is_real(int format);
int _al_get_real_pixel_format(ALLEGRO_DISPLAY *display, int format);
char const *_al_pixel_format_name(ALLEGRO_PIXEL_FORMAT format);
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,13 @@
#ifndef __al_included_allegro5_aintern_prim_h
#define __al_included_allegro5_aintern_prim_h
int _al_bitmap_region_is_locked(ALLEGRO_BITMAP* bmp, int x1, int y1, int x2, int y2);
struct ALLEGRO_VERTEX_DECL {
ALLEGRO_VERTEX_ELEMENT* elements;
int stride;
void* d3d_decl;
void* d3d_dummy_shader;
};
#endif

View File

@@ -0,0 +1,21 @@
#ifndef __al_included_allegro5_aintern_prim_directx_h
#define __al_included_allegro5_aintern_prim_directx_h
struct ALLEGRO_BITMAP;
struct ALLEGRO_VERTEX;
int _al_draw_prim_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type);
int _al_draw_prim_indexed_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type);
void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret);
bool _al_init_d3d_driver(void);
void _al_shutdown_d3d_driver(void);
void* _al_create_default_shader(void* dev);
void _al_setup_default_shader(void* dev, void* shader);
void _al_setup_shader(void* dev, const ALLEGRO_VERTEX_DECL* decl);
void _al_create_shader(void* dev, ALLEGRO_VERTEX_DECL* decl);
void _al_set_texture_matrix(void* dev, float* mat);
#endif

View File

@@ -0,0 +1,10 @@
#ifndef __al_included_allegro5_aintern_prim_opengl_h
#define __al_included_allegro5_aintern_prim_opengl_h
struct ALLEGRO_BITMAP;
struct ALLEGRO_VERTEX;
int _al_draw_prim_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type);
int _al_draw_prim_indexed_opengl(ALLEGRO_BITMAP *target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type);
#endif

View File

@@ -0,0 +1,13 @@
#ifndef __al_included_allegro5_aintern_prim_soft_h
#define __al_included_allegro5_aintern_prim_soft_h
struct ALLEGRO_BITMAP;
struct ALLEGRO_VERTEX;
int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type);
int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type);
void _al_line_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2);
void _al_point_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v);
#endif

View File

@@ -0,0 +1,60 @@
#ifndef __al_included_allegro5_aintern_system_h
#define __al_included_allegro5_aintern_system_h
#include "allegro5/system.h"
#include "allegro5/internal/aintern_display.h"
#include "allegro5/internal/aintern_dtor.h"
#include "allegro5/internal/aintern_events.h"
#include "allegro5/internal/aintern_joystick.h"
#include "allegro5/internal/aintern_keyboard.h"
#include "allegro5/internal/aintern_mouse.h"
#include "allegro5/internal/aintern_vector.h"
typedef struct ALLEGRO_SYSTEM_INTERFACE ALLEGRO_SYSTEM_INTERFACE;
struct ALLEGRO_SYSTEM_INTERFACE
{
int id;
ALLEGRO_SYSTEM *(*initialize)(int flags);
ALLEGRO_DISPLAY_INTERFACE *(*get_display_driver)(void);
ALLEGRO_KEYBOARD_DRIVER *(*get_keyboard_driver)(void);
ALLEGRO_MOUSE_DRIVER *(*get_mouse_driver)(void);
ALLEGRO_JOYSTICK_DRIVER *(*get_joystick_driver)(void);
int (*get_num_display_modes)(void);
ALLEGRO_DISPLAY_MODE *(*get_display_mode)(int index, ALLEGRO_DISPLAY_MODE *mode);
void (*shutdown_system)(void);
int (*get_num_video_adapters)(void);
bool (*get_monitor_info)(int adapter, ALLEGRO_MONITOR_INFO *info);
ALLEGRO_MOUSE_CURSOR *(*create_mouse_cursor)(ALLEGRO_BITMAP *bmp, int x_focus, int y_focus);
void (*destroy_mouse_cursor)(ALLEGRO_MOUSE_CURSOR *cursor);
bool (*get_cursor_position)(int *ret_x, int *ret_y);
bool (*grab_mouse)(ALLEGRO_DISPLAY *display);
bool (*ungrab_mouse)(void);
ALLEGRO_PATH *(*get_path)(int id);
bool (*inhibit_screensaver)(bool inhibit);
void (*thread_init)(ALLEGRO_THREAD *thread);
void (*thread_exit)(ALLEGRO_THREAD *thread);
void *(*open_library)(const char *filename);
void *(*import_symbol)(void *library, const char *symbol);
void (*close_library)(void *handle);
};
struct ALLEGRO_SYSTEM
{
ALLEGRO_SYSTEM_INTERFACE *vt;
_AL_VECTOR displays; /* Keep a list of all displays attached to us. */
ALLEGRO_CONFIG *config;
ALLEGRO_PATH *user_exe_path;
bool installed;
};
AL_FUNC(void, _al_register_system_interfaces, (void));
AL_VAR(_AL_VECTOR, _al_system_interfaces);
AL_VAR(_AL_DTOR_LIST *, _al_dtor_list);
AL_FUNC(void *, _al_open_library, (const char *filename));
AL_FUNC(void *, _al_import_symbol, (void *library, const char *symbol));
AL_FUNC(void, _al_close_library, (void *library));
#endif

View File

@@ -0,0 +1,52 @@
#ifndef __al_included_allegro5_aintern_thread_h
#define __al_included_allegro5_aintern_thread_h
#include ALLEGRO_INTERNAL_THREAD_HEADER
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _AL_THREAD _AL_THREAD;
typedef struct _AL_MUTEX _AL_MUTEX;
typedef struct _AL_COND _AL_COND;
AL_FUNC(void, _al_thread_create, (_AL_THREAD*,
void (*proc)(_AL_THREAD*, void*),
void *arg));
AL_FUNC(void, _al_thread_set_should_stop, (_AL_THREAD *));
/* static inline bool _al_get_thread_should_stop(_AL_THREAD *); */
AL_FUNC(void, _al_thread_join, (_AL_THREAD*));
AL_FUNC(void, _al_thread_detach, (_AL_THREAD*));
AL_FUNC(void, _al_mutex_init, (_AL_MUTEX*));
AL_FUNC(void, _al_mutex_init_recursive, (_AL_MUTEX*));
AL_FUNC(void, _al_mutex_destroy, (_AL_MUTEX*));
/* static inline void _al_mutex_lock(_AL_MUTEX*); */
/* static inline void _al_mutex_unlock(_AL_MUTEX*); */
/* All 5 functions below are declared inline in aintuthr.h.
* FIXME: Why are they all inline? And if they have to be, why not treat them
* the same as the two functions above?
*/
#ifdef ALLEGRO_WINDOWS
AL_FUNC(void, _al_cond_init, (_AL_COND*));
AL_FUNC(void, _al_cond_destroy, (_AL_COND*));
AL_FUNC(void, _al_cond_wait, (_AL_COND*, _AL_MUTEX*));
AL_FUNC(void, _al_cond_broadcast, (_AL_COND*));
AL_FUNC(void, _al_cond_signal, (_AL_COND*));
#endif
AL_FUNC(int, _al_cond_timedwait, (_AL_COND*, _AL_MUTEX*, const ALLEGRO_TIMEOUT *timeout));
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,16 @@
#ifndef __al_included_allegro5_aintern_timer_h
#define __al_included_allegro5_aintern_timer_h
#ifdef __cplusplus
extern "C" {
#endif
void _al_init_timers(void);
#ifdef __cplusplus
}
#endif
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,20 @@
#ifndef __al_included_allegro5_aintern_tls_h
#define __al_included_allegro5_aintern_tls_h
#ifdef __cplusplus
extern "C" {
#endif
void _al_tls_init_once(void);
int *_al_tls_get_dtor_owner_count(void);
#ifdef __cplusplus
}
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,9 @@
#ifndef __al_included_allegro5_aintern_transform_h
#define __al_included_allegro5_aintern_transform_h
bool _al_transform_is_translation(const ALLEGRO_TRANSFORM* trans,
float *dx, float *dy);
#endif

View File

@@ -0,0 +1,27 @@
#ifndef __al_included_allegro5_aintern_tri_soft_h
#define __al_included_allegro5_aintern_tri_soft_h
struct ALLEGRO_BITMAP;
/* Duplicated in allegro_primitives.h */
#ifndef _ALLEGRO_VERTEX_DEFINED
#define _ALLEGRO_VERTEX_DEFINED
typedef struct ALLEGRO_VERTEX ALLEGRO_VERTEX;
struct ALLEGRO_VERTEX {
float x, y, z;
float u, v;
ALLEGRO_COLOR color;
};
#endif
AL_FUNC(void, _al_triangle_2d, (ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3));
AL_FUNC(void, _al_draw_soft_triangle, (
ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state,
void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*),
void (*first)(uintptr_t, int, int, int, int),
void (*step)(uintptr_t, int),
void (*draw)(uintptr_t, int, int, int)));
#endif

View File

@@ -0,0 +1 @@
/* #undef ALLEGRO_CFG_TTF_FREETYPE */

View File

@@ -0,0 +1,55 @@
#ifndef __al_included_allegro5_aintern_vector_h
#define __al_included_allegro5_aintern_vector_h
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _AL_VECTOR
{
/* private */
size_t _itemsize;
char* _items; /* total size == (size + unused) * itemsize */
size_t _size;
size_t _unused;
} _AL_VECTOR;
#define _AL_VECTOR_INITIALIZER(typ) { sizeof(typ), 0, 0, 0 }
AL_FUNC(void, _al_vector_init, (_AL_VECTOR*, size_t itemsize));
AL_INLINE(size_t, _al_vector_size, (const _AL_VECTOR *vec),
{
return vec->_size;
})
AL_INLINE(bool, _al_vector_is_empty, (const _AL_VECTOR *vec),
{
ASSERT(vec);
return vec->_size == 0 ? true : false;
})
AL_INLINE(bool, _al_vector_is_nonempty, (const _AL_VECTOR *vec),
{
ASSERT(vec);
return !_al_vector_is_empty(vec);
})
AL_FUNC(void*, _al_vector_ref, (const _AL_VECTOR*, unsigned int index));
AL_FUNC(void*, _al_vector_ref_front, (const _AL_VECTOR*));
AL_FUNC(void*, _al_vector_ref_back, (const _AL_VECTOR*));
AL_FUNC(bool, _al_vector_append_array, (_AL_VECTOR *vec, unsigned int num, const void *arr));
AL_FUNC(void*, _al_vector_alloc_back, (_AL_VECTOR*));
AL_FUNC(void*, _al_vector_alloc_mid, (_AL_VECTOR*, unsigned int index));
AL_FUNC(int, _al_vector_find, (const _AL_VECTOR*, const void *ptr_item));
AL_FUNC(bool, _al_vector_contains, (const _AL_VECTOR*, const void *ptr_item));
AL_FUNC(void, _al_vector_delete_at, (_AL_VECTOR*, unsigned int index));
AL_FUNC(bool, _al_vector_find_and_delete, (_AL_VECTOR*, const void *ptr_item));
AL_FUNC(void, _al_vector_free, (_AL_VECTOR*));
#ifdef __cplusplus
}
#endif
#endif
/* vi ts=8 sts=3 sw=3 et */

View File

@@ -0,0 +1,23 @@
#ifndef __al_included_allegro5_aintern_wunicode_h
#define __al_included_allegro5_aintern_wunicode_h
#ifdef ALLEGRO_WINDOWS
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(wchar_t *, _al_win_utf16, (const char *s));
AL_FUNC(char *, _al_win_utf8, (const wchar_t *ws));
#ifdef __cplusplus
}
#endif
#endif
#endif
/* vim: set ts=8 sts=3 sw=3 et: */

View File

@@ -0,0 +1,9 @@
#ifndef __al_included_allegro5_aintern_x_h
#define __al_included_allegro5_aintern_x_h
#include <X11/Xlib.h>
typedef struct ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_XGLX;
typedef struct ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_XGLX;
#endif

View File

@@ -0,0 +1,24 @@
#ifndef __al_included_allegro5_aintern_xcursor_h
#define __al_included_allegro5_aintern_xcursor_h
#ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#include "allegro5/internal/aintern_display.h"
typedef struct ALLEGRO_MOUSE_CURSOR_XWIN ALLEGRO_MOUSE_CURSOR_XWIN;
struct ALLEGRO_MOUSE_CURSOR_XWIN
{
Cursor cursor;
};
ALLEGRO_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(ALLEGRO_BITMAP *bmp,
int x_focus, int y_focus);
void _al_xwin_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor);
void _al_xwin_add_cursor_functions(ALLEGRO_DISPLAY_INTERFACE *vt);
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,61 @@
#ifndef __al_included_allegro5_aintern_xdisplay_h
#define __al_included_allegro5_aintern_xdisplay_h
#include <GL/glx.h>
#include "allegro5/internal/aintern_display.h"
#include "allegro5/internal/aintern_x.h"
/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */
struct ALLEGRO_DISPLAY_XGLX
{
/* This must be the first member. */
ALLEGRO_DISPLAY display;
/* Driver specifics. */
Window window;
int xscreen; /* X Screen ID */
int adapter; /* allegro virtual adapter id/index */
GLXWindow glxwindow;
GLXContext context;
Atom wm_delete_window_atom;
XVisualInfo *xvinfo; /* Used when selecting the X11 visual to use. */
GLXFBConfig *fbc; /* Used when creating the OpenGL context. */
int glx_version; /* 130 means 1 major and 3 minor, aka 1.3 */
/* If our window is embedded by the XEmbed protocol, this gives
* the window ID of the embedder; Otherwise None.
*/
Window embedder_window;
_AL_COND mapped; /* Condition variable to wait for mapping a window. */
bool is_mapped; /* Set to true when mapped. */
int resize_count; /* Increments when resized. */
bool programmatic_resize; /* Set while programmatic resize in progress. */
/* Cursor for this window. */
Cursor invisible_cursor;
Cursor current_cursor;
bool cursor_hidden;
/* Icon for this window. */
Pixmap icon, icon_mask;
/* Desktop position. */
int x, y;
/* al_set_mouse_xy implementation */
bool mouse_warp;
};
void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d, int old_resize_count, bool delay_hack);
void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, int width, int height, bool setglxy);
void _al_xglx_display_configure_event(ALLEGRO_DISPLAY *d, XEvent *event);
void _al_xwin_display_switch_handler(ALLEGRO_DISPLAY *d,
XFocusChangeEvent *event);
void _al_xwin_display_switch_handler_inner(ALLEGRO_DISPLAY *d, bool focus_in);
void _al_xwin_display_expose(ALLEGRO_DISPLAY *display, XExposeEvent *xevent);
#endif

View File

@@ -0,0 +1,8 @@
#ifndef __al_included_allegro5_aintern_xevents_h
#define __al_included_allegro5_aintern_xevents_h
#include "allegro5/internal/aintern_thread.h"
void _al_xwin_background_thread(_AL_THREAD *self, void *arg);
#endif

View File

@@ -0,0 +1,65 @@
#ifndef __al_included_allegro5_aintern_xfullscreen_h
#define __al_included_allegro5_aintern_xfullscreen_h
/* fullscreen and multi monitor stuff */
typedef struct _ALLEGRO_XGLX_MMON_INTERFACE _ALLEGRO_XGLX_MMON_INTERFACE;
struct _ALLEGRO_XGLX_MMON_INTERFACE {
int (*get_num_display_modes)(ALLEGRO_SYSTEM_XGLX *s, int adapter);
ALLEGRO_DISPLAY_MODE *(*get_display_mode)(ALLEGRO_SYSTEM_XGLX *s, int, int, ALLEGRO_DISPLAY_MODE*);
bool (*set_mode)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *, int, int, int, int);
void (*store_mode)(ALLEGRO_SYSTEM_XGLX *);
void (*restore_mode)(ALLEGRO_SYSTEM_XGLX *, int);
void (*get_display_offset)(ALLEGRO_SYSTEM_XGLX *, int, int *, int *);
int (*get_num_adapters)(ALLEGRO_SYSTEM_XGLX *);
bool (*get_monitor_info)(ALLEGRO_SYSTEM_XGLX *, int, ALLEGRO_MONITOR_INFO *);
int (*get_default_adapter)(ALLEGRO_SYSTEM_XGLX *);
int (*get_adapter)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *);
int (*get_xscreen)(ALLEGRO_SYSTEM_XGLX *, int);
void (*post_setup)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *);
void (*handle_xevent)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *, XEvent *e);
};
extern _ALLEGRO_XGLX_MMON_INTERFACE _al_xglx_mmon_interface;
int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s);
int _al_xsys_mheadx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter);
void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y);
void _al_xsys_mmon_exit(ALLEGRO_SYSTEM_XGLX *s);
int _al_xglx_get_num_display_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter);
ALLEGRO_DISPLAY_MODE *_al_xglx_get_display_mode(
ALLEGRO_SYSTEM_XGLX *s, int adapter, int index, ALLEGRO_DISPLAY_MODE *mode);
bool _al_xglx_fullscreen_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int w, int h,
int format, int refresh_rate);
void _al_xglx_store_video_mode(ALLEGRO_SYSTEM_XGLX *s);
void _al_xglx_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter);
void _al_xglx_fullscreen_to_display(ALLEGRO_SYSTEM_XGLX *s,
ALLEGRO_DISPLAY_XGLX *d);
void _al_xglx_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value);
void _al_xglx_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y);
int _al_xglx_fullscreen_select_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int w, int h, int format, int refresh_rate);
bool _al_xglx_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONITOR_INFO *info);
int _al_xglx_get_num_video_adapters(ALLEGRO_SYSTEM_XGLX *s);
int _al_xglx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s);
int _al_xglx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter);
void _al_xglx_set_above(ALLEGRO_DISPLAY *display, int value);
int _al_xglx_get_adapter(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, bool recalc);
void _al_xglx_handle_mmon_event(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, XEvent *e);
#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR
void _al_xsys_xrandr_init(ALLEGRO_SYSTEM_XGLX *s);
void _al_xsys_xrandr_exit(ALLEGRO_SYSTEM_XGLX *s);
#endif /* ALLEGRO_XWINDOWS_WITH_XRANDR */
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,9 @@
#ifndef __al_included_allegro5_aintern_xglx_h
#define __al_included_allegro5_aintern_xglx_h
#include "allegro5/internal/aintern_x.h"
void _al_xglx_config_select_visual(ALLEGRO_DISPLAY_XGLX *glx);
bool _al_xglx_config_create_context(ALLEGRO_DISPLAY_XGLX *glx);
#endif

View File

@@ -0,0 +1,14 @@
#ifndef __al_included_allegro5_aintern_xkeyboard_h
#define __al_included_allegro5_aintern_xkeyboard_h
#include "allegro5/internal/aintern_keyboard.h"
ALLEGRO_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void);
void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display);
void _al_xwin_keyboard_switch_handler(ALLEGRO_DISPLAY *display, bool focus_in);
void _al_xwin_keyboard_handler_alternative(bool press, int hardware_keycode,
uint32_t unichar, ALLEGRO_DISPLAY *display);
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,15 @@
#ifndef __al_included_allegro5_aintern_xmouse_h
#define __al_included_allegro5_aintern_xmouse_h
#include "allegro5/internal/aintern_mouse.h"
ALLEGRO_MOUSE_DRIVER *_al_xwin_mouse_driver(void);
void _al_xwin_mouse_button_press_handler(int button, ALLEGRO_DISPLAY *display);
void _al_xwin_mouse_button_release_handler(int button, ALLEGRO_DISPLAY *d);
void _al_xwin_mouse_motion_notify_handler(int x, int y, ALLEGRO_DISPLAY *d);
void _al_xwin_mouse_switch_handler(ALLEGRO_DISPLAY *display,
const XCrossingEvent *event);
bool _al_xwin_grab_mouse(ALLEGRO_DISPLAY *display);
bool _al_xwin_ungrab_mouse(void);
#endif

View File

@@ -0,0 +1,88 @@
#ifndef __al_included_allegro5_aintern_xsystem_h
#define __al_included_allegro5_aintern_xsystem_h
#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
#include <X11/extensions/xf86vmode.h>
#endif
#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "allegro5/internal/aintern_system.h"
/* This is our version of ALLEGRO_SYSTEM with driver specific extra data. */
struct ALLEGRO_SYSTEM_XGLX
{
/* This must be the first member, we "derive" from it. */
ALLEGRO_SYSTEM system;
/* Driver specifics. */
/* X11 is not thread-safe. But we use a separate thread to handle X11 events.
* Plus, users may call OpenGL commands in the main thread, and we have no
* way to enforce locking for them.
* The only solution seems to be two X11 display connections. One to do our
* input handling, and one for OpenGL graphics.
*
* Note: these may be NULL if we are not connected to an X server, for
* headless command-line tools. We don't have a separate "null" system
* driver.
*/
/* The X11 display. You *MUST* only access this from one
* thread at a time, use the mutex lock below to ensure it.
*/
Display *x11display;
/* Another X11 display we use for graphics. You *MUST*
* only use this in the main thread.
*/
Display *gfxdisplay;
Atom AllegroAtom;
Atom XEmbedAtom;
_AL_THREAD thread; /* background thread. */
_AL_MUTEX lock; /* thread lock for whenever we access internals. */
// FIXME: One condition variable really would be enough.
_AL_COND resized; /* Condition variable to wait for resizing a window. */
ALLEGRO_DISPLAY *mouse_grab_display; /* Best effort: may be inaccurate. */
int toggle_mouse_grab_keycode; /* Disabled if zero */
unsigned int toggle_mouse_grab_modifiers;
bool inhibit_screensaver; /* Should we inhibit the screensaver? */
bool mmon_interface_inited;
#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA
int xinerama_available;
int xinerama_screen_count;
XineramaScreenInfo *xinerama_screen_info;
#endif
#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
/* For VidMode extension. */
int xfvm_available;
int xfvm_screen_count;
struct {
int mode_count;
XF86VidModeModeInfo **modes;
XF86VidModeModeInfo *original_mode;
} *xfvm_screen;
#endif
#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR
int xrandr_available;
int xrandr_event_base;
_AL_VECTOR xrandr_screens;
_AL_VECTOR xrandr_adaptermap;
#endif
/* Used to keep track of how many adapters are in use, so the multi-head
* code can bail if we try to use more than one. */
int adapter_use_count;
int adapter_map[32]; /* XXX magic constant */
};
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,14 @@
#ifndef __al_included_allegro5_aintern_xwindow_h
#define __al_included_allegro5_aintern_xwindow_h
void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off);
void _al_xwin_reset_size_hints(ALLEGRO_DISPLAY *d);
void _al_xwin_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value);
void _al_xwin_set_above(ALLEGRO_DISPLAY *display, int value);
void _al_xwin_set_frame(ALLEGRO_DISPLAY *display, bool frame_on);
void _al_xwin_set_icons(ALLEGRO_DISPLAY *d,
int num_icons, ALLEGRO_BITMAP *bitmaps[]);
#endif
/* vim: set sts=3 sw=3 et: */

View File

@@ -0,0 +1,267 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration defines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
/* for backward compatibility */
#ifdef USE_CONSOLE
#define ALLEGRO_NO_MAGIC_MAIN
#define ALLEGRO_USE_CONSOLE
#endif
/* include platform-specific stuff */
#include "allegro5/platform/alplatf.h"
#if defined ALLEGRO_WATCOM
#include "allegro5/platform/alwatcom.h"
#elif defined ALLEGRO_MINGW32
#include "allegro5/platform/almngw32.h"
#elif defined ALLEGRO_BCC32
#include "allegro5/platform/albcc32.h"
#elif defined ALLEGRO_MSVC
#include "allegro5/platform/almsvc.h"
#elif defined ALLEGRO_IPHONE
#include "allegro5/platform/aliphonecfg.h"
#elif defined ALLEGRO_MACOSX
#include "allegro5/platform/alosxcfg.h"
#elif defined ALLEGRO_UNIX
#include "allegro5/platform/alucfg.h"
#else
#error platform not supported
#endif
#include "allegro5/platform/astdint.h"
#include "allegro5/platform/astdbool.h"
/* special definitions for the GCC compiler */
#ifdef __GNUC__
#define ALLEGRO_GCC
#ifndef AL_INLINE
#ifdef __cplusplus
#define AL_INLINE(type, name, args, code) \
static inline type name args; \
static inline type name args code
/* Needed if this header is included by C99 code, as
* "extern __inline__" in C99 exports a new global function.
*/
#elif __GNUC_STDC_INLINE__
#define AL_INLINE(type, name, args, code) \
extern __inline__ __attribute__((__gnu_inline__)) type name args; \
extern __inline__ __attribute__((__gnu_inline__)) type name args code
#else
#define AL_INLINE(type, name, args, code) \
extern __inline__ type name args; \
extern __inline__ type name args code
#endif
#endif
#ifndef AL_INLINE_STATIC
#ifdef __cplusplus
#define AL_INLINE_STATIC(type, name, args, code) \
AL_INLINE(type, name, args, code)
#else
#define AL_INLINE_STATIC(type, name, args, code) \
static __inline__ type name args; \
static __inline__ type name args code
#endif
#endif
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args) __attribute__ ((format (printf, a, b)))
#ifndef INLINE
#define INLINE __inline__
#endif
#ifndef ZERO_SIZE_ARRAY
#if __GNUC__ < 3
#define ZERO_SIZE_ARRAY(type, name) __extension__ type name[0]
#else
#define ZERO_SIZE_ARRAY(type, name) type name[] /* ISO C99 flexible array members */
#endif
#endif
#ifndef LONG_LONG
#define LONG_LONG long long
#ifdef ALLEGRO_GUESS_INTTYPES_OK
#define int64_t signed long long
#define uint64_t unsigned long long
#endif
#endif
#ifdef __i386__
#define ALLEGRO_I386
#endif
#ifdef __amd64__
#define ALLEGRO_AMD64
#endif
#ifdef __arm__
#define ALLEGRO_ARM
#endif
#ifndef AL_FUNC_DEPRECATED
#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
#define AL_FUNC_DEPRECATED(type, name, args) AL_FUNC(__attribute__ ((deprecated)) type, name, args)
#define AL_PRINTFUNC_DEPRECATED(type, name, args, a, b) AL_PRINTFUNC(__attribute__ ((deprecated)) type, name, args, a, b)
#define AL_INLINE_DEPRECATED(type, name, args, code) AL_INLINE(__attribute__ ((deprecated)) type, name, args, code)
#endif
#endif
#ifndef AL_ALIAS
#define AL_ALIAS(DECL, CALL) \
static __attribute__((unused)) __inline__ DECL \
{ \
return CALL; \
}
#endif
#ifndef AL_ALIAS_VOID_RET
#define AL_ALIAS_VOID_RET(DECL, CALL) \
static __attribute__((unused)) __inline__ void DECL \
{ \
CALL; \
}
#endif
#endif
/* the rest of this file fills in some default definitions of language
* features and helper functions, which are conditionalised so they will
* only be included if none of the above headers defined custom versions.
*/
#ifndef INLINE
#define INLINE
#endif
#ifndef ZERO_SIZE_ARRAY
#define ZERO_SIZE_ARRAY(type, name) type name[]
#endif
#ifndef AL_VAR
#define AL_VAR(type, name) extern type name
#endif
#ifndef AL_ARRAY
#define AL_ARRAY(type, name) extern type name[]
#endif
#ifndef AL_FUNC
#define AL_FUNC(type, name, args) type name args
#endif
#ifndef AL_PRINTFUNC
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args)
#endif
#ifndef AL_METHOD
#define AL_METHOD(type, name, args) type (*name) args
#endif
#ifndef AL_FUNCPTR
#define AL_FUNCPTR(type, name, args) extern type (*name) args
#endif
#ifndef AL_FUNCPTRARRAY
#define AL_FUNCPTRARRAY(type, name, args) extern type (*name[]) args
#endif
#ifndef AL_INLINE
#define AL_INLINE(type, name, args, code) type name args;
#endif
#ifndef AL_FUNC_DEPRECATED
#define AL_FUNC_DEPRECATED(type, name, args) AL_FUNC(type, name, args)
#define AL_PRINTFUNC_DEPRECATED(type, name, args, a, b) AL_PRINTFUNC(type, name, args, a, b)
#define AL_INLINE_DEPRECATED(type, name, args, code) AL_INLINE(type, name, args, code)
#endif
#ifndef AL_ALIAS
#define AL_ALIAS(DECL, CALL) \
static INLINE DECL \
{ \
return CALL; \
}
#endif
#ifndef AL_ALIAS_VOID_RET
#define AL_ALIAS_VOID_RET(DECL, CALL) \
static INLINE void DECL \
{ \
CALL; \
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* endian-independent 3-byte accessor macros */
#ifdef ALLEGRO_LITTLE_ENDIAN
#define READ3BYTES(p) ((*(unsigned char *)(p)) \
| (*((unsigned char *)(p) + 1) << 8) \
| (*((unsigned char *)(p) + 2) << 16))
#define WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c)), \
(*((unsigned char *)(p) + 1) = (c) >> 8), \
(*((unsigned char *)(p) + 2) = (c) >> 16))
#elif defined ALLEGRO_BIG_ENDIAN
#define READ3BYTES(p) ((*(unsigned char *)(p) << 16) \
| (*((unsigned char *)(p) + 1) << 8) \
| (*((unsigned char *)(p) + 2)))
#define WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c) >> 16), \
(*((unsigned char *)(p) + 1) = (c) >> 8), \
(*((unsigned char *)(p) + 2) = (c)))
#else
#error endianess not defined
#endif
/* generic versions of the video memory access helpers */
/* FIXME: why do we need macros for this? */
#define bmp_write16(addr, c) (*((uint16_t *)(addr)) = (c))
#define bmp_write32(addr, c) (*((uint32_t *)(addr)) = (c))
#define bmp_read16(addr) (*((uint16_t *)(addr)))
#define bmp_read32(addr) (*((uint32_t *)(addr)))
/* default random function definition */
#ifndef AL_RAND
#define AL_RAND() (rand())
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,309 @@
/*
* This source file has had its exported symbols prefixed with _al_ or _AL_
* for the Allegro project.
*/
/*
* This source file is part of the _al_bstring string library. This code was
* written by Paul Hsieh in 2002-2008, and is covered by the BSD open source
* license and the GPL. Refer to the accompanying documentation for details
* on usage and license.
*/
/*
* bstrlib.c
*
* This file is the core module for implementing the _al_bstring functions.
*/
#ifndef _AL_BSTRLIB_INCLUDE
#define _AL_BSTRLIB_INCLUDE
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#if !defined (BSTRLIB_VSNP_OK) && !defined (BSTRLIB_NOVSNP)
# if defined (__TURBOC__) && !defined (__BORLANDC__)
# define BSTRLIB_NOVSNP
# endif
#endif
#define _AL_BSTR_ERR (-1)
#define _AL_BSTR_OK (0)
#define _AL_BSTR_BS_BUFF_LENGTH_GET (0)
typedef struct _al_tagbstring * _al_bstring;
typedef const struct _al_tagbstring * _al_const_bstring;
/* Copy functions */
#define _al_cstr2bstr _al_bfromcstr
extern _al_bstring _al_bfromcstr (const char * str);
extern _al_bstring _al_bfromcstralloc (int mlen, const char * str);
extern _al_bstring _al_blk2bstr (const void * blk, int len);
extern char * _al_bstr2cstr (_al_const_bstring s, char z);
extern int _al_bcstrfree (char * s);
extern _al_bstring _al_bstrcpy (_al_const_bstring b1);
extern int _al_bassign (_al_bstring a, _al_const_bstring b);
extern int _al_bassignmidstr (_al_bstring a, _al_const_bstring b, int left, int len);
extern int _al_bassigncstr (_al_bstring a, const char * str);
extern int _al_bassignblk (_al_bstring a, const void * s, int len);
/* Destroy function */
extern int _al_bdestroy (_al_bstring b);
/* Space allocation hinting functions */
extern int _al_balloc (_al_bstring s, int len);
extern int _al_ballocmin (_al_bstring b, int len);
/* Substring extraction */
extern _al_bstring _al_bmidstr (_al_const_bstring b, int left, int len);
/* Various standard manipulations */
extern int _al_bconcat (_al_bstring b0, _al_const_bstring b1);
extern int _al_bconchar (_al_bstring b0, char c);
extern int _al_bcatcstr (_al_bstring b, const char * s);
extern int _al_bcatblk (_al_bstring b, const void * s, int len);
extern int _al_binsert (_al_bstring s1, int pos, _al_const_bstring s2, unsigned char fill);
extern int _al_binsertch (_al_bstring s1, int pos, int len, unsigned char fill);
extern int _al_breplace (_al_bstring b1, int pos, int len, _al_const_bstring b2, unsigned char fill);
extern int _al_bdelete (_al_bstring s1, int pos, int len);
extern int _al_bsetstr (_al_bstring b0, int pos, _al_const_bstring b1, unsigned char fill);
extern int _al_btrunc (_al_bstring b, int n);
/* Scan/search functions */
extern int _al_bstricmp (_al_const_bstring b0, _al_const_bstring b1);
extern int _al_bstrnicmp (_al_const_bstring b0, _al_const_bstring b1, int n);
extern int _al_biseqcaseless (_al_const_bstring b0, _al_const_bstring b1);
extern int _al_bisstemeqcaselessblk (_al_const_bstring b0, const void * blk, int len);
extern int _al_biseq (_al_const_bstring b0, _al_const_bstring b1);
extern int _al_bisstemeqblk (_al_const_bstring b0, const void * blk, int len);
extern int _al_biseqcstr (_al_const_bstring b, const char * s);
extern int _al_biseqcstrcaseless (_al_const_bstring b, const char * s);
extern int _al_bstrcmp (_al_const_bstring b0, _al_const_bstring b1);
extern int _al_bstrncmp (_al_const_bstring b0, _al_const_bstring b1, int n);
extern int _al_binstr (_al_const_bstring s1, int pos, _al_const_bstring s2);
extern int _al_binstrr (_al_const_bstring s1, int pos, _al_const_bstring s2);
extern int _al_binstrcaseless (_al_const_bstring s1, int pos, _al_const_bstring s2);
extern int _al_binstrrcaseless (_al_const_bstring s1, int pos, _al_const_bstring s2);
extern int _al_bstrchrp (_al_const_bstring b, int c, int pos);
extern int _al_bstrrchrp (_al_const_bstring b, int c, int pos);
#define _al_bstrchr(b,c) _al_bstrchrp ((b), (c), 0)
#define _al_bstrrchr(b,c) _al_bstrrchrp ((b), (c), _al_blength(b)-1)
extern int _al_binchr (_al_const_bstring b0, int pos, _al_const_bstring b1);
extern int _al_binchrr (_al_const_bstring b0, int pos, _al_const_bstring b1);
extern int _al_bninchr (_al_const_bstring b0, int pos, _al_const_bstring b1);
extern int _al_bninchrr (_al_const_bstring b0, int pos, _al_const_bstring b1);
extern int _al_bfindreplace (_al_bstring b, _al_const_bstring find, _al_const_bstring repl, int pos);
extern int _al_bfindreplacecaseless (_al_bstring b, _al_const_bstring find, _al_const_bstring repl, int pos);
/* List of string container functions */
struct _al_bstrList {
int qty, mlen;
_al_bstring * entry;
};
extern struct _al_bstrList * _al_bstrListCreate (void);
extern int _al_bstrListDestroy (struct _al_bstrList * sl);
extern int _al_bstrListAlloc (struct _al_bstrList * sl, int msz);
extern int _al_bstrListAllocMin (struct _al_bstrList * sl, int msz);
/* String split and join functions */
extern struct _al_bstrList * _al_bsplit (_al_const_bstring str, unsigned char splitChar);
extern struct _al_bstrList * _al_bsplits (_al_const_bstring str, _al_const_bstring splitStr);
extern struct _al_bstrList * _al_bsplitstr (_al_const_bstring str, _al_const_bstring splitStr);
extern _al_bstring _al_bjoin (const struct _al_bstrList * bl, _al_const_bstring sep);
extern int _al_bsplitcb (_al_const_bstring str, unsigned char splitChar, int pos,
int (* cb) (void * parm, int ofs, int len), void * parm);
extern int _al_bsplitscb (_al_const_bstring str, _al_const_bstring splitStr, int pos,
int (* cb) (void * parm, int ofs, int len), void * parm);
extern int _al_bsplitstrcb (_al_const_bstring str, _al_const_bstring splitStr, int pos,
int (* cb) (void * parm, int ofs, int len), void * parm);
/* Miscellaneous functions */
extern int _al_bpattern (_al_bstring b, int len);
extern int _al_btoupper (_al_bstring b);
extern int _al_btolower (_al_bstring b);
extern int _al_bltrimws (_al_bstring b);
extern int _al_brtrimws (_al_bstring b);
extern int _al_btrimws (_al_bstring b);
#if !defined (BSTRLIB_NOVSNP)
extern _al_bstring _al_bformat (const char * fmt, ...);
extern int _al_bformata (_al_bstring b, const char * fmt, ...);
extern int _al_bassignformat (_al_bstring b, const char * fmt, ...);
extern int _al_bvcformata (_al_bstring b, int count, const char * fmt, va_list arglist);
#define _al_bvformata(ret, b, fmt, lastarg) { \
_al_bstring bstrtmp_b = (b); \
const char * bstrtmp_fmt = (fmt); \
int bstrtmp_r = _AL_BSTR_ERR, bstrtmp_sz = 16; \
for (;;) { \
va_list bstrtmp_arglist; \
va_start (bstrtmp_arglist, lastarg); \
bstrtmp_r = _al_bvcformata (bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, bstrtmp_arglist); \
va_end (bstrtmp_arglist); \
if (bstrtmp_r >= 0) { /* Everything went ok */ \
bstrtmp_r = _AL_BSTR_OK; \
break; \
} else if (-bstrtmp_r <= bstrtmp_sz) { /* A real error? */ \
bstrtmp_r = _AL_BSTR_ERR; \
break; \
} \
bstrtmp_sz = -bstrtmp_r; /* Doubled or target size */ \
} \
ret = bstrtmp_r; \
}
#endif
typedef int (*_al_bNgetc) (void *parm);
typedef size_t (* _al_bNread) (void *buff, size_t elsize, size_t nelem, void *parm);
/* Input functions */
extern _al_bstring _al_bgets (_al_bNgetc getcPtr, void * parm, char terminator);
extern _al_bstring _al_bread (_al_bNread readPtr, void * parm);
extern int _al_bgetsa (_al_bstring b, _al_bNgetc getcPtr, void * parm, char terminator);
extern int _al_bassigngets (_al_bstring b, _al_bNgetc getcPtr, void * parm, char terminator);
extern int _al_breada (_al_bstring b, _al_bNread readPtr, void * parm);
/* Stream functions */
extern struct _al_bStream * _al_bsopen (_al_bNread readPtr, void * parm);
extern void * _al_bsclose (struct _al_bStream * s);
extern int _al_bsbufflength (struct _al_bStream * s, int sz);
extern int _al_bsreadln (_al_bstring b, struct _al_bStream * s, char terminator);
extern int _al_bsreadlns (_al_bstring r, struct _al_bStream * s, _al_const_bstring term);
extern int _al_bsread (_al_bstring b, struct _al_bStream * s, int n);
extern int _al_bsreadlna (_al_bstring b, struct _al_bStream * s, char terminator);
extern int _al_bsreadlnsa (_al_bstring r, struct _al_bStream * s, _al_const_bstring term);
extern int _al_bsreada (_al_bstring b, struct _al_bStream * s, int n);
extern int _al_bsunread (struct _al_bStream * s, _al_const_bstring b);
extern int _al_bspeek (_al_bstring r, const struct _al_bStream * s);
extern int _al_bssplitscb (struct _al_bStream * s, _al_const_bstring splitStr,
int (* cb) (void * parm, int ofs, _al_const_bstring entry), void * parm);
extern int _al_bssplitstrcb (struct _al_bStream * s, _al_const_bstring splitStr,
int (* cb) (void * parm, int ofs, _al_const_bstring entry), void * parm);
extern int _al_bseof (const struct _al_bStream * s);
#ifndef __al_tagbstring_defined
#define __al_tagbstring_defined
struct _al_tagbstring {
int mlen;
int slen;
unsigned char * data;
};
#endif
/* Accessor macros */
#define _al_blengthe(b, e) (((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen))
#define _al_blength(b) (_al_blengthe ((b), 0))
#define _al_bdataofse(b, o, e) (((b) == (void *)0 || (b)->data == (void*)0) ? (char *)(e) : ((char *)(b)->data) + (o))
#define _al_bdataofs(b, o) (_al_bdataofse ((b), (o), (void *)0))
#define _al_bdatae(b, e) (_al_bdataofse (b, 0, e))
#define _al_bdata(b) (_al_bdataofs (b, 0))
#define _al_bchare(b, p, e) ((((unsigned)(p)) < (unsigned)_al_blength(b)) ? ((b)->data[(p)]) : (e))
#define _al_bchar(b, p) _al_bchare ((b), (p), '\0')
/* Static constant string initialization macro */
#define _al_bsStaticMlen(q,m) {(m), (int) sizeof(q)-1, (unsigned char *) ("" q "")}
#if defined(_MSC_VER)
# define _al_bsStatic(q) _al_bsStaticMlen(q,-32)
#endif
#ifndef _al_bsStatic
# define _al_bsStatic(q) _al_bsStaticMlen(q,-__LINE__)
#endif
/* Static constant block parameter pair */
#define _al_bsStaticBlkParms(q) ((void *)("" q "")), ((int) sizeof(q)-1)
/* Reference building macros */
#define _al_cstr2tbstr _al_btfromcstr
#define _al_btfromcstr(t,s) { \
(t).data = (unsigned char *) (s); \
(t).slen = ((t).data) ? ((int) (strlen) ((char *)(t).data)) : 0; \
(t).mlen = -1; \
}
#define _al_blk2tbstr(t,s,l) { \
(t).data = (unsigned char *) (s); \
(t).slen = l; \
(t).mlen = -1; \
}
#define _al_btfromblk(t,s,l) _al_blk2tbstr(t,s,l)
#define _al_bmid2tbstr(t,b,p,l) { \
_al_const_bstring bstrtmp_s = (b); \
if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \
int bstrtmp_left = (p); \
int bstrtmp_len = (l); \
if (bstrtmp_left < 0) { \
bstrtmp_len += bstrtmp_left; \
bstrtmp_left = 0; \
} \
if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) \
bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
if (bstrtmp_len <= 0) { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} else { \
(t).data = bstrtmp_s->data + bstrtmp_left; \
(t).slen = bstrtmp_len; \
} \
} else { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} \
(t).mlen = -__LINE__; \
}
#define _al_btfromblkltrimws(t,s,l) { \
int bstrtmp_idx = 0, bstrtmp_len = (l); \
unsigned char * bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \
if (!isspace (bstrtmp_s[bstrtmp_idx])) break; \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len - bstrtmp_idx; \
(t).mlen = -__LINE__; \
}
#define _al_btfromblkrtrimws(t,s,l) { \
int bstrtmp_len = (l) - 1; \
unsigned char * bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_len >= 0; bstrtmp_len--) { \
if (!isspace (bstrtmp_s[bstrtmp_len])) break; \
} \
} \
(t).data = bstrtmp_s; \
(t).slen = bstrtmp_len + 1; \
(t).mlen = -__LINE__; \
}
#define _al_btfromblktrimws(t,s,l) { \
int bstrtmp_idx = 0, bstrtmp_len = (l) - 1; \
unsigned char * bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \
if (!isspace (bstrtmp_s[bstrtmp_idx])) break; \
} \
for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
if (!isspace (bstrtmp_s[bstrtmp_len])) break; \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
(t).mlen = -__LINE__; \
}
/* Write protection macros */
#define _al_bwriteprotect(t) { if ((t).mlen >= 0) (t).mlen = -1; }
#define _al_bwriteallow(t) { if ((t).mlen == -1) (t).mlen = (t).slen + ((t).slen == 0); }
#define _al_biswriteprotected(t) ((t).mlen <= 0)
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,91 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Joystick routines.
*
* See readme.txt for copyright information.
*/
#ifndef __al_included_allegro5_joystick_h
#define __al_included_allegro5_joystick_h
#include "allegro5/base.h"
#include "allegro5/events.h"
#ifdef __cplusplus
extern "C" {
#endif
/* internal values */
#define _AL_MAX_JOYSTICK_AXES 3
#define _AL_MAX_JOYSTICK_STICKS 8
#define _AL_MAX_JOYSTICK_BUTTONS 32
/* Type: ALLEGRO_JOYSTICK
*/
typedef struct ALLEGRO_JOYSTICK ALLEGRO_JOYSTICK;
/* Type: ALLEGRO_JOYSTICK_STATE
*/
typedef struct ALLEGRO_JOYSTICK_STATE ALLEGRO_JOYSTICK_STATE;
struct ALLEGRO_JOYSTICK_STATE
{
struct {
float axis[_AL_MAX_JOYSTICK_AXES]; /* -1.0 to 1.0 */
} stick[_AL_MAX_JOYSTICK_STICKS];
int button[_AL_MAX_JOYSTICK_BUTTONS]; /* 0 to 32767 */
};
/* Enum: ALLEGRO_JOYFLAGS
*/
enum ALLEGRO_JOYFLAGS
{
ALLEGRO_JOYFLAG_DIGITAL = 0x01,
ALLEGRO_JOYFLAG_ANALOGUE = 0x02
};
AL_FUNC(bool, al_install_joystick, (void));
AL_FUNC(void, al_uninstall_joystick, (void));
AL_FUNC(bool, al_is_joystick_installed, (void));
AL_FUNC(bool, al_reconfigure_joysticks, (void));
AL_FUNC(int, al_get_num_joysticks, (void));
AL_FUNC(ALLEGRO_JOYSTICK *, al_get_joystick, (int joyn));
AL_FUNC(void, al_release_joystick, (ALLEGRO_JOYSTICK *));
AL_FUNC(bool, al_get_joystick_active, (ALLEGRO_JOYSTICK *));
AL_FUNC(const char*, al_get_joystick_name, (ALLEGRO_JOYSTICK *));
AL_FUNC(int, al_get_joystick_num_sticks, (ALLEGRO_JOYSTICK *));
AL_FUNC(int, al_get_joystick_stick_flags, (ALLEGRO_JOYSTICK *, int stick)); /* junk? */
AL_FUNC(const char*, al_get_joystick_stick_name, (ALLEGRO_JOYSTICK *, int stick));
AL_FUNC(int, al_get_joystick_num_axes, (ALLEGRO_JOYSTICK *, int stick));
AL_FUNC(const char*, al_get_joystick_axis_name, (ALLEGRO_JOYSTICK *, int stick, int axis));
AL_FUNC(int, al_get_joystick_num_buttons, (ALLEGRO_JOYSTICK *));
AL_FUNC(const char*, al_get_joystick_button_name, (ALLEGRO_JOYSTICK *, int buttonn));
AL_FUNC(void, al_get_joystick_state, (ALLEGRO_JOYSTICK *, ALLEGRO_JOYSTICK_STATE *ret_state));
AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_joystick_event_source, (void));
#ifdef __cplusplus
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More