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

14
.gitignore vendored
View File

@ -1 +1,15 @@
.vscode .vscode
*.exe
*.txt
*.a
*.dll
!allegro_acodec-5.0.10-md.dll
!allegro_audio-5.0.10-md.dll
!allegro_image-5.0.10-md.dll
!allegro_primitives-5.0.10-md.dll
!allegro-5.0.10-md.dll
!liballegro_audio-5.0.10-md.a
!liballegro_acodec-5.0.10-md.a
!liballegro_image-5.0.10-md.a
!liballegro_dialog-5.0.10-md.a
!liballegro_primitives-5.0.10-md.a

797
Game.c Normal file
View File

@ -0,0 +1,797 @@
/*
Author: Asrın "Syntriax" Doğan
Date: 25.08.2019
Mail: asrindogan99@gmail.com
*/
#include <stdio.h>
#include <math.h>
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_audio.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_acodec.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_image.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_primitives.h"
#define playerSpeed 7.5
#define bulletSpeed 25
#define numberSize 5
#define scoreDigitLimit 10
#define enemyLimiter 8
#define initialEnemyLimit 3
typedef struct
{
float x;
float y;
} Vector2D;
struct
{
Vector2D position;
char health;
float moveSpeed;
byte lookDirection;
int shootPerSecond;
float shootCooldown;
unsigned int killedEnemyCount;
unsigned int score;
ALLEGRO_BITMAP *playerImage;
} player;
typedef struct
{
Vector2D position;
char health;
float moveSpeed;
float fireCooldown;
Vector2D velocity;
} Enemy;
struct
{
int enemyLimit;
int enemyCount;
Enemy *enemyArray;
} enemies;
typedef struct
{
char isEnemyBullet;
Vector2D position;
Vector2D velocity;
} Bullet;
struct
{
int bulletCount;
Bullet *bulletArray;
} bullets;
void SpawnEnemies();
void CheckBullets();
void RemoveBulletAtIndex(int index);
void RemoveEnemyAtIndex(int index);
void CheckEnemies();
void MoveEnemies();
void InitializeEnemies();
void DestroyGame();
void DrawObject(Vector2D position, ALLEGRO_BITMAP *image, int flag);
void DrawSizedObject(Vector2D position, ALLEGRO_BITMAP *image, int flag, float objectSizeMultiplier);
void DrawScreen();
void DrawScore();
void DrawNumber(Vector2D position, int number);
void Inputs();
void PlayerMovement();
void BulletMovement();
void ShootSoundEffect();
void DieSoundEffect();
void PlayerShoot();
void EnemyShoot();
void BulletCollisions();
void Update();
void DestroyGameWindow();
float VectorMagnitude(Vector2D vector);
float VectorDistance(Vector2D vectorFirst, Vector2D vectorSecond);
byte isVectorExceedingLimits(Vector2D vector, Vector2D limits);
byte CheckCollision(Vector2D *firstPos, Vector2D *secondPos, ALLEGRO_BITMAP *firstMap, ALLEGRO_BITMAP *secondMap);
char InitializeGameWindow();
char InitializeGame();
char DealDamage(char *health, int damage);
Vector2D NormalizeVector(Vector2D vector);
ALLEGRO_KEYBOARD_STATE keyboardState;
ALLEGRO_DISPLAY *display;
ALLEGRO_DISPLAY_MODE disp_data;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_TIMER *timer = NULL;
ALLEGRO_COLOR backgroundColor;
ALLEGRO_BITMAP *gameOverImage;
ALLEGRO_SAMPLE *shootSound;
ALLEGRO_SAMPLE_ID shootSoundID;
ALLEGRO_BITMAP *enemyImage;
ALLEGRO_BITMAP *enemyBulletImage;
ALLEGRO_SAMPLE *enemyDieSound;
ALLEGRO_SAMPLE_ID enemyDieSoundID;
ALLEGRO_BITMAP *numberTable;
const char *displayName = "Syn Game";
const Vector2D referenceScreenDimensions = {160, 90};
Vector2D screenDimensions = {0, 0};
Vector2D scorePosition = {0, 0};
Vector2D highScorePosition = {0, 0};
float sizeMultiplier;
float timeFromStart;
const float FPS = 60;
double deltaTime;
unsigned int enemyRespawnCounter = 0;
Vector2D input;
byte isRestart = 0;
byte isRunning = 1;
byte isGameStarted = 0;
byte isGameOver = 0;
void Update()
{
al_get_keyboard_state(&keyboardState);
if(al_key_down(&keyboardState, ALLEGRO_KEY_ESCAPE))
isRunning = 0;
al_clear_to_color(backgroundColor);
if(!isGameOver)
{
printf("Inputs();\n");
Inputs();
if(al_key_down(&keyboardState, ALLEGRO_KEY_F))
player.score += 1000;
// enemies.enemyLimit++;
printf("PlayerMovement();\n");
PlayerMovement();
printf("EnemyShoot();\n");
EnemyShoot();
printf("BulletCollisions();\n");
BulletCollisions();
if(player.shootCooldown < 0.0f)
{
if(al_key_down(&keyboardState, ALLEGRO_KEY_SPACE))
{
printf("PlayerShoot();\n");
PlayerShoot();
}
}
else
player.shootCooldown -= deltaTime;
timeFromStart += deltaTime;
player.score = (int)(timeFromStart * timeFromStart) * player.killedEnemyCount;
if(enemies.enemyLimit != enemyLimiter)
{
enemies.enemyLimit = initialEnemyLimit + (int)(timeFromStart / 10);
if(enemies.enemyCount > enemyLimiter)
enemies.enemyLimit = enemyLimiter;
}
}
else if(al_key_down(&keyboardState, ALLEGRO_KEY_R))
isRestart = 1;
printf("CheckEnemies();\n");
CheckEnemies();
printf("MoveEnemies();\n");
MoveEnemies();
printf("CheckBullets();\n");
CheckBullets();
printf("BulletMovement();\n");
BulletMovement();
printf("DrawScreen();\n");
DrawScreen();
al_flip_display();
}
int main(int argc, char **argv)
{
if(InitializeGameWindow() == 0)
return 0;
do
{
if(InitializeGame() == 0)
return 0;
while (isRunning && !isRestart)
{
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
isRunning = 0;
if(ev.type == ALLEGRO_EVENT_TIMER)
Update();
}
DestroyGame();
} while (isRestart);
DestroyGameWindow();
getchar();
return 0;
}
Vector2D NormalizeVector(Vector2D vector)
{
Vector2D normalizedVector;
float magnitude = sqrt(vector.x * vector.x + vector.y * vector.y);
if(vector.x == 0.0 && vector.y == 0.0)
return vector;
normalizedVector.x = vector.x / magnitude;
normalizedVector.y = vector.y / magnitude;
return normalizedVector;
}
float VectorMagnitude(Vector2D vector)
{
return sqrt(vector.x * vector.x + vector.y * vector.y);
}
float VectorDistance(Vector2D vectorFirst, Vector2D vectorSecond)
{
Vector2D difference;
difference.x = abs(vectorFirst.x - vectorSecond.x);
difference.y = abs(vectorFirst.y - vectorSecond.y);
return VectorMagnitude(difference);
}
byte isVectorExceedingLimits(Vector2D vector, Vector2D limits)
{
byte result = vector.x > limits.x || vector.x < 0 || vector.y > limits.y || vector.y < 0;
return result;
}
byte CheckCollision(Vector2D *firstPos, Vector2D *secondPos, ALLEGRO_BITMAP *firstMap, ALLEGRO_BITMAP *secondMap)
{
Vector2D firstImageSize;
Vector2D secondImageSize;
byte result;
float minDistance;
float distance;
firstImageSize.x = (float)al_get_bitmap_width(firstMap);
firstImageSize.y = (float)al_get_bitmap_height(firstMap);
secondImageSize.x = (float)al_get_bitmap_width(secondMap);
secondImageSize.y = (float)al_get_bitmap_height(secondMap);
minDistance = firstImageSize.x > firstImageSize.y ? firstImageSize.y : firstImageSize.x;
minDistance += secondImageSize.x > secondImageSize.y ? secondImageSize.y : secondImageSize.x;
minDistance /= 2;
minDistance *= sizeMultiplier;
distance = VectorDistance(*firstPos, *secondPos);
result = distance <= minDistance;
return result;
}
char InitializeGameWindow()
{
float x = 0.0f;
float y = 0.0f;
if(!al_init() ||
!al_init_primitives_addon() ||
!al_init_image_addon() ||
!al_install_audio() ||
!al_init_acodec_addon() ||
!al_reserve_samples(1))
return 0;
al_get_display_mode(al_get_num_display_modes() - 1, &disp_data);
al_set_new_display_flags(ALLEGRO_FULLSCREEN);
x = disp_data.width;
y = disp_data.height;
/* x = 1600; */
/* y = 900; */
screenDimensions = (Vector2D){x, y};
scorePosition = (Vector2D){x * (float)0.05, y * (float)0.05};
highScorePosition = (Vector2D){x * (float)0.05, y * (float)0.95};
sizeMultiplier = screenDimensions.x / referenceScreenDimensions.x;
display = al_create_display(screenDimensions.x, screenDimensions.y);
if(display == NULL)
return 0;
if(!al_install_keyboard())
return 0;
deltaTime = 1.0 / FPS;
timer = al_create_timer(deltaTime);
event_queue = al_create_event_queue();
if(event_queue == NULL)
{
printf("Event Queue Error");
al_destroy_display(display);
al_destroy_timer(timer);
return 0;
}
al_register_event_source(event_queue, al_get_keyboard_event_source());
al_register_event_source(event_queue, al_get_display_event_source(display));
al_register_event_source(event_queue, al_get_timer_event_source(timer));
al_start_timer(timer);
al_set_window_title(display, displayName);
backgroundColor.a = 1;
backgroundColor.a = 0;
backgroundColor.a = 0;
backgroundColor.a = 0;
}
char InitializeGame()
{
shootSound = al_load_sample("Sounds/Shoot.wav");
enemyDieSound = al_load_sample("Sounds/Die.wav");
InitializeEnemies();
/* Player Initialization */
player.position.x = screenDimensions.x / 2;
player.position.y = screenDimensions.y / 2;
player.moveSpeed = playerSpeed;
player.shootPerSecond = 10;
player.health = 100;
player.playerImage = al_load_bitmap("Images/Player.png");
bullets.bulletCount = 0;
bullets.bulletArray = (Bullet *) malloc(sizeof(Bullet) * bullets.bulletCount);
if(player.playerImage == NULL ||
shootSound == NULL ||
enemyDieSound == NULL)
return 0;
isRunning = 1;
isRestart = 0;
isGameOver = 0;
isGameStarted = 0;
timeFromStart = 0;
player.killedEnemyCount = 0;
return 1;
}
void InitializeEnemies()
{
int i = 0;
enemies.enemyLimit = initialEnemyLimit;
enemies.enemyCount = 0;
enemies.enemyArray = (Enemy *) malloc(sizeof(Enemy) * enemies.enemyCount);
enemyImage = al_load_bitmap("Images/Enemy.png");
numberTable = al_load_bitmap("Images/Numbers.png");
enemyBulletImage = al_load_bitmap("Images/Bullet.png");
gameOverImage = al_load_bitmap("Images/GameOver.png");
SpawnEnemies();
}
void SpawnEnemies()
{
if(enemyRespawnCounter > 10000)
enemyRespawnCounter = 0;
Vector2D enemySpawnVector;
Vector2D enemyvelocity;
Enemy *enemy;
float speed;
int randomNumber;
while (enemies.enemyCount < enemies.enemyLimit)
{
srand(time(0) + enemyRespawnCounter);
enemies.enemyCount++;
randomNumber = rand() * enemies.enemyCount;
enemies.enemyArray = (Enemy *) realloc(enemies.enemyArray, sizeof(Enemy) * enemies.enemyCount);
enemyvelocity.x = (float)(randomNumber % 20000) / 10000;
enemyvelocity.y = (float)(randomNumber % 2000) / 1000;
enemyvelocity.x *= randomNumber % 2 == 0 ? -1 : 1;
enemyvelocity.y *= randomNumber % 4 >= 2 ? -1 : 1;
speed = (float)(randomNumber % 500 / 100 + 2);
enemy = (enemies.enemyArray + enemies.enemyCount - 1);
enemy -> velocity = NormalizeVector(enemyvelocity);
enemy -> moveSpeed = speed;
enemySpawnVector.x = enemyvelocity.x > 0 ? 0 : screenDimensions.x;
enemySpawnVector.y = enemyvelocity.y > 0 ? 0 : screenDimensions.y;
enemy -> position = enemySpawnVector;
enemy -> fireCooldown = 01.0 / (rand() % 5) + 2.0;
enemyRespawnCounter++;
}
}
void CheckBullets()
{
int i = 0;
int j = 0;
for (; i < bullets.bulletCount; i++)
{
if(isVectorExceedingLimits((bullets.bulletArray + i) -> position, screenDimensions))
{
for (j = i; j < bullets.bulletCount - 1; j++)
*(bullets.bulletArray + j) = *(bullets.bulletArray + j + 1);
bullets.bulletCount--;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
}
}
}
void RemoveBulletAtIndex(int index)
{
printf("RemoveBulletAtIndex();\n");
for (; index < bullets.bulletCount - 1; index++)
*(bullets.bulletArray + index) = *(bullets.bulletArray + index + 1);
bullets.bulletCount--;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
}
void RemoveEnemyAtIndex(int index)
{
printf("RemoveEnemyAtIndex();\n");
for (; index < enemies.enemyCount - 1; index++)
*(enemies.enemyArray + index) = *(enemies.enemyArray + index + 1);
enemies.enemyCount--;
enemies.enemyArray = (Enemy *) realloc(enemies.enemyArray, sizeof(Enemy) * enemies.enemyCount);
printf("New Enemy Count = %d\n", enemies.enemyCount);
DieSoundEffect();
}
void CheckEnemies()
{
int i = 0;
for (; i < enemies.enemyCount; i++)
if(isVectorExceedingLimits((enemies.enemyArray + i) -> position, screenDimensions))
RemoveEnemyAtIndex(i);
SpawnEnemies();
}
void MoveEnemies()
{
int i = 0;
Vector2D velocity;
float speed;
for (; i < enemies.enemyCount; i++)
{
speed = (enemies.enemyArray + i) -> moveSpeed;
velocity = (enemies.enemyArray + i) -> velocity;
(enemies.enemyArray + i) -> position.x += velocity.x * speed;
(enemies.enemyArray + i) -> position.y += velocity.y * speed;
}
}
void DrawObject(Vector2D position, ALLEGRO_BITMAP *image, int flag)
{
Vector2D InstantiateSize;
InstantiateSize.x = (float)al_get_bitmap_width(image);
InstantiateSize.y = (float)al_get_bitmap_height(image);
al_draw_scaled_bitmap(image,
0, 0, InstantiateSize.x, InstantiateSize.y,
position.x - InstantiateSize.x / 2 * sizeMultiplier, position.y - InstantiateSize.y / 2 * sizeMultiplier,
InstantiateSize.x * sizeMultiplier, InstantiateSize.y * sizeMultiplier, flag);
}
void DrawNumber(Vector2D position, int number)
{
Vector2D InstantiateSize;
float numberFactor;
InstantiateSize.x = (float)al_get_bitmap_width(numberTable);
InstantiateSize.y = (float)al_get_bitmap_height(numberTable);
numberFactor = InstantiateSize.x / 10.0;
al_draw_scaled_bitmap(numberTable,
numberFactor * number, 0, numberFactor, InstantiateSize.y,
position.x - numberFactor / 2 * sizeMultiplier, position.y - InstantiateSize.y / 2 * sizeMultiplier,
numberFactor * sizeMultiplier, InstantiateSize.y * sizeMultiplier, 0);
}
void DrawSizedObject(Vector2D position, ALLEGRO_BITMAP *image, int flag, float objectSizeMultiplier)
{
Vector2D InstantiateSize;
float sizeFactor = sizeMultiplier * objectSizeMultiplier;
InstantiateSize.x = (float)al_get_bitmap_width(image);
InstantiateSize.y = (float)al_get_bitmap_height(image);
al_draw_scaled_bitmap(image,
0, 0, InstantiateSize.x, InstantiateSize.y,
position.x - InstantiateSize.x / 2 * sizeFactor, position.y - InstantiateSize.y / 2 * sizeFactor,
InstantiateSize.x * sizeFactor, InstantiateSize.y * sizeFactor, flag);
}
void DrawScreen()
{
int i = 0;
Vector2D halfScreen = {screenDimensions.x / 2, screenDimensions.y / 2};
/* Enemy Draw */
for (i = 0; i < enemies.enemyCount; i++)
DrawObject((enemies.enemyArray + i) -> position, enemyImage, (enemies.enemyArray + i) -> velocity.x > 0 ? ALLEGRO_FLIP_HORIZONTAL : 0 );
/* Bullet Draw */
for (i = 0; i < bullets.bulletCount; i++)
DrawObject((bullets.bulletArray + i) -> position, enemyBulletImage, 0);
/* Player Draw */
if(!isGameOver)
DrawObject(player.position, player.playerImage, player.lookDirection == 1 ? ALLEGRO_FLIP_HORIZONTAL : 0);
else
DrawObject(halfScreen, gameOverImage, 0);
DrawScore();
}
void DrawScore()
{
unsigned int processedScore = player.score;
char digit;
Vector2D spawnPosition;
int i = scoreDigitLimit;
/*while (processedScore >= 1 && i > 0)*/
while (i > 0)
{
spawnPosition = scorePosition;
/* numberSize + 1 is because 1 pixel space between digits */
spawnPosition.x += sizeMultiplier * (numberSize + 1) * i;
digit = processedScore % 10;
processedScore = (int)(processedScore / 10);
DrawNumber(spawnPosition, digit);
i--;
}
}
void Inputs()
{
input.x = 0;
input.y = 0;
if(al_key_down(&keyboardState, ALLEGRO_KEY_UP))
input.y = -1;
else if(al_key_down(&keyboardState, ALLEGRO_KEY_DOWN))
input.y = 1;
if(al_key_down(&keyboardState, ALLEGRO_KEY_RIGHT))
{
input.x = 1;
player.lookDirection = input.x;
}
else if(al_key_down(&keyboardState, ALLEGRO_KEY_LEFT))
{
input.x = -1;
player.lookDirection = input.x;
}
input = NormalizeVector(input);
}
void PlayerMovement()
{
player.position.x += input.x * player.moveSpeed;
player.position.y += input.y * player.moveSpeed;
}
char DealDamage(char *health, int damage)
{
int healthInt = *health;
*health -= damage;
return healthInt <= 0;
}
void BulletMovement()
{
Bullet *bullet;
int i = 0;
for (; i < bullets.bulletCount; i++)
{
bullet = (bullets.bulletArray + i);
bullet -> position.x += bullet -> velocity.x;
bullet -> position.y += bullet -> velocity.y;
}
}
void ShootSoundEffect()
{
printf("ShootSoundEffect();\n");
al_stop_sample(&shootSoundID);
al_play_sample(shootSound, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, &shootSoundID);
}
void DieSoundEffect()
{
printf("DieSoundEffect();\n");
al_stop_sample(&enemyDieSoundID);
al_play_sample(enemyDieSound, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, &enemyDieSoundID);
}
void PlayerShoot()
{
Vector2D shootDir;
Bullet *newBullet;
float offset = (al_get_bitmap_width(player.playerImage) + al_get_bitmap_width(enemyBulletImage) * 2.0 * sizeMultiplier);
if(player.lookDirection != 1)
offset = -offset;
shootDir.x = player.lookDirection == 1 ? bulletSpeed : -bulletSpeed;
shootDir.y = 0;
player.shootCooldown = 1 / (float)player.shootPerSecond;
bullets.bulletCount++;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
newBullet = (bullets.bulletArray + bullets.bulletCount - 1);
newBullet -> position = player.position;
newBullet -> position.x += offset;
newBullet -> velocity = shootDir;
newBullet -> isEnemyBullet = 0;
ShootSoundEffect();
}
void EnemyShoot()
{
Vector2D shootDir;
Vector2D normalizedVec;
Enemy *enemy;
Bullet *bullet;
int i;
float offset = (al_get_bitmap_width(player.playerImage) + al_get_bitmap_width(enemyBulletImage) * 2.0 * sizeMultiplier);
for (i = 0; i < enemies.enemyCount; i++)
{
srand(time(0) + enemyRespawnCounter++);
enemy = (enemies.enemyArray + i);
if(enemy -> fireCooldown > 0.0)
enemy -> fireCooldown -= deltaTime;
else
{
shootDir = (Vector2D){player.position.x - enemy -> position.x , player.position.y - enemy -> position.y};
shootDir = NormalizeVector(shootDir);
normalizedVec = shootDir;
shootDir = (Vector2D){shootDir.x * bulletSpeed, shootDir.y * bulletSpeed};
enemy -> fireCooldown = 1.0 / (rand() % 5) + 2.0;
bullets.bulletCount++;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
bullet = (bullets.bulletArray + bullets.bulletCount - 1);
bullet -> position = enemy -> position;
bullet -> position.x += normalizedVec.x * offset;
bullet -> position.y += normalizedVec.y * offset;
bullet -> velocity = shootDir;
bullet -> isEnemyBullet = 1;
ShootSoundEffect();
}
}
}
void BulletCollisions()
{
Bullet *bullet;
Enemy *enemy;
int bulletCounter = 0;
int enemyCounter = 0;
int i = 0;
byte isCheckPlayerEnemyInteraction = 1;
for (bulletCounter = 0; bulletCounter < bullets.bulletCount; bulletCounter++)
{
bullet = (bullets.bulletArray + bulletCounter);
printf("Player-Bullet\n");
if(bullet -> isEnemyBullet == 1 && CheckCollision(
&bullet -> position,
&player.position,
enemyBulletImage,
player.playerImage
))
{
RemoveBulletAtIndex(bulletCounter);
bulletCounter--;
if(DealDamage(&player.health, 25))
isGameOver = 1;
break;
}
printf("Enemy-Bullet\n");
for (enemyCounter = 0; enemyCounter < enemies.enemyCount; enemyCounter++)
{
enemy = (enemies.enemyArray + enemyCounter);
printf("Enemy-Bullet|enemyCounter\n");
printf("Enemy Count = %d\n", enemyCounter);
printf("Enemy Counter = %d\n", enemies.enemyCount);
printf("Bullet Count = %d\n", bulletCounter);
printf("Bullet Counter = %d\n", bullets.bulletCount);
if(bullet -> isEnemyBullet == 0 && CheckCollision(
&bullet -> position,
&enemy -> position,
enemyBulletImage,
enemyImage
))
{
printf("Enemy-Bullet|EnemyRemove\n");
RemoveEnemyAtIndex(enemyCounter);
enemyCounter--;
printf("Enemy-Bullet|BulletRemove\n");
RemoveBulletAtIndex(bulletCounter);
bulletCounter--;
player.killedEnemyCount++;
break;
}
printf("Enemy-Player\n");
if( isCheckPlayerEnemyInteraction == 1 &&
CheckCollision(
&enemy -> position,
&player.position,
enemyImage,
player.playerImage
))
{
RemoveEnemyAtIndex(enemyCounter);
enemyCounter--;
if(DealDamage(&player.health, 25))
isGameOver = 1;
isCheckPlayerEnemyInteraction = 0;
}
}
}
}
void DestroyGame()
{
al_destroy_bitmap(enemyImage);
al_destroy_bitmap(enemyBulletImage);
al_destroy_bitmap(gameOverImage);
al_destroy_bitmap(numberTable);
al_destroy_sample(shootSound);
al_destroy_sample(enemyDieSound);
al_destroy_bitmap(player.playerImage);
free(enemies.enemyArray);
}
void DestroyGameWindow()
{
al_destroy_display(display);
al_uninstall_keyboard();
}

