Merge branch 'os' (related to #139)

This commit is contained in:
David Capello 2018-08-23 17:27:52 -03:00
commit 860edf6439
515 changed files with 988 additions and 101999 deletions

26
.appveyor.yml Normal file
View File

@ -0,0 +1,26 @@
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCVARS_FILE: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat
VCVARS_ARG:
ENABLE_UI: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCVARS_FILE: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
VCVARS_ARG:
ENABLE_UI: ON
install:
- call "%VCVARS_FILE%" %VCVARS_ARG%
clone_script:
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/%APPVEYOR_REPO_NAME%.git %APPVEYOR_BUILD_FOLDER%
- cd %APPVEYOR_BUILD_FOLDER%
- git checkout -qf %APPVEYOR_REPO_COMMIT%
- git submodule update --init --recursive
build_script:
- mkdir build
- cd build
- cmake .. -G "NMake Makefiles" -DENABLE_TESTS=ON -DENABLE_UI=%ENABLE_UI%
- nmake
- ctest --output-on-failure

View File

@ -1,25 +1,46 @@
language: cpp
dist: trusty
compiler:
- clang
- gcc
env:
matrix:
- ENABLE_UI=OFF
- ENABLE_UI=ON
matrix:
include:
- os: osx
osx_image: xcode9
env:
- ENABLE_UI=ON
- os: linux
addons:
apt:
packages:
- libpixman-1-dev libfreetype6-dev libharfbuzz-dev libx11-dev libxcursor-dev
env:
- ENABLE_UI=OFF
- XVFB=xvfb-run
- os: linux
addons:
apt:
packages:
- libpixman-1-dev libfreetype6-dev libharfbuzz-dev libx11-dev libxcursor-dev
env:
- ENABLE_UI=ON
- XVFB=xvfb-run
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7 libpixman-1-dev libfreetype6-dev libharfbuzz-dev libx11-dev libxcursor-dev
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- ENABLE_UI=ON
- XVFB=xvfb-run
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install -y -qq g++-4.8
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8"; fi
- eval "${MATRIX_EVAL}"
before_script:
- mkdir build
- cd build
- cmake .. -DENABLE_TESTS=ON -DENABLE_UI=$ENABLE_UI
- $XVFB cmake .. -DENABLE_TESTS=ON -DENABLE_UI=$ENABLE_UI
script:
- make
@ -29,6 +50,6 @@ script:
export ASEPRITE=$PWD/bin/aseprite
git clone https://github.com/aseprite/tests.git
cd tests
bash run-tests.sh
$XVFB bash run-tests.sh
fi
fi

View File

@ -1,7 +1,5 @@
# Aseprite
# Copyright (C) 2001-2018 David Capello
#
# Parts of this file come from the Allegro 4.4 CMakeLists.txt
cmake_minimum_required(VERSION 3.4)
@ -57,7 +55,6 @@ enable_testing()
# CMakeCache.txt)
option(WITH_WEBP_SUPPORT "Enable support to load/save .webp files" on)
option(WITH_GTK_FILE_DIALOG_SUPPORT "Enable support for the experimental native GTK File Dialog" off)
option(WITH_DESKTOP_INTEGRATION "Enable desktop integration modules" off)
option(WITH_QT_THUMBNAILER "Enable kde5/qt5 thumnailer" off)
@ -67,12 +64,10 @@ option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off)
option(USE_SHARED_ZLIB "Use your installed copy of zlib" off)
option(USE_SHARED_LIBPNG "Use your installed copy of libpng" off)
option(USE_SHARED_LIBLOADPNG "Use your installed copy of libloadpng" off)
option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off)
option(USE_SHARED_PIXMAN "Use your installed copy of pixman" off)
option(USE_SHARED_FREETYPE "Use shared FreeType library" off)
option(USE_SHARED_HARFBUZZ "Use shared HarfBuzz library" off)
option(USE_SHARED_ALLEGRO4 "Use shared Allegro 4 library (without resize support)" off)
option(ENABLE_MEMLEAK "Enable memory-leaks detector (only for developers)" off)
option(ENABLE_UPDATER "Enable automatic check for updates" on)
option(ENABLE_SCRIPTING "Compile with scripting support" on)
@ -87,25 +82,13 @@ option(FULLSCREEN_PLATFORM "Enable fullscreen by default" off)
set(CUSTOM_WEBSITE_URL "" CACHE STRING "Enable custom local webserver to check updates")
if(NOT ENABLE_UI)
# Without UI, don't use back-ends
set(USE_ALLEG4_BACKEND off)
set(USE_SKIA_BACKEND off)
set(USE_NONE_BACKEND on)
set(LAF_OS_BACKEND "none") # Without UI, we use the none backend
else()
if(APPLE)
# On OS X Allegro isn't supported anymore
set(USE_ALLEG4_BACKEND off)
set(USE_SKIA_BACKEND on)
set(USE_NONE_BACKEND off)
else()
option(USE_ALLEG4_BACKEND "Use Allegro 4 backend" on)
option(USE_SKIA_BACKEND "Use Skia backend" off)
set(USE_NONE_BACKEND off)
endif()
set(LAF_OS_BACKEND "skia")
endif()
# Check valid gtk + libpng combination
if(WITH_GTK_FILE_DIALOG_SUPPORT)
if(LAF_OS_WITH_GTK)
if(NOT USE_SHARED_LIBPNG)
message(FATAL_ERROR "Cannot compile with gtk and static libpng, set USE_SHARED_LIBPNG=ON")
endif()
@ -167,7 +150,6 @@ set(CURL_DIR ${CMAKE_SOURCE_DIR}/third_party/curl)
set(GIFLIB_DIR ${CMAKE_SOURCE_DIR}/third_party/giflib)
set(LIBJPEG_DIR ${CMAKE_SOURCE_DIR}/third_party/jpeg)
set(LIBPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/libpng)
set(LOADPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/loadpng)
set(LIBWEBP_DIR ${CMAKE_SOURCE_DIR}/third_party/libwebp)
set(PIXMAN_DIR ${CMAKE_SOURCE_DIR}/third_party/pixman)
set(FREETYPE_DIR ${CMAKE_SOURCE_DIR}/third_party/freetype2)
@ -297,17 +279,6 @@ else()
endif()
include_directories(${JPEG_INCLUDE_DIRS})
if(USE_ALLEG4_BACKEND)
if(USE_SHARED_LIBLOADPNG)
find_library(LOADPNG_LIBRARY NAMES loadpng)
find_path(LOADPNG_INCLUDE_DIR NAMES loadpng.h)
else()
set(LOADPNG_LIBRARY loadpng)
set(LOADPNG_INCLUDE_DIR ${LOADPNG_DIR})
endif()
include_directories(${LOADPNG_INCLUDE_DIR})
endif()
if(USE_SHARED_CMARK)
find_library(CMARK_LIBRARIES NAMES cmark)
find_path(CMARK_INCLUDE_DIRS NAMES cmark.h)
@ -328,131 +299,6 @@ include_directories(${CURL_INCLUDE_DIRS})
# simpleini
include_directories(${SIMPLEINI_DIR})
######################################################################
# Platform specific stuff
set(PLATFORM_LIBS)
# Allegro 4 backend
if(USE_ALLEG4_BACKEND)
add_definitions(-DUSE_ALLEG4_BACKEND)
if(USE_SHARED_ALLEGRO4)
# Find the shared Allegro 4 library
find_library(LIBALLEGRO4_LIBRARY alleg)
find_path(LIBALLEGRO4_INCLUDE_DIR allegro.h)
if(NOT LIBALLEGRO4_LIBRARY)
message(FATAL_ERROR "Allegro 4 not found")
endif()
# Get flags to link programs using allegro-config program
execute_process(COMMAND allegro-config --libs --shared
OUTPUT_VARIABLE LIBALLEGRO4_LINK_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LIBALLEGRO4_LINK_FLAGS ${LIBALLEGRO4_LINK_FLAGS} ${PLATFORM_LIBS})
include_directories(${LIBALLEGRO4_INCLUDE_DIR})
else()
include_directories(${CMAKE_SOURCE_DIR}/src/allegro/include)
include_directories(${CMAKE_BINARY_DIR}/include)
add_definitions(-DALLEGRO4_WITH_RESIZE_PATCH)
add_definitions(-DALLEGRO4_WITH_EXTRA_CURSORS)
# Static Allegro (the code of Allegro library is embedded).
add_definitions(-DALLEGRO_STATICLINK)
set(LIBALLEGRO4_LINK_FLAGS allegro)
endif()
endif()
# Skia backend
if(USE_SKIA_BACKEND)
add_definitions(-DUSE_SKIA_BACKEND)
endif()
# -- Unix --
if(UNIX AND NOT APPLE AND NOT BEOS)
# Pthreads
find_package(Threads REQUIRED)
list(APPEND PLATFORM_LIBS m ${CMAKE_THREAD_LIBS_INIT})
# X11
find_package(X11 REQUIRED)
include_directories(SYSTEM ${X11_INCLUDE_DIR})
list(APPEND PLATFORM_LIBS ${X11_LIBRARIES})
if(X11_XShm_FOUND)
list(APPEND PLATFORM_LIBS ${X11_Xext_LIB})
endif()
if(X11_Xcursor_FOUND)
list(APPEND PLATFORM_LIBS ${X11_Xcursor_LIB})
endif()
if(X11_Xpm_FOUND)
list(APPEND PLATFORM_LIBS ${X11_Xpm_LIB})
endif()
find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
mark_as_advanced(X11_Xxf86vm_LIB)
if(X11_xf86vmode_FOUND)
list(APPEND PLATFORM_LIBS ${X11_Xxf86vm_LIB})
endif()
check_library_exists(X11 XOpenIM "${X11_LIB_SEARCH_PATH}" XIM_FOUND)
check_library_exists(Xxf86dga XDGAQueryExtension
"${X11_LIB_SEARCH_PATH}" XDGA_FOUND)
if(XDGA_FOUND)
list(APPEND PLATFORM_LIBS Xxf86dga ${X11_LIBRARIES})
endif()
endif()
# -- Windows --
if(WIN32)
list(APPEND PLATFORM_LIBS
kernel32 user32 gdi32 comdlg32 ole32 winmm
shlwapi psapi wininet comctl32 dbghelp)
# Windows Vista is the minimum supported platform but we're defining
# Windows 10 to get the all constant/structure definitions.
add_definitions(-D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00)
# We need Unicode support
add_definitions(-DUNICODE -D_UNICODE)
endif(WIN32)
# -- Mac OS X --
if(APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(CARBON_LIBRARY Carbon)
find_library(IOKIT_LIBRARY IOKit)
mark_as_advanced(COCOA_LIBRARY CARBON_LIBRARY IOKIT_LIBRARY)
list(APPEND PLATFORM_LIBS
${COCOA_LIBRARY}
${CARBON_LIBRARY}
${IOKIT_LIBRARY})
# Hack to deal with Mac OS X 10.6. NSQuickDrawView is not defined by
# NSQuickDrawView.h when compiling in 64-bit mode, and 64-bit mode is the
# default when compiling on Snow Leopard.
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL i386)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386")
endif()
# The Mac port simply uses too many deprecated things.
if(COMPILER_GCC)
set(WFLAGS "${WFLAGS} -Wno-deprecated-declarations")
endif(COMPILER_GCC)
endif(APPLE)
# Third parties
add_subdirectory(third_party)
@ -467,5 +313,4 @@ set(LAF_WITH_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable LAF tests")
set(UNDO_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
add_subdirectory(laf)
add_subdirectory(src)

View File

@ -12,10 +12,10 @@
* [Issues with Retina displays](#issues-with-retina-displays)
* [Linux details](#linux-details)
* [Using shared third party libraries](#using-shared-third-party-libraries)
* [Linux issues](#linux-issues)
* [Building Skia dependency](#building-skia-dependency)
* [Skia on Windows](#skia-on-windows)
* [Skia on macOS](#skia-on-macos)
* [Skia on Linux](#skia-on-linux)
# Platforms
@ -53,18 +53,9 @@ To compile Aseprite you will need:
* The latest version of [CMake](http://www.cmake.org/) (3.4 or greater)
* [Ninja](https://ninja-build.org) build system
Aseprite can be compiled with two different back-ends:
1. Allegro back-end (Windows, Linux): You will not need any extra
library because the repository already contains a modified version
of the Allegro library. This back-end is deprecated and will be
removed in future versions. All new development is being done in
the new Skia back-end.
2. Skia back-end (Windows, macOS): You will need a compiled version
of the Skia library. Please check the details about
[how to build Skia](#building-skia-dependency) on your platform.
* You will need a compiled version of the Skia library.
Please check the details about [how to build Skia](#building-skia-dependency)
on your platform.
## Windows dependencies
@ -78,18 +69,10 @@ Then, you will need an extra little utility: `awk`, used to compile
the libpng library. You can get this utility from MSYS2 distributions
like [MozillaBuild](https://wiki.mozilla.org/MozillaBuild).
After that you have to choose the back-end:
1. If you choose the Allegro back-end, you can jump directly to the
[Compiling](#compiling) section.
2. If you choose the Skia back-end, you will need to
[compile Skia](#skia-on-windows) before and then continue in the
[Compiling](#compiling) section. Remember to check the
[Windows details](#windows-details) section to know how to call
`cmake` correctly.
The official version of Aseprite is compiled with the Skia back-end.
You will need to [compile Skia](#skia-on-windows) before and then
continue in the [Compiling](#compiling) section. Remember to check the
[Windows details](#windows-details) section to know how to call
`cmake` correctly.
## macOS dependencies
@ -145,14 +128,13 @@ The `libxcursor-dev` package is needed to
## Windows details
To choose the Skia back-end
([after you've compiled Skia](#skia-on-windows)) you can execute `cmake`
After you've [compiled Skia](#skia-on-windows) you can execute `cmake`
with the following arguments:
cd aseprite
mkdir build
cd build
cmake -DUSE_ALLEG4_BACKEND=OFF -DUSE_SKIA_BACKEND=ON -DSKIA_DIR=C:\deps\skia -G Ninja ..
cmake -DSKIA_DIR=C:\deps\skia -G Ninja ..
ninja aseprite
In this case, `C:\deps\skia` is the directory where Skia was compiled
@ -170,8 +152,6 @@ the following parameters and then `ninja`:
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk \
-DUSE_ALLEG4_BACKEND=OFF \
-DUSE_SKIA_BACKEND=ON \
-DSKIA_DIR=$HOME/deps/skia \
-DWITH_HarfBuzz=OFF \
-G Ninja \
@ -189,17 +169,17 @@ If you have a Retina display, check the following issue:
## Linux details
On Linux you can specify a specific directory to install Aseprite
after a `ninja install` command. For example:
First you have to [compile Skia](#skia-on-linux), then you should run
`cmake` with the following parameters and then `ninja`:
cd aseprite
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=~/software -G Ninja ..
cmake -DSKIA_DIR=$HOME/deps/skia -G Ninja ..
ninja aseprite
Then, you can invoke `ninja install` and it will copy the program in
the given location (e.g. `~/software/bin/aseprite` on Linux).
In this case, `$HOME/deps/skia` is the directory where Skia was
compiled as described in [Skia on Linux](#skia-on-linux) section.
# Using shared third party libraries
@ -211,20 +191,6 @@ After running `cmake -G`, you can edit `build/CMakeCache.txt` file,
and enable the `USE_SHARED_` flag (set its value to `ON`) of the
library that you want to be linked dynamically.
## Linux issues
If you use the official version of Allegro 4.4 library (i.e. you
compile with `USE_SHARED_ALLEGRO4=ON`) you will experience a couple of
known issues solved in
[our patched version of Allegro 4.4 library](https://github.com/aseprite/aseprite/tree/master/src/allegro):
* You will
[not be able to resize the window](https://github.com/aseprite/aseprite/issues/192)
([patch](https://github.com/aseprite/aseprite/commit/920f6275d55113507121afcbcda80adb44cc0563)).
* You will have problems
[adding HSV colors in non-English systems](https://github.com/aseprite/aseprite/commit/27b55030e26e93c5e8d9e7e21206c8709d46ff22)
using the warning icon.
# Building Skia dependency
When you compile Aseprite with [Skia](https://skia.org) as back-end on
@ -264,9 +230,8 @@ Then:
Just ignore it.)
cd C:\deps
git clone https://github.com/aseprite/skia.git
git clone -b aseprite-m67 https://github.com/aseprite/skia.git
cd skia
git checkout aseprite-m67
python tools/git-sync-deps
(The `tools/git-sync-deps` will take some minutes because it downloads
@ -296,10 +261,9 @@ several minutes to finish:
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone https://github.com/aseprite/skia.git
git clone -b aseprite-m67 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
git checkout aseprite-m67
python tools/git-sync-deps
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false extra_cflags_cc=[\"-frtti\"]"
ninja -C out/Release skia
@ -311,3 +275,28 @@ described in the [macOS details](#macos-details) section.
More information about these steps in the
[official Skia documentation](https://skia.org/user/build).
## Skia on Linux
These steps will create a `deps` folder in your home directory with a
couple of subdirectories needed to build Skia (you can change the
`$HOME/deps` with other directory). Some of these commands will take
several minutes to finish:
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone -b aseprite-m67 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps
gn gen out/Release --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false"
ninja -C out/Release skia
After this you should have all Skia libraries compiled. When you
[compile Aseprite](#compiling), remember to add
`-DSKIA_DIR=$HOME/deps/skia` parameter to your `cmake` call as
described in the [Linux details](#linux-details) section.
More information about these steps in the
[official Skia documentation](https://skia.org/user/build).

View File

@ -2,6 +2,7 @@
*Copyright (C) 2001-2018 David Capello*
[![Build Status](https://travis-ci.org/aseprite/aseprite.svg)](https://travis-ci.org/aseprite/aseprite)
[![Build status](https://ci.appveyor.com/api/projects/status/kdu2gt7ls014i25h?svg=true)](https://ci.appveyor.com/project/dacap/aseprite)
[![Discourse Community](https://img.shields.io/badge/discourse-community-brightgreen.svg?style=flat)](https://community.aseprite.org/)
[![Discord Server](https://discordapp.com/api/guilds/324979738533822464/embed.png)](https://discord.gg/Yb2CeX8)
@ -89,7 +90,7 @@ This program is distributed under three different licenses:
are distributed under the MIT license
(e.g. [laf](https://github.com/aseprite/laf),
[clip](https://github.com/aseprite/clip),
[she](https://github.com/aseprite/aseprite/tree/master/src/she),
[os](https://github.com/aseprite/aseprite/tree/master/src/os),
[gfx](src/gfx), [ui](src/ui), etc.).
2. You can request a special
[educational license](http://www.aseprite.org/faq/#is-there-an-educational-license)

View File

@ -1,24 +0,0 @@
# - Find dxguid
# Find the dxguid libraries
#
# DXGUID_LIBRARIES - List of libraries
# DXGUID_FOUND - True if dxguid found.
find_library(DXGUID_LIBRARY
NAMES dxguid
PATHS "$ENV{DXSDK_DIR}/Lib/$ENV{PROCESSOR_ARCHITECTURE}"
)
# Handle the QUIETLY and REQUIRED arguments and set DXGUID_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DXGUID DEFAULT_MSG
DXGUID_LIBRARY)
if(DXGUID_FOUND)
set(DXGUID_LIBRARIES ${DXGUID_LIBRARY})
else(DXGUID_FOUND)
set(DXGUID_LIBRARIES)
endif(DXGUID_FOUND)
mark_as_advanced(DXGUID_INCLUDE_DIR DXGUID_LIBRARY)

View File

@ -8,10 +8,10 @@ function(find_tests dir dependencies)
# Add gtest include directory so we can #include <gtest/gtest.h> in tests source code
include_directories(${CMAKE_SOURCE_DIR}/third_party/gtest/include)
# See if the test is linked with "she" library.
list(FIND dependencies she link_with_she)
if(link_with_she)
set(extra_definitions -DLINKED_WITH_SHE)
# See if the test is linked with "laf-os" library.
list(FIND dependencies laf-os link_with_os)
if(link_with_os)
set(extra_definitions -DLINKED_WITH_OS_LIBRARY)
endif()
foreach(testsourcefile ${tests})

View File

@ -1,66 +0,0 @@
# Use this command to build the Windows port of Allegro
# with a mingw cross compiler:
#
# cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-mingw.cmake .
#
# or for out of source:
#
# cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw.cmake ..
#
# You will need at least CMake 2.6.0.
#
# Adjust the following paths to suit your environment.
#
# You might want to set MINGDIR to prevent make install making a mess
# in your normal directories.
#
# This file was based on http://www.cmake.org/Wiki/CmakeMingw
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
# Assume the target architecture.
# XXX for some reason the value set here gets cleared before we reach the
# main CMakeLists.txt; see that file for a workaround.
# set(CMAKE_SYSTEM_PROCESSOR i686)
# Which compilers to use for C and C++, and location of target
# environment.
if(EXISTS /usr/i586-mingw32msvc)
# First look in standard location as used by Debian/Ubuntu/etc.
set(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
set(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
set(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)
elseif(EXISTS /opt/mingw)
# Otherwise you can get a MinGW environment using the script at
# <http://mingw-cross-env.nongnu.org>. It downloads and builds MinGW and
# most of the dependencies for you. This is a suitable location.
set(CMAKE_C_COMPILER /opt/mingw/usr/bin/i686-pc-mingw32-gcc)
set(CMAKE_CXX_COMPILER /opt/mingw/usr/bin/i686-pc-mingw32-g++)
set(CMAKE_FIND_ROOT_PATH /opt/mingw/usr/i686-pc-mingw32)
else()
# Else fill in local path which the user will likely adjust.
# This is the location assumed by <http://www.libsdl.org/extras/win32/cross/>
set(CMAKE_C_COMPILER /usr/local/cross-tools/bin/i386-mingw32-gcc)
set(CMAKE_CXX_COMPILER /usr/local/cross-tools/bin/i386-mingw32-g++)
set(CMAKE_FIND_ROOT_PATH /usr/local/cross-tools)
endif()
# Adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Tell pkg-config not to look at the target environment's .pc files.
# Setting PKG_CONFIG_LIBDIR sets the default search directory, but we have to
# set PKG_CONFIG_PATH as well to prevent pkg-config falling back to the host's
# path.
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
set(ENV{PKG_CONFIG_PATH} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
set(INSTALL_PREFIX ${CMAKE_FIND_ROOT_PATH})
if(ENV{MINGDIR} STREQUAL "")
set(ENV{MINGDIR} ${CMAKE_FIND_ROOT_PATH})
endif()

View File

@ -1,219 +0,0 @@
# Use this command to build the PSP port of Allegro:
#
# cmake -DWANT_TESTS=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-psp-gcc.cmake .
#
# or for out of source:
#
# cmake -DWANT_TESTS=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-psp-gcc.cmake ..
#
# You will need at least CMake 2.6.0.
#
# Adjust the following paths to suit your environment.
#
# This file was based on http://www.cmake.org/Wiki/CmakeMingw
# The name of the target operating system.
set(CMAKE_SYSTEM_NAME Generic)
# Location of target environment.
find_program(psp-config_SCRIPT psp-config)
if (psp-config_SCRIPT)
execute_process(COMMAND ${psp-config_SCRIPT}
ARGS --psp-prefix
OUTPUT_VARIABLE PSP_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${psp-config_SCRIPT}
ARGS --pspsdk-path
OUTPUT_VARIABLE PSPSDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
else (psp-config_SCRIPT)
message(FATAL_ERROR "psp-config was not found.\nInstall the PSPDEV toolchain or update the $PATH environment variable.")
endif (psp-config_SCRIPT)
set(CMAKE_SYSTEM_INCLUDE_PATH "${PSP_PREFIX}/include")
set(CMAKE_SYSTEM_LIBRARY_PATH "${PSP_PREFIX}/lib")
set(CMAKE_SYSTEM_PROGRAM_PATH "${PSP_PREFIX}/bin")
# Which compilers to use for C and C++.
set(CMAKE_C_COMPILER psp-gcc)
set(CMAKE_CXX_COMPILER psp-g++)
# Needed to pass the compiler tests.
set(LINK_DIRECTORIES ${PSPSDK_PATH}/lib)
set(LINK_LIBRARIES -lc -lpspuser -lpspkernel -lc)
# Adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment.
set(CMAKE_FIND_ROOT_PATH ${PSP_PREFIX})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# After building the ELF binary build the PSP executable.
function(add_psp_executable nm)
get_target_property(PSP_EXECUTABLE_OUTPUT_NAME ${nm} OUTPUT_NAME)
if (NOT PSP_EXECUTABLE_OUTPUT_NAME)
set(PSP_EXECUTABLE_OUTPUT_NAME ${nm})
endif(NOT PSP_EXECUTABLE_OUTPUT_NAME)
set_target_properties(
${nm}
PROPERTIES LINK_FLAGS "-specs=${PSPSDK_PATH}/lib/prxspecs -Wl,-q,-T${PSPSDK_PATH}/lib/linkfile.prx ${PSPSDK_PATH}/lib/prxexports.o"
)
add_custom_command(
TARGET ${nm}
POST_BUILD
COMMAND psp-fixup-imports ${PSP_EXECUTABLE_OUTPUT_NAME}
COMMAND mksfo '${PSP_EXECUTABLE_OUTPUT_NAME}' PARAM.SFO
COMMAND psp-prxgen ${PSP_EXECUTABLE_OUTPUT_NAME} ${PSP_EXECUTABLE_OUTPUT_NAME}.prx
COMMAND pack-pbp EBOOT.PBP PARAM.SFO NULL NULL NULL NULL NULL ${PSP_EXECUTABLE_OUTPUT_NAME}.prx NULL
)
endfunction()
set(PSP 1)
# Use this command to build the PSP port of Allegro:
#
# cmake -DWANT_TESTS=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-psp-gcc.cmake .
#
# or for out of source:
#
# cmake -DWANT_TESTS=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-psp-gcc.cmake ..
#
# You will need at least CMake 2.6.0.
#
# Adjust the following paths to suit your environment.
#
# This file was based on http://www.cmake.org/Wiki/CmakeMingw
# The name of the target operating system.
set(CMAKE_SYSTEM_NAME Generic)
# Location of target environment.
find_program(psp-config_SCRIPT psp-config)
if (psp-config_SCRIPT)
execute_process(COMMAND ${psp-config_SCRIPT}
ARGS --psp-prefix
OUTPUT_VARIABLE PSP_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${psp-config_SCRIPT}
ARGS --pspsdk-path
OUTPUT_VARIABLE PSPSDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
else (psp-config_SCRIPT)
message(FATAL_ERROR "psp-config was not found.\nInstall the PSPDEV toolchain or update the $PATH environment variable.")
endif (psp-config_SCRIPT)
set(CMAKE_SYSTEM_INCLUDE_PATH "${PSP_PREFIX}/include")
set(CMAKE_SYSTEM_LIBRARY_PATH "${PSP_PREFIX}/lib")
set(CMAKE_SYSTEM_PROGRAM_PATH "${PSP_PREFIX}/bin")
# Which compilers to use for C and C++.
set(CMAKE_C_COMPILER psp-gcc)
set(CMAKE_CXX_COMPILER psp-g++)
# Needed to pass the compiler tests.
set(LINK_DIRECTORIES ${PSPSDK_PATH}/lib)
set(LINK_LIBRARIES -lc -lpspuser -lpspkernel -lc)
# Adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment.
set(CMAKE_FIND_ROOT_PATH ${PSP_PREFIX})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# After building the ELF binary build the PSP executable.
function(add_psp_executable nm)
get_target_property(PSP_EXECUTABLE_OUTPUT_NAME ${nm} OUTPUT_NAME)
if (NOT PSP_EXECUTABLE_OUTPUT_NAME)
set(PSP_EXECUTABLE_OUTPUT_NAME ${nm})
endif(NOT PSP_EXECUTABLE_OUTPUT_NAME)
set_target_properties(
${nm}
PROPERTIES LINK_FLAGS "-specs=${PSPSDK_PATH}/lib/prxspecs -Wl,-q,-T${PSPSDK_PATH}/lib/linkfile.prx ${PSPSDK_PATH}/lib/prxexports.o"
)
add_custom_command(
TARGET ${nm}
POST_BUILD
COMMAND psp-fixup-imports ${PSP_EXECUTABLE_OUTPUT_NAME}
COMMAND mksfo '${PSP_EXECUTABLE_OUTPUT_NAME}' PARAM.SFO
COMMAND psp-prxgen ${PSP_EXECUTABLE_OUTPUT_NAME} ${PSP_EXECUTABLE_OUTPUT_NAME}.prx
COMMAND pack-pbp EBOOT.PBP PARAM.SFO NULL NULL NULL NULL NULL ${PSP_EXECUTABLE_OUTPUT_NAME}.prx NULL
)
endfunction()
set(PSP 1)
# Use this command to build the PSP port of Allegro:
#
# cmake -DWANT_TESTS=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-psp-gcc.cmake .
#
# or for out of source:
#
# cmake -DWANT_TESTS=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-psp-gcc.cmake ..
#
# You will need at least CMake 2.6.0.
#
# Adjust the following paths to suit your environment.
#
# This file was based on http://www.cmake.org/Wiki/CmakeMingw
# The name of the target operating system.
set(CMAKE_SYSTEM_NAME Generic)
# Location of target environment.
find_program(psp-config_SCRIPT psp-config)
if (psp-config_SCRIPT)
execute_process(COMMAND ${psp-config_SCRIPT}
ARGS --psp-prefix
OUTPUT_VARIABLE PSP_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${psp-config_SCRIPT}
ARGS --pspsdk-path
OUTPUT_VARIABLE PSPSDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
else (psp-config_SCRIPT)
message(FATAL_ERROR "psp-config was not found.\nInstall the PSPDEV toolchain or update the $PATH environment variable.")
endif (psp-config_SCRIPT)
set(CMAKE_SYSTEM_INCLUDE_PATH "${PSP_PREFIX}/include")
set(CMAKE_SYSTEM_LIBRARY_PATH "${PSP_PREFIX}/lib")
set(CMAKE_SYSTEM_PROGRAM_PATH "${PSP_PREFIX}/bin")
# Which compilers to use for C and C++.
set(CMAKE_C_COMPILER psp-gcc)
set(CMAKE_CXX_COMPILER psp-g++)
# Needed to pass the compiler tests.
set(LINK_DIRECTORIES ${PSPSDK_PATH}/lib)
set(LINK_LIBRARIES -lc -lpspuser -lpspkernel -lc)
# Adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment.
set(CMAKE_FIND_ROOT_PATH ${PSP_PREFIX})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# After building the ELF binary build the PSP executable.
function(add_psp_executable nm)
get_target_property(PSP_EXECUTABLE_OUTPUT_NAME ${nm} OUTPUT_NAME)
if (NOT PSP_EXECUTABLE_OUTPUT_NAME)
set(PSP_EXECUTABLE_OUTPUT_NAME ${nm})
endif(NOT PSP_EXECUTABLE_OUTPUT_NAME)
set_target_properties(
${nm}
PROPERTIES LINK_FLAGS "-specs=${PSPSDK_PATH}/lib/prxspecs -Wl,-q,-T${PSPSDK_PATH}/lib/linkfile.prx ${PSPSDK_PATH}/lib/prxexports.o"
)
add_custom_command(
TARGET ${nm}
POST_BUILD
COMMAND psp-fixup-imports ${PSP_EXECUTABLE_OUTPUT_NAME}
COMMAND mksfo '${PSP_EXECUTABLE_OUTPUT_NAME}' PARAM.SFO
COMMAND psp-prxgen ${PSP_EXECUTABLE_OUTPUT_NAME} ${PSP_EXECUTABLE_OUTPUT_NAME}.prx
COMMAND pack-pbp EBOOT.PBP PARAM.SFO NULL NULL NULL NULL NULL ${PSP_EXECUTABLE_OUTPUT_NAME}.prx NULL
)
endfunction()
set(PSP 1)

View File

@ -879,31 +879,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
# [loadpng](http://tjaden.strangesoft.net/loadpng/)
```
Copyright (C) 1999-2012 Peter Wang
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
```
# [Lua](https://www.lua.org/)
```

2
laf

@ -1 +1 @@
Subproject commit 2068f653224edfbfafc00a40a1d72a8e022d00d8
Subproject commit e4a54eedd70fde9f9d410a16a13afe2dcf6c5502

View File

@ -12,7 +12,7 @@ endif()
if(MSVC)
# As Skia is compiled with /GL flag (whole program optimization),
# the linker prefer a /LTCG parameter to improve link times.
if(USE_SKIA_BACKEND)
if(LAF_OS_BACKEND STREQUAL "skia")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
endif()
@ -33,18 +33,6 @@ if(WIN32)
include_directories(..)
endif()
# Use patched version of Allegro 4 (with window resize support).
if(USE_ALLEG4_BACKEND AND NOT USE_SHARED_ALLEGRO4)
add_subdirectory(allegro)
endif()
######################################################################
# pthread
if (CMAKE_USE_PTHREADS_INIT)
list(APPEND PLATFORM_LIBS ${CMAKE_THREAD_LIBS_INIT})
endif()
######################################################################
# Custom Aseprite website (for testing server-side)
@ -107,12 +95,9 @@ add_subdirectory(filters)
add_subdirectory(fixmath)
add_subdirectory(flic)
add_subdirectory(gen)
add_subdirectory(gfx)
add_subdirectory(net)
add_subdirectory(render)
add_subdirectory(dio)
add_subdirectory(ft)
add_subdirectory(she)
add_subdirectory(ui)
if(ENABLE_UPDATER)
@ -179,21 +164,12 @@ add_executable(aseprite main/main.cpp ${win32_resources})
if(WIN32 AND ENABLE_UI)
set_target_properties(aseprite PROPERTIES WIN32_EXECUTABLE true)
endif()
target_link_libraries(aseprite app-lib ${PLATFORM_LIBS})
target_link_libraries(aseprite app-lib)
add_dependencies(aseprite copy_data)
if(MSVC)
if(ENABLE_UI)
if(USE_SKIA_BACKEND)
# Linking with "wsetargv.obj" to add support to expand filename
# wildcards in argc/argv.
set_target_properties(aseprite
PROPERTIES LINK_FLAGS "-LINK wsetargv.obj -ENTRY:\"wWinMainCRTStartup\"")
endif()
else()
set_target_properties(aseprite
PROPERTIES LINK_FLAGS "-LINK wsetargv.obj -ENTRY:\"wmainCRTStartup\"")
endif()
if(LAF_OS_BACKEND_LINK_FLAGS)
set_target_properties(aseprite PROPERTIES LINK_FLAGS
${LAF_OS_BACKEND_LINK_FLAGS})
endif()
install(TARGETS aseprite
@ -207,7 +183,6 @@ install(DIRECTORY ../data
if(ENABLE_TESTS)
include(FindTests)
find_tests(gfx gfx-lib)
find_tests(doc doc-lib)
find_tests(render render-lib)
find_tests(ui ui-lib)

View File

@ -13,7 +13,6 @@ Aseprite is separated in the following layers/modules:
These libraries are easy to be used and embedded in other software
because they don't depend on any other component.
* [allegro](allegro/): Modified version of [Allegro](http://alleg.sourceforge.net/) library, used for keyboard/mouse input, and drawing 2D graphics on screen.
* [clip](https://github.com/aseprite/clip): Clipboard library.
* [fixmath](fixmath/): Fixed point operations (original code from Allegro code by Shawn Hargreaves).
* [flic](https://github.com/aseprite/flic): Library to load/save FLI/FLC files.
@ -35,13 +34,13 @@ because they don't depend on any other component.
## Level 2
* [doc](doc/) (base, fixmath, gfx): Document model library.
* [she](she/) (allegro, base, gfx, wacom): A wrapper for the Allegro library.
* [os](os/) (base, gfx, wacom): OS input/output.
## Level 3
* [filters](filters/) (base, doc, gfx): Effects for images.
* [render](render/) (base, doc, gfx): Library to render documents.
* [ui](ui/) (base, gfx, she): Portable UI library (buttons, windows, text fields, etc.)
* [ui](ui/) (base, gfx, os): Portable UI library (buttons, windows, text fields, etc.)
* [updater](updater/) (base, cfg, net): Component to check for updates.
## Level 4
@ -50,11 +49,11 @@ because they don't depend on any other component.
## Level 5
* [app](app/) (base, doc, dio, filters, fixmath, flic, gfx, pen, render, scripting, she, ui, undo, updater, webserver)
* [app](app/) (base, doc, dio, filters, fixmath, flic, gfx, pen, render, scripting, os, ui, undo, updater, webserver)
## Level 6
* [main](main/) (app, base, she, ui)
* [main](main/) (app, base, os, ui)
* [desktop](desktop/) (base, doc, dio, render): Integration with the desktop (Windows Explorer, Finder, GNOME, KDE, etc.)
# Debugging Tricks

View File

@ -1,431 +0,0 @@
#-----------------------------------------------------------------------------#
#
# Build options
#
# Set the project name.
project(ALLEGRO C CXX)
set(ALLEGRO_VERSION 4.4.2)
string(REGEX MATCH "^[0-9]+[.][0-9]+" ALLEGRO_SOVERSION ${ALLEGRO_VERSION})
# Mac OS X -compatibility_version.
# XXX doesn't seem to work
set(COMPAT_VERSION 4.4.0)
set(ALLEGRO_DLL_SHORTVER 44)
# Search in the `cmake' directory for additional CMake modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Lists of all the source files.
include(FileList)
# Our own CMake macros and functions.
include(Common)
#-----------------------------------------------------------------------------#
#
# Build options
#
# On some 64-bit platforms, libraries should be installed into `lib64'
# instead of `lib'. Set this to 64 to do that.
set(LIB_SUFFIX "" CACHE STRING "Suffix for 'lib' directories, e.g. '64'")
option(MAGIC_MAIN "Enable magic main (Unix)" off)
option(WANT_FRAMEWORKS "Want frameworks on Mac OS X" off)
option(WANT_EMBED
"Make frameworks embeddable in application bundles (Mac OS X)" on)
set(FRAMEWORK_INSTALL_PREFIX "/Library/Frameworks" CACHE STRING
"Directory in which to install Mac OS X frameworks")
#-----------------------------------------------------------------------------#
#
# Platform checks
#
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(FindPkgConfig)
include(TestBigEndian)
if(UNIX)
test_big_endian(ALLEGRO_BIG_ENDIAN)
if(NOT ALLEGRO_BIG_ENDIAN)
set(ALLEGRO_LITTLE_ENDIAN 1)
endif(NOT ALLEGRO_BIG_ENDIAN)
check_include_files(dirent.h ALLEGRO_HAVE_DIRENT_H)
check_include_files(inttypes.h ALLEGRO_HAVE_INTTYPES_H)
check_include_files(linux/awe_voice.h ALLEGRO_HAVE_LINUX_AWE_VOICE_H)
check_include_files(linux/input.h ALLEGRO_HAVE_LINUX_INPUT_H)
# On some systems including linux/joystick.h without sys/types.h results
# in conflicting definitions of fd_set.
check_include_files("sys/types.h;linux/joystick.h" ALLEGRO_HAVE_LINUX_JOYSTICK_H)
check_include_files(linux/soundcard.h ALLEGRO_HAVE_LINUX_SOUNDCARD_H)
check_include_files(machine/soundcard.h ALLEGRO_HAVE_MACHINE_SOUNDCARD_H)
check_include_files(soundcard.h ALLEGRO_HAVE_SOUNDCARD_H)
check_include_files(sys/io.h ALLEGRO_HAVE_SYS_IO_H)
check_include_files(sys/stat.h ALLEGRO_HAVE_SYS_STAT_H)
check_include_files(sys/time.h ALLEGRO_HAVE_SYS_TIME_H)
check_include_files(sys/soundcard.h ALLEGRO_HAVE_SYS_SOUNDCARD_H)
check_include_files(sys/utsname.h ALLEGRO_HAVE_SYS_UTSNAME_H)
check_function_exists(getexecname ALLEGRO_HAVE_GETEXECNAME)
check_function_exists(memcmp ALLEGRO_HAVE_MEMCMP)
check_function_exists(mkstemp ALLEGRO_HAVE_MKSTEMP)
check_function_exists(mmap ALLEGRO_HAVE_MMAP)
check_function_exists(mprotect ALLEGRO_HAVE_MPROTECT)
check_function_exists(sched_yield ALLEGRO_HAVE_SCHED_YIELD)
check_function_exists(stricmp ALLEGRO_HAVE_STRICMP)
check_function_exists(strlwr ALLEGRO_HAVE_STRLWR)
check_function_exists(strupr ALLEGRO_HAVE_STRUPR)
check_function_exists(sysconf ALLEGRO_HAVE_SYSCONF)
check_c_source_compiles("
#include <sys/procfs.h>
#include <sys/ioctl.h>
int main(void) {
struct prpsinfo psinfo;
ioctl(0, PIOCPSINFO, &psinfo);
return 0;
}"
ALLEGRO_HAVE_SV_PROCFS_H
)
check_c_source_compiles("
#include <sys/procfs.h>
int main(void) {
struct prpsinfo psinfo;
psinfo.pr_argc = 0;
return 0;
}"
ALLEGRO_HAVE_PROCFS_ARGCV
)
check_c_source_compiles("
#include <unistd.h>
#include <sys/mman.h>
int main(void) {
void *x = MAP_FAILED;
}"
MAP_FAILED_DEFINED)
if(NOT MAP_FAILED_DEFINED)
set(MAP_FAILED "((void *) -1)")
endif()
check_c_source_runs("
static int notsupported = 1;
void test_ctor (void) __attribute__((constructor));
void test_ctor (void) { notsupported = 0; }
int main(void) { return (notsupported); }
"
ALLEGRO_USE_CONSTRUCTOR)
find_library(RT_LIBRARY rt)
check_c_source_compiles("
#include <time.h>
int main(void) {
struct timespec new_time_ns;
clock_gettime(CLOCK_MONOTONIC, &new_time_ns);
return 0;
}"
ALLEGRO_HAVE_POSIX_MONOTONIC_CLOCK
)
if(MAGIC_MAIN)
set(ALLEGRO_WITH_MAGIC_MAIN 1)
endif(MAGIC_MAIN)
# XXX const
# XXX inline
# XXX size_t
endif(UNIX)
check_include_files(stdint.h ALLEGRO_HAVE_STDINT_H)
#-----------------------------------------------------------------------------#
#
# Compiler and platform setup
#
option(STRICT_WARN "Halt at warnings" off)
set(INSTALL_PREFIX "")
if(CMAKE_COMPILER_IS_GNUCC)
set(COMPILER_GCC 1)
set(ALLEGRO_GCC 1)
set(WFLAGS "-W -Wall -Wno-unused-parameter")
set(WFLAGS_C_ONLY "-Wdeclaration-after-statement")
if(STRICT_WARN)
set(WFLAGS "${WFLAGS} -Werror -Wpointer-arith")
set(WFLAGS_C_ONLY "${WFLAGS_C_ONLY} -Wmissing-declarations")
set(WFLAGS_C_ONLY "${WFLAGS_C_ONLY} -Wstrict-prototypes")
endif(STRICT_WARN)
endif(CMAKE_COMPILER_IS_GNUCC)
if(MINGW)
set(ALLEGRO_MINGW32 1)
# Guess MINGDIR from the value of CMAKE_C_COMPILER if it's not set.
if("$ENV{MINGDIR}" STREQUAL "")
string(REGEX REPLACE "/bin/[^/]*$" "" MINGDIR "${CMAKE_C_COMPILER}")
message(STATUS "Guessed MinGW directory: ${MINGDIR}")
else("$ENV{MINGDIR}" STREQUAL "")
file(TO_CMAKE_PATH "$ENV{MINGDIR}" MINGDIR)
message(STATUS "Using MINGDIR: ${MINGDIR}")
endif("$ENV{MINGDIR}" STREQUAL "")
# Search in MINGDIR for headers and libraries.
set(CMAKE_PREFIX_PATH "${MINGDIR}")
# Install to MINGDIR
if(INSTALL_PREFIX STREQUAL "")
set(CMAKE_INSTALL_PREFIX ${MINGDIR})
else(INSTALL_PREFIX STREQUAL "")
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX})
endif(INSTALL_PREFIX STREQUAL "")
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
endif(MINGW)
if(MSVC)
set(COMPILER_MSVC 1)
set(ALLEGRO_MSVC 1)
set(WFLAGS "/W3 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE")
endif(MSVC)
if(WIN32)
set(ALLEGRO_WINDOWS 1)
endif()
if(APPLE)
set(ALLEGRO_MACOSX 1)
set(ALLEGRO_DARWIN 1)
endif(APPLE)
if(UNIX AND NOT APPLE)
set(ALLEGRO_UNIX 1)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WFLAGS} ${WFLAGS_C_ONLY}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WFLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUGMODE=1")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUGMODE=1")
#-----------------------------------------------------------------------------#
# Not sure if we want to support disabling these any more.
set(ALLEGRO_COLOR8 1)
set(ALLEGRO_COLOR16 1)
set(ALLEGRO_COLOR24 1)
set(ALLEGRO_COLOR32 1)
set(ALLEGRO_NO_ASM 1)
# ALLEGRO_MMX left undefined
# ALLEGRO_SSE left undefined
#-----------------------------------------------------------------------------#
#
# Platform drivers
#
set(PLATFORM_SOURCES)
# -- Unix --
if(ALLEGRO_UNIX) # not MACOSX
set(ALLEGRO_HAVE_LIBPTHREAD 1)
list(APPEND PLATFORM_SOURCES ${ALLEGRO_SRC_UNIX_FILES})
if(ALLEGRO_HAVE_POSIX_MONOTONIC_CLOCK)
list(APPEND PLATFORM_LIBS ${RT_LIBRARY})
endif(ALLEGRO_HAVE_POSIX_MONOTONIC_CLOCK)
endif(ALLEGRO_UNIX)
# -- X11 --
if(ALLEGRO_UNIX AND X11_FOUND)
set(ALLEGRO_WITH_XWINDOWS 1)
endif()
if(ALLEGRO_WITH_XWINDOWS)
list(APPEND PLATFORM_SOURCES ${ALLEGRO_SRC_X_FILES})
if(X11_XShm_FOUND)
set(ALLEGRO_XWINDOWS_WITH_SHM 1)
endif()
if(X11_Xcursor_FOUND)
set(ALLEGRO_XWINDOWS_WITH_XCURSOR 1)
endif()
if(X11_Xpm_FOUND)
set(ALLEGRO_XWINDOWS_WITH_XPM 1)
endif()
if(X11_xf86vmode_FOUND)
set(ALLEGRO_XWINDOWS_WITH_XF86VIDMODE 1)
list(APPEND PLATFORM_LIBS ${X11_Xxf86vm_LIB})
endif()
if(XIM_FOUND)
set(ALLEGRO_XWINDOWS_WITH_XIM 1)
endif(XIM_FOUND)
if(XDGA_FOUND)
set(ALLEGRO_XWINDOWS_WITH_XF86DGA2 1)
endif()
endif(ALLEGRO_WITH_XWINDOWS)
# -- Windows --
if(WIN32)
list(APPEND PLATFORM_SOURCES ${ALLEGRO_SRC_WIN_FILES})
endif(WIN32)
# -- Mac OS X --
if(ALLEGRO_MACOSX)
list(APPEND PLATFORM_SOURCES ${ALLEGRO_SRC_MACOSX_FILES})
list(APPEND PLATFORM_SOURCES src/macosx/main.m)
endif(ALLEGRO_MACOSX)
#-----------------------------------------------------------------------------#
#
# Generate and install headers
#
set(ALLEGRO_PUBLIC_HEADERS)
macro(add_headers location)
list(APPEND ALLEGRO_PUBLIC_HEADERS ${ARGN})
# We reuse MACOSX_PACKAGE_LOCATION on non-Mac platforms as well.
set_source_files_properties(${ARGN}
PROPERTIES
MACOSX_PACKAGE_LOCATION Headers/${location}
)
endmacro(add_headers)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/allegro/platform/alplatf.h.cmake
${CMAKE_BINARY_DIR}/include/allegro/platform/alplatf.h
@ONLY
)
add_headers(allegro/platform
${CMAKE_BINARY_DIR}/include/allegro/platform/alplatf.h
)
if(UNIX)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/allegro/platform/alunixac.h.cmake
${CMAKE_BINARY_DIR}/include/allegro/platform/alunixac.h
)
add_headers(allegro/platform
${CMAKE_BINARY_DIR}/include/allegro/platform/alunixac.h
)
endif(UNIX)
add_headers("" include/allegro.h)
add_headers(allegro ${ALLEGRO_INCLUDE_ALLEGRO_FILES})
add_headers(allegro/inline ${ALLEGRO_INCLUDE_ALLEGRO_INLINE_FILES})
add_headers(allegro/internal ${ALLEGRO_INCLUDE_ALLEGRO_INTERNAL_FILES})
add_headers(allegro/platform ${ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES})
# Platform-specific top-level headers.
if(ALLEGRO_LINUX)
add_headers("" include/linalleg.h)
endif(ALLEGRO_LINUX)
if(APPLE)
add_headers("" include/osxalleg.h)
endif(APPLE)
if(WIN32)
add_headers("" include/winalleg.h)
endif(WIN32)
if(ALLEGRO_WITH_XWINDOWS)
add_headers("" include/xalleg.h)
endif(ALLEGRO_WITH_XWINDOWS)
#-----------------------------------------------------------------------------#
#
# Main library
#
# On Unix/Mac we don't ever use a -static postfix.
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(BUILD_TYPE_SUFFIX -debug)
elseif(CMAKE_BUILD_TYPE STREQUAL Profile)
set(BUILD_TYPE_SUFFIX -profile)
else()
set(BUILD_TYPE_SUFFIX "")
endif()
if(APPLE)
# CMake 2.6.2 onwards passes these flags automatically.
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STREQUAL 2.6 AND
${CMAKE_PATCH_VERSION} LESS 2)
set(ALLEGRO_LINK_FLAGS
"-compatibility_version ${COMPAT_VERSION} -current_version ${ALLEGRO_VERSION}")
endif()
endif(APPLE)
add_our_library(allegro
${ALLEGRO_SRC_FILES}
${ALLEGRO_SRC_C_FILES}
${PLATFORM_SOURCES}
${ALLEGRO_PUBLIC_HEADERS}
)
set(allegro_OUTPUT_NAME alleg)
set_target_properties(allegro
PROPERTIES
COMPILE_FLAGS "-DALLEGRO_SRC"
LINK_FLAGS "${ALLEGRO_LINK_FLAGS}"
OUTPUT_NAME ${allegro_OUTPUT_NAME}
VERSION ${ALLEGRO_VERSION}
SOVERSION ${ALLEGRO_SOVERSION}
)
if(WIN32)
# Add a -static postfix on the main library for Windows.
# In earlier versions of Allegro this was "_s".
set_target_properties(allegro
PROPERTIES
POSTFIX "-static"
DEBUG_POSTFIX "-debug-static"
PROFILE_POSTFIX "-profile-static"
)
endif(WIN32)
set_our_framework_properties(allegro Allegro)
set(link_with ${PLATFORM_LIBS})
target_link_libraries(allegro ${link_with})
sanitize_cmake_link_flags(static_link_with ${link_with})
set_target_properties(allegro
PROPERTIES
static_link_with "${static_link_with}"
)
if(WANT_FRAMEWORKS)
add_our_library(alleg-main STATIC
src/macosx/main.m
)
set_target_properties(alleg-main
PROPERTIES
OUTPUT_NAME alleg-main${BUILD_TYPE_SUFFIX}
COMPILE_FLAGS -DALLEGRO_SRC
)
target_link_libraries(allegro alleg-main)
endif(WANT_FRAMEWORKS)
#-----------------------------------------------------------------------------#

View File

@ -1,18 +0,0 @@
This is a modified version of Allegro library (branch 4.4)
specially patched for Aseprite by David Capello.
Changes:
* Mouse driver for Windows was modified to use WM_MOUSEMOVE instead of
DirectInput (like in Allegro 5).
* Keyboard driver for Windows was modified to use WM_KEYDOWN/UP messages
instead of DirectInput (like in Allegro 5).
* Added resize support for Windows, X11, and Mac OS X ports.
* Removed code and functions that are not used (Allegro GUI,
audio, MIDI, joystick, etc.).
* The HWND class has CS_DBLCLKS enabled (so UI code can detect
double-clicks from Windows messages).
* Fixed issues recreating DirectX surfaces
* Fixed OS X mouse issues
* Support for x64
* Several [other changes](https://github.com/aseprite/aseprite/commits/master/src/allegro)

View File

@ -1,95 +0,0 @@
# For OS X frameworks to work you must add headers to the target's sources.
function(add_our_library target)
add_library(${target} ${ARGN})
set_target_properties(${target}
PROPERTIES
DEBUG_POSTFIX -debug
PROFILE_POSTFIX -profile
)
endfunction(add_our_library)
function(set_our_framework_properties target nm)
if(WANT_FRAMEWORKS)
if(WANT_EMBED)
set(install_name_dir "@executable_path/../Frameworks")
else()
set(install_name_dir "${FRAMEWORK_INSTALL_PREFIX}")
endif(WANT_EMBED)
set_target_properties(${target}
PROPERTIES
FRAMEWORK on
OUTPUT_NAME ${nm}
INSTALL_NAME_DIR "${install_name_dir}"
)
endif(WANT_FRAMEWORKS)
endfunction(set_our_framework_properties)
function(install_our_library target)
install(TARGETS ${target}
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
FRAMEWORK DESTINATION "${FRAMEWORK_INSTALL_PREFIX}"
RUNTIME DESTINATION "bin"
# Doesn't work, see below.
# PUBLIC_HEADER DESTINATION "include"
)
endfunction(install_our_library)
# Unfortunately, CMake's PUBLIC_HEADER support doesn't install into nested
# directories well, otherwise we could rely on install(TARGETS) to install
# header files associated with the target. Instead we use the install(FILES)
# to install headers. We reuse the MACOSX_PACKAGE_LOCATION property,
# substituting the "Headers" prefix with "include".
function(install_our_headers)
foreach(hdr ${ARGN})
get_source_file_property(LOC ${hdr} MACOSX_PACKAGE_LOCATION)
string(REGEX REPLACE "^Headers" "include" LOC ${LOC})
install(FILES ${hdr} DESTINATION ${LOC})
endforeach()
endfunction(install_our_headers)
function(add_our_executable nm)
add_executable(${nm} ${ARGN})
target_link_libraries(${nm} allegro)
endfunction()
# Oh my. CMake really is bad for this - but I couldn't find a better
# way.
function(sanitize_cmake_link_flags return)
SET(acc_libs)
foreach(lib ${ARGN})
# Watch out for -framework options (OS X)
IF (NOT lib MATCHES "-framework.*|.*framework")
# Remove absolute path.
string(REGEX REPLACE "/.*/(.*)" "\\1" lib ${lib})
# Remove .a/.so/.dylib.
string(REGEX REPLACE "lib(.*)\\.(a|so|dylib)" "\\1" lib ${lib})
# Remove -l prefix if it's there already.
string(REGEX REPLACE "-l(.*)" "\\1" lib ${lib})
set(acc_libs "${acc_libs} -l${lib}")
ENDIF()
endforeach(lib)
set(${return} ${acc_libs} PARENT_SCOPE)
endfunction(sanitize_cmake_link_flags)
function(copy_files target)
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
return()
endif()
foreach(file ${ARGN})
# The "./" is NOT redundant as CMAKE_CFG_INTDIR may be "/".
add_custom_command(
OUTPUT "./${CMAKE_CFG_INTDIR}/${file}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${file}"
COMMAND "${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/${file}"
"./${CMAKE_CFG_INTDIR}/${file}"
)
endforeach()
add_custom_target(${target} ALL DEPENDS ${ARGN})
endfunction()
# vim: set sts=4 sw=4 et:

View File

@ -1,260 +0,0 @@
set(ALLEGRO_SRC_FILES
src/allegro.c
src/blit.c
src/bmp.c
src/clip3d.c
src/clip3df.c
src/colblend.c
src/color.c
src/config.c
src/datafile.c
src/dataregi.c
src/dither.c
src/dispsw.c
src/drvlist.c
src/file.c
src/fli.c
src/flood.c
src/font.c
src/fontbios.c
src/fontbmp.c
src/fontdat.c
src/fontgrx.c
src/fonttxt.c
src/gfx.c
src/glyph.c
src/graphics.c
src/gsprite.c
src/inline.c
src/keyboard.c
src/lbm.c
src/libc.c
src/lzss.c
src/math.c
src/math3d.c
src/mouse.c
src/pcx.c
src/poly3d.c
src/polygon.c
src/quantize.c
src/quat.c
src/readbmp.c
src/readfont.c
src/rle.c
src/rotate.c
src/rsfb.c
src/scene3d.c
src/spline.c
src/text.c
src/tga.c
src/timer.c
src/unicode.c
src/vtable.c
src/vtable15.c
src/vtable16.c
src/vtable24.c
src/vtable32.c
src/vtable8.c
)
set(ALLEGRO_SRC_C_FILES
src/c/cblit16.c
src/c/cblit24.c
src/c/cblit32.c
src/c/cblit8.c
src/c/ccpu.c
src/c/ccsprite.c
src/c/cgfx15.c
src/c/cgfx16.c
src/c/cgfx24.c
src/c/cgfx32.c
src/c/cgfx8.c
src/c/cmisc.c
src/c/cscan15.c
src/c/cscan16.c
src/c/cscan24.c
src/c/cscan32.c
src/c/cscan8.c
src/c/cspr15.c
src/c/cspr16.c
src/c/cspr24.c
src/c/cspr32.c
src/c/cspr8.c
src/c/cstretch.c
src/c/czscan15.c
src/c/czscan16.c
src/c/czscan24.c
src/c/czscan32.c
src/c/czscan8.c
src/misc/ccolconv.c
)
set(ALLEGRO_SRC_WIN_FILES
src/win/dllver.rc
src/win/gdi.c
src/win/wddaccel.c
src/win/wddbmp.c
src/win/wddbmpl.c
src/win/wddraw.c
src/win/wddlock.c
src/win/wddmode.c
src/win/wddwin.c
src/win/wdxver.c
src/win/wdispsw.c
src/win/wfile.c
src/win/wgfxdrv.c
src/win/wkeybd.c
src/win/wmouse.c
src/win/wsystem.c
src/win/wthread.c
src/win/wtimer.c
src/win/wwnd.c
src/misc/colconv.c
)
set(ALLEGRO_SRC_LINUX_FILES
src/linux/fbcon.c
src/linux/lconsole.c
src/linux/lgfxdrv.c
src/linux/lkeybd.c
src/linux/lmemory.c
src/linux/lmouse.c
src/linux/lmsedrv.c
src/linux/lmsegpmd.c
src/linux/lmsems.c
src/linux/lmseps2.c
src/linux/lmseev.c
src/linux/lstddrv.c
src/linux/lsystem.c
src/linux/ltimer.c
src/linux/lvga.c
src/linux/lvgahelp.c
src/linux/svgalib.c
src/linux/vtswitch.c
src/misc/vbeaf.c
src/misc/vgaregs.c
src/misc/vga.c
)
set(ALLEGRO_SRC_UNIX_FILES
src/unix/udjgpp.c
src/unix/udrvlist.c
src/unix/udummy.c
src/unix/ufile.c
src/unix/ugfxdrv.c
src/unix/ukeybd.c
src/unix/umain.c
src/unix/umodules.c
src/unix/umouse.c
src/unix/uptimer.c
src/unix/usigalrm.c
src/unix/ustimer.c
src/unix/usystem.c
src/unix/uthreads.c
src/unix/utimer.c
)
set(ALLEGRO_SRC_X_FILES
src/x/xgfxdrv.c
src/x/xkeyboard.c
src/x/xmouse.c
src/x/xsystem.c
src/x/xtimer.c
src/x/xvtable.c
src/x/xwin.c
src/x/xdga2.c
src/misc/colconv.c
)
set(ALLEGRO_SRC_MACOSX_FILES
src/macosx/drivers.m
src/macosx/hidman.m
src/macosx/keybd.m
src/macosx/pcpu.m
src/macosx/quartz.m
src/macosx/qzfull.m
src/macosx/qzmouse.m
src/macosx/qzwindow.m
src/macosx/system.m
src/unix/ufile.c
src/unix/utimer.c
src/unix/uptimer.c
src/unix/usystem.c
src/unix/uthreads.c
src/misc/colconv.c
)
set(ALLEGRO_INCLUDE_ALLEGRO_FILES
include/allegro/3d.h
include/allegro/3dmaths.h
include/allegro/alcompat.h
include/allegro/alinline.h
include/allegro/base.h
include/allegro/color.h
include/allegro/compiled.h
include/allegro/config.h
include/allegro/datafile.h
include/allegro/debug.h
include/allegro/draw.h
include/allegro/file.h
include/allegro/fix.h
include/allegro/fixed.h
include/allegro/fli.h
include/allegro/fmaths.h
include/allegro/font.h
include/allegro/gfx.h
include/allegro/graphics.h
include/allegro/keyboard.h
include/allegro/lzss.h
include/allegro/matrix.h
include/allegro/mouse.h
include/allegro/palette.h
include/allegro/quat.h
include/allegro/rle.h
include/allegro/system.h
include/allegro/text.h
include/allegro/timer.h
include/allegro/unicode.h
)
set(ALLEGRO_INCLUDE_ALLEGRO_INLINE_FILES
include/allegro/inline/3dmaths.inl
include/allegro/inline/asm.inl
include/allegro/inline/color.inl
include/allegro/inline/draw.inl
include/allegro/inline/fix.inl
include/allegro/inline/fmaths.inl
include/allegro/inline/gfx.inl
include/allegro/inline/matrix.inl
include/allegro/inline/rle.inl
include/allegro/inline/system.inl
)
set(ALLEGRO_INCLUDE_ALLEGRO_INTERNAL_FILES
include/allegro/internal/aintern.h
include/allegro/internal/aintvga.h
include/allegro/internal/alconfig.h
)
set(ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES
include/allegro/platform/aintlnx.h
include/allegro/platform/aintosx.h
include/allegro/platform/aintunix.h
include/allegro/platform/aintwin.h
include/allegro/platform/al386gcc.h
include/allegro/platform/al386vc.h
include/allegro/platform/almngw32.h
include/allegro/platform/almsvc.h
include/allegro/platform/alosx.h
include/allegro/platform/alosxcfg.h
# include/allegro/platform/alplatf.h.cmake
include/allegro/platform/alucfg.h
include/allegro/platform/alunix.h
# include/allegro/platform/alunixac.h.cmake
# include/allegro/platform/alunixac.hin
include/allegro/platform/alwin.h
include/allegro/platform/astdint.h
)
#-----------------------------------------------------------------------------#
# vim: set sts=4 sw=4 et:

View File

@ -1,76 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \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 ALLEGRO_H
#define ALLEGRO_H
#include "allegro/base.h"
#include "allegro/system.h"
#include "allegro/debug.h"
#include "allegro/unicode.h"
#include "allegro/mouse.h"
#include "allegro/timer.h"
#include "allegro/keyboard.h"
#include "allegro/palette.h"
#include "allegro/gfx.h"
#include "allegro/color.h"
#include "allegro/draw.h"
#include "allegro/rle.h"
#include "allegro/compiled.h"
#include "allegro/text.h"
#include "allegro/font.h"
#include "allegro/fli.h"
#include "allegro/config.h"
#include "allegro/file.h"
#include "allegro/lzss.h"
#include "allegro/datafile.h"
#include "allegro/fixed.h"
#include "allegro/fmaths.h"
#include "allegro/matrix.h"
#include "allegro/quat.h"
#include "allegro/3d.h"
#include "allegro/3dmaths.h"
#ifndef ALLEGRO_NO_COMPATIBILITY
#include "allegro/alcompat.h"
#endif
#ifndef ALLEGRO_NO_FIX_CLASS
#ifdef __cplusplus
#include "allegro/fix.h"
#endif
#endif
#ifdef ALLEGRO_EXTRA_HEADER
#include ALLEGRO_EXTRA_HEADER
#endif
#endif /* ifndef ALLEGRO_H */

View File

@ -1,102 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 3D polygon drawing routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_3D_H
#define ALLEGRO_3D_H
#include "base.h"
#include "fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BITMAP;
typedef struct V3D /* a 3d point (fixed point version) */
{
fixed x, y, z; /* position */
fixed u, v; /* texture map coordinates */
int c; /* color */
} V3D;
typedef struct V3D_f /* a 3d point (floating point version) */
{
float x, y, z; /* position */
float u, v; /* texture map coordinates */
int c; /* color */
} V3D_f;
#define POLYTYPE_FLAT 0
#define POLYTYPE_GCOL 1
#define POLYTYPE_GRGB 2
#define POLYTYPE_ATEX 3
#define POLYTYPE_PTEX 4
#define POLYTYPE_ATEX_MASK 5
#define POLYTYPE_PTEX_MASK 6
#define POLYTYPE_ATEX_LIT 7
#define POLYTYPE_PTEX_LIT 8
#define POLYTYPE_ATEX_MASK_LIT 9
#define POLYTYPE_PTEX_MASK_LIT 10
#define POLYTYPE_ATEX_TRANS 11
#define POLYTYPE_PTEX_TRANS 12
#define POLYTYPE_ATEX_MASK_TRANS 13
#define POLYTYPE_PTEX_MASK_TRANS 14
#define POLYTYPE_MAX 15
#define POLYTYPE_ZBUF 16
AL_VAR(float, scene_gap);
AL_FUNC(void, _soft_polygon3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D *vtx[]));
AL_FUNC(void, _soft_polygon3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D_f *vtx[]));
AL_FUNC(void, _soft_triangle3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3));
AL_FUNC(void, _soft_triangle3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3));
AL_FUNC(void, _soft_quad3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4));
AL_FUNC(void, _soft_quad3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3, V3D_f *v4));
AL_FUNC(int, clip3d, (int type, fixed min_z, fixed max_z, int vc, AL_CONST V3D *vtx[], V3D *vout[], V3D *vtmp[], int out[]));
AL_FUNC(int, clip3d_f, (int type, float min_z, float max_z, int vc, AL_CONST V3D_f *vtx[], V3D_f *vout[], V3D_f *vtmp[], int out[]));
AL_FUNC(fixed, polygon_z_normal, (AL_CONST V3D *v1, AL_CONST V3D *v2, AL_CONST V3D *v3));
AL_FUNC(float, polygon_z_normal_f, (AL_CONST V3D_f *v1, AL_CONST V3D_f *v2, AL_CONST V3D_f *v3));
/* Note: You are not supposed to mix ZBUFFER with BITMAP even though it is
* currently possible. This is just the internal representation, and it may
* change in the future.
*/
typedef struct BITMAP ZBUFFER;
AL_FUNC(ZBUFFER *, create_zbuffer, (struct BITMAP *bmp));
AL_FUNC(ZBUFFER *, create_sub_zbuffer, (ZBUFFER *parent, int x, int y, int width, int height));
AL_FUNC(void, set_zbuffer, (ZBUFFER *zbuf));
AL_FUNC(void, clear_zbuffer, (ZBUFFER *zbuf, float z));
AL_FUNC(void, destroy_zbuffer, (ZBUFFER *zbuf));
AL_FUNC(int, create_scene, (int nedge, int npoly));
AL_FUNC(void, clear_scene, (struct BITMAP* bmp));
AL_FUNC(void, destroy_scene, (void));
AL_FUNC(int, scene_polygon3d, (int type, struct BITMAP *texture, int vx, V3D *vtx[]));
AL_FUNC(int, scene_polygon3d_f, (int type, struct BITMAP *texture, int vx, V3D_f *vtx[]));
AL_FUNC(void, render_scene, (void));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_3D_H */

View File

@ -1,62 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 3D oriented math routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_3DMATHS_H
#define ALLEGRO_3DMATHS_H
#include "base.h"
#include "fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
struct QUAT;
struct MATRIX_f;
AL_FUNC(fixed, vector_length, (fixed x, fixed y, fixed z));
AL_FUNC(float, vector_length_f, (float x, float y, float z));
AL_FUNC(void, normalize_vector, (fixed *x, fixed *y, fixed *z));
AL_FUNC(void, normalize_vector_f, (float *x, float *y, float *z));
AL_FUNC(void, cross_product, (fixed x1, fixed y_1, fixed z1, fixed x2, fixed y2, fixed z2, fixed *xout, fixed *yout, fixed *zout));
AL_FUNC(void, cross_product_f, (float x1, float y_1, float z1, float x2, float y2, float z2, float *xout, float *yout, float *zout));
AL_VAR(fixed, _persp_xscale);
AL_VAR(fixed, _persp_yscale);
AL_VAR(fixed, _persp_xoffset);
AL_VAR(fixed, _persp_yoffset);
AL_VAR(float, _persp_xscale_f);
AL_VAR(float, _persp_yscale_f);
AL_VAR(float, _persp_xoffset_f);
AL_VAR(float, _persp_yoffset_f);
AL_FUNC(void, set_projection_viewport, (int x, int y, int w, int h));
AL_FUNC(void, quat_to_matrix, (AL_CONST struct QUAT *q, struct MATRIX_f *m));
AL_FUNC(void, matrix_to_quat, (AL_CONST struct MATRIX_f *m, struct QUAT *q));
#ifdef __cplusplus
}
#endif
#include "inline/3dmaths.inl"
#endif /* ifndef ALLEGRO_3DMATHS_H */

View File

@ -1,194 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Backward compatibility stuff.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_COMPAT_H
#define ALLEGRO_COMPAT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ALLEGRO_SRC
#ifndef ALLEGRO_NO_CLEAR_BITMAP_ALIAS
#if (defined ALLEGRO_GCC)
static __attribute__((unused)) __inline__ void clear(BITMAP *bmp)
{
clear_bitmap(bmp);
}
#else
static INLINE void clear(BITMAP *bmp)
{
clear_bitmap(bmp);
}
#endif
#endif
#ifndef ALLEGRO_NO_FIX_ALIASES
AL_ALIAS(fixed fadd(fixed x, fixed y), fixadd(x, y))
AL_ALIAS(fixed fsub(fixed x, fixed y), fixsub(x, y))
AL_ALIAS(fixed fmul(fixed x, fixed y), fixmul(x, y))
AL_ALIAS(fixed fdiv(fixed x, fixed y), fixdiv(x, y))
AL_ALIAS(int fceil(fixed x), fixceil(x))
AL_ALIAS(int ffloor(fixed x), fixfloor(x))
AL_ALIAS(fixed fcos(fixed x), fixcos(x))
AL_ALIAS(fixed fsin(fixed x), fixsin(x))
AL_ALIAS(fixed ftan(fixed x), fixtan(x))
AL_ALIAS(fixed facos(fixed x), fixacos(x))
AL_ALIAS(fixed fasin(fixed x), fixasin(x))
AL_ALIAS(fixed fatan(fixed x), fixatan(x))
AL_ALIAS(fixed fatan2(fixed y, fixed x), fixatan2(y, x))
AL_ALIAS(fixed fsqrt(fixed x), fixsqrt(x))
AL_ALIAS(fixed fhypot(fixed x, fixed y), fixhypot(x, y))
#endif
#endif /* !defined ALLEGRO_SRC */
#define KB_NORMAL 1
#define KB_EXTENDED 2
#define SEND_MESSAGE object_message
#define cpu_fpu (cpu_capabilities & CPU_FPU)
#define cpu_mmx (cpu_capabilities & CPU_MMX)
#define cpu_3dnow (cpu_capabilities & CPU_3DNOW)
#define cpu_cpuid (cpu_capabilities & CPU_ID)
/* in case you want to spell 'palette' as 'pallete' */
#define PALLETE PALETTE
#define black_pallete black_palette
#define desktop_pallete desktop_palette
#define set_pallete set_palette
#define get_pallete get_palette
#define set_pallete_range set_palette_range
#define get_pallete_range get_palette_range
#define fli_pallete fli_palette
#define pallete_color palette_color
#define DAT_PALLETE DAT_PALETTE
#define select_pallete select_palette
#define unselect_pallete unselect_palette
#define generate_332_pallete generate_332_palette
#define generate_optimised_pallete generate_optimised_palette
/* a pretty vague name */
#define fix_filename_path canonicalize_filename
/* the old (and broken!) file enumeration function */
AL_FUNC_DEPRECATED(int, for_each_file, (AL_CONST char *name, int attrib, AL_METHOD(void, callback, (AL_CONST char *filename, int attrib, int param)), int param));
/* long is 32-bit only on some systems, and we want to list DVDs! */
AL_FUNC_DEPRECATED(long, file_size, (AL_CONST char *filename));
/* the old state-based textout functions */
AL_VAR(int, _textmode);
AL_FUNC_DEPRECATED(int, text_mode, (int mode));
AL_INLINE_DEPRECATED(void, textout, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x, int y, int color),
{
textout_ex(bmp, f, str, x, y, color, _textmode);
})
AL_INLINE_DEPRECATED(void, textout_centre, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x, int y, int color),
{
textout_centre_ex(bmp, f, str, x, y, color, _textmode);
})
AL_INLINE_DEPRECATED(void, textout_right, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x, int y, int color),
{
textout_right_ex(bmp, f, str, x, y, color, _textmode);
})
AL_INLINE_DEPRECATED(void, textout_justify, (struct BITMAP *bmp, AL_CONST FONT *f, AL_CONST char *str, int x1, int x2, int y, int diff, int color),
{
textout_justify_ex(bmp, f, str, x1, x2, y, diff, color, _textmode);
})
AL_PRINTFUNC_DEPRECATED(void, textprintf, (struct BITMAP *bmp, AL_CONST FONT *f, int x, int y, int color, AL_CONST char *format, ...), 6, 7);
AL_PRINTFUNC_DEPRECATED(void, textprintf_centre, (struct BITMAP *bmp, AL_CONST FONT *f, int x, int y, int color, AL_CONST char *format, ...), 6, 7);
AL_PRINTFUNC_DEPRECATED(void, textprintf_right, (struct BITMAP *bmp, AL_CONST FONT *f, int x, int y, int color, AL_CONST char *format, ...), 6, 7);
AL_PRINTFUNC_DEPRECATED(void, textprintf_justify, (struct BITMAP *bmp, AL_CONST FONT *f, int x1, int x2, int y, int diff, int color, AL_CONST char *format, ...), 8, 9);
AL_INLINE_DEPRECATED(void, draw_character, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color),
{
draw_character_ex(bmp, sprite, x, y, color, _textmode);
})
/* the old close button functions */
AL_INLINE_DEPRECATED(int, set_window_close_button, (int enable),
{
(void)enable;
return 0;
})
AL_INLINE_DEPRECATED(void, set_window_close_hook, (void (*proc)(void)),
{
set_close_button_callback(proc);
})
/* the weird old clipping API */
AL_FUNC_DEPRECATED(void, set_clip, (BITMAP *bitmap, int x1, int y_1, int x2, int y2));
/* unnecessary, can use rest(0) */
AL_INLINE_DEPRECATED(void, yield_timeslice, (void),
{
ASSERT(system_driver);
if (system_driver->yield_timeslice)
system_driver->yield_timeslice();
})
/* DOS-ish monitor retrace ideas that don't work elsewhere */
AL_FUNCPTR(void, retrace_proc, (void));
/* Those were never documented, but we need to keep them for DLL compatibility,
* and to be on the safe side also let's keep them work regardless.
*/
AL_INLINE_DEPRECATED(void, set_file_encoding, (int encoding),
{
set_filename_encoding(encoding);
})
AL_INLINE_DEPRECATED(int, get_file_encoding, (void),
{
return get_filename_encoding();
})
#ifdef ALLEGRO_SRC
AL_FUNC(int, timer_can_simulate_retrace, (void));
AL_FUNC(void, timer_simulate_retrace, (int enable));
#else
AL_FUNC_DEPRECATED(int, timer_can_simulate_retrace, (void));
AL_FUNC_DEPRECATED(void, timer_simulate_retrace, (int enable));
#endif
AL_FUNC_DEPRECATED(int, timer_is_using_retrace, (void));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_COMPAT_H */

View File

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

View File

@ -1,115 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \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 ALLEGRO_BASE_H
#define ALLEGRO_BASE_H
#ifndef ALLEGRO_NO_STD_HEADERS
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#endif
#if (defined DEBUGMODE) && (defined FORTIFY)
#include <fortify/fortify.h>
#endif
#if (defined DEBUGMODE) && (defined DMALLOC)
#include <dmalloc.h>
#endif
#include "internal/alconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ALLEGRO_VERSION 4
#define ALLEGRO_SUB_VERSION 4
#define ALLEGRO_WIP_VERSION 2
#define ALLEGRO_VERSION_STR "4.4.2 (SVN)"
#define ALLEGRO_DATE_STR "2010"
#define ALLEGRO_DATE 20100303 /* yyyymmdd */
/*******************************************/
/************ Some global stuff ************/
/*******************************************/
/* Asm build disabled as of 4.3.10+. */
#ifndef ALLEGRO_NO_ASM
#define ALLEGRO_NO_ASM
#endif
#ifndef TRUE
#define TRUE -1
#define FALSE 0
#endif
#undef MIN
#undef MAX
#undef MID
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
/* Returns the median of x, y, z */
#define MID(x,y,z) ((x) > (y) ? ((y) > (z) ? (y) : ((x) > (z) ? \
(z) : (x))) : ((y) > (z) ? ((z) > (x) ? (z) : \
(x)): (y)))
/* Optimized version of MID for when x <= z. */
#define CLAMP(x,y,z) MAX((x), MIN((y), (z)))
#undef ABS
#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
#undef SGN
#define SGN(x) (((x) >= 0) ? 1 : -1)
#define AL_PI 3.14159265358979323846
#define AL_ID(a,b,c,d) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d))
AL_VAR(int *, allegro_errno);
typedef struct _DRIVER_INFO /* info about a hardware driver */
{
int id; /* integer ID */
void *driver; /* the driver structure */
int autodetect; /* set to allow autodetection */
} _DRIVER_INFO;
#ifdef _MSC_VER
#define ALLEGRO_TLS __declspec(thread)
#elif __GNUC__
#define ALLEGRO_TLS __thread
#else
#define ALLEGRO_TLS
#endif
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_BASE_H */

View File

@ -1,153 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Color manipulation routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_COLOR_H
#define ALLEGRO_COLOR_H
#include "base.h"
#include "palette.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BITMAP;
AL_VAR(PALETTE, black_palette);
AL_VAR(PALETTE, desktop_palette);
AL_VAR(PALETTE, default_palette);
typedef struct {
unsigned char data[32][32][32];
} RGB_MAP;
typedef struct {
unsigned char data[PAL_SIZE][PAL_SIZE];
} COLOR_MAP;
AL_VAR(RGB_MAP *, rgb_map);
AL_VAR(COLOR_MAP *, color_map);
AL_VAR(PALETTE, _current_palette);
AL_VAR(int, _rgb_r_shift_15);
AL_VAR(int, _rgb_g_shift_15);
AL_VAR(int, _rgb_b_shift_15);
AL_VAR(int, _rgb_r_shift_16);
AL_VAR(int, _rgb_g_shift_16);
AL_VAR(int, _rgb_b_shift_16);
AL_VAR(int, _rgb_r_shift_24);
AL_VAR(int, _rgb_g_shift_24);
AL_VAR(int, _rgb_b_shift_24);
AL_VAR(int, _rgb_r_shift_32);
AL_VAR(int, _rgb_g_shift_32);
AL_VAR(int, _rgb_b_shift_32);
AL_VAR(int, _rgb_a_shift_32);
AL_ARRAY(int, _rgb_scale_5);
AL_ARRAY(int, _rgb_scale_6);
#define MASK_COLOR_8 0
#define MASK_COLOR_15 0x7C1F
#define MASK_COLOR_16 0xF81F
#define MASK_COLOR_24 0xFF00FF
#define MASK_COLOR_32 0xFF00FF
AL_VAR(int *, palette_color);
AL_FUNC(void, set_color, (int idx, AL_CONST RGB *p));
AL_FUNC(void, set_palette, (AL_CONST PALETTE p));
AL_FUNC(void, set_palette_range, (AL_CONST PALETTE p, int from, int to, int retracesync));
AL_FUNC(void, get_color, (int idx, RGB *p));
AL_FUNC(void, get_palette, (PALETTE p));
AL_FUNC(void, get_palette_range, (PALETTE p, int from, int to));
AL_FUNC(void, fade_interpolate, (AL_CONST PALETTE source, AL_CONST PALETTE dest, PALETTE output, int pos, int from, int to));
AL_FUNC(void, fade_from_range, (AL_CONST PALETTE source, AL_CONST PALETTE dest, int speed, int from, int to));
AL_FUNC(void, fade_in_range, (AL_CONST PALETTE p, int speed, int from, int to));
AL_FUNC(void, fade_out_range, (int speed, int from, int to));
AL_FUNC(void, fade_from, (AL_CONST PALETTE source, AL_CONST PALETTE dest, int speed));
AL_FUNC(void, fade_in, (AL_CONST PALETTE p, int speed));
AL_FUNC(void, fade_out, (int speed));
AL_FUNC(void, select_palette, (AL_CONST PALETTE p));
AL_FUNC(void, unselect_palette, (void));
AL_FUNC(void, generate_332_palette, (PALETTE pal));
AL_FUNC(int, generate_optimized_palette, (struct BITMAP *image, PALETTE pal, AL_CONST signed char rsvdcols[256]));
AL_FUNC(void, create_rgb_table, (RGB_MAP *table, AL_CONST PALETTE pal, AL_METHOD(void, callback, (int pos))));
AL_FUNC(void, create_light_table, (COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, int b, AL_METHOD(void, callback, (int pos))));
AL_FUNC(void, create_trans_table, (COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, int b, AL_METHOD(void, callback, (int pos))));
AL_FUNC(void, create_color_table, (COLOR_MAP *table, AL_CONST PALETTE pal, AL_METHOD(void, blend, (AL_CONST PALETTE pal, int x, int y, RGB *rgb)), AL_METHOD(void, callback, (int pos))));
AL_FUNC(void, create_blender_table, (COLOR_MAP *table, AL_CONST PALETTE pal, AL_METHOD(void, callback, (int pos))));
typedef AL_METHOD(unsigned long, BLENDER_FUNC, (unsigned long x, unsigned long y, unsigned long n));
AL_FUNC(void, set_blender_mode, (BLENDER_FUNC b15, BLENDER_FUNC b16, BLENDER_FUNC b24, int r, int g, int b, int a));
AL_FUNC(void, set_blender_mode_ex, (BLENDER_FUNC b15, BLENDER_FUNC b16, BLENDER_FUNC b24, BLENDER_FUNC b32, BLENDER_FUNC b15x, BLENDER_FUNC b16x, BLENDER_FUNC b24x, int r, int g, int b, int a));
AL_FUNC(void, set_alpha_blender, (void));
AL_FUNC(void, set_write_alpha_blender, (void));
AL_FUNC(void, set_trans_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_add_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_burn_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_color_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_difference_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_dissolve_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_dodge_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_hue_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_invert_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_luminance_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_multiply_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_saturation_blender, (int r, int g, int b, int a));
AL_FUNC(void, set_screen_blender, (int r, int g, int b, int a));
AL_FUNC(void, hsv_to_rgb, (float h, float s, float v, int *r, int *g, int *b));
AL_FUNC(void, rgb_to_hsv, (int r, int g, int b, float *h, float *s, float *v));
AL_FUNC(int, bestfit_color, (AL_CONST PALETTE pal, int r, int g, int b));
AL_FUNC(int, makecol, (int r, int g, int b));
AL_FUNC(int, makecol8, (int r, int g, int b));
AL_FUNC(int, makecol_depth, (int color_depth, int r, int g, int b));
AL_FUNC(int, makeacol, (int r, int g, int b, int a));
AL_FUNC(int, makeacol_depth, (int color_depth, int r, int g, int b, int a));
AL_FUNC(int, makecol15_dither, (int r, int g, int b, int x, int y));
AL_FUNC(int, makecol16_dither, (int r, int g, int b, int x, int y));
AL_FUNC(int, getr, (int c));
AL_FUNC(int, getg, (int c));
AL_FUNC(int, getb, (int c));
AL_FUNC(int, geta, (int c));
AL_FUNC(int, getr_depth, (int color_depth, int c));
AL_FUNC(int, getg_depth, (int color_depth, int c));
AL_FUNC(int, getb_depth, (int color_depth, int c));
AL_FUNC(int, geta_depth, (int color_depth, int c));
#ifdef __cplusplus
}
#endif
#include "inline/color.inl"
#endif /* ifndef ALLEGRO_COLOR_H */

View File

@ -1,42 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Compiled sprites.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_COMPILED_H
#define ALLEGRO_COMPILED_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BITMAP;
/* emulate compiled sprites using RLE on other platforms */
struct RLE_SPRITE;
typedef struct RLE_SPRITE COMPILED_SPRITE;
AL_FUNC(COMPILED_SPRITE *, get_compiled_sprite, (struct BITMAP *bitmap, int planar));
AL_FUNC(void, destroy_compiled_sprite, (COMPILED_SPRITE *sprite));
AL_FUNC(void, draw_compiled_sprite, (struct BITMAP *bmp, AL_CONST COMPILED_SPRITE *sprite, int x, int y));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_COMPILED_H */

View File

@ -1,63 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration file access routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_CONFIG_H
#define ALLEGRO_CONFIG_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(void, set_config_file, (AL_CONST char *filename));
AL_FUNC(void, set_config_data, (AL_CONST char *data, int length));
AL_FUNC(void, override_config_file, (AL_CONST char *filename));
AL_FUNC(void, override_config_data, (AL_CONST char *data, int length));
AL_FUNC(void, flush_config_file, (void));
AL_FUNC(void, reload_config_texts, (AL_CONST char *new_language));
AL_FUNC(void, push_config_state, (void));
AL_FUNC(void, pop_config_state, (void));
AL_FUNC(void, hook_config_section, (AL_CONST char *section, AL_METHOD(int, intgetter, (AL_CONST char *, int)), AL_METHOD(AL_CONST char *, stringgetter, (AL_CONST char *, AL_CONST char *)), AL_METHOD(void, stringsetter, (AL_CONST char *, AL_CONST char *))));
AL_FUNC(int, config_is_hooked, (AL_CONST char *section));
AL_FUNC(AL_CONST char *, get_config_string, (AL_CONST char *section, AL_CONST char *name, AL_CONST char *def));
AL_FUNC(int, get_config_int, (AL_CONST char *section, AL_CONST char *name, int def));
AL_FUNC(int, get_config_hex, (AL_CONST char *section, AL_CONST char *name, int def));
AL_FUNC(float, get_config_float, (AL_CONST char *section, AL_CONST char *name, float def));
AL_FUNC(int, get_config_id, (AL_CONST char *section, AL_CONST char *name, int def));
AL_FUNC(char **, get_config_argv, (AL_CONST char *section, AL_CONST char *name, int *argc));
AL_FUNC(AL_CONST char *, get_config_text, (AL_CONST char *msg));
AL_FUNC(void, set_config_string, (AL_CONST char *section, AL_CONST char *name, AL_CONST char *val));
AL_FUNC(void, set_config_int, (AL_CONST char *section, AL_CONST char *name, int val));
AL_FUNC(void, set_config_hex, (AL_CONST char *section, AL_CONST char *name, int val));
AL_FUNC(void, set_config_float, (AL_CONST char *section, AL_CONST char *name, float val));
AL_FUNC(void, set_config_id, (AL_CONST char *section, AL_CONST char *name, int val));
AL_FUNC(int, list_config_entries, (AL_CONST char *section, AL_CONST char ***names));
AL_FUNC(int, list_config_sections, (AL_CONST char ***names));
AL_FUNC(void, free_config_entries, (char ***names));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_CONFIG_H */

View File

@ -1,112 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Datafile access routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_DATAFILE_H
#define ALLEGRO_DATAFILE_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BITMAP;
struct PACKFILE;
struct RGB;
#define DAT_ID(a,b,c,d) AL_ID(a,b,c,d)
#define DAT_MAGIC DAT_ID('A','L','L','.')
#define DAT_FILE DAT_ID('F','I','L','E')
#define DAT_DATA DAT_ID('D','A','T','A')
#define DAT_FONT DAT_ID('F','O','N','T')
#define DAT_PATCH DAT_ID('P','A','T',' ')
#define DAT_FLI DAT_ID('F','L','I','C')
#define DAT_BITMAP DAT_ID('B','M','P',' ')
#define DAT_RLE_SPRITE DAT_ID('R','L','E',' ')
#define DAT_C_SPRITE DAT_ID('C','M','P',' ')
#define DAT_XC_SPRITE DAT_ID('X','C','M','P')
#define DAT_PALETTE DAT_ID('P','A','L',' ')
#define DAT_PROPERTY DAT_ID('p','r','o','p')
#define DAT_NAME DAT_ID('N','A','M','E')
#define DAT_END -1
typedef struct DATAFILE_PROPERTY
{
char *dat; /* pointer to the data */
int type; /* property type */
} DATAFILE_PROPERTY;
typedef struct DATAFILE
{
void *dat; /* pointer to the data */
int type; /* object type */
long size; /* size of the object */
DATAFILE_PROPERTY *prop; /* object properties */
} DATAFILE;
typedef struct DATAFILE_INDEX
{
char *filename; /* datafile name (path) */
long *offset; /* list of offsets */
} DATAFILE_INDEX;
AL_FUNC(DATAFILE *, load_datafile, (AL_CONST char *filename));
AL_FUNC(DATAFILE *, load_datafile_callback, (AL_CONST char *filename, AL_METHOD(void, callback, (DATAFILE *))));
AL_FUNC(DATAFILE_INDEX *, create_datafile_index, (AL_CONST char *filename));
AL_FUNC(void, unload_datafile, (DATAFILE *dat));
AL_FUNC(void, destroy_datafile_index, (DATAFILE_INDEX *index));
AL_FUNC(DATAFILE *, load_datafile_object, (AL_CONST char *filename, AL_CONST char *objectname));
AL_FUNC(DATAFILE *, load_datafile_object_indexed, (AL_CONST DATAFILE_INDEX *index, int item));
AL_FUNC(void, unload_datafile_object, (DATAFILE *dat));
AL_FUNC(DATAFILE *, find_datafile_object, (AL_CONST DATAFILE *dat, AL_CONST char *objectname));
AL_FUNC(AL_CONST char *, get_datafile_property, (AL_CONST DATAFILE *dat, int type));
AL_FUNC(void, register_datafile_object, (int id_, AL_METHOD(void *, load, (struct PACKFILE *f, long size)), AL_METHOD(void, destroy, (void *data))));
AL_FUNC(void, fixup_datafile, (DATAFILE *data));
AL_FUNC(struct BITMAP *, load_bitmap, (AL_CONST char *filename, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_bmp, (AL_CONST char *filename, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_bmp_pf, (PACKFILE *f, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_lbm, (AL_CONST char *filename, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_pcx, (AL_CONST char *filename, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_pcx_pf, (PACKFILE *f, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_tga, (AL_CONST char *filename, struct RGB *pal));
AL_FUNC(struct BITMAP *, load_tga_pf, (PACKFILE *f, struct RGB *pal));
AL_FUNC(int, save_bitmap, (AL_CONST char *filename, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(int, save_bmp, (AL_CONST char *filename, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(int, save_bmp_pf, (PACKFILE *f, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(int, save_pcx, (AL_CONST char *filename, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(int, save_pcx_pf, (PACKFILE *f, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(int, save_tga, (AL_CONST char *filename, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(int, save_tga_pf, (PACKFILE *f, struct BITMAP *bmp, AL_CONST struct RGB *pal));
AL_FUNC(void, register_bitmap_file_type, (AL_CONST char *ext, AL_METHOD(struct BITMAP *, load, (AL_CONST char *filename, struct RGB *pal)), AL_METHOD(int, save, (AL_CONST char *filename, struct BITMAP *bmp, AL_CONST struct RGB *pal))));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_DATAFILE_H */

View File

@ -1,57 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Debug facilities.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_DEBUG_H
#define ALLEGRO_DEBUG_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(void, al_assert, (AL_CONST char *file, int linenr));
AL_PRINTFUNC(void, al_trace, (AL_CONST char *msg, ...), 1, 2);
AL_FUNC(void, register_assert_handler, (AL_METHOD(int, handler, (AL_CONST char *msg))));
AL_FUNC(void, register_trace_handler, (AL_METHOD(int, handler, (AL_CONST char *msg))));
#ifdef DEBUGMODE
#ifndef ASSERT
#define ASSERT(condition) { if (!(condition)) al_assert(__FILE__, __LINE__); }
#endif
#ifndef TRACE
#define TRACE al_trace
#endif
#else
#ifndef ASSERT
#define ASSERT(condition)
#endif
#ifndef TRACE
#define TRACE 1 ? (void) 0 : al_trace
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_DEBUG_H */

View File

@ -1,89 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Drawing and sprite routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_DRAW_H
#define ALLEGRO_DRAW_H
#include "base.h"
#include "fixed.h"
#include "gfx.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DRAW_MODE_SOLID 0 /* flags for drawing_mode() */
#define DRAW_MODE_XOR 1
#define DRAW_MODE_COPY_PATTERN 2
#define DRAW_MODE_SOLID_PATTERN 3
#define DRAW_MODE_MASKED_PATTERN 4
#define DRAW_MODE_TRANS 5
AL_FUNC(void, drawing_mode, (int mode, struct BITMAP *pattern, int x_anchor, int y_anchor));
AL_FUNC(void, xor_mode, (int on));
AL_FUNC(void, solid_mode, (void));
AL_FUNC(void, do_line, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int d, AL_METHOD(void, proc, (struct BITMAP *, int, int, int))));
AL_FUNC(void, _soft_triangle, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int x3, int y3, int color));
AL_FUNC(void, _soft_polygon, (struct BITMAP *bmp, int vertices, AL_CONST int *points, int color));
AL_FUNC(void, _soft_rect, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
AL_FUNC(void, do_circle, (struct BITMAP *bmp, int x, int y, int radius, int d, AL_METHOD(void, proc, (struct BITMAP *, int, int, int))));
AL_FUNC(void, _soft_circle, (struct BITMAP *bmp, int x, int y, int radius, int color));
AL_FUNC(void, _soft_circlefill, (struct BITMAP *bmp, int x, int y, int radius, int color));
AL_FUNC(void, do_ellipse, (struct BITMAP *bmp, int x, int y, int rx, int ry, int d, AL_METHOD(void, proc, (struct BITMAP *, int, int, int))));
AL_FUNC(void, _soft_ellipse, (struct BITMAP *bmp, int x, int y, int rx, int ry, int color));
AL_FUNC(void, _soft_ellipsefill, (struct BITMAP *bmp, int x, int y, int rx, int ry, int color));
AL_FUNC(void, do_arc, (struct BITMAP *bmp, int x, int y, fixed ang1, fixed ang2, int r, int d, AL_METHOD(void, proc, (struct BITMAP *, int, int, int))));
AL_FUNC(void, _soft_arc, (struct BITMAP *bmp, int x, int y, fixed ang1, fixed ang2, int r, int color));
AL_FUNC(void, calc_spline, (AL_CONST int points[8], int npts, int *x, int *y));
AL_FUNC(void, _soft_spline, (struct BITMAP *bmp, AL_CONST int points[8], int color));
AL_FUNC(void, _soft_floodfill, (struct BITMAP *bmp, int x, int y, int color));
AL_FUNC(void, blit, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_FUNC(void, masked_blit, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_FUNC(void, stretch_blit, (struct BITMAP *s, struct BITMAP *d, int s_x, int s_y, int s_w, int s_h, int d_x, int d_y, int d_w, int d_h));
AL_FUNC(void, masked_stretch_blit, (struct BITMAP *s, struct BITMAP *d, int s_x, int s_y, int s_w, int s_h, int d_x, int d_y, int d_w, int d_h));
AL_FUNC(void, stretch_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int w, int h));
AL_FUNC(void, _soft_draw_gouraud_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4));
/* rotate+trans */
AL_FUNC(void, rotate_sprite_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle));
AL_FUNC(void, rotate_sprite_v_flip_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle));
AL_FUNC(void, rotate_scaled_sprite_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale));
AL_FUNC(void, rotate_scaled_sprite_v_flip_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale));
AL_FUNC(void, pivot_sprite_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle));
AL_FUNC(void, pivot_sprite_v_flip_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle));
AL_FUNC(void, pivot_scaled_sprite_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale));
AL_FUNC(void, pivot_scaled_sprite_v_flip_trans, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale));
/* rotate+lit */
AL_FUNC(void, rotate_sprite_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, int color));
AL_FUNC(void, rotate_sprite_v_flip_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, int color));
AL_FUNC(void, rotate_scaled_sprite_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale, int color));
AL_FUNC(void, rotate_scaled_sprite_v_flip_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale, int color));
AL_FUNC(void, pivot_sprite_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, int color));
AL_FUNC(void, pivot_sprite_v_flip_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, int color));
AL_FUNC(void, pivot_scaled_sprite_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale, int color));
AL_FUNC(void, pivot_scaled_sprite_v_flip_lit, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale, int color));
#ifdef __cplusplus
}
#endif
#include "inline/draw.inl"
#endif /* ifndef ALLEGRO_DRAW_H */

View File

@ -1,178 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* File I/O.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FILE_H
#define ALLEGRO_FILE_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(char *, fix_filename_case, (char *path));
AL_FUNC(char *, fix_filename_slashes, (char *path));
AL_FUNC(char *, canonicalize_filename, (char *dest, AL_CONST char *filename, int size));
AL_FUNC(char *, make_absolute_filename, (char *dest, AL_CONST char *path, AL_CONST char *filename, int size));
AL_FUNC(char *, make_relative_filename, (char *dest, AL_CONST char *path, AL_CONST char *filename, int size));
AL_FUNC(int, is_relative_filename, (AL_CONST char *filename));
AL_FUNC(char *, replace_filename, (char *dest, AL_CONST char *path, AL_CONST char *filename, int size));
AL_FUNC(char *, replace_extension, (char *dest, AL_CONST char *filename, AL_CONST char *ext, int size));
AL_FUNC(char *, append_filename, (char *dest, AL_CONST char *path, AL_CONST char *filename, int size));
AL_FUNC(char *, get_filename, (AL_CONST char *path));
AL_FUNC(char *, get_extension, (AL_CONST char *filename));
AL_FUNC(void, put_backslash, (char *filename));
AL_FUNC(int, file_exists, (AL_CONST char *filename, int attrib, int *aret));
AL_FUNC(int, exists, (AL_CONST char *filename));
AL_FUNC(uint64_t, file_size_ex, (AL_CONST char *filename));
AL_FUNC(time_t, file_time, (AL_CONST char *filename));
AL_FUNC(int, delete_file, (AL_CONST char *filename));
AL_FUNC(int, for_each_file_ex, (AL_CONST char *name, int in_attrib, int out_attrib, AL_METHOD(int, callback, (AL_CONST char *filename, int attrib, void *param)), void *param));
AL_FUNC(int, set_allegro_resource_path, (int priority, AL_CONST char *path));
AL_FUNC(int, find_allegro_resource, (char *dest, AL_CONST char *resource, AL_CONST char *ext, AL_CONST char *datafile, AL_CONST char *objectname, AL_CONST char *envvar, AL_CONST char *subdir, int size));
struct al_ffblk /* file info block for the al_find*() routines */
{
int attrib; /* actual attributes of the file found */
time_t time; /* modification time of file */
long size; /* size of file */
char name[512]; /* name of file */
void *ff_data; /* private hook */
};
AL_FUNC(uint64_t, al_ffblk_get_size, (struct al_ffblk *info));
AL_FUNC(int, al_findfirst, (AL_CONST char *pattern, struct al_ffblk *info, int attrib));
AL_FUNC(int, al_findnext, (struct al_ffblk *info));
AL_FUNC(void, al_findclose, (struct al_ffblk *info));
#ifndef EOF
#define EOF (-1)
#endif
#define F_READ "r"
#define F_WRITE "w"
#define F_READ_PACKED "rp"
#define F_WRITE_PACKED "wp"
#define F_WRITE_NOPACK "w!"
#define F_BUF_SIZE 4096 /* 4K buffer for caching data */
#define F_PACK_MAGIC 0x736C6821L /* magic number for packed files */
#define F_NOPACK_MAGIC 0x736C682EL /* magic number for autodetect */
#define F_EXE_MAGIC 0x736C682BL /* magic number for appended data */
#define PACKFILE_FLAG_WRITE 1 /* the file is being written */
#define PACKFILE_FLAG_PACK 2 /* data is compressed */
#define PACKFILE_FLAG_CHUNK 4 /* file is a sub-chunk */
#define PACKFILE_FLAG_EOF 8 /* reached the end-of-file */
#define PACKFILE_FLAG_ERROR 16 /* an error has occurred */
#define PACKFILE_FLAG_OLD_CRYPT 32 /* backward compatibility mode */
#define PACKFILE_FLAG_EXEDAT 64 /* reading from our executable */
typedef struct PACKFILE_VTABLE PACKFILE_VTABLE;
typedef struct PACKFILE PACKFILE;
struct LZSS_PACK_DATA;
struct LZSS_UNPACK_DATA;
struct _al_normal_packfile_details
{
int hndl; /* DOS file handle */
int flags; /* PACKFILE_FLAG_* constants */
unsigned char *buf_pos; /* position in buffer */
int buf_size; /* number of bytes in the buffer */
long todo; /* number of bytes still on the disk */
struct PACKFILE *parent; /* nested, parent file */
struct LZSS_PACK_DATA *pack_data; /* for LZSS compression */
struct LZSS_UNPACK_DATA *unpack_data; /* for LZSS decompression */
char *filename; /* name of the file */
char *passdata; /* encryption key data */
char *passpos; /* current key position */
unsigned char buf[F_BUF_SIZE]; /* the actual data buffer */
};
struct PACKFILE /* our very own FILE structure... */
{
AL_CONST PACKFILE_VTABLE *vtable;
void *userdata;
int is_normal_packfile;
/* The following is only to be used for the "normal" PACKFILE vtable,
* i.e. what is implemented by Allegro itself. If is_normal_packfile is
* false then the following is not even allocated. This must be the last
* member in the structure.
*/
struct _al_normal_packfile_details normal;
};
struct PACKFILE_VTABLE
{
AL_METHOD(int, pf_fclose, (void *userdata));
AL_METHOD(int, pf_getc, (void *userdata));
AL_METHOD(int, pf_ungetc, (int c, void *userdata));
AL_METHOD(long, pf_fread, (void *p, long n, void *userdata));
AL_METHOD(int, pf_putc, (int c, void *userdata));
AL_METHOD(long, pf_fwrite, (AL_CONST void *p, long n, void *userdata));
AL_METHOD(int, pf_fseek, (void *userdata, int offset));
AL_METHOD(int, pf_feof, (void *userdata));
AL_METHOD(int, pf_ferror, (void *userdata));
};
#define uconvert_tofilename(s, buf) uconvert(s, U_CURRENT, buf, get_filename_encoding(), sizeof(buf))
AL_FUNC(void, set_filename_encoding, (int encoding));
AL_FUNC(int, get_filename_encoding, (void));
AL_FUNC(void, packfile_password, (AL_CONST char *password));
AL_FUNC(PACKFILE *, pack_fopen, (AL_CONST char *filename, AL_CONST char *mode));
AL_FUNC(PACKFILE *, pack_fopen_vtable, (AL_CONST PACKFILE_VTABLE *vtable, void *userdata));
AL_FUNC(int, pack_fclose, (PACKFILE *f));
AL_FUNC(int, pack_fseek, (PACKFILE *f, int offset));
AL_FUNC(PACKFILE *, pack_fopen_chunk, (PACKFILE *f, int pack));
AL_FUNC(PACKFILE *, pack_fclose_chunk, (PACKFILE *f));
AL_FUNC(int, pack_getc, (PACKFILE *f));
AL_FUNC(int, pack_putc, (int c, PACKFILE *f));
AL_FUNC(int, pack_feof, (PACKFILE *f));
AL_FUNC(int, pack_ferror, (PACKFILE *f));
AL_FUNC(int, pack_igetw, (PACKFILE *f));
AL_FUNC(long, pack_igetl, (PACKFILE *f));
AL_FUNC(int, pack_iputw, (int w, PACKFILE *f));
AL_FUNC(long, pack_iputl, (long l, PACKFILE *f));
AL_FUNC(int, pack_mgetw, (PACKFILE *f));
AL_FUNC(long, pack_mgetl, (PACKFILE *f));
AL_FUNC(int, pack_mputw, (int w, PACKFILE *f));
AL_FUNC(long, pack_mputl, (long l, PACKFILE *f));
AL_FUNC(long, pack_fread, (void *p, long n, PACKFILE *f));
AL_FUNC(long, pack_fwrite, (AL_CONST void *p, long n, PACKFILE *f));
AL_FUNC(int, pack_ungetc, (int c, PACKFILE *f));
AL_FUNC(char *, pack_fgets, (char *p, int max, PACKFILE *f));
AL_FUNC(int, pack_fputs, (AL_CONST char *p, PACKFILE *f));
AL_FUNC(void *, pack_get_userdata, (PACKFILE *f));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_FILE_H */

View File

@ -1,208 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* C++ wrapper for fixed point math type.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FIX_H
#define ALLEGRO_FIX_H
#include "fixed.h"
#include "fmaths.h"
#ifdef __cplusplus
class fix /* C++ wrapper for the fixed point routines */
{
public:
fixed v;
fix() : v(0) {}
fix(const fix &x) : v(x.v) {}
explicit fix(const int x) : v(itofix(x)) {}
explicit fix(const long x) : v(itofix(x)) {}
explicit fix(const unsigned int x) : v(itofix(x)) {}
explicit fix(const unsigned long x) : v(itofix(x)) {}
explicit fix(const float x) : v(ftofix(x)) {}
explicit fix(const double x) : v(ftofix(x)) {}
operator int() const { return fixtoi(v); }
operator long() const { return fixtoi(v); }
operator unsigned int() const { return fixtoi(v); }
operator unsigned long() const { return fixtoi(v); }
operator float() const { return fixtof(v); }
operator double() const { return fixtof(v); }
fix& operator = (const fix &x) { v = x.v; return *this; }
fix& operator = (const int x) { v = itofix(x); return *this; }
fix& operator = (const long x) { v = itofix(x); return *this; }
fix& operator = (const unsigned int x) { v = itofix(x); return *this; }
fix& operator = (const unsigned long x) { v = itofix(x); return *this; }
fix& operator = (const float x) { v = ftofix(x); return *this; }
fix& operator = (const double x) { v = ftofix(x); return *this; }
fix& operator += (const fix x) { v += x.v; return *this; }
fix& operator += (const int x) { v += itofix(x); return *this; }
fix& operator += (const long x) { v += itofix(x); return *this; }
fix& operator += (const float x) { v += ftofix(x); return *this; }
fix& operator += (const double x) { v += ftofix(x); return *this; }
fix& operator -= (const fix x) { v -= x.v; return *this; }
fix& operator -= (const int x) { v -= itofix(x); return *this; }
fix& operator -= (const long x) { v -= itofix(x); return *this; }
fix& operator -= (const float x) { v -= ftofix(x); return *this; }
fix& operator -= (const double x) { v -= ftofix(x); return *this; }
fix& operator *= (const fix x) { v = fixmul(v, x.v); return *this; }
fix& operator *= (const int x) { v *= x; return *this; }
fix& operator *= (const long x) { v *= x; return *this; }
fix& operator *= (const float x) { v = ftofix(fixtof(v) * x); return *this; }
fix& operator *= (const double x) { v = ftofix(fixtof(v) * x); return *this; }
fix& operator /= (const fix x) { v = fixdiv(v, x.v); return *this; }
fix& operator /= (const int x) { v /= x; return *this; }
fix& operator /= (const long x) { v /= x; return *this; }
fix& operator /= (const float x) { v = ftofix(fixtof(v) / x); return *this; }
fix& operator /= (const double x) { v = ftofix(fixtof(v) / x); return *this; }
fix& operator <<= (const int x) { v <<= x; return *this; }
fix& operator >>= (const int x) { v >>= x; return *this; }
fix& operator ++ () { v += itofix(1); return *this; }
fix& operator -- () { v -= itofix(1); return *this; }
fix operator ++ (int) { fix t; t.v = v; v += itofix(1); return t; }
fix operator -- (int) { fix t; t.v = v; v -= itofix(1); return t; }
fix operator - () const { fix t; t.v = -v; return t; }
inline friend fix operator + (const fix x, const fix y);
inline friend fix operator + (const fix x, const int y);
inline friend fix operator + (const int x, const fix y);
inline friend fix operator + (const fix x, const long y);
inline friend fix operator + (const long x, const fix y);
inline friend fix operator + (const fix x, const float y);
inline friend fix operator + (const float x, const fix y);
inline friend fix operator + (const fix x, const double y);
inline friend fix operator + (const double x, const fix y);
inline friend fix operator - (const fix x, const fix y);
inline friend fix operator - (const fix x, const int y);
inline friend fix operator - (const int x, const fix y);
inline friend fix operator - (const fix x, const long y);
inline friend fix operator - (const long x, const fix y);
inline friend fix operator - (const fix x, const float y);
inline friend fix operator - (const float x, const fix y);
inline friend fix operator - (const fix x, const double y);
inline friend fix operator - (const double x, const fix y);
inline friend fix operator * (const fix x, const fix y);
inline friend fix operator * (const fix x, const int y);
inline friend fix operator * (const int x, const fix y);
inline friend fix operator * (const fix x, const long y);
inline friend fix operator * (const long x, const fix y);
inline friend fix operator * (const fix x, const float y);
inline friend fix operator * (const float x, const fix y);
inline friend fix operator * (const fix x, const double y);
inline friend fix operator * (const double x, const fix y);
inline friend fix operator / (const fix x, const fix y);
inline friend fix operator / (const fix x, const int y);
inline friend fix operator / (const int x, const fix y);
inline friend fix operator / (const fix x, const long y);
inline friend fix operator / (const long x, const fix y);
inline friend fix operator / (const fix x, const float y);
inline friend fix operator / (const float x, const fix y);
inline friend fix operator / (const fix x, const double y);
inline friend fix operator / (const double x, const fix y);
inline friend fix operator << (const fix x, const int y);
inline friend fix operator >> (const fix x, const int y);
inline friend int operator == (const fix x, const fix y);
inline friend int operator == (const fix x, const int y);
inline friend int operator == (const int x, const fix y);
inline friend int operator == (const fix x, const long y);
inline friend int operator == (const long x, const fix y);
inline friend int operator == (const fix x, const float y);
inline friend int operator == (const float x, const fix y);
inline friend int operator == (const fix x, const double y);
inline friend int operator == (const double x, const fix y);
inline friend int operator != (const fix x, const fix y);
inline friend int operator != (const fix x, const int y);
inline friend int operator != (const int x, const fix y);
inline friend int operator != (const fix x, const long y);
inline friend int operator != (const long x, const fix y);
inline friend int operator != (const fix x, const float y);
inline friend int operator != (const float x, const fix y);
inline friend int operator != (const fix x, const double y);
inline friend int operator != (const double x, const fix y);
inline friend int operator < (const fix x, const fix y);
inline friend int operator < (const fix x, const int y);
inline friend int operator < (const int x, const fix y);
inline friend int operator < (const fix x, const long y);
inline friend int operator < (const long x, const fix y);
inline friend int operator < (const fix x, const float y);
inline friend int operator < (const float x, const fix y);
inline friend int operator < (const fix x, const double y);
inline friend int operator < (const double x, const fix y);
inline friend int operator > (const fix x, const fix y);
inline friend int operator > (const fix x, const int y);
inline friend int operator > (const int x, const fix y);
inline friend int operator > (const fix x, const long y);
inline friend int operator > (const long x, const fix y);
inline friend int operator > (const fix x, const float y);
inline friend int operator > (const float x, const fix y);
inline friend int operator > (const fix x, const double y);
inline friend int operator > (const double x, const fix y);
inline friend int operator <= (const fix x, const fix y);
inline friend int operator <= (const fix x, const int y);
inline friend int operator <= (const int x, const fix y);
inline friend int operator <= (const fix x, const long y);
inline friend int operator <= (const long x, const fix y);
inline friend int operator <= (const fix x, const float y);
inline friend int operator <= (const float x, const fix y);
inline friend int operator <= (const fix x, const double y);
inline friend int operator <= (const double x, const fix y);
inline friend int operator >= (const fix x, const fix y);
inline friend int operator >= (const fix x, const int y);
inline friend int operator >= (const int x, const fix y);
inline friend int operator >= (const fix x, const long y);
inline friend int operator >= (const long x, const fix y);
inline friend int operator >= (const fix x, const float y);
inline friend int operator >= (const float x, const fix y);
inline friend int operator >= (const fix x, const double y);
inline friend int operator >= (const double x, const fix y);
inline friend fix sqrt(fix x);
inline friend fix cos(fix x);
inline friend fix sin(fix x);
inline friend fix tan(fix x);
inline friend fix acos(fix x);
inline friend fix asin(fix x);
inline friend fix atan(fix x);
inline friend fix atan2(fix x, fix y);
};
#endif /* ifdef __cplusplus */
#include "inline/fix.inl"
#endif /* ifndef ALLEGRO_FIX_H */

View File

@ -1,37 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fixed point type.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FIXED_H
#define ALLEGRO_FIXED_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t fixed;
AL_VAR(AL_CONST fixed, fixtorad_r);
AL_VAR(AL_CONST fixed, radtofix_r);
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_FIXED_H */

View File

@ -1,61 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* FLI/FLC routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FLI_H
#define ALLEGRO_FLI_H
#include "base.h"
#include "palette.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BITMAP;
#define FLI_OK 0 /* FLI player return values */
#define FLI_EOF -1
#define FLI_ERROR -2
#define FLI_NOT_OPEN -3
AL_FUNC(int, play_fli, (AL_CONST char *filename, struct BITMAP *bmp, int loop, AL_METHOD(int, callback, (void))));
AL_FUNC(int, play_memory_fli, (void *fli_data, struct BITMAP *bmp, int loop, AL_METHOD(int, callback, (void))));
AL_FUNC(int, open_fli, (AL_CONST char *filename));
AL_FUNC(int, open_memory_fli, (void *fli_data));
AL_FUNC(void, close_fli, (void));
AL_FUNC(int, next_fli_frame, (int loop));
AL_FUNC(void, reset_fli_variables, (void));
AL_VAR(struct BITMAP *, fli_bitmap); /* current frame of the FLI */
AL_VAR(PALETTE, fli_palette); /* current FLI palette */
AL_VAR(int, fli_bmp_dirty_from); /* what part of fli_bitmap is dirty */
AL_VAR(int, fli_bmp_dirty_to);
AL_VAR(int, fli_pal_dirty_from); /* what part of fli_palette is dirty */
AL_VAR(int, fli_pal_dirty_to);
AL_VAR(int, fli_frame); /* current frame number */
AL_VAR(volatile int, fli_timer); /* for timing FLI playback */
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_FLI_H */

View File

@ -1,44 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fixed point math routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FMATH_H
#define ALLEGRO_FMATH_H
#include "base.h"
#include "fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(fixed, fixsqrt, (fixed x));
AL_FUNC(fixed, fixhypot, (fixed x, fixed y));
AL_FUNC(fixed, fixatan, (fixed x));
AL_FUNC(fixed, fixatan2, (fixed y, fixed x));
AL_ARRAY(fixed, _cos_tbl);
AL_ARRAY(fixed, _tan_tbl);
AL_ARRAY(fixed, _acos_tbl);
#ifdef __cplusplus
}
#endif
#include "inline/fmaths.inl"
#endif /* ifndef ALLEGRO_FMATH_H */

View File

@ -1,74 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Font loading routines.
*
* By Evert Glebbeek.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FONT_H
#define ALLEGRO_FONT_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct FONT_GLYPH /* a single monochrome font character */
{
short w, h;
ZERO_SIZE_ARRAY(unsigned char, dat);
} FONT_GLYPH;
struct FONT_VTABLE;
typedef struct FONT
{
void *data;
int height;
struct FONT_VTABLE *vtable;
} FONT;
AL_FUNC(int, font_has_alpha, (FONT *f));
AL_FUNC(void, make_trans_font, (FONT *f));
AL_FUNC(int, is_trans_font, (FONT *f));
AL_FUNC(int, is_color_font, (FONT *f));
AL_FUNC(int, is_mono_font, (FONT *f));
AL_FUNC(int, is_compatible_font, (FONT *f1, FONT *f2));
AL_FUNC(void, register_font_file_type, (AL_CONST char *ext, FONT *(*load)(AL_CONST char *filename, RGB *pal, void *param)));
AL_FUNC(FONT *, load_font, (AL_CONST char *filename, RGB *pal, void *param));
AL_FUNC(FONT *, load_dat_font, (AL_CONST char *filename, RGB *pal, void *param));
AL_FUNC(FONT *, load_bios_font, (AL_CONST char *filename, RGB *pal, void *param));
AL_FUNC(FONT *, load_grx_font, (AL_CONST char *filename, RGB *pal, void *param));
AL_FUNC(FONT *, load_grx_or_bios_font, (AL_CONST char *filename, RGB *pal, void *param));
AL_FUNC(FONT *, load_bitmap_font, (AL_CONST char *fname, RGB *pal, void *param));
AL_FUNC(FONT *, load_txt_font, (AL_CONST char *fname, RGB *pal, void *param));
AL_FUNC(FONT *, grab_font_from_bitmap, (BITMAP *bmp));
AL_FUNC(int, get_font_ranges, (FONT *f));
AL_FUNC(int, get_font_range_begin, (FONT *f, int range));
AL_FUNC(int, get_font_range_end, (FONT *f, int range));
AL_FUNC(FONT *, extract_font_range, (FONT *f, int begin, int end));
AL_FUNC(FONT *, merge_fonts, (FONT *f1, FONT *f2));
AL_FUNC(int, transpose_font, (FONT *f, int drange));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_FONT_H */

View File

@ -1,466 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Basic graphics support routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_GFX_H
#define ALLEGRO_GFX_H
#include "3d.h"
#include "base.h"
#include "fixed.h"
#ifdef __cplusplus
extern "C" {
#endif
struct RLE_SPRITE;
struct FONT_GLYPH;
struct RGB;
#define GFX_TEXT -1
#define GFX_AUTODETECT 0
#define GFX_AUTODETECT_FULLSCREEN 1
#define GFX_AUTODETECT_WINDOWED 2
#define GFX_SAFE AL_ID('S','A','F','E')
#define GFX_NONE AL_ID('N','O','N','E')
/* drawing modes for draw_sprite_ex() */
#define DRAW_SPRITE_NORMAL 0
#define DRAW_SPRITE_LIT 1
#define DRAW_SPRITE_TRANS 2
/* flipping modes for draw_sprite_ex() */
#define DRAW_SPRITE_NO_FLIP 0x0
#define DRAW_SPRITE_H_FLIP 0x1
#define DRAW_SPRITE_V_FLIP 0x2
#define DRAW_SPRITE_VH_FLIP 0x3
/* Blender mode defines, for the gfx_driver->set_blender_mode() function */
#define blender_mode_none 0
#define blender_mode_trans 1
#define blender_mode_add 2
#define blender_mode_burn 3
#define blender_mode_color 4
#define blender_mode_difference 5
#define blender_mode_dissolve 6
#define blender_mode_dodge 7
#define blender_mode_hue 8
#define blender_mode_invert 9
#define blender_mode_luminance 10
#define blender_mode_multiply 11
#define blender_mode_saturation 12
#define blender_mode_screen 13
#define blender_mode_alpha 14
typedef struct GFX_MODE
{
int width, height, bpp;
} GFX_MODE;
typedef struct GFX_MODE_LIST
{
int num_modes; /* number of gfx modes */
GFX_MODE *mode; /* pointer to the actual mode list array */
} GFX_MODE_LIST;
typedef struct GFX_DRIVER /* creates and manages the screen bitmap */
{
int id;
AL_CONST char *name;
AL_CONST char *desc;
AL_CONST char *ascii_name;
AL_METHOD(struct BITMAP *, init, (int w, int h, int v_w, int v_h, int color_depth));
AL_METHOD(void, exit, (struct BITMAP *b));
AL_METHOD(int, scroll, (int x, int y));
AL_METHOD(void, vsync, (void));
AL_METHOD(void, set_palette, (AL_CONST struct RGB *p, int from, int to, int retracesync));
AL_METHOD(int, request_scroll, (int x, int y));
AL_METHOD(int, poll_scroll, (void));
AL_METHOD(void, enable_triple_buffer, (void));
AL_METHOD(struct BITMAP *, create_video_bitmap, (int width, int height));
AL_METHOD(void, destroy_video_bitmap, (struct BITMAP *bitmap));
AL_METHOD(int, show_video_bitmap, (struct BITMAP *bitmap));
AL_METHOD(int, request_video_bitmap, (struct BITMAP *bitmap));
AL_METHOD(struct BITMAP *, create_system_bitmap, (int width, int height));
AL_METHOD(void, destroy_system_bitmap, (struct BITMAP *bitmap));
AL_METHOD(int, set_mouse_sprite, (struct BITMAP *sprite, int xfocus, int yfocus));
AL_METHOD(int, show_mouse, (struct BITMAP *bmp, int x, int y));
AL_METHOD(void, hide_mouse, (void));
AL_METHOD(void, move_mouse, (int x, int y));
AL_METHOD(void, drawing_mode, (void));
AL_METHOD(void, save_video_state, (void));
AL_METHOD(void, restore_video_state, (void));
AL_METHOD(void, set_blender_mode, (int mode, int r, int g, int b, int a));
AL_METHOD(GFX_MODE_LIST *, fetch_mode_list, (void));
AL_METHOD(struct BITMAP *, acknowledge_resize, (void));
int w, h; /* physical (not virtual!) screen size */
int linear; /* true if video memory is linear */
long bank_size; /* bank size, in bytes */
long bank_gran; /* bank granularity, in bytes */
long vid_mem; /* video memory size, in bytes */
long vid_phys_base; /* physical address of video memory */
int windowed; /* true if driver runs windowed */
} GFX_DRIVER;
AL_VAR(GFX_DRIVER *, gfx_driver);
AL_ARRAY(_DRIVER_INFO, _gfx_driver_list);
/* macros for constructing the driver list */
#define BEGIN_GFX_DRIVER_LIST \
_DRIVER_INFO _gfx_driver_list[] = \
{
#define END_GFX_DRIVER_LIST \
{ 0, NULL, 0 } \
};
#define GFX_CAN_SCROLL 0x00000001
#define GFX_CAN_TRIPLE_BUFFER 0x00000002
#define GFX_HW_CURSOR 0x00000004
#define GFX_HW_HLINE 0x00000008
#define GFX_HW_HLINE_XOR 0x00000010
#define GFX_HW_HLINE_SOLID_PATTERN 0x00000020
#define GFX_HW_HLINE_COPY_PATTERN 0x00000040
#define GFX_HW_FILL 0x00000080
#define GFX_HW_FILL_XOR 0x00000100
#define GFX_HW_FILL_SOLID_PATTERN 0x00000200
#define GFX_HW_FILL_COPY_PATTERN 0x00000400
#define GFX_HW_LINE 0x00000800
#define GFX_HW_LINE_XOR 0x00001000
#define GFX_HW_TRIANGLE 0x00002000
#define GFX_HW_TRIANGLE_XOR 0x00004000
#define GFX_HW_GLYPH 0x00008000
#define GFX_HW_VRAM_BLIT 0x00010000
#define GFX_HW_VRAM_BLIT_MASKED 0x00020000
#define GFX_HW_MEM_BLIT 0x00040000
#define GFX_HW_MEM_BLIT_MASKED 0x00080000
#define GFX_HW_SYS_TO_VRAM_BLIT 0x00100000
#define GFX_HW_SYS_TO_VRAM_BLIT_MASKED 0x00200000
#define GFX_SYSTEM_CURSOR 0x00400000
#define GFX_HW_VRAM_STRETCH_BLIT 0x00800000
#define GFX_HW_VRAM_STRETCH_BLIT_MASKED 0x01000000
#define GFX_HW_SYS_STRETCH_BLIT 0x02000000
#define GFX_HW_SYS_STRETCH_BLIT_MASKED 0x04000000
AL_VAR(int, gfx_capabilities); /* current driver capabilities */
typedef struct GFX_VTABLE /* functions for drawing onto bitmaps */
{
int color_depth;
int mask_color;
void *unwrite_bank; /* C function on some machines, asm on i386 */
AL_METHOD(void, set_clip, (struct BITMAP *bmp));
AL_METHOD(void, acquire, (struct BITMAP *bmp));
AL_METHOD(void, release, (struct BITMAP *bmp));
AL_METHOD(struct BITMAP *, create_sub_bitmap, (struct BITMAP *parent, int x, int y, int width, int height));
AL_METHOD(void, created_sub_bitmap, (struct BITMAP *bmp, struct BITMAP *parent));
AL_METHOD(int, getpixel, (struct BITMAP *bmp, int x, int y));
AL_METHOD(void, putpixel, (struct BITMAP *bmp, int x, int y, int color));
AL_METHOD(void, vline, (struct BITMAP *bmp, int x, int y_1, int y2, int color));
AL_METHOD(void, hline, (struct BITMAP *bmp, int x1, int y, int x2, int color));
AL_METHOD(void, hfill, (struct BITMAP *bmp, int x1, int y, int x2, int color));
AL_METHOD(void, line, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
AL_METHOD(void, fastline, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
AL_METHOD(void, rectfill, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
AL_METHOD(void, triangle, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int x3, int y3, int color));
AL_METHOD(void, draw_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_256_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_sprite_v_flip, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_sprite_h_flip, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_sprite_vh_flip, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_trans_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_trans_rgba_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y));
AL_METHOD(void, draw_lit_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color));
AL_METHOD(void, draw_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
AL_METHOD(void, draw_trans_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
AL_METHOD(void, draw_trans_rgba_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
AL_METHOD(void, draw_lit_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
AL_METHOD(void, draw_character, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color, int bg));
AL_METHOD(void, draw_glyph, (struct BITMAP *bmp, AL_CONST struct FONT_GLYPH *glyph, int x, int y, int color, int bg));
AL_METHOD(void, blit_from_memory, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_to_memory, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_from_system, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_to_system, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_to_self, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_to_self_forward, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_to_self_backward, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_between_formats, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, masked_blit, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, clear_to_color, (struct BITMAP *bitmap, int color));
AL_METHOD(void, pivot_scaled_sprite_flip, (struct BITMAP *bmp, struct BITMAP *sprite, fixed x, fixed y, fixed cx, fixed cy, fixed angle, fixed scale, int v_flip));
AL_METHOD(void, do_stretch_blit, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int dest_width, int dest_height, int masked));
AL_METHOD(void, draw_gouraud_sprite, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4));
AL_METHOD(void, draw_sprite_end, (void));
AL_METHOD(void, blit_end, (void));
AL_METHOD(void, polygon, (struct BITMAP *bmp, int vertices, AL_CONST int *points, int color));
AL_METHOD(void, rect, (struct BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
AL_METHOD(void, circle, (struct BITMAP *bmp, int x, int y, int radius, int color));
AL_METHOD(void, circlefill, (struct BITMAP *bmp, int x, int y, int radius, int color));
AL_METHOD(void, ellipse, (struct BITMAP *bmp, int x, int y, int rx, int ry, int color));
AL_METHOD(void, ellipsefill, (struct BITMAP *bmp, int x, int y, int rx, int ry, int color));
AL_METHOD(void, arc, (struct BITMAP *bmp, int x, int y, fixed ang1, fixed ang2, int r, int color));
AL_METHOD(void, spline, (struct BITMAP *bmp, AL_CONST int points[8], int color));
AL_METHOD(void, floodfill, (struct BITMAP *bmp, int x, int y, int color));
AL_METHOD(void, polygon3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D *vtx[]));
AL_METHOD(void, polygon3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D_f *vtx[]));
AL_METHOD(void, triangle3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3));
AL_METHOD(void, triangle3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3));
AL_METHOD(void, quad3d, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4));
AL_METHOD(void, quad3d_f, (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3, V3D_f *v4));
AL_METHOD(void, draw_sprite_ex, (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int mode, int flip ));
} GFX_VTABLE;
AL_VAR(GFX_VTABLE, __linear_vtable8);
AL_VAR(GFX_VTABLE, __linear_vtable15);
AL_VAR(GFX_VTABLE, __linear_vtable16);
AL_VAR(GFX_VTABLE, __linear_vtable24);
AL_VAR(GFX_VTABLE, __linear_vtable32);
typedef struct _VTABLE_INFO
{
int color_depth;
GFX_VTABLE *vtable;
} _VTABLE_INFO;
AL_ARRAY(_VTABLE_INFO, _vtable_list);
/* macros for constructing the vtable list */
#define BEGIN_COLOR_DEPTH_LIST \
_VTABLE_INFO _vtable_list[] = \
{
#define END_COLOR_DEPTH_LIST \
{ 0, NULL } \
};
#define COLOR_DEPTH_8 \
{ 8, &__linear_vtable8 },
#define COLOR_DEPTH_15 \
{ 15, &__linear_vtable15 },
#define COLOR_DEPTH_16 \
{ 16, &__linear_vtable16 },
#define COLOR_DEPTH_24 \
{ 24, &__linear_vtable24 },
#define COLOR_DEPTH_32 \
{ 32, &__linear_vtable32 },
typedef struct BITMAP /* a bitmap structure */
{
int w, h; /* width and height in pixels */
int clip; /* flag if clipping is turned on */
int cl, cr, ct, cb; /* clip left, right, top and bottom values */
GFX_VTABLE *vtable; /* drawing functions */
void *write_bank; /* C func on some machines, asm on i386 */
void *read_bank; /* C func on some machines, asm on i386 */
void *dat; /* the memory we allocated for the bitmap */
unsigned long id; /* for identifying sub-bitmaps */
void *extra; /* points to a structure with more info */
int x_ofs; /* horizontal offset (for sub-bitmaps) */
int y_ofs; /* vertical offset (for sub-bitmaps) */
int seg; /* bitmap segment */
ZERO_SIZE_ARRAY(unsigned char *, line);
} BITMAP;
#define BMP_ID_VIDEO 0x80000000
#define BMP_ID_SYSTEM 0x40000000
#define BMP_ID_SUB 0x20000000
#define BMP_ID_PLANAR 0x10000000
#define BMP_ID_NOBLIT 0x08000000
#define BMP_ID_LOCKED 0x04000000
#define BMP_ID_AUTOLOCK 0x02000000
#define BMP_ID_MASK 0x01FFFFFF
AL_VAR(BITMAP *, screen);
#define SCREEN_W (gfx_driver ? gfx_driver->w : 0)
#define SCREEN_H (gfx_driver ? gfx_driver->h : 0)
#define VIRTUAL_W (screen ? screen->w : 0)
#define VIRTUAL_H (screen ? screen->h : 0)
#define COLORCONV_NONE 0
#define COLORCONV_8_TO_15 1
#define COLORCONV_8_TO_16 2
#define COLORCONV_8_TO_24 4
#define COLORCONV_8_TO_32 8
#define COLORCONV_15_TO_8 0x10
#define COLORCONV_15_TO_16 0x20
#define COLORCONV_15_TO_24 0x40
#define COLORCONV_15_TO_32 0x80
#define COLORCONV_16_TO_8 0x100
#define COLORCONV_16_TO_15 0x200
#define COLORCONV_16_TO_24 0x400
#define COLORCONV_16_TO_32 0x800
#define COLORCONV_24_TO_8 0x1000
#define COLORCONV_24_TO_15 0x2000
#define COLORCONV_24_TO_16 0x4000
#define COLORCONV_24_TO_32 0x8000
#define COLORCONV_32_TO_8 0x10000
#define COLORCONV_32_TO_15 0x20000
#define COLORCONV_32_TO_16 0x40000
#define COLORCONV_32_TO_24 0x80000
#define COLORCONV_32A_TO_8 0x100000
#define COLORCONV_32A_TO_15 0x200000
#define COLORCONV_32A_TO_16 0x400000
#define COLORCONV_32A_TO_24 0x800000
#define COLORCONV_DITHER_PAL 0x1000000
#define COLORCONV_DITHER_HI 0x2000000
#define COLORCONV_KEEP_TRANS 0x4000000
#define COLORCONV_DITHER (COLORCONV_DITHER_PAL | \
COLORCONV_DITHER_HI)
#define COLORCONV_EXPAND_256 (COLORCONV_8_TO_15 | \
COLORCONV_8_TO_16 | \
COLORCONV_8_TO_24 | \
COLORCONV_8_TO_32)
#define COLORCONV_REDUCE_TO_256 (COLORCONV_15_TO_8 | \
COLORCONV_16_TO_8 | \
COLORCONV_24_TO_8 | \
COLORCONV_32_TO_8 | \
COLORCONV_32A_TO_8)
#define COLORCONV_EXPAND_15_TO_16 COLORCONV_15_TO_16
#define COLORCONV_REDUCE_16_TO_15 COLORCONV_16_TO_15
#define COLORCONV_EXPAND_HI_TO_TRUE (COLORCONV_15_TO_24 | \
COLORCONV_15_TO_32 | \
COLORCONV_16_TO_24 | \
COLORCONV_16_TO_32)
#define COLORCONV_REDUCE_TRUE_TO_HI (COLORCONV_24_TO_15 | \
COLORCONV_24_TO_16 | \
COLORCONV_32_TO_15 | \
COLORCONV_32_TO_16)
#define COLORCONV_24_EQUALS_32 (COLORCONV_24_TO_32 | \
COLORCONV_32_TO_24)
#define COLORCONV_TOTAL (COLORCONV_EXPAND_256 | \
COLORCONV_REDUCE_TO_256 | \
COLORCONV_EXPAND_15_TO_16 | \
COLORCONV_REDUCE_16_TO_15 | \
COLORCONV_EXPAND_HI_TO_TRUE | \
COLORCONV_REDUCE_TRUE_TO_HI | \
COLORCONV_24_EQUALS_32 | \
COLORCONV_32A_TO_15 | \
COLORCONV_32A_TO_16 | \
COLORCONV_32A_TO_24)
#define COLORCONV_PARTIAL (COLORCONV_EXPAND_15_TO_16 | \
COLORCONV_REDUCE_16_TO_15 | \
COLORCONV_24_EQUALS_32)
#define COLORCONV_MOST (COLORCONV_EXPAND_15_TO_16 | \
COLORCONV_REDUCE_16_TO_15 | \
COLORCONV_EXPAND_HI_TO_TRUE | \
COLORCONV_REDUCE_TRUE_TO_HI | \
COLORCONV_24_EQUALS_32)
#define COLORCONV_KEEP_ALPHA (COLORCONV_TOTAL \
& ~(COLORCONV_32A_TO_8 | \
COLORCONV_32A_TO_15 | \
COLORCONV_32A_TO_16 | \
COLORCONV_32A_TO_24))
AL_FUNC(GFX_MODE_LIST *, get_gfx_mode_list, (int card));
AL_FUNC(void, destroy_gfx_mode_list, (GFX_MODE_LIST *gfx_mode_list));
AL_FUNC(void, set_color_depth, (int depth));
AL_FUNC(int, get_color_depth, (void));
AL_FUNC(void, set_color_conversion, (int mode));
AL_FUNC(int, get_color_conversion, (void));
AL_FUNC(void, request_refresh_rate, (int rate));
AL_FUNC(int, get_refresh_rate, (void));
AL_FUNC(int, set_gfx_mode, (int card, int w, int h, int v_w, int v_h));
AL_FUNC(int, acknowledge_resize, (void));
AL_FUNC(int, scroll_screen, (int x, int y));
AL_FUNC(int, request_scroll, (int x, int y));
AL_FUNC(int, poll_scroll, (void));
AL_FUNC(int, show_video_bitmap, (BITMAP *bitmap));
AL_FUNC(int, request_video_bitmap, (BITMAP *bitmap));
AL_FUNC(int, enable_triple_buffer, (void));
AL_FUNC(BITMAP *, create_bitmap, (int width, int height));
AL_FUNC(BITMAP *, create_bitmap_ex, (int color_depth, int width, int height));
AL_FUNC(BITMAP *, create_sub_bitmap, (BITMAP *parent, int x, int y, int width, int height));
AL_FUNC(BITMAP *, create_video_bitmap, (int width, int height));
AL_FUNC(BITMAP *, create_system_bitmap, (int width, int height));
AL_FUNC(void, destroy_bitmap, (BITMAP *bitmap));
AL_FUNC(void, set_clip_rect, (BITMAP *bitmap, int x1, int y_1, int x2, int y2));
AL_FUNC(void, add_clip_rect, (BITMAP *bitmap, int x1, int y_1, int x2, int y2));
AL_FUNC(void, clear_bitmap, (BITMAP *bitmap));
AL_FUNC(void, vsync, (void));
/* Bitfield for relaying graphics driver type information */
#define GFX_TYPE_UNKNOWN 0
#define GFX_TYPE_WINDOWED 1
#define GFX_TYPE_FULLSCREEN 2
#define GFX_TYPE_DEFINITE 4
#define GFX_TYPE_MAGIC 8
AL_FUNC(int, get_gfx_mode_type, (int graphics_card));
AL_FUNC(int, get_gfx_mode, (void));
#define SWITCH_NONE 0
#define SWITCH_PAUSE 1
#define SWITCH_AMNESIA 2
#define SWITCH_BACKGROUND 3
#define SWITCH_BACKAMNESIA 4
#define SWITCH_IN 0
#define SWITCH_OUT 1
AL_FUNC(int, set_display_switch_mode, (int mode));
AL_FUNC(int, get_display_switch_mode, (void));
AL_FUNC(int, set_display_switch_callback, (int dir, AL_METHOD(void, cb, (void))));
AL_FUNC(void, remove_display_switch_callback, (AL_METHOD(void, cb, (void))));
AL_FUNC(void, lock_bitmap, (struct BITMAP *bmp));
#ifdef __cplusplus
}
#endif
#include "inline/gfx.inl"
#endif /* ifndef ALLEGRO_GFX_H */

View File

@ -1,32 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Container for all graphics related routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_GRAPHICS_H
#define ALLEGRO_GRAPHICS_H
#include "base.h"
#include "gfx.h"
#include "text.h"
#include "3d.h"
#include "draw.h"
#include "color.h"
#include "palette.h"
#include "rle.h"
#include "compiled.h"
#endif /* ifndef ALLEGRO_GRAPHICS_H */

View File

@ -1,58 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 3D maths inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_3DMATHS_INL
#define ALLEGRO_3DMATHS_INL
#ifdef __cplusplus
extern "C" {
#endif
AL_INLINE(fixed, dot_product, (fixed x1, fixed y_1, fixed z1, fixed x2, fixed y2, fixed z2),
{
return fixmul(x1, x2) + fixmul(y_1, y2) + fixmul(z1, z2);
})
AL_INLINE(float, dot_product_f, (float x1, float y_1, float z1, float x2, float y2, float z2),
{
return (x1 * x2) + (y_1 * y2) + (z1 * z2);
})
AL_INLINE(void, persp_project, (fixed x, fixed y, fixed z, fixed *xout, fixed *yout),
{
*xout = fixmul(fixdiv(x, z), _persp_xscale) + _persp_xoffset;
*yout = fixmul(fixdiv(y, z), _persp_yscale) + _persp_yoffset;
})
AL_INLINE(void, persp_project_f, (float x, float y, float z, float *xout, float *yout),
{
float z1 = 1.0f / z;
*xout = ((x * z1) * _persp_xscale_f) + _persp_xoffset_f;
*yout = ((y * z1) * _persp_yscale_f) + _persp_yoffset_f;
})
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_3DMATHS_INL */

View File

@ -1,37 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Imports asm definitions of various inline functions.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ALLEGRO_NO_ASM
/* asm not supported */
#define ALLEGRO_NO_ASM
#endif
/* Define ALLEGRO_USE_C for backwards compatibility. It should not be used
* anywhere else in the sources for now.
*/
#define ALLEGRO_USE_C
#ifdef __cplusplus
}
#endif

View File

@ -1,177 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Color inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_COLOR_INL
#define ALLEGRO_COLOR_INL
#ifdef __cplusplus
extern "C" {
#endif
AL_INLINE(int, makecol15, (int r, int g, int b),
{
return (((r >> 3) << _rgb_r_shift_15) |
((g >> 3) << _rgb_g_shift_15) |
((b >> 3) << _rgb_b_shift_15));
})
AL_INLINE(int, makecol16, (int r, int g, int b),
{
return (((r >> 3) << _rgb_r_shift_16) |
((g >> 2) << _rgb_g_shift_16) |
((b >> 3) << _rgb_b_shift_16));
})
AL_INLINE(int, makecol24, (int r, int g, int b),
{
return ((r << _rgb_r_shift_24) |
(g << _rgb_g_shift_24) |
(b << _rgb_b_shift_24));
})
AL_INLINE(int, makecol32, (int r, int g, int b),
{
return ((r << _rgb_r_shift_32) |
(g << _rgb_g_shift_32) |
(b << _rgb_b_shift_32));
})
AL_INLINE(int, makeacol32, (int r, int g, int b, int a),
{
return ((r << _rgb_r_shift_32) |
(g << _rgb_g_shift_32) |
(b << _rgb_b_shift_32) |
(a << _rgb_a_shift_32));
})
AL_INLINE(int, getr8, (int c),
{
return _rgb_scale_6[(int)_current_palette[c].r];
})
AL_INLINE(int, getg8, (int c),
{
return _rgb_scale_6[(int)_current_palette[c].g];
})
AL_INLINE(int, getb8, (int c),
{
return _rgb_scale_6[(int)_current_palette[c].b];
})
AL_INLINE(int, getr15, (int c),
{
return _rgb_scale_5[(c >> _rgb_r_shift_15) & 0x1F];
})
AL_INLINE(int, getg15, (int c),
{
return _rgb_scale_5[(c >> _rgb_g_shift_15) & 0x1F];
})
AL_INLINE(int, getb15, (int c),
{
return _rgb_scale_5[(c >> _rgb_b_shift_15) & 0x1F];
})
AL_INLINE(int, getr16, (int c),
{
return _rgb_scale_5[(c >> _rgb_r_shift_16) & 0x1F];
})
AL_INLINE(int, getg16, (int c),
{
return _rgb_scale_6[(c >> _rgb_g_shift_16) & 0x3F];
})
AL_INLINE(int, getb16, (int c),
{
return _rgb_scale_5[(c >> _rgb_b_shift_16) & 0x1F];
})
AL_INLINE(int, getr24, (int c),
{
return ((c >> _rgb_r_shift_24) & 0xFF);
})
AL_INLINE(int, getg24, (int c),
{
return ((c >> _rgb_g_shift_24) & 0xFF);
})
AL_INLINE(int, getb24, (int c),
{
return ((c >> _rgb_b_shift_24) & 0xFF);
})
AL_INLINE(int, getr32, (int c),
{
return ((c >> _rgb_r_shift_32) & 0xFF);
})
AL_INLINE(int, getg32, (int c),
{
return ((c >> _rgb_g_shift_32) & 0xFF);
})
AL_INLINE(int, getb32, (int c),
{
return ((c >> _rgb_b_shift_32) & 0xFF);
})
AL_INLINE(int, geta32, (int c),
{
return ((c >> _rgb_a_shift_32) & 0xFF);
})
#ifndef ALLEGRO_DOS
AL_INLINE(void, _set_color, (int idx, AL_CONST RGB *p),
{
set_color(idx, p);
})
#endif
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_COLOR_INL */

View File

@ -1,557 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Draw inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_DRAW_INL
#define ALLEGRO_DRAW_INL
#include "allegro/debug.h"
#include "allegro/3d.h"
#include "gfx.inl"
#ifdef __cplusplus
extern "C" {
#endif
AL_INLINE(int, getpixel, (BITMAP *bmp, int x, int y),
{
ASSERT(bmp);
return bmp->vtable->getpixel(bmp, x, y);
})
AL_INLINE(void, putpixel, (BITMAP *bmp, int x, int y, int color),
{
ASSERT(bmp);
bmp->vtable->putpixel(bmp, x, y, color);
})
AL_INLINE(void, _allegro_vline, (BITMAP *bmp, int x, int y_1, int y2, int color),
{
ASSERT(bmp);
bmp->vtable->vline(bmp, x, y_1, y2, color);
})
AL_INLINE(void, _allegro_hline, (BITMAP *bmp, int x1, int y, int x2, int color),
{
ASSERT(bmp);
bmp->vtable->hline(bmp, x1, y, x2, color);
})
/* The curses API also contains functions called vline and hline so we have
* called our functions _allegro_vline and _allegro_hline. User programs
* should use the vline/hline aliases as they are the official names.
*/
#ifndef ALLEGRO_NO_VHLINE_ALIAS
AL_ALIAS_VOID_RET(vline(BITMAP *bmp, int x, int y_1, int y2, int color), _allegro_vline(bmp, x, y_1, y2, color))
AL_ALIAS_VOID_RET(hline(BITMAP *bmp, int x1, int y, int x2, int color), _allegro_hline(bmp, x1, y, x2, color))
#endif
AL_INLINE(void, line, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color),
{
ASSERT(bmp);
bmp->vtable->line(bmp, x1, y_1, x2, y2, color);
})
AL_INLINE(void, fastline, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color),
{
ASSERT(bmp);
bmp->vtable->fastline(bmp, x1, y_1, x2, y2, color);
})
AL_INLINE(void, rectfill, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color),
{
ASSERT(bmp);
bmp->vtable->rectfill(bmp, x1, y_1, x2, y2, color);
})
AL_INLINE(void, triangle, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int x3, int y3, int color),
{
ASSERT(bmp);
bmp->vtable->triangle(bmp, x1, y_1, x2, y2, x3, y3, color);
})
AL_INLINE(void, polygon, (BITMAP *bmp, int vertices, AL_CONST int *points, int color),
{
ASSERT(bmp);
bmp->vtable->polygon(bmp, vertices, points, color);
})
AL_INLINE(void, rect, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color),
{
ASSERT(bmp);
bmp->vtable->rect(bmp, x1, y_1, x2, y2, color);
})
AL_INLINE(void, circle, (BITMAP *bmp, int x, int y, int radius, int color),
{
ASSERT(bmp);
bmp->vtable->circle(bmp, x, y, radius, color);
})
AL_INLINE(void, circlefill, (BITMAP *bmp, int x, int y, int radius, int color),
{
ASSERT(bmp);
bmp->vtable->circlefill(bmp, x, y, radius, color);
})
AL_INLINE(void, ellipse, (BITMAP *bmp, int x, int y, int rx, int ry, int color),
{
ASSERT(bmp);
bmp->vtable->ellipse(bmp, x, y, rx, ry, color);
})
AL_INLINE(void, ellipsefill, (BITMAP *bmp, int x, int y, int rx, int ry, int color),
{
ASSERT(bmp);
bmp->vtable->ellipsefill(bmp, x, y, rx, ry, color);
})
AL_INLINE(void, arc, (BITMAP *bmp, int x, int y, fixed ang1, fixed ang2, int r, int color),
{
ASSERT(bmp);
bmp->vtable->arc(bmp, x, y, ang1, ang2, r, color);
})
AL_INLINE(void, spline, (BITMAP *bmp, AL_CONST int points[8], int color),
{
ASSERT(bmp);
bmp->vtable->spline(bmp, points, color);
})
AL_INLINE(void, floodfill, (BITMAP *bmp, int x, int y, int color),
{
ASSERT(bmp);
bmp->vtable->floodfill(bmp, x, y, color);
})
AL_INLINE(void, polygon3d, (BITMAP *bmp, int type, BITMAP *texture, int vc, V3D *vtx[]),
{
ASSERT(bmp);
bmp->vtable->polygon3d(bmp, type, texture, vc, vtx);
})
AL_INLINE(void, polygon3d_f, (BITMAP *bmp, int type, BITMAP *texture, int vc, V3D_f *vtx[]),
{
ASSERT(bmp);
bmp->vtable->polygon3d_f(bmp, type, texture, vc, vtx);
})
AL_INLINE(void, triangle3d, (BITMAP *bmp, int type, BITMAP *texture, V3D *v1, V3D *v2, V3D *v3),
{
ASSERT(bmp);
bmp->vtable->triangle3d(bmp, type, texture, v1, v2, v3);
})
AL_INLINE(void, triangle3d_f, (BITMAP *bmp, int type, BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3),
{
ASSERT(bmp);
bmp->vtable->triangle3d_f(bmp, type, texture, v1, v2, v3);
})
AL_INLINE(void, quad3d, (BITMAP *bmp, int type, BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4),
{
ASSERT(bmp);
bmp->vtable->quad3d(bmp, type, texture, v1, v2, v3, v4);
})
AL_INLINE(void, quad3d_f, (BITMAP *bmp, int type, BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3, V3D_f *v4),
{
ASSERT(bmp);
bmp->vtable->quad3d_f(bmp, type, texture, v1, v2, v3, v4);
})
AL_INLINE(void, draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
{
ASSERT(bmp);
ASSERT(sprite);
if (sprite->vtable->color_depth == 8) {
bmp->vtable->draw_256_sprite(bmp, sprite, x, y);
}
else {
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_sprite(bmp, sprite, x, y);
}
})
AL_INLINE(void, draw_sprite_ex, (BITMAP *bmp, BITMAP *sprite, int x, int y,
int mode, int flip),
{
ASSERT(bmp);
ASSERT(sprite);
if (mode == DRAW_SPRITE_TRANS) {
ASSERT((bmp->vtable->color_depth == sprite->vtable->color_depth) ||
(sprite->vtable->color_depth == 32) ||
((sprite->vtable->color_depth == 8) &&
(bmp->vtable->color_depth == 32)));
bmp->vtable->draw_sprite_ex(bmp, sprite, x, y, mode, flip);
}
else {
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_sprite_ex(bmp, sprite, x, y, mode, flip);
}
})
AL_INLINE(void, draw_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y),{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_sprite_v_flip(bmp, sprite, x, y);
})
AL_INLINE(void, draw_sprite_h_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y),{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_sprite_h_flip(bmp, sprite, x, y);
})
AL_INLINE(void, draw_sprite_vh_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y),
{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_sprite_vh_flip(bmp, sprite, x, y);
})
AL_INLINE(void, draw_trans_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
{
ASSERT(bmp);
ASSERT(sprite);
if (sprite->vtable->color_depth == 32) {
ASSERT(bmp->vtable->draw_trans_rgba_sprite);
bmp->vtable->draw_trans_rgba_sprite(bmp, sprite, x, y);
}
else {
ASSERT((bmp->vtable->color_depth == sprite->vtable->color_depth) ||
((bmp->vtable->color_depth == 32) &&
(sprite->vtable->color_depth == 8)));
bmp->vtable->draw_trans_sprite(bmp, sprite, x, y);
}
})
AL_INLINE(void, draw_lit_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color),
{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_lit_sprite(bmp, sprite, x, y, color);
})
AL_INLINE(void, draw_gouraud_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, int c1, int c2, int c3, int c4),
{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
bmp->vtable->draw_gouraud_sprite(bmp, sprite, x, y, c1, c2, c3, c4);
})
AL_INLINE(void, draw_character_ex, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int bg),
{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(sprite->vtable->color_depth == 8);
bmp->vtable->draw_character(bmp, sprite, x, y, color, bg);
})
AL_INLINE(void, rotate_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, (x<<16) + (sprite->w * 0x10000) / 2,
(y<<16) + (sprite->h * 0x10000) / 2,
sprite->w << 15, sprite->h << 15,
angle, 0x10000, FALSE);
})
AL_INLINE(void, rotate_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, (x<<16) + (sprite->w * 0x10000) / 2,
(y<<16) + (sprite->h * 0x10000) / 2,
sprite->w << 15, sprite->h << 15,
angle, 0x10000, TRUE);
})
AL_INLINE(void, rotate_scaled_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, (x<<16) + (sprite->w * scale) / 2,
(y<<16) + (sprite->h * scale) / 2,
sprite->w << 15, sprite->h << 15,
angle, scale, FALSE);
})
AL_INLINE(void, rotate_scaled_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle, fixed scale),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, (x<<16) + (sprite->w * scale) / 2,
(y<<16) + (sprite->h * scale) / 2,
sprite->w << 15, sprite->h << 15,
angle, scale, TRUE);
})
AL_INLINE(void, pivot_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, x<<16, y<<16, cx<<16, cy<<16, angle, 0x10000, FALSE);
})
AL_INLINE(void, pivot_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, x<<16, y<<16, cx<<16, cy<<16, angle, 0x10000, TRUE);
})
AL_INLINE(void, pivot_scaled_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, x<<16, y<<16, cx<<16, cy<<16, angle, scale, FALSE);
})
AL_INLINE(void, pivot_scaled_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle, fixed scale),
{
ASSERT(bmp);
ASSERT(sprite);
bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, x<<16, y<<16, cx<<16, cy<<16, angle, scale, TRUE);
})
AL_INLINE(void, _putpixel, (BITMAP *bmp, int x, int y, int color),
{
uintptr_t addr;
bmp_select(bmp);
addr = bmp_write_line(bmp, y);
bmp_write8(addr+x, color);
bmp_unwrite_line(bmp);
})
AL_INLINE(int, _getpixel, (BITMAP *bmp, int x, int y),
{
uintptr_t addr;
int c;
bmp_select(bmp);
addr = bmp_read_line(bmp, y);
c = bmp_read8(addr+x);
bmp_unwrite_line(bmp);
return c;
})
AL_INLINE(void, _putpixel15, (BITMAP *bmp, int x, int y, int color),
{
uintptr_t addr;
bmp_select(bmp);
addr = bmp_write_line(bmp, y);
bmp_write15(addr+x*sizeof(short), color);
bmp_unwrite_line(bmp);
})
AL_INLINE(int, _getpixel15, (BITMAP *bmp, int x, int y),
{
uintptr_t addr;
int c;
bmp_select(bmp);
addr = bmp_read_line(bmp, y);
c = bmp_read15(addr+x*sizeof(short));
bmp_unwrite_line(bmp);
return c;
})
AL_INLINE(void, _putpixel16, (BITMAP *bmp, int x, int y, int color),
{
uintptr_t addr;
bmp_select(bmp);
addr = bmp_write_line(bmp, y);
bmp_write16(addr+x*sizeof(short), color);
bmp_unwrite_line(bmp);
})
AL_INLINE(int, _getpixel16, (BITMAP *bmp, int x, int y),
{
uintptr_t addr;
int c;
bmp_select(bmp);
addr = bmp_read_line(bmp, y);
c = bmp_read16(addr+x*sizeof(short));
bmp_unwrite_line(bmp);
return c;
})
AL_INLINE(void, _putpixel24, (BITMAP *bmp, int x, int y, int color),
{
uintptr_t addr;
bmp_select(bmp);
addr = bmp_write_line(bmp, y);
bmp_write24(addr+x*3, color);
bmp_unwrite_line(bmp);
})
AL_INLINE(int, _getpixel24, (BITMAP *bmp, int x, int y),
{
uintptr_t addr;
int c;
bmp_select(bmp);
addr = bmp_read_line(bmp, y);
c = bmp_read24(addr+x*3);
bmp_unwrite_line(bmp);
return c;
})
AL_INLINE(void, _putpixel32, (BITMAP *bmp, int x, int y, int color),
{
uintptr_t addr;
bmp_select(bmp);
addr = bmp_write_line(bmp, y);
bmp_write32(addr+x*sizeof(int32_t), color);
bmp_unwrite_line(bmp);
})
AL_INLINE(int, _getpixel32, (BITMAP *bmp, int x, int y),
{
uintptr_t addr;
int c;
bmp_select(bmp);
addr = bmp_read_line(bmp, y);
c = bmp_read32(addr+x*sizeof(int32_t));
bmp_unwrite_line(bmp);
return c;
})
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_DRAW_INL */

View File

@ -1,252 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fix class inline functions.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FIX_INL
#define ALLEGRO_FIX_INL
#ifdef __cplusplus
inline fix operator + (const fix x, const fix y) { fix t; t.v = x.v + y.v; return t; }
inline fix operator + (const fix x, const int y) { fix t; t.v = x.v + itofix(y); return t; }
inline fix operator + (const int x, const fix y) { fix t; t.v = itofix(x) + y.v; return t; }
inline fix operator + (const fix x, const long y) { fix t; t.v = x.v + itofix(y); return t; }
inline fix operator + (const long x, const fix y) { fix t; t.v = itofix(x) + y.v; return t; }
inline fix operator + (const fix x, const float y) { fix t; t.v = x.v + ftofix(y); return t; }
inline fix operator + (const float x, const fix y) { fix t; t.v = ftofix(x) + y.v; return t; }
inline fix operator + (const fix x, const double y) { fix t; t.v = x.v + ftofix(y); return t; }
inline fix operator + (const double x, const fix y) { fix t; t.v = ftofix(x) + y.v; return t; }
inline fix operator - (const fix x, const fix y) { fix t; t.v = x.v - y.v; return t; }
inline fix operator - (const fix x, const int y) { fix t; t.v = x.v - itofix(y); return t; }
inline fix operator - (const int x, const fix y) { fix t; t.v = itofix(x) - y.v; return t; }
inline fix operator - (const fix x, const long y) { fix t; t.v = x.v - itofix(y); return t; }
inline fix operator - (const long x, const fix y) { fix t; t.v = itofix(x) - y.v; return t; }
inline fix operator - (const fix x, const float y) { fix t; t.v = x.v - ftofix(y); return t; }
inline fix operator - (const float x, const fix y) { fix t; t.v = ftofix(x) - y.v; return t; }
inline fix operator - (const fix x, const double y) { fix t; t.v = x.v - ftofix(y); return t; }
inline fix operator - (const double x, const fix y) { fix t; t.v = ftofix(x) - y.v; return t; }
inline fix operator * (const fix x, const fix y) { fix t; t.v = fixmul(x.v, y.v); return t; }
inline fix operator * (const fix x, const int y) { fix t; t.v = x.v * y; return t; }
inline fix operator * (const int x, const fix y) { fix t; t.v = x * y.v; return t; }
inline fix operator * (const fix x, const long y) { fix t; t.v = x.v * y; return t; }
inline fix operator * (const long x, const fix y) { fix t; t.v = x * y.v; return t; }
inline fix operator * (const fix x, const float y) { fix t; t.v = ftofix(fixtof(x.v) * y); return t; }
inline fix operator * (const float x, const fix y) { fix t; t.v = ftofix(x * fixtof(y.v)); return t; }
inline fix operator * (const fix x, const double y) { fix t; t.v = ftofix(fixtof(x.v) * y); return t; }
inline fix operator * (const double x, const fix y) { fix t; t.v = ftofix(x * fixtof(y.v)); return t; }
inline fix operator / (const fix x, const fix y) { fix t; t.v = fixdiv(x.v, y.v); return t; }
inline fix operator / (const fix x, const int y) { fix t; t.v = x.v / y; return t; }
inline fix operator / (const int x, const fix y) { fix t; t.v = fixdiv(itofix(x), y.v); return t; }
inline fix operator / (const fix x, const long y) { fix t; t.v = x.v / y; return t; }
inline fix operator / (const long x, const fix y) { fix t; t.v = fixdiv(itofix(x), y.v); return t; }
inline fix operator / (const fix x, const float y) { fix t; t.v = ftofix(fixtof(x.v) / y); return t; }
inline fix operator / (const float x, const fix y) { fix t; t.v = ftofix(x / fixtof(y.v)); return t; }
inline fix operator / (const fix x, const double y) { fix t; t.v = ftofix(fixtof(x.v) / y); return t; }
inline fix operator / (const double x, const fix y) { fix t; t.v = ftofix(x / fixtof(y.v)); return t; }
inline fix operator << (const fix x, const int y) { fix t; t.v = x.v << y; return t; }
inline fix operator >> (const fix x, const int y) { fix t; t.v = x.v >> y; return t; }
inline int operator == (const fix x, const fix y) { return (x.v == y.v); }
inline int operator == (const fix x, const int y) { return (x.v == itofix(y)); }
inline int operator == (const int x, const fix y) { return (itofix(x) == y.v); }
inline int operator == (const fix x, const long y) { return (x.v == itofix(y)); }
inline int operator == (const long x, const fix y) { return (itofix(x) == y.v); }
inline int operator == (const fix x, const float y) { return (x.v == ftofix(y)); }
inline int operator == (const float x, const fix y) { return (ftofix(x) == y.v); }
inline int operator == (const fix x, const double y) { return (x.v == ftofix(y)); }
inline int operator == (const double x, const fix y) { return (ftofix(x) == y.v); }
inline int operator != (const fix x, const fix y) { return (x.v != y.v); }
inline int operator != (const fix x, const int y) { return (x.v != itofix(y)); }
inline int operator != (const int x, const fix y) { return (itofix(x) != y.v); }
inline int operator != (const fix x, const long y) { return (x.v != itofix(y)); }
inline int operator != (const long x, const fix y) { return (itofix(x) != y.v); }
inline int operator != (const fix x, const float y) { return (x.v != ftofix(y)); }
inline int operator != (const float x, const fix y) { return (ftofix(x) != y.v); }
inline int operator != (const fix x, const double y) { return (x.v != ftofix(y)); }
inline int operator != (const double x, const fix y) { return (ftofix(x) != y.v); }
inline int operator < (const fix x, const fix y) { return (x.v < y.v); }
inline int operator < (const fix x, const int y) { return (x.v < itofix(y)); }
inline int operator < (const int x, const fix y) { return (itofix(x) < y.v); }
inline int operator < (const fix x, const long y) { return (x.v < itofix(y)); }
inline int operator < (const long x, const fix y) { return (itofix(x) < y.v); }
inline int operator < (const fix x, const float y) { return (x.v < ftofix(y)); }
inline int operator < (const float x, const fix y) { return (ftofix(x) < y.v); }
inline int operator < (const fix x, const double y) { return (x.v < ftofix(y)); }
inline int operator < (const double x, const fix y) { return (ftofix(x) < y.v); }
inline int operator > (const fix x, const fix y) { return (x.v > y.v); }
inline int operator > (const fix x, const int y) { return (x.v > itofix(y)); }
inline int operator > (const int x, const fix y) { return (itofix(x) > y.v); }
inline int operator > (const fix x, const long y) { return (x.v > itofix(y)); }
inline int operator > (const long x, const fix y) { return (itofix(x) > y.v); }
inline int operator > (const fix x, const float y) { return (x.v > ftofix(y)); }
inline int operator > (const float x, const fix y) { return (ftofix(x) > y.v); }
inline int operator > (const fix x, const double y) { return (x.v > ftofix(y)); }
inline int operator > (const double x, const fix y) { return (ftofix(x) > y.v); }
inline int operator <= (const fix x, const fix y) { return (x.v <= y.v); }
inline int operator <= (const fix x, const int y) { return (x.v <= itofix(y)); }
inline int operator <= (const int x, const fix y) { return (itofix(x) <= y.v); }
inline int operator <= (const fix x, const long y) { return (x.v <= itofix(y)); }
inline int operator <= (const long x, const fix y) { return (itofix(x) <= y.v); }
inline int operator <= (const fix x, const float y) { return (x.v <= ftofix(y)); }
inline int operator <= (const float x, const fix y) { return (ftofix(x) <= y.v); }
inline int operator <= (const fix x, const double y) { return (x.v <= ftofix(y)); }
inline int operator <= (const double x, const fix y) { return (ftofix(x) <= y.v); }
inline int operator >= (const fix x, const fix y) { return (x.v >= y.v); }
inline int operator >= (const fix x, const int y) { return (x.v >= itofix(y)); }
inline int operator >= (const int x, const fix y) { return (itofix(x) >= y.v); }
inline int operator >= (const fix x, const long y) { return (x.v >= itofix(y)); }
inline int operator >= (const long x, const fix y) { return (itofix(x) >= y.v); }
inline int operator >= (const fix x, const float y) { return (x.v >= ftofix(y)); }
inline int operator >= (const float x, const fix y) { return (ftofix(x) >= y.v); }
inline int operator >= (const fix x, const double y) { return (x.v >= ftofix(y)); }
inline int operator >= (const double x, const fix y) { return (ftofix(x) >= y.v); }
inline fix sqrt(fix x) { fix t; t.v = fixsqrt(x.v); return t; }
inline fix cos(fix x) { fix t; t.v = fixcos(x.v); return t; }
inline fix sin(fix x) { fix t; t.v = fixsin(x.v); return t; }
inline fix tan(fix x) { fix t; t.v = fixtan(x.v); return t; }
inline fix acos(fix x) { fix t; t.v = fixacos(x.v); return t; }
inline fix asin(fix x) { fix t; t.v = fixasin(x.v); return t; }
inline fix atan(fix x) { fix t; t.v = fixatan(x.v); return t; }
inline fix atan2(fix x, fix y) { fix t; t.v = fixatan2(x.v, y.v); return t; }
inline void get_translation_matrix(MATRIX *m, fix x, fix y, fix z)
{
get_translation_matrix(m, x.v, y.v, z.v);
}
inline void get_scaling_matrix(MATRIX *m, fix x, fix y, fix z)
{
get_scaling_matrix(m, x.v, y.v, z.v);
}
inline void get_x_rotate_matrix(MATRIX *m, fix r)
{
get_x_rotate_matrix(m, r.v);
}
inline void get_y_rotate_matrix(MATRIX *m, fix r)
{
get_y_rotate_matrix(m, r.v);
}
inline void get_z_rotate_matrix(MATRIX *m, fix r)
{
get_z_rotate_matrix(m, r.v);
}
inline void get_rotation_matrix(MATRIX *m, fix x, fix y, fix z)
{
get_rotation_matrix(m, x.v, y.v, z.v);
}
inline void get_align_matrix(MATRIX *m, fix xfront, fix yfront, fix zfront, fix xup, fix yup, fix zup)
{
get_align_matrix(m, xfront.v, yfront.v, zfront.v, xup.v, yup.v, zup.v);
}
inline void get_vector_rotation_matrix(MATRIX *m, fix x, fix y, fix z, fix a)
{
get_vector_rotation_matrix(m, x.v, y.v, z.v, a.v);
}
inline void get_transformation_matrix(MATRIX *m, fix scale, fix xrot, fix yrot, fix zrot, fix x, fix y, fix z)
{
get_transformation_matrix(m, scale.v, xrot.v, yrot.v, zrot.v, x.v, y.v, z.v);
}
inline void get_camera_matrix(MATRIX *m, fix x, fix y, fix z, fix xfront, fix yfront, fix zfront, fix xup, fix yup, fix zup, fix fov, fix aspect)
{
get_camera_matrix(m, x.v, y.v, z.v, xfront.v, yfront.v, zfront.v, xup.v, yup.v, zup.v, fov.v, aspect.v);
}
inline void qtranslate_matrix(MATRIX *m, fix x, fix y, fix z)
{
qtranslate_matrix(m, x.v, y.v, z.v);
}
inline void qscale_matrix(MATRIX *m, fix scale)
{
qscale_matrix(m, scale.v);
}
inline fix vector_length(fix x, fix y, fix z)
{
fix t;
t.v = vector_length(x.v, y.v, z.v);
return t;
}
inline void normalize_vector(fix *x, fix *y, fix *z)
{
normalize_vector(&x->v, &y->v, &z->v);
}
inline void cross_product(fix x1, fix y_1, fix z1, fix x2, fix y2, fix z2, fix *xout, fix *yout, fix *zout)
{
cross_product(x1.v, y_1.v, z1.v, x2.v, y2.v, z2.v, &xout->v, &yout->v, &zout->v);
}
inline fix dot_product(fix x1, fix y_1, fix z1, fix x2, fix y2, fix z2)
{
fix t;
t.v = dot_product(x1.v, y_1.v, z1.v, x2.v, y2.v, z2.v);
return t;
}
inline void apply_matrix(MATRIX *m, fix x, fix y, fix z, fix *xout, fix *yout, fix *zout)
{
apply_matrix(m, x.v, y.v, z.v, &xout->v, &yout->v, &zout->v);
}
inline void persp_project(fix x, fix y, fix z, fix *xout, fix *yout)
{
persp_project(x.v, y.v, z.v, &xout->v, &yout->v);
}
#endif /* ifdef __cplusplus */
#endif /* ifndef ALLEGRO_FIX_INL */

View File

@ -1,236 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Fixed point math inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FMATHS_INL
#define ALLEGRO_FMATHS_INL
#define ALLEGRO_IMPORT_MATH_ASM
#include "asm.inl"
#undef ALLEGRO_IMPORT_MATH_ASM
#ifdef __cplusplus
extern "C" {
#endif
/* ftofix and fixtof are used in generic C versions of fixmul and fixdiv */
AL_INLINE(fixed, ftofix, (double x),
{
if (x > 32767.0) {
*allegro_errno = ERANGE;
return 0x7FFFFFFF;
}
if (x < -32767.0) {
*allegro_errno = ERANGE;
return -0x7FFFFFFF;
}
return (fixed)(x * 65536.0 + (x < 0 ? -0.5 : 0.5));
})
AL_INLINE(double, fixtof, (fixed x),
{
return (double)x / 65536.0;
})
#ifdef ALLEGRO_NO_ASM
/* use generic C versions */
AL_INLINE(fixed, fixadd, (fixed x, fixed y),
{
fixed result = x + y;
if (result >= 0) {
if ((x < 0) && (y < 0)) {
*allegro_errno = ERANGE;
return -0x7FFFFFFF;
}
else
return result;
}
else {
if ((x > 0) && (y > 0)) {
*allegro_errno = ERANGE;
return 0x7FFFFFFF;
}
else
return result;
}
})
AL_INLINE(fixed, fixsub, (fixed x, fixed y),
{
fixed result = x - y;
if (result >= 0) {
if ((x < 0) && (y > 0)) {
*allegro_errno = ERANGE;
return -0x7FFFFFFF;
}
else
return result;
}
else {
if ((x > 0) && (y < 0)) {
*allegro_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(fixed, fixmul, (fixed x, fixed y),
{
return ftofix(fixtof(x) * fixtof(y));
})
#else
AL_INLINE(fixed, fixmul, (fixed x, fixed y),
{
LONG_LONG lx = x;
LONG_LONG ly = y;
LONG_LONG lres = (lx*ly);
if (lres > 0x7FFFFFFF0000LL) {
*allegro_errno = ERANGE;
return 0x7FFFFFFF;
}
else if (lres < -0x7FFFFFFF0000LL) {
*allegro_errno = ERANGE;
return 0x80000000;
}
else {
int res = lres >> 16;
return res;
}
})
#endif /* fixmul() C implementations */
AL_INLINE(fixed, fixdiv, (fixed x, fixed y),
{
if (y == 0) {
*allegro_errno = ERANGE;
return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
}
else
return ftofix(fixtof(x) / fixtof(y));
})
AL_INLINE(int, fixfloor, (fixed x),
{
/* (x >> 16) is not portable */
if (x >= 0)
return (x >> 16);
else
return ~((~x) >> 16);
})
AL_INLINE(int, fixceil, (fixed x),
{
if (x > 0x7FFF0000) {
*allegro_errno = ERANGE;
return 0x7FFF;
}
return fixfloor(x + 0xFFFF);
})
#endif /* C vs. inline asm */
AL_INLINE(fixed, itofix, (int x),
{
return x << 16;
})
AL_INLINE(int, fixtoi, (fixed x),
{
return fixfloor(x) + ((x & 0x8000) >> 15);
})
AL_INLINE(fixed, fixcos, (fixed x),
{
return _cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
})
AL_INLINE(fixed, fixsin, (fixed x),
{
return _cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
})
AL_INLINE(fixed, fixtan, (fixed x),
{
return _tan_tbl[((x + 0x4000) >> 15) & 0xFF];
})
AL_INLINE(fixed, fixacos, (fixed x),
{
if ((x < -65536) || (x > 65536)) {
*allegro_errno = EDOM;
return 0;
}
return _acos_tbl[(x+65536+127)>>8];
})
AL_INLINE(fixed, fixasin, (fixed x),
{
if ((x < -65536) || (x > 65536)) {
*allegro_errno = EDOM;
return 0;
}
return 0x00400000 - _acos_tbl[(x+65536+127)>>8];
})
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_FMATHS_INL */

View File

@ -1,282 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Graphics inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_GFX_INL
#define ALLEGRO_GFX_INL
#include "allegro/debug.h"
#define ALLEGRO_IMPORT_GFX_ASM
#include "asm.inl"
#undef ALLEGRO_IMPORT_GFX_ASM
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ALLEGRO_NO_ASM
/* use generic C versions */
AL_INLINE(int, _default_ds, (void),
{
return 0;
})
#ifdef ALLEGRO_BCC32
/* BCC32 is a somewhat unusual platform because it mixes a MSVC/MinGW generated DLL
* (for which ALLEGRO_NO_ASM is not defined) with Borland C++ compiled programs for
* which ALLEGRO_NO_ASM is defined. As a result, Borland C++ compiled programs can't
* use the inlined version of bmp_write_line(), bmp_read_line() and bmp_unwrite_line()
* because the write_bank() and read_bank() methods of the BITMAP class don't expect
* the same calling convention on both sides.
*/
AL_FUNC(uintptr_t, bmp_write_line, (BITMAP *bmp, int lyne));
AL_FUNC(uintptr_t, bmp_read_line, (BITMAP *bmp, int lyne));
AL_FUNC(void, bmp_unwrite_line, (BITMAP *bmp));
#else
typedef AL_METHOD(uintptr_t, _BMP_BANK_SWITCHER, (BITMAP *bmp, int lyne));
typedef AL_METHOD(void, _BMP_UNBANK_SWITCHER, (BITMAP *bmp));
AL_INLINE(uintptr_t, bmp_write_line, (BITMAP *bmp, int lyne),
{
_BMP_BANK_SWITCHER switcher = (_BMP_BANK_SWITCHER)bmp->write_bank;
return switcher(bmp, lyne);
})
AL_INLINE(uintptr_t, bmp_read_line, (BITMAP *bmp, int lyne),
{
_BMP_BANK_SWITCHER switcher = (_BMP_BANK_SWITCHER)bmp->read_bank;
return switcher(bmp, lyne);
})
AL_INLINE(void, bmp_unwrite_line, (BITMAP *bmp),
{
_BMP_UNBANK_SWITCHER switcher = (_BMP_UNBANK_SWITCHER)bmp->vtable->unwrite_bank;
switcher(bmp);
})
#endif /* defined ALLEGRO_BCC32 */
#endif /* C vs. inline asm */
AL_INLINE(int, is_windowed_mode, (void),
{
ASSERT (gfx_driver);
return gfx_driver->windowed;
})
AL_INLINE(void, clear_to_color, (BITMAP *bitmap, int color),
{
ASSERT(bitmap);
bitmap->vtable->clear_to_color(bitmap, color);
})
AL_INLINE(int, bitmap_color_depth, (BITMAP *bmp),
{
ASSERT(bmp);
return bmp->vtable->color_depth;
})
AL_INLINE(int, bitmap_mask_color, (BITMAP *bmp),
{
ASSERT(bmp);
return bmp->vtable->mask_color;
})
AL_INLINE(int, is_same_bitmap, (BITMAP *bmp1, BITMAP *bmp2),
{
unsigned long m1;
unsigned long m2;
if ((!bmp1) || (!bmp2))
return FALSE;
if (bmp1 == bmp2)
return TRUE;
m1 = bmp1->id & BMP_ID_MASK;
m2 = bmp2->id & BMP_ID_MASK;
return ((m1) && (m1 == m2));
})
AL_INLINE(int, is_linear_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return (bmp->id & BMP_ID_PLANAR) == 0;
})
AL_INLINE(int, is_planar_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return (bmp->id & BMP_ID_PLANAR) != 0;
})
AL_INLINE(int, is_memory_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return (bmp->id & (BMP_ID_VIDEO | BMP_ID_SYSTEM)) == 0;
})
AL_INLINE(int, is_screen_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return is_same_bitmap(bmp, screen);
})
AL_INLINE(int, is_video_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return (bmp->id & BMP_ID_VIDEO) != 0;
})
AL_INLINE(int, is_system_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return (bmp->id & BMP_ID_SYSTEM) != 0;
})
AL_INLINE(int, is_sub_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
return (bmp->id & BMP_ID_SUB) != 0;
})
#ifdef ALLEGRO_MPW
#define acquire_bitmap(bmp)
#define release_bitmap(bmp)
#define acquire_screen()
#define release_screen()
#else
AL_INLINE(void, acquire_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
if (bmp->vtable->acquire)
bmp->vtable->acquire(bmp);
})
AL_INLINE(void, release_bitmap, (BITMAP *bmp),
{
ASSERT(bmp);
if (bmp->vtable->release)
bmp->vtable->release(bmp);
})
AL_INLINE(void, acquire_screen, (void),
{
acquire_bitmap(screen);
})
AL_INLINE(void, release_screen, (void),
{
release_bitmap(screen);
})
#endif
AL_INLINE(int, is_inside_bitmap, (BITMAP *bmp, int x, int y, int clip),
{
ASSERT(bmp);
if (clip) {
if (bmp->clip)
/* internal clipping is inclusive-exclusive */
return (x >= bmp->cl) && (y >= bmp->ct) && (x < bmp->cr) && (y < bmp->cb);
else
return TRUE;
}
else
/* bitmap dimensions are always non-negative */
return (unsigned int)x < (unsigned int)bmp->w && (unsigned int)y < (unsigned int)bmp->h;
})
AL_INLINE(void, get_clip_rect, (BITMAP *bitmap, int *x1, int *y_1, int *x2, int *y2),
{
ASSERT(bitmap);
/* internal clipping is inclusive-exclusive */
*x1 = bitmap->cl;
*y_1 = bitmap->ct;
*x2 = bitmap->cr-1;
*y2 = bitmap->cb-1;
})
AL_INLINE(void, set_clip_state, (BITMAP *bitmap, int state),
{
ASSERT(bitmap);
bitmap->clip = state;
})
AL_INLINE(int, get_clip_state, (BITMAP *bitmap),
{
ASSERT(bitmap);
return bitmap->clip;
})
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_GFX_INL */

View File

@ -1,46 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Matrix math inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_MATRIX_INL
#define ALLEGRO_MATRIX_INL
#ifdef __cplusplus
extern "C" {
#endif
#define CALC_ROW(n) (fixmul(x, m->v[n][0]) + \
fixmul(y, m->v[n][1]) + \
fixmul(z, m->v[n][2]) + \
m->t[n])
AL_INLINE(void, apply_matrix, (MATRIX *m, fixed x, fixed y, fixed z, fixed *xout, fixed *yout, fixed *zout),
{
*xout = CALC_ROW(0);
*yout = CALC_ROW(1);
*zout = CALC_ROW(2);
})
#undef CALC_ROW
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_MATRIX_INL */

View File

@ -1,68 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* RLE sprite inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_RLE_INL
#define ALLEGRO_RLE_INL
#include "allegro/debug.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_INLINE(void, draw_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y),
{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->color_depth);
bmp->vtable->draw_rle_sprite(bmp, sprite, x, y);
})
AL_INLINE(void, draw_trans_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y),
{
ASSERT(bmp);
ASSERT(sprite);
if (sprite->color_depth == 32) {
ASSERT(bmp->vtable->draw_trans_rgba_rle_sprite);
bmp->vtable->draw_trans_rgba_rle_sprite(bmp, sprite, x, y);
}
else {
ASSERT(bmp->vtable->color_depth == sprite->color_depth);
bmp->vtable->draw_trans_rle_sprite(bmp, sprite, x, y);
}
})
AL_INLINE(void, draw_lit_rle_sprite, (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color),
{
ASSERT(bmp);
ASSERT(sprite);
ASSERT(bmp->vtable->color_depth == sprite->color_depth);
bmp->vtable->draw_lit_rle_sprite(bmp, sprite, x, y, color);
})
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_RLE_INL */

View File

@ -1,65 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* System inline functions (generic C).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_SYSTEM_INL
#define ALLEGRO_SYSTEM_INL
#include "allegro/debug.h"
#ifdef __cplusplus
extern "C" {
#endif
AL_INLINE(void, set_window_title, (AL_CONST char *name),
{
ASSERT(system_driver);
if (system_driver->set_window_title)
system_driver->set_window_title(name);
})
AL_INLINE(int, desktop_color_depth, (void),
{
ASSERT(system_driver);
if (system_driver->desktop_color_depth)
return system_driver->desktop_color_depth();
else
return 0;
})
AL_INLINE(int, get_desktop_resolution, (int *width, int *height),
{
ASSERT(system_driver);
if (system_driver->get_desktop_resolution)
return system_driver->get_desktop_resolution(width, height);
else
return -1;
})
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_SYSTEM_INL */

File diff suppressed because it is too large Load Diff

View File

@ -1,139 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Helpers for accessing the VGA hardware registers.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef AINTVGA_H
#define AINTVGA_H
#ifndef ALLEGRO_H
#error must include allegro.h first
#endif
#ifdef ALLEGRO_GFX_HAS_VGA
#ifdef __cplusplus
extern "C" {
#endif
AL_VAR(int, _crtc);
AL_FUNC(void, _vga_regs_init, (void));
AL_FUNC(void, _vga_vsync, (void));
AL_FUNC(void, _vga_set_palette_range, (AL_CONST PALETTE p, int from, int to, int do_sync));
AL_FUNC(void, _set_vga_virtual_width, (int old_width, int new_width));
AL_FUNC(uintptr_t, _set_vga_mode, (int modenum));
AL_FUNC(void, _unset_vga_mode, (void));
AL_FUNC(void, _save_vga_mode, (void));
AL_FUNC(void, _restore_vga_mode, (void));
/* reads the current value of a VGA hardware register */
AL_INLINE(int, _read_vga_register, (int port, int idx),
{
if (port==0x3C0)
inportb(_crtc+6);
outportb(port, idx);
return inportb(port+1);
})
/* writes to a VGA hardware register */
AL_INLINE(void, _write_vga_register, (int port, int idx, int v),
{
if (port==0x3C0) {
inportb(_crtc+6);
outportb(port, idx);
outportb(port, v);
}
else {
outportb(port, idx);
outportb(port+1, v);
}
})
/* alters specific bits of a VGA hardware register */
AL_INLINE(void, _alter_vga_register, (int port, int idx, int mask, int v),
{
int temp;
temp = _read_vga_register(port, idx);
temp &= (~mask);
temp |= (v & mask);
_write_vga_register(port, idx, temp);
})
/* waits until the VGA isn't in a horizontal blank */
AL_INLINE(void, _vsync_out_h, (void),
{
do {
} while (inportb(0x3DA) & 1);
})
/* waits until the VGA isn't in a vertical blank */
AL_INLINE(void, _vsync_out_v, (void),
{
do {
} while (inportb(0x3DA) & 8);
})
/* waits until the VGA is in a vertical blank */
AL_INLINE(void, _vsync_in, (void),
{
if (_timer_use_retrace) {
int t = retrace_count;
do {
} while (t == retrace_count);
}
else {
do {
} while (!(inportb(0x3DA) & 8));
}
})
/* modifies the VGA pelpan register */
AL_INLINE(void, _write_hpp, (int value),
{
if (_timer_use_retrace) {
_retrace_hpp_value = value;
do {
} while (_retrace_hpp_value == value);
}
else {
do {
} while (!(inportb(0x3DA) & 8));
_write_vga_register(0x3C0, 0x33, value);
}
})
#ifdef __cplusplus
}
#endif
#endif /* ifdef ALLEGRO_GFX_HAS_VGA */
#endif /* ifndef AINTVGA_H */

View File

@ -1,435 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration defines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
/* which color depths to include? */
#define ALLEGRO_COLOR8
#define ALLEGRO_COLOR16
#define ALLEGRO_COLOR24
#define ALLEGRO_COLOR32
/* for backward compatibility */
#ifdef USE_CONSOLE
#define ALLEGRO_NO_MAGIC_MAIN
#define ALLEGRO_USE_CONSOLE
#endif
/* include platform-specific stuff */
#ifndef SCAN_EXPORT
#ifndef SCAN_DEPEND
#include "allegro/platform/alplatf.h"
#endif
#if defined ALLEGRO_DJGPP
#include "allegro/platform/aldjgpp.h"
#elif defined ALLEGRO_WATCOM
#include "allegro/platform/alwatcom.h"
#elif defined ALLEGRO_MINGW32
#include "allegro/platform/almngw32.h"
#elif defined ALLEGRO_DMC
#include "allegro/platform/aldmc.h"
#elif defined ALLEGRO_BCC32
#include "allegro/platform/albcc32.h"
#elif defined ALLEGRO_MSVC
#include "allegro/platform/almsvc.h"
#elif defined ALLEGRO_HAIKU
#include "allegro/platform/albecfg.h"
#elif defined ALLEGRO_BEOS
#include "allegro/platform/albecfg.h"
#elif defined ALLEGRO_MPW
#include "allegro/platform/almaccfg.h"
#elif defined ALLEGRO_MACOSX
#include "allegro/platform/alosxcfg.h"
#elif defined ALLEGRO_QNX
#include "allegro/platform/alqnxcfg.h"
#elif defined ALLEGRO_UNIX
#include "allegro/platform/alucfg.h"
#elif defined ALLEGRO_PSP
#include "allegro/platform/alpspcfg.h"
#else
#error platform not supported
#endif
#ifndef SCAN_DEPEND
#include "allegro/platform/astdint.h"
#endif
#endif
/* special definitions for the GCC compiler */
#ifdef __GNUC__
#define ALLEGRO_GCC
#ifndef AL_INLINE
#ifdef __cplusplus
#define AL_INLINE(type, name, args, code) \
static inline type name args; \
static inline type name args code
/* Needed if this header is included by C99 user code, as
* "extern __inline__" is defined differently in C99 (it exports
* a new global function symbol).
*/
#elif __GNUC_STDC_INLINE__
#define AL_INLINE(type, name, args, code) \
extern __inline__ __attribute__((__gnu_inline__)) type name args; \
extern __inline__ __attribute__((__gnu_inline__)) type name args code
#else
#define AL_INLINE(type, name, args, code) \
extern __inline__ type name args; \
extern __inline__ type name args code
#endif
#endif
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args) __attribute__ ((format (printf, a, b)))
#ifndef INLINE
#define INLINE __inline__
#endif
#if __GNUC__ >= 3
/* SET: According to gcc volatile is ignored for a return type.
* I think the code should just ensure that inportb is declared as an
* __asm__ __volatile__ macro. If that's the case the extra volatile
* doesn't have any sense.
*/
#define RET_VOLATILE
#else
#define RET_VOLATILE volatile
#endif
#ifndef ZERO_SIZE_ARRAY
#if __GNUC__ < 3
#define ZERO_SIZE_ARRAY(type, name) __extension__ type name[0]
#else
#define ZERO_SIZE_ARRAY(type, name) type name[] /* ISO C99 flexible array members */
#endif
#endif
#ifndef LONG_LONG
#define LONG_LONG long long
#ifdef ALLEGRO_GUESS_INTTYPES_OK
#define int64_t signed long long
#define uint64_t unsigned long long
#endif
#endif
#ifdef __i386__
#define ALLEGRO_I386
#ifndef ALLEGRO_NO_ASM
#define _AL_SINCOS(x, s, c) __asm__ ("fsincos" : "=t" (c), "=u" (s) : "0" (x))
#endif
#endif
#ifdef __amd64__
#define ALLEGRO_AMD64
#ifndef ALLEGRO_NO_ASM
#define _AL_SINCOS(x, s, c) __asm__ ("fsincos" : "=t" (c), "=u" (s) : "0" (x))
#endif
#endif
#ifdef __arm__
#define ALLEGRO_ARM
#endif
#ifndef AL_CONST
#define AL_CONST const
#endif
#ifndef AL_FUNC_DEPRECATED
#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
#define AL_FUNC_DEPRECATED(type, name, args) AL_FUNC(__attribute__ ((deprecated)) type, name, args)
#define AL_PRINTFUNC_DEPRECATED(type, name, args, a, b) AL_PRINTFUNC(__attribute__ ((deprecated)) type, name, args, a, b)
#define AL_INLINE_DEPRECATED(type, name, args, code) AL_INLINE(__attribute__ ((deprecated)) type, name, args, code)
#endif
#endif
#ifndef AL_ALIAS
#define AL_ALIAS(DECL, CALL) \
static __attribute__((unused)) __inline__ DECL \
{ \
return CALL; \
}
#endif
#ifndef AL_ALIAS_VOID_RET
#define AL_ALIAS_VOID_RET(DECL, CALL) \
static __attribute__((unused)) __inline__ void DECL \
{ \
CALL; \
}
#endif
#endif
/* use constructor functions, if supported */
#ifdef ALLEGRO_USE_CONSTRUCTOR
#define CONSTRUCTOR_FUNCTION(func) func __attribute__ ((constructor))
#define DESTRUCTOR_FUNCTION(func) func __attribute__ ((destructor))
#endif
/* the rest of this file fills in some default definitions of language
* features and helper functions, which are conditionalised so they will
* only be included if none of the above headers defined custom versions.
*/
#ifndef _AL_SINCOS
#define _AL_SINCOS(x, s, c) do { (c) = cos(x); (s) = sin(x); } while (0)
#endif
#ifndef INLINE
#define INLINE
#endif
#ifndef RET_VOLATILE
#define RET_VOLATILE volatile
#endif
#ifndef ZERO_SIZE_ARRAY
#define ZERO_SIZE_ARRAY(type, name) type name[]
#endif
#ifndef AL_CONST
#define AL_CONST
#endif
#ifndef AL_VAR
#define AL_VAR(type, name) extern type name
#endif
#ifndef AL_ARRAY
#define AL_ARRAY(type, name) extern type name[]
#endif
#ifndef AL_FUNC
#define AL_FUNC(type, name, args) type name args
#endif
#ifndef AL_PRINTFUNC
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args)
#endif
#ifndef AL_METHOD
#define AL_METHOD(type, name, args) type (*name) args
#endif
#ifndef AL_FUNCPTR
#define AL_FUNCPTR(type, name, args) extern type (*name) args
#endif
#ifndef AL_FUNCPTRARRAY
#define AL_FUNCPTRARRAY(type, name, args) extern type (*name[]) args
#endif
#ifndef AL_INLINE
#define AL_INLINE(type, name, args, code) type name args;
#endif
#ifndef AL_FUNC_DEPRECATED
#define AL_FUNC_DEPRECATED(type, name, args) AL_FUNC(type, name, args)
#define AL_PRINTFUNC_DEPRECATED(type, name, args, a, b) AL_PRINTFUNC(type, name, args, a, b)
#define AL_INLINE_DEPRECATED(type, name, args, code) AL_INLINE(type, name, args, code)
#endif
#ifndef AL_ALIAS
#define AL_ALIAS(DECL, CALL) \
static INLINE DECL \
{ \
return CALL; \
}
#endif
#ifndef AL_ALIAS_VOID_RET
#define AL_ALIAS_VOID_RET(DECL, CALL) \
static INLINE void DECL \
{ \
CALL; \
}
#endif
#ifndef END_OF_MAIN
#define END_OF_MAIN()
#endif
/* fill in default memory locking macros */
#ifndef END_OF_FUNCTION
#define END_OF_FUNCTION(x)
#define END_OF_STATIC_FUNCTION(x)
#define LOCK_DATA(d, s)
#define LOCK_CODE(c, s)
#define UNLOCK_DATA(d, s)
#define LOCK_VARIABLE(x)
#define LOCK_FUNCTION(x)
#endif
/* fill in default filename behaviour */
#ifndef ALLEGRO_LFN
#define ALLEGRO_LFN 1
#endif
#if (defined ALLEGRO_DOS) || (defined ALLEGRO_WINDOWS)
#define OTHER_PATH_SEPARATOR '\\'
#define DEVICE_SEPARATOR ':'
#else
#define OTHER_PATH_SEPARATOR '/'
#define DEVICE_SEPARATOR '\0'
#endif
/* emulate the FA_* flags for platforms that don't already have them */
#ifndef FA_RDONLY
#define FA_RDONLY 1
#define FA_HIDDEN 2
#define FA_SYSTEM 4
#define FA_LABEL 8
#define FA_DIREC 16
#define FA_ARCH 32
#endif
#define FA_NONE 0
#define FA_ALL (~FA_NONE)
#ifdef __cplusplus
extern "C" {
#endif
/* emulate missing library functions */
#ifdef ALLEGRO_NO_STRICMP
AL_FUNC(int, _alemu_stricmp, (AL_CONST char *s1, AL_CONST char *s2));
#define stricmp _alemu_stricmp
#endif
#ifdef ALLEGRO_NO_STRLWR
AL_FUNC(char *, _alemu_strlwr, (char *string));
#define strlwr _alemu_strlwr
#endif
#ifdef ALLEGRO_NO_STRUPR
AL_FUNC(char *, _alemu_strupr, (char *string));
#define strupr _alemu_strupr
#endif
#ifdef ALLEGRO_NO_MEMCMP
AL_FUNC(int, _alemu_memcmp, (AL_CONST void *s1, AL_CONST void *s2, size_t num));
#define memcmp _alemu_memcmp
#endif
/* if nobody put them elsewhere, video bitmaps go in regular memory */
#ifndef _video_ds
#define _video_ds() _default_ds()
#endif
/* not many places actually use these, but still worth emulating */
#ifndef ALLEGRO_DJGPP
#define _farsetsel(seg)
#define _farnspokeb(addr, val) (*((uint8_t *)(addr)) = (val))
#define _farnspokew(addr, val) (*((uint16_t *)(addr)) = (val))
#define _farnspokel(addr, val) (*((uint32_t *)(addr)) = (val))
#define _farnspeekb(addr) (*((uint8_t *)(addr)))
#define _farnspeekw(addr) (*((uint16_t *)(addr)))
#define _farnspeekl(addr) (*((uint32_t *)(addr)))
#endif
/* endian-independent 3-byte accessor macros */
#ifdef ALLEGRO_LITTLE_ENDIAN
#define READ3BYTES(p) ((*(unsigned char *)(p)) \
| (*((unsigned char *)(p) + 1) << 8) \
| (*((unsigned char *)(p) + 2) << 16))
#define WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c)), \
(*((unsigned char *)(p) + 1) = (c) >> 8), \
(*((unsigned char *)(p) + 2) = (c) >> 16))
#elif defined ALLEGRO_BIG_ENDIAN
#define READ3BYTES(p) ((*(unsigned char *)(p) << 16) \
| (*((unsigned char *)(p) + 1) << 8) \
| (*((unsigned char *)(p) + 2)))
#define WRITE3BYTES(p,c) ((*(unsigned char *)(p) = (c) >> 16), \
(*((unsigned char *)(p) + 1) = (c) >> 8), \
(*((unsigned char *)(p) + 2) = (c)))
#elif defined SCAN_DEPEND
#define READ3BYTES(p)
#define WRITE3BYTES(p,c)
#else
#error endianess not defined
#endif
/* generic versions of the video memory access helpers */
#ifndef bmp_select
#define bmp_select(bmp)
#endif
#ifndef bmp_write8
#define bmp_write8(addr, c) (*((uint8_t *)(addr)) = (c))
#define bmp_write15(addr, c) (*((uint16_t *)(addr)) = (c))
#define bmp_write16(addr, c) (*((uint16_t *)(addr)) = (c))
#define bmp_write32(addr, c) (*((uint32_t *)(addr)) = (c))
#define bmp_read8(addr) (*((uint8_t *)(addr)))
#define bmp_read15(addr) (*((uint16_t *)(addr)))
#define bmp_read16(addr) (*((uint16_t *)(addr)))
#define bmp_read32(addr) (*((uint32_t *)(addr)))
AL_INLINE(int, bmp_read24, (uintptr_t addr),
{
unsigned char *p = (unsigned char *)addr;
int c;
c = READ3BYTES(p);
return c;
})
AL_INLINE(void, bmp_write24, (uintptr_t addr, int c),
{
unsigned char *p = (unsigned char *)addr;
WRITE3BYTES(p, c);
})
#endif
/* default random function definition */
#ifndef AL_RAND
#define AL_RAND() (rand())
#endif
#ifdef __cplusplus
}
#endif
/* parameters for the color conversion code */
#if (defined ALLEGRO_WINDOWS) || (defined ALLEGRO_QNX)
#define ALLEGRO_COLORCONV_ALIGNED_WIDTH
#define ALLEGRO_NO_COLORCOPY
#endif

View File

@ -1,393 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Keyboard routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_KEYBOARD_H
#define ALLEGRO_KEYBOARD_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct KEYBOARD_DRIVER
{
int id;
AL_CONST char *name;
AL_CONST char *desc;
AL_CONST char *ascii_name;
int autorepeat;
AL_METHOD(int, init, (void));
AL_METHOD(void, exit, (void));
AL_METHOD(void, poll, (void));
AL_METHOD(void, set_leds, (int leds));
AL_METHOD(void, set_rate, (int delay, int rate));
AL_METHOD(void, wait_for_input, (void));
AL_METHOD(void, stop_waiting_for_input, (void));
AL_METHOD(int, scancode_to_ascii, (int scancode));
AL_METHOD(AL_CONST char *, scancode_to_name, (int scancode));
} KEYBOARD_DRIVER;
AL_VAR(KEYBOARD_DRIVER *, keyboard_driver);
AL_ARRAY(_DRIVER_INFO, _keyboard_driver_list);
AL_FUNC(int, install_keyboard, (void));
AL_FUNC(void, remove_keyboard, (void));
AL_FUNC(int, poll_keyboard, (void));
AL_FUNC(int, keyboard_needs_poll, (void));
AL_FUNCPTR(int, keyboard_callback, (int key));
AL_FUNCPTR(int, keyboard_ucallback, (int key, int *scancode));
AL_FUNCPTR(void, keyboard_lowlevel_callback, (int scancode));
AL_FUNC(void, install_keyboard_hooks, (AL_METHOD(int, keypressed, (void)), AL_METHOD(int, readkey, (void))));
AL_ARRAY(volatile char, key);
AL_VAR(volatile int, key_shifts);
AL_VAR(int, three_finger_flag);
AL_VAR(int, key_led_flag);
AL_FUNC(int, keypressed, (void));
AL_FUNC(int, readkey, (void));
AL_FUNC(int, ureadkey, (int *scancode));
AL_FUNC(void, simulate_keypress, (int keycode));
AL_FUNC(void, simulate_ukeypress, (int keycode, int scancode));
AL_FUNC(void, clear_keybuf, (void));
AL_FUNC(void, set_leds, (int leds));
AL_FUNC(void, set_keyboard_rate, (int delay, int repeat));
AL_FUNC(int, scancode_to_ascii, (int scancode));
AL_FUNC(AL_CONST char *, scancode_to_name, (int scancode));
/* The KEY_ macros are no longer #defined directly to avoid conflicting with
* linux (which has its own KEY_ constants). "__allegro_"-prefixed constants
* are used by the Allegro-Linux keyboard driver, but everyone else should
* continue to use the KEY_ constants.
*/
enum {
__allegro_KB_SHIFT_FLAG = 0x0001,
__allegro_KB_CTRL_FLAG = 0x0002,
__allegro_KB_ALT_FLAG = 0x0004,
__allegro_KB_LWIN_FLAG = 0x0008,
__allegro_KB_RWIN_FLAG = 0x0010,
__allegro_KB_MENU_FLAG = 0x0020,
__allegro_KB_COMMAND_FLAG = 0x0040,
__allegro_KB_SCROLOCK_FLAG = 0x0100,
__allegro_KB_NUMLOCK_FLAG = 0x0200,
__allegro_KB_CAPSLOCK_FLAG = 0x0400,
__allegro_KB_INALTSEQ_FLAG = 0x0800,
__allegro_KB_ACCENT1_FLAG = 0x1000,
__allegro_KB_ACCENT2_FLAG = 0x2000,
__allegro_KB_ACCENT3_FLAG = 0x4000,
__allegro_KB_ACCENT4_FLAG = 0x8000
};
enum {
__allegro_KEY_A = 1,
__allegro_KEY_B = 2,
__allegro_KEY_C = 3,
__allegro_KEY_D = 4,
__allegro_KEY_E = 5,
__allegro_KEY_F = 6,
__allegro_KEY_G = 7,
__allegro_KEY_H = 8,
__allegro_KEY_I = 9,
__allegro_KEY_J = 10,
__allegro_KEY_K = 11,
__allegro_KEY_L = 12,
__allegro_KEY_M = 13,
__allegro_KEY_N = 14,
__allegro_KEY_O = 15,
__allegro_KEY_P = 16,
__allegro_KEY_Q = 17,
__allegro_KEY_R = 18,
__allegro_KEY_S = 19,
__allegro_KEY_T = 20,
__allegro_KEY_U = 21,
__allegro_KEY_V = 22,
__allegro_KEY_W = 23,
__allegro_KEY_X = 24,
__allegro_KEY_Y = 25,
__allegro_KEY_Z = 26,
__allegro_KEY_0 = 27,
__allegro_KEY_1 = 28,
__allegro_KEY_2 = 29,
__allegro_KEY_3 = 30,
__allegro_KEY_4 = 31,
__allegro_KEY_5 = 32,
__allegro_KEY_6 = 33,
__allegro_KEY_7 = 34,
__allegro_KEY_8 = 35,
__allegro_KEY_9 = 36,
__allegro_KEY_0_PAD = 37,
__allegro_KEY_1_PAD = 38,
__allegro_KEY_2_PAD = 39,
__allegro_KEY_3_PAD = 40,
__allegro_KEY_4_PAD = 41,
__allegro_KEY_5_PAD = 42,
__allegro_KEY_6_PAD = 43,
__allegro_KEY_7_PAD = 44,
__allegro_KEY_8_PAD = 45,
__allegro_KEY_9_PAD = 46,
__allegro_KEY_F1 = 47,
__allegro_KEY_F2 = 48,
__allegro_KEY_F3 = 49,
__allegro_KEY_F4 = 50,
__allegro_KEY_F5 = 51,
__allegro_KEY_F6 = 52,
__allegro_KEY_F7 = 53,
__allegro_KEY_F8 = 54,
__allegro_KEY_F9 = 55,
__allegro_KEY_F10 = 56,
__allegro_KEY_F11 = 57,
__allegro_KEY_F12 = 58,
__allegro_KEY_ESC = 59,
__allegro_KEY_TILDE = 60,
__allegro_KEY_MINUS = 61,
__allegro_KEY_EQUALS = 62,
__allegro_KEY_BACKSPACE = 63,
__allegro_KEY_TAB = 64,
__allegro_KEY_OPENBRACE = 65,
__allegro_KEY_CLOSEBRACE = 66,
__allegro_KEY_ENTER = 67,
__allegro_KEY_COLON = 68,
__allegro_KEY_QUOTE = 69,
__allegro_KEY_BACKSLASH = 70,
__allegro_KEY_BACKSLASH2 = 71,
__allegro_KEY_COMMA = 72,
__allegro_KEY_STOP = 73,
__allegro_KEY_SLASH = 74,
__allegro_KEY_SPACE = 75,
__allegro_KEY_INSERT = 76,
__allegro_KEY_DEL = 77,
__allegro_KEY_HOME = 78,
__allegro_KEY_END = 79,
__allegro_KEY_PGUP = 80,
__allegro_KEY_PGDN = 81,
__allegro_KEY_LEFT = 82,
__allegro_KEY_RIGHT = 83,
__allegro_KEY_UP = 84,
__allegro_KEY_DOWN = 85,
__allegro_KEY_SLASH_PAD = 86,
__allegro_KEY_ASTERISK = 87,
__allegro_KEY_MINUS_PAD = 88,
__allegro_KEY_PLUS_PAD = 89,
__allegro_KEY_DEL_PAD = 90,
__allegro_KEY_ENTER_PAD = 91,
__allegro_KEY_PRTSCR = 92,
__allegro_KEY_PAUSE = 93,
__allegro_KEY_ABNT_C1 = 94,
__allegro_KEY_YEN = 95,
__allegro_KEY_KANA = 96,
__allegro_KEY_CONVERT = 97,
__allegro_KEY_NOCONVERT = 98,
__allegro_KEY_AT = 99,
__allegro_KEY_CIRCUMFLEX = 100,
__allegro_KEY_COLON2 = 101,
__allegro_KEY_KANJI = 102,
__allegro_KEY_EQUALS_PAD = 103, /* MacOS X */
__allegro_KEY_BACKQUOTE = 104, /* MacOS X */
__allegro_KEY_SEMICOLON = 105, /* MacOS X */
__allegro_KEY_COMMAND = 106, /* MacOS X */
__allegro_KEY_UNKNOWN1 = 107,
__allegro_KEY_UNKNOWN2 = 108,
__allegro_KEY_UNKNOWN3 = 109,
__allegro_KEY_UNKNOWN4 = 110,
__allegro_KEY_UNKNOWN5 = 111,
__allegro_KEY_UNKNOWN6 = 112,
__allegro_KEY_UNKNOWN7 = 113,
__allegro_KEY_UNKNOWN8 = 114,
__allegro_KEY_MODIFIERS = 115,
__allegro_KEY_LSHIFT = 115,
__allegro_KEY_RSHIFT = 116,
__allegro_KEY_LCONTROL = 117,
__allegro_KEY_RCONTROL = 118,
__allegro_KEY_ALT = 119,
__allegro_KEY_ALTGR = 120,
__allegro_KEY_LWIN = 121,
__allegro_KEY_RWIN = 122,
__allegro_KEY_MENU = 123,
__allegro_KEY_SCRLOCK = 124,
__allegro_KEY_NUMLOCK = 125,
__allegro_KEY_CAPSLOCK = 126,
__allegro_KEY_MAX = 127
};
#ifndef ALLEGRO_NO_KEY_DEFINES
#define KB_SHIFT_FLAG __allegro_KB_SHIFT_FLAG
#define KB_CTRL_FLAG __allegro_KB_CTRL_FLAG
#define KB_ALT_FLAG __allegro_KB_ALT_FLAG
#define KB_LWIN_FLAG __allegro_KB_LWIN_FLAG
#define KB_RWIN_FLAG __allegro_KB_RWIN_FLAG
#define KB_MENU_FLAG __allegro_KB_MENU_FLAG
#define KB_COMMAND_FLAG __allegro_KB_COMMAND_FLAG
#define KB_SCROLOCK_FLAG __allegro_KB_SCROLOCK_FLAG
#define KB_NUMLOCK_FLAG __allegro_KB_NUMLOCK_FLAG
#define KB_CAPSLOCK_FLAG __allegro_KB_CAPSLOCK_FLAG
#define KB_INALTSEQ_FLAG __allegro_KB_INALTSEQ_FLAG
#define KB_ACCENT1_FLAG __allegro_KB_ACCENT1_FLAG
#define KB_ACCENT2_FLAG __allegro_KB_ACCENT2_FLAG
#define KB_ACCENT3_FLAG __allegro_KB_ACCENT3_FLAG
#define KB_ACCENT4_FLAG __allegro_KB_ACCENT4_FLAG
#define KEY_A __allegro_KEY_A
#define KEY_B __allegro_KEY_B
#define KEY_C __allegro_KEY_C
#define KEY_D __allegro_KEY_D
#define KEY_E __allegro_KEY_E
#define KEY_F __allegro_KEY_F
#define KEY_G __allegro_KEY_G
#define KEY_H __allegro_KEY_H
#define KEY_I __allegro_KEY_I
#define KEY_J __allegro_KEY_J
#define KEY_K __allegro_KEY_K
#define KEY_L __allegro_KEY_L
#define KEY_M __allegro_KEY_M
#define KEY_N __allegro_KEY_N
#define KEY_O __allegro_KEY_O
#define KEY_P __allegro_KEY_P
#define KEY_Q __allegro_KEY_Q
#define KEY_R __allegro_KEY_R
#define KEY_S __allegro_KEY_S
#define KEY_T __allegro_KEY_T
#define KEY_U __allegro_KEY_U
#define KEY_V __allegro_KEY_V
#define KEY_W __allegro_KEY_W
#define KEY_X __allegro_KEY_X
#define KEY_Y __allegro_KEY_Y
#define KEY_Z __allegro_KEY_Z
#define KEY_0 __allegro_KEY_0
#define KEY_1 __allegro_KEY_1
#define KEY_2 __allegro_KEY_2
#define KEY_3 __allegro_KEY_3
#define KEY_4 __allegro_KEY_4
#define KEY_5 __allegro_KEY_5
#define KEY_6 __allegro_KEY_6
#define KEY_7 __allegro_KEY_7
#define KEY_8 __allegro_KEY_8
#define KEY_9 __allegro_KEY_9
#define KEY_0_PAD __allegro_KEY_0_PAD
#define KEY_1_PAD __allegro_KEY_1_PAD
#define KEY_2_PAD __allegro_KEY_2_PAD
#define KEY_3_PAD __allegro_KEY_3_PAD
#define KEY_4_PAD __allegro_KEY_4_PAD
#define KEY_5_PAD __allegro_KEY_5_PAD
#define KEY_6_PAD __allegro_KEY_6_PAD
#define KEY_7_PAD __allegro_KEY_7_PAD
#define KEY_8_PAD __allegro_KEY_8_PAD
#define KEY_9_PAD __allegro_KEY_9_PAD
#define KEY_F1 __allegro_KEY_F1
#define KEY_F2 __allegro_KEY_F2
#define KEY_F3 __allegro_KEY_F3
#define KEY_F4 __allegro_KEY_F4
#define KEY_F5 __allegro_KEY_F5
#define KEY_F6 __allegro_KEY_F6
#define KEY_F7 __allegro_KEY_F7
#define KEY_F8 __allegro_KEY_F8
#define KEY_F9 __allegro_KEY_F9
#define KEY_F10 __allegro_KEY_F10
#define KEY_F11 __allegro_KEY_F11
#define KEY_F12 __allegro_KEY_F12
#define KEY_ESC __allegro_KEY_ESC
#define KEY_TILDE __allegro_KEY_TILDE
#define KEY_MINUS __allegro_KEY_MINUS
#define KEY_EQUALS __allegro_KEY_EQUALS
#define KEY_BACKSPACE __allegro_KEY_BACKSPACE
#define KEY_TAB __allegro_KEY_TAB
#define KEY_OPENBRACE __allegro_KEY_OPENBRACE
#define KEY_CLOSEBRACE __allegro_KEY_CLOSEBRACE
#define KEY_ENTER __allegro_KEY_ENTER
#define KEY_COLON __allegro_KEY_COLON
#define KEY_QUOTE __allegro_KEY_QUOTE
#define KEY_BACKSLASH __allegro_KEY_BACKSLASH
#define KEY_BACKSLASH2 __allegro_KEY_BACKSLASH2
#define KEY_COMMA __allegro_KEY_COMMA
#define KEY_STOP __allegro_KEY_STOP
#define KEY_SLASH __allegro_KEY_SLASH
#define KEY_SPACE __allegro_KEY_SPACE
#define KEY_INSERT __allegro_KEY_INSERT
#define KEY_DEL __allegro_KEY_DEL
#define KEY_HOME __allegro_KEY_HOME
#define KEY_END __allegro_KEY_END
#define KEY_PGUP __allegro_KEY_PGUP
#define KEY_PGDN __allegro_KEY_PGDN
#define KEY_LEFT __allegro_KEY_LEFT
#define KEY_RIGHT __allegro_KEY_RIGHT
#define KEY_UP __allegro_KEY_UP
#define KEY_DOWN __allegro_KEY_DOWN
#define KEY_SLASH_PAD __allegro_KEY_SLASH_PAD
#define KEY_ASTERISK __allegro_KEY_ASTERISK
#define KEY_MINUS_PAD __allegro_KEY_MINUS_PAD
#define KEY_PLUS_PAD __allegro_KEY_PLUS_PAD
#define KEY_DEL_PAD __allegro_KEY_DEL_PAD
#define KEY_ENTER_PAD __allegro_KEY_ENTER_PAD
#define KEY_PRTSCR __allegro_KEY_PRTSCR
#define KEY_PAUSE __allegro_KEY_PAUSE
#define KEY_ABNT_C1 __allegro_KEY_ABNT_C1
#define KEY_YEN __allegro_KEY_YEN
#define KEY_KANA __allegro_KEY_KANA
#define KEY_CONVERT __allegro_KEY_CONVERT
#define KEY_NOCONVERT __allegro_KEY_NOCONVERT
#define KEY_AT __allegro_KEY_AT
#define KEY_CIRCUMFLEX __allegro_KEY_CIRCUMFLEX
#define KEY_COLON2 __allegro_KEY_COLON2
#define KEY_KANJI __allegro_KEY_KANJI
#define KEY_EQUALS_PAD __allegro_KEY_EQUALS_PAD
#define KEY_BACKQUOTE __allegro_KEY_BACKQUOTE
#define KEY_SEMICOLON __allegro_KEY_SEMICOLON
#define KEY_COMMAND __allegro_KEY_COMMAND
#define KEY_UNKNOWN1 __allegro_KEY_UNKNOWN1
#define KEY_UNKNOWN2 __allegro_KEY_UNKNOWN2
#define KEY_UNKNOWN3 __allegro_KEY_UNKNOWN3
#define KEY_UNKNOWN4 __allegro_KEY_UNKNOWN4
#define KEY_UNKNOWN5 __allegro_KEY_UNKNOWN5
#define KEY_UNKNOWN6 __allegro_KEY_UNKNOWN6
#define KEY_UNKNOWN7 __allegro_KEY_UNKNOWN7
#define KEY_UNKNOWN8 __allegro_KEY_UNKNOWN8
#define KEY_MODIFIERS __allegro_KEY_MODIFIERS
#define KEY_LSHIFT __allegro_KEY_LSHIFT
#define KEY_RSHIFT __allegro_KEY_RSHIFT
#define KEY_LCONTROL __allegro_KEY_LCONTROL
#define KEY_RCONTROL __allegro_KEY_RCONTROL
#define KEY_ALT __allegro_KEY_ALT
#define KEY_ALTGR __allegro_KEY_ALTGR
#define KEY_LWIN __allegro_KEY_LWIN
#define KEY_RWIN __allegro_KEY_RWIN
#define KEY_MENU __allegro_KEY_MENU
#define KEY_SCRLOCK __allegro_KEY_SCRLOCK
#define KEY_NUMLOCK __allegro_KEY_NUMLOCK
#define KEY_CAPSLOCK __allegro_KEY_CAPSLOCK
#define KEY_MAX __allegro_KEY_MAX
#endif /* ALLEGRO_NO_KEY_DEFINES */
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_KEYBOARD_H */

View File

@ -1,45 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Compression routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_LZSS_H
#define ALLEGRO_LZSS_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct LZSS_PACK_DATA LZSS_PACK_DATA;
typedef struct LZSS_UNPACK_DATA LZSS_UNPACK_DATA;
AL_FUNC(LZSS_PACK_DATA *, create_lzss_pack_data, (void));
AL_FUNC(void, free_lzss_pack_data, (LZSS_PACK_DATA *dat));
AL_FUNC(int, lzss_write, (PACKFILE *file, LZSS_PACK_DATA *dat, int size, unsigned char *buf, int last));
AL_FUNC(LZSS_UNPACK_DATA *, create_lzss_unpack_data, (void));
AL_FUNC(void, free_lzss_unpack_data, (LZSS_UNPACK_DATA *dat));
AL_FUNC(int, lzss_read, (PACKFILE *file, LZSS_UNPACK_DATA *dat, int s, unsigned char *buf));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_LZSS_H */

View File

@ -1,94 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Matrix math routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_MATRIX_H
#define ALLEGRO_MATRIX_H
#include "base.h"
#include "fixed.h"
#include "fmaths.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct MATRIX /* transformation matrix (fixed point) */
{
fixed v[3][3]; /* scaling and rotation */
fixed t[3]; /* translation */
} MATRIX;
typedef struct MATRIX_f /* transformation matrix (floating point) */
{
float v[3][3]; /* scaling and rotation */
float t[3]; /* translation */
} MATRIX_f;
AL_VAR(MATRIX, identity_matrix);
AL_VAR(MATRIX_f, identity_matrix_f);
AL_FUNC(void, get_translation_matrix, (MATRIX *m, fixed x, fixed y, fixed z));
AL_FUNC(void, get_translation_matrix_f, (MATRIX_f *m, float x, float y, float z));
AL_FUNC(void, get_scaling_matrix, (MATRIX *m, fixed x, fixed y, fixed z));
AL_FUNC(void, get_scaling_matrix_f, (MATRIX_f *m, float x, float y, float z));
AL_FUNC(void, get_x_rotate_matrix, (MATRIX *m, fixed r));
AL_FUNC(void, get_x_rotate_matrix_f, (MATRIX_f *m, float r));
AL_FUNC(void, get_y_rotate_matrix, (MATRIX *m, fixed r));
AL_FUNC(void, get_y_rotate_matrix_f, (MATRIX_f *m, float r));
AL_FUNC(void, get_z_rotate_matrix, (MATRIX *m, fixed r));
AL_FUNC(void, get_z_rotate_matrix_f, (MATRIX_f *m, float r));
AL_FUNC(void, get_rotation_matrix, (MATRIX *m, fixed x, fixed y, fixed z));
AL_FUNC(void, get_rotation_matrix_f, (MATRIX_f *m, float x, float y, float z));
AL_FUNC(void, get_align_matrix, (MATRIX *m, fixed xfront, fixed yfront, fixed zfront, fixed xup, fixed yup, fixed zup));
AL_FUNC(void, get_align_matrix_f, (MATRIX_f *m, float xfront, float yfront, float zfront, float xup, float yup, float zup));
AL_FUNC(void, get_vector_rotation_matrix, (MATRIX *m, fixed x, fixed y, fixed z, fixed a));
AL_FUNC(void, get_vector_rotation_matrix_f, (MATRIX_f *m, float x, float y, float z, float a));
AL_FUNC(void, get_transformation_matrix, (MATRIX *m, fixed scale, fixed xrot, fixed yrot, fixed zrot, fixed x, fixed y, fixed z));
AL_FUNC(void, get_transformation_matrix_f, (MATRIX_f *m, float scale, float xrot, float yrot, float zrot, float x, float y, float z));
AL_FUNC(void, get_camera_matrix, (MATRIX *m, fixed x, fixed y, fixed z, fixed xfront, fixed yfront, fixed zfront, fixed xup, fixed yup, fixed zup, fixed fov, fixed aspect));
AL_FUNC(void, get_camera_matrix_f, (MATRIX_f *m, float x, float y, float z, float xfront, float yfront, float zfront, float xup, float yup, float zup, float fov, float aspect));
AL_FUNC(void, qtranslate_matrix, (MATRIX *m, fixed x, fixed y, fixed z));
AL_FUNC(void, qtranslate_matrix_f, (MATRIX_f *m, float x, float y, float z));
AL_FUNC(void, qscale_matrix, (MATRIX *m, fixed scale));
AL_FUNC(void, qscale_matrix_f, (MATRIX_f *m, float scale));
AL_FUNC(void, matrix_mul, (AL_CONST MATRIX *m1, AL_CONST MATRIX *m2, MATRIX *out));
AL_FUNC(void, matrix_mul_f, (AL_CONST MATRIX_f *m1, AL_CONST MATRIX_f *m2, MATRIX_f *out));
AL_FUNC(void, apply_matrix_f, (AL_CONST MATRIX_f *m, float x, float y, float z, float *xout, float *yout, float *zout));
#ifdef __cplusplus
}
#endif
#include "inline/matrix.inl"
#endif /* ifndef ALLEGRO_MATRIX_H */

View File

@ -1,138 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Mouse routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_MOUSE_H
#define ALLEGRO_MOUSE_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MOUSEDRV_AUTODETECT -1
#define MOUSEDRV_NONE 0
typedef struct MOUSE_DRIVER
{
int id;
AL_CONST char *name;
AL_CONST char *desc;
AL_CONST char *ascii_name;
AL_METHOD(int, init, (void));
AL_METHOD(void, exit, (void));
AL_METHOD(void, poll, (void));
AL_METHOD(void, timer_poll, (void));
AL_METHOD(void, position, (int x, int y));
AL_METHOD(void, set_range, (int x1, int y_1, int x2, int y2));
AL_METHOD(void, set_speed, (int xspeed, int yspeed));
AL_METHOD(void, get_mickeys, (int *mickeyx, int *mickeyy));
AL_METHOD(int, analyse_data, (AL_CONST char *buffer, int size));
AL_METHOD(void, enable_hardware_cursor, (int mode));
AL_METHOD(int, select_system_cursor, (int cursor));
} MOUSE_DRIVER;
AL_VAR(MOUSE_DRIVER, mousedrv_none);
AL_VAR(MOUSE_DRIVER *, mouse_driver);
AL_ARRAY(_DRIVER_INFO, _mouse_driver_list);
AL_FUNC(int, install_mouse, (void));
AL_FUNC(void, remove_mouse, (void));
AL_FUNC(int, poll_mouse, (void));
AL_FUNC(int, mouse_needs_poll, (void));
AL_FUNC(void, enable_hardware_cursor, (void));
AL_FUNC(void, disable_hardware_cursor, (void));
/* Mouse cursors */
enum {
MOUSE_CURSOR_NONE,
MOUSE_CURSOR_ALLEGRO,
MOUSE_CURSOR_ARROW,
MOUSE_CURSOR_BUSY,
MOUSE_CURSOR_QUESTION,
MOUSE_CURSOR_EDIT,
#ifdef ALLEGRO4_WITH_EXTRA_CURSORS
MOUSE_CURSOR_CROSS,
MOUSE_CURSOR_MOVE,
MOUSE_CURSOR_LINK,
MOUSE_CURSOR_FORBIDDEN,
MOUSE_CURSOR_SIZE_N,
MOUSE_CURSOR_SIZE_NE,
MOUSE_CURSOR_SIZE_E,
MOUSE_CURSOR_SIZE_SE,
MOUSE_CURSOR_SIZE_S,
MOUSE_CURSOR_SIZE_SW,
MOUSE_CURSOR_SIZE_W,
MOUSE_CURSOR_SIZE_NW,
MOUSE_CURSOR_SIZE_NS,
MOUSE_CURSOR_SIZE_WE,
#endif
AL_NUM_MOUSE_CURSORS
};
AL_VAR(struct BITMAP *, mouse_sprite);
AL_VAR(int, mouse_x_focus);
AL_VAR(int, mouse_y_focus);
AL_VAR(volatile int, mouse_x);
AL_VAR(volatile int, mouse_y);
AL_VAR(volatile int, mouse_z);
AL_VAR(volatile int, mouse_w);
AL_VAR(volatile int, mouse_b);
AL_VAR(volatile int, mouse_pos);
AL_VAR(volatile int, freeze_mouse_flag);
#define MOUSE_FLAG_MOVE 1
#define MOUSE_FLAG_LEFT_DOWN 2
#define MOUSE_FLAG_LEFT_UP 4
#define MOUSE_FLAG_RIGHT_DOWN 8
#define MOUSE_FLAG_RIGHT_UP 16
#define MOUSE_FLAG_MIDDLE_DOWN 32
#define MOUSE_FLAG_MIDDLE_UP 64
#define MOUSE_FLAG_MOVE_Z 128
#define MOUSE_FLAG_MOVE_W 256
AL_FUNCPTR(void, mouse_callback, (int flags));
AL_FUNC(void, show_mouse, (struct BITMAP *bmp));
AL_FUNC(void, scare_mouse, (void));
AL_FUNC(void, scare_mouse_area, (int x, int y, int w, int h));
AL_FUNC(void, unscare_mouse, (void));
AL_FUNC(void, position_mouse, (int x, int y));
AL_FUNC(void, position_mouse_z, (int z));
AL_FUNC(void, position_mouse_w, (int w));
AL_FUNC(void, set_mouse_range, (int x1, int y_1, int x2, int y2));
AL_FUNC(void, set_mouse_speed, (int xspeed, int yspeed));
AL_FUNC(void, select_mouse_cursor, (int cursor));
AL_FUNC(void, set_mouse_cursor_bitmap, (int cursor, struct BITMAP *bmp));
AL_FUNC(void, set_mouse_sprite_focus, (int x, int y));
AL_FUNC(void, get_mouse_mickeys, (int *mickeyx, int *mickeyy));
AL_FUNC(void, set_mouse_sprite, (struct BITMAP *sprite));
AL_FUNC(int, show_os_cursor, (int cursor));
AL_FUNC(int, mouse_on_screen, (void));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_MOUSE_H */

View File

@ -1,40 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Palette type.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_PALETTE_H
#define ALLEGRO_PALETTE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RGB
{
unsigned char r, g, b;
unsigned char filler;
} RGB;
#define PAL_SIZE 256
typedef RGB PALETTE[PAL_SIZE];
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_PALETTE_H */

View File

@ -1,256 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Some definitions for internal use by the Linux console code.
*
* By George Foot.
*
* See readme.txt for copyright information.
*/
#ifndef AINTLNX_H
#define AINTLNX_H
#ifdef __cplusplus
extern "C" {
#endif
/**************************************/
/************ Driver lists ************/
/**************************************/
extern _DRIVER_INFO _linux_gfx_driver_list[];
extern _DRIVER_INFO _linux_keyboard_driver_list[];
extern _DRIVER_INFO _linux_mouse_driver_list[];
extern _DRIVER_INFO _linux_timer_driver_list[];
/****************************************/
/************ Memory mapping ************/ /* (src/linux/lmemory.c) */
/****************************************/
/* struct MAPPED_MEMORY: Used to describe a block of memory mapped
* into our address space (in particular, the video memory).
*/
struct MAPPED_MEMORY {
unsigned int base, size; /* linear address and size of block */
int perms; /* PROT_READ | PROT_WRITE, etc */
void *data; /* pointer to block after mapping */
};
extern int __al_linux_have_ioperms;
int __al_linux_init_memory (void);
int __al_linux_shutdown_memory (void);
int __al_linux_map_memory (struct MAPPED_MEMORY *info);
int __al_linux_unmap_memory (struct MAPPED_MEMORY *info);
/******************************************/
/************ Standard drivers ************/ /* (src/linux/lstddrv.c) */
/******************************************/
/* This "standard drivers" business is mostly a historical artifact.
* It was highly over-engineered, now simplified. It has been mostly
* superseded by the newer, shinier, better bg_man. But hey, at least
* it didn't suffer the fate of its cousin lasyncio.c, now dead,
* buried, and without a tombstone to show for it. --pw
*/
typedef struct STD_DRIVER {
unsigned type; /* One of the below STD_ constants */
int (*update) (void);
void (*resume) (void);
void (*suspend) (void);
int fd; /* Descriptor of the opened device */
} STD_DRIVER;
#define STD_MOUSE 0
#define STD_KBD 1
#define N_STD_DRIVERS 2
/* List of standard drivers */
extern STD_DRIVER *__al_linux_std_drivers[];
/* Exported functions */
int __al_linux_add_standard_driver (STD_DRIVER *spec);
int __al_linux_remove_standard_driver (STD_DRIVER *spec);
void __al_linux_update_standard_drivers (int threaded);
void __al_linux_suspend_standard_drivers (void);
void __al_linux_resume_standard_drivers (void);
/******************************************/
/************ Console routines ************/ /* (src/linux/lconsole.c) */
/******************************************/
#define N_CRTC_REGS 24
#define N_ATC_REGS 21
#define N_GC_REGS 9
#define N_SEQ_REGS 5
#define MISC_REG_R 0x03CC
#define MISC_REG_W 0x03C2
#define ATC_REG_IW 0x03C0
#define ATC_REG_R 0x03C1
#define GC_REG_I 0x03CE
#define GC_REG_RW 0x03CF
#define SEQ_REG_I 0x03C4
#define SEQ_REG_RW 0x03C5
#define PEL_REG_IW 0x03C8
#define PEL_REG_IR 0x03C7
#define PEL_REG_D 0x03C9
#define _is1 0x03DA
#define ATC_DELAY 10 /* microseconds - for usleep() */
#define VGA_MEMORY_BASE 0xA0000
#define VGA_MEMORY_SIZE 0x10000
#define VGA_FONT_SIZE 0x02000
/* This structure is also used for video state saving/restoring, therefore it
* contains fields that are used only when saving/restoring the text mode. */
typedef struct MODE_REGISTERS
{
unsigned char crt[N_CRTC_REGS];
unsigned char seq[N_SEQ_REGS];
unsigned char atc[N_ATC_REGS];
unsigned char gc[N_GC_REGS];
unsigned char misc;
unsigned char *ext;
unsigned short ext_count;
unsigned char *text_font1;
unsigned char *text_font2;
unsigned long flags;
union {
unsigned char vga[768];
PALETTE allegro;
} palette;
} MODE_REGISTERS;
extern int __al_linux_vt;
extern int __al_linux_console_fd;
extern int __al_linux_prev_vt;
extern int __al_linux_got_text_message;
extern struct termios __al_linux_startup_termio;
extern struct termios __al_linux_work_termio;
int __al_linux_use_console (void);
int __al_linux_leave_console (void);
int __al_linux_console_graphics (void);
int __al_linux_console_text (void);
int __al_linux_wait_for_display (void);
/*************************************/
/************ VGA helpers ************/ /* (src/linux/lvgahelp.c) */
/*************************************/
int __al_linux_init_vga_helpers (void);
int __al_linux_shutdown_vga_helpers (void);
void __al_linux_screen_off (void);
void __al_linux_screen_on (void);
void __al_linux_clear_vram (void);
void __al_linux_set_vga_regs (MODE_REGISTERS *regs);
void __al_linux_get_vga_regs (MODE_REGISTERS *regs);
void __al_linux_save_gfx_mode (void);
void __al_linux_restore_gfx_mode (void);
void __al_linux_save_text_mode (void);
void __al_linux_restore_text_mode (void);
#define __just_a_moment() usleep(ATC_DELAY)
/**************************************/
/************ VT switching ************/ /* (src/linux/vtswitch.c) */
/**************************************/
/* signals for VT switching */
#define SIGRELVT SIGUSR1
#define SIGACQVT SIGUSR2
int __al_linux_init_vtswitch (void);
int __al_linux_done_vtswitch (void);
void __al_linux_acquire_bitmap (BITMAP *bmp);
void __al_linux_release_bitmap (BITMAP *bmp);
int __al_linux_set_display_switch_mode (int mode);
void __al_linux_display_switch_lock (int lock, int foreground);
extern volatile int __al_linux_switching_blocked;
/**************************************/
/************ Mode setting ************/ /* (src/linux/lgraph.c) */
/**************************************/
typedef struct GFX_MODE_INFO {
int w,h,c; /* width, height, colour depth */
int id; /* ID code, for driver's reference */
void *data; /* data for driver's use in setting the mode */
} GFX_MODE_INFO;
BITMAP *__al_linux_gfx_mode_set_helper (
int w, int h, int v_w, int v_h, int c,
GFX_DRIVER *driver, GFX_MODE_INFO *mode,
int (*set_video_mode) (GFX_MODE_INFO *mode),
void (*set_width) (int w)
);
/*******************************/
/************ Mouse ************/ /* (src/linux/lmouse.c) */
/*******************************/
typedef struct INTERNAL_MOUSE_DRIVER {
int device;
int (*process) (unsigned char *buf, int buf_size);
int num_buttons;
} INTERNAL_MOUSE_DRIVER;
int __al_linux_mouse_init (INTERNAL_MOUSE_DRIVER *drv);
void __al_linux_mouse_exit (void);
void __al_linux_mouse_position (int x, int y);
void __al_linux_mouse_set_range (int x1, int y_1, int x2, int y2);
void __al_linux_mouse_set_speed (int xspeed, int yspeed);
void __al_linux_mouse_get_mickeys (int *mickeyx, int *mickeyy);
void __al_linux_mouse_handler (int x, int y, int z, int b);
#ifdef __cplusplus
}
#endif
/* VGA register access helpers */
/* This is conditional because configure may have disabled VGA support */
#ifdef ALLEGRO_LINUX_VGA
#include "allegro/internal/aintern.h"
#include "allegro/internal/aintvga.h"
#endif
/* Functions for querying the framebuffer, for the fbcon driver */
#if (defined ALLEGRO_LINUX_FBCON) && (!defined ALLEGRO_WITH_MODULES)
extern int __al_linux_get_fb_color_depth(void);
extern int __al_linux_get_fb_resolution(int *width, int *height);
#endif
#endif /* ifndef AINTLNX_H */

View File

@ -1,198 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Internal header file for the MacOS X Allegro library port.
*
* By Angelo Mottola.
*
* See readme.txt for copyright information.
*/
#ifndef AINTOSX_H
#define AINTOSX_H
#ifdef __OBJC__
#include "allegro/platform/aintunix.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#ifndef NSAppKitVersionNumber10_1
#define NSAppKitVersionNumber10_1 620
#endif
#ifndef NSAppKitVersionNumber10_2
#define NSAppKitVersionNumber10_2 663
#endif
#define OSX_GFX_NONE 0
#define OSX_GFX_WINDOW 1
#define OSX_GFX_FULL 2
#define BMP_EXTRA(bmp) ((BMP_EXTRA_INFO *)((bmp)->extra))
#define HID_MAX_DEVICES MAX_JOYSTICKS
#define HID_MOUSE 0
#define HID_JOYSTICK 1
#define HID_GAMEPAD 2
#define HID_MAX_DEVICE_ELEMENTS ((MAX_JOYSTICK_AXIS * MAX_JOYSTICK_STICKS) + MAX_JOYSTICK_BUTTONS)
#define HID_ELEMENT_BUTTON 0
#define HID_ELEMENT_AXIS 1
#define HID_ELEMENT_AXIS_PRIMARY_X 2
#define HID_ELEMENT_AXIS_PRIMARY_Y 3
#define HID_ELEMENT_STANDALONE_AXIS 4
#define HID_ELEMENT_HAT 5
@interface AllegroAppDelegate : NSObject
- (void)applicationDidFinishLaunching: (NSNotification *)aNotification;
- (void)applicationDidChangeScreenParameters: (NSNotification *)aNotification;
+ (void)app_main: (id)arg;
- (NSApplicationTerminateReply) applicationShouldTerminate: (id)sender;
- (void) quitAction: (id) sender;
@end
@interface AllegroWindow : NSWindow
- (void)display;
- (void)miniaturize: (id)sender;
@end
@interface AllegroWindowDelegate : NSObject
- (BOOL)windowShouldClose: (id)sender;
- (void)windowDidDeminiaturize: (NSNotification *)aNotification;
- (void)windowDidResize: (NSNotification *)aNotification;
- (void)windowDidBecomeKey:(NSNotification *)notification;
- (void)windowDidResignKey:(NSNotification *)notification;
@end
@interface AllegroView: NSQuickDrawView
- (void)resetCursorRects;
@end
typedef void RETSIGTYPE;
typedef struct BMP_EXTRA_INFO
{
GrafPtr port;
} BMP_EXTRA_INFO;
typedef struct HID_ELEMENT
{
int type;
IOHIDElementCookie cookie;
int max, min;
int app;
int col;
int index;
char *name;
} HID_ELEMENT;
typedef struct HID_DEVICE
{
int type;
char *manufacturer;
char *product;
int num_elements;
int capacity;
HID_ELEMENT *element;
IOHIDDeviceInterface **interface;
int cur_app;
} HID_DEVICE;
typedef struct
{
int count;
int capacity;
HID_DEVICE* devices;
} HID_DEVICE_COLLECTION;
void osx_event_handler(void);
int osx_bootstrap_ok(void);
void setup_direct_shifts(void);
void osx_init_fade_system(void);
void osx_fade_screen(int fade_in, double seconds);
void osx_qz_blit_to_self(BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
void osx_qz_created_sub_bitmap(BITMAP *bmp, BITMAP *parent);
BITMAP *osx_qz_create_video_bitmap(int width, int height);
BITMAP *osx_qz_create_system_bitmap(int width, int height);
void osx_qz_destroy_video_bitmap(BITMAP *bmp);
int osx_setup_colorconv_blitter(void);
void osx_update_dirty_lines(void);
uintptr_t osx_qz_write_line(BITMAP *bmp, int lyne);
void osx_qz_unwrite_line(BITMAP *bmp);
void osx_qz_acquire(BITMAP *bmp);
void osx_qz_release(BITMAP *bmp);
void osx_keyboard_handler(int pressed, NSEvent *event);
void osx_keyboard_modifiers(unsigned int new_mods);
void osx_keyboard_focused(int focused, int state);
void osx_mouse_handler(int x, int y, int dx, int dy, int dz, int buttons);
int osx_mouse_set_sprite(BITMAP *sprite, int x, int y);
int osx_mouse_show(BITMAP *bmp, int x, int y);
void osx_mouse_hide(void);
void osx_mouse_move(int x, int y);
HID_DEVICE_COLLECTION *osx_hid_scan(int type, HID_DEVICE_COLLECTION*);
void osx_hid_free(HID_DEVICE_COLLECTION *);
AL_VAR(NSBundle *, osx_bundle);
AL_VAR(void *, osx_event_mutex);
AL_VAR(void *, osx_window_mutex);
AL_VAR(int, osx_gfx_mode);
AL_VAR(int, osx_screen_used);
AL_VAR(NSCursor *, osx_blank_cursor);
AL_VAR(NSCursor *, osx_cursor);
AL_VAR(AllegroWindow *, osx_window);
AL_ARRAY(char, osx_window_title);
AL_VAR(int, osx_window_first_expose);
AL_VAR(int, osx_skip_events_processing);
AL_VAR(void *, osx_skip_events_processing_mutex);
AL_VAR(CGDirectPaletteRef, osx_palette);
AL_VAR(int, osx_palette_dirty);
AL_VAR(int, osx_mouse_warped);
AL_VAR(int, osx_skip_mouse_move);
AL_VAR(int, osx_emulate_mouse_buttons);
AL_VAR(NSTrackingRectTag, osx_mouse_tracking_rect);
#endif
extern AL_METHOD(void, osx_window_close_hook, (void));
extern AL_METHOD(void, osx_resize_callback, (RESIZE_DISPLAY_EVENT *ev));
extern AL_METHOD(void, osx_mouse_enter_callback, (void));
extern AL_METHOD(void, osx_mouse_leave_callback, (void));
#endif
/* Local variables: */
/* mode: objc */
/* c-basic-offset: 3 */
/* indent-tabs-mode: nil */
/* End: */

View File

@ -1,179 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Some definitions for internal use by the Unix library code.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef AINTUNIX_H
#define AINTUNIX_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ALLEGRO_HAVE_LIBPTHREAD
/* Synchronization routines using POSIX threads */
AL_FUNC(void *, _unix_create_mutex, (void));
AL_FUNC(void, _unix_destroy_mutex, (void *handle));
AL_FUNC(void, _unix_lock_mutex, (void *handle));
AL_FUNC(void, _unix_unlock_mutex, (void *handle));
#else
/* Asynchronous event processing with SIGALRM */
AL_FUNC(void, _sigalrm_request_abort, (void));
AL_FUNCPTR(void, _sigalrm_timer_interrupt_handler, (unsigned long interval));
#endif
/* Macros to enable and disable interrupts */
#define DISABLE() _unix_bg_man->disable_interrupts()
#define ENABLE() _unix_bg_man->enable_interrupts()
/* Helper for locating config files */
AL_FUNC(int, _unix_find_resource, (char *dest, AL_CONST char *resource, int size));
/* Generic system driver entry for finding the executable */
AL_FUNC(void, _unix_get_executable_name, (char *output, int size));
/* Helper for setting os_type */
AL_FUNC(void, _unix_read_os_type, (void));
/* Helper for yield CPU */
AL_FUNC(void, _unix_yield_timeslice, (void));
/* Unix rest function */
AL_FUNC(void, _unix_rest, (unsigned int, AL_METHOD(void, callback, (void))));
/* Module support */
AL_FUNC(void, _unix_load_modules, (int system_driver_id));
AL_FUNC(void, _unix_unload_modules, (void));
/* Dynamic driver lists, for modules */
AL_VAR(_DRIVER_INFO *, _unix_gfx_driver_list);
AL_FUNC(void, _unix_driver_lists_init, (void));
AL_FUNC(void, _unix_driver_lists_shutdown, (void));
AL_FUNC(void, _unix_register_gfx_driver, (int id, GFX_DRIVER *driver, int autodetect, int priority));
/* Get size of a memory page in bytes */
AL_FUNC(size_t, _unix_get_page_size, (void));
#ifdef ALLEGRO_WITH_XWINDOWS
AL_FUNCPTR(void, _xwin_keyboard_interrupt, (int pressed, int code));
AL_FUNCPTR(void, _xwin_keyboard_focused, (int focused, int state));
AL_FUNCPTR(void, _xwin_mouse_interrupt, (int x, int y, int z, int w, int buttons));
AL_FUNCPTR(void, _xwin_timer_interrupt, (unsigned long interval));
AL_ARRAY(_DRIVER_INFO, _xwin_gfx_driver_list);
AL_ARRAY(_DRIVER_INFO, _xwin_keyboard_driver_list);
AL_ARRAY(_DRIVER_INFO, _xwin_mouse_driver_list);
AL_ARRAY(_DRIVER_INFO, _xwin_timer_driver_list);
AL_FUNC(void, _xwin_handle_input, (void));
AL_FUNC(void, _xwin_private_handle_input, (void));
#ifndef ALLEGRO_MULTITHREADED
AL_VAR(int, _xwin_missed_input);
#define XLOCK() \
do { \
_xwin.lock_count++; \
} while (0)
#define XUNLOCK() \
do { \
if (_xwin.lock_count == 1) { \
while(_xwin_missed_input) { \
if (_xwin_input_handler) \
_xwin_input_handler(); \
else \
_xwin_private_handle_input(); \
--_xwin_missed_input; \
} \
} \
_xwin.lock_count--; \
} while (0)
#else
#define XLOCK() \
do { \
if (_xwin.mutex) \
_unix_lock_mutex (_xwin.mutex); \
_xwin.lock_count++; \
} while (0)
#define XUNLOCK() \
do { \
if (_xwin.mutex) \
_unix_unlock_mutex (_xwin.mutex); \
_xwin.lock_count--; \
} while (0)
#endif
#endif
#ifdef __cplusplus
}
#endif
#ifdef ALLEGRO_LINUX
#include "aintlnx.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Typedef for background functions, called frequently in the background.
* `threaded' is nonzero if the function is being called from a thread.
*/
typedef void (*bg_func) (int threaded);
/* Background function manager -- responsible for calling background
* functions. `int' methods return -1 on failure, 0 on success. */
struct bg_manager
{
int multi_threaded;
int (*init) (void);
void (*exit) (void);
int (*register_func) (bg_func f);
int (*unregister_func) (bg_func f);
void (*enable_interrupts) (void);
void (*disable_interrupts) (void);
int (*interrupts_disabled) (void);
};
extern struct bg_manager _bg_man_pthreads;
extern struct bg_manager _bg_man_sigalrm;
extern struct bg_manager *_unix_bg_man;
#ifdef __cplusplus
}
#endif
#endif /* ifndef AINTUNIX_H */

View File

@ -1,158 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Some definitions for internal use by the Windows library code.
*
* By Stefan Schimanski.
*
* See readme.txt for copyright information.
*/
#ifndef AINTWIN_H
#define AINTWIN_H
#ifndef ALLEGRO_H
#error must include allegro.h first
#endif
#ifndef ALLEGRO_WINDOWS
#error bad include
#endif
#include "winalleg.h"
#ifndef SCAN_DEPEND
/* workaround for buggy MinGW32 headers */
#ifdef ALLEGRO_MINGW32
#ifndef HMONITOR_DECLARED
#define HMONITOR_DECLARED
#endif
#if (defined _HRESULT_DEFINED) && (defined WINNT)
#undef WINNT
#endif
#endif
#include <objbase.h> /* for LPGUID */
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* generals */
AL_VAR(HINSTANCE, allegro_inst);
AL_VAR(HANDLE, allegro_thread);
AL_VAR(CRITICAL_SECTION, allegro_critical_section);
AL_VAR(int, _dx_ver);
#define _enter_critical() EnterCriticalSection(&allegro_critical_section)
#define _exit_critical() LeaveCriticalSection(&allegro_critical_section)
AL_FUNC(int, init_directx_window, (void));
AL_FUNC(void, exit_directx_window, (void));
AL_FUNC(int, get_dx_ver, (void));
AL_FUNC(int, adjust_window, (int w, int h));
AL_FUNC(void, restore_window_style, (void));
AL_FUNC(void, save_window_pos, (void));
/* main window */
#define WND_TITLE_SIZE 128
AL_ARRAY(wchar_t, wnd_title);
AL_VAR(int, wnd_x);
AL_VAR(int, wnd_y);
AL_VAR(int, wnd_width);
AL_VAR(int, wnd_height);
AL_VAR(int, wnd_sysmenu);
AL_FUNCPTR(void, user_close_proc, (void));
AL_FUNCPTR(void, user_resize_proc, (RESIZE_DISPLAY_EVENT *ev));
/* gfx synchronization */
AL_VAR(CRITICAL_SECTION, gfx_crit_sect);
AL_VAR(int, gfx_crit_sect_nesting);
#define _enter_gfx_critical() EnterCriticalSection(&gfx_crit_sect); \
gfx_crit_sect_nesting++
#define _exit_gfx_critical() LeaveCriticalSection(&gfx_crit_sect); \
gfx_crit_sect_nesting--
#define GFX_CRITICAL_RELEASED (!gfx_crit_sect_nesting)
/* switch routines */
AL_VAR(int, _win_app_foreground);
AL_FUNC(void, sys_directx_display_switch_init, (void));
AL_FUNC(void, sys_directx_display_switch_exit, (void));
AL_FUNC(int, sys_directx_set_display_switch_mode, (int mode));
AL_FUNC(void, _win_switch_in, (void));
AL_FUNC(void, _win_switch_out, (void));
AL_FUNC(void, _win_reset_switch_mode, (void));
AL_FUNC(int, _win_thread_switch_out, (void));
/* main window routines */
AL_FUNC(int, wnd_call_proc, (int (*proc)(void)));
AL_FUNC(void, wnd_schedule_proc, (int (*proc)(void)));
/* keyboard routines */
AL_FUNC(void, _al_win_kbd_update_shifts, (void));
AL_FUNC(void, _al_win_kbd_handle_key_press, (int scode, int vcode, BOOL repeated));
AL_FUNC(void, _al_win_kbd_handle_key_release, (int vcode));
/* mouse routines */
AL_VAR(HCURSOR, _win_hcursor);
AL_FUNC(int, mouse_set_syscursor, (void));
AL_FUNC(void, _al_win_mouse_handle_button, (HWND hwnd, int button, BOOL down, int x, int y, BOOL abs));
AL_FUNC(void, _al_win_mouse_handle_wheel, (HWND hwnd, int z, BOOL abs));
AL_FUNC(void, _al_win_mouse_handle_move, (HWND hwnd, int x, int y));
/* thread routines */
AL_FUNC(void, _win_thread_init, (void));
AL_FUNC(void, _win_thread_exit, (void));
/* synchronization routines */
AL_FUNC(void *, sys_directx_create_mutex, (void));
AL_FUNC(void, sys_directx_destroy_mutex, (void *handle));
AL_FUNC(void, sys_directx_lock_mutex, (void *handle));
AL_FUNC(void, sys_directx_unlock_mutex, (void *handle));
/* file routines */
AL_VAR(int, _al_win_unicode_filenames);
/* error handling */
AL_FUNC(char* , win_err_str, (long err));
AL_FUNC(void, thread_safe_trace, (char *msg, ...));
#if DEBUGMODE >= 2
#define _TRACE thread_safe_trace
#else
#define _TRACE 1 ? (void) 0 : thread_safe_trace
#endif
#ifdef __cplusplus
}
#endif
#endif /* !defined AINTWIN_H */

View File

@ -1,401 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Inline functions (gcc style 386 asm).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#if (!defined ALLEGRO_GCC) || (!defined ALLEGRO_I386)
#error bad include
#endif
#ifdef ALLEGRO_IMPORT_GFX_ASM
/* _default_ds:
* Return a copy of the current %ds selector.
*/
AL_INLINE(int, _default_ds, (void),
{
short result;
__asm__ (
" movw %%ds, %0 "
: "=r" (result)
);
return result;
})
/* bmp_write_line:
* Bank switch function.
*/
AL_INLINE(uintptr_t, bmp_write_line, (BITMAP *bmp, int lyne),
{
uintptr_t result;
__asm__ volatile (
" call *%3 "
: "=a" (result) /* result in eax */
: "d" (bmp), /* bitmap in edx */
"0" (lyne), /* line number in eax */
"r" (bmp->write_bank) /* the bank switch routine */
);
return result;
})
/* bmp_read_line:
* Bank switch function.
*/
AL_INLINE(uintptr_t, bmp_read_line, (BITMAP *bmp, int lyne),
{
uintptr_t result;
__asm__ volatile (
" call *%3 "
: "=a" (result) /* result in eax */
: "d" (bmp), /* bitmap in edx */
"0" (lyne), /* line number in eax */
"r" (bmp->read_bank) /* the bank switch routine */
);
return result;
})
/* bmp_unwrite_line:
* Terminate bank switch function.
*/
AL_INLINE(void, bmp_unwrite_line, (BITMAP *bmp),
{
__asm__ volatile (
" call *%1 "
:
: "d" (bmp), /* bitmap in edx */
"r" (bmp->vtable->unwrite_bank) /* the bank switch routine */
);
})
#endif /* ALLEGRO_IMPORT_GFX_ASM */
#ifdef ALLEGRO_IMPORT_MATH_ASM
/* Helper macro that makes the compiler reduce fixadd(), fixsub(), fixmul() and
fixdiv() calls to a single constant if both operands are constant. Since
this doesn't work unless we compile with optimization, it's better to skip
the test then. */
#if (defined __OPTIMIZE__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
#define __PRECALCULATE_CONSTANTS(calc) \
if(__builtin_constant_p(x) && __builtin_constant_p(y)) { \
if((calc) > (double)0x7FFFFFFF) { \
*allegro_errno = ERANGE; \
return 0x7FFFFFFF; \
} \
else if(-(calc) > (double)0x7FFFFFFF) { \
*allegro_errno = ERANGE; \
return -0x7FFFFFFF; \
} \
else \
return (fixed)(calc); \
} \
else
#else
#define __PRECALCULATE_CONSTANTS(calc)
#endif
/* fixadd:
* Fixed point (16.16) addition.
*/
AL_INLINE(fixed, fixadd, (fixed x, fixed y),
{
fixed result;
__PRECALCULATE_CONSTANTS(x + (double)y)
{
__asm__ (
" addl %2, %0 ; " /* do the addition */
" jno 0f ; " /* check for overflow */
" movl %4, %0 ; " /* on overflow, set errno */
" movl %3, (%0) ; "
" movl $0x7FFFFFFF, %0 ; " /* and return MAXINT */
" cmpl $0, %2 ; "
" jg 0f ; "
" negl %0 ; "
" 0: " /* finished */
: "=r" (result) /* result in a register */
: "0" (x), /* x in the output register */
"rm" (y), /* y can go in register or memory */
"i" (ERANGE),
"m" (allegro_errno)
: "%cc", "memory" /* clobbers flags and errno */
);
return result;
}
})
/* fixsub:
* Fixed point (16.16) subtraction.
*/
AL_INLINE(fixed, fixsub, (fixed x, fixed y),
{
fixed result;
__PRECALCULATE_CONSTANTS(x - (double)y)
{
__asm__ (
" subl %2, %0 ; " /* do the subtraction */
" jno 0f ; " /* check for overflow */
" movl %4, %0 ; " /* on overflow, set errno */
" movl %3, (%0) ; "
" movl $0x7FFFFFFF, %0 ; " /* and return MAXINT */
" cmpl $0, %2 ; "
" jl 0f ; "
" negl %0 ; "
" 0: " /* finished */
: "=r" (result) /* result in a register */
: "0" (x), /* x in the output register */
"rm" (y), /* y can go in register or memory */
"i" (ERANGE),
"m" (allegro_errno)
: "%cc", "memory" /* clobbers flags and errno */
);
return result;
}
})
/* fixmul:
* Fixed point (16.16) multiplication.
*/
AL_INLINE(fixed, fixmul, (fixed x, fixed y),
{
fixed edx __attribute__ ((__unused__));
fixed result;
__PRECALCULATE_CONSTANTS(x / 65536.0 * y)
{
__asm__ (
" movl %2, %%eax ; "
" imull %3 ; " /* do the multiply */
" shrdl $16, %%edx, %%eax ; "
" sarl $15, %%edx ; " /* check for overflow */
" jz 0f ; "
" cmpl $-1, %%edx ; "
" je 0f ; "
" movl %5, %%eax ; " /* on overflow, set errno */
" movl %4, (%%eax) ; "
" movl $0x7FFFFFFF, %%eax ; " /* and return MAXINT */
" cmpl $0, %2 ; "
" jge 1f ; "
" negl %%eax ; "
" 1: "
" cmpl $0, %3 ; "
" jge 0f ; "
" negl %%eax ; "
" .balign 4, 0x90 ; "
" 0: " /* finished */
: "=&a" (result), /* the result has to go in eax */
"=&d" (edx) /* reliably reserve edx */
: "mr" (x), /* x and y can be regs or mem */
"mr" (y),
"i" (ERANGE),
"m" (allegro_errno)
: "%cc", "memory" /* clobbers flags and errno */
);
return result;
}
})
/* fixdiv:
* Fixed point (16.16) division.
*/
AL_INLINE(fixed, fixdiv, (fixed x, fixed y),
{
fixed edx __attribute__ ((__unused__));
fixed reg __attribute__ ((__unused__));
fixed result;
__PRECALCULATE_CONSTANTS(x * 65536.0 / y)
{
__asm__ (
" testl %%eax, %%eax ; " /* test sign of x */
" js 3f ; "
" testl %2, %2 ; " /* test sign of y */
" jns 4f ; "
" negl %2 ; "
" 0: " /* result will be negative */
" movl %%eax, %%edx ; " /* check the range is ok */
" shrl $16, %%edx ; "
" shll $16, %%eax ; "
" cmpl %2, %%edx ; "
" jae 1f ; "
" divl %2 ; " /* do the divide */
" testl %%eax, %%eax ; "
" jns 2f ; "
" 1: "
" movl %6, %%eax ; " /* on overflow, set errno */
" movl %5, (%%eax) ; "
" movl $0x7FFFFFFF, %%eax ; " /* and return MAXINT */
" 2: "
" negl %%eax ; " /* fix up the sign of the result */
" jmp 6f ; "
" .balign 4, 0x90 ; "
" 3: " /* x is negative */
" negl %%eax ; "
" testl %2, %2 ; " /* test sign of y */
" jns 0b ; "
" negl %2 ; "
" 4: " /* result will be positive */
" movl %%eax, %%edx ; " /* check the range is ok */
" shrl $16, %%edx ; "
" shll $16, %%eax ; "
" cmpl %2, %%edx ; "
" jae 5f ; "
" divl %2 ; " /* do the divide */
" testl %%eax, %%eax ; "
" jns 6f ; "
" 5: "
" movl %6, %%eax ; " /* on overflow, set errno */
" movl %5, (%%eax) ; "
" movl $0x7FFFFFFF, %%eax ; " /* and return MAXINT */
" 6: " /* finished */
: "=a" (result), /* the result has to go in eax */
"=&d" (edx), /* reliably reserve edx */
"=r" (reg) /* input operand will be clobbered */
: "0" (x), /* x in eax */
"2" (y), /* y in register */
"i" (ERANGE),
"m" (allegro_errno)
: "%cc", "memory" /* clobbers flags and memory */
);
return result;
}
})
/* fixfloor:
* Fixed point version of floor().
* Note that it returns an integer result (not a fixed one)
*/
AL_INLINE(int, fixfloor, (fixed x),
{
int result;
__asm__ (
" sarl $16, %0 " /* convert to int */
: "=r" (result) /* result in a register */
: "0" (x) /* x in the output register */
);
return result;
})
/* fixceil:
* Fixed point version of ceil().
* Note that it returns an integer result (not a fixed one)
*/
AL_INLINE(int, fixceil, (fixed x),
{
int result;
__asm__ (
" addl $0xFFFF, %0 ;" /* ceil () */
" jns 0f ;"
" jo 1f ;"
"0:"
" sarl $16, %0 ;" /* convert to int */
" jmp 2f ;"
"1:"
" movl %3, %0 ;" /* on overflow, set errno */
" movl %2, (%0) ;"
" movl $0x7FFF, %0 ;" /* and return large int */
"2:"
: "=r" (result) /* result in a register */
: "0" (x), /* x in the output register */
"i" (ERANGE),
"m" (allegro_errno)
: "%cc", "memory" /* clobbers flags and errno */
);
return result;
})
#undef __PRECALCULATE_CONSTANTS
#endif /* ALLEGRO_IMPORT_MATH_ASM */

View File

@ -1,268 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Inline functions (MSVC style 386 asm).
*
* By Stefan Schimanski.
*
* See readme.txt for copyright information.
*/
#if (!defined ALLEGRO_MSVC) || (!defined ALLEGRO_I386)
#error bad include
#endif
#pragma warning (disable: 4035)
#ifdef ALLEGRO_IMPORT_GFX_ASM
/* _default_ds:
* Return a copy of the current %ds selector.
*/
INLINE _AL_DLL int _default_ds(void)
{
_asm {
mov eax, 0
mov ax, ds
}
}
END_OF_INLINE(_default_ds);
/* bmp_write_line:
* Bank switch function.
*/
INLINE _AL_DLL uintptr_t bmp_write_line(BITMAP *bmp, int lyne)
{
_asm {
mov edx, bmp
mov ecx, [edx]BITMAP.write_bank
mov eax, lyne
call ecx
}
}
END_OF_INLINE(bmp_write_line);
/* bmp_read_line:
* Bank switch function.
*/
INLINE _AL_DLL uintptr_t bmp_read_line(BITMAP *bmp, int lyne)
{
_asm {
mov edx, bmp
mov ecx, [edx]BITMAP.read_bank
mov eax, lyne
call ecx
}
}
END_OF_INLINE(bmp_read_line);
/* bmp_unwrite_line:
* Terminate bank switch function.
*/
INLINE _AL_DLL void bmp_unwrite_line(BITMAP *bmp)
{
_asm {
mov edx, bmp
mov ecx, [edx]BITMAP.vtable
mov ecx, [ecx]GFX_VTABLE.unwrite_bank
call ecx
}
}
END_OF_INLINE(bmp_unwrite_line);
#endif /* ALLEGRO_IMPORT_GFX_ASM */
#ifdef ALLEGRO_IMPORT_MATH_ASM
/* _set_errno_erange:
*/
INLINE void _set_errno_erange(void)
{
*allegro_errno = ERANGE;
}
END_OF_INLINE(_set_errno_erange);
/* fixadd:
* Fixed point (16.16) addition.
*/
INLINE _AL_DLL fixed fixadd(fixed x, fixed y)
{
_asm {
mov eax, x
add eax, y
jno Out1
call _set_errno_erange
mov eax, 0x7FFFFFFF
cmp y, 0
jg Out1
neg eax
Out1:
}
}
END_OF_INLINE(fixadd);
/* fixsub:
* Fixed point (16.16) subtraction.
*/
INLINE _AL_DLL fixed fixsub(fixed x, fixed y)
{
_asm {
mov eax, x
sub eax, y
jno Out1
call _set_errno_erange
mov eax, 0x7FFFFFFF
cmp y, 0
jl Out1
neg eax
Out1:
}
}
END_OF_INLINE(fixsub);
/* fixmul:
* Fixed point (16.16) multiplication.
*/
INLINE _AL_DLL fixed fixmul(fixed x, fixed y)
{
_asm {
mov eax, x
imul y
shrd eax, edx, 16
sar edx, 15
jz Out2
cmp edx, -1
jz Out2
call _set_errno_erange
mov eax, 0x7FFFFFFF
cmp x, 0
jge Out1
neg eax
Out1:
cmp y, 0
jge Out2
neg eax
Out2:
}
}
END_OF_INLINE(fixmul);
/* fixdiv:
* Fixed point (16.16) division.
*/
INLINE _AL_DLL fixed fixdiv(fixed x, fixed y)
{
_asm {
mov ecx, y
xor ebx, ebx
mov eax, x
or eax, eax
jns Out1
neg eax
inc ebx
Out1:
or ecx, ecx
jns Out2
neg ecx
inc ebx
Out2:
mov edx, eax
shr edx, 0x10
shl eax, 0x10
cmp edx, ecx
jae Out3
div ecx
or eax, eax
jns Out4
Out3:
call _set_errno_erange
mov eax, 0x7FFFFFFF
Out4:
test ebx, 1
je Out5
neg eax
Out5:
}
}
END_OF_INLINE(fixdiv);
/* fixfloor :
* Fixed point version of floor().
* Note that it returns an integer result (not a fixed one)
*/
INLINE _AL_DLL int fixfloor(fixed x)
{
_asm {
mov eax, x
sar eax, 0x10
}
}
END_OF_INLINE(fixfloor);
/* fixceil:
* Fixed point version of ceil().
* Note that it returns an integer result (not a fixed one)
*/
INLINE _AL_DLL int fixceil(fixed x)
{
_asm {
mov eax, x
add eax, 0xFFFF
jns Out1
jo Out2
Out1:
sar eax, 0x10
jmp Out3
Out2:
call _set_errno_erange
mov eax, 0x7FFF
Out3:
}
}
END_OF_INLINE(fixceil);
#endif /* ALLEGRO_IMPORT_MATH_ASM */
#pragma warning (default: 4035)

View File

@ -1,98 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration defines for use with Mingw32.
*
* By Michael Rickmann.
*
* Native build version by Henrik Stokseth.
*
* See readme.txt for copyright information.
*/
#ifndef SCAN_DEPEND
#include <io.h>
#include <fcntl.h>
#include <direct.h>
#include <malloc.h>
#endif
/* a static auto config */
/* older mingw's don't seem to have inttypes.h */
/* #define ALLEGRO_HAVE_INTTYPES_H */
#ifndef ALLEGRO_HAVE_STDINT_H
#define ALLEGRO_HAVE_STDINT_H 1
#endif
/* describe this platform */
#ifdef ALLEGRO_STATICLINK
#define ALLEGRO_PLATFORM_STR "MinGW32.s"
#else
#define ALLEGRO_PLATFORM_STR "MinGW32"
#endif
#define ALLEGRO_WINDOWS
#define ALLEGRO_I386
#define ALLEGRO_LITTLE_ENDIAN
#define ALLEGRO_USE_CONSTRUCTOR
#define ALLEGRO_MULTITHREADED
#ifdef ALLEGRO_USE_CONSOLE
#define ALLEGRO_CONSOLE_OK
#define ALLEGRO_NO_MAGIC_MAIN
#endif
/* describe how function prototypes look to MINGW32 */
#if (defined ALLEGRO_STATICLINK) || (defined ALLEGRO_SRC)
#define _AL_DLL
#else
#define _AL_DLL __declspec(dllimport)
#endif
#define AL_VAR(type, name) extern _AL_DLL type name
#define AL_ARRAY(type, name) extern _AL_DLL type name[]
#define AL_FUNC(type, name, args) extern type name args
#define AL_METHOD(type, name, args) type (*name) args
#define AL_FUNCPTR(type, name, args) extern _AL_DLL type (*name) args
/* windows specific defines */
#if (defined ALLEGRO_SRC)
/* pathches to handle DX7 headers on a win9x system */
/* should WINNT be defined on win9x systems? */
#ifdef WINNT
#undef WINNT
#endif
/* defined in windef.h */
#ifndef HMONITOR_DECLARED
#define HMONITOR_DECLARED 1
#endif
#endif /* ALLEGRO_SRC */
/* another instance of missing constants in the mingw32 headers */
#ifndef ENUM_CURRENT_SETTINGS
#define ENUM_CURRENT_SETTINGS ((DWORD)-1)
#endif
/* describe the asm syntax for this platform */
#define ALLEGRO_ASM_PREFIX "_"
/* arrange for other headers to be included later on */
#define ALLEGRO_EXTRA_HEADER "allegro/platform/alwin.h"
#define ALLEGRO_INTERNAL_HEADER "allegro/platform/aintwin.h"
#define ALLEGRO_ASMCAPA_HEADER "obj/mingw32/asmcapa.h"

View File

@ -1,105 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration defines for use with MSVC.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef SCAN_DEPEND
#include <io.h>
#include <fcntl.h>
#include <direct.h>
#include <malloc.h>
#endif
#pragma warning (disable: 4200 4244 4305)
/* describe this platform */
#ifdef ALLEGRO_STATICLINK
#define ALLEGRO_PLATFORM_STR "MSVC.s"
#else
#define ALLEGRO_PLATFORM_STR "MSVC"
#endif
#define ALLEGRO_WINDOWS
#define ALLEGRO_I386
#define ALLEGRO_LITTLE_ENDIAN
#define ALLEGRO_GUESS_INTTYPES_OK
#define ALLEGRO_MULTITHREADED
#ifdef ALLEGRO_USE_CONSOLE
#define ALLEGRO_CONSOLE_OK
#define ALLEGRO_NO_MAGIC_MAIN
#endif
#ifdef ALLEGRO_AND_MFC
#define ALLEGRO_NO_MAGIC_MAIN
#endif
/* describe how function prototypes look to MSVC */
#if defined ALLEGRO_STATICLINK
#define _AL_DLL
#elif defined ALLEGRO_SRC
#define _AL_DLL __declspec(dllexport)
#else
#define _AL_DLL __declspec(dllimport)
#endif
#define AL_VAR(type, name) extern _AL_DLL type name
#define AL_ARRAY(type, name) extern _AL_DLL type name[]
#define AL_FUNC(type, name, args) _AL_DLL type __cdecl name args
#define AL_METHOD(type, name, args) type (__cdecl *name) args
#define AL_FUNCPTR(type, name, args) extern _AL_DLL type (__cdecl *name) args
#ifdef AL_INLINE
#define END_OF_INLINE(name) void *_force_instantiate_##name = name;
#else
#define END_OF_INLINE(name)
#endif
#undef AL_INLINE
#define AL_INLINE(type, name, args, code) __inline _AL_DLL type __cdecl name args code END_OF_INLINE(name)
#define INLINE __inline
#if _MSC_VER < 1700
#define LONG_LONG __int64
#define int64_t signed __int64
#define uint64_t unsigned __int64
#else
#define LONG_LONG long long
#endif
#define AL_CONST const
/* describe the asm syntax for this platform */
#define ALLEGRO_ASM_PREFIX "_"
/* life would be so easy if compilers would all use the same names! */
#if (!defined S_IRUSR) && (!defined SCAN_DEPEND)
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
#endif
/* arrange for other headers to be included later on */
#define ALLEGRO_EXTRA_HEADER "allegro/platform/alwin.h"
#define ALLEGRO_INTERNAL_HEADER "allegro/platform/aintwin.h"
#define ALLEGRO_ASMCAPA_HEADER "obj/msvc/asmcapa.h"

View File

@ -1,95 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* MacOS X specific header defines.
*
* By Angelo Mottola.
*
* See readme.txt for copyright information.
*/
#ifndef ALOSX_H
#define ALOSX_H
#ifndef ALLEGRO_MACOSX
#error bad include
#endif
#ifndef SCAN_DEPEND
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#if defined __OBJC__ && defined ALLEGRO_SRC
#undef TRUE
#undef FALSE
#import <mach/mach.h>
#import <mach/mach_error.h>
#import <AppKit/AppKit.h>
#import <ApplicationServices/ApplicationServices.h>
#import <Cocoa/Cocoa.h>
#import <IOKit/IOKitLib.h>
#import <IOKit/IOCFPlugIn.h>
#import <IOKit/hid/IOHIDLib.h>
#import <IOKit/hid/IOHIDKeys.h>
#import <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
#undef TRUE
#undef FALSE
#undef assert
#define TRUE -1
#define FALSE 0
#endif
#endif
/* The following code comes from alunix.h */
/* Magic to capture name of executable file */
extern int __crt0_argc;
extern char **__crt0_argv;
#ifndef ALLEGRO_NO_MAGIC_MAIN
#define ALLEGRO_MAGIC_MAIN
#define main _mangled_main
#undef END_OF_MAIN
#define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main;
#else
#undef END_OF_MAIN
#define END_OF_MAIN() void *_mangled_main_address;
#endif
/* System driver */
#define SYSTEM_MACOSX AL_ID('O','S','X',' ')
AL_VAR(SYSTEM_DRIVER, system_macosx);
/* Timer driver */
#define TIMERDRV_UNIX_PTHREADS AL_ID('P','T','H','R')
AL_VAR(TIMER_DRIVER, timerdrv_unix_pthreads);
/* Keyboard driver */
#define KEYBOARD_MACOSX AL_ID('O','S','X','K')
AL_VAR(KEYBOARD_DRIVER, keyboard_macosx);
/* Mouse driver */
#define MOUSE_MACOSX AL_ID('O','S','X','M')
AL_VAR(MOUSE_DRIVER, mouse_macosx);
/* Gfx drivers */
#define GFX_QUARTZ_WINDOW AL_ID('Q','Z','W','N')
#define GFX_QUARTZ_FULLSCREEN AL_ID('Q','Z','F','L')
AL_VAR(GFX_DRIVER, gfx_quartz_window);
AL_VAR(GFX_DRIVER, gfx_quartz_full);
#endif

View File

@ -1,65 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration defines for use with MacOS X.
*
* By Angelo Mottola.
*
* See readme.txt for copyright information.
*/
#ifndef ALOSXCFG_H
#define ALOSXCFG_H
/* Provide implementations of missing functions */
#define ALLEGRO_NO_STRICMP
#define ALLEGRO_NO_STRLWR
#define ALLEGRO_NO_STRUPR
/* Provide implementations of missing definitions */
#define O_BINARY 0
/* Override default definitions for this platform */
#define AL_RAND() ((rand() >> 16) & 0x7fff)
/* A static auto config */
#define ALLEGRO_HAVE_LIBPTHREAD 1
#define ALLEGRO_HAVE_DIRENT_H 1
#define ALLEGRO_HAVE_INTTYPES_H 1
#define ALLEGRO_HAVE_SYS_TIME_H 1
#define ALLEGRO_HAVE_SYS_STAT_H 1
#define ALLEGRO_HAVE_MKSTEMP 1
/* Describe this platform */
#define ALLEGRO_PLATFORM_STR "MacOS X"
#define ALLEGRO_CONSOLE_OK
#define ALLEGRO_USE_CONSTRUCTOR
#define ALLEGRO_MULTITHREADED
/* Endianesse - different between Intel and PPC based Mac's */
#ifdef __LITTLE_ENDIAN__
#define ALLEGRO_LITTLE_ENDIAN
#endif
#ifdef __BIG_ENDIAN__
#define ALLEGRO_BIG_ENDIAN
#endif
/* Exclude ASM */
#ifndef ALLEGRO_NO_ASM
#define ALLEGRO_NO_ASM
#endif
/* Arrange for other headers to be included later on */
#define ALLEGRO_EXTRA_HEADER "allegro/platform/alosx.h"
#endif

View File

@ -1,19 +0,0 @@
#cmakedefine ALLEGRO_BCC32
#cmakedefine ALLEGRO_BEOS
#cmakedefine ALLEGRO_DJGPP
#cmakedefine ALLEGRO_DMC
#cmakedefine ALLEGRO_HAIKU
#cmakedefine ALLEGRO_MACOSX
#cmakedefine ALLEGRO_MINGW32
#cmakedefine ALLEGRO_MPW
#cmakedefine ALLEGRO_MSVC
#cmakedefine ALLEGRO_PSP
#cmakedefine ALLEGRO_QNX
#cmakedefine ALLEGRO_UNIX
#cmakedefine ALLEGRO_WATCOM
#cmakedefine ALLEGRO_HAVE_STDINT_H
/* These are always defined now. */
#define ALLEGRO_NO_ASM
#define ALLEGRO_USE_C

View File

@ -1,64 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Configuration defines for use on Unix platforms.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include <fcntl.h>
#include <unistd.h>
/* Describe this platform. */
#define ALLEGRO_PLATFORM_STR "Unix"
#define ALLEGRO_CONSOLE_OK
#define ALLEGRO_VRAM_SINGLE_SURFACE
#define ALLEGRO_EXTRA_HEADER "allegro/platform/alunix.h"
#define ALLEGRO_INTERNAL_HEADER "allegro/platform/aintunix.h"
#ifndef O_BINARY
#define O_BINARY 0
#define O_TEXT 0
#endif
/* These defines will be provided by configure script. */
#undef ALLEGRO_COLOR8
#undef ALLEGRO_COLOR16
#undef ALLEGRO_COLOR24
#undef ALLEGRO_COLOR32
/* Include configuration generated by configure script. */
#include "allegro/platform/alunixac.h"
/* Enable multithreaded library */
#ifdef ALLEGRO_HAVE_LIBPTHREAD
#define ALLEGRO_MULTITHREADED
#endif
/* Provide implementations of missing functions. */
#ifndef ALLEGRO_HAVE_STRICMP
#define ALLEGRO_NO_STRICMP
#endif
#ifndef ALLEGRO_HAVE_STRLWR
#define ALLEGRO_NO_STRLWR
#endif
#ifndef ALLEGRO_HAVE_STRUPR
#define ALLEGRO_NO_STRUPR
#endif
#ifndef ALLEGRO_HAVE_MEMCMP
#define ALLEGRO_NO_MEMCMP
#endif

View File

@ -1,202 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Unix-specific header defines.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_UNIX
#error bad include
#endif
/* magic to capture name of executable file */
extern int __crt0_argc;
extern char **__crt0_argv;
#ifdef ALLEGRO_WITH_MAGIC_MAIN
#ifndef ALLEGRO_NO_MAGIC_MAIN
#define ALLEGRO_MAGIC_MAIN
#define main _mangled_main
#undef END_OF_MAIN
#define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main;
#else
#undef END_OF_MAIN
#define END_OF_MAIN() void *_mangled_main_address;
#endif
#endif
/**************************************/
/************ General Unix ************/
/**************************************/
#define TIMERDRV_UNIX_PTHREADS AL_ID('P','T','H','R')
#define TIMERDRV_UNIX_SIGALRM AL_ID('A','L','R','M')
#ifdef ALLEGRO_HAVE_LIBPTHREAD
AL_VAR(TIMER_DRIVER, timerdrv_unix_pthreads);
#else
AL_VAR(TIMER_DRIVER, timerdrv_unix_sigalrm);
#endif
/************************************/
/************ X-specific ************/
/************************************/
#define SYSTEM_XWINDOWS AL_ID('X','W','I','N')
#define KEYBOARD_XWINDOWS AL_ID('X','W','I','N')
#define MOUSE_XWINDOWS AL_ID('X','W','I','N')
#define GFX_XWINDOWS AL_ID('X','W','I','N')
#define GFX_XWINDOWS_FULLSCREEN AL_ID('X','W','F','S')
#define GFX_XDGA AL_ID('X','D','G','A')
#define GFX_XDGA_FULLSCREEN AL_ID('X','D','F','S')
#define GFX_XDGA2 AL_ID('D','G','A','2')
#define GFX_XDGA2_SOFT AL_ID('D','G','A','S')
#ifdef ALLEGRO_WITH_XWINDOWS
AL_VAR(SYSTEM_DRIVER, system_xwin);
#ifdef ALLEGRO_XWINDOWS_WITH_XF86DGA2
#ifndef ALLEGRO_WITH_MODULES
AL_VAR(GFX_DRIVER, gfx_xdga2);
AL_VAR(GFX_DRIVER, gfx_xdga2_soft);
#endif
#endif
#endif /* ALLEGRO_WITH_XWINDOWS */
/****************************************/
/************ Linux-specific ************/
/****************************************/
#define SYSTEM_LINUX AL_ID('L','N','X','C')
#define GFX_VGA AL_ID('V','G','A',' ')
#define GFX_MODEX AL_ID('M','O','D','X')
#define GFX_FBCON AL_ID('F','B',' ',' ')
#define GFX_VBEAF AL_ID('V','B','A','F')
#define GFX_SVGALIB AL_ID('S','V','G','A')
#define KEYDRV_LINUX AL_ID('L','N','X','C')
#define MOUSEDRV_LINUX_PS2 AL_ID('L','P','S','2')
#define MOUSEDRV_LINUX_IPS2 AL_ID('L','I','P','S')
#define MOUSEDRV_LINUX_GPMDATA AL_ID('G','P','M','D')
#define MOUSEDRV_LINUX_MS AL_ID('M','S',' ',' ')
#define MOUSEDRV_LINUX_IMS AL_ID('I','M','S',' ')
#define MOUSEDRV_LINUX_EVDEV AL_ID('E','V',' ',' ')
#define JOY_TYPE_LINUX_ANALOGUE AL_ID('L','N','X','A')
#ifdef ALLEGRO_LINUX
AL_VAR(SYSTEM_DRIVER, system_linux);
#ifdef ALLEGRO_LINUX_VGA
AL_VAR(GFX_DRIVER, gfx_vga);
AL_VAR(GFX_DRIVER, gfx_modex);
#define ALLEGRO_GFX_HAS_VGA
#endif
#ifndef ALLEGRO_WITH_MODULES
#ifdef ALLEGRO_LINUX_FBCON
AL_VAR(GFX_DRIVER, gfx_fbcon);
#endif
#ifdef ALLEGRO_LINUX_SVGALIB
AL_VAR(GFX_DRIVER, gfx_svgalib);
#endif
#endif
#ifdef ALLEGRO_LINUX_VBEAF
AL_VAR(GFX_DRIVER, gfx_vbeaf);
#define ALLEGRO_GFX_HAS_VBEAF
#endif
AL_VAR(MOUSE_DRIVER, mousedrv_linux_ps2);
AL_VAR(MOUSE_DRIVER, mousedrv_linux_ips2);
AL_VAR(MOUSE_DRIVER, mousedrv_linux_gpmdata);
AL_VAR(MOUSE_DRIVER, mousedrv_linux_ms);
AL_VAR(MOUSE_DRIVER, mousedrv_linux_ims);
AL_VAR(MOUSE_DRIVER, mousedrv_linux_evdev);
AL_FUNC_DEPRECATED(void, split_modex_screen, (int lyne));
/* Port I/O functions -- maybe these should be internal */
#ifdef ALLEGRO_LINUX_VGA
#ifdef __cplusplus
extern "C" {
#endif
static INLINE void outportb(unsigned short port, unsigned char value)
{
__asm__ volatile ("outb %0, %1" : : "a" (value), "d" (port));
}
static INLINE void outportw(unsigned short port, unsigned short value)
{
__asm__ volatile ("outw %0, %1" : : "a" (value), "d" (port));
}
static INLINE void outportl(unsigned short port, unsigned long value)
{
__asm__ volatile ("outl %0, %1" : : "a" (value), "d" (port));
}
static INLINE unsigned char inportb(unsigned short port)
{
unsigned char value;
__asm__ volatile ("inb %1, %0" : "=a" (value) : "d" (port));
return value;
}
static INLINE unsigned short inportw(unsigned short port)
{
unsigned short value;
__asm__ volatile ("inw %1, %0" : "=a" (value) : "d" (port));
return value;
}
static INLINE unsigned long inportl(unsigned short port)
{
unsigned long value;
__asm__ volatile ("inl %1, %0" : "=a" (value) : "d" (port));
return value;
}
#ifdef __cplusplus
}
#endif
#endif /* ALLEGRO_LINUX_VGA */
#endif /* ALLEGRO_LINUX */

View File

@ -1,178 +0,0 @@
/*
* Note that this file is no longer generated by autoheader as it results in
* too much namespace pollution. If you add define a new macro in
* configure.in or aclocal.m4, you must add an entry to this file.
*/
/* Define if you want support for n bpp modes. */
#cmakedefine ALLEGRO_COLOR8
#cmakedefine ALLEGRO_COLOR16
#cmakedefine ALLEGRO_COLOR24
#cmakedefine ALLEGRO_COLOR32
/*---------------------------------------------------------------------------*/
/* Define to 1 if you have the corresponding header file. */
#cmakedefine ALLEGRO_HAVE_DIRENT_H
#cmakedefine ALLEGRO_HAVE_INTTYPES_H
#cmakedefine ALLEGRO_HAVE_LINUX_AWE_VOICE_H
#cmakedefine ALLEGRO_HAVE_LINUX_INPUT_H
#cmakedefine ALLEGRO_HAVE_LINUX_JOYSTICK_H
#cmakedefine ALLEGRO_HAVE_LINUX_SOUNDCARD_H
#cmakedefine ALLEGRO_HAVE_MACHINE_SOUNDCARD_H
#cmakedefine ALLEGRO_HAVE_SOUNDCARD_H
#cmakedefine ALLEGRO_HAVE_SV_PROCFS_H
#cmakedefine ALLEGRO_HAVE_SYS_IO_H
#cmakedefine ALLEGRO_HAVE_SYS_SOUNDCARD_H
#cmakedefine ALLEGRO_HAVE_SYS_STAT_H
#cmakedefine ALLEGRO_HAVE_SYS_TIME_H
#cmakedefine ALLEGRO_HAVE_SYS_UTSNAME_H
/* Define to 1 if the corresponding functions are available. */
#cmakedefine ALLEGRO_HAVE_GETEXECNAME
#cmakedefine ALLEGRO_HAVE_MEMCMP
#cmakedefine ALLEGRO_HAVE_MKSTEMP
#cmakedefine ALLEGRO_HAVE_MMAP
#cmakedefine ALLEGRO_HAVE_MPROTECT
#cmakedefine ALLEGRO_HAVE_POSIX_MONOTONIC_CLOCK
#cmakedefine ALLEGRO_HAVE_SCHED_YIELD
#cmakedefine ALLEGRO_HAVE_STRICMP
#cmakedefine ALLEGRO_HAVE_STRLWR
#cmakedefine ALLEGRO_HAVE_STRUPR
#cmakedefine ALLEGRO_HAVE_SYSCONF
/* Define to 1 if procfs reveals argc and argv */
#cmakedefine ALLEGRO_HAVE_PROCFS_ARGCV
/*---------------------------------------------------------------------------*/
/* Define if target machine is little endian. */
#cmakedefine ALLEGRO_LITTLE_ENDIAN
/* Define if target machine is big endian. */
#cmakedefine ALLEGRO_BIG_ENDIAN
/* Define for Unix platforms, to use C convention for bank switching. */
#cmakedefine ALLEGRO_NO_ASM
/* Define if compiler prepends underscore to symbols. */
#cmakedefine ALLEGRO_ASM_PREFIX
/* Define if assembler supports MMX. */
#cmakedefine ALLEGRO_MMX
/* Define if assembler supports SSE. */
#cmakedefine ALLEGRO_SSE
/* Define if target platform is Darwin. */
#cmakedefine ALLEGRO_DARWIN
/* Define if you have the pthread library. */
#cmakedefine ALLEGRO_HAVE_LIBPTHREAD
/* Define if constructor attribute is supported. */
#cmakedefine ALLEGRO_USE_CONSTRUCTOR
/* Define if you need to use a magic main. */
#cmakedefine ALLEGRO_WITH_MAGIC_MAIN
/* Define if dynamically loaded modules are supported. */
#cmakedefine ALLEGRO_WITH_MODULES
/*---------------------------------------------------------------------------*/
/* Define if you need support for X-Windows. */
#cmakedefine ALLEGRO_WITH_XWINDOWS
/* Define if MIT-SHM extension is supported. */
#cmakedefine ALLEGRO_XWINDOWS_WITH_SHM
/* Define if XCursor ARGB extension is available. */
#cmakedefine ALLEGRO_XWINDOWS_WITH_XCURSOR
/* Define if DGA version 2.0 or newer is supported */
#cmakedefine ALLEGRO_XWINDOWS_WITH_XF86DGA2
/* Define if XF86VidMode extension is supported. */
#cmakedefine ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
/* Define if XIM extension is supported. */
#cmakedefine ALLEGRO_XWINDOWS_WITH_XIM
/* Define if xpm bitmap support is available. */
#cmakedefine ALLEGRO_XWINDOWS_WITH_XPM
/*---------------------------------------------------------------------------*/
/* Define if target platform is linux. */
#cmakedefine ALLEGRO_LINUX
/* Define to enable Linux console fbcon driver. */
#cmakedefine ALLEGRO_LINUX_FBCON
/* Define to enable Linux console SVGAlib driver. */
#cmakedefine ALLEGRO_LINUX_SVGALIB
/* Define if SVGAlib driver can check vga_version. */
#cmakedefine ALLEGRO_LINUX_SVGALIB_HAVE_VGA_VERSION
/* Define to enable Linux console VBE/AF driver. */
#cmakedefine ALLEGRO_LINUX_VBEAF
/* Define to enable Linux console VGA driver. */
#cmakedefine ALLEGRO_LINUX_VGA
/*---------------------------------------------------------------------------*/
/* Define to the installed ALSA version. */
#cmakedefine ALLEGRO_ALSA_VERSION @ALLEGRO_ALSA_VERSION@
/* Define if ALSA DIGI driver is supported. */
#cmakedefine ALLEGRO_WITH_ALSADIGI
/* Define if ALSA MIDI driver is supported. */
#cmakedefine ALLEGRO_WITH_ALSAMIDI
/* Define if aRts DIGI driver is supported. */
#cmakedefine ALLEGRO_WITH_ARTSDIGI
/* Define if ESD DIGI driver is supported. */
#cmakedefine ALLEGRO_WITH_ESDDIGI
/* Define if JACK DIGI driver is supported. */
#cmakedefine ALLEGRO_WITH_JACKDIGI
/* Define if OSS DIGI driver is supported. */
#cmakedefine ALLEGRO_WITH_OSSDIGI
/* Define if OSS MIDI driver is supported. */
#cmakedefine ALLEGRO_WITH_OSSMIDI
/* Define if SGI AL DIGI driver is supported. */
#cmakedefine ALLEGRO_WITH_SGIALDIGI
/*---------------------------------------------------------------------------*/
/* Define to (void *)-1, if MAP_FAILED is not defined. */
/* TODO: rename this */
#cmakedefine MAP_FAILED @MAP_FAILED@
/* Define as the return type of signal handlers (`int' or `void'). */
/* TODO: rename this */
/* XXX too lazy to configure this */
#define RETSIGTYPE void
/* Define to empty if `const' does not conform to ANSI C. */
#cmakedefine const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#cmakedefine inline
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#cmakedefine size_t
/*---------------------------------------------------------------------------*/
/* vi:set ft=c: */

View File

@ -1,177 +0,0 @@
/*
* Note that this file is no longer generated by autoheader as it results in
* too much namespace pollution. If you add define a new macro in
* configure.in or aclocal.m4, you must add an entry to this file.
*/
/* Define if you want support for n bpp modes. */
#undef ALLEGRO_COLOR8
#undef ALLEGRO_COLOR16
#undef ALLEGRO_COLOR24
#undef ALLEGRO_COLOR32
/*---------------------------------------------------------------------------*/
/* Define to 1 if you have the corresponding header file. */
#undef ALLEGRO_HAVE_DIRENT_H
#undef ALLEGRO_HAVE_INTTYPES_H
#undef ALLEGRO_HAVE_LINUX_AWE_VOICE_H
#undef ALLEGRO_HAVE_LINUX_INPUT_H
#undef ALLEGRO_HAVE_LINUX_JOYSTICK_H
#undef ALLEGRO_HAVE_LINUX_SOUNDCARD_H
#undef ALLEGRO_HAVE_MACHINE_SOUNDCARD_H
#undef ALLEGRO_HAVE_SOUNDCARD_H
#undef ALLEGRO_HAVE_STDINT_H
#undef ALLEGRO_HAVE_SV_PROCFS_H
#undef ALLEGRO_HAVE_SYS_IO_H
#undef ALLEGRO_HAVE_SYS_SOUNDCARD_H
#undef ALLEGRO_HAVE_SYS_STAT_H
#undef ALLEGRO_HAVE_SYS_TIME_H
#undef ALLEGRO_HAVE_SYS_UTSNAME_H
/* Define to 1 if the corresponding functions are available. */
#undef ALLEGRO_HAVE_GETEXECNAME
#undef ALLEGRO_HAVE_MEMCMP
#undef ALLEGRO_HAVE_MKSTEMP
#undef ALLEGRO_HAVE_MMAP
#undef ALLEGRO_HAVE_MPROTECT
#undef ALLEGRO_HAVE_SCHED_YIELD
#undef ALLEGRO_HAVE_STRICMP
#undef ALLEGRO_HAVE_STRLWR
#undef ALLEGRO_HAVE_STRUPR
#undef ALLEGRO_HAVE_SYSCONF
/* Define to 1 if procfs reveals argc and argv */
#undef ALLEGRO_HAVE_PROCFS_ARGCV
/*---------------------------------------------------------------------------*/
/* Define if target machine is little endian. */
#undef ALLEGRO_LITTLE_ENDIAN
/* Define if target machine is big endian. */
#undef ALLEGRO_BIG_ENDIAN
/* Define for Unix platforms, to use C convention for bank switching. */
#undef ALLEGRO_NO_ASM
/* Define if compiler prepends underscore to symbols. */
#undef ALLEGRO_ASM_PREFIX
/* Define if assembler supports MMX. */
#undef ALLEGRO_MMX
/* Define if assembler supports SSE. */
#undef ALLEGRO_SSE
/* Define if target platform is Darwin. */
#undef ALLEGRO_DARWIN
/* Define if you have the pthread library. */
#undef ALLEGRO_HAVE_LIBPTHREAD
/* Define if constructor attribute is supported. */
#undef ALLEGRO_USE_CONSTRUCTOR
/* Define if you need to use a magic main. */
#undef ALLEGRO_WITH_MAGIC_MAIN
/* Define if dynamically loaded modules are supported. */
#undef ALLEGRO_WITH_MODULES
/*---------------------------------------------------------------------------*/
/* Define if you need support for X-Windows. */
#undef ALLEGRO_WITH_XWINDOWS
/* Define if MIT-SHM extension is supported. */
#undef ALLEGRO_XWINDOWS_WITH_SHM
/* Define if XCursor ARGB extension is available. */
#undef ALLEGRO_XWINDOWS_WITH_XCURSOR
/* Define if DGA version 2.0 or newer is supported */
#undef ALLEGRO_XWINDOWS_WITH_XF86DGA2
/* Define if XF86VidMode extension is supported. */
#undef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
/* Define if XIM extension is supported. */
#undef ALLEGRO_XWINDOWS_WITH_XIM
/* Define if xpm bitmap support is available. */
#undef ALLEGRO_XWINDOWS_WITH_XPM
/*---------------------------------------------------------------------------*/
/* Define if target platform is linux. */
#undef ALLEGRO_LINUX
/* Define to enable Linux console fbcon driver. */
#undef ALLEGRO_LINUX_FBCON
/* Define to enable Linux console SVGAlib driver. */
#undef ALLEGRO_LINUX_SVGALIB
/* Define if SVGAlib driver can check vga_version. */
#undef ALLEGRO_LINUX_SVGALIB_HAVE_VGA_VERSION
/* Define to enable Linux console VBE/AF driver. */
#undef ALLEGRO_LINUX_VBEAF
/* Define to enable Linux console VGA driver. */
#undef ALLEGRO_LINUX_VGA
/*---------------------------------------------------------------------------*/
/* Define to the installed ALSA version. */
#undef ALLEGRO_ALSA_VERSION
/* Define if ALSA DIGI driver is supported. */
#undef ALLEGRO_WITH_ALSADIGI
/* Define if ALSA MIDI driver is supported. */
#undef ALLEGRO_WITH_ALSAMIDI
/* Define if aRts DIGI driver is supported. */
#undef ALLEGRO_WITH_ARTSDIGI
/* Define if ESD DIGI driver is supported. */
#undef ALLEGRO_WITH_ESDDIGI
/* Define if JACK DIGI driver is supported. */
#undef ALLEGRO_WITH_JACKDIGI
/* Define if OSS DIGI driver is supported. */
#undef ALLEGRO_WITH_OSSDIGI
/* Define if OSS MIDI driver is supported. */
#undef ALLEGRO_WITH_OSSMIDI
/* Define if SGI AL DIGI driver is supported. */
#undef ALLEGRO_WITH_SGIALDIGI
/*---------------------------------------------------------------------------*/
/* Define to (void *)-1, if MAP_FAILED is not defined. */
/* TODO: rename this */
#undef MAP_FAILED
/* Define as the return type of signal handlers (`int' or `void'). */
/* TODO: rename this */
#undef RETSIGTYPE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/*---------------------------------------------------------------------------*/
/* vi:set ft=c: */

View File

@ -1,90 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Windows-specific header defines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_WINDOWS
#error bad include
#endif
/*******************************************/
/********** magic main emulation ***********/
/*******************************************/
#ifdef __cplusplus
extern "C" {
#endif
AL_FUNC(int, _WinMain, (void *_main, void *hInst, void *hPrev, char *Cmd, int nShow));
#ifdef __cplusplus
}
#endif
#if (!defined ALLEGRO_NO_MAGIC_MAIN) && (!defined ALLEGRO_SRC)
#define ALLEGRO_MAGIC_MAIN
#define main _mangled_main
#undef END_OF_MAIN
/* disable strict pointer typing because of the vague prototype below */
#define NO_STRICT
#ifdef __cplusplus
extern "C" int __stdcall WinMain(void *hInst, void *hPrev, char *Cmd, int nShow);
#endif
#define END_OF_MAIN() \
\
int __stdcall WinMain(void *hInst, void *hPrev, char *Cmd, int nShow) \
{ \
return _WinMain((void *)_mangled_main, hInst, hPrev, Cmd, nShow); \
}
#endif
/*******************************************/
/************* system drivers **************/
/*******************************************/
#define SYSTEM_DIRECTX AL_ID('D','X',' ',' ')
AL_VAR(SYSTEM_DRIVER, system_directx);
/*******************************************/
/************** timer drivers **************/
/*******************************************/
#define TIMER_WIN32_HIGH_PERF AL_ID('W','3','2','H')
#define TIMER_WIN32_LOW_PERF AL_ID('W','3','2','L')
/*******************************************/
/*************** gfx drivers ***************/
/*******************************************/
#define GFX_DIRECTX AL_ID('D','X','A','C')
#define GFX_DIRECTX_WIN AL_ID('D','X','W','N')
AL_VAR(GFX_DRIVER, gfx_directx_win);
#define GFX_DRIVER_DIRECTX \
{ GFX_DIRECTX_WIN, &gfx_directx_win, TRUE },

View File

@ -1,49 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* A header file to get definitions of uint*_t and int*_t.
*
* By Peter Wang.
*
* See readme.txt for copyright information.
*/
#ifndef ASTDINT_H
#define ASTDINT_H
/* Please only include this file from include/allegro/internal/alconfig.h
* and don't add more than inttypes.h/stdint.h emulation here. Thanks.
*/
#if defined ALLEGRO_HAVE_INTTYPES_H
#include <inttypes.h>
#elif defined ALLEGRO_HAVE_STDINT_H
#include <stdint.h>
#elif defined ALLEGRO_I386 && defined ALLEGRO_LITTLE_ENDIAN
#ifndef ALLEGRO_GUESS_INTTYPES_OK
#warning Guessing the definitions of fixed-width integer types.
#endif
#define int8_t signed char
#define uint8_t unsigned char
#define int16_t signed short
#define uint16_t unsigned short
#define int32_t signed int
#define uint32_t unsigned int
#define intptr_t int32_t
#define uintptr_t uint32_t
#else
#error I dunno how to get the definitions of fixed-width integer types on your platform. Please report this to your friendly Allegro developer.
#endif
#endif /* ifndef ASTDINT_H */

View File

@ -1,58 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Quaternion routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_QUAT_H
#define ALLEGRO_QUAT_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct QUAT
{
float w, x, y, z;
} QUAT;
AL_VAR(QUAT, identity_quat);
AL_FUNC(void, quat_mul, (AL_CONST QUAT *p, AL_CONST QUAT *q, QUAT *out));
AL_FUNC(void, get_x_rotate_quat, (QUAT *q, float r));
AL_FUNC(void, get_y_rotate_quat, (QUAT *q, float r));
AL_FUNC(void, get_z_rotate_quat, (QUAT *q, float r));
AL_FUNC(void, get_rotation_quat, (QUAT *q, float x, float y, float z));
AL_FUNC(void, get_vector_rotation_quat, (QUAT *q, float x, float y, float z, float a));
AL_FUNC(void, apply_quat, (AL_CONST QUAT *q, float x, float y, float z, float *xout, float *yout, float *zout));
AL_FUNC(void, quat_slerp, (AL_CONST QUAT *from, AL_CONST QUAT *to, float t, QUAT *out, int how));
#define QUAT_SHORT 0
#define QUAT_LONG 1
#define QUAT_CW 2
#define QUAT_CCW 3
#define QUAT_USER 4
#define quat_interpolate(from, to, t, out) quat_slerp((from), (to), (t), (out), QUAT_SHORT)
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_QUAT_H */

View File

@ -1,47 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* RLE sprites.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_RLE_H
#define ALLEGRO_RLE_H
#include "base.h"
#include "gfx.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RLE_SPRITE /* a RLE compressed sprite */
{
int w, h; /* width and height in pixels */
int color_depth; /* color depth of the image */
int size; /* size of sprite data in bytes */
ZERO_SIZE_ARRAY(signed char, dat);
} RLE_SPRITE;
AL_FUNC(RLE_SPRITE *, get_rle_sprite, (struct BITMAP *bitmap));
AL_FUNC(void, destroy_rle_sprite, (RLE_SPRITE *sprite));
#ifdef __cplusplus
}
#endif
#include "inline/rle.inl"
#endif /* ifndef ALLEGRO_RLE_H */

View File

@ -1,258 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* System level: initialization, cleanup, etc.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_SYSTEM_H
#define ALLEGRO_SYSTEM_H
#include "base.h"
#include "unicode.h"
#include "config.h"
#ifdef __cplusplus
extern "C" {
#endif
struct RGB;
struct BITMAP;
struct GFX_VTABLE;
struct GFX_MODE;
typedef struct RESIZE_DISPLAY_EVENT
{
int old_w, old_h;
int new_w, new_h;
int is_maximized : 1; /* 1 if this event is because the user maximized the window */
int is_restored : 1; /* 1 if this event is because the user restored the window */
} RESIZE_DISPLAY_EVENT;
#define ALLEGRO_ERROR_SIZE 256
AL_ARRAY(char, allegro_id);
AL_ARRAY(char, allegro_error);
#define OSTYPE_UNKNOWN 0
#define OSTYPE_WIN3 AL_ID('W','I','N','3')
#define OSTYPE_WIN95 AL_ID('W','9','5',' ')
#define OSTYPE_WIN98 AL_ID('W','9','8',' ')
#define OSTYPE_WINME AL_ID('W','M','E',' ')
#define OSTYPE_WINNT AL_ID('W','N','T',' ')
#define OSTYPE_WIN2000 AL_ID('W','2','K',' ')
#define OSTYPE_WINXP AL_ID('W','X','P',' ')
#define OSTYPE_WIN2003 AL_ID('W','2','K','3')
#define OSTYPE_WINVISTA AL_ID('W','V','S','T')
#define OSTYPE_OS2 AL_ID('O','S','2',' ')
#define OSTYPE_WARP AL_ID('W','A','R','P')
#define OSTYPE_DOSEMU AL_ID('D','E','M','U')
#define OSTYPE_OPENDOS AL_ID('O','D','O','S')
#define OSTYPE_LINUX AL_ID('T','U','X',' ')
#define OSTYPE_SUNOS AL_ID('S','U','N',' ')
#define OSTYPE_FREEBSD AL_ID('F','B','S','D')
#define OSTYPE_NETBSD AL_ID('N','B','S','D')
#define OSTYPE_OPENBSD AL_ID('O','B','S','D')
#define OSTYPE_IRIX AL_ID('I','R','I','X')
#define OSTYPE_DARWIN AL_ID('D','A','R','W')
#define OSTYPE_QNX AL_ID('Q','N','X',' ')
#define OSTYPE_UNIX AL_ID('U','N','I','X')
#define OSTYPE_BEOS AL_ID('B','E','O','S')
#define OSTYPE_HAIKU AL_ID('H','A','I','K')
#define OSTYPE_MACOS AL_ID('M','A','C',' ')
#define OSTYPE_MACOSX AL_ID('M','A','C','X')
#define OSTYPE_PSP AL_ID('K','P','S','P')
AL_VAR(int, os_type);
AL_VAR(int, os_version);
AL_VAR(int, os_revision);
AL_VAR(int, os_multitasking);
#define SYSTEM_AUTODETECT 0
#define SYSTEM_NONE AL_ID('N','O','N','E')
#define MAKE_VERSION(a, b, c) (((a)<<16)|((b)<<8)|(c))
AL_FUNC(int, _install_allegro_version_check, (int system_id, int *errno_ptr,
AL_METHOD(int, atexit_ptr, (AL_METHOD(void, func, (void)))), int version));
AL_INLINE(int, install_allegro, (int system_id, int *errno_ptr,
AL_METHOD(int, atexit_ptr, (AL_METHOD(void, func, (void))))),
{
return _install_allegro_version_check(system_id, errno_ptr, atexit_ptr, \
MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION));
})
#define allegro_init() _install_allegro_version_check(SYSTEM_AUTODETECT, &errno, \
(int (*)(void (*)(void)))atexit, \
MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION))
AL_FUNC(void, allegro_exit, (void));
AL_PRINTFUNC(void, allegro_message, (AL_CONST char *msg, ...), 1, 2);
AL_FUNC(void, get_executable_name, (char *output, int size));
AL_FUNC(int, set_close_button_callback, (AL_METHOD(void, proc, (void))));
AL_FUNC(int, set_resize_callback, (AL_METHOD(void, proc, (RESIZE_DISPLAY_EVENT *ev))));
AL_FUNC(void, check_cpu, (void));
/* CPU Capabilities flags for x86 capable chips */
#define CPU_ID 0x0001
#define CPU_FPU 0x0002
#define CPU_MMX 0x0004
#define CPU_MMXPLUS 0x0008
#define CPU_SSE 0x0010
#define CPU_SSE2 0x0020
#define CPU_3DNOW 0x0040
#define CPU_ENH3DNOW 0x0080
#define CPU_CMOV 0x0100
#define CPU_AMD64 0x0200
#define CPU_IA64 0x0400
#define CPU_SSE3 0x0800
#define CPU_SSSE3 0x1000
#define CPU_SSE41 0x2000
#define CPU_SSE42 0x4000
/* CPU families - PC */
#define CPU_FAMILY_UNKNOWN 0
#define CPU_FAMILY_I386 3
#define CPU_FAMILY_I486 4
#define CPU_FAMILY_I586 5
#define CPU_FAMILY_I686 6
#define CPU_FAMILY_ITANIUM 7
#define CPU_FAMILY_EXTENDED 15
/* CPUID only returns 15 bits, we need extra information from the CPU */
/* model to identify Pentium IV, Xeon and Athlon 64 processors. */
/* CPU families - Power PC */
#define CPU_FAMILY_POWERPC 18
/* CPU models - PC */
/* 486 */
#define CPU_MODEL_I486DX 0
#define CPU_MODEL_I486DX50 1
#define CPU_MODEL_I486SX 2
#define CPU_MODEL_I487SX 3
#define CPU_MODEL_I486SL 4
#define CPU_MODEL_I486SX2 5
#define CPU_MODEL_I486DX2 7
#define CPU_MODEL_I486DX4 8
/* Intel/586 */
#define CPU_MODEL_PENTIUM 1
#define CPU_MODEL_PENTIUMP54C 2
#define CPU_MODEL_PENTIUMOVERDRIVE 3
#define CPU_MODEL_PENTIUMOVERDRIVEDX4 4
#define CPU_MODEL_CYRIX 14
#define CPU_MODEL_UNKNOWN 15
/* AMD/586 */
#define CPU_MODEL_K5 0
#define CPU_MODEL_K6 6
/* Intel/686 */
#define CPU_MODEL_PENTIUMPROA 0
#define CPU_MODEL_PENTIUMPRO 1
#define CPU_MODEL_PENTIUMIIKLAMATH 3
#define CPU_MODEL_PENTIUMII 5
#define CPU_MODEL_CELERON 6
#define CPU_MODEL_PENTIUMIIIKATMAI 7
#define CPU_MODEL_PENTIUMIIICOPPERMINE 8
#define CPU_MODEL_PENTIUMIIIMOBILE 9
/* AMD/686 */
#define CPU_MODEL_ATHLON 2
#define CPU_MODEL_DURON 3
/* Information when CPU_FAMILY is 15 */
#define CPU_MODEL_PENTIUMIV 0
#define CPU_MODEL_XEON 2
#define CPU_MODEL_ATHLON64 4
#define CPU_MODEL_OPTERON 5
/* Information for Power PC processors */
/* these defines are taken from <mach-o/machine.h> */
#define CPU_MODEL_POWERPC_601 1
#define CPU_MODEL_POWERPC_602 2
#define CPU_MODEL_POWERPC_603 3
#define CPU_MODEL_POWERPC_603e 4
#define CPU_MODEL_POWERPC_603ev 5
#define CPU_MODEL_POWERPC_604 6
#define CPU_MODEL_POWERPC_604e 7
#define CPU_MODEL_POWERPC_620 8
#define CPU_MODEL_POWERPC_750 9
#define CPU_MODEL_POWERPC_7400 10
#define CPU_MODEL_POWERPC_7450 11
AL_ARRAY(char, cpu_vendor);
AL_VAR(int, cpu_family);
AL_VAR(int, cpu_model);
AL_VAR(int, cpu_capabilities);
typedef struct SYSTEM_DRIVER
{
int id;
AL_CONST char *name;
AL_CONST char *desc;
AL_CONST char *ascii_name;
AL_METHOD(int, init, (void));
AL_METHOD(void, exit, (void));
AL_METHOD(void, get_executable_name, (char *output, int size));
AL_METHOD(int, find_resource, (char *dest, AL_CONST char *resource, int size));
AL_METHOD(void, set_window_title, (AL_CONST char *name));
AL_METHOD(int, set_close_button_callback, (AL_METHOD(void, proc, (void))));
AL_METHOD(int, set_resize_callback, (AL_METHOD(void, proc, (RESIZE_DISPLAY_EVENT *ev))));
AL_METHOD(void, message, (AL_CONST char *msg));
AL_METHOD(void, assert, (AL_CONST char *msg));
AL_METHOD(void, save_console_state, (void));
AL_METHOD(void, restore_console_state, (void));
AL_METHOD(struct BITMAP *, create_bitmap, (int color_depth, int width, int height));
AL_METHOD(void, created_bitmap, (struct BITMAP *bmp));
AL_METHOD(struct BITMAP *, create_sub_bitmap, (struct BITMAP *parent, int x, int y, int width, int height));
AL_METHOD(void, created_sub_bitmap, (struct BITMAP *bmp, struct BITMAP *parent));
AL_METHOD(int, destroy_bitmap, (struct BITMAP *bitmap));
AL_METHOD(void, read_hardware_palette, (void));
AL_METHOD(void, set_palette_range, (AL_CONST struct RGB *p, int from, int to, int retracesync));
AL_METHOD(struct GFX_VTABLE *, get_vtable, (int color_depth));
AL_METHOD(int, set_display_switch_mode, (int mode));
AL_METHOD(void, display_switch_lock, (int lock, int foreground));
AL_METHOD(int, desktop_color_depth, (void));
AL_METHOD(int, get_desktop_resolution, (int *width, int *height));
AL_METHOD(void, get_gfx_safe_mode, (int *driver, struct GFX_MODE *mode));
AL_METHOD(void, yield_timeslice, (void));
AL_METHOD(void *, create_mutex, (void));
AL_METHOD(void, destroy_mutex, (void *handle));
AL_METHOD(void, lock_mutex, (void *handle));
AL_METHOD(void, unlock_mutex, (void *handle));
AL_METHOD(_DRIVER_INFO *, gfx_drivers, (void));
AL_METHOD(_DRIVER_INFO *, keyboard_drivers, (void));
AL_METHOD(_DRIVER_INFO *, mouse_drivers, (void));
AL_METHOD(_DRIVER_INFO *, timer_drivers, (void));
} SYSTEM_DRIVER;
AL_VAR(SYSTEM_DRIVER, system_none);
AL_VAR(SYSTEM_DRIVER *, system_driver);
AL_ARRAY(_DRIVER_INFO, _system_driver_list);
#ifdef __cplusplus
}
#endif
#include "inline/system.inl"
#endif /* ifndef ALLEGRO_SYSTEM_H */

View File

@ -1,52 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Text output routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_TEXT_H
#define ALLEGRO_TEXT_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BITMAP;
struct FONT_VTABLE;
struct FONT;
AL_VAR(struct FONT *, font);
AL_VAR(int, allegro_404_char);
AL_FUNC(void, textout_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, AL_CONST char *str, int x, int y, int color, int bg));
AL_FUNC(void, textout_centre_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, AL_CONST char *str, int x, int y, int color, int bg));
AL_FUNC(void, textout_right_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, AL_CONST char *str, int x, int y, int color, int bg));
AL_FUNC(void, textout_justify_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, AL_CONST char *str, int x1, int x2, int y, int diff, int color, int bg));
AL_PRINTFUNC(void, textprintf_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, int x, int y, int color, int bg, AL_CONST char *format, ...), 7, 8);
AL_PRINTFUNC(void, textprintf_centre_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, int x, int y, int color, int bg, AL_CONST char *format, ...), 7, 8);
AL_PRINTFUNC(void, textprintf_right_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, int x, int y, int color, int bg, AL_CONST char *format, ...), 7, 8);
AL_PRINTFUNC(void, textprintf_justify_ex, (struct BITMAP *bmp, AL_CONST struct FONT *f, int x1, int x2, int y, int diff, int color, int bg, AL_CONST char *format, ...), 9, 10);
AL_FUNC(int, text_length, (AL_CONST struct FONT *f, AL_CONST char *str));
AL_FUNC(int, text_height, (AL_CONST struct FONT *f));
AL_FUNC(void, destroy_font, (struct FONT *f));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_TEXT_H */

View File

@ -1,75 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Timer routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_TIMER_H
#define ALLEGRO_TIMER_H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TIMERS_PER_SECOND 1193181L
#define SECS_TO_TIMER(x) ((long)(x) * TIMERS_PER_SECOND)
#define MSEC_TO_TIMER(x) ((long)(x) * (TIMERS_PER_SECOND / 1000))
#define BPS_TO_TIMER(x) (TIMERS_PER_SECOND / (long)(x))
#define BPM_TO_TIMER(x) ((60 * TIMERS_PER_SECOND) / (long)(x))
typedef struct TIMER_DRIVER
{
int id;
AL_CONST char *name;
AL_CONST char *desc;
AL_CONST char *ascii_name;
AL_METHOD(int, init, (void));
AL_METHOD(void, exit, (void));
AL_METHOD(int, install_int, (AL_METHOD(void, proc, (void)), long speed));
AL_METHOD(void, remove_int, (AL_METHOD(void, proc, (void))));
AL_METHOD(int, install_param_int, (AL_METHOD(void, proc, (void *param)), void *param, long speed));
AL_METHOD(void, remove_param_int, (AL_METHOD(void, proc, (void *param)), void *param));
AL_METHOD(int, can_simulate_retrace, (void));
AL_METHOD(void, simulate_retrace, (int enable));
AL_METHOD(void, rest, (unsigned int tyme, AL_METHOD(void, callback, (void))));
} TIMER_DRIVER;
AL_VAR(TIMER_DRIVER *, timer_driver);
AL_ARRAY(_DRIVER_INFO, _timer_driver_list);
AL_FUNC(int, install_timer, (void));
AL_FUNC(void, remove_timer, (void));
AL_FUNC(int, install_int_ex, (AL_METHOD(void, proc, (void)), long speed));
AL_FUNC(int, install_int, (AL_METHOD(void, proc, (void)), long speed));
AL_FUNC(void, remove_int, (AL_METHOD(void, proc, (void))));
AL_FUNC(int, install_param_int_ex, (AL_METHOD(void, proc, (void *param)), void *param, long speed));
AL_FUNC(int, install_param_int, (AL_METHOD(void, proc, (void *param)), void *param, long speed));
AL_FUNC(void, remove_param_int, (AL_METHOD(void, proc, (void *param)), void *param));
AL_VAR(volatile int, retrace_count);
AL_FUNC(void, rest, (unsigned int tyme));
AL_FUNC(void, rest_callback, (unsigned int tyme, AL_METHOD(void, callback, (void))));
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_TIMER_H */

View File

@ -1,114 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Unicode support routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_UNICODE__H
#define ALLEGRO_UNICODE__H
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
#define U_ASCII AL_ID('A','S','C','8')
#define U_ASCII_CP AL_ID('A','S','C','P')
#define U_UNICODE AL_ID('U','N','I','C')
#define U_UTF8 AL_ID('U','T','F','8')
#define U_CURRENT AL_ID('c','u','r','.')
AL_FUNC(void, set_uformat, (int type));
AL_FUNC(int, get_uformat, (void));
AL_FUNC(void, register_uformat, (int type, AL_METHOD(int, u_getc, (AL_CONST char *s)), AL_METHOD(int, u_getx, (char **s)), AL_METHOD(int, u_setc, (char *s, int c)), AL_METHOD(int, u_width, (AL_CONST char *s)), AL_METHOD(int, u_cwidth, (int c)), AL_METHOD(int, u_isok, (int c)), int u_width_max));
AL_FUNC(void, set_ucodepage, (AL_CONST unsigned short *table, AL_CONST unsigned short *extras));
AL_FUNC(int, need_uconvert, (AL_CONST char *s, int type, int newtype));
AL_FUNC(int, uconvert_size, (AL_CONST char *s, int type, int newtype));
AL_FUNC(void, do_uconvert, (AL_CONST char *s, int type, char *buf, int newtype, int size));
AL_FUNC(char *, uconvert, (AL_CONST char *s, int type, char *buf, int newtype, int size));
AL_FUNC(int, uwidth_max, (int type));
#define uconvert_ascii(s, buf) uconvert(s, U_ASCII, buf, U_CURRENT, sizeof(buf))
#define uconvert_toascii(s, buf) uconvert(s, U_CURRENT, buf, U_ASCII, sizeof(buf))
#define EMPTY_STRING "\0\0\0"
AL_ARRAY(char, empty_string);
AL_FUNCPTR(int, ugetc, (AL_CONST char *s));
AL_FUNCPTR(int, ugetx, (char **s));
AL_FUNCPTR(int, ugetxc, (AL_CONST char **s));
AL_FUNCPTR(int, usetc, (char *s, int c));
AL_FUNCPTR(int, uwidth, (AL_CONST char *s));
AL_FUNCPTR(int, ucwidth, (int c));
AL_FUNCPTR(int, uisok, (int c));
AL_FUNC(int, uoffset, (AL_CONST char *s, int idx));
AL_FUNC(int, ugetat, (AL_CONST char *s, int idx));
AL_FUNC(int, usetat, (char *s, int idx, int c));
AL_FUNC(int, uinsert, (char *s, int idx, int c));
AL_FUNC(int, uremove, (char *s, int idx));
AL_FUNC(int, utolower, (int c));
AL_FUNC(int, utoupper, (int c));
AL_FUNC(int, uisspace, (int c));
AL_FUNC(int, uisdigit, (int c));
AL_FUNC(int, ustrsize, (AL_CONST char *s));
AL_FUNC(int, ustrsizez, (AL_CONST char *s));
AL_FUNC(char *, _ustrdup, (AL_CONST char *src, AL_METHOD(void *, malloc_func, (size_t))));
AL_FUNC(char *, ustrzcpy, (char *dest, int size, AL_CONST char *src));
AL_FUNC(char *, ustrzcat, (char *dest, int size, AL_CONST char *src));
AL_FUNC(int, ustrlen, (AL_CONST char *s));
AL_FUNC(int, ustrcmp, (AL_CONST char *s1, AL_CONST char *s2));
AL_FUNC(char *, ustrzncpy, (char *dest, int size, AL_CONST char *src, int n));
AL_FUNC(char *, ustrzncat, (char *dest, int size, AL_CONST char *src, int n));
AL_FUNC(int, ustrncmp, (AL_CONST char *s1, AL_CONST char *s2, int n));
AL_FUNC(int, ustricmp, (AL_CONST char *s1, AL_CONST char *s2));
AL_FUNC(int, ustrnicmp, (AL_CONST char *s1, AL_CONST char *s2, int n));
AL_FUNC(char *, ustrlwr, (char *s));
AL_FUNC(char *, ustrupr, (char *s));
AL_FUNC(char *, ustrchr, (AL_CONST char *s, int c));
AL_FUNC(char *, ustrrchr, (AL_CONST char *s, int c));
AL_FUNC(char *, ustrstr, (AL_CONST char *s1, AL_CONST char *s2));
AL_FUNC(char *, ustrpbrk, (AL_CONST char *s, AL_CONST char *set));
AL_FUNC(char *, ustrtok, (char *s, AL_CONST char *set));
AL_FUNC(char *, ustrtok_r, (char *s, AL_CONST char *set, char **last));
AL_FUNC(double, uatof, (AL_CONST char *s));
AL_FUNC(long, ustrtol, (AL_CONST char *s, char **endp, int base));
AL_FUNC(double, ustrtod, (AL_CONST char *s, char **endp));
AL_FUNC(AL_CONST char *, ustrerror, (int err));
AL_PRINTFUNC(int, uszprintf, (char *buf, int size, AL_CONST char *format, ...), 3, 4);
AL_FUNC(int, uvszprintf, (char *buf, int size, AL_CONST char *format, va_list args));
AL_PRINTFUNC(int, usprintf, (char *buf, AL_CONST char *format, ...), 2, 3);
#ifndef ustrdup
#ifdef FORTIFY
#define ustrdup(src) _ustrdup(src, Fortify_malloc)
#else
#define ustrdup(src) _ustrdup(src, malloc)
#endif
#endif
#define ustrcpy(dest, src) ustrzcpy(dest, INT_MAX, src)
#define ustrcat(dest, src) ustrzcat(dest, INT_MAX, src)
#define ustrncpy(dest, src, n) ustrzncpy(dest, INT_MAX, src, n)
#define ustrncat(dest, src, n) ustrzncat(dest, INT_MAX, src, n)
#define uvsprintf(buf, format, args) uvszprintf(buf, INT_MAX, format, args)
#ifdef __cplusplus
}
#endif
#endif /* ifndef ALLEGRO_UNICODE__H */

View File

@ -1,27 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Linux header file for the Allegro library.
*
* This file no longer contains anything. At the moment,
* it exists only for backwards compatibility.
*
* See readme.txt for copyright information.
*/
#ifndef LIN_ALLEGRO_H
#define LIN_ALLEGRO_H
/*
* THIS IS AN EX-PARROT!!
*/
#endif /* ifndef LIN_ALLEGRO_H */

View File

@ -1,37 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Main header file for the MacOS X Allegro library port.
* Any OS X Allegro specific function is declared here.
*
* By Angelo Mottola.
*
* See readme.txt for copyright information.
*/
#ifndef OSX_ALLEGRO_H
#define OSX_ALLEGRO_H
#ifndef ALLEGRO_H
#error Please include allegro.h before osxalleg.h!
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,112 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Windows header file for the Allegro library.
*
* It must be included by Allegro programs that need to use
* direct Win32 API calls and by Win32 programs that need to
* interface with Allegro.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef WIN_ALLEGRO_H
#define WIN_ALLEGRO_H
#ifndef ALLEGRO_H
#error Please include allegro.h before winalleg.h!
#endif
#ifdef ALLEGRO_SRC
#define WIN32_LEAN_AND_MEAN /* to save compilation time */
#endif
/* bodges to avoid conflicts between Allegro and Windows */
#define BITMAP WINDOWS_BITMAP
#if (!defined SCAN_EXPORT) && (!defined SCAN_DEPEND)
#ifdef ALLEGRO_AND_MFC
#ifdef DEBUGMODE
#define AL_ASSERT(condition) { if (!(condition)) al_assert(__FILE__, __LINE__); }
#define AL_TRACE al_trace
#else
#define AL_ASSERT(condition)
#define AL_TRACE 1 ? (void) 0 : al_trace
#endif
#undef TRACE
#undef ASSERT
#include <afxwin.h>
#else
#include <windows.h>
#endif
#endif
#define WINDOWS_RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
#undef BITMAP
#undef RGB
/* Allegro's Win32 specific interface */
#ifdef __cplusplus
extern "C" {
#endif
/* external graphics driver support */
typedef struct WIN_GFX_DRIVER {
int has_backing_store;
AL_METHOD(void, switch_in, (void));
AL_METHOD(void, switch_out, (void));
AL_METHOD(void, enter_sysmode, (void));
AL_METHOD(void, exit_sysmode, (void));
AL_METHOD(void, move, (int x, int y, int w, int h));
AL_METHOD(void, iconify, (void));
AL_METHOD(void, paint, (RECT *rect));
} WIN_GFX_DRIVER;
AL_VAR(WIN_GFX_DRIVER *, win_gfx_driver);
/* external window support */
AL_FUNC(HWND, win_get_window, (void));
/* GDI to DirectDraw routines */
AL_FUNC(HDC, win_get_dc, (BITMAP *bmp));
AL_FUNC(void, win_release_dc, (BITMAP *bmp, HDC dc));
/* GDI routines */
AL_FUNC(void, set_gdi_color_format, (void));
AL_FUNC(void, set_palette_to_hdc, (HDC dc, PALETTE pal));
AL_FUNC(HPALETTE, convert_palette_to_hpalette, (PALETTE pal));
AL_FUNC(void, convert_hpalette_to_palette, (HPALETTE hpal, PALETTE pal));
AL_FUNC(HBITMAP, convert_bitmap_to_hbitmap, (BITMAP *bitmap));
AL_FUNC(BITMAP *, convert_hbitmap_to_bitmap, (HBITMAP bitmap));
AL_FUNC(void, draw_to_hdc, (HDC dc, BITMAP *bitmap, int x, int y));
AL_FUNC(void, blit_to_hdc, (BITMAP *bitmap, HDC dc, int src_x, int src_y, int dest_x, int dest_y, int w, int h));
AL_FUNC(void, stretch_blit_to_hdc, (BITMAP *bitmap, HDC dc, int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, int dest_w, int dest_h));
AL_FUNC(void, blit_from_hdc, (HDC dc, BITMAP *bitmap, int src_x, int src_y, int dest_x, int dest_y, int w, int h));
AL_FUNC(void, stretch_blit_from_hdc, (HDC hdc, BITMAP *bitmap, int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, int dest_w, int dest_h));
#ifdef __cplusplus
}
#endif
#endif /* ifndef WIN_ALLEGRO_H */

View File

@ -1,177 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* X header file for the Allegro library.
*
* This prototypes some things which might be useful to
* the calling application, but you don't need it.
*/
#ifndef X_ALLEGRO_H
#define X_ALLEGRO_H
#ifndef ALLEGRO_H
#error Please include allegro.h before xalleg.h!
#endif
#include "allegro/internal/aintern.h"
#include "allegro/platform/aintunix.h"
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#ifdef ALLEGRO_XWINDOWS_WITH_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#endif
#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
#include <X11/extensions/xf86vmode.h>
#endif
#ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* X-Windows resources used by the library. */
extern struct _xwin_type
{
Display *display;
volatile int lock_count;
int screen;
Window window;
GC gc;
Visual *visual;
Colormap colormap;
XImage *ximage;
#ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
XcursorImage *xcursor_image;
XcursorBool support_argb_cursor;
#endif
Cursor cursor;
int cursor_shape;
int hw_cursor_ok;
void (*screen_to_buffer)(int sx, int sy, int sw, int sh);
void (*set_colors)(AL_CONST PALETTE p, int from, int to);
unsigned char *screen_data;
unsigned char **screen_line;
unsigned char **buffer_line;
int scroll_x;
int scroll_y;
int window_width;
int window_height;
int window_depth;
int screen_width;
int screen_height;
int screen_depth;
int virtual_width;
int virtual_height;
int mouse_warped;
int keycode_to_scancode[256];
int matching_formats;
int fast_visual_depth;
int visual_is_truecolor;
int rsize;
int gsize;
int bsize;
int rshift;
int gshift;
int bshift;
unsigned long cmap[0x1000];
unsigned long rmap[0x100];
unsigned long gmap[0x100];
unsigned long bmap[0x100];
#ifdef ALLEGRO_XWINDOWS_WITH_SHM
XShmSegmentInfo shminfo;
#endif
int use_shm;
int in_dga_mode; /* 0=no, 2=DGA2 */
int keyboard_grabbed;
int mouse_grabbed;
#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
XF86VidModeModeInfo **modesinfo;
int num_modes;
int mode_switched; /* only kept around and set for ABI compat */
int override_redirected; /* no longer used, kept for ABI compat */
#endif
char window_title[1024];
char application_name[1024];
char application_class[1024];
int drawing_mode_ok;
#ifdef ALLEGRO_MULTITHREADED
void *mutex;
#endif
void (*close_button_callback)(void);
void (*resize_callback)(RESIZE_DISPLAY_EVENT *ev);
/* These are at the end of the struct to maintain ABI compatibility with
* allegro-4.2.0 (if and only if compiled with the same configuration).
* Notice that IMHO apps really should not be using _xwin, but we export it,
* so its fair game.
*/
#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
XF86VidModeModeInfo *orig_modeinfo;
#endif
/* Separate fullscreen and managed window id's, see
* _xwin_private_create_windo* in src/x/xwin.c for more details.
*/
Window fs_window;
Window wm_window;
} _xwin;
AL_FUNCPTR (int, _xwin_window_creator, (void));
AL_FUNCPTR (void, _xwin_window_defaultor, (void));
AL_FUNCPTR (void, _xwin_window_redrawer, (int, int, int, int));
AL_FUNCPTR (void, _xwin_input_handler, (void));
AL_FUNCPTR (void, _xwin_keyboard_callback, (int, int));
AL_FUNC(void, xwin_set_window_name, (AL_CONST char *name, AL_CONST char *group));
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,777 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Assorted globals and setup/cleanup routines.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "allegro.h"
#include "allegro/internal/aintern.h"
#define PREFIX_I "al-main INFO: "
#define PREFIX_W "al-main WARNING: "
#define PREFIX_E "al-main ERROR: "
#ifdef ALLEGRO_AMIGA
#define LOGFILE "RAM:allegro.log"
#else
#define LOGFILE "allegro.log"
#endif
/* in case you want to report version numbers */
char allegro_id[] = "Allegro " ALLEGRO_VERSION_STR ", " ALLEGRO_PLATFORM_STR;
/* error message for sound and gfx init routines */
char allegro_error[ALLEGRO_ERROR_SIZE] = EMPTY_STRING;
/* current system driver */
SYSTEM_DRIVER *system_driver = NULL;
/* error value, which will work even with DLL linkage */
int *allegro_errno = NULL;
/* flag for how many times we have been initialised */
int _allegro_count = 0;
/* flag to know whether we are being called by the exit mechanism */
int _allegro_in_exit = FALSE;
/* flag to decide whether to disable the screensaver */
int _screensaver_policy = FULLSCREEN_DISABLED;
/* the graphics driver currently in use */
GFX_DRIVER *gfx_driver = NULL;
/* abilities of the current graphics driver */
int gfx_capabilities = 0;
/* a bitmap structure for accessing the physical screen */
BITMAP *screen = NULL;
/* info about the current graphics drawing mode */
ALLEGRO_TLS int _drawing_mode = DRAW_MODE_SOLID;
ALLEGRO_TLS BITMAP *_drawing_pattern = NULL;
ALLEGRO_TLS int _drawing_x_anchor = 0;
ALLEGRO_TLS int _drawing_y_anchor = 0;
ALLEGRO_TLS unsigned int _drawing_x_mask = 0;
ALLEGRO_TLS unsigned int _drawing_y_mask = 0;
/* default palette structures */
PALETTE black_palette;
PALETTE _current_palette;
int _current_palette_changed = 0xFFFFFFFF;
PALETTE desktop_palette =
{
{ 63, 63, 63, 0 }, { 63, 0, 0, 0 }, { 0, 63, 0, 0 }, { 63, 63, 0, 0 },
{ 0, 0, 63, 0 }, { 63, 0, 63, 0 }, { 0, 63, 63, 0 }, { 16, 16, 16, 0 },
{ 31, 31, 31, 0 }, { 63, 31, 31, 0 }, { 31, 63, 31, 0 }, { 63, 63, 31, 0 },
{ 31, 31, 63, 0 }, { 63, 31, 63, 0 }, { 31, 63, 63, 0 }, { 0, 0, 0, 0 }
};
PALETTE default_palette =
{
{ 0, 0, 0, 0 }, { 0, 0, 42, 0 }, { 0, 42, 0, 0 }, { 0, 42, 42, 0 },
{ 42, 0, 0, 0 }, { 42, 0, 42, 0 }, { 42, 21, 0, 0 }, { 42, 42, 42, 0 },
{ 21, 21, 21, 0 }, { 21, 21, 63, 0 }, { 21, 63, 21, 0 }, { 21, 63, 63, 0 },
{ 63, 21, 21, 0 }, { 63, 21, 63, 0 }, { 63, 63, 21, 0 }, { 63, 63, 63, 0 },
{ 0, 0, 0, 0 }, { 5, 5, 5, 0 }, { 8, 8, 8, 0 }, { 11, 11, 11, 0 },
{ 14, 14, 14, 0 }, { 17, 17, 17, 0 }, { 20, 20, 20, 0 }, { 24, 24, 24, 0 },
{ 28, 28, 28, 0 }, { 32, 32, 32, 0 }, { 36, 36, 36, 0 }, { 40, 40, 40, 0 },
{ 45, 45, 45, 0 }, { 50, 50, 50, 0 }, { 56, 56, 56, 0 }, { 63, 63, 63, 0 },
{ 0, 0, 63, 0 }, { 16, 0, 63, 0 }, { 31, 0, 63, 0 }, { 47, 0, 63, 0 },
{ 63, 0, 63, 0 }, { 63, 0, 47, 0 }, { 63, 0, 31, 0 }, { 63, 0, 16, 0 },
{ 63, 0, 0, 0 }, { 63, 16, 0, 0 }, { 63, 31, 0, 0 }, { 63, 47, 0, 0 },
{ 63, 63, 0, 0 }, { 47, 63, 0, 0 }, { 31, 63, 0, 0 }, { 16, 63, 0, 0 },
{ 0, 63, 0, 0 }, { 0, 63, 16, 0 }, { 0, 63, 31, 0 }, { 0, 63, 47, 0 },
{ 0, 63, 63, 0 }, { 0, 47, 63, 0 }, { 0, 31, 63, 0 }, { 0, 16, 63, 0 },
{ 31, 31, 63, 0 }, { 39, 31, 63, 0 }, { 47, 31, 63, 0 }, { 55, 31, 63, 0 },
{ 63, 31, 63, 0 }, { 63, 31, 55, 0 }, { 63, 31, 47, 0 }, { 63, 31, 39, 0 },
{ 63, 31, 31, 0 }, { 63, 39, 31, 0 }, { 63, 47, 31, 0 }, { 63, 55, 31, 0 },
{ 63, 63, 31, 0 }, { 55, 63, 31, 0 }, { 47, 63, 31, 0 }, { 39, 63, 31, 0 },
{ 31, 63, 31, 0 }, { 31, 63, 39, 0 }, { 31, 63, 47, 0 }, { 31, 63, 55, 0 },
{ 31, 63, 63, 0 }, { 31, 55, 63, 0 }, { 31, 47, 63, 0 }, { 31, 39, 63, 0 },
{ 45, 45, 63, 0 }, { 49, 45, 63, 0 }, { 54, 45, 63, 0 }, { 58, 45, 63, 0 },
{ 63, 45, 63, 0 }, { 63, 45, 58, 0 }, { 63, 45, 54, 0 }, { 63, 45, 49, 0 },
{ 63, 45, 45, 0 }, { 63, 49, 45, 0 }, { 63, 54, 45, 0 }, { 63, 58, 45, 0 },
{ 63, 63, 45, 0 }, { 58, 63, 45, 0 }, { 54, 63, 45, 0 }, { 49, 63, 45, 0 },
{ 45, 63, 45, 0 }, { 45, 63, 49, 0 }, { 45, 63, 54, 0 }, { 45, 63, 58, 0 },
{ 45, 63, 63, 0 }, { 45, 58, 63, 0 }, { 45, 54, 63, 0 }, { 45, 49, 63, 0 },
{ 0, 0, 28, 0 }, { 7, 0, 28, 0 }, { 14, 0, 28, 0 }, { 21, 0, 28, 0 },
{ 28, 0, 28, 0 }, { 28, 0, 21, 0 }, { 28, 0, 14, 0 }, { 28, 0, 7, 0 },
{ 28, 0, 0, 0 }, { 28, 7, 0, 0 }, { 28, 14, 0, 0 }, { 28, 21, 0, 0 },
{ 28, 28, 0, 0 }, { 21, 28, 0, 0 }, { 14, 28, 0, 0 }, { 7, 28, 0, 0 },
{ 0, 28, 0, 0 }, { 0, 28, 7, 0 }, { 0, 28, 14, 0 }, { 0, 28, 21, 0 },
{ 0, 28, 28, 0 }, { 0, 21, 28, 0 }, { 0, 14, 28, 0 }, { 0, 7, 28, 0 },
{ 14, 14, 28, 0 }, { 17, 14, 28, 0 }, { 21, 14, 28, 0 }, { 24, 14, 28, 0 },
{ 28, 14, 28, 0 }, { 28, 14, 24, 0 }, { 28, 14, 21, 0 }, { 28, 14, 17, 0 },
{ 28, 14, 14, 0 }, { 28, 17, 14, 0 }, { 28, 21, 14, 0 }, { 28, 24, 14, 0 },
{ 28, 28, 14, 0 }, { 24, 28, 14, 0 }, { 21, 28, 14, 0 }, { 17, 28, 14, 0 },
{ 14, 28, 14, 0 }, { 14, 28, 17, 0 }, { 14, 28, 21, 0 }, { 14, 28, 24, 0 },
{ 14, 28, 28, 0 }, { 14, 24, 28, 0 }, { 14, 21, 28, 0 }, { 14, 17, 28, 0 },
{ 20, 20, 28, 0 }, { 22, 20, 28, 0 }, { 24, 20, 28, 0 }, { 26, 20, 28, 0 },
{ 28, 20, 28, 0 }, { 28, 20, 26, 0 }, { 28, 20, 24, 0 }, { 28, 20, 22, 0 },
{ 28, 20, 20, 0 }, { 28, 22, 20, 0 }, { 28, 24, 20, 0 }, { 28, 26, 20, 0 },
{ 28, 28, 20, 0 }, { 26, 28, 20, 0 }, { 24, 28, 20, 0 }, { 22, 28, 20, 0 },
{ 20, 28, 20, 0 }, { 20, 28, 22, 0 }, { 20, 28, 24, 0 }, { 20, 28, 26, 0 },
{ 20, 28, 28, 0 }, { 20, 26, 28, 0 }, { 20, 24, 28, 0 }, { 20, 22, 28, 0 },
{ 0, 0, 16, 0 }, { 4, 0, 16, 0 }, { 8, 0, 16, 0 }, { 12, 0, 16, 0 },
{ 16, 0, 16, 0 }, { 16, 0, 12, 0 }, { 16, 0, 8, 0 }, { 16, 0, 4, 0 },
{ 16, 0, 0, 0 }, { 16, 4, 0, 0 }, { 16, 8, 0, 0 }, { 16, 12, 0, 0 },
{ 16, 16, 0, 0 }, { 12, 16, 0, 0 }, { 8, 16, 0, 0 }, { 4, 16, 0, 0 },
{ 0, 16, 0, 0 }, { 0, 16, 4, 0 }, { 0, 16, 8, 0 }, { 0, 16, 12, 0 },
{ 0, 16, 16, 0 }, { 0, 12, 16, 0 }, { 0, 8, 16, 0 }, { 0, 4, 16, 0 },
{ 8, 8, 16, 0 }, { 10, 8, 16, 0 }, { 12, 8, 16, 0 }, { 14, 8, 16, 0 },
{ 16, 8, 16, 0 }, { 16, 8, 14, 0 }, { 16, 8, 12, 0 }, { 16, 8, 10, 0 },
{ 16, 8, 8, 0 }, { 16, 10, 8, 0 }, { 16, 12, 8, 0 }, { 16, 14, 8, 0 },
{ 16, 16, 8, 0 }, { 14, 16, 8, 0 }, { 12, 16, 8, 0 }, { 10, 16, 8, 0 },
{ 8, 16, 8, 0 }, { 8, 16, 10, 0 }, { 8, 16, 12, 0 }, { 8, 16, 14, 0 },
{ 8, 16, 16, 0 }, { 8, 14, 16, 0 }, { 8, 12, 16, 0 }, { 8, 10, 16, 0 },
{ 11, 11, 16, 0 }, { 12, 11, 16, 0 }, { 13, 11, 16, 0 }, { 15, 11, 16, 0 },
{ 16, 11, 16, 0 }, { 16, 11, 15, 0 }, { 16, 11, 13, 0 }, { 16, 11, 12, 0 },
{ 16, 11, 11, 0 }, { 16, 12, 11, 0 }, { 16, 13, 11, 0 }, { 16, 15, 11, 0 },
{ 16, 16, 11, 0 }, { 15, 16, 11, 0 }, { 13, 16, 11, 0 }, { 12, 16, 11, 0 },
{ 11, 16, 11, 0 }, { 11, 16, 12, 0 }, { 11, 16, 13, 0 }, { 11, 16, 15, 0 },
{ 11, 16, 16, 0 }, { 11, 15, 16, 0 }, { 11, 13, 16, 0 }, { 11, 12, 16, 0 },
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 63, 63, 63, 0 }
};
/* colors for the standard GUI dialogs (alerts, file selector, etc) */
int gui_fg_color = 255;
int gui_mg_color = 8;
int gui_bg_color = 0;
/* a block of temporary working memory */
void *_scratch_mem = NULL;
int _scratch_mem_size = 0;
/* SVGA bank switching tables */
int _last_bank_1 = -1;
int _last_bank_2 = -1;
int *_gfx_bank = NULL;
/* what OS are we running under? */
int os_type = OSTYPE_UNKNOWN;
int os_version = -1;
int os_revision = -1;
int os_multitasking = FALSE;
/* processor information */
char cpu_vendor[_AL_CPU_VENDOR_SIZE] = EMPTY_STRING;
int cpu_family = 0;
int cpu_model = 0;
int cpu_capabilities = 0;
/* debugging stuff */
static int debug_assert_virgin = TRUE;
static int debug_trace_virgin = TRUE;
static FILE *assert_file = NULL;
static FILE *trace_file = NULL;
static int (*assert_handler)(AL_CONST char *msg) = NULL;
int (*_al_trace_handler)(AL_CONST char *msg) = NULL;
/* Module linking system stuff: if an object file is linked in, then its
* constructor function is executed; this function should fill in the
* data structures below (declared in aintern.h). If the module is not
* linked in, then the structure pointers will be null, so we don't need
* to bother with that bit of code elsewhere.
*/
struct _AL_LINKER_MOUSE *_al_linker_mouse = NULL;
/* dynamic registration system for cleanup code */
struct al_exit_func {
void (*funcptr)(void);
AL_CONST char *desc;
struct al_exit_func *next;
};
static struct al_exit_func *exit_func_list = NULL;
/* _add_exit_func:
* Adds a function to the list that need to be called by allegro_exit().
* `desc' should point to a statically allocated string to help with
* debugging.
*/
void _add_exit_func(void (*func)(void), AL_CONST char *desc)
{
struct al_exit_func *n;
for (n = exit_func_list; n; n = n->next)
if (n->funcptr == func)
return;
n = _AL_MALLOC(sizeof(struct al_exit_func));
if (!n)
return;
n->next = exit_func_list;
n->funcptr = func;
n->desc = desc;
exit_func_list = n;
}
/* _remove_exit_func:
* Removes a function from the list that need to be called by allegro_exit().
*/
void _remove_exit_func(void (*func)(void))
{
struct al_exit_func *iter = exit_func_list, *prev = NULL;
while (iter) {
if (iter->funcptr == func) {
if (prev)
prev->next = iter->next;
else
exit_func_list = iter->next;
_AL_FREE(iter);
return;
}
prev = iter;
iter = iter->next;
}
}
/* allegro_exit_stub:
* Stub function registered by the library via atexit.
*/
static void allegro_exit_stub(void)
{
_allegro_in_exit = TRUE;
allegro_exit();
}
/* _install_allegro:
* Initialises the Allegro library, activating the system driver.
*/
static int _install_allegro(int system_id, int *errno_ptr, int (*atexit_ptr)(void (*func)(void)))
{
RGB black_rgb = {0, 0, 0, 0};
char tmp1[64], tmp2[64];
int i;
#ifndef ALLEGRO_USE_CONSTRUCTOR
/* call constructor functions manually */
extern void _initialize_datafile_types();
extern void _mouse_constructor();
_initialize_datafile_types();
_mouse_constructor();
_register_bitmap_file_type_init();
_register_font_file_type_init();
#endif
if (errno_ptr)
allegro_errno = errno_ptr;
else
allegro_errno = &errno;
/* set up default palette structures */
for (i=0; i<256; i++)
black_palette[i] = black_rgb;
for (i=16; i<256; i++)
desktop_palette[i] = desktop_palette[i & 15];
/* lock some important variables */
LOCK_VARIABLE(screen);
LOCK_VARIABLE(gfx_driver);
LOCK_VARIABLE(gfx_capabilities);
LOCK_VARIABLE(_last_bank_1);
LOCK_VARIABLE(_last_bank_2);
LOCK_VARIABLE(_gfx_bank);
LOCK_VARIABLE(_drawing_mode);
LOCK_VARIABLE(_drawing_pattern);
LOCK_VARIABLE(_drawing_x_anchor);
LOCK_VARIABLE(_drawing_y_anchor);
LOCK_VARIABLE(_drawing_x_mask);
LOCK_VARIABLE(_drawing_y_mask);
LOCK_VARIABLE(_current_palette);
LOCK_VARIABLE(os_type);
/* nasty stuff to set up the config system before the system driver */
system_driver = _system_driver_list[0].driver;
/* needed in case set_config_file was called before allegro_init */
_reload_config();
reload_config_texts(NULL);
if (system_id == SYSTEM_AUTODETECT)
system_id = get_config_id(uconvert_ascii("system", tmp1), uconvert_ascii("system", tmp2), SYSTEM_AUTODETECT);
system_driver = NULL;
/* initialise the system driver */
usetc(allegro_error, 0);
for (i=0; _system_driver_list[i].driver; i++) {
if ((_system_driver_list[i].id == system_id) ||
((_system_driver_list[i].autodetect) && (system_id == SYSTEM_AUTODETECT))) {
system_driver = _system_driver_list[i].driver;
system_driver->name = system_driver->desc = get_config_text(system_driver->ascii_name);
if (system_driver->init() != 0) {
system_driver = NULL;
if (system_id != SYSTEM_AUTODETECT)
break;
}
else
break;
}
}
if (!system_driver)
return -1;
/* disable close button */
set_close_button_callback(NULL);
/* disable resize */
set_resize_callback(NULL);
/* detect CPU type */
check_cpu();
#if defined(ALLEGRO_UNIX) || defined(ALLEGRO_WINDOWS)
/* detect filename encoding used by libc */
/* XXX This should be done for all platforms but I'm not set up to check
* that all platforms have been covered before making the 4.2.3 release.
* --pw
*/
_al_detect_filename_encoding();
#endif
/* set up screensaver policy */
_screensaver_policy = get_config_int(uconvert_ascii("system", tmp1),
uconvert_ascii("disable_screensaver", tmp2),
FULLSCREEN_DISABLED);
/* install shutdown handler */
if (_allegro_count == 0) {
if (atexit_ptr)
atexit_ptr(allegro_exit_stub);
}
_allegro_count++;
TRACE(PREFIX_I "Allegro initialised (instance %d)\n", _allegro_count);
return 0;
}
/* _install_allegro_version_check:
* Initialises the Allegro library, but return with an error if an
* incompatible version is found.
*/
int _install_allegro_version_check(int system_id, int *errno_ptr,
int (*atexit_ptr)(void (*func)(void)), int version)
{
int r = _install_allegro(system_id, errno_ptr, atexit_ptr);
int build_wip = version & 255;
int build_ver = version & ~255;
int version_ok;
if (r != 0) {
/* failed */
return r;
}
#if ALLEGRO_SUB_VERSION & 1
/* This is a WIP runtime, so enforce strict compatibility. */
version_ok = version == MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION);
#else
/* This is a stable runtime, so the runtime should be at least as new
* as the build headers (otherwise we may get a crash, since some
* functions may have been used which aren't available in this runtime).
*/
version_ok = (MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, 0) == build_ver) &&
(ALLEGRO_WIP_VERSION >= build_wip);
#endif
if (!version_ok) {
uszprintf(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text(
"The detected dynamic Allegro library (%d.%d.%d) is "
"not compatible with this program (%d.%d.%d)."),
ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION,
build_ver >> 16, (build_ver >> 8) & 255, build_wip);
return -1;
}
return 0;
}
/* allegro_exit:
* Closes down the Allegro system.
*/
void allegro_exit(void)
{
while (exit_func_list) {
void (*func)(void) = exit_func_list->funcptr;
_remove_exit_func(func);
(*func)();
}
if (system_driver) {
system_driver->exit();
system_driver = NULL;
}
if (_scratch_mem) {
_AL_FREE(_scratch_mem);
_scratch_mem = NULL;
_scratch_mem_size = 0;
}
}
/* allegro_message:
* Displays a message in whatever form the current platform requires.
*/
void allegro_message(AL_CONST char *msg, ...)
{
char *buf = _AL_MALLOC_ATOMIC(ALLEGRO_MESSAGE_SIZE);
char *tmp = _AL_MALLOC_ATOMIC(ALLEGRO_MESSAGE_SIZE);
va_list ap;
ASSERT(msg);
va_start(ap, msg);
uvszprintf(buf, ALLEGRO_MESSAGE_SIZE, msg, ap);
va_end(ap);
if ((system_driver) && (system_driver->message))
system_driver->message(buf);
else
fputs(uconvert(buf, U_CURRENT, tmp, U_ASCII_CP, ALLEGRO_MESSAGE_SIZE), stdout);
_AL_FREE(buf);
_AL_FREE(tmp);
}
/* get_executable_name:
* Finds out the name of the current executable.
*/
void get_executable_name(char *output, int size)
{
ASSERT(system_driver);
ASSERT(output);
if (system_driver->get_executable_name) {
system_driver->get_executable_name(output, size);
}
else {
output += usetc(output, '.');
output += usetc(output, '/');
usetc(output, 0);
}
}
/* set_close_button_callback:
* Installs a callback function to be called when the close button
* of the window or any equivalent device is activated. Returns 0 on
* success and -1 on failure (e.g. feature not supported).
*/
int set_close_button_callback(void (*proc)(void))
{
ASSERT(system_driver);
if (system_driver->set_close_button_callback)
return system_driver->set_close_button_callback(proc);
return -1;
}
/* set_resize_callback:
* Installs a callback function to be called when the window is
* resized.
*/
int set_resize_callback(void (*proc)(RESIZE_DISPLAY_EVENT *ev))
{
ASSERT(system_driver);
if (system_driver->set_resize_callback)
return system_driver->set_resize_callback(proc);
return -1;
}
/* debug_exit:
* Closes the debugging output files.
*/
static void debug_exit(void)
{
if (assert_file) {
fclose(assert_file);
assert_file = NULL;
}
if (trace_file) {
fclose(trace_file);
trace_file = NULL;
}
debug_assert_virgin = TRUE;
debug_trace_virgin = TRUE;
_remove_exit_func(debug_exit);
}
/* al_assert:
* Raises an assert (uses ASCII strings).
*/
void al_assert(AL_CONST char *file, int line)
{
static int asserted = FALSE;
int olderr = errno;
char buf[128];
char *s;
if (asserted)
return;
/* todo, some day: use snprintf (C99) */
sprintf(buf, "Assert failed at line %d of %s", line, file);
if (assert_handler) {
if (assert_handler(buf))
return;
}
if (debug_assert_virgin) {
s = getenv("ALLEGRO_ASSERT");
if (s)
assert_file = fopen(s, "w");
else
assert_file = NULL;
if (debug_trace_virgin)
_add_exit_func(debug_exit, "debug_exit");
debug_assert_virgin = FALSE;
}
if (assert_file) {
fprintf(assert_file, "%s\n", buf);
fflush(assert_file);
}
else {
asserted = TRUE;
if ((system_driver) && (system_driver->assert)) {
system_driver->assert(buf);
}
else {
allegro_exit();
fprintf(stderr, "%s\n", buf);
abort();
}
}
errno = olderr;
}
/* al_trace:
* Outputs a trace message (uses ASCII strings).
*/
void al_trace(AL_CONST char *msg, ...)
{
int olderr = errno;
char buf[512];
char *s;
/* todo, some day: use vsnprintf (C99) */
va_list ap;
va_start(ap, msg);
vsprintf(buf, msg, ap);
va_end(ap);
if (_al_trace_handler) {
if (_al_trace_handler(buf))
return;
}
if (debug_trace_virgin) {
s = getenv("ALLEGRO_TRACE");
if (s)
trace_file = fopen(s, "w");
else
trace_file = fopen(LOGFILE, "w");
if (debug_assert_virgin)
_add_exit_func(debug_exit, "debug_exit");
debug_trace_virgin = FALSE;
}
if (trace_file) {
fwrite(buf, sizeof(char), strlen(buf), trace_file);
fflush(trace_file);
}
errno = olderr;
}
/* register_assert_handler:
* Installs a user handler for assert failures.
*/
void register_assert_handler(int (*handler)(AL_CONST char *msg))
{
assert_handler = handler;
}
/* register_trace_handler:
* Installs a user handler for trace output.
*/
void register_trace_handler(int (*handler)(AL_CONST char *msg))
{
_al_trace_handler = handler;
}
/* _al_malloc:
* Wrapper for when a program needs to manipulate memory that has been
* allocated by the Allegro DLL.
*/
void *_al_malloc(size_t size)
{
return malloc(size);
}
/* _al_free:
* Wrapper for when a program needs to manipulate memory that has been
* allocated by the Allegro DLL.
*/
void _al_free(void *mem)
{
free(mem);
}
/* _al_realloc:
* Wrapper for when a program needs to manipulate memory that has been
* allocated by the Allegro DLL.
*/
void *_al_realloc(void *mem, size_t size)
{
return realloc(mem, size);
}
/* _al_strdup:
* Wrapper for when a program needs to duplicate a string in a way that
* uses any user overloaded memory allocation system in use.
* The result of this function _must_ be freed with _AL_FREE().
*/
char *_al_strdup(AL_CONST char *string)
{
char *newstring = _AL_MALLOC(strlen(string) + 1);
if (newstring)
strcpy(newstring, string);
return newstring;
}
/* a simple system driver for platform-independent code */
static int sys_none_init(void) { return 0; }
static void sys_none_exit(void) { }
static _DRIVER_INFO no_drivers[] = {{ 0, NULL, 0 }};
static _DRIVER_INFO *sys_no_driver(void) { return no_drivers; }
SYSTEM_DRIVER system_none =
{
SYSTEM_NONE,
empty_string,
empty_string,
"Agnostic",
sys_none_init,
sys_none_exit,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
sys_no_driver, sys_no_driver, sys_no_driver, sys_no_driver
};

View File

@ -1,760 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Blitting functions.
*
* By Shawn Hargreaves.
*
* Dithering code by James Hyman.
*
* Transparency preserving code by Elias Pschernig.
*
* See readme.txt for copyright information.
*/
#include <string.h>
#include "allegro.h"
#include "allegro/internal/aintern.h"
/* get_replacement_mask_color:
* Helper function to get a replacement color for the bitmap's mask color.
*/
static int get_replacement_mask_color(BITMAP *bmp)
{
int depth, c, g = 0;
depth = bitmap_color_depth(bmp);
if (depth == 8) {
if (rgb_map)
return rgb_map->data[31][1][31];
else
return bestfit_color(_current_palette, 63, 1, 63);
}
else {
do
c = makecol_depth(depth, 255, ++g, 255);
while (c == bitmap_mask_color(bmp));
return c;
}
}
/* blit_from_256:
* Expands 256 color images onto a truecolor destination.
*/
static void blit_from_256(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
#ifdef ALLEGRO_COLOR8
int *dest_palette_color;
uintptr_t s, d;
unsigned char *ss;
int x, y, c, rc;
/* lookup table avoids repeated color format conversions */
if (_color_conv & COLORCONV_KEEP_TRANS) {
dest_palette_color = _AL_MALLOC_ATOMIC(256*sizeof(int));
memcpy(dest_palette_color, _palette_expansion_table(bitmap_color_depth(dest)), 256*sizeof(int));
rc = get_replacement_mask_color(dest);
dest_palette_color[MASK_COLOR_8] = bitmap_mask_color(dest);
for (c=0; c<256; c++) {
if ((c != MASK_COLOR_8) &&
(dest_palette_color[c] == bitmap_mask_color(dest)))
dest_palette_color[c] = rc;
}
}
else
dest_palette_color = _palette_expansion_table(bitmap_color_depth(dest));
/* worker macro */
#define EXPAND_BLIT(bits, dsize) \
{ \
if (is_memory_bitmap(src)) { \
/* fast version when reading from memory bitmap */ \
bmp_select(dest); \
\
for (y=0; y<h; y++) { \
ss = src->line[s_y+y] + s_x; \
d = bmp_write_line(dest, d_y+y) + d_x*dsize; \
\
for (x=0; x<w; x++) { \
bmp_write##bits(d, dest_palette_color[*ss]); \
ss++; \
d += dsize; \
} \
} \
\
bmp_unwrite_line(dest); \
} \
else { \
/* slower version when reading from the screen */ \
for (y=0; y<h; y++) { \
s = bmp_read_line(src, s_y+y) + s_x; \
d = bmp_write_line(dest, d_y+y) + d_x*dsize; \
\
for (x=0; x<w; x++) { \
bmp_select(src); \
c = bmp_read8(s); \
\
bmp_select(dest); \
bmp_write##bits(d, dest_palette_color[c]); \
\
s++; \
d += dsize; \
} \
} \
\
bmp_unwrite_line(src); \
bmp_unwrite_line(dest); \
} \
}
/* expand the above macro for each possible output depth */
switch (bitmap_color_depth(dest)) {
#ifdef ALLEGRO_COLOR16
case 15:
case 16:
EXPAND_BLIT(16, sizeof(int16_t));
break;
#endif
#ifdef ALLEGRO_COLOR24
case 24:
EXPAND_BLIT(24, 3);
break;
#endif
#ifdef ALLEGRO_COLOR32
case 32:
EXPAND_BLIT(32, sizeof(int32_t));
break;
#endif
}
if (_color_conv & COLORCONV_KEEP_TRANS)
_AL_FREE(dest_palette_color);
#endif
}
/* worker macro for converting between two color formats, possibly with dithering */
#define CONVERT_BLIT_EX(sbits, ssize, dbits, dsize, MAKECOL) \
{ \
if (_color_conv & COLORCONV_KEEP_TRANS) { \
int rc = get_replacement_mask_color(dest); \
int src_mask = bitmap_mask_color(src); \
int dest_mask = bitmap_mask_color(dest); \
\
for (y=0; y<h; y++) { \
s = bmp_read_line(src, s_y+y) + s_x*ssize; \
d = bmp_write_line(dest, d_y+y) + d_x*dsize; \
\
for (x=0; x<w; x++) { \
bmp_select(src); \
c = bmp_read##sbits(s); \
\
if (c == src_mask) \
c = dest_mask; \
else { \
r = getr##sbits(c); \
g = getg##sbits(c); \
b = getb##sbits(c); \
c = MAKECOL; \
if (c == dest_mask) \
c = rc; \
} \
\
bmp_select(dest); \
bmp_write##dbits(d, c); \
\
s += ssize; \
d += dsize; \
} \
} \
} \
else { \
for (y=0; y<h; y++) { \
s = bmp_read_line(src, s_y+y) + s_x*ssize; \
d = bmp_write_line(dest, d_y+y) + d_x*dsize; \
\
for (x=0; x<w; x++) { \
bmp_select(src); \
c = bmp_read##sbits(s); \
\
r = getr##sbits(c); \
g = getg##sbits(c); \
b = getb##sbits(c); \
\
bmp_select(dest); \
bmp_write##dbits(d, MAKECOL); \
\
s += ssize; \
d += dsize; \
} \
} \
} \
\
bmp_unwrite_line(src); \
bmp_unwrite_line(dest); \
}
#define CONVERT_BLIT(sbits, ssize, dbits, dsize) \
CONVERT_BLIT_EX(sbits, ssize, dbits, dsize, makecol##dbits(r, g, b))
#define CONVERT_DITHER_BLIT(sbits, ssize, dbits, dsize) \
CONVERT_BLIT_EX(sbits, ssize, dbits, dsize, \
makecol##dbits##_dither(r, g, b, x, y))
#if (defined ALLEGRO_COLOR8) || (defined ALLEGRO_GFX_HAS_VGA)
/* dither_blit:
* Blits with Floyd-Steinberg error diffusion.
*/
static void dither_blit(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
int prev_drawmode = _drawing_mode;
int *errline[3];
int *errnextline[3];
int errpixel[3];
int v[3], e[3], n[3];
int x, y, i;
int c, nc, rc;
/* allocate memory for the error buffers */
for (i=0; i<3; i++) {
errline[i] = _AL_MALLOC_ATOMIC(sizeof(int) * w);
errnextline[i] = _AL_MALLOC_ATOMIC(sizeof(int) * w);
}
/* free the buffers if there was an error allocating one */
for (i=0; i<3; i++) {
if ((!errline[i]) || (!errnextline[i]))
goto getout;
}
/* initialize the error buffers */
for (i=0; i<3; i++) {
memset(errline[i], 0, sizeof(int) * w);
memset(errnextline[i], 0, sizeof(int) * w);
errpixel[i] = 0;
}
/* get the replacement color */
rc = get_replacement_mask_color(dest);
_drawing_mode = DRAW_MODE_SOLID;
/* dither!!! */
for (y =0; y<h; y++) {
for (x =0; x<w; x++) {
/* get the colour from the source bitmap */
c = getpixel(src, s_x+x, s_y+y);
v[0] = getr_depth(bitmap_color_depth(src), c);
v[1] = getg_depth(bitmap_color_depth(src), c);
v[2] = getb_depth(bitmap_color_depth(src), c);
/* add the error from previous pixels */
for (i=0; i<3; i++) {
n[i] = v[i] + errline[i][x] + errpixel[i];
if (n[i] > 255)
n[i] = 255;
if (n[i] < 0)
n[i] = 0;
}
/* find the nearest matching colour */
nc = makecol8(n[0], n[1], n[2]);
if (_color_conv & COLORCONV_KEEP_TRANS) {
if (c == bitmap_mask_color(src))
putpixel(dest, d_x+x, d_y+y, bitmap_mask_color(dest));
else if (nc == bitmap_mask_color(dest))
putpixel(dest, d_x+x, d_y+y, rc);
else
putpixel(dest, d_x+x, d_y+y, nc);
}
else {
putpixel(dest, d_x+x, d_y+y, nc);
}
v[0] = getr8(nc);
v[1] = getg8(nc);
v[2] = getb8(nc);
/* calculate the error and store it */
for (i=0; i<3; i++) {
e[i] = n[i] - v[i];
errpixel[i] = (int)((e[i] * 3)/8);
errnextline[i][x] += errpixel[i];
if (x != w-1)
errnextline[i][x+1] = (int)(e[i]/4);
}
}
/* update error buffers */
for (i=0; i<3; i++) {
memcpy(errline[i], errnextline[i], sizeof(int) * w);
memset(errnextline[i], 0, sizeof(int) * w);
}
}
_drawing_mode = prev_drawmode;
getout:
for (i=0; i<3; i++) {
if (errline[i])
_AL_FREE(errline[i]);
if (errnextline[i])
_AL_FREE(errnextline[i]);
}
}
#endif
/* blit_from_15:
* Converts 15 bpp images onto some other destination format.
*/
static void blit_from_15(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
#ifdef ALLEGRO_COLOR16
int x, y, c, r, g, b;
uintptr_t s, d;
switch (bitmap_color_depth(dest)) {
#ifdef ALLEGRO_COLOR8
case 8:
if (_color_conv & COLORCONV_DITHER_PAL)
dither_blit(src, dest, s_x, s_y, d_x, d_y, w, h);
else
CONVERT_BLIT(15, sizeof(int16_t), 8, 1)
break;
#endif
case 16:
CONVERT_BLIT(15, sizeof(int16_t), 16, sizeof(int16_t))
break;
#ifdef ALLEGRO_COLOR24
case 24:
CONVERT_BLIT(15, sizeof(int16_t), 24, 3)
break;
#endif
#ifdef ALLEGRO_COLOR32
case 32:
CONVERT_BLIT(15, sizeof(int16_t), 32, sizeof(int32_t))
break;
#endif
}
#endif
}
/* blit_from_16:
* Converts 16 bpp images onto some other destination format.
*/
static void blit_from_16(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
#ifdef ALLEGRO_COLOR16
int x, y, c, r, g, b;
uintptr_t s, d;
switch (bitmap_color_depth(dest)) {
#ifdef ALLEGRO_COLOR8
case 8:
if (_color_conv & COLORCONV_DITHER_PAL)
dither_blit(src, dest, s_x, s_y, d_x, d_y, w, h);
else
CONVERT_BLIT(16, sizeof(int16_t), 8, 1)
break;
#endif
case 15:
CONVERT_BLIT(16, sizeof(int16_t), 15, sizeof(int16_t))
break;
#ifdef ALLEGRO_COLOR24
case 24:
CONVERT_BLIT(16, sizeof(int16_t), 24, 3)
break;
#endif
#ifdef ALLEGRO_COLOR32
case 32:
CONVERT_BLIT(16, sizeof(int16_t), 32, sizeof(int32_t))
break;
#endif
}
#endif
}
/* blit_from_24:
* Converts 24 bpp images onto some other destination format.
*/
static void blit_from_24(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
#ifdef ALLEGRO_COLOR24
int x, y, c, r, g, b;
uintptr_t s, d;
switch (bitmap_color_depth(dest)) {
#ifdef ALLEGRO_COLOR8
case 8:
if (_color_conv & COLORCONV_DITHER_PAL)
dither_blit(src, dest, s_x, s_y, d_x, d_y, w, h);
else
CONVERT_BLIT(24, 3, 8, 1);
break;
#endif
#ifdef ALLEGRO_COLOR16
case 15:
if (_color_conv & COLORCONV_DITHER_HI)
CONVERT_DITHER_BLIT(24, 3, 15, sizeof(int16_t))
else
CONVERT_BLIT(24, 3, 15, sizeof(int16_t))
break;
case 16:
if (_color_conv & COLORCONV_DITHER_HI)
CONVERT_DITHER_BLIT(24, 3, 16, sizeof(int16_t))
else
CONVERT_BLIT(24, 3, 16, sizeof(int16_t))
break;
#endif
#ifdef ALLEGRO_COLOR32
case 32:
CONVERT_BLIT(24, 3, 32, sizeof(int32_t))
break;
#endif
}
#endif
}
/* blit_from_32:
* Converts 32 bpp images onto some other destination format.
*/
static void blit_from_32(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
#ifdef ALLEGRO_COLOR32
int x, y, c, r, g, b;
uintptr_t s, d;
switch (bitmap_color_depth(dest)) {
#ifdef ALLEGRO_COLOR8
case 8:
if (_color_conv & COLORCONV_DITHER_PAL)
dither_blit(src, dest, s_x, s_y, d_x, d_y, w, h);
else
CONVERT_BLIT(32, sizeof(int32_t), 8, 1)
break;
#endif
#ifdef ALLEGRO_COLOR16
case 15:
if (_color_conv & COLORCONV_DITHER_HI)
CONVERT_DITHER_BLIT(32, sizeof(int32_t), 15, sizeof(int16_t))
else
CONVERT_BLIT(32, sizeof(int32_t), 15, sizeof(int16_t))
break;
case 16:
if (_color_conv & COLORCONV_DITHER_HI)
CONVERT_DITHER_BLIT(32, sizeof(int32_t), 16, sizeof(int16_t))
else
CONVERT_BLIT(32, sizeof(int32_t), 16, sizeof(int16_t))
break;
#endif
#ifdef ALLEGRO_COLOR24
case 24:
CONVERT_BLIT(32, sizeof(int32_t), 24, 3)
break;
#endif
}
#endif
}
/* blit_to_or_from_modex:
* Converts between truecolor and planar mode-X bitmaps. This function is
* painfully slow, but I don't think it is something that people will need
* to do very often...
*/
static void blit_to_or_from_modex(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
#ifdef ALLEGRO_GFX_HAS_VGA
int x, y, c, r, g, b;
int src_depth = bitmap_color_depth(src);
int dest_depth = bitmap_color_depth(dest);
int prev_drawmode = _drawing_mode;
_drawing_mode = DRAW_MODE_SOLID;
if ((src_depth != 8) && (_color_conv & COLORCONV_DITHER_PAL))
dither_blit(src, dest, s_x, s_y, d_x, d_y, w, h);
else {
for (y=0; y<h; y++) {
for (x=0; x<w; x++) {
c = getpixel(src, s_x+x, s_y+y);
r = getr_depth(src_depth, c);
g = getg_depth(src_depth, c);
b = getb_depth(src_depth, c);
c = makecol_depth(dest_depth, r, g, b);
putpixel(dest, d_x+x, d_y+y, c);
}
}
}
_drawing_mode = prev_drawmode;
#endif
}
/* blit_between_formats:
* Blits an (already clipped) region between two bitmaps of different
* color depths, doing the appopriate format conversions.
*/
void _blit_between_formats(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
if ((is_planar_bitmap(src)) || (is_planar_bitmap(dest))) {
blit_to_or_from_modex(src, dest, s_x, s_y, d_x, d_y, w, h);
}
else {
switch (bitmap_color_depth(src)) {
case 8:
blit_from_256(src, dest, s_x, s_y, d_x, d_y, w, h);
break;
case 15:
blit_from_15(src, dest, s_x, s_y, d_x, d_y, w, h);
break;
case 16:
blit_from_16(src, dest, s_x, s_y, d_x, d_y, w, h);
break;
case 24:
blit_from_24(src, dest, s_x, s_y, d_x, d_y, w, h);
break;
case 32:
blit_from_32(src, dest, s_x, s_y, d_x, d_y, w, h);
break;
}
}
}
/* blit_to_self:
* Blits an (already clipped) region between two areas of the same bitmap,
* checking which way around to do the blit.
*/
static void blit_to_self(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
unsigned long sx, sy, dx, dy;
BITMAP *tmp;
if (dest->id & BMP_ID_NOBLIT) {
/* with single-banked cards we have to use a temporary bitmap */
tmp = create_bitmap(w, h);
if (tmp) {
src->vtable->blit_to_memory(src, tmp, s_x, s_y, 0, 0, w, h);
dest->vtable->blit_from_memory(tmp, dest, 0, 0, d_x, d_y, w, h);
destroy_bitmap(tmp);
}
}
else {
/* check which way round to do the blit */
sx = s_x + src->x_ofs;
sy = s_y + src->y_ofs;
dx = d_x + dest->x_ofs;
dy = d_y + dest->y_ofs;
if ((sx+w <= dx) || (dx+w <= sx) || (sy+h <= dy) || (dy+h <= sy))
dest->vtable->blit_to_self(src, dest, s_x, s_y, d_x, d_y, w, h);
else if ((sy > dy) || ((sy == dy) && (sx > dx)))
dest->vtable->blit_to_self_forward(src, dest, s_x, s_y, d_x, d_y, w, h);
else if ((sx != dx) || (sy != dy))
dest->vtable->blit_to_self_backward(src, dest, s_x, s_y, d_x, d_y, w, h);
}
}
/* helper for clipping a blit rectangle */
#define BLIT_CLIP() \
/* check for ridiculous cases */ \
if ((s_x >= src->w) || (s_y >= src->h) || \
(d_x >= dest->cr) || (d_y >= dest->cb)) \
return; \
\
/* clip src left */ \
if (s_x < 0) { \
w += s_x; \
d_x -= s_x; \
s_x = 0; \
} \
\
/* clip src top */ \
if (s_y < 0) { \
h += s_y; \
d_y -= s_y; \
s_y = 0; \
} \
\
/* clip src right */ \
if (s_x+w > src->w) \
w = src->w - s_x; \
\
/* clip src bottom */ \
if (s_y+h > src->h) \
h = src->h - s_y; \
\
/* clip dest left */ \
if (d_x < dest->cl) { \
d_x -= dest->cl; \
w += d_x; \
s_x -= d_x; \
d_x = dest->cl; \
} \
\
/* clip dest top */ \
if (d_y < dest->ct) { \
d_y -= dest->ct; \
h += d_y; \
s_y -= d_y; \
d_y = dest->ct; \
} \
\
/* clip dest right */ \
if (d_x+w > dest->cr) \
w = dest->cr - d_x; \
\
/* clip dest bottom */ \
if (d_y+h > dest->cb) \
h = dest->cb - d_y; \
\
/* bottle out if zero size */ \
if ((w <= 0) || (h <= 0)) \
return;
/* blit:
* Copies an area of the source bitmap to the destination bitmap. s_x and
* s_y give the top left corner of the area of the source bitmap to copy,
* and d_x and d_y give the position in the destination bitmap. w and h
* give the size of the area to blit. This routine respects the clipping
* rectangle of the destination bitmap, and will work correctly even when
* the two memory areas overlap (ie. src and dest are the same).
*/
void blit(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
ASSERT(src);
ASSERT(dest);
BLIT_CLIP();
if (src->vtable->color_depth != dest->vtable->color_depth) {
/* need to do a color conversion */
dest->vtable->blit_between_formats(src, dest, s_x, s_y, d_x, d_y, w, h);
}
else if (is_same_bitmap(src, dest)) {
/* special handling for overlapping regions */
blit_to_self(src, dest, s_x, s_y, d_x, d_y, w, h);
}
else if (is_video_bitmap(dest)) {
/* drawing onto video bitmaps */
if (is_video_bitmap(src))
dest->vtable->blit_to_self(src, dest, s_x, s_y, d_x, d_y, w, h);
else if (is_system_bitmap(src))
dest->vtable->blit_from_system(src, dest, s_x, s_y, d_x, d_y, w, h);
else
dest->vtable->blit_from_memory(src, dest, s_x, s_y, d_x, d_y, w, h);
}
else if (is_system_bitmap(dest)) {
/* drawing onto system bitmaps */
if (is_video_bitmap(src))
src->vtable->blit_to_system(src, dest, s_x, s_y, d_x, d_y, w, h);
else if (is_system_bitmap(src))
dest->vtable->blit_to_self(src, dest, s_x, s_y, d_x, d_y, w, h);
else
dest->vtable->blit_from_memory(src, dest, s_x, s_y, d_x, d_y, w, h);
}
else {
/* drawing onto memory bitmaps */
if ((is_video_bitmap(src)) || (is_system_bitmap(src)))
src->vtable->blit_to_memory(src, dest, s_x, s_y, d_x, d_y, w, h);
else
dest->vtable->blit_to_self(src, dest, s_x, s_y, d_x, d_y, w, h);
}
}
END_OF_FUNCTION(blit);
/* masked_blit:
* Version of blit() that skips zero pixels. The source must be a memory
* bitmap, and the source and dest regions must not overlap.
*/
void masked_blit(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h)
{
ASSERT(src);
ASSERT(dest);
ASSERT(src->vtable->color_depth == dest->vtable->color_depth);
BLIT_CLIP();
dest->vtable->masked_blit(src, dest, s_x, s_y, d_x, d_y, w, h);
}

View File

@ -1,872 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* BMP reader.
*
* By Seymour Shlien.
*
* OS/2 BMP support and BMP save function by Jonas Petersen.
*
* See readme.txt for copyright information.
*/
#include <string.h>
#include "allegro.h"
#include "allegro/internal/aintern.h"
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#define BI_BITFIELDS 3
#define OS2INFOHEADERSIZE 12
#define WININFOHEADERSIZE 40
typedef struct BITMAPFILEHEADER
{
unsigned long bfType;
unsigned long bfSize;
unsigned short bfReserved1;
unsigned short bfReserved2;
unsigned long bfOffBits;
} BITMAPFILEHEADER;
/* Used for both OS/2 and Windows BMP.
* Contains only the parameters needed to load the image
*/
typedef struct BITMAPINFOHEADER
{
unsigned long biWidth;
signed long biHeight;
unsigned short biBitCount;
unsigned long biCompression;
} BITMAPINFOHEADER;
typedef struct WINBMPINFOHEADER /* size: 40 */
{
unsigned long biWidth;
signed long biHeight;
unsigned short biPlanes;
unsigned short biBitCount;
unsigned long biCompression;
unsigned long biSizeImage;
unsigned long biXPelsPerMeter;
unsigned long biYPelsPerMeter;
unsigned long biClrUsed;
unsigned long biClrImportant;
} WINBMPINFOHEADER;
typedef struct OS2BMPINFOHEADER /* size: 12 */
{
unsigned short biWidth;
unsigned short biHeight;
unsigned short biPlanes;
unsigned short biBitCount;
} OS2BMPINFOHEADER;
/* read_bmfileheader:
* Reads a BMP file header and check that it has the BMP magic number.
*/
static int read_bmfileheader(PACKFILE *f, BITMAPFILEHEADER *fileheader)
{
fileheader->bfType = pack_igetw(f);
fileheader->bfSize= pack_igetl(f);
fileheader->bfReserved1= pack_igetw(f);
fileheader->bfReserved2= pack_igetw(f);
fileheader->bfOffBits= pack_igetl(f);
if (fileheader->bfType != 19778)
return -1;
return 0;
}
/* read_win_bminfoheader:
* Reads information from a BMP file header.
*/
static int read_win_bminfoheader(PACKFILE *f, BITMAPINFOHEADER *infoheader)
{
WINBMPINFOHEADER win_infoheader;
win_infoheader.biWidth = pack_igetl(f);
win_infoheader.biHeight = pack_igetl(f);
win_infoheader.biPlanes = pack_igetw(f);
win_infoheader.biBitCount = pack_igetw(f);
win_infoheader.biCompression = pack_igetl(f);
win_infoheader.biSizeImage = pack_igetl(f);
win_infoheader.biXPelsPerMeter = pack_igetl(f);
win_infoheader.biYPelsPerMeter = pack_igetl(f);
win_infoheader.biClrUsed = pack_igetl(f);
win_infoheader.biClrImportant = pack_igetl(f);
infoheader->biWidth = win_infoheader.biWidth;
infoheader->biHeight = win_infoheader.biHeight;
infoheader->biBitCount = win_infoheader.biBitCount;
infoheader->biCompression = win_infoheader.biCompression;
return 0;
}
/* read_os2_bminfoheader:
* Reads information from an OS/2 format BMP file header.
*/
static int read_os2_bminfoheader(PACKFILE *f, BITMAPINFOHEADER *infoheader)
{
OS2BMPINFOHEADER os2_infoheader;
os2_infoheader.biWidth = pack_igetw(f);
os2_infoheader.biHeight = pack_igetw(f);
os2_infoheader.biPlanes = pack_igetw(f);
os2_infoheader.biBitCount = pack_igetw(f);
infoheader->biWidth = os2_infoheader.biWidth;
infoheader->biHeight = os2_infoheader.biHeight;
infoheader->biBitCount = os2_infoheader.biBitCount;
infoheader->biCompression = 0;
return 0;
}
/* read_bmicolors:
* Loads the color palette for 1,4,8 bit formats.
*/
static void read_bmicolors(int bytes, RGB *pal, PACKFILE *f, int win_flag)
{
int i, j;
for (i=j=0; (i+3 <= bytes && j < PAL_SIZE); j++) {
pal[j].b = pack_getc(f) / 4;
pal[j].g = pack_getc(f) / 4;
pal[j].r = pack_getc(f) / 4;
i += 3;
if (win_flag && i < bytes) {
pack_getc(f);
i++;
}
}
for (; i<bytes; i++)
pack_getc(f);
}
/* read_1bit_line:
* Support function for reading the 1 bit bitmap file format.
*/
static void read_1bit_line(int length, PACKFILE *f, BITMAP *bmp, int line)
{
unsigned char b[32];
unsigned long n;
int i, j, k;
int pix;
for (i=0; i<length; i++) {
j = i % 32;
if (j == 0) {
n = pack_mgetl(f);
for (k=0; k<32; k++) {
b[31-k] = (char)(n & 1);
n = n >> 1;
}
}
pix = b[j];
bmp->line[line][i] = pix;
}
}
/* read_4bit_line:
* Support function for reading the 4 bit bitmap file format.
*/
static void read_4bit_line(int length, PACKFILE *f, BITMAP *bmp, int line)
{
unsigned char b[8];
unsigned long n;
int i, j, k;
int temp;
int pix;
for (i=0; i<length; i++) {
j = i % 8;
if (j == 0) {
n = pack_igetl(f);
for (k=0; k<4; k++) {
temp = n & 255;
b[k*2+1] = temp & 15;
temp = temp >> 4;
b[k*2] = temp & 15;
n = n >> 8;
}
}
pix = b[j];
bmp->line[line][i] = pix;
}
}
/* read_8bit_line:
* Support function for reading the 8 bit bitmap file format.
*/
static void read_8bit_line(int length, PACKFILE *f, BITMAP *bmp, int line)
{
unsigned char b[4];
unsigned long n;
int i, j, k;
int pix;
for (i=0; i<length; i++) {
j = i % 4;
if (j == 0) {
n = pack_igetl(f);
for (k=0; k<4; k++) {
b[k] = (char)(n & 255);
n = n >> 8;
}
}
pix = b[j];
bmp->line[line][i] = pix;
}
}
/* read_16bit_line:
* Support function for reading the 16 bit bitmap file format, doing
* our best to convert it down to a 256 color palette.
*/
static void read_16bit_line(int length, PACKFILE *f, BITMAP *bmp, int line)
{
int i, w;
RGB c;
for (i=0; i<length; i++) {
w = pack_igetw(f);
/* the format is like a 15-bpp bitmap, not 16bpp */
c.r = (w >> 10) & 0x1f;
c.g = (w >> 5) & 0x1f;
c.b = w & 0x1f;
bmp_write16(bmp->line[line]+i*2,
makecol16(_rgb_scale_5[c.r],
_rgb_scale_5[c.g],
_rgb_scale_5[c.b]));
}
/* padding */
i = (i * 2) % 4;
if (i != 0) {
while (i++ < 4)
pack_getc(f);
}
}
/* read_24bit_line:
* Support function for reading the 24 bit bitmap file format, doing
* our best to convert it down to a 256 color palette.
*/
static void read_24bit_line(int length, PACKFILE *f, BITMAP *bmp, int line)
{
int i;
RGB c;
for (i=0; i<length; i++) {
c.b = pack_getc(f);
c.g = pack_getc(f);
c.r = pack_getc(f);
WRITE3BYTES(bmp->line[line]+i*3, makecol24(c.r, c.g, c.b));
}
/* padding */
i = (i * 3) % 4;
if (i != 0) {
while (i++ < 4)
pack_getc(f);
}
}
/* read_32bit_line:
* Support function for reading the 32 bit bitmap file format, doing
* our best to convert it down to a 256 color palette.
*/
static void read_32bit_line(int length, PACKFILE *f, BITMAP *bmp, int line)
{
int i;
RGB c;
char a;
for (i=0; i<length; i++) {
c.b = pack_getc(f);
c.g = pack_getc(f);
c.r = pack_getc(f);
a = pack_getc(f);
WRITE3BYTES(bmp->line[line]+i*4, makeacol32(c.r, c.g, c.b, a));
}
}
/* read_bitfields_image:
* For reading the bitfield compressed BMP image format.
*/
static void read_bitfields_image(PACKFILE *f, BITMAP *bmp, AL_CONST BITMAPINFOHEADER *infoheader)
{
int k, i, line, height, dir;
int bpp;
int bytes_per_pixel;
int red, grn, blu;
unsigned long buffer;
height = infoheader->biHeight;
line = height < 0 ? 0 : height-1;
dir = height < 0 ? 1 : -1;
height = ABS(height);
bpp = bitmap_color_depth(bmp);
bytes_per_pixel = BYTES_PER_PIXEL(bpp);
for (i=0; i<height; i++, line+=dir) {
for (k=0; k<(int)infoheader->biWidth; k++) {
pack_fread(&buffer, bytes_per_pixel, f);
if (bpp == 15) {
red = (buffer >> 10) & 0x1f;
grn = (buffer >> 5) & 0x1f;
blu = (buffer) & 0x1f;
buffer = (red << _rgb_r_shift_15) |
(grn << _rgb_g_shift_15) |
(blu << _rgb_b_shift_15);
}
else if (bpp == 16) {
red = (buffer >> 11) & 0x1f;
grn = (buffer >> 5) & 0x3f;
blu = (buffer) & 0x1f;
buffer = (red << _rgb_r_shift_16) |
(grn << _rgb_g_shift_16) |
(blu << _rgb_b_shift_16);
}
else {
red = (buffer >> 16) & 0xff;
grn = (buffer >> 8) & 0xff;
blu = (buffer) & 0xff;
buffer = (red << _rgb_r_shift_32) |
(grn << _rgb_g_shift_32) |
(blu << _rgb_b_shift_32);
}
memcpy(&bmp->line[line][k * bytes_per_pixel], &buffer, bytes_per_pixel);
}
/* padding */
k = (k * bytes_per_pixel) % 4;
if (k > 0) {
while (k++ < 4)
pack_getc(f);
}
}
}
/* read_image:
* For reading the noncompressed BMP image format.
*/
static void read_image(PACKFILE *f, BITMAP *bmp, AL_CONST BITMAPINFOHEADER *infoheader)
{
int i, line, height, dir;
height = infoheader->biHeight;
line = height < 0 ? 0: height-1;
dir = height < 0 ? 1: -1;
height = ABS(height);
for (i=0; i<height; i++, line+=dir) {
switch (infoheader->biBitCount) {
case 1:
read_1bit_line(infoheader->biWidth, f, bmp, line);
break;
case 4:
read_4bit_line(infoheader->biWidth, f, bmp, line);
break;
case 8:
read_8bit_line(infoheader->biWidth, f, bmp, line);
break;
case 16:
read_16bit_line(infoheader->biWidth, f, bmp, line);
break;
case 24:
read_24bit_line(infoheader->biWidth, f, bmp, line);
break;
case 32:
read_32bit_line(infoheader->biWidth, f, bmp, line);
break;
}
}
}
/* read_RLE8_compressed_image:
* For reading the 8 bit RLE compressed BMP image format.
*/
static void read_RLE8_compressed_image(PACKFILE *f, BITMAP *bmp, AL_CONST BITMAPINFOHEADER *infoheader)
{
unsigned char count, val, val0;
int j, pos, line;
int eolflag, eopicflag;
eopicflag = 0;
line = infoheader->biHeight - 1;
while (eopicflag == 0) {
pos = 0; /* x position in bitmap */
eolflag = 0; /* end of line flag */
while ((eolflag == 0) && (eopicflag == 0)) {
count = pack_getc(f);
val = pack_getc(f);
if (count > 0) { /* repeat pixel count times */
for (j=0;j<count;j++) {
bmp->line[line][pos] = val;
pos++;
}
}
else {
switch (val) {
case 0: /* end of line flag */
eolflag=1;
break;
case 1: /* end of picture flag */
eopicflag=1;
break;
case 2: /* displace picture */
count = pack_getc(f);
val = pack_getc(f);
pos += count;
line -= val;
break;
default: /* read in absolute mode */
for (j=0; j<val; j++) {
val0 = pack_getc(f);
bmp->line[line][pos] = val0;
pos++;
}
if (j%2 == 1)
val0 = pack_getc(f); /* align on word boundary */
break;
}
}
if (pos-1 > (int)infoheader->biWidth)
eolflag=1;
}
line--;
if (line < 0)
eopicflag = 1;
}
}
/* read_RLE4_compressed_image:
* For reading the 4 bit RLE compressed BMP image format.
*/
static void read_RLE4_compressed_image(PACKFILE *f, BITMAP *bmp, AL_CONST BITMAPINFOHEADER *infoheader)
{
unsigned char b[8];
unsigned char count;
unsigned short val0, val;
int j, k, pos, line;
int eolflag, eopicflag;
eopicflag = 0; /* end of picture flag */
line = infoheader->biHeight - 1;
while (eopicflag == 0) {
pos = 0;
eolflag = 0; /* end of line flag */
while ((eolflag == 0) && (eopicflag == 0)) {
count = pack_getc(f);
val = pack_getc(f);
if (count > 0) { /* repeat pixels count times */
b[1] = val & 15;
b[0] = (val >> 4) & 15;
for (j=0; j<count; j++) {
bmp->line[line][pos] = b[j%2];
pos++;
}
}
else {
switch (val) {
case 0: /* end of line */
eolflag=1;
break;
case 1: /* end of picture */
eopicflag=1;
break;
case 2: /* displace image */
count = pack_getc(f);
val = pack_getc(f);
pos += count;
line -= val;
break;
default: /* read in absolute mode */
for (j=0; j<val; j++) {
if ((j%4) == 0) {
val0 = pack_igetw(f);
for (k=0; k<2; k++) {
b[2*k+1] = val0 & 15;
val0 = val0 >> 4;
b[2*k] = val0 & 15;
val0 = val0 >> 4;
}
}
bmp->line[line][pos] = b[j%4];
pos++;
}
break;
}
}
if (pos-1 > (int)infoheader->biWidth)
eolflag=1;
}
line--;
if (line < 0)
eopicflag = 1;
}
}
/* load_bmp:
* Loads a Windows BMP file, returning a bitmap structure and storing
* the palette data in the specified palette (this should be an array of
* at least 256 RGB structures).
*
* Thanks to Seymour Shlien for contributing this function.
*/
BITMAP *load_bmp(AL_CONST char *filename, RGB *pal)
{
PACKFILE *f;
BITMAP *bmp;
ASSERT(filename);
f = pack_fopen(filename, F_READ);
if (!f)
return NULL;
bmp = load_bmp_pf(f, pal);
pack_fclose(f);
return bmp;
}
/* load_bmp_pf:
* Like load_bmp, but starts loading from the current place in the PACKFILE
* specified. If successful the offset into the file will be left just after
* the image data. If unsuccessful the offset into the file is unspecified,
* i.e. you must either reset the offset to some known place or close the
* packfile. The packfile is not closed by this function.
*/
BITMAP *load_bmp_pf(PACKFILE *f, RGB *pal)
{
BITMAPFILEHEADER fileheader;
BITMAPINFOHEADER infoheader;
BITMAP *bmp;
PALETTE tmppal;
int want_palette = TRUE;
unsigned long biSize;
int bpp, dest_depth;
ASSERT(f);
/* we really need a palette */
if (!pal) {
want_palette = FALSE;
pal = tmppal;
}
if (read_bmfileheader(f, &fileheader) != 0) {
return NULL;
}
biSize = pack_igetl(f);
if (biSize == WININFOHEADERSIZE) {
if (read_win_bminfoheader(f, &infoheader) != 0) {
return NULL;
}
if (infoheader.biCompression != BI_BITFIELDS)
read_bmicolors(fileheader.bfOffBits - 54, pal, f, 1);
}
else if (biSize == OS2INFOHEADERSIZE) {
if (read_os2_bminfoheader(f, &infoheader) != 0) {
return NULL;
}
if (infoheader.biCompression != BI_BITFIELDS)
read_bmicolors(fileheader.bfOffBits - 26, pal, f, 0);
}
else {
return NULL;
}
if (infoheader.biBitCount == 24)
bpp = 24;
else if (infoheader.biBitCount == 16)
bpp = 16;
else if (infoheader.biBitCount == 32)
bpp = 32;
else
bpp = 8;
if (infoheader.biCompression == BI_BITFIELDS) {
unsigned long redMask = pack_igetl(f);
unsigned long grnMask = pack_igetl(f);
unsigned long bluMask = pack_igetl(f);
(void)grnMask;
if ((bluMask == 0x001f) && (redMask == 0x7C00))
bpp = 15;
else if ((bluMask == 0x001f) && (redMask == 0xF800))
bpp = 16;
else if ((bluMask == 0x0000FF) && (redMask == 0xFF0000))
bpp = 32;
else {
/* Unrecognised bit masks/depth, refuse to load. */
return NULL;
}
}
dest_depth = _color_load_depth(bpp, FALSE);
bmp = create_bitmap_ex(bpp, infoheader.biWidth, ABS(infoheader.biHeight));
if (!bmp) {
return NULL;
}
clear_bitmap(bmp);
switch (infoheader.biCompression) {
case BI_RGB:
read_image(f, bmp, &infoheader);
break;
case BI_RLE8:
read_RLE8_compressed_image(f, bmp, &infoheader);
break;
case BI_RLE4:
read_RLE4_compressed_image(f, bmp, &infoheader);
break;
case BI_BITFIELDS:
read_bitfields_image(f, bmp, &infoheader);
break;
default:
destroy_bitmap(bmp);
bmp = NULL;
}
if (dest_depth != bpp) {
/* restore original palette except if it comes from the bitmap */
if ((bpp != 8) && (!want_palette))
pal = NULL;
if (bmp) {
bmp = _fixup_loaded_bitmap(bmp, pal, dest_depth);
}
}
/* construct a fake palette if 8-bit mode is not involved */
if ((bpp != 8) && (dest_depth != 8) && want_palette)
generate_332_palette(pal);
return bmp;
}
/* save_bmp:
* Writes a bitmap into a BMP file, using the specified palette (this
* should be an array of at least 256 RGB structures).
*/
int save_bmp(AL_CONST char *filename, BITMAP *bmp, AL_CONST RGB *pal)
{
PACKFILE *f;
int ret;
ASSERT(filename);
f = pack_fopen(filename, F_WRITE);
if (!f)
return -1;
ret = save_bmp_pf(f, bmp, pal);
pack_fclose(f);
return ret;
}
/* save_bmp_pf:
* Like save_bmp but writes into the PACKFILE given instead of a new file.
* The packfile is not closed after writing is completed. On success the
* offset into the file is left after the TGA file just written. On failure
* the offset is left at the end of whatever incomplete data was written.
*/
int save_bmp_pf(PACKFILE *f, BITMAP *bmp, AL_CONST RGB *pal)
{
PALETTE tmppal;
int bfSize;
int biSizeImage;
int depth;
int bpp;
int filler;
int c, i, j;
ASSERT(f);
ASSERT(bmp);
depth = bitmap_color_depth(bmp);
bpp = (depth == 8) ? 8 : 24;
filler = 3 - ((bmp->w*(bpp/8)-1) & 3);
if (!pal) {
get_palette(tmppal);
pal = tmppal;
}
if (bpp == 8) {
biSizeImage = (bmp->w + filler) * bmp->h;
bfSize = (54 /* header */
+ 256*4 /* palette */
+ biSizeImage); /* image data */
}
else {
biSizeImage = (bmp->w*3 + filler) * bmp->h;
bfSize = 54 + biSizeImage; /* header + image data */
}
*allegro_errno = 0;
/* file_header */
pack_iputw(0x4D42, f); /* bfType ("BM") */
pack_iputl(bfSize, f); /* bfSize */
pack_iputw(0, f); /* bfReserved1 */
pack_iputw(0, f); /* bfReserved2 */
if (bpp == 8) /* bfOffBits */
pack_iputl(54+256*4, f);
else
pack_iputl(54, f);
/* info_header */
pack_iputl(40, f); /* biSize */
pack_iputl(bmp->w, f); /* biWidth */
pack_iputl(bmp->h, f); /* biHeight */
pack_iputw(1, f); /* biPlanes */
pack_iputw(bpp, f); /* biBitCount */
pack_iputl(0, f); /* biCompression */
pack_iputl(biSizeImage, f); /* biSizeImage */
pack_iputl(0xB12, f); /* biXPelsPerMeter (0xB12 = 72 dpi) */
pack_iputl(0xB12, f); /* biYPelsPerMeter */
if (bpp == 8) {
pack_iputl(256, f); /* biClrUsed */
pack_iputl(256, f); /* biClrImportant */
/* palette */
for (i=0; i<256; i++) {
pack_putc(_rgb_scale_6[pal[i].b], f);
pack_putc(_rgb_scale_6[pal[i].g], f);
pack_putc(_rgb_scale_6[pal[i].r], f);
pack_putc(0, f);
}
}
else {
pack_iputl(0, f); /* biClrUsed */
pack_iputl(0, f); /* biClrImportant */
}
/* image data */
for (i=bmp->h-1; i>=0; i--) {
for (j=0; j<bmp->w; j++) {
if (bpp == 8) {
pack_putc(getpixel(bmp, j, i), f);
}
else {
c = getpixel(bmp, j, i);
pack_putc(getb_depth(depth, c), f);
pack_putc(getg_depth(depth, c), f);
pack_putc(getr_depth(depth, c), f);
}
}
for (j=0; j<filler; j++)
pack_putc(0, f);
}
if (*allegro_errno)
return -1;
else
return 0;
}

View File

@ -1,183 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Bitmap blitting functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cblit_h
#define __bma_cblit_h
/* Define USE_MEMMOVE to use libc's memmove command for doing blits.
* This helps some machines, while it doesn't seem to do much for others.
* Left as a define so the older blit version can be easily reactivated for
* testing.
*/
#define USE_MEMMOVE
#ifdef USE_MEMMOVE
#include <string.h>
#endif
/* _linear_clear_to_color:
* Fills a linear bitmp with the specified color.
*/
void FUNC_LINEAR_CLEAR_TO_COLOR(BITMAP *dst, int color)
{
int x, y;
int w;
ASSERT(dst);
w = dst->cr - dst->cl;
bmp_select(dst);
for (y = dst->ct; y < dst->cb; y++) {
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, y), dst->cl);
for (x = w - 1; x >= 0; INC_PIXEL_PTR(d), x--) {
PUT_PIXEL(d, color);
}
}
bmp_unwrite_line(dst);
}
/* _linear_blit:
* Normal forward blitting for linear bitmaps.
*/
void FUNC_LINEAR_BLIT(BITMAP *src, BITMAP *dst, int sx, int sy,
int dx, int dy, int w, int h)
{
int y;
#ifndef USE_MEMMOVE
int x;
#endif
ASSERT(src);
ASSERT(dst);
for (y = 0; y < h; y++) {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(src, sy + y), sx);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy + y), dx);
#ifndef USE_MEMMOVE
for (x = w - 1; x >= 0; INC_PIXEL_PTR(s), INC_PIXEL_PTR(d), x--) {
unsigned long c;
bmp_select(src);
c = GET_PIXEL(s);
bmp_select(dst);
PUT_PIXEL(d, c);
}
#else
memmove(d, s, w * sizeof(*s) * PTR_PER_PIXEL);
#endif
}
bmp_unwrite_line(src);
bmp_unwrite_line(dst);
}
/* _linear_blit_backward:
* Reverse blitting routine, for overlapping linear bitmaps.
*/
void FUNC_LINEAR_BLIT_BACKWARD(BITMAP *src, BITMAP *dst, int sx, int sy,
int dx, int dy, int w, int h)
{
int y;
#ifndef USE_MEMMOVE
int x;
#endif
ASSERT(src);
ASSERT(dst);
for (y = h - 1; y >= 0; y--) {
#ifndef USE_MEMMOVE
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(src, sy + y), sx + w - 1);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy + y), dx + w - 1);
for (x = w - 1; x >= 0; DEC_PIXEL_PTR(s), DEC_PIXEL_PTR(d), x--) {
unsigned long c;
bmp_select(src);
c = GET_PIXEL(s);
bmp_select(dst);
PUT_PIXEL(d, c);
}
#else
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(src, sy + y), sx);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy + y), dx);
memmove(d, s, w * sizeof(*s) * PTR_PER_PIXEL);
#endif
}
bmp_unwrite_line(src);
bmp_unwrite_line(dst);
}
void FUNC_LINEAR_BLIT_END(void) { }
/* _linear_masked_blit:
* Masked (skipping transparent pixels) blitting routine for linear bitmaps.
*/
void FUNC_LINEAR_MASKED_BLIT(BITMAP *src, BITMAP *dst, int sx, int sy,
int dx, int dy, int w, int h)
{
int x, y;
unsigned long mask_color;
ASSERT(src);
ASSERT(dst);
mask_color = bitmap_mask_color(dst);
for (y = 0; y < h; y++) {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(src, sy + y), sx);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy + y), dx);
for (x = w - 1; x >= 0; INC_PIXEL_PTR(s), INC_PIXEL_PTR(d), x--) {
unsigned long c;
bmp_select(src);
c = GET_PIXEL(s);
if (c != mask_color) {
bmp_select(dst);
PUT_PIXEL(d, c);
}
}
}
bmp_unwrite_line(src);
bmp_unwrite_line(dst);
}
#endif /* !__bma_cblit_h */

View File

@ -1,26 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 16 bit color bitmap blitting functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#ifdef ALLEGRO_COLOR16
#include "cdefs16.h"
#include "cblit.h"
#endif

View File

@ -1,26 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 24 bit color bitmap blitting functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#ifdef ALLEGRO_COLOR24
#include "cdefs24.h"
#include "cblit.h"
#endif

View File

@ -1,26 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 32 bit color bitmap blitting functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#ifdef ALLEGRO_COLOR32
#include "cdefs32.h"
#include "cblit.h"
#endif

View File

@ -1,26 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 256 color bitmap blitting functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#ifdef ALLEGRO_COLOR8
#include "cdefs8.h"
#include "cblit.h"
#endif

View File

@ -1,34 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Dummy CPU detection routines.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
/* MacOS X has its own check_cpu function, see src/macosx/pcpu.m */
#ifndef ALLEGRO_MACOSX
/* check_cpu:
* This is the function to call to set the globals.
*/
void check_cpu(void)
{
cpu_family = 0;
cpu_model = 0;
cpu_capabilities = 0;
}
#endif

View File

@ -1,54 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Compiled sprite routines for some unknown platforms.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
/* get_compiled_sprite:
* Creates a compiled sprite based on the specified bitmap.
*/
COMPILED_SPRITE *get_compiled_sprite(BITMAP *bitmap, int planar)
{
ASSERT(bitmap);
return get_rle_sprite(bitmap);
}
/* destroy_compiled_sprite:
* Destroys a compiled sprite structure returned by get_compiled_sprite().
*/
void destroy_compiled_sprite(COMPILED_SPRITE *sprite)
{
ASSERT(sprite);
destroy_rle_sprite(sprite);
}
/* draw_compiled_sprite:
* Draws a compiled sprite onto the specified bitmap at the specified
* position.
*/
void draw_compiled_sprite(BITMAP *dst, AL_CONST COMPILED_SPRITE *src, int x, int y)
{
ASSERT(dst);
ASSERT(src);
draw_rle_sprite(dst, (COMPILED_SPRITE *)src, x, y);
}

View File

@ -1,115 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Defines for 15 bit color graphics primitives.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cdefs15_h
#define __bma_cdefs15_h
#define PP_DEPTH 15
#define PIXEL_PTR unsigned short*
#define OFFSET_PIXEL_PTR(p,x) ((PIXEL_PTR) (p) + (x))
#define INC_PIXEL_PTR(p) ((p)++)
#define INC_PIXEL_PTR_N(p,d) ((p) += d)
#define DEC_PIXEL_PTR(p) ((p)--)
#define PUT_PIXEL(p,c) bmp_write15((uintptr_t) (p), (c))
#define PUT_MEMORY_PIXEL(p,c) (*(p) = (c))
#define PUT_RGB(p,r,g,b) bmp_write15((uintptr_t) (p), makecol15((r), (g), (b)))
#define GET_PIXEL(p) bmp_read15((uintptr_t) (p))
#define GET_MEMORY_PIXEL(p) (*(p))
#define IS_MASK(c) ((unsigned long) (c) == MASK_COLOR_15)
#define IS_SPRITE_MASK(b,c) ((unsigned long) (c) == MASK_COLOR_15)
/* Blender for putpixel (DRAW_MODE_TRANS). */
#define PP_BLENDER BLENDER_FUNC
#define MAKE_PP_BLENDER(c) _blender_func15
#define PP_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_trans_*_sprite. */
#define DTS_BLENDER BLENDER_FUNC
#define MAKE_DTS_BLENDER() _blender_func15
#define DTS_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_lit_*_sprite. */
#define DLS_BLENDER BLENDER_FUNC
#define MAKE_DLS_BLENDER(a) _blender_func15
#define DLS_BLEND(b,a,n) ((*(b))(_blender_col_15, (n), (a)))
#define DLSX_BLEND(b,n) ((*(b))(_blender_col_15, (n), _blender_alpha))
/* Blender for RGBA sprites. */
#define RGBA_BLENDER BLENDER_FUNC
#define MAKE_RGBA_BLENDER() _blender_func15x
#define RGBA_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for poly_scanline_*_lit. */
#define PS_BLENDER BLENDER_FUNC
#define MAKE_PS_BLENDER() _blender_func15
#define PS_BLEND(b,o,c) ((*(b))((c), _blender_col_15, (o)))
#define PS_ALPHA_BLEND(b,o,c) ((*(b))((o), (c), _blender_alpha))
#define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \
& _drawing_y_mask])
#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \
((x) - _drawing_x_anchor) & _drawing_x_mask))
#define RLE_PTR signed short*
#define RLE_IS_EOL(c) ((unsigned short) (c) == MASK_COLOR_15)
#define FUNC_LINEAR_CLEAR_TO_COLOR _linear_clear_to_color15
#define FUNC_LINEAR_BLIT _linear_blit15
#define FUNC_LINEAR_BLIT_BACKWARD _linear_blit_backward15
#define FUNC_LINEAR_MASKED_BLIT _linear_masked_blit15
#define FUNC_LINEAR_PUTPIXEL _linear_putpixel15
#define FUNC_LINEAR_GETPIXEL _linear_getpixel15
#define FUNC_LINEAR_HLINE _linear_hline15
#define FUNC_LINEAR_VLINE _linear_vline15
#define FUNC_LINEAR_DRAW_SPRITE _linear_draw_sprite15
#define FUNC_LINEAR_DRAW_SPRITE_EX _linear_draw_sprite_ex15
#define FUNC_LINEAR_DRAW_256_SPRITE _linear_draw_256_sprite15
#define FUNC_LINEAR_DRAW_SPRITE_V_FLIP _linear_draw_sprite_v_flip15
#define FUNC_LINEAR_DRAW_SPRITE_H_FLIP _linear_draw_sprite_h_flip15
#define FUNC_LINEAR_DRAW_SPRITE_VH_FLIP _linear_draw_sprite_vh_flip15
#define FUNC_LINEAR_DRAW_TRANS_SPRITE _linear_draw_trans_sprite15
#define FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE _linear_draw_trans_rgba_sprite15
#define FUNC_LINEAR_DRAW_LIT_SPRITE _linear_draw_lit_sprite15
#define FUNC_LINEAR_DRAW_CHARACTER _linear_draw_character15
#define FUNC_LINEAR_DRAW_RLE_SPRITE _linear_draw_rle_sprite15
#define FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE _linear_draw_trans_rle_sprite15
#define FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE _linear_draw_trans_rgba_rle_sprite15
#define FUNC_LINEAR_DRAW_LIT_RLE_SPRITE _linear_draw_lit_rle_sprite15
#define FUNC_LINEAR_DRAW_SPRITE_END _linear_draw_sprite15_end
#define FUNC_LINEAR_BLIT_END _linear_blit15_end
#define FUNC_POLY_SCANLINE_GRGB _poly_scanline_grgb15
#define FUNC_POLY_SCANLINE_ATEX _poly_scanline_atex15
#define FUNC_POLY_SCANLINE_ATEX_MASK _poly_scanline_atex_mask15
#define FUNC_POLY_SCANLINE_ATEX_LIT _poly_scanline_atex_lit15
#define FUNC_POLY_SCANLINE_ATEX_MASK_LIT _poly_scanline_atex_mask_lit15
#define FUNC_POLY_SCANLINE_PTEX _poly_scanline_ptex15
#define FUNC_POLY_SCANLINE_PTEX_MASK _poly_scanline_ptex_mask15
#define FUNC_POLY_SCANLINE_PTEX_LIT _poly_scanline_ptex_lit15
#define FUNC_POLY_SCANLINE_PTEX_MASK_LIT _poly_scanline_ptex_mask_lit15
#define FUNC_POLY_SCANLINE_ATEX_TRANS _poly_scanline_atex_trans15
#define FUNC_POLY_SCANLINE_ATEX_MASK_TRANS _poly_scanline_atex_mask_trans15
#define FUNC_POLY_SCANLINE_PTEX_TRANS _poly_scanline_ptex_trans15
#define FUNC_POLY_SCANLINE_PTEX_MASK_TRANS _poly_scanline_ptex_mask_trans15
#endif /* !__bma_cdefs15_h */

View File

@ -1,116 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Defines for 16 bit color graphics primitives.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cdefs16_h
#define __bma_cdefs16_h
#define PP_DEPTH 16
#define PIXEL_PTR unsigned short*
#define PTR_PER_PIXEL 1
#define OFFSET_PIXEL_PTR(p,x) ((PIXEL_PTR) (p) + (x))
#define INC_PIXEL_PTR(p) ((p)++)
#define INC_PIXEL_PTR_N(p,d) ((p) += d)
#define DEC_PIXEL_PTR(p) ((p)--)
#define PUT_PIXEL(p,c) bmp_write16((uintptr_t) (p), (c))
#define PUT_MEMORY_PIXEL(p,c) (*(p) = (c))
#define PUT_RGB(p,r,g,b) bmp_write16((uintptr_t) (p), makecol16((r), (g), (b)))
#define GET_PIXEL(p) bmp_read16((uintptr_t) (p))
#define GET_MEMORY_PIXEL(p) (*(p))
#define IS_MASK(c) ((unsigned long) (c) == MASK_COLOR_16)
#define IS_SPRITE_MASK(b,c) ((unsigned long) (c) == (unsigned long) (b)->vtable->mask_color)
/* Blender for putpixel (DRAW_MODE_TRANS). */
#define PP_BLENDER BLENDER_FUNC
#define MAKE_PP_BLENDER(c) _blender_func16
#define PP_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_trans_*_sprite. */
#define DTS_BLENDER BLENDER_FUNC
#define MAKE_DTS_BLENDER() _blender_func16
#define DTS_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_lit_*_sprite. */
#define DLS_BLENDER BLENDER_FUNC
#define MAKE_DLS_BLENDER(a) _blender_func16
#define DLS_BLEND(b,a,n) ((*(b))(_blender_col_16, (n), (a)))
#define DLSX_BLEND(b,n) ((*(b))(_blender_col_16, (n), _blender_alpha))
/* Blender for RGBA sprites. */
#define RGBA_BLENDER BLENDER_FUNC
#define MAKE_RGBA_BLENDER() _blender_func16x
#define RGBA_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for poly_scanline_*_lit. */
#define PS_BLENDER BLENDER_FUNC
#define MAKE_PS_BLENDER() _blender_func16
#define PS_BLEND(b,o,c) ((*(b))((c), _blender_col_16, (o)))
#define PS_ALPHA_BLEND(b,o,c) ((*(b))((o), (c), _blender_alpha))
#define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \
& _drawing_y_mask])
#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \
((x) - _drawing_x_anchor) & _drawing_x_mask))
#define RLE_PTR signed short*
#define RLE_IS_EOL(c) ((unsigned short) (c) == MASK_COLOR_16)
#define FUNC_LINEAR_CLEAR_TO_COLOR _linear_clear_to_color16
#define FUNC_LINEAR_BLIT _linear_blit16
#define FUNC_LINEAR_BLIT_BACKWARD _linear_blit_backward16
#define FUNC_LINEAR_MASKED_BLIT _linear_masked_blit16
#define FUNC_LINEAR_PUTPIXEL _linear_putpixel16
#define FUNC_LINEAR_GETPIXEL _linear_getpixel16
#define FUNC_LINEAR_HLINE _linear_hline16
#define FUNC_LINEAR_VLINE _linear_vline16
#define FUNC_LINEAR_DRAW_SPRITE _linear_draw_sprite16
#define FUNC_LINEAR_DRAW_SPRITE_EX _linear_draw_sprite_ex16
#define FUNC_LINEAR_DRAW_256_SPRITE _linear_draw_256_sprite16
#define FUNC_LINEAR_DRAW_SPRITE_V_FLIP _linear_draw_sprite_v_flip16
#define FUNC_LINEAR_DRAW_SPRITE_H_FLIP _linear_draw_sprite_h_flip16
#define FUNC_LINEAR_DRAW_SPRITE_VH_FLIP _linear_draw_sprite_vh_flip16
#define FUNC_LINEAR_DRAW_TRANS_SPRITE _linear_draw_trans_sprite16
#define FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE _linear_draw_trans_rgba_sprite16
#define FUNC_LINEAR_DRAW_LIT_SPRITE _linear_draw_lit_sprite16
#define FUNC_LINEAR_DRAW_CHARACTER _linear_draw_character16
#define FUNC_LINEAR_DRAW_RLE_SPRITE _linear_draw_rle_sprite16
#define FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE _linear_draw_trans_rle_sprite16
#define FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE _linear_draw_trans_rgba_rle_sprite16
#define FUNC_LINEAR_DRAW_LIT_RLE_SPRITE _linear_draw_lit_rle_sprite16
#define FUNC_LINEAR_DRAW_SPRITE_END _linear_draw_sprite16_end
#define FUNC_LINEAR_BLIT_END _linear_blit16_end
#define FUNC_POLY_SCANLINE_GRGB _poly_scanline_grgb16
#define FUNC_POLY_SCANLINE_ATEX _poly_scanline_atex16
#define FUNC_POLY_SCANLINE_ATEX_MASK _poly_scanline_atex_mask16
#define FUNC_POLY_SCANLINE_ATEX_LIT _poly_scanline_atex_lit16
#define FUNC_POLY_SCANLINE_ATEX_MASK_LIT _poly_scanline_atex_mask_lit16
#define FUNC_POLY_SCANLINE_PTEX _poly_scanline_ptex16
#define FUNC_POLY_SCANLINE_PTEX_MASK _poly_scanline_ptex_mask16
#define FUNC_POLY_SCANLINE_PTEX_LIT _poly_scanline_ptex_lit16
#define FUNC_POLY_SCANLINE_PTEX_MASK_LIT _poly_scanline_ptex_mask_lit16
#define FUNC_POLY_SCANLINE_ATEX_TRANS _poly_scanline_atex_trans16
#define FUNC_POLY_SCANLINE_ATEX_MASK_TRANS _poly_scanline_atex_mask_trans16
#define FUNC_POLY_SCANLINE_PTEX_TRANS _poly_scanline_ptex_trans16
#define FUNC_POLY_SCANLINE_PTEX_MASK_TRANS _poly_scanline_ptex_mask_trans16
#endif /* !__bma_cdefs16_h */

View File

@ -1,115 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Defines for 24 bit color graphics primitives.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cdefs24_h
#define __bma_cdefs24_h
#define PP_DEPTH 24
#define PIXEL_PTR unsigned char*
#define PTR_PER_PIXEL 3
#define OFFSET_PIXEL_PTR(p,x) ((PIXEL_PTR) (p) + 3 * (x))
#define INC_PIXEL_PTR(p) ((p) += 3)
#define INC_PIXEL_PTR_N(p,d) ((p) += 3 * d)
#define DEC_PIXEL_PTR(p) ((p) -= 3)
#define PUT_PIXEL(p,c) bmp_write24((uintptr_t) (p), (c))
#define PUT_MEMORY_PIXEL(p,c) WRITE3BYTES((p), (c))
#define PUT_RGB(p,r,g,b) bmp_write24((uintptr_t) (p), makecol24((r), (g), (b)))
#define GET_PIXEL(p) bmp_read24((uintptr_t) (p))
#define GET_MEMORY_PIXEL(p) READ3BYTES((p))
#define IS_MASK(c) ((unsigned long) (c) == MASK_COLOR_24)
#define IS_SPRITE_MASK(b,c) ((unsigned long) (c) == MASK_COLOR_24)
/* Blender for putpixel (DRAW_MODE_TRANS). */
#define PP_BLENDER BLENDER_FUNC
#define MAKE_PP_BLENDER(c) _blender_func24
#define PP_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_trans_*_sprite. */
#define DTS_BLENDER BLENDER_FUNC
#define MAKE_DTS_BLENDER() _blender_func24
#define DTS_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_lit_*_sprite. */
#define DLS_BLENDER BLENDER_FUNC
#define MAKE_DLS_BLENDER(a) _blender_func24
#define DLS_BLEND(b,a,n) ((*(b))(_blender_col_24, (n), (a)))
#define DLSX_BLEND(b,n) ((*(b))(_blender_col_24, (n), _blender_alpha))
/* Blender for RGBA sprites. */
#define RGBA_BLENDER BLENDER_FUNC
#define MAKE_RGBA_BLENDER() _blender_func24x
#define RGBA_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for poly_scanline_*_lit. */
#define PS_BLENDER BLENDER_FUNC
#define MAKE_PS_BLENDER() _blender_func24
#define PS_BLEND(b,o,c) ((*(b))((c), _blender_col_24, (o)))
#define PS_ALPHA_BLEND(b,o,c) ((*(b))((o), (c), _blender_alpha))
#define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \
& _drawing_y_mask])
#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \
((x) - _drawing_x_anchor) & _drawing_x_mask))
#define RLE_PTR int32_t*
#define RLE_IS_EOL(c) ((unsigned long) (c) == MASK_COLOR_24)
#define FUNC_LINEAR_CLEAR_TO_COLOR _linear_clear_to_color24
#define FUNC_LINEAR_BLIT _linear_blit24
#define FUNC_LINEAR_BLIT_BACKWARD _linear_blit_backward24
#define FUNC_LINEAR_MASKED_BLIT _linear_masked_blit24
#define FUNC_LINEAR_PUTPIXEL _linear_putpixel24
#define FUNC_LINEAR_GETPIXEL _linear_getpixel24
#define FUNC_LINEAR_HLINE _linear_hline24
#define FUNC_LINEAR_VLINE _linear_vline24
#define FUNC_LINEAR_DRAW_SPRITE _linear_draw_sprite24
#define FUNC_LINEAR_DRAW_SPRITE_EX _linear_draw_sprite_ex24
#define FUNC_LINEAR_DRAW_256_SPRITE _linear_draw_256_sprite24
#define FUNC_LINEAR_DRAW_SPRITE_V_FLIP _linear_draw_sprite_v_flip24
#define FUNC_LINEAR_DRAW_SPRITE_H_FLIP _linear_draw_sprite_h_flip24
#define FUNC_LINEAR_DRAW_SPRITE_VH_FLIP _linear_draw_sprite_vh_flip24
#define FUNC_LINEAR_DRAW_TRANS_SPRITE _linear_draw_trans_sprite24
#define FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE _linear_draw_trans_rgba_sprite24
#define FUNC_LINEAR_DRAW_LIT_SPRITE _linear_draw_lit_sprite24
#define FUNC_LINEAR_DRAW_CHARACTER _linear_draw_character24
#define FUNC_LINEAR_DRAW_RLE_SPRITE _linear_draw_rle_sprite24
#define FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE _linear_draw_trans_rle_sprite24
#define FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE _linear_draw_trans_rgba_rle_sprite24
#define FUNC_LINEAR_DRAW_LIT_RLE_SPRITE _linear_draw_lit_rle_sprite24
#define FUNC_LINEAR_DRAW_SPRITE_END _linear_draw_sprite24_end
#define FUNC_LINEAR_BLIT_END _linear_blit24_end
#define FUNC_POLY_SCANLINE_GRGB _poly_scanline_grgb24
#define FUNC_POLY_SCANLINE_ATEX _poly_scanline_atex24
#define FUNC_POLY_SCANLINE_ATEX_MASK _poly_scanline_atex_mask24
#define FUNC_POLY_SCANLINE_ATEX_LIT _poly_scanline_atex_lit24
#define FUNC_POLY_SCANLINE_ATEX_MASK_LIT _poly_scanline_atex_mask_lit24
#define FUNC_POLY_SCANLINE_PTEX _poly_scanline_ptex24
#define FUNC_POLY_SCANLINE_PTEX_MASK _poly_scanline_ptex_mask24
#define FUNC_POLY_SCANLINE_PTEX_LIT _poly_scanline_ptex_lit24
#define FUNC_POLY_SCANLINE_PTEX_MASK_LIT _poly_scanline_ptex_mask_lit24
#define FUNC_POLY_SCANLINE_ATEX_TRANS _poly_scanline_atex_trans24
#define FUNC_POLY_SCANLINE_ATEX_MASK_TRANS _poly_scanline_atex_mask_trans24
#define FUNC_POLY_SCANLINE_PTEX_TRANS _poly_scanline_ptex_trans24
#define FUNC_POLY_SCANLINE_PTEX_MASK_TRANS _poly_scanline_ptex_mask_trans24
#endif /* !__bma_cdefs24_h */

View File

@ -1,111 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Defines for 32 bit color graphics primitives.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cdefs32_h
#define __bma_cdefs32_h
#define PP_DEPTH 32
#define PIXEL_PTR uint32_t*
#define PTR_PER_PIXEL 1
#define OFFSET_PIXEL_PTR(p,x) ((PIXEL_PTR) (p) + (x))
#define INC_PIXEL_PTR(p) ((p)++)
#define INC_PIXEL_PTR_N(p,d) ((p) += d)
#define DEC_PIXEL_PTR(p) ((p)--)
#define PUT_PIXEL(p,c) bmp_write32((uintptr_t) (p), (c))
#define PUT_MEMORY_PIXEL(p,c) (*(p) = (c))
#define PUT_RGB(p,r,g,b) bmp_write32((uintptr_t) (p), makecol32((r), (g), (b)))
#define GET_PIXEL(p) bmp_read32((uintptr_t) (p))
#define GET_MEMORY_PIXEL(p) (*(p))
#define IS_MASK(c) ((unsigned long) (c) == MASK_COLOR_32)
#define IS_SPRITE_MASK(b,c) ((unsigned long) (c) == MASK_COLOR_32)
/* Blender for putpixel (DRAW_MODE_TRANS). */
#define PP_BLENDER BLENDER_FUNC
#define MAKE_PP_BLENDER(c) _blender_func32
#define PP_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_trans_*_sprite. */
#define DTS_BLENDER BLENDER_FUNC
#define MAKE_DTS_BLENDER() _blender_func32
#define DTS_BLEND(b,o,n) ((*(b))((n), (o), _blender_alpha))
/* Blender for draw_lit_*_sprite. */
#define DLS_BLENDER BLENDER_FUNC
#define MAKE_DLS_BLENDER(a) _blender_func32
#define DLS_BLEND(b,a,n) ((*(b))(_blender_col_32, (n), (a)))
#define DLSX_BLEND(b,n) ((*(b))(_blender_col_32, (n), _blender_alpha))
/* Blender for poly_scanline_*_lit. */
#define PS_BLENDER BLENDER_FUNC
#define MAKE_PS_BLENDER() _blender_func32
#define PS_BLEND(b,o,c) ((*(b))((c), _blender_col_32, (o)))
#define PS_ALPHA_BLEND(b,o,c) ((*(b))((o), (c), _blender_alpha))
#define PATTERN_LINE(y) (PIXEL_PTR) (_drawing_pattern->line[((y) - _drawing_y_anchor) \
& _drawing_y_mask])
#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \
((x) - _drawing_x_anchor) & _drawing_x_mask))
#define RLE_PTR int32_t*
#define RLE_IS_EOL(c) ((unsigned long) (c) == MASK_COLOR_32)
#define FUNC_LINEAR_CLEAR_TO_COLOR _linear_clear_to_color32
#define FUNC_LINEAR_BLIT _linear_blit32
#define FUNC_LINEAR_BLIT_BACKWARD _linear_blit_backward32
#define FUNC_LINEAR_MASKED_BLIT _linear_masked_blit32
#define FUNC_LINEAR_PUTPIXEL _linear_putpixel32
#define FUNC_LINEAR_GETPIXEL _linear_getpixel32
#define FUNC_LINEAR_HLINE _linear_hline32
#define FUNC_LINEAR_VLINE _linear_vline32
#define FUNC_LINEAR_DRAW_SPRITE _linear_draw_sprite32
#define FUNC_LINEAR_DRAW_SPRITE_EX _linear_draw_sprite_ex32
#define FUNC_LINEAR_DRAW_256_SPRITE _linear_draw_256_sprite32
#define FUNC_LINEAR_DRAW_SPRITE_V_FLIP _linear_draw_sprite_v_flip32
#define FUNC_LINEAR_DRAW_SPRITE_H_FLIP _linear_draw_sprite_h_flip32
#define FUNC_LINEAR_DRAW_SPRITE_VH_FLIP _linear_draw_sprite_vh_flip32
#define FUNC_LINEAR_DRAW_TRANS_SPRITE _linear_draw_trans_sprite32
#define FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE _linear_draw_trans_rgba_sprite32
#define FUNC_LINEAR_DRAW_LIT_SPRITE _linear_draw_lit_sprite32
#define FUNC_LINEAR_DRAW_CHARACTER _linear_draw_character32
#define FUNC_LINEAR_DRAW_RLE_SPRITE _linear_draw_rle_sprite32
#define FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE _linear_draw_trans_rle_sprite32
#define FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE _linear_draw_trans_rgba_rle_sprite32
#define FUNC_LINEAR_DRAW_LIT_RLE_SPRITE _linear_draw_lit_rle_sprite32
#define FUNC_LINEAR_DRAW_SPRITE_END _linear_draw_sprite32_end
#define FUNC_LINEAR_BLIT_END _linear_blit32_end
#define FUNC_POLY_SCANLINE_GRGB _poly_scanline_grgb32
#define FUNC_POLY_SCANLINE_ATEX _poly_scanline_atex32
#define FUNC_POLY_SCANLINE_ATEX_MASK _poly_scanline_atex_mask32
#define FUNC_POLY_SCANLINE_ATEX_LIT _poly_scanline_atex_lit32
#define FUNC_POLY_SCANLINE_ATEX_MASK_LIT _poly_scanline_atex_mask_lit32
#define FUNC_POLY_SCANLINE_PTEX _poly_scanline_ptex32
#define FUNC_POLY_SCANLINE_PTEX_MASK _poly_scanline_ptex_mask32
#define FUNC_POLY_SCANLINE_PTEX_LIT _poly_scanline_ptex_lit32
#define FUNC_POLY_SCANLINE_PTEX_MASK_LIT _poly_scanline_ptex_mask_lit32
#define FUNC_POLY_SCANLINE_ATEX_TRANS _poly_scanline_atex_trans32
#define FUNC_POLY_SCANLINE_ATEX_MASK_TRANS _poly_scanline_atex_mask_trans32
#define FUNC_POLY_SCANLINE_PTEX_TRANS _poly_scanline_ptex_trans32
#define FUNC_POLY_SCANLINE_PTEX_MASK_TRANS _poly_scanline_ptex_mask_trans32
#endif /* !__bma_cdefs32_h */

View File

@ -1,111 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Defines for 256 color graphics primitives.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cdefs8_h
#define __bma_cdefs8_h
#define PP_DEPTH 8
#define PIXEL_PTR unsigned char*
#define PTR_PER_PIXEL 1
#define OFFSET_PIXEL_PTR(p,x) ((PIXEL_PTR) (p) + (x))
#define INC_PIXEL_PTR(p) ((p)++)
#define INC_PIXEL_PTR_N(p,d) ((p) += d)
#define DEC_PIXEL_PTR(p) ((p)--)
#define PUT_PIXEL(p,c) bmp_write8((uintptr_t) (p), (c))
#define PUT_MEMORY_PIXEL(p,c) (*(p) = (c))
#define PUT_RGB(p,r,g,b) bmp_write8((uintptr_t) (p), makecol8((r), (g), (b)))
#define GET_PIXEL(p) bmp_read8((uintptr_t) (p))
#define GET_MEMORY_PIXEL(p) (*(p))
#define IS_MASK(c) ((c) == 0)
#define IS_SPRITE_MASK(b,c) ((c) == 0)
/* Blender for putpixel (DRAW_MODE_TRANS). */
#define PP_BLENDER unsigned char*
#define MAKE_PP_BLENDER(c) (color_map->data[(c) & 0xFF])
#define PP_BLEND(b,o,n) ((b)[(o) & 0xFF])
/* Blender for draw_trans_*_sprite. */
#define DTS_BLENDER COLOR_MAP*
#define MAKE_DTS_BLENDER() color_map
#define DTS_BLEND(b,o,n) ((b)->data[(n)& 0xFF][(o) & 0xFF])
/* Blender for draw_lit_*_sprite. */
#define DLS_BLENDER unsigned char*
#define MAKE_DLS_BLENDER(a) (color_map->data[(a) & 0xFF])
#define DLS_BLEND(b,a,c) ((b)[(c) & 0xFF])
#define DLSX_BLEND(b,c) ((b)[(c) & 0xFF])
/* Blender for poly_scanline_*_lit. */
#define PS_BLENDER COLOR_MAP*
#define MAKE_PS_BLENDER() color_map
#define PS_BLEND(b,o,c) ((b)->data[(o) & 0xFF][(c) & 0xFF])
#define PS_ALPHA_BLEND(b,o,c) ((b)->data[(o) & 0xFF][(c) & 0xFF])
#define PATTERN_LINE(y) _drawing_pattern->line[((y) - _drawing_y_anchor) & _drawing_y_mask]
#define GET_PATTERN_PIXEL(x,y) GET_MEMORY_PIXEL(OFFSET_PIXEL_PTR(PATTERN_LINE(y), \
((x) - _drawing_x_anchor) & _drawing_x_mask))
#define RLE_PTR signed char*
#define RLE_IS_EOL(c) ((c) == 0)
#define FUNC_LINEAR_CLEAR_TO_COLOR _linear_clear_to_color8
#define FUNC_LINEAR_BLIT _linear_blit8
#define FUNC_LINEAR_BLIT_BACKWARD _linear_blit_backward8
#define FUNC_LINEAR_MASKED_BLIT _linear_masked_blit8
#define FUNC_LINEAR_PUTPIXEL _linear_putpixel8
#define FUNC_LINEAR_GETPIXEL _linear_getpixel8
#define FUNC_LINEAR_HLINE _linear_hline8
#define FUNC_LINEAR_VLINE _linear_vline8
#define FUNC_LINEAR_DRAW_SPRITE _linear_draw_sprite8
#define FUNC_LINEAR_DRAW_SPRITE_EX _linear_draw_sprite_ex8
#define FUNC_LINEAR_DRAW_256_SPRITE _linear_draw_256_sprite8
#define FUNC_LINEAR_DRAW_SPRITE_V_FLIP _linear_draw_sprite_v_flip8
#define FUNC_LINEAR_DRAW_SPRITE_H_FLIP _linear_draw_sprite_h_flip8
#define FUNC_LINEAR_DRAW_SPRITE_VH_FLIP _linear_draw_sprite_vh_flip8
#define FUNC_LINEAR_DRAW_TRANS_SPRITE _linear_draw_trans_sprite8
#define FUNC_LINEAR_DRAW_TRANS_RGBA_SPRITE _linear_draw_trans_rgba_sprite8
#define FUNC_LINEAR_DRAW_LIT_SPRITE _linear_draw_lit_sprite8
#define FUNC_LINEAR_DRAW_CHARACTER _linear_draw_character8
#define FUNC_LINEAR_DRAW_RLE_SPRITE _linear_draw_rle_sprite8
#define FUNC_LINEAR_DRAW_TRANS_RLE_SPRITE _linear_draw_trans_rle_sprite8
#define FUNC_LINEAR_DRAW_TRANS_RGBA_RLE_SPRITE _linear_draw_trans_rgba_rle_sprite8
#define FUNC_LINEAR_DRAW_LIT_RLE_SPRITE _linear_draw_lit_rle_sprite8
#define FUNC_LINEAR_DRAW_SPRITE_END _linear_draw_sprite8_end
#define FUNC_LINEAR_BLIT_END _linear_blit8_end
#define FUNC_POLY_SCANLINE_GCOL _poly_scanline_gcol8
#define FUNC_POLY_SCANLINE_GRGB _poly_scanline_grgb8
#define FUNC_POLY_SCANLINE_ATEX _poly_scanline_atex8
#define FUNC_POLY_SCANLINE_ATEX_MASK _poly_scanline_atex_mask8
#define FUNC_POLY_SCANLINE_ATEX_LIT _poly_scanline_atex_lit8
#define FUNC_POLY_SCANLINE_ATEX_MASK_LIT _poly_scanline_atex_mask_lit8
#define FUNC_POLY_SCANLINE_PTEX _poly_scanline_ptex8
#define FUNC_POLY_SCANLINE_PTEX_MASK _poly_scanline_ptex_mask8
#define FUNC_POLY_SCANLINE_PTEX_LIT _poly_scanline_ptex_lit8
#define FUNC_POLY_SCANLINE_PTEX_MASK_LIT _poly_scanline_ptex_mask_lit8
#define FUNC_POLY_SCANLINE_ATEX_TRANS _poly_scanline_atex_trans8
#define FUNC_POLY_SCANLINE_ATEX_MASK_TRANS _poly_scanline_atex_mask_trans8
#define FUNC_POLY_SCANLINE_PTEX_TRANS _poly_scanline_ptex_trans8
#define FUNC_POLY_SCANLINE_PTEX_MASK_TRANS _poly_scanline_ptex_mask_trans8
#endif /* !__bma_cdefs8_h */

View File

@ -1,263 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Linear graphics functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#ifndef __bma_cgfx_h
#define __bma_cgfx_h
/* _linear_putpixel:
* Draws a pixel onto a linear bitmap.
*/
void FUNC_LINEAR_PUTPIXEL(BITMAP *dst, int dx, int dy, int color)
{
ASSERT(dst);
if (dst->clip && ((dx < dst->cl) || (dx >= dst->cr) || (dy < dst->ct) || (dy >= dst->cb)))
return;
bmp_select(dst);
if (_drawing_mode == DRAW_MODE_SOLID) {
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx);
PUT_PIXEL(d, color);
}
else if (_drawing_mode == DRAW_MODE_XOR) {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(dst, dy), dx);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx);
unsigned long c = GET_PIXEL(s) ^ color;
PUT_PIXEL(d, c);
}
else if (_drawing_mode == DRAW_MODE_TRANS) {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(dst, dy), dx);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx);
PP_BLENDER blender = MAKE_PP_BLENDER(color);
unsigned long c = PP_BLEND(blender, GET_PIXEL(s), color);
PUT_PIXEL(d, c);
}
else {
unsigned long c = GET_PATTERN_PIXEL(dx, dy);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx);
if (_drawing_mode == DRAW_MODE_COPY_PATTERN) {
PUT_PIXEL(d, c);
}
else if (_drawing_mode == DRAW_MODE_SOLID_PATTERN) {
if (!IS_MASK(c)) {
PUT_PIXEL(d, color);
}
else {
PUT_PIXEL(d, c);
}
}
else if (_drawing_mode == DRAW_MODE_MASKED_PATTERN) {
if (!IS_MASK(c)) {
PUT_PIXEL(d, color);
}
}
}
bmp_unwrite_line(dst);
}
/* _linear_getpixel:
* Reads a pixel from a linear bitmap.
*/
int FUNC_LINEAR_GETPIXEL(BITMAP *src, int sx, int sy)
{
ASSERT(src);
if ((sx < 0) || (sx >= src->w) || (sy < 0) || (sy >= src->h))
return -1;
else {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(src, sy), sx);
unsigned long c;
bmp_select(src);
c = GET_PIXEL(s);
bmp_unwrite_line(src);
return c;
}
}
/* _linear_hline:
* Draws a horizontal line onto a linear bitmap.
*/
void FUNC_LINEAR_HLINE(BITMAP *dst, int dx1, int dy, int dx2, int color)
{
int w;
ASSERT(dst);
if (dx1 > dx2) {
int tmp = dx1;
dx1 = dx2;
dx2 = tmp;
}
if (dst->clip) {
if (dx1 < dst->cl)
dx1 = dst->cl;
if (dx2 >= dst->cr)
dx2 = dst->cr - 1;
if ((dx1 > dx2) || (dy < dst->ct) || (dy >= dst->cb))
return;
}
w = dx2 - dx1;
bmp_select(dst);
if (_drawing_mode == DRAW_MODE_SOLID) {
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx1);
do {
PUT_PIXEL(d, color);
INC_PIXEL_PTR(d);
} while (--w >= 0);
}
else if (_drawing_mode == DRAW_MODE_XOR) {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(dst, dy), dx1);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx1);
do {
unsigned long c = GET_PIXEL(s) ^ color;
PUT_PIXEL(d, c);
INC_PIXEL_PTR(s);
INC_PIXEL_PTR(d);
} while (--w >= 0);
}
else if (_drawing_mode == DRAW_MODE_TRANS) {
PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(dst, dy), dx1);
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx1);
PP_BLENDER blender = MAKE_PP_BLENDER(color);
do {
unsigned long c = PP_BLEND(blender, GET_PIXEL(s), color);
PUT_PIXEL(d, c);
INC_PIXEL_PTR(s);
INC_PIXEL_PTR(d);
} while (--w >= 0);
}
else {
int x, curw;
PIXEL_PTR sline = PATTERN_LINE(dy);
PIXEL_PTR s;
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy), dx1);
x = (dx1 - _drawing_x_anchor) & _drawing_x_mask;
s = OFFSET_PIXEL_PTR(sline, x);
w++;
curw = _drawing_x_mask + 1 - x;
if (curw > w)
curw = w;
if (_drawing_mode == DRAW_MODE_COPY_PATTERN) {
do {
w -= curw;
do {
unsigned long c = GET_MEMORY_PIXEL(s);
PUT_PIXEL(d, c);
INC_PIXEL_PTR(s);
INC_PIXEL_PTR(d);
} while (--curw > 0);
s = sline;
curw = MIN(w, (int)_drawing_x_mask+1);
} while (curw > 0);
}
else if (_drawing_mode == DRAW_MODE_SOLID_PATTERN) {
do {
w -= curw;
do {
unsigned long c = GET_MEMORY_PIXEL(s);
if (!IS_MASK(c)) {
PUT_PIXEL(d, color);
}
else {
PUT_PIXEL(d, c);
}
INC_PIXEL_PTR(s);
INC_PIXEL_PTR(d);
} while (--curw > 0);
s = sline;
curw = MIN(w, (int)_drawing_x_mask+1);
} while (curw > 0);
}
else if (_drawing_mode == DRAW_MODE_MASKED_PATTERN) {
do {
w -= curw;
do {
unsigned long c = GET_MEMORY_PIXEL(s);
if (!IS_MASK(c)) {
PUT_PIXEL(d, color);
}
INC_PIXEL_PTR(s);
INC_PIXEL_PTR(d);
} while (--curw > 0);
s = sline;
curw = MIN(w, (int)_drawing_x_mask+1);
} while (curw > 0);
}
}
bmp_unwrite_line(dst);
}
/* _linear_vline:
* Draws a vertical line onto a linear bitmap.
*/
void FUNC_LINEAR_VLINE(BITMAP *dst, int dx, int dy1, int dy2, int color)
{
int y;
ASSERT(dst);
if (dy1 > dy2) {
int tmp = dy1;
dy1 = dy2;
dy2 = tmp;
}
if (dst->clip) {
if (dy1 < dst->ct)
dy1 = dst->ct;
if (dy2 >= dst->cb)
dy2 = dst->cb - 1;
if ((dx < dst->cl) || (dx >= dst->cr) || (dy1 > dy2))
return;
}
if (_drawing_mode == DRAW_MODE_SOLID) {
bmp_select(dst);
for (y = dy1; y <= dy2; y++) {
PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, y), dx);
PUT_PIXEL(d, color);
}
bmp_unwrite_line(dst);
}
else {
int clip = dst->clip;
dst->clip = 0;
for (y = dy1; y <= dy2; y++) {
FUNC_LINEAR_PUTPIXEL(dst, dx, y, color);
}
dst->clip = clip;
}
}
#endif /* !__bma_cgfx_h */

View File

@ -1,27 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 15 bit color linear graphics functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#ifdef ALLEGRO_COLOR16
#include "allegro/internal/aintern.h"
#include "cdefs15.h"
#include "cgfx.h"
#endif

View File

@ -1,27 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* 16 bit color linear graphics functions.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#ifdef ALLEGRO_COLOR16
#include "allegro/internal/aintern.h"
#include "cdefs16.h"
#include "cgfx.h"
#endif

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