BIN
Images/Bullet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

BIN
Images/Enemy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

BIN
Images/GameOver.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

BIN
Images/Numbers.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

BIN
Images/Player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

View File

@ -1 +1,8 @@
# SynGame # SynGame
Simple Shoot 'Em Up game.
Exe without console window
g++ SynGame.c -o SynGame.exe "allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_audio-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_acodec-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_image-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_dialog-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_primitives-5.0.10-md.a" --machine-windows
Exe with console window
g++ SynGame.c -o SynGame.exe "allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_audio-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_acodec-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_image-5.0.10-md.a" "allegro-5.0.10-mingw-4.7.0\lib\liballegro_primitives-5.0.10-md.a"

BIN
Sounds/die.wav Normal file

Binary file not shown.

BIN
Sounds/shoot.wav Normal file

Binary file not shown.

796
SynGame.c Normal file
View File

@ -0,0 +1,796 @@
/*
Author: Asrın "Syntriax" Doğan
Date: 10.09.2019
Mail: asrindogan99@gmail.com
*/
#include <stdio.h>
#include <math.h>
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_audio.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_acodec.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_image.h"
#include "allegro-5.0.10-mingw-4.7.0\include\allegro5\allegro_primitives.h"
#define playerSpeed 7.5
#define bulletSpeed 25
#define numberSize 5
#define scoreDigitLimit 10
#define enemyLimiter 8
#define initialEnemyLimit 3
typedef struct
{
float x;
float y;
} Vector2D;
struct
{
Vector2D position;
char health;
float moveSpeed;
byte lookDirection;
int shootPerSecond;
float shootCooldown;
unsigned int killedEnemyCount;
unsigned int score;
ALLEGRO_BITMAP *playerImage;
} player;
typedef struct
{
Vector2D position;
/* char health; */
float moveSpeed;
float fireCooldown;
Vector2D velocity;
} Enemy;
struct
{
int enemyLimit;
int enemyCount;
Enemy *enemyArray;
} enemies;
typedef struct
{
char isEnemyBullet;
Vector2D position;
Vector2D velocity;
} Bullet;
struct
{
int bulletCount;
Bullet *bulletArray;
} bullets;
void SpawnEnemies();
void CheckBullets();
void RemoveBulletAtIndex(int index);
void RemoveEnemyAtIndex(int index);
void CheckEnemies();
void MoveEnemies();
void InitializeEnemies();
void DestroyGame();
void DrawObject(Vector2D position, ALLEGRO_BITMAP *image, int flag);
void DrawSizedObject(Vector2D position, ALLEGRO_BITMAP *image, int flag, float objectSizeMultiplier);
void DrawScreen();
void DrawScore();
void DrawNumber(Vector2D position, int number);
void Inputs();
void PlayerMovement();
void BulletMovement();
void ShootSoundEffect();
void DieSoundEffect();
void PlayerShoot();
void EnemyShoot();
void BulletCollisions();
void Update();
void DestroyGameWindow();
float VectorMagnitude(Vector2D vector);
float VectorDistance(Vector2D vectorFirst, Vector2D vectorSecond);
byte isVectorExceedingLimits(Vector2D vector, Vector2D limits);
byte CheckCollision(Vector2D *firstPos, Vector2D *secondPos, ALLEGRO_BITMAP *firstMap, ALLEGRO_BITMAP *secondMap);
char InitializeGameWindow();
char InitializeGame();
char DealDamage(char *health, int damage);
Vector2D NormalizeVector(Vector2D vector);
ALLEGRO_KEYBOARD_STATE keyboardState;
ALLEGRO_DISPLAY *display;
ALLEGRO_DISPLAY_MODE disp_data;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_TIMER *timer = NULL;
ALLEGRO_COLOR backgroundColor;
ALLEGRO_BITMAP *gameOverImage;
ALLEGRO_SAMPLE *shootSound;
ALLEGRO_SAMPLE_ID shootSoundID;
ALLEGRO_BITMAP *enemyImage;
ALLEGRO_BITMAP *enemyBulletImage;
ALLEGRO_SAMPLE *enemyDieSound;
ALLEGRO_SAMPLE_ID enemyDieSoundID;
ALLEGRO_BITMAP *numberTable;
const char *displayName = "Syn Game";
const Vector2D referenceScreenDimensions = {160, 90};
Vector2D screenDimensions = {0, 0};
Vector2D scorePosition = {0, 0};
Vector2D highScorePosition = {0, 0};
float sizeMultiplier;
float timeFromStart;
const float FPS = 60;
double deltaTime;
unsigned int enemyRespawnCounter = 0;
Vector2D input;
byte isRestart = 0;
byte isRunning = 1;
byte isGameStarted = 0;
byte isGameOver = 0;
void Update()
{
al_get_keyboard_state(&keyboardState);
if(al_key_down(&keyboardState, ALLEGRO_KEY_ESCAPE))
isRunning = 0;
al_clear_to_color(backgroundColor);
if(!isGameOver)
{
printf("Inputs();\n");
Inputs();
if(al_key_down(&keyboardState, ALLEGRO_KEY_F))
player.score += 1000;
// enemies.enemyLimit++;
printf("PlayerMovement();\n");
PlayerMovement();
printf("EnemyShoot();\n");
EnemyShoot();
printf("BulletCollisions();\n");
BulletCollisions();
if(player.shootCooldown < 0.0f)
{
if(al_key_down(&keyboardState, ALLEGRO_KEY_SPACE))
{
printf("PlayerShoot();\n");
PlayerShoot();
}
}
else
player.shootCooldown -= deltaTime;
timeFromStart += deltaTime;
player.score = (int)(timeFromStart * timeFromStart) * player.killedEnemyCount;
if(enemies.enemyLimit != enemyLimiter)
{
enemies.enemyLimit = initialEnemyLimit + (int)(timeFromStart / 10);
if(enemies.enemyCount > enemyLimiter)
enemies.enemyLimit = enemyLimiter;
}
}
else if(al_key_down(&keyboardState, ALLEGRO_KEY_R))
isRestart = 1;
printf("CheckEnemies();\n");
CheckEnemies();
printf("MoveEnemies();\n");
MoveEnemies();
printf("CheckBullets();\n");
CheckBullets();
printf("BulletMovement();\n");
BulletMovement();
printf("DrawScreen();\n");
DrawScreen();
al_flip_display();
}
int main(int argc, char **argv)
{
if(InitializeGameWindow() == 0)
return 0;
do
{
if(InitializeGame() == 0)
return 0;
while (isRunning && !isRestart)
{
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
isRunning = 0;
if(ev.type == ALLEGRO_EVENT_TIMER)
Update();
}
DestroyGame();
} while (isRestart);
DestroyGameWindow();
getchar();
return 0;
}
Vector2D NormalizeVector(Vector2D vector)
{
Vector2D normalizedVector;
float magnitude = sqrt(vector.x * vector.x + vector.y * vector.y);
if(vector.x == 0.0 && vector.y == 0.0)
return vector;
normalizedVector.x = vector.x / magnitude;
normalizedVector.y = vector.y / magnitude;
return normalizedVector;
}
float VectorMagnitude(Vector2D vector)
{
return sqrt(vector.x * vector.x + vector.y * vector.y);
}
float VectorDistance(Vector2D vectorFirst, Vector2D vectorSecond)
{
Vector2D difference;
difference.x = abs(vectorFirst.x - vectorSecond.x);
difference.y = abs(vectorFirst.y - vectorSecond.y);
return VectorMagnitude(difference);
}
byte isVectorExceedingLimits(Vector2D vector, Vector2D limits)
{
byte result = vector.x > limits.x || vector.x < 0 || vector.y > limits.y || vector.y < 0;
return result;
}
byte CheckCollision(Vector2D *firstPos, Vector2D *secondPos, ALLEGRO_BITMAP *firstMap, ALLEGRO_BITMAP *secondMap)
{
Vector2D firstImageSize;
Vector2D secondImageSize;
byte result;
float minDistance;
float distance;
firstImageSize.x = (float)al_get_bitmap_width(firstMap);
firstImageSize.y = (float)al_get_bitmap_height(firstMap);
secondImageSize.x = (float)al_get_bitmap_width(secondMap);
secondImageSize.y = (float)al_get_bitmap_height(secondMap);
minDistance = firstImageSize.x > firstImageSize.y ? firstImageSize.y : firstImageSize.x;
minDistance += secondImageSize.x > secondImageSize.y ? secondImageSize.y : secondImageSize.x;
minDistance /= 2;
minDistance *= sizeMultiplier;
distance = VectorDistance(*firstPos, *secondPos);
result = distance <= minDistance;
return result;
}
char InitializeGameWindow()
{
float x = 0.0f;
float y = 0.0f;
if(!al_init() ||
!al_init_primitives_addon() ||
!al_init_image_addon() ||
!al_install_audio() ||
!al_init_acodec_addon() ||
!al_reserve_samples(1))
return 0;
al_get_display_mode(al_get_num_display_modes() - 1, &disp_data);
al_set_new_display_flags(ALLEGRO_FULLSCREEN);
x = disp_data.width;
y = disp_data.height;
/* x = 1600; */
/* y = 900; */
screenDimensions = (Vector2D){x, y};
scorePosition = (Vector2D){x * (float)0.05, y * (float)0.05};
highScorePosition = (Vector2D){x * (float)0.05, y * (float)0.95};
sizeMultiplier = screenDimensions.x / referenceScreenDimensions.x;
display = al_create_display(screenDimensions.x, screenDimensions.y);
if(display == NULL)
return 0;
if(!al_install_keyboard())
return 0;
deltaTime = 1.0 / FPS;
timer = al_create_timer(deltaTime);
event_queue = al_create_event_queue();
if(event_queue == NULL)
{
printf("Event Queue Error");
al_destroy_display(display);
al_destroy_timer(timer);
return 0;
}
al_register_event_source(event_queue, al_get_keyboard_event_source());
al_register_event_source(event_queue, al_get_display_event_source(display));
al_register_event_source(event_queue, al_get_timer_event_source(timer));
al_start_timer(timer);
al_set_window_title(display, displayName);
backgroundColor.a = 1;
backgroundColor.a = 0;
backgroundColor.a = 0;
backgroundColor.a = 0;
}
char InitializeGame()
{
shootSound = al_load_sample("Sounds/Shoot.wav");
enemyDieSound = al_load_sample("Sounds/Die.wav");
InitializeEnemies();
/* Player Initialization */
player.position.x = screenDimensions.x / 2;
player.position.y = screenDimensions.y / 2;
player.moveSpeed = playerSpeed;
player.shootPerSecond = 10;
player.health = 100;
player.playerImage = al_load_bitmap("Images/Player.png");
bullets.bulletCount = 0;
bullets.bulletArray = (Bullet *) malloc(sizeof(Bullet) * bullets.bulletCount);
if(player.playerImage == NULL ||
shootSound == NULL ||
enemyDieSound == NULL)
return 0;
isRunning = 1;
isRestart = 0;
isGameOver = 0;
isGameStarted = 0;
timeFromStart = 0;
player.killedEnemyCount = 0;
return 1;
}
void InitializeEnemies()
{
int i = 0;
enemies.enemyLimit = initialEnemyLimit;
enemies.enemyCount = 0;
enemies.enemyArray = (Enemy *) malloc(sizeof(Enemy) * enemies.enemyCount);
enemyImage = al_load_bitmap("Images/Enemy.png");
numberTable = al_load_bitmap("Images/Numbers.png");
enemyBulletImage = al_load_bitmap("Images/Bullet.png");
gameOverImage = al_load_bitmap("Images/GameOver.png");
SpawnEnemies();
}
void SpawnEnemies()
{
if(enemyRespawnCounter > 10000)
enemyRespawnCounter = 0;
Vector2D enemySpawnVector;
Vector2D enemyvelocity;
Enemy *enemy;
float speed;
int randomNumber;
while (enemies.enemyCount < enemies.enemyLimit)
{
srand(time(0) + enemyRespawnCounter);
enemies.enemyCount++;
randomNumber = rand() * enemies.enemyCount;
enemies.enemyArray = (Enemy *) realloc(enemies.enemyArray, sizeof(Enemy) * enemies.enemyCount);
enemyvelocity.x = (float)(randomNumber % 20000) / 10000;
enemyvelocity.y = (float)(randomNumber % 2000) / 1000;
enemyvelocity.x *= randomNumber % 2 == 0 ? -1 : 1;
enemyvelocity.y *= randomNumber % 4 >= 2 ? -1 : 1;
speed = (float)(randomNumber % 500 / 100 + 2);
enemy = (enemies.enemyArray + enemies.enemyCount - 1);
enemy -> velocity = NormalizeVector(enemyvelocity);
enemy -> moveSpeed = speed;
enemySpawnVector.x = enemyvelocity.x > 0 ? 0 : screenDimensions.x;
enemySpawnVector.y = enemyvelocity.y > 0 ? 0 : screenDimensions.y;
enemy -> position = enemySpawnVector;
enemy -> fireCooldown = 01.0 / (rand() % 5) + 2.0;
enemyRespawnCounter++;
}
}
void CheckBullets()
{
int i = 0;
int j = 0;
for (; i < bullets.bulletCount; i++)
{
if(isVectorExceedingLimits((bullets.bulletArray + i) -> position, screenDimensions))
{
for (j = i; j < bullets.bulletCount - 1; j++)
*(bullets.bulletArray + j) = *(bullets.bulletArray + j + 1);
bullets.bulletCount--;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
}
}
}
void RemoveBulletAtIndex(int index)
{
printf("RemoveBulletAtIndex();\n");
for (; index < bullets.bulletCount - 1; index++)
*(bullets.bulletArray + index) = *(bullets.bulletArray + index + 1);
bullets.bulletCount--;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
}
void RemoveEnemyAtIndex(int index)
{
printf("RemoveEnemyAtIndex();\n");
for (; index < enemies.enemyCount - 1; index++)
*(enemies.enemyArray + index) = *(enemies.enemyArray + index + 1);
enemies.enemyCount--;
enemies.enemyArray = (Enemy *) realloc(enemies.enemyArray, sizeof(Enemy) * enemies.enemyCount);
printf("New Enemy Count = %d\n", enemies.enemyCount);
DieSoundEffect();
}
void CheckEnemies()
{
int i = 0;
for (; i < enemies.enemyCount; i++)
if(isVectorExceedingLimits((enemies.enemyArray + i) -> position, screenDimensions))
RemoveEnemyAtIndex(i);
SpawnEnemies();
}
void MoveEnemies()
{
int i = 0;
Vector2D velocity;
float speed;
for (; i < enemies.enemyCount; i++)
{
speed = (enemies.enemyArray + i) -> moveSpeed;
velocity = (enemies.enemyArray + i) -> velocity;
(enemies.enemyArray + i) -> position.x += velocity.x * speed;
(enemies.enemyArray + i) -> position.y += velocity.y * speed;
}
}
void DrawObject(Vector2D position, ALLEGRO_BITMAP *image, int flag)
{
Vector2D InstantiateSize;
InstantiateSize.x = (float)al_get_bitmap_width(image);
InstantiateSize.y = (float)al_get_bitmap_height(image);
al_draw_scaled_bitmap(image,
0, 0, InstantiateSize.x, InstantiateSize.y,
position.x - InstantiateSize.x / 2 * sizeMultiplier, position.y - InstantiateSize.y / 2 * sizeMultiplier,
InstantiateSize.x * sizeMultiplier, InstantiateSize.y * sizeMultiplier, flag);
}
void DrawNumber(Vector2D position, int number)
{
Vector2D InstantiateSize;
float numberFactor;
InstantiateSize.x = (float)al_get_bitmap_width(numberTable);
InstantiateSize.y = (float)al_get_bitmap_height(numberTable);
numberFactor = InstantiateSize.x / 10.0;
al_draw_scaled_bitmap(numberTable,
numberFactor * number, 0, numberFactor, InstantiateSize.y,
position.x - numberFactor / 2 * sizeMultiplier, position.y - InstantiateSize.y / 2 * sizeMultiplier,
numberFactor * sizeMultiplier, InstantiateSize.y * sizeMultiplier, 0);
}
void DrawSizedObject(Vector2D position, ALLEGRO_BITMAP *image, int flag, float objectSizeMultiplier)
{
Vector2D InstantiateSize;
float sizeFactor = sizeMultiplier * objectSizeMultiplier;
InstantiateSize.x = (float)al_get_bitmap_width(image);
InstantiateSize.y = (float)al_get_bitmap_height(image);
al_draw_scaled_bitmap(image,
0, 0, InstantiateSize.x, InstantiateSize.y,
position.x - InstantiateSize.x / 2 * sizeFactor, position.y - InstantiateSize.y / 2 * sizeFactor,
InstantiateSize.x * sizeFactor, InstantiateSize.y * sizeFactor, flag);
}
void DrawScreen()
{
int i = 0;
Vector2D halfScreen = {screenDimensions.x / 2, screenDimensions.y / 2};
/* Enemy Draw */
for (i = 0; i < enemies.enemyCount; i++)
DrawObject((enemies.enemyArray + i) -> position, enemyImage, (enemies.enemyArray + i) -> velocity.x > 0 ? ALLEGRO_FLIP_HORIZONTAL : 0 );
/* Bullet Draw */
for (i = 0; i < bullets.bulletCount; i++)
DrawObject((bullets.bulletArray + i) -> position, enemyBulletImage, 0);
/* Player Draw */
if(!isGameOver)
DrawObject(player.position, player.playerImage, player.lookDirection == 1 ? ALLEGRO_FLIP_HORIZONTAL : 0);
else
DrawObject(halfScreen, gameOverImage, 0);
DrawScore();
}
void DrawScore()
{
unsigned int processedScore = player.score;
char digit;
Vector2D spawnPosition;
int i = scoreDigitLimit;
/*while (processedScore >= 1 && i > 0)*/
while (i > 0)
{
spawnPosition = scorePosition;
/* numberSize + 1 is because 1 pixel space between digits */
spawnPosition.x += sizeMultiplier * (numberSize + 1) * i;
digit = processedScore % 10;
processedScore = (int)(processedScore / 10);
DrawNumber(spawnPosition, digit);
i--;
}
}
void Inputs()
{
input.x = 0;
input.y = 0;
if(al_key_down(&keyboardState, ALLEGRO_KEY_UP))
input.y = -1;
else if(al_key_down(&keyboardState, ALLEGRO_KEY_DOWN))
input.y = 1;
if(al_key_down(&keyboardState, ALLEGRO_KEY_RIGHT))
{
input.x = 1;
player.lookDirection = input.x;
}
else if(al_key_down(&keyboardState, ALLEGRO_KEY_LEFT))
{
input.x = -1;
player.lookDirection = input.x;
}
input = NormalizeVector(input);
}
void PlayerMovement()
{
player.position.x += input.x * player.moveSpeed;
player.position.y += input.y * player.moveSpeed;
}
char DealDamage(char *health, int damage)
{
int healthInt = *health;
*health -= damage;
return healthInt <= 0;
}
void BulletMovement()
{
Bullet *bullet;
int i = 0;
for (; i < bullets.bulletCount; i++)
{
bullet = (bullets.bulletArray + i);
bullet -> position.x += bullet -> velocity.x;
bullet -> position.y += bullet -> velocity.y;
}
}
void ShootSoundEffect()
{
printf("ShootSoundEffect();\n");
al_stop_sample(&shootSoundID);
al_play_sample(shootSound, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, &shootSoundID);
}
void DieSoundEffect()
{
printf("DieSoundEffect();\n");
al_stop_sample(&enemyDieSoundID);
al_play_sample(enemyDieSound, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, &enemyDieSoundID);
}
void PlayerShoot()
{
Vector2D shootDir;
Bullet *newBullet;
float offset = (al_get_bitmap_width(player.playerImage) + al_get_bitmap_width(enemyBulletImage) * 2.0 * sizeMultiplier);
if(player.lookDirection != 1)
offset = -offset;
shootDir.x = player.lookDirection == 1 ? bulletSpeed : -bulletSpeed;
shootDir.y = 0;
player.shootCooldown = 1 / (float)player.shootPerSecond;
bullets.bulletCount++;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
newBullet = (bullets.bulletArray + bullets.bulletCount - 1);
newBullet -> position = player.position;
newBullet -> position.x += offset;
newBullet -> velocity = shootDir;
newBullet -> isEnemyBullet = 0;
ShootSoundEffect();
}
void EnemyShoot()
{
Vector2D shootDir;
Vector2D normalizedVec;
Enemy *enemy;
Bullet *bullet;
int i;
float offset = (al_get_bitmap_width(player.playerImage) + al_get_bitmap_width(enemyBulletImage) * 2.0 * sizeMultiplier);
for (i = 0; i < enemies.enemyCount; i++)
{
srand(time(0) + enemyRespawnCounter++);
enemy = (enemies.enemyArray + i);
if(enemy -> fireCooldown > 0.0)
enemy -> fireCooldown -= deltaTime;
else
{
shootDir = (Vector2D){player.position.x - enemy -> position.x , player.position.y - enemy -> position.y};
shootDir = NormalizeVector(shootDir);
normalizedVec = shootDir;
shootDir = (Vector2D){shootDir.x * bulletSpeed, shootDir.y * bulletSpeed};
enemy -> fireCooldown = 1.0 / (rand() % 5) + 2.0;
bullets.bulletCount++;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
bullet = (bullets.bulletArray + bullets.bulletCount - 1);
bullet -> position = enemy -> position;
bullet -> position.x += normalizedVec.x * offset;
bullet -> position.y += normalizedVec.y * offset;
bullet -> velocity = shootDir;
bullet -> isEnemyBullet = 1;
ShootSoundEffect();
}
}
}
void BulletCollisions()
{
Bullet *bullet;
Enemy *enemy;
int bulletCounter = 0;
int enemyCounter = 0;
int i = 0;
byte isCheckPlayerEnemyInteraction = 1;
for (bulletCounter = 0; bulletCounter < bullets.bulletCount; bulletCounter++)
{
bullet = (bullets.bulletArray + bulletCounter);
printf("Player-Bullet\n");
if(bullet -> isEnemyBullet == 1 && CheckCollision(
&bullet -> position,
&player.position,
enemyBulletImage,
player.playerImage
))
{
RemoveBulletAtIndex(bulletCounter);
bulletCounter--;
if(DealDamage(&player.health, 25))
isGameOver = 1;
break;
}
printf("Enemy-Bullet\n");
for (enemyCounter = 0; enemyCounter < enemies.enemyCount; enemyCounter++)
{
enemy = (enemies.enemyArray + enemyCounter);
printf("Enemy-Bullet|enemyCounter\n");
printf("Enemy Count = %d\n", enemyCounter);
printf("Enemy Counter = %d\n", enemies.enemyCount);
printf("Bullet Count = %d\n", bulletCounter);
printf("Bullet Counter = %d\n", bullets.bulletCount);
if(bullet -> isEnemyBullet == 0 && CheckCollision(
&bullet -> position,
&enemy -> position,
enemyBulletImage,
enemyImage
))
{
printf("Enemy-Bullet|EnemyRemove\n");
RemoveEnemyAtIndex(enemyCounter);
enemyCounter--;
printf("Enemy-Bullet|BulletRemove\n");
RemoveBulletAtIndex(bulletCounter);
bulletCounter--;
player.killedEnemyCount++;
break;
}
printf("Enemy-Player\n");
if( isCheckPlayerEnemyInteraction == 1 &&
CheckCollision(
&enemy -> position,
&player.position,
enemyImage,
player.playerImage
))
{
RemoveEnemyAtIndex(enemyCounter);
enemyCounter--;
if(DealDamage(&player.health, 25))
isGameOver = 1;
isCheckPlayerEnemyInteraction = 0;
}
}
}
}
void DestroyGame()
{
al_destroy_bitmap(enemyImage);
al_destroy_bitmap(enemyBulletImage);
al_destroy_bitmap(gameOverImage);
al_destroy_bitmap(numberTable);
al_destroy_sample(shootSound);
al_destroy_sample(enemyDieSound);
al_destroy_bitmap(player.playerImage);
free(enemies.enemyArray);
}
void DestroyGameWindow()
{
al_destroy_display(display);
al_uninstall_keyboard();
}

Binary file not shown.

View File

@ -0,0 +1,724 @@
#ifndef AL_AL_H
#define AL_AL_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(AL_LIBTYPE_STATIC)
#define AL_API
#elif defined(_WIN32) && !defined(_XBOX)
#if defined(AL_BUILD_LIBRARY)
#define AL_API __declspec(dllexport)
#else
#define AL_API __declspec(dllimport)
#endif
#else
#if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
#define AL_API __attribute__((visibility("protected")))
#else
#define AL_API extern
#endif
#endif
#if defined(_WIN32)
#define AL_APIENTRY __cdecl
#else
#define AL_APIENTRY
#endif
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export on
#endif
/*
* The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
* AL_ILLEGAL_COMMAND macros are deprecated, but are included for
* applications porting code from AL 1.0
*/
#define OPENAL
#define ALAPI AL_API
#define ALAPIENTRY AL_APIENTRY
#define AL_INVALID (-1)
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
#define AL_VERSION_1_0
#define AL_VERSION_1_1
/** 8-bit boolean */
typedef char ALboolean;
/** character */
typedef char ALchar;
/** signed 8-bit 2's complement integer */
typedef signed char ALbyte;
/** unsigned 8-bit integer */
typedef unsigned char ALubyte;
/** signed 16-bit 2's complement integer */
typedef short ALshort;
/** unsigned 16-bit integer */
typedef unsigned short ALushort;
/** signed 32-bit 2's complement integer */
typedef int ALint;
/** unsigned 32-bit integer */
typedef unsigned int ALuint;
/** non-negative 32-bit binary integer size */
typedef int ALsizei;
/** enumerated 32-bit value */
typedef int ALenum;
/** 32-bit IEEE754 floating-point */
typedef float ALfloat;
/** 64-bit IEEE754 floating-point */
typedef double ALdouble;
/** void type (for opaque pointers only) */
typedef void ALvoid;
/* Enumerant values begin at column 50. No tabs. */
/* "no distance model" or "no buffer" */
#define AL_NONE 0
/* Boolean False. */
#define AL_FALSE 0
/** Boolean True. */
#define AL_TRUE 1
/** Indicate Source has relative coordinates. */
#define AL_SOURCE_RELATIVE 0x202
/**
* Directional source, inner cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_INNER_ANGLE 0x1001
/**
* Directional source, outer cone angle, in degrees.
* Range: [0-360]
* Default: 360
*/
#define AL_CONE_OUTER_ANGLE 0x1002
/**
* Specify the pitch to be applied at source.
* Range: [0.5-2.0]
* Default: 1.0
*/
#define AL_PITCH 0x1003
/**
* Specify the current location in three dimensional space.
* OpenAL, like OpenGL, uses a right handed coordinate system,
* where in a frontal default view X (thumb) points right,
* Y points up (index finger), and Z points towards the
* viewer/camera (middle finger).
* To switch from a left handed coordinate system, flip the
* sign on the Z coordinate.
* Listener position is always in the world coordinate system.
*/
#define AL_POSITION 0x1004
/** Specify the current direction. */
#define AL_DIRECTION 0x1005
/** Specify the current velocity in three dimensional space. */
#define AL_VELOCITY 0x1006
/**
* Indicate whether source is looping.
* Type: ALboolean?
* Range: [AL_TRUE, AL_FALSE]
* Default: FALSE.
*/
#define AL_LOOPING 0x1007
/**
* Indicate the buffer to provide sound samples.
* Type: ALuint.
* Range: any valid Buffer id.
*/
#define AL_BUFFER 0x1009
/**
* Indicate the gain (volume amplification) applied.
* Type: ALfloat.
* Range: ]0.0- ]
* A value of 1.0 means un-attenuated/unchanged.
* Each division by 2 equals an attenuation of -6dB.
* Each multiplicaton with 2 equals an amplification of +6dB.
* A value of 0.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
#define AL_GAIN 0x100A
/*
* Indicate minimum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
#define AL_MIN_GAIN 0x100D
/**
* Indicate maximum source attenuation
* Type: ALfloat
* Range: [0.0 - 1.0]
*
* Logarthmic
*/
#define AL_MAX_GAIN 0x100E
/**
* Indicate listener orientation.
*
* at/up
*/
#define AL_ORIENTATION 0x100F
/**
* Source state information.
*/
#define AL_SOURCE_STATE 0x1010
#define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013
#define AL_STOPPED 0x1014
/**
* Buffer Queue params
*/
#define AL_BUFFERS_QUEUED 0x1015
#define AL_BUFFERS_PROCESSED 0x1016
/**
* Source buffer position information
*/
#define AL_SEC_OFFSET 0x1024
#define AL_SAMPLE_OFFSET 0x1025
#define AL_BYTE_OFFSET 0x1026
/*
* Source type (Static, Streaming or undetermined)
* Source is Static if a Buffer has been attached using AL_BUFFER
* Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
* Source is undetermined when it has the NULL buffer attached
*/
#define AL_SOURCE_TYPE 0x1027
#define AL_STATIC 0x1028
#define AL_STREAMING 0x1029
#define AL_UNDETERMINED 0x1030
/** Sound samples: format specifier. */
#define AL_FORMAT_MONO8 0x1100
#define AL_FORMAT_MONO16 0x1101
#define AL_FORMAT_STEREO8 0x1102
#define AL_FORMAT_STEREO16 0x1103
/**
* source specific reference distance
* Type: ALfloat
* Range: 0.0 - +inf
*
* At 0.0, no distance attenuation occurs. Default is
* 1.0.
*/
#define AL_REFERENCE_DISTANCE 0x1020
/**
* source specific rolloff factor
* Type: ALfloat
* Range: 0.0 - +inf
*
*/
#define AL_ROLLOFF_FACTOR 0x1021
/**
* Directional source, outer cone gain.
*
* Default: 0.0
* Range: [0.0 - 1.0]
* Logarithmic
*/
#define AL_CONE_OUTER_GAIN 0x1022
/**
* Indicate distance above which sources are not
* attenuated using the inverse clamped distance model.
*
* Default: +inf
* Type: ALfloat
* Range: 0.0 - +inf
*/
#define AL_MAX_DISTANCE 0x1023
/**
* Sound samples: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
*/
#define AL_FREQUENCY 0x2001
#define AL_BITS 0x2002
#define AL_CHANNELS 0x2003
#define AL_SIZE 0x2004
/**
* Buffer state.
*
* Not supported for public use (yet).
*/
#define AL_UNUSED 0x2010
#define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012
/** Errors: No Error. */
#define AL_NO_ERROR AL_FALSE
/**
* Invalid Name paramater passed to AL call.
*/
#define AL_INVALID_NAME 0xA001
/**
* Invalid parameter passed to AL call.
*/
#define AL_INVALID_ENUM 0xA002
/**
* Invalid enum parameter value.
*/
#define AL_INVALID_VALUE 0xA003
/**
* Illegal call.
*/
#define AL_INVALID_OPERATION 0xA004
/**
* No mojo.
*/
#define AL_OUT_OF_MEMORY 0xA005
/** Context strings: Vendor Name. */
#define AL_VENDOR 0xB001
#define AL_VERSION 0xB002
#define AL_RENDERER 0xB003
#define AL_EXTENSIONS 0xB004
/** Global tweakage. */
/**
* Doppler scale. Default 1.0
*/
#define AL_DOPPLER_FACTOR 0xC000
/**
* Tweaks speed of propagation.
*/
#define AL_DOPPLER_VELOCITY 0xC001
/**
* Speed of Sound in units per second
*/
#define AL_SPEED_OF_SOUND 0xC003
/**
* Distance models
*
* used in conjunction with DistanceModel
*
* implicit: NONE, which disances distance attenuation.
*/
#define AL_DISTANCE_MODEL 0xD000
#define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
#define AL_LINEAR_DISTANCE 0xD003
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
#define AL_EXPONENT_DISTANCE 0xD005
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
/*
* Renderer State management
*/
AL_API void AL_APIENTRY alEnable( ALenum capability );
AL_API void AL_APIENTRY alDisable( ALenum capability );
AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
/*
* State retrieval
*/
AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data );
AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data );
AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data );
AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
AL_API ALint AL_APIENTRY alGetInteger( ALenum param );
AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param );
AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
/*
* Error support.
* Obtain the most recent error generated in the AL state machine.
*/
AL_API ALenum AL_APIENTRY alGetError( void );
/*
* Extension support.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/
AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname );
AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname );
AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
/*
* LISTENER
* Listener represents the location and orientation of the
* 'user' in 3D-space.
*
* Properties include: -
*
* Gain AL_GAIN ALfloat
* Position AL_POSITION ALfloat[3]
* Velocity AL_VELOCITY ALfloat[3]
* Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
*/
/*
* Set Listener parameters
*/
AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value );
AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
/*
* Get Listener parameters
*/
AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
/**
* SOURCE
* Sources represent individual sound objects in 3D-space.
* Sources take the PCM data provided in the specified Buffer,
* apply Source-specific modifications, and then
* submit them to be mixed according to spatial arrangement etc.
*
* Properties include: -
*
* Gain AL_GAIN ALfloat
* Min Gain AL_MIN_GAIN ALfloat
* Max Gain AL_MAX_GAIN ALfloat
* Position AL_POSITION ALfloat[3]
* Velocity AL_VELOCITY ALfloat[3]
* Direction AL_DIRECTION ALfloat[3]
* Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE)
* Reference Distance AL_REFERENCE_DISTANCE ALfloat
* Max Distance AL_MAX_DISTANCE ALfloat
* RollOff Factor AL_ROLLOFF_FACTOR ALfloat
* Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat
* Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat
* Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat
* Pitch AL_PITCH ALfloat
* Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE)
* MS Offset AL_MSEC_OFFSET ALint or ALfloat
* Byte Offset AL_BYTE_OFFSET ALint or ALfloat
* Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat
* Attached Buffer AL_BUFFER ALint
* State (Query only) AL_SOURCE_STATE ALint
* Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
*/
/* Create Source objects */
AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources );
/* Delete Source objects */
AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
/* Verify a handle is a valid Source */
AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
/*
* Set Source parameters
*/
AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
/*
* Get Source parameters
*/
AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
/*
* Source vector based playback calls
*/
/* Play, replay, or resume (if paused) a list of Sources */
AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
/* Stop a list of Sources */
AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
/* Rewind a list of Sources */
AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
/* Pause a list of Sources */
AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
/*
* Source based playback calls
*/
/* Play, replay, or resume a Source */
AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
/* Stop a Source */
AL_API void AL_APIENTRY alSourceStop( ALuint sid );
/* Rewind a Source (set playback postiton to beginning) */
AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
/* Pause a Source */
AL_API void AL_APIENTRY alSourcePause( ALuint sid );
/*
* Source Queuing
*/
AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
/**
* BUFFER
* Buffer objects are storage space for sample data.
* Buffers are referred to by Sources. One Buffer can be used
* by multiple Sources.
*
* Properties include: -
*
* Frequency (Query only) AL_FREQUENCY ALint
* Size (Query only) AL_SIZE ALint
* Bits (Query only) AL_BITS ALint
* Channels (Query only) AL_CHANNELS ALint
*/
/* Create Buffer objects */
AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
/* Delete Buffer objects */
AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
/* Verify a handle is a valid Buffer */
AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
/* Specify the data to be copied into a buffer */
AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
/*
* Set Buffer parameters
*/
AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
/*
* Get Buffer parameters
*/
AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
/*
* Global Parameters
*/
AL_API void AL_APIENTRY alDopplerFactor( ALfloat value );
AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value );
AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
/*
* Pointer-to-function types, useful for dynamically getting AL entry points.
*/
typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability );
typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability );
typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability );
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param );
typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param );
typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param );
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param );
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param );
typedef ALenum (AL_APIENTRY *LPALGETERROR)( void );
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
typedef void (AL_APIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
typedef void (AL_APIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALLISTENERI)( ALenum param, ALint value );
typedef void (AL_APIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
typedef void (AL_APIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
typedef void (AL_APIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
typedef void (AL_APIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void (AL_APIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void (AL_APIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
typedef void (AL_APIENTRY *LPALSOURCEPLAY)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCESTOP)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEREWIND)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)( ALuint sid );
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
typedef void (AL_APIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)( ALuint bid );
typedef void (AL_APIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
typedef void (AL_APIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void (AL_APIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
typedef void (AL_APIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void (AL_APIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
typedef void (AL_APIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
typedef void (AL_APIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void (AL_APIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
typedef void (AL_APIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
typedef void (AL_APIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void (AL_APIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export off
#endif
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif /* AL_AL_H */

View File

@ -0,0 +1,286 @@
#ifndef AL_ALC_H
#define AL_ALC_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(AL_LIBTYPE_STATIC)
#define ALC_API
#elif defined(_WIN32) && !defined(_XBOX)
#if defined(AL_BUILD_LIBRARY)
#define ALC_API __declspec(dllexport)
#else
#define ALC_API __declspec(dllimport)
#endif
#else
#if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
#define ALC_API __attribute__((visibility("protected")))
#else
#define ALC_API extern
#endif
#endif
#if defined(_WIN32)
#define ALC_APIENTRY __cdecl
#else
#define ALC_APIENTRY
#endif
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export on
#endif
/*
* The ALCAPI, ALCAPIENTRY, and ALC_INVALID macros are deprecated, but are
* included for applications porting code from AL 1.0
*/
#define ALCAPI ALC_API
#define ALCAPIENTRY ALC_APIENTRY
#define ALC_INVALID 0
#define ALC_VERSION_0_1 1
typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCcontext_struct ALCcontext;
/** 8-bit boolean */
typedef char ALCboolean;
/** character */
typedef char ALCchar;
/** signed 8-bit 2's complement integer */
typedef signed char ALCbyte;
/** unsigned 8-bit integer */
typedef unsigned char ALCubyte;
/** signed 16-bit 2's complement integer */
typedef short ALCshort;
/** unsigned 16-bit integer */
typedef unsigned short ALCushort;
/** signed 32-bit 2's complement integer */
typedef int ALCint;
/** unsigned 32-bit integer */
typedef unsigned int ALCuint;
/** non-negative 32-bit binary integer size */
typedef int ALCsizei;
/** enumerated 32-bit value */
typedef int ALCenum;
/** 32-bit IEEE754 floating-point */
typedef float ALCfloat;
/** 64-bit IEEE754 floating-point */
typedef double ALCdouble;
/** void type (for opaque pointers only) */
typedef void ALCvoid;
/* Enumerant values begin at column 50. No tabs. */
/* Boolean False. */
#define ALC_FALSE 0
/* Boolean True. */
#define ALC_TRUE 1
/**
* followed by <int> Hz
*/
#define ALC_FREQUENCY 0x1007
/**
* followed by <int> Hz
*/
#define ALC_REFRESH 0x1008
/**
* followed by AL_TRUE, AL_FALSE
*/
#define ALC_SYNC 0x1009
/**
* followed by <int> Num of requested Mono (3D) Sources
*/
#define ALC_MONO_SOURCES 0x1010
/**
* followed by <int> Num of requested Stereo Sources
*/
#define ALC_STEREO_SOURCES 0x1011
/**
* errors
*/
/**
* No error
*/
#define ALC_NO_ERROR ALC_FALSE
/**
* No device
*/
#define ALC_INVALID_DEVICE 0xA001
/**
* invalid context ID
*/
#define ALC_INVALID_CONTEXT 0xA002
/**
* bad enum
*/
#define ALC_INVALID_ENUM 0xA003
/**
* bad value
*/
#define ALC_INVALID_VALUE 0xA004
/**
* Out of memory.
*/
#define ALC_OUT_OF_MEMORY 0xA005
/**
* The Specifier string for default device
*/
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
#define ALC_DEVICE_SPECIFIER 0x1005
#define ALC_EXTENSIONS 0x1006
#define ALC_MAJOR_VERSION 0x1000
#define ALC_MINOR_VERSION 0x1001
#define ALC_ATTRIBUTES_SIZE 0x1002
#define ALC_ALL_ATTRIBUTES 0x1003
/**
* Capture extension
*/
#define ALC_EXT_CAPTURE 1
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
#define ALC_CAPTURE_SAMPLES 0x312
/**
* ALC_ENUMERATE_ALL_EXT enums
*/
#define ALC_ENUMERATE_ALL_EXT 1
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
#define ALC_ALL_DEVICES_SPECIFIER 0x1013
/*
* Context Management
*/
ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
/*
* Device Management
*/
ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
/*
* Error support.
* Obtain the most recent Context error
*/
ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
/*
* Extension support.
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
/*
* Query functions
*/
ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
/*
* Capture functions
*/
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
/*
* Pointer-to-function types, useful for dynamically getting ALC entry points.
*/
typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export off
#endif
#if defined(__cplusplus)
}
#endif
#endif /* AL_ALC_H */

View File

@ -0,0 +1,183 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 2008 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#ifndef AL_ALEXT_H
#define AL_ALEXT_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef AL_LOKI_IMA_ADPCM_format
#define AL_LOKI_IMA_ADPCM_format 1
#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
#define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001
#endif
#ifndef AL_LOKI_WAVE_format
#define AL_LOKI_WAVE_format 1
#define AL_FORMAT_WAVE_EXT 0x10002
#endif
#ifndef AL_EXT_vorbis
#define AL_EXT_vorbis 1
#define AL_FORMAT_VORBIS_EXT 0x10003
#endif
#ifndef AL_LOKI_quadriphonic
#define AL_LOKI_quadriphonic 1
#define AL_FORMAT_QUAD8_LOKI 0x10004
#define AL_FORMAT_QUAD16_LOKI 0x10005
#endif
#ifndef AL_EXT_float32
#define AL_EXT_float32 1
#define AL_FORMAT_MONO_FLOAT32 0x10010
#define AL_FORMAT_STEREO_FLOAT32 0x10011
#endif
#ifndef AL_EXT_double
#define AL_EXT_double 1
#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
#define AL_FORMAT_STEREO_DOUBLE_EXT 0x10013
#endif
#ifndef ALC_LOKI_audio_channel
#define ALC_LOKI_audio_channel 1
#define ALC_CHAN_MAIN_LOKI 0x500001
#define ALC_CHAN_PCM_LOKI 0x500002
#define ALC_CHAN_CD_LOKI 0x500003
#endif
#ifndef AL_EXT_MCFORMATS
#define AL_EXT_MCFORMATS 1
#define AL_FORMAT_QUAD8 0x1204
#define AL_FORMAT_QUAD16 0x1205
#define AL_FORMAT_QUAD32 0x1206
#define AL_FORMAT_REAR8 0x1207
#define AL_FORMAT_REAR16 0x1208
#define AL_FORMAT_REAR32 0x1209
#define AL_FORMAT_51CHN8 0x120A
#define AL_FORMAT_51CHN16 0x120B
#define AL_FORMAT_51CHN32 0x120C
#define AL_FORMAT_61CHN8 0x120D
#define AL_FORMAT_61CHN16 0x120E
#define AL_FORMAT_61CHN32 0x120F
#define AL_FORMAT_71CHN8 0x1210
#define AL_FORMAT_71CHN16 0x1211
#define AL_FORMAT_71CHN32 0x1212
#endif
#ifndef AL_EXT_MULAW_MCFORMATS
#define AL_EXT_MULAW_MCFORMATS 1
#define AL_FORMAT_MONO_MULAW 0x10014
#define AL_FORMAT_STEREO_MULAW 0x10015
#define AL_FORMAT_QUAD_MULAW 0x10021
#define AL_FORMAT_REAR_MULAW 0x10022
#define AL_FORMAT_51CHN_MULAW 0x10023
#define AL_FORMAT_61CHN_MULAW 0x10024
#define AL_FORMAT_71CHN_MULAW 0x10025
#endif
#ifndef AL_EXT_IMA4
#define AL_EXT_IMA4 1
#define AL_FORMAT_MONO_IMA4 0x1300
#define AL_FORMAT_STEREO_IMA4 0x1301
#endif
#ifndef AL_EXT_STATIC_BUFFER
#define AL_EXT_STATIC_BUFFER 1
typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
#endif
#endif
#ifndef ALC_EXT_EFX
#define ALC_EXT_EFX 1
#include "efx.h"
#endif
#ifndef ALC_EXT_disconnect
#define ALC_EXT_disconnect 1
#define ALC_CONNECTED 0x313
#endif
#ifndef ALC_EXT_thread_local_context
#define ALC_EXT_thread_local_context 1
typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
#ifdef AL_ALEXT_PROTOTYPES
ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
#endif
#endif
#ifndef AL_EXT_source_distance_model
#define AL_EXT_source_distance_model 1
#define AL_SOURCE_DISTANCE_MODEL 0x200
#endif
#ifndef AL_SOFT_buffer_sub_data
#define AL_SOFT_buffer_sub_data 1
#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
#endif
#endif
#ifndef AL_SOFT_loop_points
#define AL_SOFT_loop_points 1
#define AL_LOOP_POINTS_SOFT 0x2015
#endif
#ifndef AL_EXT_FOLDBACK
#define AL_EXT_FOLDBACK 1
#define AL_EXT_FOLDBACK_NAME "AL_EXT_FOLDBACK"
#define AL_FOLDBACK_EVENT_BLOCK 0x4112
#define AL_FOLDBACK_EVENT_START 0x4111
#define AL_FOLDBACK_EVENT_STOP 0x4113
#define AL_FOLDBACK_MODE_MONO 0x4101
#define AL_FOLDBACK_MODE_STEREO 0x4102
typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei);
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK);
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void);
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback);
AL_API void AL_APIENTRY alRequestFoldbackStop(void);
#endif
#endif
#ifndef ALC_EXT_DEDICATED
#define ALC_EXT_DEDICATED 1
#define AL_DEDICATED_GAIN 0x0001
#define AL_EFFECT_DEDICATED_DIALOGUE 0x9001
#define AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT 0x9000
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,3 @@
/* The tokens that would be defined here are already defined in efx.h. This
* empty file is here to provide compatibility with Windows-based projects
* that would include it. */

View File

@ -0,0 +1,758 @@
#ifndef AL_EFX_H
#define AL_EFX_H
#ifdef __cplusplus
extern "C" {
#endif
#define ALC_EXT_EFX_NAME "ALC_EXT_EFX"
#define ALC_EFX_MAJOR_VERSION 0x20001
#define ALC_EFX_MINOR_VERSION 0x20002
#define ALC_MAX_AUXILIARY_SENDS 0x20003
/* Listener properties. */
#define AL_METERS_PER_UNIT 0x20004
/* Source properties. */
#define AL_DIRECT_FILTER 0x20005
#define AL_AUXILIARY_SEND_FILTER 0x20006
#define AL_AIR_ABSORPTION_FACTOR 0x20007
#define AL_ROOM_ROLLOFF_FACTOR 0x20008
#define AL_CONE_OUTER_GAINHF 0x20009
#define AL_DIRECT_FILTER_GAINHF_AUTO 0x2000A
#define AL_AUXILIARY_SEND_FILTER_GAIN_AUTO 0x2000B
#define AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO 0x2000C
/* Effect properties. */
/* Reverb effect parameters */
#define AL_REVERB_DENSITY 0x0001
#define AL_REVERB_DIFFUSION 0x0002
#define AL_REVERB_GAIN 0x0003
#define AL_REVERB_GAINHF 0x0004
#define AL_REVERB_DECAY_TIME 0x0005
#define AL_REVERB_DECAY_HFRATIO 0x0006
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
#define AL_REVERB_DECAY_HFLIMIT 0x000D
/* EAX Reverb effect parameters */
#define AL_EAXREVERB_DENSITY 0x0001
#define AL_EAXREVERB_DIFFUSION 0x0002
#define AL_EAXREVERB_GAIN 0x0003
#define AL_EAXREVERB_GAINHF 0x0004
#define AL_EAXREVERB_GAINLF 0x0005
#define AL_EAXREVERB_DECAY_TIME 0x0006
#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
#define AL_EAXREVERB_ECHO_TIME 0x000F
#define AL_EAXREVERB_ECHO_DEPTH 0x0010
#define AL_EAXREVERB_MODULATION_TIME 0x0011
#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
#define AL_EAXREVERB_HFREFERENCE 0x0014
#define AL_EAXREVERB_LFREFERENCE 0x0015
#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
/* Chorus effect parameters */
#define AL_CHORUS_WAVEFORM 0x0001
#define AL_CHORUS_PHASE 0x0002
#define AL_CHORUS_RATE 0x0003
#define AL_CHORUS_DEPTH 0x0004
#define AL_CHORUS_FEEDBACK 0x0005
#define AL_CHORUS_DELAY 0x0006
/* Distortion effect parameters */
#define AL_DISTORTION_EDGE 0x0001
#define AL_DISTORTION_GAIN 0x0002
#define AL_DISTORTION_LOWPASS_CUTOFF 0x0003
#define AL_DISTORTION_EQCENTER 0x0004
#define AL_DISTORTION_EQBANDWIDTH 0x0005
/* Echo effect parameters */
#define AL_ECHO_DELAY 0x0001
#define AL_ECHO_LRDELAY 0x0002
#define AL_ECHO_DAMPING 0x0003
#define AL_ECHO_FEEDBACK 0x0004
#define AL_ECHO_SPREAD 0x0005
/* Flanger effect parameters */
#define AL_FLANGER_WAVEFORM 0x0001
#define AL_FLANGER_PHASE 0x0002
#define AL_FLANGER_RATE 0x0003
#define AL_FLANGER_DEPTH 0x0004
#define AL_FLANGER_FEEDBACK 0x0005
#define AL_FLANGER_DELAY 0x0006
/* Frequency shifter effect parameters */
#define AL_FREQUENCY_SHIFTER_FREQUENCY 0x0001
#define AL_FREQUENCY_SHIFTER_LEFT_DIRECTION 0x0002
#define AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION 0x0003
/* Vocal morpher effect parameters */
#define AL_VOCAL_MORPHER_PHONEMEA 0x0001
#define AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING 0x0002
#define AL_VOCAL_MORPHER_PHONEMEB 0x0003
#define AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING 0x0004
#define AL_VOCAL_MORPHER_WAVEFORM 0x0005
#define AL_VOCAL_MORPHER_RATE 0x0006
/* Pitchshifter effect parameters */
#define AL_PITCH_SHIFTER_COARSE_TUNE 0x0001
#define AL_PITCH_SHIFTER_FINE_TUNE 0x0002
/* Ringmodulator effect parameters */
#define AL_RING_MODULATOR_FREQUENCY 0x0001
#define AL_RING_MODULATOR_HIGHPASS_CUTOFF 0x0002
#define AL_RING_MODULATOR_WAVEFORM 0x0003
/* Autowah effect parameters */
#define AL_AUTOWAH_ATTACK_TIME 0x0001
#define AL_AUTOWAH_RELEASE_TIME 0x0002
#define AL_AUTOWAH_RESONANCE 0x0003
#define AL_AUTOWAH_PEAK_GAIN 0x0004
/* Compressor effect parameters */
#define AL_COMPRESSOR_ONOFF 0x0001
/* Equalizer effect parameters */
#define AL_EQUALIZER_LOW_GAIN 0x0001
#define AL_EQUALIZER_LOW_CUTOFF 0x0002
#define AL_EQUALIZER_MID1_GAIN 0x0003
#define AL_EQUALIZER_MID1_CENTER 0x0004
#define AL_EQUALIZER_MID1_WIDTH 0x0005
#define AL_EQUALIZER_MID2_GAIN 0x0006
#define AL_EQUALIZER_MID2_CENTER 0x0007
#define AL_EQUALIZER_MID2_WIDTH 0x0008
#define AL_EQUALIZER_HIGH_GAIN 0x0009
#define AL_EQUALIZER_HIGH_CUTOFF 0x000A
/* Effect type */
#define AL_EFFECT_FIRST_PARAMETER 0x0000
#define AL_EFFECT_LAST_PARAMETER 0x8000
#define AL_EFFECT_TYPE 0x8001
/* Effect types, used with the AL_EFFECT_TYPE property */
#define AL_EFFECT_NULL 0x0000
#define AL_EFFECT_REVERB 0x0001
#define AL_EFFECT_CHORUS 0x0002
#define AL_EFFECT_DISTORTION 0x0003
#define AL_EFFECT_ECHO 0x0004
#define AL_EFFECT_FLANGER 0x0005
#define AL_EFFECT_FREQUENCY_SHIFTER 0x0006
#define AL_EFFECT_VOCAL_MORPHER 0x0007
#define AL_EFFECT_PITCH_SHIFTER 0x0008
#define AL_EFFECT_RING_MODULATOR 0x0009
#define AL_EFFECT_AUTOWAH 0x000A
#define AL_EFFECT_COMPRESSOR 0x000B
#define AL_EFFECT_EQUALIZER 0x000C
#define AL_EFFECT_EAXREVERB 0x8000
/* Auxiliary Effect Slot properties. */
#define AL_EFFECTSLOT_EFFECT 0x0001
#define AL_EFFECTSLOT_GAIN 0x0002
#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
/* NULL Auxiliary Slot ID to disable a source send. */
#define AL_EFFECTSLOT_NULL 0x0000
/* Filter properties. */
/* Lowpass filter parameters */
#define AL_LOWPASS_GAIN 0x0001
#define AL_LOWPASS_GAINHF 0x0002
/* Highpass filter parameters */
#define AL_HIGHPASS_GAIN 0x0001
#define AL_HIGHPASS_GAINLF 0x0002
/* Bandpass filter parameters */
#define AL_BANDPASS_GAIN 0x0001
#define AL_BANDPASS_GAINLF 0x0002
#define AL_BANDPASS_GAINHF 0x0003
/* Filter type */
#define AL_FILTER_FIRST_PARAMETER 0x0000
#define AL_FILTER_LAST_PARAMETER 0x8000
#define AL_FILTER_TYPE 0x8001
/* Filter types, used with the AL_FILTER_TYPE property */
#define AL_FILTER_NULL 0x0000
#define AL_FILTER_LOWPASS 0x0001
#define AL_FILTER_HIGHPASS 0x0002
#define AL_FILTER_BANDPASS 0x0003
/* Effect object function types. */
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, ALuint*);
typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
/* Filter object function types. */
typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, ALuint*);
typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
/* Auxiliary Effect Slot object function types. */
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects);
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters);
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
#endif
/* Filter ranges and defaults. */
/* Lowpass filter */
#define LOWPASS_MIN_GAIN (0.0f)
#define LOWPASS_MAX_GAIN (1.0f)
#define LOWPASS_DEFAULT_GAIN (1.0f)
#define LOWPASS_MIN_GAINHF (0.0f)
#define LOWPASS_MAX_GAINHF (1.0f)
#define LOWPASS_DEFAULT_GAINHF (1.0f)
/* Highpass filter */
#define HIGHPASS_MIN_GAIN (0.0f)
#define HIGHPASS_MAX_GAIN (1.0f)
#define HIGHPASS_DEFAULT_GAIN (1.0f)
#define HIGHPASS_MIN_GAINLF (0.0f)
#define HIGHPASS_MAX_GAINLF (1.0f)
#define HIGHPASS_DEFAULT_GAINLF (1.0f)
/* Bandpass filter */
#define BANDPASS_MIN_GAIN (0.0f)
#define BANDPASS_MAX_GAIN (1.0f)
#define BANDPASS_DEFAULT_GAIN (1.0f)
#define BANDPASS_MIN_GAINHF (0.0f)
#define BANDPASS_MAX_GAINHF (1.0f)
#define BANDPASS_DEFAULT_GAINHF (1.0f)
#define BANDPASS_MIN_GAINLF (0.0f)
#define BANDPASS_MAX_GAINLF (1.0f)
#define BANDPASS_DEFAULT_GAINLF (1.0f)
/* Effect parameter ranges and defaults. */
/* Standard reverb effect */
#define AL_REVERB_MIN_DENSITY (0.0f)
#define AL_REVERB_MAX_DENSITY (1.0f)
#define AL_REVERB_DEFAULT_DENSITY (1.0f)
#define AL_REVERB_MIN_DIFFUSION (0.0f)
#define AL_REVERB_MAX_DIFFUSION (1.0f)
#define AL_REVERB_DEFAULT_DIFFUSION (1.0f)
#define AL_REVERB_MIN_GAIN (0.0f)
#define AL_REVERB_MAX_GAIN (1.0f)
#define AL_REVERB_DEFAULT_GAIN (0.32f)
#define AL_REVERB_MIN_GAINHF (0.0f)
#define AL_REVERB_MAX_GAINHF (1.0f)
#define AL_REVERB_DEFAULT_GAINHF (0.89f)
#define AL_REVERB_MIN_DECAY_TIME (0.1f)
#define AL_REVERB_MAX_DECAY_TIME (20.0f)
#define AL_REVERB_DEFAULT_DECAY_TIME (1.49f)
#define AL_REVERB_MIN_DECAY_HFRATIO (0.1f)
#define AL_REVERB_MAX_DECAY_HFRATIO (2.0f)
#define AL_REVERB_DEFAULT_DECAY_HFRATIO (0.83f)
#define AL_REVERB_MIN_REFLECTIONS_GAIN (0.0f)
#define AL_REVERB_MAX_REFLECTIONS_GAIN (3.16f)
#define AL_REVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
#define AL_REVERB_MIN_REFLECTIONS_DELAY (0.0f)
#define AL_REVERB_MAX_REFLECTIONS_DELAY (0.3f)
#define AL_REVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
#define AL_REVERB_MIN_LATE_REVERB_GAIN (0.0f)
#define AL_REVERB_MAX_LATE_REVERB_GAIN (10.0f)
#define AL_REVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
#define AL_REVERB_MIN_LATE_REVERB_DELAY (0.0f)
#define AL_REVERB_MAX_LATE_REVERB_DELAY (0.1f)
#define AL_REVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
#define AL_REVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
#define AL_REVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
#define AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
#define AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
#define AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
#define AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
#define AL_REVERB_MIN_DECAY_HFLIMIT AL_FALSE
#define AL_REVERB_MAX_DECAY_HFLIMIT AL_TRUE
#define AL_REVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
/* EAX reverb effect */
#define AL_EAXREVERB_MIN_DENSITY (0.0f)
#define AL_EAXREVERB_MAX_DENSITY (1.0f)
#define AL_EAXREVERB_DEFAULT_DENSITY (1.0f)
#define AL_EAXREVERB_MIN_DIFFUSION (0.0f)
#define AL_EAXREVERB_MAX_DIFFUSION (1.0f)
#define AL_EAXREVERB_DEFAULT_DIFFUSION (1.0f)
#define AL_EAXREVERB_MIN_GAIN (0.0f)
#define AL_EAXREVERB_MAX_GAIN (1.0f)
#define AL_EAXREVERB_DEFAULT_GAIN (0.32f)
#define AL_EAXREVERB_MIN_GAINHF (0.0f)
#define AL_EAXREVERB_MAX_GAINHF (1.0f)
#define AL_EAXREVERB_DEFAULT_GAINHF (0.89f)
#define AL_EAXREVERB_MIN_GAINLF (0.0f)
#define AL_EAXREVERB_MAX_GAINLF (1.0f)
#define AL_EAXREVERB_DEFAULT_GAINLF (1.0f)
#define AL_EAXREVERB_MIN_DECAY_TIME (0.1f)
#define AL_EAXREVERB_MAX_DECAY_TIME (20.0f)
#define AL_EAXREVERB_DEFAULT_DECAY_TIME (1.49f)
#define AL_EAXREVERB_MIN_DECAY_HFRATIO (0.1f)
#define AL_EAXREVERB_MAX_DECAY_HFRATIO (2.0f)
#define AL_EAXREVERB_DEFAULT_DECAY_HFRATIO (0.83f)
#define AL_EAXREVERB_MIN_DECAY_LFRATIO (0.1f)
#define AL_EAXREVERB_MAX_DECAY_LFRATIO (2.0f)
#define AL_EAXREVERB_DEFAULT_DECAY_LFRATIO (1.0f)
#define AL_EAXREVERB_MIN_REFLECTIONS_GAIN (0.0f)
#define AL_EAXREVERB_MAX_REFLECTIONS_GAIN (3.16f)
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN (0.05f)
#define AL_EAXREVERB_MIN_REFLECTIONS_DELAY (0.0f)
#define AL_EAXREVERB_MAX_REFLECTIONS_DELAY (0.3f)
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY (0.007f)
#define AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ (0.0f)
#define AL_EAXREVERB_MIN_LATE_REVERB_GAIN (0.0f)
#define AL_EAXREVERB_MAX_LATE_REVERB_GAIN (10.0f)
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN (1.26f)
#define AL_EAXREVERB_MIN_LATE_REVERB_DELAY (0.0f)
#define AL_EAXREVERB_MAX_LATE_REVERB_DELAY (0.1f)
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY (0.011f)
#define AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ (0.0f)
#define AL_EAXREVERB_MIN_ECHO_TIME (0.075f)
#define AL_EAXREVERB_MAX_ECHO_TIME (0.25f)
#define AL_EAXREVERB_DEFAULT_ECHO_TIME (0.25f)
#define AL_EAXREVERB_MIN_ECHO_DEPTH (0.0f)
#define AL_EAXREVERB_MAX_ECHO_DEPTH (1.0f)
#define AL_EAXREVERB_DEFAULT_ECHO_DEPTH (0.0f)
#define AL_EAXREVERB_MIN_MODULATION_TIME (0.04f)
#define AL_EAXREVERB_MAX_MODULATION_TIME (4.0f)
#define AL_EAXREVERB_DEFAULT_MODULATION_TIME (0.25f)
#define AL_EAXREVERB_MIN_MODULATION_DEPTH (0.0f)
#define AL_EAXREVERB_MAX_MODULATION_DEPTH (1.0f)
#define AL_EAXREVERB_DEFAULT_MODULATION_DEPTH (0.0f)
#define AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF (0.892f)
#define AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF (1.0f)
#define AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF (0.994f)
#define AL_EAXREVERB_MIN_HFREFERENCE (1000.0f)
#define AL_EAXREVERB_MAX_HFREFERENCE (20000.0f)
#define AL_EAXREVERB_DEFAULT_HFREFERENCE (5000.0f)
#define AL_EAXREVERB_MIN_LFREFERENCE (20.0f)
#define AL_EAXREVERB_MAX_LFREFERENCE (1000.0f)
#define AL_EAXREVERB_DEFAULT_LFREFERENCE (250.0f)
#define AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
#define AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
#define AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
#define AL_EAXREVERB_MIN_DECAY_HFLIMIT AL_FALSE
#define AL_EAXREVERB_MAX_DECAY_HFLIMIT AL_TRUE
#define AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT AL_TRUE
/* Chorus effect */
#define AL_CHORUS_WAVEFORM_SINUSOID (0)
#define AL_CHORUS_WAVEFORM_TRIANGLE (1)
#define AL_CHORUS_MIN_WAVEFORM (0)
#define AL_CHORUS_MAX_WAVEFORM (1)
#define AL_CHORUS_DEFAULT_WAVEFORM (1)
#define AL_CHORUS_MIN_PHASE (-180)
#define AL_CHORUS_MAX_PHASE (180)
#define AL_CHORUS_DEFAULT_PHASE (90)
#define AL_CHORUS_MIN_RATE (0.0f)
#define AL_CHORUS_MAX_RATE (10.0f)
#define AL_CHORUS_DEFAULT_RATE (1.1f)
#define AL_CHORUS_MIN_DEPTH (0.0f)
#define AL_CHORUS_MAX_DEPTH (1.0f)
#define AL_CHORUS_DEFAULT_DEPTH (0.1f)
#define AL_CHORUS_MIN_FEEDBACK (-1.0f)
#define AL_CHORUS_MAX_FEEDBACK (1.0f)
#define AL_CHORUS_DEFAULT_FEEDBACK (0.25f)
#define AL_CHORUS_MIN_DELAY (0.0f)
#define AL_CHORUS_MAX_DELAY (0.016f)
#define AL_CHORUS_DEFAULT_DELAY (0.016f)
/* Distortion effect */
#define AL_DISTORTION_MIN_EDGE (0.0f)
#define AL_DISTORTION_MAX_EDGE (1.0f)
#define AL_DISTORTION_DEFAULT_EDGE (0.2f)
#define AL_DISTORTION_MIN_GAIN (0.01f)
#define AL_DISTORTION_MAX_GAIN (1.0f)
#define AL_DISTORTION_DEFAULT_GAIN (0.05f)
#define AL_DISTORTION_MIN_LOWPASS_CUTOFF (80.0f)
#define AL_DISTORTION_MAX_LOWPASS_CUTOFF (24000.0f)
#define AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF (8000.0f)
#define AL_DISTORTION_MIN_EQCENTER (80.0f)
#define AL_DISTORTION_MAX_EQCENTER (24000.0f)
#define AL_DISTORTION_DEFAULT_EQCENTER (3600.0f)
#define AL_DISTORTION_MIN_EQBANDWIDTH (80.0f)
#define AL_DISTORTION_MAX_EQBANDWIDTH (24000.0f)
#define AL_DISTORTION_DEFAULT_EQBANDWIDTH (3600.0f)
/* Echo effect */
#define AL_ECHO_MIN_DELAY (0.0f)
#define AL_ECHO_MAX_DELAY (0.207f)
#define AL_ECHO_DEFAULT_DELAY (0.1f)
#define AL_ECHO_MIN_LRDELAY (0.0f)
#define AL_ECHO_MAX_LRDELAY (0.404f)
#define AL_ECHO_DEFAULT_LRDELAY (0.1f)
#define AL_ECHO_MIN_DAMPING (0.0f)
#define AL_ECHO_MAX_DAMPING (0.99f)
#define AL_ECHO_DEFAULT_DAMPING (0.5f)
#define AL_ECHO_MIN_FEEDBACK (0.0f)
#define AL_ECHO_MAX_FEEDBACK (1.0f)
#define AL_ECHO_DEFAULT_FEEDBACK (0.5f)
#define AL_ECHO_MIN_SPREAD (-1.0f)
#define AL_ECHO_MAX_SPREAD (1.0f)
#define AL_ECHO_DEFAULT_SPREAD (-1.0f)
/* Flanger effect */
#define AL_FLANGER_WAVEFORM_SINUSOID (0)
#define AL_FLANGER_WAVEFORM_TRIANGLE (1)
#define AL_FLANGER_MIN_WAVEFORM (0)
#define AL_FLANGER_MAX_WAVEFORM (1)
#define AL_FLANGER_DEFAULT_WAVEFORM (1)
#define AL_FLANGER_MIN_PHASE (-180)
#define AL_FLANGER_MAX_PHASE (180)
#define AL_FLANGER_DEFAULT_PHASE (0)
#define AL_FLANGER_MIN_RATE (0.0f)
#define AL_FLANGER_MAX_RATE (10.0f)
#define AL_FLANGER_DEFAULT_RATE (0.27f)
#define AL_FLANGER_MIN_DEPTH (0.0f)
#define AL_FLANGER_MAX_DEPTH (1.0f)
#define AL_FLANGER_DEFAULT_DEPTH (1.0f)
#define AL_FLANGER_MIN_FEEDBACK (-1.0f)
#define AL_FLANGER_MAX_FEEDBACK (1.0f)
#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
#define AL_FLANGER_MIN_DELAY (0.0f)
#define AL_FLANGER_MAX_DELAY (0.004f)
#define AL_FLANGER_DEFAULT_DELAY (0.002f)
/* Frequency shifter effect */
#define AL_FREQUENCY_SHIFTER_MIN_FREQUENCY (0.0f)
#define AL_FREQUENCY_SHIFTER_MAX_FREQUENCY (24000.0f)
#define AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY (0.0f)
#define AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION (0)
#define AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION (2)
#define AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION (0)
#define AL_FREQUENCY_SHIFTER_DIRECTION_DOWN (0)
#define AL_FREQUENCY_SHIFTER_DIRECTION_UP (1)
#define AL_FREQUENCY_SHIFTER_DIRECTION_OFF (2)
#define AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION (0)
#define AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION (2)
#define AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION (0)
/* Vocal morpher effect */
#define AL_VOCAL_MORPHER_MIN_PHONEMEA (0)
#define AL_VOCAL_MORPHER_MAX_PHONEMEA (29)
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA (0)
#define AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING (-24)
#define AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING (24)
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEA_COARSE_TUNING (0)
#define AL_VOCAL_MORPHER_MIN_PHONEMEB (0)
#define AL_VOCAL_MORPHER_MAX_PHONEMEB (29)
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB (10)
#define AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING (-24)
#define AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING (24)
#define AL_VOCAL_MORPHER_DEFAULT_PHONEMEB_COARSE_TUNING (0)
#define AL_VOCAL_MORPHER_PHONEME_A (0)
#define AL_VOCAL_MORPHER_PHONEME_E (1)
#define AL_VOCAL_MORPHER_PHONEME_I (2)
#define AL_VOCAL_MORPHER_PHONEME_O (3)
#define AL_VOCAL_MORPHER_PHONEME_U (4)
#define AL_VOCAL_MORPHER_PHONEME_AA (5)
#define AL_VOCAL_MORPHER_PHONEME_AE (6)
#define AL_VOCAL_MORPHER_PHONEME_AH (7)
#define AL_VOCAL_MORPHER_PHONEME_AO (8)
#define AL_VOCAL_MORPHER_PHONEME_EH (9)
#define AL_VOCAL_MORPHER_PHONEME_ER (10)
#define AL_VOCAL_MORPHER_PHONEME_IH (11)
#define AL_VOCAL_MORPHER_PHONEME_IY (12)
#define AL_VOCAL_MORPHER_PHONEME_UH (13)
#define AL_VOCAL_MORPHER_PHONEME_UW (14)
#define AL_VOCAL_MORPHER_PHONEME_B (15)
#define AL_VOCAL_MORPHER_PHONEME_D (16)
#define AL_VOCAL_MORPHER_PHONEME_F (17)
#define AL_VOCAL_MORPHER_PHONEME_G (18)
#define AL_VOCAL_MORPHER_PHONEME_J (19)
#define AL_VOCAL_MORPHER_PHONEME_K (20)
#define AL_VOCAL_MORPHER_PHONEME_L (21)
#define AL_VOCAL_MORPHER_PHONEME_M (22)
#define AL_VOCAL_MORPHER_PHONEME_N (23)
#define AL_VOCAL_MORPHER_PHONEME_P (24)
#define AL_VOCAL_MORPHER_PHONEME_R (25)
#define AL_VOCAL_MORPHER_PHONEME_S (26)
#define AL_VOCAL_MORPHER_PHONEME_T (27)
#define AL_VOCAL_MORPHER_PHONEME_V (28)
#define AL_VOCAL_MORPHER_PHONEME_Z (29)
#define AL_VOCAL_MORPHER_WAVEFORM_SINUSOID (0)
#define AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE (1)
#define AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH (2)
#define AL_VOCAL_MORPHER_MIN_WAVEFORM (0)
#define AL_VOCAL_MORPHER_MAX_WAVEFORM (2)
#define AL_VOCAL_MORPHER_DEFAULT_WAVEFORM (0)
#define AL_VOCAL_MORPHER_MIN_RATE (0.0f)
#define AL_VOCAL_MORPHER_MAX_RATE (10.0f)
#define AL_VOCAL_MORPHER_DEFAULT_RATE (1.41f)
/* Pitch shifter effect */
#define AL_PITCH_SHIFTER_MIN_COARSE_TUNE (-12)
#define AL_PITCH_SHIFTER_MAX_COARSE_TUNE (12)
#define AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE (12)
#define AL_PITCH_SHIFTER_MIN_FINE_TUNE (-50)
#define AL_PITCH_SHIFTER_MAX_FINE_TUNE (50)
#define AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE (0)
/* Ring modulator effect */
#define AL_RING_MODULATOR_MIN_FREQUENCY (0.0f)
#define AL_RING_MODULATOR_MAX_FREQUENCY (8000.0f)
#define AL_RING_MODULATOR_DEFAULT_FREQUENCY (440.0f)
#define AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF (0.0f)
#define AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF (24000.0f)
#define AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF (800.0f)
#define AL_RING_MODULATOR_SINUSOID (0)
#define AL_RING_MODULATOR_SAWTOOTH (1)
#define AL_RING_MODULATOR_SQUARE (2)
#define AL_RING_MODULATOR_MIN_WAVEFORM (0)
#define AL_RING_MODULATOR_MAX_WAVEFORM (2)
#define AL_RING_MODULATOR_DEFAULT_WAVEFORM (0)
/* Autowah effect */
#define AL_AUTOWAH_MIN_ATTACK_TIME (0.0001f)
#define AL_AUTOWAH_MAX_ATTACK_TIME (1.0f)
#define AL_AUTOWAH_DEFAULT_ATTACK_TIME (0.06f)
#define AL_AUTOWAH_MIN_RELEASE_TIME (0.0001f)
#define AL_AUTOWAH_MAX_RELEASE_TIME (1.0f)
#define AL_AUTOWAH_DEFAULT_RELEASE_TIME (0.06f)
#define AL_AUTOWAH_MIN_RESONANCE (2.0f)
#define AL_AUTOWAH_MAX_RESONANCE (1000.0f)
#define AL_AUTOWAH_DEFAULT_RESONANCE (1000.0f)
#define AL_AUTOWAH_MIN_PEAK_GAIN (0.00003f)
#define AL_AUTOWAH_MAX_PEAK_GAIN (31621.0f)
#define AL_AUTOWAH_DEFAULT_PEAK_GAIN (11.22f)
/* Compressor effect */
#define AL_COMPRESSOR_MIN_ONOFF (0)
#define AL_COMPRESSOR_MAX_ONOFF (1)
#define AL_COMPRESSOR_DEFAULT_ONOFF (1)
/* Equalizer effect */
#define AL_EQUALIZER_MIN_LOW_GAIN (0.126f)
#define AL_EQUALIZER_MAX_LOW_GAIN (7.943f)
#define AL_EQUALIZER_DEFAULT_LOW_GAIN (1.0f)
#define AL_EQUALIZER_MIN_LOW_CUTOFF (50.0f)
#define AL_EQUALIZER_MAX_LOW_CUTOFF (800.0f)
#define AL_EQUALIZER_DEFAULT_LOW_CUTOFF (200.0f)
#define AL_EQUALIZER_MIN_MID1_GAIN (0.126f)
#define AL_EQUALIZER_MAX_MID1_GAIN (7.943f)
#define AL_EQUALIZER_DEFAULT_MID1_GAIN (1.0f)
#define AL_EQUALIZER_MIN_MID1_CENTER (200.0f)
#define AL_EQUALIZER_MAX_MID1_CENTER (3000.0f)
#define AL_EQUALIZER_DEFAULT_MID1_CENTER (500.0f)
#define AL_EQUALIZER_MIN_MID1_WIDTH (0.01f)
#define AL_EQUALIZER_MAX_MID1_WIDTH (1.0f)
#define AL_EQUALIZER_DEFAULT_MID1_WIDTH (1.0f)
#define AL_EQUALIZER_MIN_MID2_GAIN (0.126f)
#define AL_EQUALIZER_MAX_MID2_GAIN (7.943f)
#define AL_EQUALIZER_DEFAULT_MID2_GAIN (1.0f)
#define AL_EQUALIZER_MIN_MID2_CENTER (1000.0f)
#define AL_EQUALIZER_MAX_MID2_CENTER (8000.0f)
#define AL_EQUALIZER_DEFAULT_MID2_CENTER (3000.0f)
#define AL_EQUALIZER_MIN_MID2_WIDTH (0.01f)
#define AL_EQUALIZER_MAX_MID2_WIDTH (1.0f)
#define AL_EQUALIZER_DEFAULT_MID2_WIDTH (1.0f)
#define AL_EQUALIZER_MIN_HIGH_GAIN (0.126f)
#define AL_EQUALIZER_MAX_HIGH_GAIN (7.943f)
#define AL_EQUALIZER_DEFAULT_HIGH_GAIN (1.0f)
#define AL_EQUALIZER_MIN_HIGH_CUTOFF (4000.0f)
#define AL_EQUALIZER_MAX_HIGH_CUTOFF (16000.0f)
#define AL_EQUALIZER_DEFAULT_HIGH_CUTOFF (6000.0f)
/* Source parameter value ranges and defaults. */
#define AL_MIN_AIR_ABSORPTION_FACTOR (0.0f)
#define AL_MAX_AIR_ABSORPTION_FACTOR (10.0f)
#define AL_DEFAULT_AIR_ABSORPTION_FACTOR (0.0f)
#define AL_MIN_ROOM_ROLLOFF_FACTOR (0.0f)
#define AL_MAX_ROOM_ROLLOFF_FACTOR (10.0f)
#define AL_DEFAULT_ROOM_ROLLOFF_FACTOR (0.0f)
#define AL_MIN_CONE_OUTER_GAINHF (0.0f)
#define AL_MAX_CONE_OUTER_GAINHF (1.0f)
#define AL_DEFAULT_CONE_OUTER_GAINHF (1.0f)
#define AL_MIN_DIRECT_FILTER_GAINHF_AUTO AL_FALSE
#define AL_MAX_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
#define AL_DEFAULT_DIRECT_FILTER_GAINHF_AUTO AL_TRUE
#define AL_MIN_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_FALSE
#define AL_MAX_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAIN_AUTO AL_TRUE
#define AL_MIN_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_FALSE
#define AL_MAX_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
#define AL_DEFAULT_AUXILIARY_SEND_FILTER_GAINHF_AUTO AL_TRUE
/* Listener parameter value ranges and defaults. */
#define AL_MIN_METERS_PER_UNIT FLT_MIN
#define AL_MAX_METERS_PER_UNIT FLT_MAX
#define AL_DEFAULT_METERS_PER_UNIT (1.0f)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* AL_EFX_H */

View File

@ -0,0 +1,370 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__ALL_H
#define FLAC__ALL_H
#include "export.h"
#include "assert.h"
#include "callback.h"
#include "format.h"
#include "metadata.h"
#include "ordinals.h"
#include "stream_decoder.h"
#include "stream_encoder.h"
/** \mainpage
*
* \section intro Introduction
*
* This is the documentation for the FLAC C and C++ APIs. It is
* highly interconnected; this introduction should give you a top
* level idea of the structure and how to find the information you
* need. As a prerequisite you should have at least a basic
* knowledge of the FLAC format, documented
* <A HREF="../format.html">here</A>.
*
* \section c_api FLAC C API
*
* The FLAC C API is the interface to libFLAC, a set of structures
* describing the components of FLAC streams, and functions for
* encoding and decoding streams, as well as manipulating FLAC
* metadata in files. The public include files will be installed
* in your include area (for example /usr/include/FLAC/...).
*
* By writing a little code and linking against libFLAC, it is
* relatively easy to add FLAC support to another program. The
* library is licensed under <A HREF="../license.html">Xiph's BSD license</A>.
* Complete source code of libFLAC as well as the command-line
* encoder and plugins is available and is a useful source of
* examples.
*
* Aside from encoders and decoders, libFLAC provides a powerful
* metadata interface for manipulating metadata in FLAC files. It
* allows the user to add, delete, and modify FLAC metadata blocks
* and it can automatically take advantage of PADDING blocks to avoid
* rewriting the entire FLAC file when changing the size of the
* metadata.
*
* libFLAC usually only requires the standard C library and C math
* library. In particular, threading is not used so there is no
* dependency on a thread library. However, libFLAC does not use
* global variables and should be thread-safe.
*
* libFLAC also supports encoding to and decoding from Ogg FLAC.
* However the metadata editing interfaces currently have limited
* read-only support for Ogg FLAC files.
*
* \section cpp_api FLAC C++ API
*
* The FLAC C++ API is a set of classes that encapsulate the
* structures and functions in libFLAC. They provide slightly more
* functionality with respect to metadata but are otherwise
* equivalent. For the most part, they share the same usage as
* their counterparts in libFLAC, and the FLAC C API documentation
* can be used as a supplement. The public include files
* for the C++ API will be installed in your include area (for
* example /usr/include/FLAC++/...).
*
* libFLAC++ is also licensed under
* <A HREF="../license.html">Xiph's BSD license</A>.
*
* \section getting_started Getting Started
*
* A good starting point for learning the API is to browse through
* the <A HREF="modules.html">modules</A>. Modules are logical
* groupings of related functions or classes, which correspond roughly
* to header files or sections of header files. Each module includes a
* detailed description of the general usage of its functions or
* classes.
*
* From there you can go on to look at the documentation of
* individual functions. You can see different views of the individual
* functions through the links in top bar across this page.
*
* If you prefer a more hands-on approach, you can jump right to some
* <A HREF="../documentation_example_code.html">example code</A>.
*
* \section porting_guide Porting Guide
*
* Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink
* has been introduced which gives detailed instructions on how to
* port your code to newer versions of FLAC.
*
* \section embedded_developers Embedded Developers
*
* libFLAC has grown larger over time as more functionality has been
* included, but much of it may be unnecessary for a particular embedded
* implementation. Unused parts may be pruned by some simple editing of
* src/libFLAC/Makefile.am. In general, the decoders, encoders, and
* metadata interface are all independent from each other.
*
* It is easiest to just describe the dependencies:
*
* - All modules depend on the \link flac_format Format \endlink module.
* - The decoders and encoders depend on the bitbuffer.
* - The decoder is independent of the encoder. The encoder uses the
* decoder because of the verify feature, but this can be removed if
* not needed.
* - Parts of the metadata interface require the stream decoder (but not
* the encoder).
* - Ogg support is selectable through the compile time macro
* \c FLAC__HAS_OGG.
*
* For example, if your application only requires the stream decoder, no
* encoder, and no metadata interface, you can remove the stream encoder
* and the metadata interface, which will greatly reduce the size of the
* library.
*
* Also, there are several places in the libFLAC code with comments marked
* with "OPT:" where a #define can be changed to enable code that might be
* faster on a specific platform. Experimenting with these can yield faster
* binaries.
*/
/** \defgroup porting Porting Guide for New Versions
*
* This module describes differences in the library interfaces from
* version to version. It assists in the porting of code that uses
* the libraries to newer versions of FLAC.
*
* One simple facility for making porting easier that has been added
* in FLAC 1.1.3 is a set of \c #defines in \c export.h of each
* library's includes (e.g. \c include/FLAC/export.h). The
* \c #defines mirror the libraries'
* <A HREF="http://www.gnu.org/software/libtool/manual.html#Libtool-versioning">libtool version numbers</A>,
* e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
* \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
* These can be used to support multiple versions of an API during the
* transition phase, e.g.
*
* \code
* #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
* legacy code
* #else
* new code
* #endif
* \endcode
*
* The the source will work for multiple versions and the legacy code can
* easily be removed when the transition is complete.
*
* Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
* include/FLAC/export.h), which can be used to determine whether or not
* the library has been compiled with support for Ogg FLAC. This is
* simpler than trying to call an Ogg init function and catching the
* error.
*/
/** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.2 to FLAC 1.1.3.
*
* The main change between the APIs in 1.1.2 and 1.1.3 is that they have
* been simplified. First, libOggFLAC has been merged into libFLAC and
* libOggFLAC++ has been merged into libFLAC++. Second, both the three
* decoding layers and three encoding layers have been merged into a
* single stream decoder and stream encoder. That is, the functionality
* of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged
* into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and
* FLAC__FileEncoder into FLAC__StreamEncoder. Only the
* FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means
* is there is now a single API that can be used to encode or decode
* streams to/from native FLAC or Ogg FLAC and the single API can work
* on both seekable and non-seekable streams.
*
* Instead of creating an encoder or decoder of a certain layer, now the
* client will always create a FLAC__StreamEncoder or
* FLAC__StreamDecoder. The old layers are now differentiated by the
* initialization function. For example, for the decoder,
* FLAC__stream_decoder_init() has been replaced by
* FLAC__stream_decoder_init_stream(). This init function takes
* callbacks for the I/O, and the seeking callbacks are optional. This
* allows the client to use the same object for seekable and
* non-seekable streams. For decoding a FLAC file directly, the client
* can use FLAC__stream_decoder_init_file() and pass just a filename
* and fewer callbacks; most of the other callbacks are supplied
* internally. For situations where fopen()ing by filename is not
* possible (e.g. Unicode filenames on Windows) the client can instead
* open the file itself and supply the FILE* to
* FLAC__stream_decoder_init_FILE(). The init functions now returns a
* FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState.
* Since the callbacks and client data are now passed to the init
* function, the FLAC__stream_decoder_set_*_callback() functions and
* FLAC__stream_decoder_set_client_data() are no longer needed. The
* rest of the calls to the decoder are the same as before.
*
* There are counterpart init functions for Ogg FLAC, e.g.
* FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls
* and callbacks are the same as for native FLAC.
*
* As an example, in FLAC 1.1.2 a seekable stream decoder would have
* been set up like so:
*
* \code
* FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new();
* if(decoder == NULL) do_something;
* FLAC__seekable_stream_decoder_set_md5_checking(decoder, true);
* [... other settings ...]
* FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback);
* FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback);
* FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback);
* FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback);
* FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback);
* FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback);
* FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback);
* FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback);
* FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data);
* if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something;
* \endcode
*
* In FLAC 1.1.3 it is like this:
*
* \code
* FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new();
* if(decoder == NULL) do_something;
* FLAC__stream_decoder_set_md5_checking(decoder, true);
* [... other settings ...]
* if(FLAC__stream_decoder_init_stream(
* decoder,
* my_read_callback,
* my_seek_callback, // or NULL
* my_tell_callback, // or NULL
* my_length_callback, // or NULL
* my_eof_callback, // or NULL
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* or you could do;
*
* \code
* [...]
* FILE *file = fopen("somefile.flac","rb");
* if(file == NULL) do_somthing;
* if(FLAC__stream_decoder_init_FILE(
* decoder,
* file,
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* or just:
*
* \code
* [...]
* if(FLAC__stream_decoder_init_file(
* decoder,
* "somefile.flac",
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* Another small change to the decoder is in how it handles unparseable
* streams. Before, when the decoder found an unparseable stream
* (reserved for when the decoder encounters a stream from a future
* encoder that it can't parse), it changed the state to
* \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead
* drops sync and calls the error callback with a new error code
* \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is
* more robust. If your error callback does not discriminate on the the
* error state, your code does not need to be changed.
*
* The encoder now has a new setting:
* FLAC__stream_encoder_set_apodization(). This is for setting the
* method used to window the data before LPC analysis. You only need to
* add a call to this function if the default is not suitable. There
* are also two new convenience functions that may be useful:
* FLAC__metadata_object_cuesheet_calculate_cddb_id() and
* FLAC__metadata_get_cuesheet().
*
* The \a bytes parameter to FLAC__StreamDecoderReadCallback,
* FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
* is now \c size_t instead of \c unsigned.
*/
/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.3 to FLAC 1.1.4.
*
* There were no changes to any of the interfaces from 1.1.3 to 1.1.4.
* There was a slight change in the implementation of
* FLAC__stream_encoder_set_metadata(); the function now makes a copy
* of the \a metadata array of pointers so the client no longer needs
* to maintain it after the call. The objects themselves that are
* pointed to by the array are still not copied though and must be
* maintained until the call to FLAC__stream_encoder_finish().
*/
/** \defgroup porting_1_1_4_to_1_2_0 Porting from FLAC 1.1.4 to 1.2.0
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.4 to FLAC 1.2.0.
*
* There were only very minor changes to the interfaces from 1.1.4 to 1.2.0.
* In libFLAC, \c FLAC__format_sample_rate_is_subset() was added.
* In libFLAC++, \c FLAC::Decoder::Stream::get_decode_position() was added.
*
* Finally, value of the constant \c FLAC__FRAME_HEADER_RESERVED_LEN
* has changed to reflect the conversion of one of the reserved bits
* into active use. It used to be \c 2 and now is \c 1. However the
* FLAC frame header length has not changed, so to skip the proper
* number of bits, use \c FLAC__FRAME_HEADER_RESERVED_LEN +
* \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN
*/
/** \defgroup flac FLAC C API
*
* The FLAC C API is the interface to libFLAC, a set of structures
* describing the components of FLAC streams, and functions for
* encoding and decoding streams, as well as manipulating FLAC
* metadata in files.
*
* You should start with the format components as all other modules
* are dependent on it.
*/
#endif

View File

@ -0,0 +1,45 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__ASSERT_H
#define FLAC__ASSERT_H
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
#ifdef DEBUG
#include <assert.h>
#define FLAC__ASSERT(x) assert(x)
#define FLAC__ASSERT_DECLARATION(x) x
#else
#define FLAC__ASSERT(x)
#define FLAC__ASSERT_DECLARATION(x)
#endif
#endif

View File

@ -0,0 +1,184 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2004,2005,2006,2007 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__CALLBACK_H
#define FLAC__CALLBACK_H
#include "ordinals.h"
#include <stdlib.h> /* for size_t */
/** \file include/FLAC/callback.h
*
* \brief
* This module defines the structures for describing I/O callbacks
* to the other FLAC interfaces.
*
* See the detailed documentation for callbacks in the
* \link flac_callbacks callbacks \endlink module.
*/
/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
* \ingroup flac
*
* \brief
* This module defines the structures for describing I/O callbacks
* to the other FLAC interfaces.
*
* The purpose of the I/O callback functions is to create a common way
* for the metadata interfaces to handle I/O.
*
* Originally the metadata interfaces required filenames as the way of
* specifying FLAC files to operate on. This is problematic in some
* environments so there is an additional option to specify a set of
* callbacks for doing I/O on the FLAC file, instead of the filename.
*
* In addition to the callbacks, a FLAC__IOHandle type is defined as an
* opaque structure for a data source.
*
* The callback function prototypes are similar (but not identical) to the
* stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
* stdio streams to implement the callbacks, you can pass fread, fwrite, and
* fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
* FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
* is required. \warning You generally CANNOT directly use fseek or ftell
* for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
* these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
* large files. You will have to find an equivalent function (e.g. ftello),
* or write a wrapper. The same is true for feof() since this is usually
* implemented as a macro, not as a function whose address can be taken.
*
* \{
*/
#ifdef __cplusplus
extern "C" {
#endif
/** This is the opaque handle type used by the callbacks. Typically
* this is a \c FILE* or address of a file descriptor.
*/
typedef void* FLAC__IOHandle;
/** Signature for the read callback.
* The signature and semantics match POSIX fread() implementations
* and can generally be used interchangeably.
*
* \param ptr The address of the read buffer.
* \param size The size of the records to be read.
* \param nmemb The number of records to be read.
* \param handle The handle to the data source.
* \retval size_t
* The number of records read.
*/
typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
/** Signature for the write callback.
* The signature and semantics match POSIX fwrite() implementations
* and can generally be used interchangeably.
*
* \param ptr The address of the write buffer.
* \param size The size of the records to be written.
* \param nmemb The number of records to be written.
* \param handle The handle to the data source.
* \retval size_t
* The number of records written.
*/
typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
/** Signature for the seek callback.
* The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
* EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
* and 32-bits wide.
*
* \param handle The handle to the data source.
* \param offset The new position, relative to \a whence
* \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
* \retval int
* \c 0 on success, \c -1 on error.
*/
typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
/** Signature for the tell callback.
* The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
* EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
* and 32-bits wide.
*
* \param handle The handle to the data source.
* \retval FLAC__int64
* The current position on success, \c -1 on error.
*/
typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
/** Signature for the EOF callback.
* The signature and semantics mostly match POSIX feof() but WATCHOUT:
* on many systems, feof() is a macro, so in this case a wrapper function
* must be provided instead.
*
* \param handle The handle to the data source.
* \retval int
* \c 0 if not at end of file, nonzero if at end of file.
*/
typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
/** Signature for the close callback.
* The signature and semantics match POSIX fclose() implementations
* and can generally be used interchangeably.
*
* \param handle The handle to the data source.
* \retval int
* \c 0 on success, \c EOF on error.
*/
typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
/** A structure for holding a set of callbacks.
* Each FLAC interface that requires a FLAC__IOCallbacks structure will
* describe which of the callbacks are required. The ones that are not
* required may be set to NULL.
*
* If the seek requirement for an interface is optional, you can signify that
* a data sorce is not seekable by setting the \a seek field to \c NULL.
*/
typedef struct {
FLAC__IOCallback_Read read;
FLAC__IOCallback_Write write;
FLAC__IOCallback_Seek seek;
FLAC__IOCallback_Tell tell;
FLAC__IOCallback_Eof eof;
FLAC__IOCallback_Close close;
} FLAC__IOCallbacks;
/* \} */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,91 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__EXPORT_H
#define FLAC__EXPORT_H
/** \file include/FLAC/export.h
*
* \brief
* This module contains #defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* See the \link flac_export export \endlink module.
*/
/** \defgroup flac_export FLAC/export.h: export symbols
* \ingroup flac
*
* \brief
* This module contains #defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* If you are compiling with MSVC and will link to the static library
* (libFLAC.lib) you should define FLAC__NO_DLL in your project to
* make sure the symbols are exported properly.
*
* \{
*/
#if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
#define FLAC_API
#else
#ifdef FLAC_API_EXPORTS
#define FLAC_API _declspec(dllexport)
#else
#define FLAC_API _declspec(dllimport)
#endif
#endif
/** These #defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual.html#Libtool-versioning
*/
#define FLAC_API_VERSION_CURRENT 10
#define FLAC_API_VERSION_REVISION 0 /**< see above */
#define FLAC_API_VERSION_AGE 2 /**< see above */
#ifdef __cplusplus
extern "C" {
#endif
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
#ifdef __cplusplus
}
#endif
/* \} */
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__ORDINALS_H
#define FLAC__ORDINALS_H
#if !(defined(_MSC_VER) || defined(__BORLANDC__) || defined(__EMX__))
#include <inttypes.h>
#endif
typedef signed char FLAC__int8;
typedef unsigned char FLAC__uint8;
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef __int16 FLAC__int16;
typedef __int32 FLAC__int32;
typedef __int64 FLAC__int64;
typedef unsigned __int16 FLAC__uint16;
typedef unsigned __int32 FLAC__uint32;
typedef unsigned __int64 FLAC__uint64;
#elif defined(__EMX__)
typedef short FLAC__int16;
typedef long FLAC__int32;
typedef long long FLAC__int64;
typedef unsigned short FLAC__uint16;
typedef unsigned long FLAC__uint32;
typedef unsigned long long FLAC__uint64;
#else
typedef int16_t FLAC__int16;
typedef int32_t FLAC__int32;
typedef int64_t FLAC__int64;
typedef uint16_t FLAC__uint16;
typedef uint32_t FLAC__uint32;
typedef uint64_t FLAC__uint64;
#endif
typedef int FLAC__bool;
typedef FLAC__uint8 FLAC__byte;
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
#ifndef __cplusplus
#define true 1
#define false 0
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

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